From ce647d4423c49ac42585a6a3dc5f272fc0942a70 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 20 Jun 2022 19:52:31 +0200 Subject: [PATCH] v2.0-alpha --- README.md | 4 +- adminPanel/src/api.js | 2 +- adminPanel/src/elements/header.js | 4 +- adminPanel/src/views/logs.js | 2 +- adminPanel/src/views/users.js | 24 +- cli.php | 103 ++-- core/Api/ApiKeyAPI.class.php | 100 ++-- core/Api/ContactAPI.class.php | 85 ++- core/Api/GroupsAPI.class.php | 72 +-- core/Api/LanguageAPI.class.php | 78 ++- core/Api/LogsAPI.class.php | 28 +- core/Api/MailAPI.class.php | 59 ++- core/Api/NewsAPI.class.php | 140 ++--- core/Api/NotificationsAPI.class.php | 139 ++--- core/Api/PermissionAPI.class.php | 73 ++- core/Api/Request.class.php | 43 +- core/Api/RoutesAPI.class.php | 96 ++-- core/Api/SettingsAPI.class.php | 25 +- core/Api/Stats.class.php | 18 +- core/Api/Swagger.class.php | 21 +- core/Api/TemplateAPI.class.php | 12 +- core/Api/TfaAPI.class.php | 117 +++-- core/Api/UserAPI.class.php | 496 +++++++++--------- core/Api/VerifyCaptcha.class.php | 8 +- core/Api/VisitorsAPI.class.php | 20 +- core/Configuration/CreateDatabase.class.php | 167 ++---- .../Patch/EntityLog_2021_04_08.class.php | 18 +- .../Patch/SystemLog_2022_03_30.class.php | 8 - core/Configuration/Settings.class.php | 12 +- core/Documents/Account.class.php | 8 +- core/Documents/Admin.class.php | 6 +- core/Documents/Info.class.php | 2 +- core/Documents/Install.class.php | 102 ++-- core/Driver/Logger/Logger.class.php | 13 +- core/Driver/SQL/Query/Select.class.php | 10 + core/Driver/SQL/SQL.class.php | 32 +- core/Elements/Document.class.php | 15 +- core/Elements/HtmlDocument.class.php | 4 +- core/Elements/TemplateDocument.class.php | 13 +- core/Elements/View.class.php | 5 +- core/Objects/Context.class.php | 202 +++++++ core/Objects/DatabaseEntity/ApiKey.class.php | 27 + .../Attribute/DefaultValue.class.php | 21 + .../DatabaseEntity/Attribute/Enum.class.php | 17 + .../DatabaseEntity/Attribute/Json.class.php | 7 + .../DatabaseEntity/Attribute/Many.class.php | 16 + .../Attribute/MaxLength.class.php | 15 + .../Attribute/Transient.class.php | 7 + .../DatabaseEntity/Attribute/Unique.class.php | 7 + .../DatabaseEntity/DatabaseEntity.class.php | 53 +- .../DatabaseEntity/DatabaseEntityHandler.php | 286 +++++++--- .../DatabaseEntityQuery.class.php | 135 +++++ .../{ => DatabaseEntity}/GpgKey.class.php | 67 ++- core/Objects/DatabaseEntity/Group.class.php | 23 + .../Objects/DatabaseEntity/Language.class.php | 103 ++++ core/Objects/DatabaseEntity/News.class.php | 30 ++ .../DatabaseEntity/Notification.class.php | 30 ++ core/Objects/DatabaseEntity/Session.class.php | 134 +++++ .../DatabaseEntity/SystemLog.class.php | 31 ++ .../DatabaseEntity/TwoFactorToken.class.php | 78 +++ core/Objects/DatabaseEntity/User.class.php | 109 ++++ core/Objects/Language.class.php | 139 ----- core/Objects/Router/ApiRoute.class.php | 11 +- core/Objects/Router/Router.class.php | 25 +- core/Objects/Router/StaticFileRoute.class.php | 4 +- core/Objects/Session.class.php | 164 ------ .../KeyBasedTwoFactorToken.class.php | 15 +- .../TimeBasedTwoFactorToken.class.php | 25 +- .../TwoFactor/TwoFactorToken.class.php | 62 --- core/Objects/User.class.php | 376 ------------- core/core.php | 13 +- docker/php/Dockerfile | 2 +- index.php | 22 +- js/admin.min.js | 2 +- test/DatabaseEntity.test.php | 39 +- test/Request.test.php | 52 +- test/Router.test.php | 11 +- test/TimeBasedTwoFactorToken.test.php | 13 +- 78 files changed, 2474 insertions(+), 2083 deletions(-) create mode 100644 core/Objects/Context.class.php create mode 100644 core/Objects/DatabaseEntity/ApiKey.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/Enum.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/Json.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/Many.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/MaxLength.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/Transient.class.php create mode 100644 core/Objects/DatabaseEntity/Attribute/Unique.class.php create mode 100644 core/Objects/DatabaseEntity/DatabaseEntityQuery.class.php rename core/Objects/{ => DatabaseEntity}/GpgKey.class.php (73%) create mode 100644 core/Objects/DatabaseEntity/Group.class.php create mode 100644 core/Objects/DatabaseEntity/Language.class.php create mode 100644 core/Objects/DatabaseEntity/News.class.php create mode 100644 core/Objects/DatabaseEntity/Notification.class.php create mode 100644 core/Objects/DatabaseEntity/Session.class.php create mode 100644 core/Objects/DatabaseEntity/SystemLog.class.php create mode 100644 core/Objects/DatabaseEntity/TwoFactorToken.class.php create mode 100644 core/Objects/DatabaseEntity/User.class.php delete mode 100644 core/Objects/Language.class.php delete mode 100644 core/Objects/Session.class.php delete mode 100644 core/Objects/TwoFactor/TwoFactorToken.class.php delete mode 100644 core/Objects/User.class.php diff --git a/README.md b/README.md index 00c34c5..6400368 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Each endpoint is represented by a class inheriting the [Request Class](/core/Api ```php namespace Api; use Api\Parameter\Parameter; -use Objects\User; +use Objects\DatabaseEntity\User; class SingleEndpoint extends Request { @@ -108,7 +108,7 @@ Some endpoints are set to private, which means, they can be only accessed inside can be used by creating the desired request object, and calling the execute function with our parameters like shown below: ```php -$req = new \Api\Mail\Send($user); +$req = new \Api\Mail\Send($context); $success = $req->execute(array( "to" => "mail@example.org", "subject" => "Example Mail", diff --git a/adminPanel/src/api.js b/adminPanel/src/api.js index a6f06ee..502c93a 100644 --- a/adminPanel/src/api.js +++ b/adminPanel/src/api.js @@ -92,7 +92,7 @@ export default class API { } async deleteGroup(id) { - return this.apiCall("groups/delete", { uid: id }); + return this.apiCall("groups/delete", { id: id }); } async getSettings(key = "") { diff --git a/adminPanel/src/elements/header.js b/adminPanel/src/elements/header.js index 08c115e..38bac00 100644 --- a/adminPanel/src/elements/header.js +++ b/adminPanel/src/elements/header.js @@ -25,10 +25,10 @@ export default function Header(props) { let notificationItems = []; for (let i = 0; i < parent.notifications.length; i++) { const notification = parent.notifications[i]; - const uid = notification.uid; + const id = notification.id; const createdAt = getPeriodString(notification["created_at"]); notificationItems.push( - + {mailIcon} {notification.title} {createdAt} diff --git a/adminPanel/src/views/logs.js b/adminPanel/src/views/logs.js index 2cd12d1..6fab2d8 100644 --- a/adminPanel/src/views/logs.js +++ b/adminPanel/src/views/logs.js @@ -83,7 +83,7 @@ export default class Logs extends React.Component { for (let event of dates[date]) { let timeString = moment(event.timestamp).fromNow(); elements.push( -
+
{timeString} diff --git a/adminPanel/src/views/users.js b/adminPanel/src/views/users.js index bbffce0..4aa7343 100644 --- a/adminPanel/src/views/users.js +++ b/adminPanel/src/views/users.js @@ -161,12 +161,12 @@ export default class UserOverview extends React.Component { createUserCard() { let userRows = []; - for (let uid in this.state.users.data) { - if (!this.state.users.data.hasOwnProperty(uid)) { + for (let id in this.state.users.data) { + if (!this.state.users.data.hasOwnProperty(id)) { continue; } - let user = this.state.users.data[uid]; + let user = this.state.users.data[id]; let confirmedIcon = ; let groups = []; @@ -184,7 +184,7 @@ export default class UserOverview extends React.Component { } userRows.push( - + {user.name} {user.email} {groups} @@ -197,7 +197,7 @@ export default class UserOverview extends React.Component { {confirmedIcon} - + @@ -291,15 +291,15 @@ export default class UserOverview extends React.Component { createGroupCard() { let groupRows = []; - for (let uid in this.state.groups.data) { - if (!this.state.groups.data.hasOwnProperty(uid)) { + for (let id in this.state.groups.data) { + if (!this.state.groups.data.hasOwnProperty(id)) { continue; } - let group = this.state.groups.data[uid]; + let group = this.state.groups.data[id]; groupRows.push( - + {group.name} {group["memberCount"]} @@ -309,7 +309,7 @@ export default class UserOverview extends React.Component { this.onDeleteGroup(e, uid)} data-effect={"solid"} + onClick={(e) => this.onDeleteGroup(e, id)} data-effect={"solid"} data-tip={"Delete"} data-type={"error"} data-place={"bottom"}/> @@ -395,11 +395,11 @@ export default class UserOverview extends React.Component {
; } - onDeleteGroup(e, uid) { + onDeleteGroup(e, id) { e.stopPropagation(); this.parent.showDialog("Are you really sure you want to delete this group?", "Delete Group?", ["Yes", "No"], (btn) => { if (btn === "Yes") { - this.parent.api.deleteGroup(uid).then((res) => { + this.parent.api.deleteGroup(id).then((res) => { if (!res.success) { let errors = this.state.errors.slice(); errors.push({title: "Error deleting group", message: res.msg}); diff --git a/cli.php b/cli.php index 3a17261..a8dae81 100644 --- a/cli.php +++ b/cli.php @@ -6,14 +6,13 @@ include_once 'core/core.php'; require_once 'core/datetime.php'; include_once 'core/constants.php'; -use Configuration\Configuration; use Configuration\DatabaseScript; use Driver\SQL\Column\Column; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\CondIn; use Driver\SQL\Expression\DateSub; +use Driver\SQL\SQL; use Objects\ConnectionData; -use Objects\User; function printLine(string $line = "") { echo $line . PHP_EOL; @@ -24,10 +23,6 @@ function _exit(string $line = "") { die(); } -if (!is_cli()) { - _exit("Can only be executed via CLI"); -} - function getDatabaseConfig(): ConnectionData { $configClass = "\\Configuration\\Database"; $file = getClassPath($configClass); @@ -39,8 +34,12 @@ function getDatabaseConfig(): ConnectionData { return new $configClass(); } -$config = new Configuration(); -$database = $config->getDatabase(); +$context = new \Objects\Context(); +if (!$context->isCLI()) { + _exit("Can only be executed via CLI"); +} + +$database = $context->getConfig()->getDatabase(); if ($database !== null && $database->getProperty("isDocker", false) && !is_file("/.dockerenv")) { if (count($argv) < 3 || $argv[1] !== "db" || !in_array($argv[2], ["shell", "import", "export"])) { $command = array_merge(["docker", "exec", "-it", "php", "php"], $argv); @@ -49,7 +48,7 @@ if ($database !== null && $database->getProperty("isDocker", false) && !is_file( } } -function getUser(): ?User { +/*function getUser(): ?User { global $config; $user = new User($config); if (!$user->getSQL() || !$user->getSQL()->isConnected()) { @@ -58,6 +57,17 @@ function getUser(): ?User { } return $user; +}*/ + +function connectSQL(): ?SQL { + global $context; + $sql = $context->initSQL(); + if (!$sql || !$sql->isConnected()) { + printLine("Could not establish database connection"); + return null; + } + + return $sql; } function printHelp() { @@ -100,8 +110,7 @@ function handleDatabase(array $argv) { _exit("Usage: cli.php db migrate "); } - $user = getUser() or die(); - $sql = $user->getSQL(); + $sql = connectSQL() or die(); applyPatch($sql, $class); } else if (in_array($action, ["export", "import", "shell"])) { @@ -193,9 +202,7 @@ function handleDatabase(array $argv) { proc_close($process); } } else if ($action === "clean") { - $user = getUser() or die(); - $sql = $user->getSQL(); - + $sql = connectSQL() or die(); printLine("Deleting user related data older than 90 days..."); // 1st: Select all related tables and entities @@ -221,9 +228,9 @@ function handleDatabase(array $argv) { } // 2nd: delete! - foreach ($tables as $table => $uids) { + foreach ($tables as $table => $ids) { $success = $sql->delete($table) - ->where(new CondIn(new Column("uid"), $uids)) + ->where(new CondIn(new Column("id"), $ids)) ->execute(); if (!$success) { @@ -336,9 +343,8 @@ function onMaintenance(array $argv) { $newPatchFiles = array_diff($newPatchFiles, $oldPatchFiles); if (count($newPatchFiles) > 0) { printLine("Applying new database patches"); - $user = getUser(); - if ($user) { - $sql = $user->getSQL(); + $sql = connectSQL(); + if ($sql) { foreach ($newPatchFiles as $patchFile) { if (preg_match("/core\/Configuration\/(Patch\/.*)\.class\.php/", $patchFile, $match)) { $patchName = $match[1]; @@ -408,12 +414,13 @@ function printTable(array $head, array $body) { } function onSettings(array $argv) { - $user = getUser() or die(); + global $context; + $sql = connectSQL() or die(); $action = $argv[2] ?? "list"; if ($action === "list" || $action === "get") { $key = (($action === "list" || count($argv) < 4) ? null : $argv[3]); - $req = new Api\Settings\Get($user); + $req = new Api\Settings\Get($context); $success = $req->execute(["key" => $key]); if (!$success) { _exit("Error listings settings: " . $req->getLastError()); @@ -430,7 +437,7 @@ function onSettings(array $argv) { } else { $key = $argv[3]; $value = $argv[4]; - $req = new Api\Settings\Set($user); + $req = new Api\Settings\Set($context); $success = $req->execute(["settings" => [$key => $value]]); if (!$success) { _exit("Error updating settings: " . $req->getLastError()); @@ -441,7 +448,7 @@ function onSettings(array $argv) { _exit("Usage: $argv[0] settings $argv[2] "); } else { $key = $argv[3]; - $req = new Api\Settings\Set($user); + $req = new Api\Settings\Set($context); $success = $req->execute(["settings" => [$key => null]]); if (!$success) { _exit("Error updating settings: " . $req->getLastError()); @@ -453,18 +460,18 @@ function onSettings(array $argv) { } function onRoutes(array $argv) { - - $user = getUser() or die(); + global $context; + $sql = connectSQL() or die(); $action = $argv[2] ?? "list"; if ($action === "list") { - $req = new Api\Routes\Fetch($user); + $req = new Api\Routes\Fetch($context); $success = $req->execute(); if (!$success) { _exit("Error fetching routes: " . $req->getLastError()); } else { $routes = $req->getResult()["routes"]; - $head = ["uid", "request", "action", "target", "extra", "active", "exact"]; + $head = ["id", "request", "action", "target", "extra", "active", "exact"]; // strict boolean foreach ($routes as &$route) { @@ -486,7 +493,7 @@ function onRoutes(array $argv) { "extra" => $argv[7] ?? "", ); - $req = new Api\Routes\Add($user); + $req = new Api\Routes\Add($context); $success = $req->execute($params); if (!$success) { _exit($req->getLastError()); @@ -497,13 +504,13 @@ function onRoutes(array $argv) { $uid = $argv[3] ?? null; if ($uid === null || ($action === "modify" && count($argv) < 7)) { if ($action === "modify") { - _exit("Usage: cli.php routes $action [extra]"); + _exit("Usage: cli.php routes $action [extra]"); } else { - _exit("Usage: cli.php routes $action "); + _exit("Usage: cli.php routes $action "); } } - $params = ["uid" => $uid]; + $params = ["id" => $uid]; if ($action === "remove") { $input = null; do { @@ -513,13 +520,13 @@ function onRoutes(array $argv) { echo "Remove route #$uid? (y|n): "; } while(($input = trim(fgets(STDIN))) !== "y"); - $req = new Api\Routes\Remove($user); + $req = new Api\Routes\Remove($context); } else if ($action === "enable") { - $req = new Api\Routes\Enable($user); + $req = new Api\Routes\Enable($context); } else if ($action === "disable") { - $req = new Api\Routes\Disable($user); + $req = new Api\Routes\Disable($context); } else if ($action === "modify") { - $req = new Api\Routes\Update($user); + $req = new Api\Routes\Update($context); $params["request"] = $argv[4]; $params["action"] = $argv[5]; $params["target"] = $argv[6]; @@ -597,14 +604,15 @@ function onTest($argv) { } function onMail($argv) { + global $context; $action = $argv[2] ?? null; if ($action === "sync") { - $user = getUser() or die(); - if (!$user->getConfiguration()->getSettings()->isMailEnabled()) { + $sql = connectSQL() or die(); + if (!$context->getSettings()->isMailEnabled()) { _exit("Mails are not configured yet."); } - $req = new Api\Mail\Sync($user); + $req = new Api\Mail\Sync($context); printLine("Syncing emails…"); if (!$req->execute()) { _exit("Error syncing mails: " . $req->getLastError()); @@ -612,8 +620,8 @@ function onMail($argv) { _exit("Done."); } else if ($action === "send_queue") { - $user = getUser() or die(); - $req = new \Api\Mail\SendQueue($user); + $sql = connectSQL() or die(); + $req = new \Api\Mail\SendQueue($context); $debug = in_array("debug", $argv); if (!$req->execute(["debug" => $debug])) { _exit("Error processing mail queue: " . $req->getLastError()); @@ -624,30 +632,31 @@ function onMail($argv) { } function onImpersonate($argv) { + global $context; + if (count($argv) < 3) { _exit("Usage: cli.php impersonate "); } - $user = getUser() or exit; + $sql = connectSQL() or die(); $userId = $argv[2]; if (!is_numeric($userId)) { - $sql = $user->getSQL(); - $res = $sql->select("uid") + $res = $sql->select("id") ->from("User") ->where(new Compare("name", $userId)) ->execute(); if ($res === false) { _exit("SQL error: " . $sql->getLastError()); } else { - $userId = $res[0]["uid"]; + $userId = $res[0]["id"]; } } - $user->createSession(intval($userId)); - $session = $user->getSession(); + $user = new \Objects\DatabaseEntity\User($userId); + $session = new \Objects\DatabaseEntity\Session($context, $user); $session->setData(["2faAuthenticated" => true]); - $session->update(false); + $session->update(); echo "session=" . $session->getCookie() . PHP_EOL; } diff --git a/core/Api/ApiKeyAPI.class.php b/core/Api/ApiKeyAPI.class.php index a7328de..852695f 100644 --- a/core/Api/ApiKeyAPI.class.php +++ b/core/Api/ApiKeyAPI.class.php @@ -3,15 +3,20 @@ namespace Api { use Driver\SQL\Condition\Compare; + use Objects\Context; abstract class ApiKeyAPI extends Request { - protected function apiKeyExists($id): bool { - $sql = $this->user->getSQL(); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } + + protected function apiKeyExists(int $id): bool { + $sql = $this->context->getSQL(); $res = $sql->select($sql->count()) ->from("ApiKey") - ->where(new Compare("uid", $id)) - ->where(new Compare("user_id", $this->user->getId())) + ->where(new Compare("id", $id)) + ->where(new Compare("user_id", $this->context->getUser()->getId())) ->where(new Compare("valid_until", $sql->currentTimestamp(), ">")) ->where(new Compare("active", 1)) ->execute(); @@ -32,37 +37,32 @@ namespace Api\ApiKey { use Api\ApiKeyAPI; use Api\Parameter\Parameter; - use Api\Request; - use DateTime; use Driver\SQL\Condition\Compare; - use Exception; + use Driver\SQL\Condition\CondAnd; + use Objects\Context; + use Objects\DatabaseEntity\ApiKey; class Create extends ApiKeyAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array()); $this->apiKeyAllowed = false; $this->loginRequired = true; } public function _execute(): bool { - $apiKey = generateRandomString(64); - $sql = $this->user->getSQL(); - $validUntil = (new \DateTime())->modify("+30 DAY"); + $sql = $this->context->getSQL(); - $this->success = $sql->insert("ApiKey", array("user_id", "api_key", "valid_until")) - ->addRow($this->user->getId(), $apiKey, $validUntil) - ->returning("uid") - ->execute(); + $apiKey = new ApiKey(); + $apiKey->apiKey = generateRandomString(64); + $apiKey->validUntil = (new \DateTime())->modify("+30 DAY"); + $apiKey->user = $this->context->getUser(); + $this->success = $apiKey->save($sql); $this->lastError = $sql->getLastError(); if ($this->success) { - $this->result["api_key"] = array( - "api_key" => $apiKey, - "valid_until" => $validUntil->format("Y-m-d H:i:s"), - "uid" => $sql->getLastInsertId(), - ); + $this->result["api_key"] = $apiKey->jsonSerialize(); } return $this->success; @@ -71,39 +71,33 @@ namespace Api\ApiKey { class Fetch extends ApiKeyAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( "showActiveOnly" => new Parameter("showActiveOnly", Parameter::TYPE_BOOLEAN, true, true) )); $this->loginRequired = true; } public function _execute(): bool { - $sql = $this->user->getSQL(); - $query = $sql->select("uid", "api_key", "valid_until", "active") - ->from("ApiKey") - ->where(new Compare("user_id", $this->user->getId())); + $sql = $this->context->getSQL(); + $condition = new Compare("user_id", $this->context->getUser()->getId()); if ($this->getParam("showActiveOnly")) { - $query->where(new Compare("valid_until", $sql->currentTimestamp(), ">")) - ->where(new Compare("active", true)); + $condition = new CondAnd( + $condition, + new Compare("valid_until", $sql->currentTimestamp(), ">"), + new Compare("active", true) + ); } - $res = $query->execute(); - - $this->success = ($res !== FALSE); + $apiKeys = ApiKey::findAll($sql, $condition); + $this->success = ($apiKeys !== FALSE); $this->lastError = $sql->getLastError(); - if($this->success) { + if ($this->success) { $this->result["api_keys"] = array(); - foreach($res as $row) { - $apiKeyId = intval($row["uid"]); - $this->result["api_keys"][$apiKeyId] = array( - "id" => $apiKeyId, - "api_key" => $row["api_key"], - "valid_until" => $row["valid_until"], - "revoked" => !$sql->parseBool($row["active"]) - ); + foreach($apiKeys as $apiKey) { + $this->result["api_keys"][$apiKey->getId()] = $apiKey->jsonSerialize(); } } @@ -113,8 +107,8 @@ namespace Api\ApiKey { class Refresh extends ApiKeyAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( "id" => new Parameter("id", Parameter::TYPE_INT), )); $this->loginRequired = true; @@ -122,15 +116,16 @@ namespace Api\ApiKey { public function _execute(): bool { $id = $this->getParam("id"); - if(!$this->apiKeyExists($id)) + if (!$this->apiKeyExists($id)) { return false; + } $validUntil = (new \DateTime)->modify("+30 DAY"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("ApiKey") ->set("valid_until", $validUntil) - ->where(new Compare("uid", $id)) - ->where(new Compare("user_id", $this->user->getId())) + ->where(new Compare("id", $id)) + ->where(new Compare("user_id", $this->context->getUser()->getId())) ->execute(); $this->lastError = $sql->getLastError(); @@ -153,20 +148,19 @@ namespace Api\ApiKey { public function _execute(): bool { $id = $this->getParam("id"); - if (!$this->apiKeyExists($id)) + if (!$this->apiKeyExists($id)) { return false; + } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("ApiKey") ->set("active", false) - ->where(new Compare("uid", $id)) - ->where(new Compare("user_id", $this->user->getId())) + ->where(new Compare("id", $id)) + ->where(new Compare("user_id", $this->context->getUser()->getId())) ->execute(); $this->lastError = $sql->getLastError(); return $this->success; } } - - } \ No newline at end of file diff --git a/core/Api/ContactAPI.class.php b/core/Api/ContactAPI.class.php index 599a3ac..e60a00d 100644 --- a/core/Api/ContactAPI.class.php +++ b/core/Api/ContactAPI.class.php @@ -2,21 +2,20 @@ namespace Api { - use Objects\User; + use Objects\Context; abstract class ContactAPI extends Request { protected ?string $messageId; - public function __construct(User $user, bool $externalCall, array $params) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall, array $params) { + parent::__construct($context, $externalCall, $params); $this->messageId = null; $this->csrfTokenRequired = false; - } protected function sendMail(string $name, ?string $fromEmail, string $subject, string $message, ?string $to = null): bool { - $request = new \Api\Mail\Send($this->user); + $request = new \Api\Mail\Send($this->context); $this->success = $request->execute(array( "subject" => $subject, "body" => $message, @@ -45,30 +44,30 @@ namespace Api\Contact { use Driver\SQL\Condition\CondNot; use Driver\SQL\Expression\CaseWhen; use Driver\SQL\Expression\Sum; - use Objects\User; + use Objects\Context; class Request extends ContactAPI { - public function __construct(User $user, bool $externalCall = false) { + public function __construct(Context $context, bool $externalCall = false) { $parameters = array( 'fromName' => new StringType('fromName', 32), 'fromEmail' => new Parameter('fromEmail', Parameter::TYPE_EMAIL), 'message' => new StringType('message', 512), ); - $settings = $user->getConfiguration()->getSettings(); + $settings = $context->getSettings(); if ($settings->isRecaptchaEnabled()) { $parameters["captcha"] = new StringType("captcha"); } - parent::__construct($user, $externalCall, $parameters); + parent::__construct($context, $externalCall, $parameters); } public function _execute(): bool { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); if ($settings->isRecaptchaEnabled()) { $captcha = $this->getParam("captcha"); - $req = new VerifyCaptcha($this->user); + $req = new VerifyCaptcha($this->context); if (!$req->execute(array("captcha" => $captcha, "action" => "contact"))) { return $this->createError($req->getLastError()); } @@ -80,23 +79,7 @@ namespace Api\Contact { $email = $this->getParam("fromEmail"); $sendMail = $this->sendMail($name, $email, "Contact Request", $message); - $mailError = $this->getLastError(); - $insertDB = $this->insertContactRequest(); - $dbError = $this->getLastError(); - - // Create a log entry - if (!$sendMail || $mailError) { - $message = "Error processing contact request."; - if (!$sendMail) { - $message .= " Mail: $mailError"; - } - - if (!$insertDB) { - $message .= " Mail: $dbError"; - } - } - if (!$sendMail && !$insertDB) { return $this->createError("The contact request could not be sent. The Administrator is already informed. Please try again later."); } @@ -105,7 +88,7 @@ namespace Api\Contact { } private function insertContactRequest(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $name = $this->getParam("fromName"); $email = $this->getParam("fromEmail"); $message = $this->getParam("message"); @@ -113,7 +96,7 @@ namespace Api\Contact { $res = $sql->insert("ContactRequest", array("from_name", "from_email", "message", "messageId")) ->addRow($name, $email, $message, $messageId) - ->returning("uid") + ->returning("id") ->execute(); $this->success = ($res !== FALSE); @@ -124,21 +107,20 @@ namespace Api\Contact { class Respond extends ContactAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "requestId" => new Parameter("requestId", Parameter::TYPE_INT), 'message' => new StringType('message', 512), )); $this->loginRequired = true; - $this->csrfTokenRequired = false; } private function getSenderMail(): ?string { $requestId = $this->getParam("requestId"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("from_email") ->from("ContactRequest") - ->where(new Compare("uid", $requestId)) + ->where(new Compare("id", $requestId)) ->execute(); $this->success = ($res !== false); @@ -156,12 +138,12 @@ namespace Api\Contact { } private function insertResponseMessage(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $message = $this->getParam("message"); $requestId = $this->getParam("requestId"); $this->success = $sql->insert("ContactMessage", ["request_id", "user_id", "message", "messageId", "read"]) - ->addRow($requestId, $this->user->getId(), $message, $this->messageId, true) + ->addRow($requestId, $this->context->getUser()->getId(), $message, $this->messageId, true) ->execute(); $this->lastError = $sql->getLastError(); @@ -169,7 +151,7 @@ namespace Api\Contact { } private function updateEntity() { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $requestId = $this->getParam("requestId"); $sql->update("EntityLog") @@ -185,8 +167,9 @@ namespace Api\Contact { return false; } - $fromName = $this->user->getUsername(); - $fromEmail = $this->user->getEmail(); + $user = $this->context->getUser(); + $fromName = $user->getUsername(); + $fromEmail = $user->getEmail(); if (!$this->sendMail($fromName, $fromEmail, "Re: Contact Request", $message, $senderMail)) { return false; @@ -203,19 +186,19 @@ namespace Api\Contact { class Fetch extends ContactAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array()); $this->loginRequired = true; $this->csrfTokenRequired = false; } public function _execute(): bool { - $sql = $this->user->getSQL(); - $res = $sql->select("ContactRequest.uid", "from_name", "from_email", "from_name", + $sql = $this->context->getSQL(); + $res = $sql->select("ContactRequest.id", "from_name", "from_email", "from_name", new Sum(new CaseWhen(new CondNot("ContactMessage.read"), 1, 0), "unread")) ->from("ContactRequest") - ->groupBy("ContactRequest.uid") - ->leftJoin("ContactMessage", "ContactRequest.uid", "ContactMessage.request_id") + ->groupBy("ContactRequest.id") + ->leftJoin("ContactMessage", "ContactRequest.id", "ContactMessage.request_id") ->execute(); $this->success = ($res !== false); @@ -225,7 +208,7 @@ namespace Api\Contact { $this->result["contactRequests"] = []; foreach ($res as $row) { $this->result["contactRequests"][] = array( - "uid" => intval($row["uid"]), + "id" => intval($row["id"]), "from_name" => $row["from_name"], "from_email" => $row["from_email"], "unread" => intval($row["unread"]), @@ -239,8 +222,8 @@ namespace Api\Contact { class Get extends ContactAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "requestId" => new Parameter("requestId", Parameter::TYPE_INT), )); $this->loginRequired = true; @@ -249,7 +232,7 @@ namespace Api\Contact { private function updateRead() { $requestId = $this->getParam("requestId"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $sql->update("ContactMessage") ->set("read", 1) ->where(new Compare("request_id", $requestId)) @@ -258,11 +241,11 @@ namespace Api\Contact { public function _execute(): bool { $requestId = $this->getParam("requestId"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("from_name", "from_email", "message", "created_at") ->from("ContactRequest") - ->where(new Compare("uid", $requestId)) + ->where(new Compare("id", $requestId)) ->execute(); $this->success = ($res !== false); diff --git a/core/Api/GroupsAPI.class.php b/core/Api/GroupsAPI.class.php index 1cdf484..cefc7f3 100644 --- a/core/Api/GroupsAPI.class.php +++ b/core/Api/GroupsAPI.class.php @@ -3,11 +3,16 @@ namespace Api { use Driver\SQL\Condition\Compare; + use Objects\Context; abstract class GroupsAPI extends Request { - protected function groupExists($name) { - $sql = $this->user->getSQL(); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } + + protected function groupExists($name): bool { + $sql = $this->context->getSQL(); $res = $sql->select($sql->count()) ->from("Group") ->where(new Compare("name", $name)) @@ -25,14 +30,15 @@ namespace Api\Groups { use Api\GroupsAPI; use Api\Parameter\Parameter; use Api\Parameter\StringType; - use Driver\SQL\Condition\Compare; + use Objects\Context; + use Objects\DatabaseEntity\Group; class Fetch extends GroupsAPI { private int $groupCount; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'page' => new Parameter('page', Parameter::TYPE_INT, true, 1), 'count' => new Parameter('count', Parameter::TYPE_INT, true, 20) )); @@ -40,9 +46,9 @@ namespace Api\Groups { $this->groupCount = 0; } - private function getGroupCount() { + private function fetchGroupCount(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count())->from("Group")->execute(); $this->success = ($res !== FALSE); $this->lastError = $sql->getLastError(); @@ -65,16 +71,16 @@ namespace Api\Groups { return $this->createError("Invalid fetch count"); } - if (!$this->getGroupCount()) { + if (!$this->fetchGroupCount()) { return false; } - $sql = $this->user->getSQL(); - $res = $sql->select("Group.uid as groupId", "Group.name as groupName", "Group.color as groupColor", $sql->count("UserGroup.user_id")) + $sql = $this->context->getSQL(); + $res = $sql->select("Group.id as groupId", "Group.name as groupName", "Group.color as groupColor", $sql->count("UserGroup.user_id")) ->from("Group") - ->leftJoin("UserGroup", "UserGroup.group_id", "Group.uid") - ->groupBy("Group.uid") - ->orderBy("Group.uid") + ->leftJoin("UserGroup", "UserGroup.group_id", "Group.id") + ->groupBy("Group.id") + ->orderBy("Group.id") ->ascending() ->limit($count) ->offset(($page - 1) * $count) @@ -105,8 +111,8 @@ namespace Api\Groups { } class Create extends GroupsAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'name' => new StringType('name', 32), 'color' => new StringType('color', 10), )); @@ -130,17 +136,17 @@ namespace Api\Groups { return $this->createError("A group with this name already exists"); } - $sql = $this->user->getSQL(); - $res = $sql->insert("Group", array("name", "color")) - ->addRow($name, $color) - ->returning("uid") - ->execute(); + $sql = $this->context->getSQL(); - $this->success = ($res !== FALSE); + $group = new Group(); + $group->name = $name; + $group->color = $color; + + $this->success = ($group->save($sql) !== FALSE); $this->lastError = $sql->getLastError(); if ($this->success) { - $this->result["uid"] = $sql->getLastInsertId(); + $this->result["id"] = $group->getId(); } return $this->success; @@ -148,33 +154,29 @@ namespace Api\Groups { } class Delete extends GroupsAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( - 'uid' => new Parameter('uid', Parameter::TYPE_INT) + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( + 'id' => new Parameter('id', Parameter::TYPE_INT) )); } public function _execute(): bool { - $id = $this->getParam("uid"); + $id = $this->getParam("id"); if (in_array($id, DEFAULT_GROUPS)) { return $this->createError("You cannot delete a default group."); } - $sql = $this->user->getSQL(); - $res = $sql->select($sql->count()) - ->from("Group") - ->where(new Compare("uid", $id)) - ->execute(); + $sql = $this->context->getSQL(); + $group = Group::find($sql, $id); - $this->success = ($res !== FALSE); + $this->success = ($group !== FALSE); $this->lastError = $sql->getLastError(); - if ($this->success && $res[0]["count"] === 0) { + if ($this->success && $group === null) { return $this->createError("This group does not exist."); } - $res = $sql->delete("Group")->where(new Compare("uid", $id))->execute(); - $this->success = ($res !== FALSE); + $this->success = ($group->delete($sql) !== FALSE); $this->lastError = $sql->getLastError(); return $this->success; } diff --git a/core/Api/LanguageAPI.class.php b/core/Api/LanguageAPI.class.php index fab8d17..af07fd6 100644 --- a/core/Api/LanguageAPI.class.php +++ b/core/Api/LanguageAPI.class.php @@ -2,10 +2,13 @@ namespace Api { + use Objects\Context; + abstract class LanguageAPI extends Request { - + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } } - } namespace Api\Language { @@ -15,30 +18,28 @@ namespace Api\Language { use Api\Parameter\StringType; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\CondOr; - use Objects\Language; + use Objects\Context; + use Objects\DatabaseEntity\Language; class Get extends LanguageAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array()); } public function _execute(): bool { - $sql = $this->user->getSQL(); - $res = $sql->select("uid", "code", "name") - ->from("Language") - ->execute(); - - $this->success = ($res !== FALSE); + $sql = $this->context->getSQL(); + $languages = Language::findAll($sql); + $this->success = ($languages !== null); $this->lastError = $sql->getLastError(); - if($this->success) { - $this->result['languages'] = array(); - if(empty($res) === 0) { + if ($this->success) { + $this->result['languages'] = []; + if (count($languages) === 0) { $this->lastError = L("No languages found"); } else { - foreach($res as $row) { - $this->result['languages'][$row['uid']] = $row; + foreach ($languages as $language) { + $this->result['languages'][$language->getId()] = $language->jsonSerialize(); } } } @@ -51,70 +52,65 @@ namespace Api\Language { private Language $language; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'langId' => new Parameter('langId', Parameter::TYPE_INT, true, NULL), 'langCode' => new StringType('langCode', 5, true, NULL), )); } - private function checkLanguage() { + private function checkLanguage(): bool { $langId = $this->getParam("langId"); $langCode = $this->getParam("langCode"); - if(is_null($langId) && is_null($langCode)) { + if (is_null($langId) && is_null($langCode)) { return $this->createError(L("Either langId or langCode must be given")); } - $res = $this->user->getSQL() - ->select("uid", "code", "name") - ->from("Language") - ->where(new CondOr(new Compare("uid", $langId), new Compare("code", $langCode))) - ->execute(); + $sql = $this->context->getSQL(); + $languages = Language::findAll($sql, + new CondOr(new Compare("id", $langId), new Compare("code", $langCode)) + ); - $this->success = ($res !== FALSE); - $this->lastError = $this->user->getSQL()->getLastError(); + $this->success = ($languages !== null); + $this->lastError = $sql->getLastError(); if ($this->success) { - if(count($res) == 0) { + if (count($languages) === 0) { return $this->createError(L("This Language does not exist")); } else { - $row = $res[0]; - $this->language = Language::newInstance($row['uid'], $row['code'], $row['name']); - if(!$this->language) { - return $this->createError(L("Error while loading language")); - } + $this->language = array_shift($languages); } } return $this->success; } - private function updateLanguage() { + private function updateLanguage(): bool { $languageId = $this->language->getId(); - $userId = $this->user->getId(); - $sql = $this->user->getSQL(); + $userId = $this->context->getUser()->getId(); + $sql = $this->context->getSQL(); $this->success = $sql->update("User") ->set("language_id", $languageId) - ->where(new Compare("uid", $userId)) + ->where(new Compare("id", $userId)) ->execute(); + $this->lastError = $sql->getLastError(); return $this->success; } public function _execute(): bool { - if(!$this->checkLanguage()) + if (!$this->checkLanguage()) return false; - if($this->user->isLoggedIn()) { + if ($this->context->getSession()) { $this->updateLanguage(); } - $this->user->setLanguage($this->language); + $this->context->setLanguage($this->language); return $this->success; } } - } \ No newline at end of file diff --git a/core/Api/LogsAPI.class.php b/core/Api/LogsAPI.class.php index 5f20d58..21df92b 100644 --- a/core/Api/LogsAPI.class.php +++ b/core/Api/LogsAPI.class.php @@ -2,11 +2,11 @@ namespace Api { - use Objects\User; + use Objects\Context; abstract class LogsAPI extends Request { - public function __construct(User $user, bool $externalCall = false, array $params = array()) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); } } @@ -21,20 +21,22 @@ namespace Api\Logs { use Driver\SQL\Column\Column; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\CondIn; - use Objects\User; + use Objects\Context; + use Objects\DatabaseEntity\SystemLog; class Get extends LogsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "since" => new Parameter("since", Parameter::TYPE_DATE_TIME, true), "severity" => new StringType("severity", 32, true, "debug") ]); + $this->csrfTokenRequired = false; } protected function _execute(): bool { $since = $this->getParam("since"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $severity = strtolower(trim($this->getParam("severity"))); $shownLogLevels = Logger::LOG_LEVELS; @@ -45,8 +47,7 @@ namespace Api\Logs { $shownLogLevels = array_slice(Logger::LOG_LEVELS, $logLevel); } - $query = $sql->select("id", "module", "message", "severity", "timestamp") - ->from("SystemLog") + $query = SystemLog::findAllBuilder($sql) ->orderBy("timestamp") ->descending(); @@ -58,12 +59,15 @@ namespace Api\Logs { $query->where(new CondIn(new Column("severity"), $shownLogLevels)); } - $res = $query->execute(); - $this->success = $res !== false; + $logEntries = $query->execute(); + $this->success = $logEntries !== false; $this->lastError = $sql->getLastError(); if ($this->success) { - $this->result["logs"] = $res; + $this->result["logs"] = []; + foreach ($logEntries as $logEntry) { + $this->result["logs"][] = $logEntry->jsonSerialize(); + } } else { // we couldn't fetch logs from database, return a message and proceed to log files $this->result["logs"] = [ diff --git a/core/Api/MailAPI.class.php b/core/Api/MailAPI.class.php index ac9a5a8..095cf84 100644 --- a/core/Api/MailAPI.class.php +++ b/core/Api/MailAPI.class.php @@ -3,10 +3,16 @@ namespace Api { use Objects\ConnectionData; + use Objects\Context; abstract class MailAPI extends Request { + + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } + protected function getMailConfig(): ?ConnectionData { - $req = new \Api\Settings\Get($this->user); + $req = new \Api\Settings\Get($this->context); $this->success = $req->execute(array("key" => "^mail_")); $this->lastError = $req->getLastError(); @@ -47,13 +53,13 @@ namespace Api\Mail { use External\PHPMailer\Exception; use External\PHPMailer\PHPMailer; use Objects\ConnectionData; - use Objects\GpgKey; - use Objects\User; + use Objects\Context; + use Objects\DatabaseEntity\GpgKey; class Test extends MailAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "receiver" => new Parameter("receiver", Parameter::TYPE_EMAIL), "gpgFingerprint" => new StringType("gpgFingerprint", 64, true, null) )); @@ -62,7 +68,7 @@ namespace Api\Mail { public function _execute(): bool { $receiver = $this->getParam("receiver"); - $req = new \Api\Mail\Send($this->user); + $req = new \Api\Mail\Send($this->context); $this->success = $req->execute(array( "to" => $receiver, "subject" => "Test E-Mail", @@ -76,16 +82,15 @@ namespace Api\Mail { } } - // TODO: expired gpg keys? class Send extends MailAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'to' => new Parameter('to', Parameter::TYPE_EMAIL, true, null), 'subject' => new StringType('subject', -1), 'body' => new StringType('body', -1), 'replyTo' => new Parameter('replyTo', Parameter::TYPE_EMAIL, true, null), 'replyName' => new StringType('replyName', 32, true, ""), - "gpgFingerprint" => new StringType("gpgFingerprint", 64, true, null), + 'gpgFingerprint' => new StringType("gpgFingerprint", 64, true, null), 'async' => new Parameter("async", Parameter::TYPE_BOOLEAN, true, true) )); $this->isPublic = false; @@ -108,7 +113,7 @@ namespace Api\Mail { $gpgFingerprint = $this->getParam("gpgFingerprint"); if ($this->getParam("async")) { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->insert("MailQueue", ["from", "to", "subject", "body", "replyTo", "replyName", "gpgFingerprint"]) ->addRow($fromMail, $toMail, $subject, $body, $replyTo, $replyName, $gpgFingerprint) @@ -200,14 +205,14 @@ namespace Api\Mail { // TODO: attachments class Sync extends MailAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array()); $this->loginRequired = true; } private function fetchMessageIds() { - $sql = $this->user->getSQL(); - $res = $sql->select("uid", "messageId") + $sql = $this->context->getSQL(); + $res = $sql->select("id", "messageId") ->from("ContactRequest") ->where(new Compare("messageId", NULL, "!=")) ->execute(); @@ -220,7 +225,7 @@ namespace Api\Mail { $messageIds = []; foreach ($res as $row) { - $messageIds[$row["messageId"]] = $row["uid"]; + $messageIds[$row["messageId"]] = $row["id"]; } return $messageIds; } @@ -241,7 +246,7 @@ namespace Api\Mail { } private function insertMessages($messages): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $query = $sql->insert("ContactMessage", ["request_id", "user_id", "message", "messageId", "created_at"]) ->onDuplicateKeyStrategy(new UpdateStrategy(["messageId"], ["message" => new Column("message")])); @@ -251,7 +256,7 @@ namespace Api\Mail { $requestId = $message["requestId"]; $query->addRow( $requestId, - $sql->select("uid")->from("User")->where(new Compare("email", $message["from"]))->limit(1), + $sql->select("id")->from("User")->where(new Compare("email", $message["from"]))->limit(1), $message["body"], $message["messageId"], (new \DateTime())->setTimeStamp($message["timestamp"]), @@ -450,7 +455,7 @@ namespace Api\Mail { return false; } - $req = new \Api\Settings\Set($this->user); + $req = new \Api\Settings\Set($this->context); $this->success = $req->execute(array("settings" => array("mail_last_sync" => "$now"))); $this->lastError = $req->getLastError(); return $this->success; @@ -458,8 +463,8 @@ namespace Api\Mail { } class SendQueue extends MailAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "debug" => new Parameter("debug", Parameter::TYPE_BOOLEAN, true, false) ]); $this->isPublic = false; @@ -473,8 +478,8 @@ namespace Api\Mail { echo "Start of processing mail queue at $startTime" . PHP_EOL; } - $sql = $this->user->getSQL(); - $res = $sql->select("uid", "from", "to", "subject", "body", + $sql = $this->context->getSQL(); + $res = $sql->select("id", "from", "to", "subject", "body", "replyTo", "replyName", "gpgFingerprint", "retryCount") ->from("MailQueue") ->where(new Compare("retryCount", 0, ">")) @@ -505,9 +510,9 @@ namespace Api\Mail { echo "Sending subject=$subject to=$to" . PHP_EOL; } - $mailId = intval($row["uid"]); + $mailId = intval($row["id"]); $retryCount = intval($row["retryCount"]); - $req = new Send($this->user); + $req = new Send($this->context); $args = [ "to" => $to, "subject" => $subject, @@ -529,7 +534,7 @@ namespace Api\Mail { ->set("status", "error") ->set("errorMessage", $error) ->set("nextTry", $nextTry) - ->where(new Compare("uid", $mailId)) + ->where(new Compare("id", $mailId)) ->execute(); } else { $successfulMails[] = $mailId; @@ -540,7 +545,7 @@ namespace Api\Mail { if (!empty($successfulMails)) { $res = $sql->update("MailQueue") ->set("status", "success") - ->where(new CondIn(new Column("uid"), $successfulMails)) + ->where(new CondIn(new Column("id"), $successfulMails)) ->execute(); $this->success = $res !== false; $this->lastError = $sql->getLastError(); diff --git a/core/Api/NewsAPI.class.php b/core/Api/NewsAPI.class.php index b6b6ce1..830681f 100644 --- a/core/Api/NewsAPI.class.php +++ b/core/Api/NewsAPI.class.php @@ -2,11 +2,11 @@ namespace Api { - use Objects\User; + use Objects\Context; abstract class NewsAPI extends Request { - public function __construct(User $user, bool $externalCall = false, array $params = array()) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); $this->loginRequired = true; } } @@ -18,57 +18,47 @@ namespace Api\News { use Api\Parameter\Parameter; use Api\Parameter\StringType; use Driver\SQL\Condition\Compare; - use Objects\User; + use Objects\Context; + use Objects\DatabaseEntity\News; class Get extends NewsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "since" => new Parameter("since", Parameter::TYPE_DATE_TIME, true, null), "limit" => new Parameter("limit", Parameter::TYPE_INT, true, 10) ]); + + $this->loginRequired = false; } public function _execute(): bool { - $sql = $this->user->getSQL(); - $query = $sql->select("News.uid", "title", "text", "publishedAt", - "User.uid as publisherId", "User.name as publisherName", "User.fullName as publisherFullName") - ->from("News") - ->innerJoin("User", "User.uid", "News.publishedBy") - ->orderBy("publishedAt") - ->descending(); - $since = $this->getParam("since"); - if ($since) { - $query->where(new Compare("publishedAt", $since, ">=")); - } - $limit = $this->getParam("limit"); if ($limit < 1 || $limit > 30) { return $this->createError("Limit must be in range 1-30"); - } else { - $query->limit($limit); } - $res = $query->execute(); - $this->success = $res !== false; + $sql = $this->context->getSQL(); + $newsQuery = News::findAllBuilder($sql) + ->limit($limit) + ->orderBy("published_at") + ->descending() + ->fetchEntities(); + + if ($since) { + $newsQuery->where(new Compare("published_at", $since, ">=")); + } + + $newsArray = $newsQuery->execute(); + $this->success = $newsArray !== null; $this->lastError = $sql->getLastError(); if ($this->success) { $this->result["news"] = []; - foreach ($res as $row) { - $newsId = intval($row["uid"]); - $this->result["news"][$newsId] = [ - "id" => $newsId, - "title" => $row["title"], - "text" => $row["text"], - "publishedAt" => $row["publishedAt"], - "publisher" => [ - "id" => intval($row["publisherId"]), - "name" => $row["publisherName"], - "fullName" => $row["publisherFullName"] - ] - ]; + foreach ($newsArray as $news) { + $newsId = $news->getId(); + $this->result["news"][$newsId] = $news->jsonSerialize(); } } @@ -77,28 +67,27 @@ namespace Api\News { } class Publish extends NewsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "title" => new StringType("title", 128), "text" => new StringType("text", 1024) ]); + $this->loginRequired = true; } public function _execute(): bool { - $sql = $this->user->getSQL(); - $title = $this->getParam("title"); - $text = $this->getParam("text"); - $res = $sql->insert("News", ["title", "text"]) - ->addRow($title, $text) - ->returning("uid") - ->execute(); + $news = new News(); + $news->text = $this->getParam("text"); + $news->title = $this->getParam("title"); + $news->publishedBy = $this->context->getUser(); - $this->success = $res !== false; + $sql = $this->context->getSQL(); + $this->success = $news->save($sql); $this->lastError = $sql->getLastError(); if ($this->success) { - $this->result["newsId"] = $sql->getLastInsertId(); + $this->result["newsId"] = $news->getId(); } return $this->success; @@ -106,77 +95,62 @@ namespace Api\News { } class Delete extends NewsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "id" => new Parameter("id", Parameter::TYPE_INT) ]); + $this->loginRequired = true; } public function _execute(): bool { - $sql = $this->user->getSQL(); - $id = $this->getParam("id"); - $res = $sql->select("publishedBy") - ->from("News") - ->where(new Compare("uid", $id)) - ->execute(); + $sql = $this->context->getSQL(); + $currentUser = $this->context->getUser(); - $this->success = ($res !== false); + $news = News::find($sql, $this->getParam("id")); + $this->success = ($news !== false); $this->lastError = $sql->getLastError(); if (!$this->success) { return false; - } else if (empty($res) || !is_array($res)) { + } else if ($news === null) { return $this->createError("News Post not found"); - } else if (intval($res[0]["publishedBy"]) !== $this->user->getId() && !$this->user->hasGroup(USER_GROUP_ADMIN)) { + } else if ($news->publishedBy->getId() !== $currentUser->getId() && !$currentUser->hasGroup(USER_GROUP_ADMIN)) { return $this->createError("You do not have permissions to delete news post of other users."); } - $res = $sql->delete("News") - ->where(new Compare("uid", $id)) - ->execute(); - - $this->success = $res !== false; + $this->success = $news->delete($sql); $this->lastError = $sql->getLastError(); return $this->success; } } class Edit extends NewsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "id" => new Parameter("id", Parameter::TYPE_INT), "title" => new StringType("title", 128), "text" => new StringType("text", 1024) ]); + $this->loginRequired = true; } public function _execute(): bool { + $sql = $this->context->getSQL(); + $currentUser = $this->context->getUser(); - $sql = $this->user->getSQL(); - $id = $this->getParam("id"); - $text = $this->getParam("text"); - $title = $this->getParam("title"); - $res = $sql->select("publishedBy") - ->from("News") - ->where(new Compare("uid", $id)) - ->execute(); - - $this->success = ($res !== false); + $news = News::find($sql, $this->getParam("id")); + $this->success = ($news !== false); $this->lastError = $sql->getLastError(); if (!$this->success) { return false; - } else if (empty($res) || !is_array($res)) { + } else if ($news === null) { return $this->createError("News Post not found"); - } else if (intval($res[0]["publishedBy"]) !== $this->user->getId() && !$this->user->hasGroup(USER_GROUP_ADMIN)) { + } else if ($news->publishedBy->getId() !== $currentUser->getId() && !$currentUser->hasGroup(USER_GROUP_ADMIN)) { return $this->createError("You do not have permissions to edit news post of other users."); } - $res = $sql->update("News") - ->set("title", $title) - ->set("text", $text) - ->where(new Compare("uid", $id)) - ->execute(); - - $this->success = $res !== false; + $news->text = $this->getParam("text"); + $news->title = $this->getParam("title"); + $this->success = $news->save($sql); $this->lastError = $sql->getLastError(); return $this->success; } diff --git a/core/Api/NotificationsAPI.class.php b/core/Api/NotificationsAPI.class.php index 8e3c19f..73f31b0 100644 --- a/core/Api/NotificationsAPI.class.php +++ b/core/Api/NotificationsAPI.class.php @@ -1,8 +1,13 @@ new Parameter('groupId', Parameter::TYPE_INT, true), 'userId' => new Parameter('userId', Parameter::TYPE_INT, true), 'title' => new StringType('title', 32), @@ -29,28 +37,8 @@ namespace Api\Notifications { $this->isPublic = false; } - private function checkUser($userId) { - $sql = $this->user->getSQL(); - $res = $sql->select($sql->count()) - ->from("User") - ->where(new Compare("uid", $userId)) - ->execute(); - - $this->success = ($res !== FALSE); - $this->lastError = $sql->getLastError(); - - if ($this->success) { - if ($res[0]["count"] == 0) { - $this->success = false; - $this->lastError = "User not found"; - } - } - - return $this->success; - } - - private function insertUserNotification($userId, $notificationId) { - $sql = $this->user->getSQL(); + private function insertUserNotification($userId, $notificationId): bool { + $sql = $this->context->getSQL(); $res = $sql->insert("UserNotification", array("user_id", "notification_id")) ->addRow($userId, $notificationId) ->execute(); @@ -60,28 +48,8 @@ namespace Api\Notifications { return $this->success; } - private function checkGroup($groupId) { - $sql = $this->user->getSQL(); - $res = $sql->select($sql->count()) - ->from("Group") - ->where(new Compare("uid", $groupId)) - ->execute(); - - $this->success = ($res !== FALSE); - $this->lastError = $sql->getLastError(); - - if ($this->success) { - if ($res[0]["count"] == 0) { - $this->success = false; - $this->lastError = "Group not found"; - } - } - - return $this->success; - } - - private function insertGroupNotification($groupId, $notificationId) { - $sql = $this->user->getSQL(); + private function insertGroupNotification($groupId, $notificationId): bool { + $sql = $this->context->getSQL(); $res = $sql->insert("GroupNotification", array("group_id", "notification_id")) ->addRow($groupId, $notificationId) ->execute(); @@ -91,24 +59,24 @@ namespace Api\Notifications { return $this->success; } - private function createNotification($title, $message) { - $sql = $this->user->getSQL(); - $res = $sql->insert("Notification", array("title", "message")) - ->addRow($title, $message) - ->returning("uid") - ->execute(); + private function createNotification($title, $message): bool|int { + $sql = $this->context->getSQL(); + $notification = new Notification(); + $notification->title = $title; + $notification->message = $message; - $this->success = ($res !== FALSE); + $this->success = ($notification->save($sql) !== FALSE); $this->lastError = $sql->getLastError(); if ($this->success) { - return $sql->getLastInsertId(); + return $notification->getId(); } return $this->success; } public function _execute(): bool { + $sql = $this->context->getSQL(); $userId = $this->getParam("userId"); $groupId = $this->getParam("groupId"); $title = $this->getParam("title"); @@ -119,18 +87,22 @@ namespace Api\Notifications { } else if(!is_null($userId) && !is_null($groupId)) { return $this->createError("Only one of userId and groupId must be specified."); } else if(!is_null($userId)) { - if ($this->checkUser($userId)) { + if (User::exists($sql, $userId)) { $id = $this->createNotification($title, $message); if ($this->success) { return $this->insertUserNotification($userId, $id); } + } else { + return $this->createError("User not found: $userId"); } } else if(!is_null($groupId)) { - if ($this->checkGroup($groupId)) { + if (Group::exists($sql, $groupId)) { $id = $this->createNotification($title, $message); if ($this->success) { return $this->insertGroupNotification($groupId, $id); } + } else { + return $this->createError("Group not found: $groupId"); } } @@ -141,22 +113,22 @@ namespace Api\Notifications { class Fetch extends NotificationsAPI { private array $notifications; - private array $notificationids; + private array $notificationIds; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'new' => new Parameter('new', Parameter::TYPE_BOOLEAN, true, true) )); $this->loginRequired = true; } - private function fetchUserNotifications() { + private function fetchUserNotifications(): bool { $onlyNew = $this->getParam('new'); - $userId = $this->user->getId(); - $sql = $this->user->getSQL(); - $query = $sql->select($sql->distinct("Notification.uid"), "created_at", "title", "message", "type") + $userId = $this->context->getUser()->getId(); + $sql = $this->context->getSQL(); + $query = $sql->select($sql->distinct("Notification.id"), "created_at", "title", "message", "type") ->from("Notification") - ->innerJoin("UserNotification", "UserNotification.notification_id", "Notification.uid") + ->innerJoin("UserNotification", "UserNotification.notification_id", "Notification.id") ->where(new Compare("UserNotification.user_id", $userId)) ->orderBy("created_at")->descending(); @@ -167,13 +139,13 @@ namespace Api\Notifications { return $this->fetchNotifications($query); } - private function fetchGroupNotifications() { + private function fetchGroupNotifications(): bool { $onlyNew = $this->getParam('new'); - $userId = $this->user->getId(); - $sql = $this->user->getSQL(); - $query = $sql->select($sql->distinct("Notification.uid"), "created_at", "title", "message", "type") + $userId = $this->context->getUser()->getId(); + $sql = $this->context->getSQL(); + $query = $sql->select($sql->distinct("Notification.id"), "created_at", "title", "message", "type") ->from("Notification") - ->innerJoin("GroupNotification", "GroupNotification.notification_id", "Notification.uid") + ->innerJoin("GroupNotification", "GroupNotification.notification_id", "Notification.id") ->innerJoin("UserGroup", "GroupNotification.group_id", "UserGroup.group_id") ->where(new Compare("UserGroup.user_id", $userId)) ->orderBy("created_at")->descending(); @@ -185,19 +157,19 @@ namespace Api\Notifications { return $this->fetchNotifications($query); } - private function fetchNotifications(Select $query) { - $sql = $this->user->getSQL(); + private function fetchNotifications(Select $query): bool { + $sql = $this->context->getSQL(); $res = $query->execute(); $this->success = ($res !== FALSE); $this->lastError = $sql->getLastError(); if ($this->success) { foreach($res as $row) { - $id = $row["uid"]; - if (!in_array($id, $this->notificationids)) { - $this->notificationids[] = $id; + $id = $row["id"]; + if (!in_array($id, $this->notificationIds)) { + $this->notificationIds[] = $id; $this->notifications[] = array( - "uid" => $id, + "id" => $id, "title" => $row["title"], "message" => $row["message"], "created_at" => $row["created_at"], @@ -212,7 +184,7 @@ namespace Api\Notifications { public function _execute(): bool { $this->notifications = array(); - $this->notificationids = array(); + $this->notificationIds = array(); if ($this->fetchUserNotifications() && $this->fetchGroupNotifications()) { $this->result["notifications"] = $this->notifications; } @@ -223,17 +195,18 @@ namespace Api\Notifications { class Seen extends NotificationsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array()); $this->loginRequired = true; } public function _execute(): bool { - $sql = $this->user->getSQL(); + $currentUser = $this->context->getUser(); + $sql = $this->context->getSQL(); $res = $sql->update("UserNotification") ->set("seen", true) - ->where(new Compare("user_id", $this->user->getId())) + ->where(new Compare("user_id", $currentUser->getId())) ->execute(); $this->success = ($res !== FALSE); @@ -245,7 +218,7 @@ namespace Api\Notifications { ->where(new CondIn(new Column("group_id"), $sql->select("group_id") ->from("UserGroup") - ->where(new Compare("user_id", $this->user->getId())))) + ->where(new Compare("user_id", $currentUser->getId())))) ->execute(); $this->success = ($res !== FALSE); diff --git a/core/Api/PermissionAPI.class.php b/core/Api/PermissionAPI.class.php index 5081207..4a024e0 100644 --- a/core/Api/PermissionAPI.class.php +++ b/core/Api/PermissionAPI.class.php @@ -2,9 +2,17 @@ namespace Api { + use Objects\Context; + abstract class PermissionAPI extends Request { + + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } + protected function checkStaticPermission(): bool { - if (!$this->user->isLoggedIn() || !$this->user->hasGroup(USER_GROUP_ADMIN)) { + $user = $this->context->getUser(); + if (!$user || !$user->hasGroup(USER_GROUP_ADMIN)) { return $this->createError("Permission denied."); } @@ -24,12 +32,14 @@ namespace Api\Permission { use Driver\SQL\Condition\CondLike; use Driver\SQL\Condition\CondNot; use Driver\SQL\Strategy\UpdateStrategy; - use Objects\User; + use Objects\Context; + use Objects\DatabaseEntity\Group; + use Objects\DatabaseEntity\User; class Check extends PermissionAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'method' => new StringType('method', 323) )); @@ -39,7 +49,7 @@ namespace Api\Permission { public function _execute(): bool { $method = $this->getParam("method"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("groups") ->from("ApiPermission") ->where(new CondLike($method, new Column("method"))) @@ -58,8 +68,9 @@ namespace Api\Permission { return true; } - $userGroups = $this->user->getGroups(); - if (empty($userGroups) || empty(array_intersect($groups, array_keys($this->user->getGroups())))) { + $currentUser = $this->context->getUser(); + $userGroups = $currentUser ? $currentUser->getGroups() : []; + if (empty($userGroups) || empty(array_intersect($groups, array_keys($userGroups)))) { http_response_code(401); return $this->createError("Permission denied."); } @@ -71,33 +82,17 @@ namespace Api\Permission { class Fetch extends PermissionAPI { - private array $groups; + private ?array $groups; - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array()); } - private function fetchGroups() { - $sql = $this->user->getSQL(); - $res = $sql->select("uid", "name", "color") - ->from("Group") - ->orderBy("uid") - ->ascending() - ->execute(); - - $this->success = ($res !== FALSE); + private function fetchGroups(): bool { + $sql = $this->context->getSQL(); + $this->groups = Group::findAll($sql); + $this->success = ($this->groups !== FALSE); $this->lastError = $sql->getLastError(); - - if ($this->success) { - $this->groups = array(); - foreach($res as $row) { - $groupId = $row["uid"]; - $groupName = $row["name"]; - $groupColor = $row["color"]; - $this->groups[$groupId] = array("name" => $groupName, "color" => $groupColor); - } - } - return $this->success; } @@ -107,7 +102,7 @@ namespace Api\Permission { return false; } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("method", "groups", "description") ->from("ApiPermission") ->execute(); @@ -137,8 +132,8 @@ namespace Api\Permission { class Save extends PermissionAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'permissions' => new Parameter('permissions', Parameter::TYPE_ARRAY) )); } @@ -150,27 +145,27 @@ namespace Api\Permission { } $permissions = $this->getParam("permissions"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $methodParam = new StringType('method', 32); $groupsParam = new Parameter('groups', Parameter::TYPE_ARRAY); $updateQuery = $sql->insert("ApiPermission", array("method", "groups")) - ->onDuplicateKeyStrategy(new UpdateStrategy(array("method"), array( "groups" => new Column("groups") ))); + ->onDuplicateKeyStrategy(new UpdateStrategy(array("method"), array("groups" => new Column("groups")))); $insertedMethods = array(); - foreach($permissions as $permission) { + foreach ($permissions as $permission) { if (!is_array($permission)) { return $this->createError("Invalid data type found in parameter: permissions, expected: object"); - } else if(!isset($permission["method"]) || !array_key_exists("groups", $permission)) { + } else if (!isset($permission["method"]) || !array_key_exists("groups", $permission)) { return $this->createError("Invalid object found in parameter: permissions, expected keys 'method' and 'groups'"); } else if (!$methodParam->parseParam($permission["method"])) { $expectedType = $methodParam->getTypeName(); return $this->createError("Invalid data type found for attribute 'method', expected: $expectedType"); - } else if(!$groupsParam->parseParam($permission["groups"])) { + } else if (!$groupsParam->parseParam($permission["groups"])) { $expectedType = $groupsParam->getTypeName(); return $this->createError("Invalid data type found for attribute 'groups', expected: $expectedType"); - } else if(empty(trim($methodParam->value))) { + } else if (empty(trim($methodParam->value))) { return $this->createError("Method cannot be empty."); } else { $method = $methodParam->value; diff --git a/core/Api/Request.class.php b/core/Api/Request.class.php index b10ed49..32b50f1 100644 --- a/core/Api/Request.class.php +++ b/core/Api/Request.class.php @@ -3,7 +3,7 @@ namespace Api; use Driver\Logger\Logger; -use Objects\User; +use Objects\Context; use PhpMqtt\Client\MqttClient; /** @@ -14,7 +14,7 @@ use PhpMqtt\Client\MqttClient; abstract class Request { - protected User $user; + protected Context $context; protected Logger $logger; protected array $params; protected string $lastError; @@ -31,9 +31,9 @@ abstract class Request { private array $allowedMethods; private bool $externalCall; - public function __construct(User $user, bool $externalCall = false, array $params = array()) { - $this->user = $user; - $this->logger = new Logger($this->getAPIName(), $this->user->getSQL()); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + $this->context = $context; + $this->logger = new Logger($this->getAPIName(), $this->context->getSQL()); $this->defaultParams = $params; $this->success = false; @@ -137,8 +137,9 @@ abstract class Request { $this->result = array(); $this->lastError = ''; - if ($this->user->isLoggedIn()) { - $this->result['logoutIn'] = $this->user->getSession()->getExpiresSeconds(); + $session = $this->context->getSession(); + if ($session) { + $this->result['logoutIn'] = $session->getExpiresSeconds(); } if ($this->externalCall) { @@ -183,25 +184,24 @@ abstract class Request { } $apiKeyAuthorized = false; - - if (!$this->user->isLoggedIn() && $this->apiKeyAllowed) { + if (!$session && $this->apiKeyAllowed) { if (isset($_SERVER["HTTP_AUTHORIZATION"])) { $authHeader = $_SERVER["HTTP_AUTHORIZATION"]; if (startsWith($authHeader, "Bearer ")) { $apiKey = substr($authHeader, strlen("Bearer ")); - $apiKeyAuthorized = $this->user->loadApiKey($apiKey); + $apiKeyAuthorized = $this->context->loadApiKey($apiKey); } } } // Logged in or api key authorized? if ($this->loginRequired) { - if (!$this->user->isLoggedIn() && !$apiKeyAuthorized) { + if (!$session && !$apiKeyAuthorized) { $this->lastError = 'You are not logged in.'; http_response_code(401); return false; - } else if ($this->user->isLoggedIn()) { - $tfaToken = $this->user->getTwoFactorToken(); + } else if ($session) { + $tfaToken = $session->getUser()->getTwoFactorToken(); if ($tfaToken && $tfaToken->isConfirmed() && !$tfaToken->isAuthenticated()) { $this->lastError = '2FA-Authorization is required'; http_response_code(401); @@ -211,11 +211,11 @@ abstract class Request { } // CSRF Token - if ($this->csrfTokenRequired && $this->user->isLoggedIn()) { + if ($this->csrfTokenRequired && $session) { // csrf token required + external call // if it's not a call with API_KEY, check for csrf_token $csrfToken = $values["csrf_token"] ?? $_SERVER["HTTP_XSRF_TOKEN"] ?? null; - if (!$csrfToken || strcmp($csrfToken, $this->user->getSession()->getCsrfToken()) !== 0) { + if (!$csrfToken || strcmp($csrfToken, $session->getCsrfToken()) !== 0) { $this->lastError = "CSRF-Token mismatch"; http_response_code(403); return false; @@ -224,7 +224,7 @@ abstract class Request { // Check for permission if (!($this instanceof \Api\Permission\Save)) { - $req = new \Api\Permission\Check($this->user); + $req = new \Api\Permission\Check($this->context); $this->success = $req->execute(array("method" => $this->getMethod())); $this->lastError = $req->getLastError(); if (!$this->success) { @@ -241,8 +241,9 @@ abstract class Request { $this->parseVariableParams($values); } - if (!$this->user->getSQL()->isConnected()) { - $this->lastError = $this->user->getSQL()->getLastError(); + $sql = $this->context->getSQL(); + if (!$sql->isConnected()) { + $this->lastError = $sql->getLastError(); return false; } @@ -254,7 +255,7 @@ abstract class Request { $this->success = $success; } - $this->user->getSQL()->setLastError(''); + $sql->setLastError(''); return $this->success; } @@ -331,8 +332,8 @@ abstract class Request { } protected function setupSSE() { - $this->user->getSQL()->close(); - $this->user->sendCookies(); + $this->context->sendCookies(); + $this->context->getSQL()?->close(); set_time_limit(0); ignore_user_abort(true); header('Content-Type: text/event-stream'); diff --git a/core/Api/RoutesAPI.class.php b/core/Api/RoutesAPI.class.php index 6ad7475..f2d3093 100644 --- a/core/Api/RoutesAPI.class.php +++ b/core/Api/RoutesAPI.class.php @@ -4,7 +4,7 @@ namespace Api { use Api\Routes\GenerateCache; use Driver\SQL\Condition\Compare; - use Objects\User; + use Objects\Context; abstract class RoutesAPI extends Request { @@ -13,16 +13,16 @@ namespace Api { protected string $routerCachePath; - public function __construct(User $user, bool $externalCall, array $params) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall, array $params) { + parent::__construct($context, $externalCall, $params); $this->routerCachePath = getClassPath(self::ROUTER_CACHE_CLASS); } protected function routeExists($uid): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count()) ->from("Route") - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->success = ($res !== false); @@ -41,10 +41,10 @@ namespace Api { return false; } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("Route") ->set("active", $active) - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->lastError = $sql->getLastError(); @@ -53,7 +53,7 @@ namespace Api { } protected function regenerateCache(): bool { - $req = new GenerateCache($this->user); + $req = new GenerateCache($this->context); $this->success = $req->execute(); $this->lastError = $req->getLastError(); return $this->success; @@ -68,25 +68,25 @@ namespace Api\Routes { use Api\RoutesAPI; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\CondBool; + use Objects\Context; use Objects\Router\DocumentRoute; use Objects\Router\RedirectRoute; use Objects\Router\Router; use Objects\Router\StaticFileRoute; - use Objects\User; class Fetch extends RoutesAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array()); } public function _execute(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql - ->select("uid", "request", "action", "target", "extra", "active", "exact") + ->select("id", "request", "action", "target", "extra", "active", "exact") ->from("Route") - ->orderBy("uid") + ->orderBy("id") ->ascending() ->execute(); @@ -97,7 +97,7 @@ namespace Api\Routes { $routes = array(); foreach ($res as $row) { $routes[] = array( - "uid" => intval($row["uid"]), + "id" => intval($row["id"]), "request" => $row["request"], "action" => $row["action"], "target" => $row["target"], @@ -118,8 +118,8 @@ namespace Api\Routes { private array $routes; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'routes' => new Parameter('routes', Parameter::TYPE_ARRAY, false) )); } @@ -129,7 +129,7 @@ namespace Api\Routes { return false; } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); // DELETE old rules $this->success = ($sql->truncate("Route")->execute() !== FALSE); @@ -210,8 +210,8 @@ namespace Api\Routes { class Add extends RoutesAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "request" => new StringType("request", 128), "action" => new StringType("action"), "target" => new StringType("target", 128), @@ -231,7 +231,7 @@ namespace Api\Routes { return $this->createError("Invalid action: $action"); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->insert("Route", ["request", "action", "target", "extra"]) ->addRow($request, $action, $target, $extra) ->execute(); @@ -243,9 +243,9 @@ namespace Api\Routes { } class Update extends RoutesAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( - "uid" => new Parameter("uid", Parameter::TYPE_INT), + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( + "id" => new Parameter("id", Parameter::TYPE_INT), "request" => new StringType("request", 128), "action" => new StringType("action"), "target" => new StringType("target", 128), @@ -256,8 +256,8 @@ namespace Api\Routes { public function _execute(): bool { - $uid = $this->getParam("uid"); - if (!$this->routeExists($uid)) { + $id = $this->getParam("id"); + if (!$this->routeExists($id)) { return false; } @@ -269,13 +269,13 @@ namespace Api\Routes { return $this->createError("Invalid action: $action"); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("Route") ->set("request", $request) ->set("action", $action) ->set("target", $target) ->set("extra", $extra) - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $id)) ->execute(); $this->lastError = $sql->getLastError(); @@ -285,23 +285,23 @@ namespace Api\Routes { } class Remove extends RoutesAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( - "uid" => new Parameter("uid", Parameter::TYPE_INT) + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( + "id" => new Parameter("id", Parameter::TYPE_INT) )); $this->isPublic = false; } public function _execute(): bool { - $uid = $this->getParam("uid"); + $uid = $this->getParam("id"); if (!$this->routeExists($uid)) { return false; } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->delete("Route") - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->lastError = $sql->getLastError(); @@ -311,29 +311,29 @@ namespace Api\Routes { } class Enable extends RoutesAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( - "uid" => new Parameter("uid", Parameter::TYPE_INT) + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( + "id" => new Parameter("id", Parameter::TYPE_INT) )); $this->isPublic = false; } public function _execute(): bool { - $uid = $this->getParam("uid"); + $uid = $this->getParam("id"); return $this->toggleRoute($uid, true); } } class Disable extends RoutesAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( - "uid" => new Parameter("uid", Parameter::TYPE_INT) + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( + "id" => new Parameter("id", Parameter::TYPE_INT) )); $this->isPublic = false; } public function _execute(): bool { - $uid = $this->getParam("uid"); + $uid = $this->getParam("id"); return $this->toggleRoute($uid, false); } } @@ -342,19 +342,19 @@ namespace Api\Routes { private ?Router $router; - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->isPublic = false; $this->router = null; } protected function _execute(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql - ->select("uid", "request", "action", "target", "extra", "exact") + ->select("id", "request", "action", "target", "extra", "exact") ->from("Route") ->where(new CondBool("active")) - ->orderBy("uid")->ascending() + ->orderBy("id")->ascending() ->execute(); $this->success = $res !== false; @@ -363,7 +363,7 @@ namespace Api\Routes { return false; } - $this->router = new Router($this->user); + $this->router = new Router($this->context); foreach ($res as $row) { $request = $row["request"]; $target = $row["target"]; diff --git a/core/Api/SettingsAPI.class.php b/core/Api/SettingsAPI.class.php index f7299fb..e5d254b 100644 --- a/core/Api/SettingsAPI.class.php +++ b/core/Api/SettingsAPI.class.php @@ -2,10 +2,13 @@ namespace Api { + use Objects\Context; + abstract class SettingsAPI extends Request { - + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } } - } namespace Api\Settings { @@ -19,19 +22,19 @@ namespace Api\Settings { use Driver\SQL\Condition\CondNot; use Driver\SQL\Condition\CondRegex; use Driver\SQL\Strategy\UpdateStrategy; - use Objects\User; + use Objects\Context; class Get extends SettingsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'key' => new StringType('key', -1, true, NULL) )); } public function _execute(): bool { $key = $this->getParam("key"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $query = $sql->select("name", "value") ->from("Settings"); @@ -62,8 +65,8 @@ namespace Api\Settings { } class Set extends SettingsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'settings' => new Parameter('settings', Parameter::TYPE_ARRAY) )); } @@ -77,7 +80,7 @@ namespace Api\Settings { $paramKey = new StringType('key', 32); $paramValue = new StringType('value', 1024, true, NULL); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $query = $sql->insert("Settings", array("name", "value")); $keys = array(); $deleteKeys = array(); @@ -129,7 +132,7 @@ namespace Api\Settings { } private function checkReadonly(array $keys) { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("name") ->from("Settings") ->where(new CondBool("readonly")) @@ -148,7 +151,7 @@ namespace Api\Settings { } private function deleteKeys(array $keys) { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->delete("Settings") ->where(new CondIn(new Column("name"), $keys)) ->execute(); diff --git a/core/Api/Stats.class.php b/core/Api/Stats.class.php index ebfb61d..5e18fa8 100644 --- a/core/Api/Stats.class.php +++ b/core/Api/Stats.class.php @@ -5,18 +5,20 @@ namespace Api; use DateTime; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\CondBool; +use Objects\Context; +use Objects\DatabaseEntity\User; class Stats extends Request { private bool $mailConfigured; private bool $recaptchaConfigured; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array()); } private function getUserCount() { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count())->from("User")->execute(); $this->success = $this->success && ($res !== FALSE); $this->lastError = $sql->getLastError(); @@ -25,7 +27,7 @@ class Stats extends Request { } private function getPageCount() { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count())->from("Route") ->where(new CondBool("active")) ->execute(); @@ -36,7 +38,7 @@ class Stats extends Request { } private function checkSettings(): bool { - $req = new \Api\Settings\Get($this->user); + $req = new \Api\Settings\Get($this->context); $this->success = $req->execute(array("key" => "^(mail_enabled|recaptcha_enabled)$")); $this->lastError = $req->getLastError(); @@ -50,7 +52,7 @@ class Stats extends Request { } private function getVisitorCount() { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $date = new DateTime(); $monthStart = $date->format("Ym00"); $monthEnd = $date->modify("+1 month")->format("Ym00"); @@ -69,7 +71,7 @@ class Stats extends Request { public function _execute(): bool { $userCount = $this->getUserCount(); $pageCount = $this->getPageCount(); - $req = new \Api\Visitors\Stats($this->user); + $req = new \Api\Visitors\Stats($this->context); $this->success = $req->execute(array("type"=>"monthly")); $this->lastError = $req->getLastError(); if (!$this->success) { @@ -100,7 +102,7 @@ class Stats extends Request { "server" => $_SERVER["SERVER_SOFTWARE"] ?? "Unknown", "memory_usage" => memory_get_usage(), "load_avg" => $loadAvg, - "database" => $this->user->getSQL()->getStatus(), + "database" => $this->context->getSQL()->getStatus(), "mail" => $this->mailConfigured, "reCaptcha" => $this->recaptchaConfigured ); diff --git a/core/Api/Swagger.class.php b/core/Api/Swagger.class.php index b958ce9..3191bb7 100644 --- a/core/Api/Swagger.class.php +++ b/core/Api/Swagger.class.php @@ -3,12 +3,13 @@ namespace Api; use Api\Parameter\StringType; -use Objects\User; +use Objects\Context; +use Objects\DatabaseEntity\User; class Swagger extends Request { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->csrfTokenRequired = false; } @@ -61,7 +62,7 @@ class Swagger extends Request { } private function fetchPermissions(): array { - $req = new Permission\Fetch($this->user); + $req = new Permission\Fetch($this->context); $this->success = $req->execute(); $permissions = []; foreach( $req->getResult()["permissions"] as $permission) { @@ -76,17 +77,19 @@ class Swagger extends Request { return false; } - if (($request->loginRequired() || !empty($requiredGroups)) && !$this->user->isLoggedIn()) { + $currentUser = $this->context->getUser(); + if (($request->loginRequired() || !empty($requiredGroups)) && !$currentUser) { return false; } // special case: hardcoded permission - if ($request instanceof Permission\Save && (!$this->user->isLoggedIn() || !$this->user->hasGroup(USER_GROUP_ADMIN))) { + if ($request instanceof Permission\Save && (!$currentUser || !$currentUser->hasGroup(USER_GROUP_ADMIN))) { return false; } if (!empty($requiredGroups)) { - return !empty(array_intersect($requiredGroups, $this->user->getGroups())); + $userGroups = array_keys($currentUser?->getGroups() ?? []); + return !empty(array_intersect($requiredGroups, $userGroups)); } return true; @@ -94,7 +97,7 @@ class Swagger extends Request { private function getDocumentation(): string { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); $siteName = $settings->getSiteName(); $domain = parse_url($settings->getBaseUrl(), PHP_URL_HOST); @@ -105,7 +108,7 @@ class Swagger extends Request { foreach (self::getApiEndpoints() as $endpoint => $apiClass) { $body = null; $requiredProperties = []; - $apiObject = $apiClass->newInstance($this->user, false); + $apiObject = $apiClass->newInstance($this->context, false); if (!$this->canView($permissions[strtolower($endpoint)] ?? [], $apiObject)) { continue; } diff --git a/core/Api/TemplateAPI.class.php b/core/Api/TemplateAPI.class.php index 2ed0838..a13c15e 100644 --- a/core/Api/TemplateAPI.class.php +++ b/core/Api/TemplateAPI.class.php @@ -2,11 +2,11 @@ namespace Api { - use Objects\User; + use Objects\Context; abstract class TemplateAPI extends Request { - function __construct(User $user, bool $externalCall = false, array $params = array()) { - parent::__construct($user, $externalCall, $params); + function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); $this->isPublic = false; // internal API } } @@ -19,7 +19,7 @@ namespace Api\Template { use Api\Parameter\Parameter; use Api\Parameter\StringType; use Api\TemplateAPI; - use Objects\User; + use Objects\Context; use Twig\Environment; use Twig\Error\LoaderError; use Twig\Error\RuntimeError; @@ -28,8 +28,8 @@ namespace Api\Template { class Render extends TemplateAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "file" => new StringType("file"), "parameters" => new ArrayType("parameters", Parameter::TYPE_MIXED, false, true, []) ]); diff --git a/core/Api/TfaAPI.class.php b/core/Api/TfaAPI.class.php index b37f9ee..a3a366c 100644 --- a/core/Api/TfaAPI.class.php +++ b/core/Api/TfaAPI.class.php @@ -2,22 +2,23 @@ namespace Api { + use Objects\Context; use Objects\TwoFactor\AuthenticationData; use Objects\TwoFactor\KeyBasedTwoFactorToken; - use Objects\User; abstract class TfaAPI extends Request { - private bool $userVerficiationRequired; + private bool $userVerificationRequired; - public function __construct(User $user, bool $externalCall = false, array $params = array()) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); $this->loginRequired = true; - $this->userVerficiationRequired = false; + $this->apiKeyAllowed = false; + $this->userVerificationRequired = false; } protected function verifyAuthData(AuthenticationData $authData): bool { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); // $relyingParty = $settings->getSiteName(); $domain = parse_url($settings->getBaseUrl(), PHP_URL_HOST); // $domain = "localhost"; @@ -26,7 +27,7 @@ namespace Api { return $this->createError("mismatched rpIDHash. expected: " . hash("sha256", $domain) . " got: " . bin2hex($authData->getHash())); } else if (!$authData->isUserPresent()) { return $this->createError("No user present"); - } else if ($this->userVerficiationRequired && !$authData->isUserVerified()) { + } else if ($this->userVerificationRequired && !$authData->isUserVerified()) { return $this->createError("user was not verified on device (PIN/Biometric/...)"); } else if ($authData->hasExtensionData()) { return $this->createError("No extensions supported"); @@ -36,7 +37,7 @@ namespace Api { } protected function verifyClientDataJSON($jsonData, KeyBasedTwoFactorToken $token): bool { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); $expectedType = $token->isConfirmed() ? "webauthn.get" : "webauthn.create"; $type = $jsonData["type"] ?? "null"; if ($type !== $expectedType) { @@ -58,33 +59,34 @@ namespace Api\TFA { use Api\Parameter\StringType; use Api\TfaAPI; use Driver\SQL\Condition\Compare; + use Objects\Context; use Objects\TwoFactor\AttestationObject; use Objects\TwoFactor\AuthenticationData; use Objects\TwoFactor\KeyBasedTwoFactorToken; use Objects\TwoFactor\TimeBasedTwoFactorToken; - use Objects\User; // General class Remove extends TfaAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "password" => new StringType("password", 0, true) ]); } public function _execute(): bool { - $token = $this->user->getTwoFactorToken(); + $currentUser = $this->context->getUser(); + $token = $currentUser->getTwoFactorToken(); if (!$token) { return $this->createError("You do not have an active 2FA-Token"); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $password = $this->getParam("password"); if ($password) { $res = $sql->select("password") ->from("User") - ->where(new Compare("uid", $this->user->getId())) + ->where(new Compare("id", $currentUser->getId())) ->execute(); $this->success = !empty($res); $this->lastError = $sql->getLastError(); @@ -99,7 +101,7 @@ namespace Api\TFA { } $res = $sql->delete("2FA") - ->where(new Compare("uid", $token->getId())) + ->where(new Compare("id", $token->getId())) ->execute(); $this->success = $res !== false; @@ -107,12 +109,12 @@ namespace Api\TFA { if ($this->success && $token->isConfirmed()) { // send an email - $settings = $this->user->getConfiguration()->getSettings(); - $req = new \Api\Template\Render($this->user); + $settings = $this->context->getSettings(); + $req = new \Api\Template\Render($this->context); $this->success = $req->execute([ "file" => "mail/2fa_remove.twig", "parameters" => [ - "username" => $this->user->getFullName() ?? $this->user->getUsername(), + "username" => $currentUser->getFullName() ?? $currentUser->getUsername(), "site_name" => $settings->getSiteName(), "sender_mail" => $settings->getMailSender() ] @@ -120,13 +122,13 @@ namespace Api\TFA { if ($this->success) { $body = $req->getResult()["html"]; - $gpg = $this->user->getGPG(); - $req = new \Api\Mail\Send($this->user); + $gpg = $currentUser->getGPG(); + $req = new \Api\Mail\Send($this->context); $this->success = $req->execute([ - "to" => $this->user->getEmail(), + "to" => $currentUser->getEmail(), "subject" => "[Security Lab] 2FA-Authentication removed", "body" => $body, - "gpgFingerprint" => $gpg ? $gpg->getFingerprint() : null + "gpgFingerprint" => $gpg?->getFingerprint() ]); } @@ -140,27 +142,28 @@ namespace Api\TFA { // TOTP class GenerateQR extends TfaAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall); $this->csrfTokenRequired = false; } public function _execute(): bool { - $twoFactorToken = $this->user->getTwoFactorToken(); + $currentUser = $this->context->getUser(); + $twoFactorToken = $currentUser->getTwoFactorToken(); if ($twoFactorToken && $twoFactorToken->isConfirmed()) { return $this->createError("You already added a two factor token"); } else if (!($twoFactorToken instanceof TimeBasedTwoFactorToken)) { $twoFactorToken = new TimeBasedTwoFactorToken(generateRandomString(32, "base32")); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->insert("2FA", ["type", "data"]) ->addRow("totp", $twoFactorToken->getData()) - ->returning("uid") + ->returning("id") ->execute() !== false; $this->lastError = $sql->getLastError(); if ($this->success) { $this->success = $sql->update("User") - ->set("2fa_id", $sql->getLastInsertId())->where(new Compare("uid", $this->user->getId())) + ->set("2fa_id", $sql->getLastInsertId())->where(new Compare("id", $currentUser->getId())) ->execute() !== false; $this->lastError = $sql->getLastError(); } @@ -172,27 +175,27 @@ namespace Api\TFA { header("Content-Type: image/png"); $this->disableCache(); - die($twoFactorToken->generateQRCode($this->user)); + die($twoFactorToken->generateQRCode($this->context)); } } class ConfirmTotp extends VerifyTotp { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall); - $this->loginRequired = true; + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall); } public function _execute(): bool { - $twoFactorToken = $this->user->getTwoFactorToken(); + $currentUser = $this->context->getUser(); + $twoFactorToken = $currentUser->getTwoFactorToken(); if ($twoFactorToken->isConfirmed()) { return $this->createError("Your two factor token is already confirmed."); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("2FA") ->set("confirmed", true) - ->where(new Compare("uid", $twoFactorToken->getId())) + ->where(new Compare("id", $twoFactorToken->getId())) ->execute() !== false; $this->lastError = $sql->getLastError(); return $this->success; @@ -201,22 +204,22 @@ namespace Api\TFA { class VerifyTotp extends TfaAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "code" => new StringType("code", 6) ]); - $this->loginRequired = false; + $this->loginRequired = true; $this->csrfTokenRequired = false; } public function _execute(): bool { - $session = $this->user->getSession(); - if (!$session) { + $currentUser = $this->context->getUser(); + if (!$currentUser) { return $this->createError("You are not logged in."); } - $twoFactorToken = $this->user->getTwoFactorToken(); + $twoFactorToken = $currentUser->getTwoFactorToken(); if (!$twoFactorToken) { return $this->createError("You did not add a two factor token yet."); } else if (!($twoFactorToken instanceof TimeBasedTwoFactorToken)) { @@ -235,21 +238,23 @@ namespace Api\TFA { // Key class RegisterKey extends TfaAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "clientDataJSON" => new StringType("clientDataJSON", 0, true, "{}"), "attestationObject" => new StringType("attestationObject", 0, true, "") ]); + $this->loginRequired = true; } public function _execute(): bool { + $currentUser = $this->context->getUser(); $clientDataJSON = json_decode($this->getParam("clientDataJSON"), true); $attestationObjectRaw = base64_decode($this->getParam("attestationObject")); - $twoFactorToken = $this->user->getTwoFactorToken(); - $settings = $this->user->getConfiguration()->getSettings(); + $twoFactorToken = $currentUser->getTwoFactorToken(); + $settings = $this->context->getSettings(); $relyingParty = $settings->getSiteName(); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); // TODO: for react development, localhost / HTTP_HOST is required, otherwise a DOMException is thrown $domain = parse_url($settings->getBaseUrl(), PHP_URL_HOST); @@ -266,7 +271,7 @@ namespace Api\TFA { $challenge = base64_encode(generateRandomString(32, "raw")); $res = $sql->insert("2FA", ["type", "data"]) ->addRow("fido", $challenge) - ->returning("uid") + ->returning("id") ->execute(); $this->success = ($res !== false); $this->lastError = $sql->getLastError(); @@ -276,7 +281,7 @@ namespace Api\TFA { $this->success = $sql->update("User") ->set("2fa_id", $sql->getLastInsertId()) - ->where(new Compare("uid", $this->user->getId())) + ->where(new Compare("id", $currentUser->getId())) ->execute() !== false; $this->lastError = $sql->getLastError(); if (!$this->success) { @@ -286,7 +291,7 @@ namespace Api\TFA { $this->result["data"] = [ "challenge" => $challenge, - "id" => $this->user->getId() . "@" . $domain, // @ + "id" => $currentUser->getId() . "@" . $domain, // @ "relyingParty" => [ "name" => $relyingParty, "id" => $domain @@ -322,7 +327,7 @@ namespace Api\TFA { $this->success = $sql->update("2FA") ->set("data", json_encode($data)) ->set("confirmed", true) - ->where(new Compare("uid", $twoFactorToken->getId())) + ->where(new Compare("id", $twoFactorToken->getId())) ->execute() !== false; $this->lastError = $sql->getLastError(); } @@ -332,25 +337,25 @@ namespace Api\TFA { } class VerifyKey extends TfaAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "credentialID" => new StringType("credentialID"), "clientDataJSON" => new StringType("clientDataJSON"), "authData" => new StringType("authData"), "signature" => new StringType("signature"), ]); - $this->loginRequired = false; + $this->loginRequired = true; $this->csrfTokenRequired = false; } public function _execute(): bool { - $session = $this->user->getSession(); - if (!$session) { + $currentUser = $this->context->getUser(); + if (!$currentUser) { return $this->createError("You are not logged in."); } - $twoFactorToken = $this->user->getTwoFactorToken(); + $twoFactorToken = $currentUser->getTwoFactorToken(); if (!$twoFactorToken) { return $this->createError("You did not add a two factor token yet."); } else if (!($twoFactorToken instanceof KeyBasedTwoFactorToken)) { diff --git a/core/Api/UserAPI.class.php b/core/Api/UserAPI.class.php index 8713ee6..8159036 100644 --- a/core/Api/UserAPI.class.php +++ b/core/Api/UserAPI.class.php @@ -2,10 +2,17 @@ namespace Api { + use Cassandra\Date; use Driver\SQL\Condition\Compare; + use Objects\Context; + use Objects\DatabaseEntity\Language; abstract class UserAPI extends Request { + public function __construct(Context $context, bool $externalCall = false, array $params = array()) { + parent::__construct($context, $externalCall, $params); + } + protected function checkUserExists(?string $username, ?string $email = null): bool { $conditions = array(); @@ -21,7 +28,7 @@ namespace Api { return true; } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("User.name", "User.email") ->from("User") ->where(...$conditions) @@ -45,7 +52,7 @@ namespace Api { protected function checkPasswordRequirements($password, $confirmPassword): bool { if ((($password === null) !== ($confirmPassword === null)) || strcmp($password, $confirmPassword) !== 0) { return $this->createError("The given passwords do not match"); - } else if(strlen($password) < 6) { + } else if (strlen($password) < 6) { return $this->createError("The password should be at least 6 characters long"); } @@ -68,39 +75,43 @@ namespace Api { } protected function insertUser($username, $email, $password, $confirmed, $fullName = "") { - $sql = $this->user->getSQL(); - $hash = $this->hashPassword($password); - $res = $sql->insert("User", array("name", "password", "email", "confirmed", "fullName")) - ->addRow($username, $hash, $email, $confirmed, $fullName ?? "") - ->returning("uid") - ->execute(); + $sql = $this->context->getSQL(); + $user = new \Objects\DatabaseEntity\User(); + $user->language = Language::DEFAULT_LANGUAGE(false); + $user->registeredAt = new \DateTime(); + $user->password = $this->hashPassword($password); + $user->name = $username; + $user->email = $email; + $user->confirmed = $confirmed; + $user->fullName = $fullName ?? ""; + + $this->success = ($user->save($sql) !== FALSE); $this->lastError = $sql->getLastError(); - $this->success = ($res !== FALSE); if ($this->success) { - return $sql->getLastInsertId(); + return $user->getId(); } return $this->success; } - protected function hashPassword($password) { + protected function hashPassword($password): string { return password_hash($password, PASSWORD_BCRYPT); } - protected function getUser($id) { - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid as userId", "User.name", "User.fullName", "User.email", - "User.registered_at", "User.confirmed", "User.last_online", "User.profilePicture", + protected function getUser(int $id) { + $sql = $this->context->getSQL(); + $res = $sql->select("User.id as userId", "User.name", "User.full_name", "User.email", + "User.registered_at", "User.confirmed", "User.last_online", "User.profile_picture", "User.gpg_id", "GpgKey.confirmed as gpg_confirmed", "GpgKey.fingerprint as gpg_fingerprint", - "GpgKey.expires as gpg_expires", "GpgKey.algorithm as gpg_algorithm", - "Group.uid as groupId", "Group.name as groupName", "Group.color as groupColor") + "GpgKey.expires as gpg_expires", "GpgKey.algorithm as gpg_algorithm", + "Group.id as groupId", "Group.name as groupName", "Group.color as groupColor") ->from("User") - ->leftJoin("UserGroup", "User.uid", "UserGroup.user_id") - ->leftJoin("Group", "Group.uid", "UserGroup.group_id") - ->leftJoin("GpgKey", "GpgKey.uid", "User.gpg_id") - ->where(new Compare("User.uid", $id)) + ->leftJoin("UserGroup", "User.id", "UserGroup.user_id") + ->leftJoin("Group", "Group.id", "UserGroup.group_id") + ->leftJoin("GpgKey", "GpgKey.id", "User.gpg_id") + ->where(new Compare("User.id", $id)) ->execute(); $this->success = ($res !== FALSE); @@ -110,7 +121,7 @@ namespace Api { } protected function invalidateToken($token) { - $this->user->getSQL() + $this->context->getSQL() ->update("UserToken") ->set("used", true) ->where(new Compare("token", $token)) @@ -119,7 +130,7 @@ namespace Api { protected function insertToken(int $userId, string $token, string $tokenType, int $duration): bool { $validUntil = (new \DateTime())->modify("+$duration hour"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->insert("UserToken", array("user_id", "token", "token_type", "valid_until")) ->addRow($userId, $token, $tokenType, $validUntil) ->execute(); @@ -155,15 +166,17 @@ namespace Api\User { use Driver\SQL\Condition\CondNot; use Driver\SQL\Expression\JsonArrayAgg; use ImagickException; - use Objects\GpgKey; + use Objects\Context; + use Objects\DatabaseEntity\DatabaseEntityHandler; + use Objects\DatabaseEntity\GpgKey; + use Objects\DatabaseEntity\TwoFactorToken; use Objects\TwoFactor\KeyBasedTwoFactorToken; - use Objects\TwoFactor\TwoFactorToken; - use Objects\User; + use Objects\DatabaseEntity\User; class Create extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'username' => new StringType('username', 32), 'email' => new Parameter('email', Parameter::TYPE_EMAIL, true, NULL), 'password' => new StringType('password'), @@ -192,7 +205,7 @@ namespace Api\User { $email = (!is_null($email) && empty($email)) ? null : $email; $id = $this->insertUser($username, $email, $password, true); - if ($this->success) { + if ($id !== false) { $this->result["userId"] = $id; } @@ -204,8 +217,8 @@ namespace Api\User { private int $userCount; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'page' => new Parameter('page', Parameter::TYPE_INT, true, 1), 'count' => new Parameter('count', Parameter::TYPE_INT, true, 20) )); @@ -213,7 +226,7 @@ namespace Api\User { private function getUserCount(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count())->from("User")->execute(); $this->success = ($res !== FALSE); $this->lastError = $sql->getLastError(); @@ -226,12 +239,12 @@ namespace Api\User { } private function selectIds($page, $count) { - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid") + $sql = $this->context->getSQL(); + $res = $sql->select("User.id") ->from("User") ->limit($count) ->offset(($page - 1) * $count) - ->orderBy("User.uid") + ->orderBy("User.id") ->ascending() ->execute(); @@ -240,8 +253,8 @@ namespace Api\User { if ($this->success && is_array($res)) { return array_map(function ($row) { - return intval($row["uid"]); - }, $res); + return intval($row["id"]); + }, $res); } return false; @@ -268,36 +281,38 @@ namespace Api\User { return false; } - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid as userId", "User.name", "User.email", "User.registered_at", "User.confirmed", - "User.profilePicture", "User.fullName", "Group.uid as groupId", "User.last_online", + $sql = $this->context->getSQL(); + $res = $sql->select("User.id as userId", "User.name", "User.email", "User.registered_at", "User.confirmed", + "User.profile_picture", "User.full_name", "Group.id as groupId", "User.last_online", "Group.name as groupName", "Group.color as groupColor") ->from("User") - ->leftJoin("UserGroup", "User.uid", "UserGroup.user_id") - ->leftJoin("Group", "Group.uid", "UserGroup.group_id") - ->where(new CondIn(new Column("User.uid"), $userIds)) + ->leftJoin("UserGroup", "User.id", "UserGroup.user_id") + ->leftJoin("Group", "Group.id", "UserGroup.group_id") + ->where(new CondIn(new Column("User.id"), $userIds)) ->execute(); $this->success = ($res !== FALSE); $this->lastError = $sql->getLastError(); + $currentUser = $this->context->getUser(); if ($this->success) { $this->result["users"] = array(); foreach ($res as $row) { $userId = intval($row["userId"]); - $groupId = intval($row["groupId"]); + $groupId = $row["groupId"]; $groupName = $row["groupName"]; $groupColor = $row["groupColor"]; - $fullInfo = ($userId === $this->user->getId()) || - ($this->user->hasGroup(USER_GROUP_ADMIN) || $this->user->hasGroup(USER_GROUP_SUPPORT)); + $fullInfo = ($userId === $currentUser->getId() || + $currentUser->hasGroup(USER_GROUP_ADMIN) || + $currentUser->hasGroup(USER_GROUP_SUPPORT)); if (!isset($this->result["users"][$userId])) { $user = array( - "uid" => $userId, + "id" => $userId, "name" => $row["name"], - "fullName" => $row["fullName"], - "profilePicture" => $row["profilePicture"], + "fullName" => $row["full_name"], + "profilePicture" => $row["profile_picture"], "email" => $row["email"], "confirmed" => $sql->parseBool($row["confirmed"]), "groups" => array(), @@ -314,7 +329,8 @@ namespace Api\User { } if (!is_null($groupId)) { - $this->result["users"][$userId]["groups"][$groupId] = array( + $this->result["users"][$userId]["groups"][intval($groupId)] = array( + "id" => intval($groupId), "name" => $groupName, "color" => $groupColor ); @@ -330,8 +346,8 @@ namespace Api\User { class Get extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'id' => new Parameter('id', Parameter::TYPE_INT) )); $this->loginRequired = true; @@ -339,7 +355,7 @@ namespace Api\User { public function _execute(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $userId = $this->getParam("id"); $user = $this->getUser($userId); if ($this->success) { @@ -353,19 +369,19 @@ namespace Api\User { } $queriedUser = array( - "uid" => $userId, + "id" => $userId, "name" => $user[0]["name"], - "fullName" => $user[0]["fullName"], + "fullName" => $user[0]["full_name"], "email" => $user[0]["email"], "registered_at" => $user[0]["registered_at"], "last_online" => $user[0]["last_online"], - "profilePicture" => $user[0]["profilePicture"], + "profilePicture" => $user[0]["profile_picture"], "confirmed" => $sql->parseBool($user["0"]["confirmed"]), "groups" => array(), "gpgFingerprint" => $gpgFingerprint, ); - foreach($user as $row) { + foreach ($user as $row) { if (!is_null($row["groupId"])) { $queriedUser["groups"][$row["groupId"]] = array( "name" => $row["groupName"], @@ -375,13 +391,15 @@ namespace Api\User { } // either we are querying own info or we are support / admin - $canView = ($userId === $this->user->getId()) || - ($this->user->hasGroup(USER_GROUP_ADMIN) || - $this->user->hasGroup(USER_GROUP_SUPPORT)); + $currentUser = $this->context->getUser(); + $canView = ($userId === $currentUser->getId() || + $currentUser->hasGroup(USER_GROUP_ADMIN) || + $currentUser->hasGroup(USER_GROUP_SUPPORT)); // full info only when we have administrative privileges, or we are querying ourselves - $fullInfo = ($userId === $this->user->getId()) || - ($this->user->hasGroup(USER_GROUP_ADMIN) || $this->user->hasGroup(USER_GROUP_SUPPORT)); + $fullInfo = ($userId === $currentUser->getId() || + $currentUser->hasGroup(USER_GROUP_ADMIN) || + $currentUser->hasGroup(USER_GROUP_SUPPORT)); if (!$canView) { @@ -391,7 +409,7 @@ namespace Api\User { ->execute(); $this->success = ($res !== false); $this->lastError = $sql->getLastError(); - if (!$this->success ) { + if (!$this->success) { return false; } else { $canView = in_array($userId, json_decode($res[0]["publisherIds"], true)); @@ -421,19 +439,20 @@ namespace Api\User { class Info extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array()); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array()); $this->csrfTokenRequired = false; } public function _execute(): bool { - if (!$this->user->isLoggedIn()) { + $currentUser = $this->context->getUser(); + if (!$currentUser) { $this->result["loggedIn"] = false; } else { $this->result["loggedIn"] = true; - $userGroups = array_keys($this->user->getGroups()); - $sql = $this->user->getSQL(); + $userGroups = array_keys($currentUser->getGroups()); + $sql = $this->context->getSQL(); $res = $sql->select("method", "groups") ->from("ApiPermission") ->execute(); @@ -449,17 +468,18 @@ namespace Api\User { } $this->result["permissions"] = $permissions; + $this->result["user"] = $currentUser->jsonSerialize(); + $this->result["user"]["session"] = $this->context->getSession()?->jsonSerialize(); } - $this->result["user"] = $this->user->jsonSerialize(); return $this->success; } } class Invite extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'username' => new StringType('username', 32), 'email' => new StringType('email', 64), )); @@ -485,7 +505,7 @@ namespace Api\User { $token = generateRandomString(36); $validDays = 7; $valid_until = (new DateTime())->modify("+$validDays day"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->insert("UserToken", array("user_id", "token", "token_type", "valid_until")) ->addRow($id, $token, "invite", $valid_until) ->execute(); @@ -495,11 +515,11 @@ namespace Api\User { //send validation mail if ($this->success) { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); $baseUrl = $settings->getBaseUrl(); $siteName = $settings->getSiteName(); - $req = new Render($this->user); + $req = new Render($this->context); $this->success = $req->execute([ "file" => "mail/accept_invite.twig", "parameters" => [ @@ -514,7 +534,7 @@ namespace Api\User { if ($this->success) { $messageBody = $req->getResult()["html"]; - $request = new \Api\Mail\Send($this->user); + $request = new \Api\Mail\Send($this->context); $this->success = $request->execute(array( "to" => $email, "subject" => "[$siteName] Account Invitation", @@ -531,14 +551,14 @@ namespace Api\User { } } - $this->logger->info("Created new user with uid=$id"); + $this->logger->info("Created new user with id=$id"); return $this->success; } } class AcceptInvite extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'token' => new StringType('token', 36), 'password' => new StringType('password'), 'confirmPassword' => new StringType('confirmPassword'), @@ -547,11 +567,11 @@ namespace Api\User { } private function updateUser($uid, $password): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->update("User") ->set("password", $this->hashPassword($password)) ->set("confirmed", true) - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->success = ($res !== FALSE); @@ -561,7 +581,7 @@ namespace Api\User { public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError("You are already logged in."); } @@ -569,7 +589,7 @@ namespace Api\User { $password = $this->getParam("password"); $confirmPassword = $this->getParam("confirmPassword"); - $req = new CheckToken($this->user); + $req = new CheckToken($this->context); $this->success = $req->execute(array("token" => $token)); $this->lastError = $req->getLastError(); @@ -580,16 +600,16 @@ namespace Api\User { $result = $req->getResult(); if (strcasecmp($result["token"]["type"], "invite") !== 0) { return $this->createError("Invalid token type"); - } else if($result["user"]["confirmed"]) { + } else if ($result["user"]["confirmed"]) { return $this->createError("Your email address is already confirmed."); } else if (!$this->checkPasswordRequirements($password, $confirmPassword)) { return false; - } else if (!$this->updateUser($result["user"]["uid"], $password)) { + } else if (!$this->updateUser($result["user"]["id"], $password)) { return false; } else { // Invalidate token - $this->user->getSQL() + $this->context->getSQL() ->update("UserToken") ->set("used", true) ->where(new Compare("token", $token)) @@ -602,18 +622,18 @@ namespace Api\User { class ConfirmEmail extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'token' => new StringType('token', 36) )); $this->csrfTokenRequired = false; } private function updateUser($uid): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->update("User") ->set("confirmed", true) - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->success = ($res !== FALSE); @@ -623,12 +643,12 @@ namespace Api\User { public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError("You are already logged in."); } $token = $this->getParam("token"); - $req = new CheckToken($this->user); + $req = new CheckToken($this->context); $this->success = $req->execute(array("token" => $token)); $this->lastError = $req->getLastError(); @@ -636,9 +656,9 @@ namespace Api\User { $result = $req->getResult(); if (strcasecmp($result["token"]["type"], "email_confirm") !== 0) { return $this->createError("Invalid token type"); - } else if($result["user"]["confirmed"]) { + } else if ($result["user"]["confirmed"]) { return $this->createError("Your email address is already confirmed."); - } else if (!$this->updateUser($result["user"]["uid"])) { + } else if (!$this->updateUser($result["user"]["id"])) { return false; } else { $this->invalidateToken($token); @@ -654,8 +674,8 @@ namespace Api\User { private int $startedAt; - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'username' => new StringType('username'), 'password' => new StringType('password'), 'stayLoggedIn' => new Parameter('stayLoggedIn', Parameter::TYPE_BOOLEAN, true, false) @@ -672,7 +692,7 @@ namespace Api\User { public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { $this->lastError = L('You are already logged in'); $this->success = true; return true; @@ -684,15 +704,17 @@ namespace Api\User { $password = $this->getParam('password'); $stayLoggedIn = $this->getParam('stayLoggedIn'); - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid", "User.password", "User.confirmed", - "User.2fa_id", "2FA.type as 2fa_type", "2FA.confirmed as 2fa_confirmed", "2FA.data as 2fa_data") + $sql = $this->context->getSQL(); + $res = $sql->select("User.id", "User.password", "User.confirmed", + "TwoFactorToken.id as 2fa_id", "TwoFactorToken.type as 2fa_type", + "TwoFactorToken.confirmed as 2fa_confirmed", "TwoFactorToken.data as 2fa_data") ->from("User") ->where(new Compare("User.name", $username), new Compare("User.email", $username)) - ->leftJoin("2FA", "2FA.uid", "User.2fa_id") + ->leftJoin("TwoFactorToken", "TwoFactorToken.id", "User.two_factor_token_id") ->first() ->execute(); + $session = null; $this->success = ($res !== FALSE); $this->lastError = $sql->getLastError(); @@ -700,19 +722,19 @@ namespace Api\User { if ($res === null) { return $this->wrongCredentials(); } else { - $uid = $res['uid']; + $userId = $res['id']; $confirmed = $sql->parseBool($res["confirmed"]); - $token = $res["2fa_id"] ? TwoFactorToken::newInstance($res["2fa_type"], $res["2fa_data"], $res["2fa_id"], $sql->parseBool($res["2fa_confirmed"])) : null; + $token = $res["2fa_id"] ? TwoFactorToken::fromRow($sql, DatabaseEntityHandler::getPrefixedRow($res, "2fa_")) : null; if (password_verify($password, $res['password'])) { if (!$confirmed) { $this->result["emailConfirmed"] = false; return $this->createError("Your email address has not been confirmed yet."); - } else if (!($this->success = $this->user->createSession($uid, $stayLoggedIn))) { + } else if (!($session = $this->context->createSession($userId, $stayLoggedIn))) { return $this->createError("Error creating Session: " . $sql->getLastError()); } else { $this->result["loggedIn"] = true; - $this->result["logoutIn"] = $this->user->getSession()->getExpiresSeconds(); - $this->result["csrf_token"] = $this->user->getSession()->getCsrfToken(); + $this->result["logoutIn"] = $session->getExpiresSeconds(); + $this->result["csrf_token"] = $session->getCsrfToken(); if ($token && $token->isConfirmed()) { $this->result["2fa"] = ["type" => $token->getType()]; if ($token instanceof KeyBasedTwoFactorToken) { @@ -735,8 +757,8 @@ namespace Api\User { class Logout extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall); + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall); $this->loginRequired = false; $this->apiKeyAllowed = false; $this->forbidMethod("GET"); @@ -744,12 +766,13 @@ namespace Api\User { public function _execute(): bool { - if (!$this->user->isLoggedIn()) { + $session = $this->context->getSession(); + if (!$session) { return $this->createError("You are not logged in."); } - $this->success = $this->user->logout(); - $this->lastError = $this->user->getSQL()->getLastError(); + $this->success = $session->destroy(); + $this->lastError = $this->context->getSQL()->getLastError(); return $this->success; } } @@ -759,7 +782,7 @@ namespace Api\User { private ?int $userId; private string $token; - public function __construct(User $user, bool $externalCall = false) { + public function __construct(Context $context, bool $externalCall = false) { $parameters = array( "username" => new StringType("username", 32), 'email' => new Parameter('email', Parameter::TYPE_EMAIL), @@ -767,30 +790,30 @@ namespace Api\User { "confirmPassword" => new StringType("confirmPassword"), ); - $settings = $user->getConfiguration()->getSettings(); + $settings = $context->getSettings(); if ($settings->isRecaptchaEnabled()) { $parameters["captcha"] = new StringType("captcha"); } - parent::__construct($user, $externalCall, $parameters); + parent::__construct($context, $externalCall, $parameters); $this->csrfTokenRequired = false; } public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError(L('You are already logged in')); } - $registrationAllowed = $this->user->getConfiguration()->getSettings()->isRegistrationAllowed(); - if(!$registrationAllowed) { + $settings = $this->context->getSettings(); + $registrationAllowed = $settings->isRegistrationAllowed(); + if (!$registrationAllowed) { return $this->createError("User Registration is not enabled."); } - $settings = $this->user->getConfiguration()->getSettings(); if ($settings->isRecaptchaEnabled()) { $captcha = $this->getParam("captcha"); - $req = new VerifyCaptcha($this->user); + $req = new VerifyCaptcha($this->context); if (!$req->execute(array("captcha" => $captcha, "action" => "register"))) { return $this->createError($req->getLastError()); } @@ -804,13 +827,13 @@ namespace Api\User { return false; } - if(!$this->checkRequirements($username, $password, $confirmPassword)) { + if (!$this->checkRequirements($username, $password, $confirmPassword)) { return false; } $fullName = substr($email, 0, strrpos($email, "@")); $fullName = implode(" ", array_map(function ($part) { - return ucfirst(strtolower($part)); + return ucfirst(strtolower($part)); }, explode(".", $fullName)) ); @@ -823,10 +846,9 @@ namespace Api\User { $this->token = generateRandomString(36); if ($this->insertToken($this->userId, $this->token, "email_confirm", $validHours)) { - $settings = $this->user->getConfiguration()->getSettings(); $baseUrl = $settings->getBaseUrl(); $siteName = $settings->getSiteName(); - $req = new Render($this->user); + $req = new Render($this->context); $this->success = $req->execute([ "file" => "mail/confirm_email.twig", "parameters" => [ @@ -841,7 +863,7 @@ namespace Api\User { if ($this->success) { $messageBody = $req->getResult()["html"]; - $request = new \Api\Mail\Send($this->user); + $request = new \Api\Mail\Send($this->context); $this->success = $request->execute(array( "to" => $email, "subject" => "[$siteName] E-Mail Confirmation", @@ -858,24 +880,24 @@ namespace Api\User { "Please contact the server administration. This issue has been automatically logged. Reason: " . $this->lastError; } - $this->logger->info("Registered new user with uid=" . $this->userId); + $this->logger->info("Registered new user with id=" . $this->userId); return $this->success; } } class CheckToken extends UserAPI { - public function __construct($user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'token' => new StringType('token', 36), )); } private function checkToken($token) { - $sql = $this->user->getSQL(); - $res = $sql->select("UserToken.token_type", "User.uid", "User.name", "User.email", "User.confirmed") + $sql = $this->context->getSQL(); + $res = $sql->select("UserToken.token_type", "User.id", "User.name", "User.email", "User.confirmed") ->from("UserToken") - ->innerJoin("User", "UserToken.user_id", "User.uid") + ->innerJoin("User", "UserToken.user_id", "User.id") ->where(new Compare("UserToken.token", $token)) ->where(new Compare("UserToken.valid_until", $sql->now(), ">")) ->where(new Compare("UserToken.used", 0)) @@ -904,7 +926,7 @@ namespace Api\User { $this->result["user"] = array( "name" => $tokenEntry["name"], "email" => $tokenEntry["email"], - "uid" => $tokenEntry["uid"], + "id" => $tokenEntry["id"], "confirmed" => $tokenEntry["confirmed"] ); } else { @@ -917,8 +939,8 @@ namespace Api\User { class Edit extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'id' => new Parameter('id', Parameter::TYPE_INT), 'username' => new StringType('username', 32, true, NULL), 'fullName' => new StringType('fullName', 64, true, NULL), @@ -955,7 +977,7 @@ namespace Api\User { if (!is_null($groups)) { $param = new Parameter('groupId', Parameter::TYPE_INT); - foreach($groups as $groupId) { + foreach ($groups as $groupId) { if (!$param->parseParam($groupId)) { $value = print_r($groupId, true); return $this->createError("Invalid Type for groupId in parameter groups: '$value' (Required: " . $param->getTypeName() . ")"); @@ -964,31 +986,31 @@ namespace Api\User { $groupIds[] = $param->value; } - if ($id === $this->user->getId() && !in_array(USER_GROUP_ADMIN, $groupIds)) { + if ($id === $this->context->getUser()->getId() && !in_array(USER_GROUP_ADMIN, $groupIds)) { return $this->createError("Cannot remove Administrator group from own user."); } } // Check for duplicate username, email $usernameChanged = !is_null($username) && strcasecmp($username, $user[0]["name"]) !== 0; - $fullNameChanged = !is_null($fullName) && strcasecmp($fullName, $user[0]["fullName"]) !== 0; + $fullNameChanged = !is_null($fullName) && strcasecmp($fullName, $user[0]["full_name"]) !== 0; $emailChanged = !is_null($email) && strcasecmp($email, $user[0]["email"]) !== 0; - if($usernameChanged || $emailChanged) { + if ($usernameChanged || $emailChanged) { if (!$this->checkUserExists($usernameChanged ? $username : NULL, $emailChanged ? $email : NULL)) { return false; } } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $query = $sql->update("User"); if ($usernameChanged) $query->set("name", $username); - if ($fullNameChanged) $query->set("fullName", $fullName); + if ($fullNameChanged) $query->set("full_name", $fullName); if ($emailChanged) $query->set("email", $email); if (!is_null($password)) $query->set("password", $this->hashPassword($password)); if (!is_null($confirmed)) { - if ($id === $this->user->getId() && $confirmed === false) { + if ($id === $this->context->getUser()->getId() && $confirmed === false) { return $this->createError("Cannot make own account unconfirmed."); } else { $query->set("confirmed", $confirmed); @@ -996,7 +1018,7 @@ namespace Api\User { } if (!empty($query->getValues())) { - $query->where(new Compare("User.uid", $id)); + $query->where(new Compare("User.id", $id)); $res = $query->execute(); $this->lastError = $sql->getLastError(); $this->success = ($res !== FALSE); @@ -1007,7 +1029,7 @@ namespace Api\User { $deleteQuery = $sql->delete("UserGroup")->where(new Compare("user_id", $id)); $insertQuery = $sql->insert("UserGroup", array("user_id", "group_id")); - foreach($groupIds as $groupId) { + foreach ($groupIds as $groupId) { $insertQuery->addRow($id, $groupId); } @@ -1022,8 +1044,8 @@ namespace Api\User { class Delete extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'id' => new Parameter('id', Parameter::TYPE_INT) )); @@ -1033,7 +1055,7 @@ namespace Api\User { public function _execute(): bool { $id = $this->getParam("id"); - if ($id === $this->user->getId()) { + if ($id === $this->context->getUser()->getId()) { return $this->createError("You cannot delete your own user."); } @@ -1043,9 +1065,9 @@ namespace Api\User { return $this->createError("User not found"); } else { - $sql = $this->user->getSQL(); - $res = $sql->delete("User")->where(new Compare("uid", $id))->execute(); - $this->success = ($res !== FALSE); + $sql = $this->context->getSQL(); + $user = new User($id); + $this->success = ($user->delete($sql) !== FALSE); $this->lastError = $sql->getLastError(); } } @@ -1055,33 +1077,33 @@ namespace Api\User { } class RequestPasswordReset extends UserAPI { - public function __construct(User $user, $externalCall = false) { + public function __construct(Context $context, $externalCall = false) { $parameters = array( 'email' => new Parameter('email', Parameter::TYPE_EMAIL), ); - $settings = $user->getConfiguration()->getSettings(); + $settings = $context->getSettings(); if ($settings->isRecaptchaEnabled()) { $parameters["captcha"] = new StringType("captcha"); } - parent::__construct($user, $externalCall, $parameters); + parent::__construct($context, $externalCall, $parameters); } public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError("You already logged in."); } - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); if (!$settings->isMailEnabled()) { return $this->createError("The mail service is not enabled, please contact the server administration."); } if ($settings->isRecaptchaEnabled()) { $captcha = $this->getParam("captcha"); - $req = new VerifyCaptcha($this->user); + $req = new VerifyCaptcha($this->context); if (!$req->execute(array("captcha" => $captcha, "action" => "resetPassword"))) { return $this->createError($req->getLastError()); } @@ -1096,14 +1118,14 @@ namespace Api\User { if ($user !== null) { $validHours = 1; $token = generateRandomString(36); - if (!$this->insertToken($user["uid"], $token, "password_reset", $validHours)) { + if (!$this->insertToken($user["id"], $token, "password_reset", $validHours)) { return false; } $baseUrl = $settings->getBaseUrl(); $siteName = $settings->getSiteName(); - $req = new Render($this->user); + $req = new Render($this->context); $this->success = $req->execute([ "file" => "mail/reset_password.twig", "parameters" => [ @@ -1124,7 +1146,7 @@ namespace Api\User { $gpgFingerprint = $user["gpg_fingerprint"]; } - $request = new \Api\Mail\Send($this->user); + $request = new \Api\Mail\Send($this->context); $this->success = $request->execute(array( "to" => $email, "subject" => "[$siteName] Password Reset", @@ -1132,7 +1154,7 @@ namespace Api\User { "gpgFingerprint" => $gpgFingerprint )); $this->lastError = $request->getLastError(); - $this->logger->info("Requested password reset for user uid=" . $user["uid"] . " by ip_address=" . $_SERVER["REMOTE_ADDR"]); + $this->logger->info("Requested password reset for user id=" . $user["id"] . " by ip_address=" . $_SERVER["REMOTE_ADDR"]); } } @@ -1140,11 +1162,11 @@ namespace Api\User { } private function findUser($email): ?array { - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid", "User.name", - "User.gpg_id", "GpgKey.confirmed as gpg_confirmed", "GpgKey.fingerprint as gpg_fingerprint") + $sql = $this->context->getSQL(); + $res = $sql->select("User.id", "User.name", + "User.gpg_id", "GpgKey.confirmed as gpg_confirmed", "GpgKey.fingerprint as gpg_fingerprint") ->from("User") - ->leftJoin("GpgKey", "GpgKey.uid", "User.gpg_id") + ->leftJoin("GpgKey", "GpgKey.id", "User.gpg_id") ->where(new Compare("User.email", $email)) ->where(new CondBool("User.confirmed")) ->execute(); @@ -1162,39 +1184,39 @@ namespace Api\User { } class ResendConfirmEmail extends UserAPI { - public function __construct(User $user, $externalCall = false) { + public function __construct(Context $context, $externalCall = false) { $parameters = array( 'email' => new Parameter('email', Parameter::TYPE_EMAIL), ); - $settings = $user->getConfiguration()->getSettings(); + $settings = $context->getSettings(); if ($settings->isRecaptchaEnabled()) { $parameters["captcha"] = new StringType("captcha"); } - parent::__construct($user, $externalCall, $parameters); + parent::__construct($context, $externalCall, $parameters); } public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError("You already logged in."); } - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); if ($settings->isRecaptchaEnabled()) { $captcha = $this->getParam("captcha"); - $req = new VerifyCaptcha($this->user); + $req = new VerifyCaptcha($this->context); if (!$req->execute(array("captcha" => $captcha, "action" => "resendConfirmation"))) { return $this->createError($req->getLastError()); } } $email = $this->getParam("email"); - $sql = $this->user->getSQL(); - $res = $sql->select("User.uid", "User.name", "UserToken.token", "UserToken.token_type", "UserToken.used") + $sql = $this->context->getSQL(); + $res = $sql->select("User.id", "User.name", "UserToken.token", "UserToken.token_type", "UserToken.used") ->from("User") - ->leftJoin("UserToken", "User.uid", "UserToken.user_id") + ->leftJoin("UserToken", "User.id", "UserToken.user_id") ->where(new Compare("User.email", $email)) ->where(new Compare("User.confirmed", false)) ->execute(); @@ -1208,7 +1230,7 @@ namespace Api\User { return true; } - $userId = $res[0]["uid"]; + $userId = $res[0]["id"]; $token = current( array_map(function ($row) { return $row["token"]; @@ -1235,7 +1257,7 @@ namespace Api\User { $baseUrl = $settings->getBaseUrl(); $siteName = $settings->getSiteName(); - $req = new Render($this->user); + $req = new Render($this->context); $this->success = $req->execute([ "file" => "mail/confirm_email.twig", "parameters" => [ @@ -1250,7 +1272,7 @@ namespace Api\User { if ($this->success) { $messageBody = $req->getResult()["html"]; - $request = new \Api\Mail\Send($this->user); + $request = new \Api\Mail\Send($this->context); $this->success = $request->execute(array( "to" => $email, "subject" => "[$siteName] E-Mail Confirmation", @@ -1266,8 +1288,8 @@ namespace Api\User { class ResetPassword extends UserAPI { - public function __construct(User $user, $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, $externalCall = false) { + parent::__construct($context, $externalCall, array( 'token' => new StringType('token', 36), 'password' => new StringType('password'), 'confirmPassword' => new StringType('confirmPassword'), @@ -1277,10 +1299,10 @@ namespace Api\User { } private function updateUser($uid, $password): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->update("User") ->set("password", $this->hashPassword($password)) - ->where(new Compare("uid", $uid)) + ->where(new Compare("id", $uid)) ->execute(); $this->success = ($res !== FALSE); @@ -1290,7 +1312,7 @@ namespace Api\User { public function _execute(): bool { - if ($this->user->isLoggedIn()) { + if ($this->context->getUser()) { return $this->createError("You are already logged in."); } @@ -1298,7 +1320,7 @@ namespace Api\User { $password = $this->getParam("password"); $confirmPassword = $this->getParam("confirmPassword"); - $req = new CheckToken($this->user); + $req = new CheckToken($this->context); $this->success = $req->execute(array("token" => $token)); $this->lastError = $req->getLastError(); if (!$this->success) { @@ -1310,10 +1332,10 @@ namespace Api\User { return $this->createError("Invalid token type"); } else if (!$this->checkPasswordRequirements($password, $confirmPassword)) { return false; - } else if (!$this->updateUser($result["user"]["uid"], $password)) { + } else if (!$this->updateUser($result["user"]["id"], $password)) { return false; } else { - $this->logger->info("Issued password reset for user uid=" . $result["user"]["uid"]); + $this->logger->info("Issued password reset for user id=" . $result["user"]["id"]); $this->invalidateToken($token); return true; } @@ -1322,8 +1344,8 @@ namespace Api\User { class UpdateProfile extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'username' => new StringType('username', 32, true, NULL), 'fullName' => new StringType('fullName', 64, true, NULL), 'password' => new StringType('password', -1, true, NULL), @@ -1347,8 +1369,8 @@ namespace Api\User { return $this->createError("You must either provide an updated username, fullName or password"); } - $sql = $this->user->getSQL(); - $query = $sql->update("User")->where(new Compare("uid", $this->user->getId())); + $sql = $this->context->getSQL(); + $query = $sql->update("User")->where(new Compare("id", $this->context->getUser()->getId())); if ($newUsername !== null) { if (!$this->checkUsernameRequirements($newUsername) || !$this->checkUserExists($newUsername)) { return false; @@ -1358,7 +1380,7 @@ namespace Api\User { } if ($newFullName !== null) { - $query->set("fullName", $newFullName); + $query->set("full_name", $newFullName); } if ($newPassword !== null || $newPasswordConfirm !== null) { @@ -1367,7 +1389,7 @@ namespace Api\User { } else { $res = $sql->select("password") ->from("User") - ->where(new Compare("uid", $this->user->getId())) + ->where(new Compare("id", $this->context->getUser()->getId())) ->execute(); $this->success = ($res !== false); @@ -1392,8 +1414,8 @@ namespace Api\User { class ImportGPG extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "pubkey" => new StringType("pubkey") )); $this->loginRequired = true; @@ -1424,7 +1446,8 @@ namespace Api\User { public function _execute(): bool { - $gpgKey = $this->user->getGPG(); + $currentUser = $this->context->getUser(); + $gpgKey = $currentUser->getGPG(); if ($gpgKey) { return $this->createError("You already added a GPG key to your account."); } @@ -1442,10 +1465,10 @@ namespace Api\User { return $this->createError($res["error"]); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->insert("GpgKey", ["fingerprint", "algorithm", "expires"]) ->addRow($keyData["fingerprint"], $keyData["algorithm"], $keyData["expires"]) - ->returning("uid") + ->returning("id") ->execute(); $this->success = ($res !== false); @@ -1457,7 +1480,7 @@ namespace Api\User { $gpgKeyId = $sql->getLastInsertId(); $res = $sql->update("User") ->set("gpg_id", $gpgKeyId) - ->where(new Compare("uid", $this->user->getId())) + ->where(new Compare("id", $currentUser->getId())) ->execute(); $this->success = ($res !== false); @@ -1468,7 +1491,7 @@ namespace Api\User { $token = generateRandomString(36); $res = $sql->insert("UserToken", ["user_id", "token", "token_type", "valid_until"]) - ->addRow($this->user->getId(), $token, "gpg_confirm", (new DateTime())->modify("+1 hour")) + ->addRow($currentUser->getId(), $token, "gpg_confirm", (new DateTime())->modify("+1 hour")) ->execute(); $this->success = ($res !== false); @@ -1477,12 +1500,12 @@ namespace Api\User { return false; } - $name = htmlspecialchars($this->user->getFullName()); + $name = htmlspecialchars($currentUser->getFullName()); if (!$name) { - $name = htmlspecialchars($this->user->getUsername()); + $name = htmlspecialchars($currentUser->getUsername()); } - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); $baseUrl = htmlspecialchars($settings->getBaseUrl()); $token = htmlspecialchars(urlencode($token)); $url = "$baseUrl/settings?confirmGPG&token=$token"; @@ -1494,9 +1517,9 @@ namespace Api\User { Best Regards
ilum:e Security Lab"; - $sendMail = new \Api\Mail\Send($this->user); + $sendMail = new \Api\Mail\Send($this->context); $this->success = $sendMail->execute(array( - "to" => $this->user->getEmail(), + "to" => $currentUser->getEmail(), "subject" => "Security Lab - Confirm GPG-Key", "body" => $mailBody, "gpgFingerprint" => $keyData["fingerprint"] @@ -1518,8 +1541,8 @@ namespace Api\User { } class RemoveGPG extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "password" => new StringType("password") )); $this->loginRequired = true; @@ -1528,15 +1551,16 @@ namespace Api\User { public function _execute(): bool { - $gpgKey = $this->user->getGPG(); + $currentUser = $this->context->getUser(); + $gpgKey = $currentUser->getGPG(); if (!$gpgKey) { return $this->createError("You have not added a GPG public key to your account yet."); } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select("password") ->from("User") - ->where(new Compare("User.uid", $this->user->getId())) + ->where(new Compare("User.id", $currentUser->getId())) ->execute(); $this->success = ($res !== false); @@ -1549,10 +1573,10 @@ namespace Api\User { return $this->createError("Incorrect password."); } else { $res = $sql->delete("GpgKey") - ->where(new Compare("uid", + ->where(new Compare("id", $sql->select("User.gpg_id") - ->from("User") - ->where(new Compare("User.uid", $this->user->getId())) + ->from("User") + ->where(new Compare("User.id", $currentUser->getId())) ))->execute(); $this->success = ($res !== false); $this->lastError = $sql->getLastError(); @@ -1565,8 +1589,8 @@ namespace Api\User { class ConfirmGPG extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "token" => new StringType("token", 36) ]); $this->loginRequired = true; @@ -1574,7 +1598,8 @@ namespace Api\User { public function _execute(): bool { - $gpgKey = $this->user->getGPG(); + $currentUser = $this->context->getUser(); + $gpgKey = $currentUser->getGPG(); if (!$gpgKey) { return $this->createError("You have not added a GPG key yet."); } else if ($gpgKey->isConfirmed()) { @@ -1582,12 +1607,12 @@ namespace Api\User { } $token = $this->getParam("token"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $res = $sql->select($sql->count()) ->from("UserToken") ->where(new Compare("token", $token)) ->where(new Compare("valid_until", $sql->now(), ">=")) - ->where(new Compare("user_id", $this->user->getId())) + ->where(new Compare("user_id", $currentUser->getId())) ->where(new Compare("token_type", "gpg_confirm")) ->where(new CondNot(new CondBool("used"))) ->execute(); @@ -1601,7 +1626,7 @@ namespace Api\User { } else { $res = $sql->update("GpgKey") ->set("confirmed", 1) - ->where(new Compare("uid", $gpgKey->getId())) + ->where(new Compare("id", $gpgKey->getId())) ->execute(); $this->success = ($res !== false); @@ -1625,8 +1650,8 @@ namespace Api\User { } class DownloadGPG extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "id" => new Parameter("id", Parameter::TYPE_INT, true, null), "format" => new StringType("format", 16, true, "ascii") )); @@ -1642,17 +1667,18 @@ namespace Api\User { return $this->getParam("Invalid requested format. Allowed formats: " . implode(",", $allowedFormats)); } + $currentUser = $this->context->getUser(); $userId = $this->getParam("id"); - if ($userId === null || $userId == $this->user->getId()) { - $gpgKey = $this->user->getGPG(); + if ($userId === null || $userId == $currentUser->getId()) { + $gpgKey = $currentUser->getGPG(); if (!$gpgKey) { return $this->createError("You did not add a gpg key yet."); } - $email = $this->user->getEmail(); + $email = $currentUser->getEmail(); $gpgFingerprint = $gpgKey->getFingerprint(); } else { - $req = new Get($this->user); + $req = new Get($this->context); $this->success = $req->execute(["id" => $userId]); $this->lastError = $req->getLastError(); if (!$this->success) { @@ -1695,8 +1721,8 @@ namespace Api\User { } class UploadPicture extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, [ + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, [ "scale" => new Parameter("scale", Parameter::TYPE_FLOAT, true, NULL), ]); $this->loginRequired = true; @@ -1774,14 +1800,15 @@ namespace Api\User { public function _execute(): bool { - $userId = $this->user->getId(); + $currentUser = $this->context->getUser(); + $userId = $currentUser->getId(); $uploadDir = WEBROOT . "/img/uploads/user/$userId"; - list ($fileName, $imageName) = $this->processImageUpload($uploadDir, ["png","jpg","jpeg"], "onTransform"); + list ($fileName, $imageName) = $this->processImageUpload($uploadDir, ["png", "jpg", "jpeg"], "onTransform"); if (!$this->success) { return false; } - $oldPfp = $this->user->getProfilePicture(); + $oldPfp = $currentUser->getProfilePicture(); if ($oldPfp) { $path = "$uploadDir/$oldPfp"; if (is_file($path)) { @@ -1789,10 +1816,10 @@ namespace Api\User { } } - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $this->success = $sql->update("User") - ->set("profilePicture", $fileName) - ->where(new Compare("uid", $userId)) + ->set("profile_picture", $fileName) + ->where(new Compare("id", $userId)) ->execute(); $this->lastError = $sql->getLastError(); @@ -1805,23 +1832,24 @@ namespace Api\User { } class RemovePicture extends UserAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->loginRequired = true; } public function _execute(): bool { - $pfp = $this->user->getProfilePicture(); + $currentUser = $this->context->getUser(); + $pfp = $currentUser->getProfilePicture(); if (!$pfp) { return $this->createError("You did not upload a profile picture yet"); } - $userId = $this->user->getId(); - $sql = $this->user->getSQL(); + $userId = $currentUser->getId(); + $sql = $this->context->getSQL(); $this->success = $sql->update("User") - ->set("profilePicture", NULL) - ->where(new Compare("uid", $userId)) + ->set("profile_picture", NULL) + ->where(new Compare("id", $userId)) ->execute(); $this->lastError = $sql->getLastError(); diff --git a/core/Api/VerifyCaptcha.class.php b/core/Api/VerifyCaptcha.class.php index 2345ab3..486a5d4 100644 --- a/core/Api/VerifyCaptcha.class.php +++ b/core/Api/VerifyCaptcha.class.php @@ -3,12 +3,12 @@ namespace Api; use Api\Parameter\StringType; -use Objects\User; +use Objects\Context; class VerifyCaptcha extends Request { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "captcha" => new StringType("captcha"), "action" => new StringType("action"), )); @@ -17,7 +17,7 @@ class VerifyCaptcha extends Request { } public function _execute(): bool { - $settings = $this->user->getConfiguration()->getSettings(); + $settings = $this->context->getSettings(); if (!$settings->isRecaptchaEnabled()) { return $this->createError("Google reCaptcha is not enabled."); } diff --git a/core/Api/VisitorsAPI.class.php b/core/Api/VisitorsAPI.class.php index 62a6be0..4fca437 100644 --- a/core/Api/VisitorsAPI.class.php +++ b/core/Api/VisitorsAPI.class.php @@ -2,11 +2,11 @@ namespace Api { - use Objects\User; + use Objects\Context; abstract class VisitorsAPI extends Request { - public function __construct(User $user, bool $externalCall = false, array $params = []) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall = false, array $params = []) { + parent::__construct($context, $externalCall, $params); } } } @@ -21,18 +21,18 @@ namespace Api\Visitors { use Driver\SQL\Expression\Add; use Driver\SQL\Query\Select; use Driver\SQL\Strategy\UpdateStrategy; - use Objects\User; + use Objects\Context; class ProcessVisit extends VisitorsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( "cookie" => new StringType("cookie") )); $this->isPublic = false; } public function _execute(): bool { - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $cookie = $this->getParam("cookie"); $day = (new DateTime())->format("Ymd"); $sql->insert("Visitor", array("cookie", "day")) @@ -47,8 +47,8 @@ namespace Api\Visitors { } class Stats extends VisitorsAPI { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, array( + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, array( 'type' => new StringType('type', 32), 'date' => new Parameter('date', Parameter::TYPE_DATE, true, new DateTime()) )); @@ -81,7 +81,7 @@ namespace Api\Visitors { $date = $this->getParam("date"); $type = $this->getParam("type"); - $sql = $this->user->getSQL(); + $sql = $this->context->getSQL(); $query = $sql->select($sql->count(), "day") ->from("Visitor") ->where(new Compare("count", 1, ">")) diff --git a/core/Configuration/CreateDatabase.class.php b/core/Configuration/CreateDatabase.class.php index b3d317b..f6fdd21 100644 --- a/core/Configuration/CreateDatabase.class.php +++ b/core/Configuration/CreateDatabase.class.php @@ -5,90 +5,27 @@ namespace Configuration; use Driver\SQL\SQL; use \Driver\SQL\Strategy\SetNullStrategy; use \Driver\SQL\Strategy\CascadeStrategy; +use Objects\DatabaseEntity\DatabaseEntity; +use PHPUnit\Util\Exception; class CreateDatabase extends DatabaseScript { public static function createQueries(SQL $sql): array { $queries = array(); - // Language - $queries[] = $sql->createTable("Language") - ->addSerial("uid") - ->addString("code", 5) - ->addString("name", 32) - ->primaryKey("uid") - ->unique("code") - ->unique("name"); + self::loadEntities($queries, $sql); $queries[] = $sql->insert("Language", array("code", "name")) ->addRow("en_US", 'American English') ->addRow("de_DE", 'Deutsch Standard'); - - $queries[] = $sql->createTable("GpgKey") - ->addSerial("uid") - ->addString("fingerprint", 64) - ->addDateTime("added", false, $sql->now()) - ->addDateTime("expires") - ->addBool("confirmed") - ->addString("algorithm", 32) - ->primaryKey("uid"); - - $queries[] = $sql->createTable("2FA") - ->addSerial("uid") - ->addEnum("type", ["totp","fido"]) - ->addString("data", 512) // either totp secret, fido challenge or fido public key information - ->addBool("confirmed", false) - ->addDateTime("added", false, $sql->now()) - ->primaryKey("uid"); - - $queries[] = $sql->createTable("User") - ->addSerial("uid") - ->addString("email", 64, true) - ->addString("name", 32) - ->addString("password", 128) - ->addString("fullName", 64, false, "") - ->addString("profilePicture", 64, true) - ->addDateTime("last_online", true, NULL) - ->addBool("confirmed", false) - ->addInt("language_id", true, 1) - ->addInt("gpg_id", true) - ->addInt("2fa_id", true) - ->addDateTime("registered_at", false, $sql->currentTimestamp()) - ->primaryKey("uid") - ->unique("email") - ->unique("name") - ->foreignKey("language_id", "Language", "uid", new SetNullStrategy()) - ->foreignKey("gpg_id", "GpgKey", "uid", new SetNullStrategy()) - ->foreignKey("2fa_id", "2FA", "uid", new SetNullStrategy()); - - $queries[] = $sql->createTable("Session") - ->addSerial("uid") - ->addBool("active", true) - ->addDateTime("expires") - ->addInt("user_id") - ->addString("ipAddress", 45) - ->addString("os", 64) - ->addString("browser", 64) - ->addJson("data", false, '{}') - ->addBool("stay_logged_in", true) - ->addString("csrf_token", 16) - ->primaryKey("uid", "user_id") - ->foreignKey("user_id", "User", "uid", new CascadeStrategy()); - $queries[] = $sql->createTable("UserToken") ->addInt("user_id") ->addString("token", 36) ->addEnum("token_type", array("password_reset", "email_confirm", "invite", "gpg_confirm")) ->addDateTime("valid_until") ->addBool("used", false) - ->foreignKey("user_id", "User", "uid", new CascadeStrategy()); - $queries[] = $sql->createTable("Group") - ->addSerial("uid") - ->addString("name", 32) - ->addString("color", 10) - ->primaryKey("uid") - ->unique("name"); + ->foreignKey("user_id", "User", "id", new CascadeStrategy()); $queries[] = $sql->insert("Group", array("name", "color")) ->addRow(USER_GROUP_MODERATOR_NAME, "#007bff") @@ -99,42 +36,25 @@ class CreateDatabase extends DatabaseScript { ->addInt("user_id") ->addInt("group_id") ->unique("user_id", "group_id") - ->foreignKey("user_id", "User", "uid", new CascadeStrategy()) - ->foreignKey("group_id", "Group", "uid", new CascadeStrategy()); - - $queries[] = $sql->createTable("Notification") - ->addSerial("uid") - ->addEnum("type", array("default", "message", "warning"), false, "default") - ->addDateTime("created_at", false, $sql->currentTimestamp()) - ->addString("title", 32) - ->addString("message", 256) - ->primaryKey("uid"); + ->foreignKey("user_id", "User", "id", new CascadeStrategy()) + ->foreignKey("group_id", "Group", "id", new CascadeStrategy()); $queries[] = $sql->createTable("UserNotification") ->addInt("user_id") ->addInt("notification_id") ->addBool("seen", false) - ->foreignKey("user_id", "User", "uid") - ->foreignKey("notification_id", "Notification", "uid") + ->foreignKey("user_id", "User", "id") + ->foreignKey("notification_id", "Notification", "id") ->unique("user_id", "notification_id"); $queries[] = $sql->createTable("GroupNotification") ->addInt("group_id") ->addInt("notification_id") ->addBool("seen", false) - ->foreignKey("group_id", "Group", "uid") - ->foreignKey("notification_id", "Notification", "uid") + ->foreignKey("group_id", "Group", "id") + ->foreignKey("notification_id", "Notification", "id") ->unique("group_id", "notification_id"); - $queries[] = $sql->createTable("ApiKey") - ->addSerial("uid") - ->addInt("user_id") - ->addBool("active", true) - ->addString("api_key", 64) - ->addDateTime("valid_until") - ->primaryKey("uid") - ->foreignKey("user_id", "User", "uid"); - $queries[] = $sql->createTable("Visitor") ->addInt("day") ->addInt("count", false, 1) @@ -142,14 +62,14 @@ class CreateDatabase extends DatabaseScript { ->unique("day", "cookie"); $queries[] = $sql->createTable("Route") - ->addSerial("uid") + ->addSerial("id") ->addString("request", 128) ->addEnum("action", array("redirect_temporary", "redirect_permanently", "static", "dynamic")) ->addString("target", 128) ->addString("extra", 64, true) ->addBool("active", true) ->addBool("exact", true) - ->primaryKey("uid") + ->primaryKey("id") ->unique("request"); $queries[] = $sql->insert("Route", ["request", "action", "target", "extra", "exact"]) @@ -184,17 +104,17 @@ class CreateDatabase extends DatabaseScript { $queries[] = $settingsQuery; $queries[] = $sql->createTable("ContactRequest") - ->addSerial("uid") + ->addSerial("id") ->addString("from_name", 32) ->addString("from_email", 64) ->addString("message", 512) ->addString("messageId", 78, true) # null = don't sync with mails (usually if mail could not be sent) ->addDateTime("created_at", false, $sql->currentTimestamp()) ->unique("messageId") - ->primaryKey("uid"); + ->primaryKey("id"); $queries[] = $sql->createTable("ContactMessage") - ->addSerial("uid") + ->addSerial("id") ->addInt("request_id") ->addInt("user_id", true) # null = customer has sent this message ->addString("message", 512) @@ -202,9 +122,9 @@ class CreateDatabase extends DatabaseScript { ->addDateTime("created_at", false, $sql->currentTimestamp()) ->addBool("read", false) ->unique("messageId") - ->primaryKey("uid") - ->foreignKey("request_id", "ContactRequest", "uid", new CascadeStrategy()) - ->foreignKey("user_id", "User", "uid", new SetNullStrategy()); + ->primaryKey("id") + ->foreignKey("request_id", "ContactRequest", "id", new CascadeStrategy()) + ->foreignKey("user_id", "User", "id", new SetNullStrategy()); $queries[] = $sql->createTable("ApiPermission") ->addString("method", 32) @@ -213,7 +133,7 @@ class CreateDatabase extends DatabaseScript { ->primaryKey("method"); $queries[] = $sql->createTable("MailQueue") - ->addSerial("uid") + ->addSerial("id") ->addString("from", 64) ->addString("to", 64) ->addString("subject") @@ -225,18 +145,9 @@ class CreateDatabase extends DatabaseScript { ->addInt("retryCount", false, 5) ->addDateTime("nextTry", false, $sql->now()) ->addString("errorMessage", NULL, true) - ->primaryKey("uid"); + ->primaryKey("id"); $queries = array_merge($queries, \Configuration\Patch\EntityLog_2021_04_08::createTableLog($sql, "MailQueue", 30)); - $queries[] = $sql->createTable("News") - ->addSerial("uid") - ->addInt("publishedBy") - ->addDateTime("publishedAt", false, $sql->now()) - ->addString("title", 128) - ->addString("text", 1024) - ->foreignKey("publishedBy", "User", "uid", new CascadeStrategy()) - ->primaryKey("uid"); - $queries[] = $sql->insert("ApiPermission", array("method", "groups", "description")) ->addRow("ApiKey/create", array(), "Allows users to create API-Keys for themselves") ->addRow("ApiKey/fetch", array(), "Allows users to list their API-Keys") @@ -265,7 +176,6 @@ class CreateDatabase extends DatabaseScript { ->addRow("Contact/get", array(USER_GROUP_ADMIN, USER_GROUP_SUPPORT), "Allows users to see messages within a contact request"); self::loadPatches($queries, $sql); - self::loadEntities($queries, $sql); return $queries; } @@ -293,18 +203,47 @@ class CreateDatabase extends DatabaseScript { if (file_exists($entityDirectory) && is_dir($entityDirectory)) { $scan_arr = scandir($entityDirectory); $files_arr = array_diff($scan_arr, array('.', '..')); + $handlers = []; foreach ($files_arr as $file) { $suffix = ".class.php"; if (endsWith($file, $suffix)) { $className = substr($file, 0, strlen($file) - strlen($suffix)); - if (!in_array($className, ["DatabaseEntity", "DatabaseEntityHandler"])) { + if (!in_array($className, ["DatabaseEntity", "DatabaseEntityQuery", "DatabaseEntityHandler"])) { $className = "\\Objects\\DatabaseEntity\\$className"; - $method = "$className::getHandler"; - $handler = call_user_func($method, $sql); - $queries[] = $handler->getTableQuery(); + $reflectionClass = new \ReflectionClass($className); + if ($reflectionClass->isSubclassOf(DatabaseEntity::class)) { + $method = "$className::getHandler"; + $handler = call_user_func($method, $sql); + $handlers[$handler->getTableName()] = $handler; + } } } } + + $tableCount = count($handlers); + $createdTables = []; + while (!empty($handlers)) { + $prevCount = $tableCount; + $unmetDependenciesTotal = []; + + foreach ($handlers as $tableName => $handler) { + $dependsOn = $handler->dependsOn(); + $unmetDependencies = array_diff($dependsOn, $createdTables); + if (empty($unmetDependencies)) { + $queries[] = $handler->getTableQuery(); + $createdTables[] = $tableName; + unset($handlers[$tableName]); + } else { + $unmetDependenciesTotal = array_merge($unmetDependenciesTotal, $unmetDependencies); + } + } + + $tableCount = count($handlers); + if ($tableCount === $prevCount) { + throw new Exception("Circular or unmet table dependency detected. Unmet dependencies: " + . implode(", ", $unmetDependenciesTotal)); + } + } } } } diff --git a/core/Configuration/Patch/EntityLog_2021_04_08.class.php b/core/Configuration/Patch/EntityLog_2021_04_08.class.php index f43a480..febf6fc 100644 --- a/core/Configuration/Patch/EntityLog_2021_04_08.class.php +++ b/core/Configuration/Patch/EntityLog_2021_04_08.class.php @@ -19,7 +19,7 @@ class EntityLog_2021_04_08 extends DatabaseScript { ->after()->insert($table) ->exec(new CreateProcedure($sql, "InsertEntityLog"), [ "tableName" => new CurrentTable(), - "entityId" => new CurrentColumn("uid"), + "entityId" => new CurrentColumn("id"), "lifetime" => $lifetime, ]), @@ -27,14 +27,14 @@ class EntityLog_2021_04_08 extends DatabaseScript { ->after()->update($table) ->exec(new CreateProcedure($sql, "UpdateEntityLog"), [ "tableName" => new CurrentTable(), - "entityId" => new CurrentColumn("uid"), + "entityId" => new CurrentColumn("id"), ]), $sql->createTrigger("${table}_trg_delete") ->after()->delete($table) ->exec(new CreateProcedure($sql, "DeleteEntityLog"), [ "tableName" => new CurrentTable(), - "entityId" => new CurrentColumn("uid"), + "entityId" => new CurrentColumn("id"), ]) ]; } @@ -51,32 +51,32 @@ class EntityLog_2021_04_08 extends DatabaseScript { $insertProcedure = $sql->createProcedure("InsertEntityLog") ->param(new CurrentTable()) - ->param(new IntColumn("uid")) + ->param(new IntColumn("id")) ->param(new IntColumn("lifetime", false, 90)) ->returns(new Trigger()) ->exec(array( $sql->insert("EntityLog", ["entityId", "tableName", "lifetime"]) - ->addRow(new CurrentColumn("uid"), new CurrentTable(), new CurrentColumn("lifetime")) + ->addRow(new CurrentColumn("id"), new CurrentTable(), new CurrentColumn("lifetime")) )); $updateProcedure = $sql->createProcedure("UpdateEntityLog") ->param(new CurrentTable()) - ->param(new IntColumn("uid")) + ->param(new IntColumn("id")) ->returns(new Trigger()) ->exec(array( $sql->update("EntityLog") ->set("modified", $sql->now()) - ->where(new Compare("entityId", new CurrentColumn("uid"))) + ->where(new Compare("entityId", new CurrentColumn("id"))) ->where(new Compare("tableName", new CurrentTable())) )); $deleteProcedure = $sql->createProcedure("DeleteEntityLog") ->param(new CurrentTable()) - ->param(new IntColumn("uid")) + ->param(new IntColumn("id")) ->returns(new Trigger()) ->exec(array( $sql->delete("EntityLog") - ->where(new Compare("entityId", new CurrentColumn("uid"))) + ->where(new Compare("entityId", new CurrentColumn("id"))) ->where(new Compare("tableName", new CurrentTable())) )); diff --git a/core/Configuration/Patch/SystemLog_2022_03_30.class.php b/core/Configuration/Patch/SystemLog_2022_03_30.class.php index 78e0337..3bcf5d5 100644 --- a/core/Configuration/Patch/SystemLog_2022_03_30.class.php +++ b/core/Configuration/Patch/SystemLog_2022_03_30.class.php @@ -9,14 +9,6 @@ class SystemLog_2022_03_30 extends DatabaseScript { public static function createQueries(SQL $sql): array { return [ - $sql->createTable("SystemLog") - ->onlyIfNotExists() - ->addSerial("id") - ->addDateTime("timestamp", false, $sql->now()) - ->addString("message") - ->addString("module", 64, false, "global") - ->addEnum("severity", ["debug", "info", "warning", "error", "severe"]) - ->primaryKey("id"), $sql->insert("ApiPermission", ["method", "groups", "description"]) ->addRow("Logs/get", [USER_GROUP_ADMIN], "Allows users to fetch system logs") ]; diff --git a/core/Configuration/Settings.class.php b/core/Configuration/Settings.class.php index 6c189ce..1e9ee2a 100644 --- a/core/Configuration/Settings.class.php +++ b/core/Configuration/Settings.class.php @@ -7,7 +7,7 @@ namespace Configuration; use Driver\SQL\Query\Insert; -use Objects\User; +use Objects\Context; class Settings { @@ -58,8 +58,8 @@ class Settings { return $settings; } - public function loadFromDatabase(User $user): bool { - $req = new \Api\Settings\Get($user); + public function loadFromDatabase(Context $context): bool { + $req = new \Api\Settings\Get($context); $success = $req->execute(); if ($success) { @@ -78,7 +78,7 @@ class Settings { $this->allowedExtensions = explode(",", $result["allowed_extensions"] ?? strtolower(implode(",", $this->allowedExtensions))); if (!isset($result["jwt_secret"])) { - $req = new \Api\Settings\Set($user); + $req = new \Api\Settings\Set($context); $req->execute(array("settings" => array( "jwt_secret" => $this->jwtSecret ))); @@ -135,4 +135,8 @@ class Settings { public function isExtensionAllowed(string $ext): bool { return empty($this->allowedExtensions) || in_array(strtolower(trim($ext)), $this->allowedExtensions); } + + public function getDomain(): string { + return parse_url($this->getBaseUrl(), PHP_URL_HOST); + } } \ No newline at end of file diff --git a/core/Documents/Account.class.php b/core/Documents/Account.class.php index 0bdbaad..0960911 100644 --- a/core/Documents/Account.class.php +++ b/core/Documents/Account.class.php @@ -23,7 +23,7 @@ class Account extends TemplateDocument { if ($this->getTemplateName() === "account/reset_password.twig") { if (isset($_GET["token"]) && is_string($_GET["token"]) && !empty($_GET["token"])) { $this->parameters["view"]["token"] = $_GET["token"]; - $req = new \Api\User\CheckToken($this->getUser()); + $req = new \Api\User\CheckToken($this->getContext()); $this->parameters["view"]["success"] = $req->execute(array("token" => $_GET["token"])); if ($this->parameters["view"]["success"]) { if (strcmp($req->getResult()["token"]["type"], "password_reset") !== 0) { @@ -35,18 +35,18 @@ class Account extends TemplateDocument { } } else if ($this->getTemplateName() === "account/register.twig") { $settings = $this->getSettings(); - if ($this->getUser()->isLoggedIn()) { + if ($this->getUser()) { $this->createError("You are already logged in."); } else if (!$settings->isRegistrationAllowed()) { $this->createError("Registration is not enabled on this website."); } - } else if ($this->getTemplateName() === "account/login.twig" && $this->getUser()->isLoggedIn()) { + } else if ($this->getTemplateName() === "account/login.twig" && $this->getUser()) { header("Location: /admin"); exit(); } else if ($this->getTemplateName() === "account/accept_invite.twig") { if (isset($_GET["token"]) && is_string($_GET["token"]) && !empty($_GET["token"])) { $this->parameters["view"]["token"] = $_GET["token"]; - $req = new \Api\User\CheckToken($this->getUser()); + $req = new \Api\User\CheckToken($this->getContext()); $this->parameters["view"]["success"] = $req->execute(array("token" => $_GET["token"])); if ($this->parameters["view"]["success"]) { if (strcmp($req->getResult()["token"]["type"], "invite") !== 0) { diff --git a/core/Documents/Admin.class.php b/core/Documents/Admin.class.php index ac6711e..3839cfe 100644 --- a/core/Documents/Admin.class.php +++ b/core/Documents/Admin.class.php @@ -7,9 +7,9 @@ use Objects\Router\Router; class Admin extends TemplateDocument { public function __construct(Router $router) { - $user = $router->getUser(); - $template = $user->isLoggedIn() ? "admin.twig" : "redirect.twig"; - $params = $user->isLoggedIn() ? [] : ["url" => "/login"]; + $user = $router->getContext()->getUser(); + $template = $user ? "admin.twig" : "redirect.twig"; + $params = $user ? [] : ["url" => "/login"]; parent::__construct($router, $template, $params); $this->enableCSP(); } diff --git a/core/Documents/Info.class.php b/core/Documents/Info.class.php index 901bd15..d775b6d 100644 --- a/core/Documents/Info.class.php +++ b/core/Documents/Info.class.php @@ -16,7 +16,7 @@ class Info extends HtmlDocument { class InfoBody extends SimpleBody { protected function getContent(): string { $user = $this->getDocument()->getUser(); - if ($user->isLoggedIn() && $user->hasGroup(USER_GROUP_ADMIN)) { + if ($user && $user->hasGroup(USER_GROUP_ADMIN)) { phpinfo(); return ""; } else { diff --git a/core/Documents/Install.class.php b/core/Documents/Install.class.php index 6bd9ecd..5f6093f 100644 --- a/core/Documents/Install.class.php +++ b/core/Documents/Install.class.php @@ -159,15 +159,15 @@ namespace Documents\Install { } } - $user = $this->getDocument()->getUser(); - $config = $user->getConfiguration(); + $context = $this->getDocument()->getContext(); + $config = $context->getConfig(); // Check if database configuration exists if (!$config->getDatabase()) { return self::DATABASE_CONFIGURATION; } - $sql = $user->getSQL(); + $sql = $context->getSQL(); if (!$sql || !$sql->isConnected()) { return self::DATABASE_CONFIGURATION; } @@ -185,7 +185,7 @@ namespace Documents\Install { } if ($step === self::ADD_MAIL_SERVICE) { - $req = new \Api\Settings\Get($user); + $req = new \Api\Settings\Get($context); $success = $req->execute(array("key" => "^mail_enabled$")); if (!$success) { $this->errorString = $req->getLastError(); @@ -193,12 +193,12 @@ namespace Documents\Install { } else if (isset($req->getResult()["settings"]["mail_enabled"])) { $step = self::FINISH_INSTALLATION; - $req = new \Api\Settings\Set($user); + $req = new \Api\Settings\Set($context); $success = $req->execute(array("settings" => array("installation_completed" => "1"))); if (!$success) { $this->errorString = $req->getLastError(); } else { - $req = new \Api\Notifications\Create($user); + $req = new \Api\Notifications\Create($context); $req->execute(array( "title" => "Welcome", "message" => "Your Web-base was successfully installed. Check out the admin dashboard. Have fun!", @@ -365,21 +365,23 @@ namespace Documents\Install { } } - $user = $this->getDocument()->getUser(); - $config = $user->getConfiguration(); - if (Configuration::create("Database", $connectionData) === false) { - $success = false; - $msg = "Unable to write database file"; - } else { - $config->setDatabase($connectionData); - if (!$user->connectDB()) { + if ($success) { + $context = $this->getDocument()->getContext(); + $config = $context->getConfig(); + if (Configuration::create("Database", $connectionData) === false) { $success = false; - $msg = "Unable to verify database connection after installation"; + $msg = "Unable to write database file"; } else { - $req = new \Api\Routes\GenerateCache($user); - if (!$req->execute()) { + $config->setDatabase($connectionData); + if (!$context->initSQL()) { $success = false; - $msg = "Unable to write route file: " . $req->getLastError(); + $msg = "Unable to verify database connection after installation"; + } else { + $req = new \Api\Routes\GenerateCache($context); + if (!$req->execute()) { + $success = false; + $msg = "Unable to write route file: " . $req->getLastError(); + } } } } @@ -393,9 +395,9 @@ namespace Documents\Install { private function createUser(): array { - $user = $this->getDocument()->getUser(); + $context = $this->getDocument()->getContext(); if ($this->getParameter("prev") === "true") { - $success = $user->getConfiguration()->delete("Database"); + $success = $context->getConfig()->delete("Database"); $msg = $success ? "" : error_get_last(); return array("success" => $success, "msg" => $msg); } @@ -427,8 +429,7 @@ namespace Documents\Install { $msg = "Please fill out the following inputs:
" . $this->createUnorderedList($missingInputs); } else { - $sql = $user->getSQL(); - $req = new \Api\User\Create($user); + $req = new \Api\User\Create($context); $success = $req->execute(array( 'username' => $username, 'email' => $email, @@ -438,6 +439,7 @@ namespace Documents\Install { $msg = $req->getLastError(); if ($success) { + $sql = $context->getSQL(); $success = $sql->insert("UserGroup", array("group_id", "user_id")) ->addRow(USER_GROUP_ADMIN, $req->getResult()["userId"]) ->execute(); @@ -450,18 +452,16 @@ namespace Documents\Install { private function addMailService(): array { - $user = $this->getDocument()->getUser(); + $context = $this->getDocument()->getContext(); if ($this->getParameter("prev") === "true") { - $sql = $user->getSQL(); + $sql = $context->getSQL(); $success = $sql->delete("User")->execute(); $msg = $sql->getLastError(); return array("success" => $success, "msg" => $msg); } - $success = true; - $msg = $this->errorString; if ($this->getParameter("skip") === "true") { - $req = new \Api\Settings\Set($user); + $req = new \Api\Settings\Set($context); $success = $req->execute(array("settings" => array("mail_enabled" => "0"))); $msg = $req->getLastError(); } else { @@ -473,17 +473,17 @@ namespace Documents\Install { $success = true; $missingInputs = array(); - if (is_null($address) || empty($address)) { + if (empty($address)) { $success = false; $missingInputs[] = "SMTP Address"; } - if (is_null($port) || empty($port)) { + if (empty($port)) { $success = false; $missingInputs[] = "Port"; } - if (is_null($username) || empty($username)) { + if (empty($username)) { $success = false; $missingInputs[] = "Username"; } @@ -527,7 +527,7 @@ namespace Documents\Install { } if ($success) { - $req = new \Api\Settings\Set($user); + $req = new \Api\Settings\Set($context); $success = $req->execute(array("settings" => array( "mail_enabled" => "1", "mail_host" => "$address", @@ -655,39 +655,25 @@ namespace Documents\Install { } } - $replacements = array("+" => " ", "&" => "\" ", "=" => "=\""); - $attributes = http_build_query($attributes) . "\""; - foreach ($replacements as $key => $val) { - $attributes = str_replace($key, $val, $attributes); - } - + // $attributes = html_attributes($attributes); if ($type === "select") { $items = $formItem["items"] ?? array(); - $element = ""; + + $element = html_tag_ex("select", $attributes, $options, false); } else { - $element = ""; + $element = html_tag_short("input", $attributes); } - if (!$inline) { - return - "
- - $element -
"; - } else { - return - "
- - $element -
"; - } + $label = html_tag_ex("label", ["for" => $name], $title, true, false); + $className = ($inline ? "col-md-6 mb-3" : "d-block my-3"); + return html_tag_ex("div", ["class" => $className], $label . $element, false); } - private function createProgessMainview(): string { + private function createProgressMainview(): string { $isDocker = $this->isDocker(); $defaultHost = ($isDocker ? "db" : "localhost"); @@ -773,7 +759,7 @@ namespace Documents\Install { $spinnerIcon = $this->createIcon("spinner"); $title = $currentView["title"]; - $html = "

$title


"; + $html = "

$title


"; if (isset($currentView["text"])) { $text = $currentView["text"]; @@ -905,7 +891,7 @@ namespace Documents\Install { } $progressSidebar = $this->createProgressSidebar(); - $progressMainview = $this->createProgessMainview(); + $progressMainView = $this->createProgressMainview(); $errorStyle = ($this->errorString ? '' : ' style="display:none"'); $errorClass = ($this->errorString ? ' alert-danger' : ''); @@ -931,7 +917,7 @@ namespace Documents\Install {
- $progressMainview + $progressMainView
$this->errorString
diff --git a/core/Driver/Logger/Logger.class.php b/core/Driver/Logger/Logger.class.php index c8374be..e059dd9 100644 --- a/core/Driver/Logger/Logger.class.php +++ b/core/Driver/Logger/Logger.class.php @@ -34,13 +34,16 @@ class Logger { } protected function getStackTrace(int $pop = 2): string { - $debugTrace = debug_backtrace(); + $debugTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); if ($pop > 0) { array_splice($debugTrace, 0, $pop); } - return implode("\n", array_map(function ($trace) { - return $trace["file"] . "#" . $trace["line"] . ": " . $trace["function"] . "()"; + if (isset($trace["file"])) { + return $trace["file"] . "#" . $trace["line"] . ": " . $trace["function"] . "()"; + } else { + return $trace["function"] . "()"; + } }, $debugTrace)); } @@ -93,8 +96,8 @@ class Logger { return $message; } - public function debug(string $message): string { - $this->log($message, "debug"); + public function debug(string $message, bool $appendStackTrace = false): string { + $this->log($message, "debug", $appendStackTrace); return $message; } diff --git a/core/Driver/SQL/Query/Select.class.php b/core/Driver/SQL/Query/Select.class.php index 3073ffb..31ac8e4 100644 --- a/core/Driver/SQL/Query/Select.class.php +++ b/core/Driver/SQL/Query/Select.class.php @@ -43,6 +43,11 @@ class Select extends Query { return $this; } + public function addValue($value): Select { + $this->selectValues[] = $value; + return $this; + } + public function where(...$conditions): Select { $this->conditions[] = (count($conditions) === 1 ? $conditions : new CondOr($conditions)); return $this; @@ -63,6 +68,11 @@ class Select extends Query { return $this; } + public function addJoin(Join $join): Select { + $this->joins[] = $join; + return $this; + } + public function groupBy(...$columns): Select { $this->groupColumns = $columns; return $this; diff --git a/core/Driver/SQL/SQL.class.php b/core/Driver/SQL/SQL.class.php index 8ebf748..e61b4e4 100644 --- a/core/Driver/SQL/SQL.class.php +++ b/core/Driver/SQL/SQL.class.php @@ -52,16 +52,19 @@ abstract class SQL { protected ConnectionData $connectionData; protected int $lastInsertId; + protected bool $logQueries; + public function __construct($connectionData) { $this->connection = NULL; $this->lastError = 'Unknown Error'; $this->connectionData = $connectionData; $this->lastInsertId = 0; $this->logger = new Logger(getClassName($this), $this); + $this->logQueries = false; } public function isConnected(): bool { - return !is_null($this->connection); + return !is_null($this->connection) && !is_bool($this->connection); } public function getLastError(): string { @@ -131,7 +134,7 @@ abstract class SQL { $parameters = []; $queryStr = $query->build($parameters); - if($query->dump) { + if ($query->dump) { var_dump($queryStr); var_dump($parameters); } @@ -149,6 +152,31 @@ abstract class SQL { $this->fetchReturning($res, $generatedColumn); } + if ($this->logQueries && (!($query instanceof Insert) || $query->getTableName() !== "SystemLog")) { + + if ($success === false || $fetchType == self::FETCH_NONE) { + $result = var_export($success, true); + } else if ($fetchType === self::FETCH_ALL) { + $result = count($res) . " rows"; + } else if ($fetchType === self::FETCH_ONE) { + $result = ($res === null ? "(empty)" : "1 row"); + } else if ($fetchType === self::FETCH_ITERATIVE) { + $result = $res->getNumRows() . " rows (iterative)"; + } else { + $result = "Unknown"; + } + + $message = sprintf("Query: %s, Parameters: %s, Result: %s", + var_export($queryStr, true), var_export($parameters, true), $result + ); + + if ($success === false) { + $message .= "Error: " . var_export($this->lastError, true); + } + + $this->logger->debug($message); + } + return $fetchType === self::FETCH_NONE ? $success : $res; } diff --git a/core/Elements/Document.class.php b/core/Elements/Document.class.php index 3ac8991..52099d7 100644 --- a/core/Elements/Document.class.php +++ b/core/Elements/Document.class.php @@ -5,8 +5,9 @@ namespace Elements; use Configuration\Settings; use Driver\Logger\Logger; use Driver\SQL\SQL; +use Objects\Context; use Objects\Router\Router; -use Objects\User; +use Objects\DatabaseEntity\User; abstract class Document { @@ -32,16 +33,20 @@ abstract class Document { return $this->logger; } - public function getUser(): User { - return $this->router->getUser(); + public function getUser(): ?User { + return $this->getContext()->getUser(); + } + + public function getContext(): Context { + return $this->router->getContext(); } public function getSQL(): ?SQL { - return $this->getUser()->getSQL(); + return $this->getContext()->getSQL(); } public function getSettings(): Settings { - return $this->getUser()->getConfiguration()->getSettings(); + return $this->getContext()->getSettings(); } public function getCSPNonce(): ?string { diff --git a/core/Elements/HtmlDocument.class.php b/core/Elements/HtmlDocument.class.php index 2a3707a..035f51c 100644 --- a/core/Elements/HtmlDocument.class.php +++ b/core/Elements/HtmlDocument.class.php @@ -65,10 +65,10 @@ class HtmlDocument extends Document { } $head = $this->head->getCode(); - $lang = $this->getUser()->getLanguage()->getShortCode(); + $lang = $this->getContext()->getLanguage(); $code = ""; - $code .= html_tag("html", ["lang" => $lang], $head . $body, false); + $code .= html_tag("html", ["lang" => $lang->getShortCode()], $head . $body, false); return $code; } diff --git a/core/Elements/TemplateDocument.class.php b/core/Elements/TemplateDocument.class.php index 84aa2c4..b9756e4 100644 --- a/core/Elements/TemplateDocument.class.php +++ b/core/Elements/TemplateDocument.class.php @@ -46,13 +46,14 @@ class TemplateDocument extends Document { public function renderTemplate(string $name, array $params = []): string { try { - $user = $this->getUser(); + $context = $this->getContext(); + $session = $context->getSession(); $params["user"] = [ - "lang" => $user->getLanguage()->getShortCode(), - "loggedIn" => $user->isLoggedIn(), - "session" => (!$user->isLoggedIn() ? null : [ - "csrfToken" => $user->getSession()->getCsrfToken() - ]) + "lang" => $context->getLanguage()->getShortCode(), + "loggedIn" => $session !== null, + "session" => ($session ? [ + "csrfToken" => $session->getCsrfToken() + ] : null) ]; $settings = $this->getSettings(); diff --git a/core/Elements/View.class.php b/core/Elements/View.class.php index 79b5aca..3eb5d13 100644 --- a/core/Elements/View.class.php +++ b/core/Elements/View.class.php @@ -23,8 +23,7 @@ abstract class View extends StaticView { public function isSearchable(): bool { return $this->searchable; } public function getSiteName(): string { - // what a chain lol - return $this->getDocument()->getUser()->getConfiguration()->getSettings()->getSiteName(); + return $this->getDocument()->getSettings()->getSiteName(); } protected function load(string $viewClass) : string { @@ -43,7 +42,7 @@ abstract class View extends StaticView { } private function loadLanguageModules() { - $lang = $this->document->getUser()->getLanguage(); + $lang = $this->document->getContext()->getLanguage(); foreach ($this->langModules as $langModule) { $lang->loadModule($langModule); } diff --git a/core/Objects/Context.class.php b/core/Objects/Context.class.php new file mode 100644 index 0000000..d81320b --- /dev/null +++ b/core/Objects/Context.class.php @@ -0,0 +1,202 @@ +sql = null; + $this->session = null; + $this->user = null; + $this->configuration = new Configuration(); + $this->setLanguage(Language::DEFAULT_LANGUAGE()); + + if (!$this->isCLI()) { + @session_start(); + } + } + + public function __destruct() { + if ($this->sql && $this->sql->isConnected()) { + $this->sql->close(); + $this->sql = null; + } + } + + public function setLanguage(Language $language) { + $this->language = $language; + $this->language->activate(); + + if ($this->user && $this->user->language->getId() !== $language->getId()) { + $this->user->language = $language; + } + } + + public function initSQL(): ?SQL { + $databaseConf = $this->configuration->getDatabase(); + if ($databaseConf) { + $this->sql = SQL::createConnection($databaseConf); + if ($this->sql->isConnected()) { + $settings = $this->configuration->getSettings(); + $settings->loadFromDatabase($this); + return $this->sql; + } + } else { + $this->sql = null; + } + + return null; + } + + public function getSQL(): ?SQL { + return $this->sql; + } + + public function getSettings(): Settings { + return $this->configuration->getSettings(); + } + + public function getUser(): ?User { + return $this->user; + } + + public function sendCookies() { + $domain = $this->getSettings()->getDomain(); + $this->language->sendCookie($domain); + $this->session?->sendCookie($domain); + $this->session?->update(); + session_write_close(); + } + + private function loadSession(int $userId, int $sessionId) { + $this->session = Session::init($this, $userId, $sessionId); + $this->user = $this->session?->getUser(); + } + + public function parseCookies() { + if (isset($_COOKIE['session']) && is_string($_COOKIE['session']) && !empty($_COOKIE['session'])) { + try { + $token = $_COOKIE['session']; + $settings = $this->configuration->getSettings(); + $decoded = (array)JWT::decode($token, $settings->getJwtKey()); + if (!is_null($decoded)) { + $userId = ($decoded['userId'] ?? NULL); + $sessionId = ($decoded['sessionId'] ?? NULL); + if (!is_null($userId) && !is_null($sessionId)) { + $this->loadSession($userId, $sessionId); + } + } + } catch (\Exception $e) { + // ignored + } + } + + // set language by priority: 1. GET parameter, 2. cookie, 3. user's settings + if (isset($_GET['lang']) && is_string($_GET["lang"]) && !empty($_GET["lang"])) { + $this->updateLanguage($_GET['lang']); + } else if (isset($_COOKIE['lang']) && is_string($_COOKIE["lang"]) && !empty($_COOKIE["lang"])) { + $this->updateLanguage($_COOKIE['lang']); + } else if ($this->user) { + $this->setLanguage($this->user->language); + } + } + + public function updateLanguage(string $lang): bool { + if ($this->sql) { + $language = Language::findBuilder($this->sql) + ->where(new CondOr( + new CondLike("name", "%$lang%"), // english + new Compare("code", $lang), // de_DE + new CondLike("code", $lang . "_%"))) // de -> de_% + ->execute(); + if ($language) { + $this->setLanguage($language); + return true; + } + } + + return false; + } + + public function processVisit() { + if (isset($_COOKIE["PHPSESSID"]) && !empty($_COOKIE["PHPSESSID"])) { + if ($this->isBot()) { + return; + } + + $cookie = $_COOKIE["PHPSESSID"]; + $req = new \Api\Visitors\ProcessVisit($this); + $req->execute(["cookie" => $cookie]); + } + } + + private function isBot(): bool { + if (empty($_SERVER["HTTP_USER_AGENT"])) { + return false; + } + + return preg_match('/robot|spider|crawler|curl|^$/i', $_SERVER['HTTP_USER_AGENT']) === 1; + } + + public function isCLI(): bool { + return php_sapi_name() === "cli"; + } + + public function getConfig(): Configuration { + return $this->configuration; + } + + public function getSession(): ?Session { + return $this->session; + } + + public function loadApiKey(string $apiKey): bool { + $this->user = User::findBuilder($this->sql) + ->addJoin(new \Driver\SQL\Join("INNER","ApiKey", "ApiKey.user_id", "User.id")) + ->where(new Compare("ApiKey.api_key", $apiKey)) + ->where(new Compare("valid_until", $this->sql->currentTimestamp(), ">")) + ->where(new Compare("ApiKey.active", true)) + ->where(new Compare("User.confirmed", true)) + ->fetchEntities() + ->execute(); + + return $this->user !== null; + } + + public function createSession(int $userId, bool $stayLoggedIn): ?Session { + $this->user = User::find($this->sql, $userId); + if ($this->user) { + $this->session = new Session($this, $this->user); + $this->session->stayLoggedIn = $stayLoggedIn; + if ($this->session->update()) { + return $this->session; + } + } + + $this->user = null; + $this->session = null; + return null; + } + + public function getLanguage(): Language { + return $this->language; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/ApiKey.class.php b/core/Objects/DatabaseEntity/ApiKey.class.php new file mode 100644 index 0000000..a33e04a --- /dev/null +++ b/core/Objects/DatabaseEntity/ApiKey.class.php @@ -0,0 +1,27 @@ +active = true; + } + + public function jsonSerialize(): array { + return [ + "id" => $this->getId(), + "active" => $this->active, + "apiKey" => $this->apiKey, + "validUntil" => $this->validUntil->getTimestamp() + ]; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php b/core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php new file mode 100644 index 0000000..37fe236 --- /dev/null +++ b/core/Objects/DatabaseEntity/Attribute/DefaultValue.class.php @@ -0,0 +1,21 @@ +value = $value; + } + + public function getValue() { + if (is_string($this->value) && isClass($this->value)) { + return new $this->value(); + } + + return $this->value; + } + +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Attribute/Enum.class.php b/core/Objects/DatabaseEntity/Attribute/Enum.class.php new file mode 100644 index 0000000..084b286 --- /dev/null +++ b/core/Objects/DatabaseEntity/Attribute/Enum.class.php @@ -0,0 +1,17 @@ +values = $values; + } + + public function getValues(): array { + return $this->values; + } + +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Attribute/Json.class.php b/core/Objects/DatabaseEntity/Attribute/Json.class.php new file mode 100644 index 0000000..5ddfa56 --- /dev/null +++ b/core/Objects/DatabaseEntity/Attribute/Json.class.php @@ -0,0 +1,7 @@ +type = $type; + } + + public function getValue(): string { + return $this->type; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Attribute/MaxLength.class.php b/core/Objects/DatabaseEntity/Attribute/MaxLength.class.php new file mode 100644 index 0000000..a4571e3 --- /dev/null +++ b/core/Objects/DatabaseEntity/Attribute/MaxLength.class.php @@ -0,0 +1,15 @@ +maxLength = $maxLength; + } + + public function getValue(): int { + return $this->maxLength; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Attribute/Transient.class.php b/core/Objects/DatabaseEntity/Attribute/Transient.class.php new file mode 100644 index 0000000..c6088f1 --- /dev/null +++ b/core/Objects/DatabaseEntity/Attribute/Transient.class.php @@ -0,0 +1,7 @@ +id = $id; } - public static function find(SQL $sql, int $id): ?DatabaseEntity { + public abstract function jsonSerialize(): array; + + public function preInsert(array &$row) { } + public function postFetch(SQL $sql, array $row) { } + + public static function fromRow(SQL $sql, array $row): static { $handler = self::getHandler($sql); - return $handler->fetchOne($id); + return $handler->entityFromRow($row); + } + + public static function newInstance(\ReflectionClass $reflectionClass, array $row) { + return $reflectionClass->newInstanceWithoutConstructor(); + } + + public static function find(SQL $sql, int $id, bool $fetchEntities = false, bool $fetchRecursive = false): static|bool|null { + $handler = self::getHandler($sql); + if ($fetchEntities) { + return DatabaseEntityQuery::fetchOne(self::getHandler($sql)) + ->where(new Compare($handler->getTableName() . ".id", $id)) + ->fetchEntities($fetchRecursive) + ->execute(); + } else { + return $handler->fetchOne($id); + } + } + + public static function exists(SQL $sql, int $id): bool { + $handler = self::getHandler($sql); + $res = $sql->select($sql->count()) + ->from($handler->getTableName()) + ->where(new Compare($handler->getTableName() . ".id", $id)) + ->execute(); + + return $res !== false && $res[0]["count"] !== 0; + } + + public static function findBuilder(SQL $sql): DatabaseEntityQuery { + return DatabaseEntityQuery::fetchOne(self::getHandler($sql)); } public static function findAll(SQL $sql, ?Condition $condition = null): ?array { @@ -23,9 +60,13 @@ abstract class DatabaseEntity { return $handler->fetchMultiple($condition); } - public function save(SQL $sql): bool { + public static function findAllBuilder(SQL $sql): DatabaseEntityQuery { + return DatabaseEntityQuery::fetchAll(self::getHandler($sql)); + } + + public function save(SQL $sql, ?array $columns = null): bool { $handler = self::getHandler($sql); - $res = $handler->insertOrUpdate($this); + $res = $handler->insertOrUpdate($this, $columns); if ($res === false) { return false; } else if ($this->id === null) { diff --git a/core/Objects/DatabaseEntity/DatabaseEntityHandler.php b/core/Objects/DatabaseEntity/DatabaseEntityHandler.php index e84edb8..9b50063 100644 --- a/core/Objects/DatabaseEntity/DatabaseEntityHandler.php +++ b/core/Objects/DatabaseEntity/DatabaseEntityHandler.php @@ -5,7 +5,9 @@ namespace Objects\DatabaseEntity; use Driver\Logger\Logger; use Driver\SQL\Column\BoolColumn; use Driver\SQL\Column\DateTimeColumn; +use Driver\SQL\Column\EnumColumn; use Driver\SQL\Column\IntColumn; +use Driver\SQL\Column\JsonColumn; use Driver\SQL\Column\StringColumn; use Driver\SQL\Condition\Compare; use Driver\SQL\Condition\Condition; @@ -13,19 +15,27 @@ use Driver\SQL\Column\DoubleColumn; use Driver\SQL\Column\FloatColumn; use Driver\SQL\Constraint\ForeignKey; use Driver\SQL\Query\CreateTable; +use Driver\SQL\Query\Select; use Driver\SQL\SQL; use Driver\SQL\Strategy\CascadeStrategy; use Driver\SQL\Strategy\SetNullStrategy; +use Objects\DatabaseEntity\Attribute\Enum; +use Objects\DatabaseEntity\Attribute\DefaultValue; +use Objects\DatabaseEntity\Attribute\Json; +use Objects\DatabaseEntity\Attribute\Many; +use Objects\DatabaseEntity\Attribute\MaxLength; +use Objects\DatabaseEntity\Attribute\Transient; +use Objects\DatabaseEntity\Attribute\Unique; use PHPUnit\Util\Exception; class DatabaseEntityHandler { private \ReflectionClass $entityClass; - private static \ReflectionProperty $ID_FIELD; private string $tableName; private array $columns; private array $properties; private array $relations; + private array $constraints; private SQL $sql; private Logger $logger; @@ -34,22 +44,23 @@ class DatabaseEntityHandler { $className = $entityClass->getName(); $this->logger = new Logger($entityClass->getShortName(), $sql); $this->entityClass = $entityClass; - if (!$this->entityClass->isSubclassOf(DatabaseEntity::class) || - !$this->entityClass->isInstantiable()) { + if (!$this->entityClass->isSubclassOf(DatabaseEntity::class)) { $this->raiseError("Cannot persist class '$className': Not an instance of DatabaseEntity or not instantiable."); } $this->tableName = $this->entityClass->getShortName(); - $this->columns = []; - $this->properties = []; - $this->relations = []; - - if (!isset(self::$ID_FIELD)) { - self::$ID_FIELD = (new \ReflectionClass(DatabaseEntity::class))->getProperty("id"); - } + $this->columns = []; // property name => database column name + $this->properties = []; // property name => \ReflectionProperty + $this->relations = []; // property name => referenced table name + $this->constraints = []; // \Driver\SQL\Constraint\Constraint foreach ($this->entityClass->getProperties() as $property) { $propertyName = $property->getName(); + if ($propertyName === "id") { + $this->properties[$propertyName] = $property; + continue; + } + $propertyType = $property->getType(); $columnName = self::getColumnName($propertyName); if (!($propertyType instanceof \ReflectionNamedType)) { @@ -58,38 +69,83 @@ class DatabaseEntityHandler { $nullable = $propertyType->allowsNull(); $propertyTypeName = $propertyType->getName(); + if (!empty($property->getAttributes(Transient::class))) { + continue; + } + + $defaultValue = (self::getAttribute($property, DefaultValue::class))?->getValue(); + $isUnique = !empty($property->getAttributes(Unique::class)); + if ($propertyTypeName === 'string') { - $this->columns[$propertyName] = new StringColumn($columnName, null, $nullable); + $enum = self::getAttribute($property, Enum::class); + if ($enum) { + $this->columns[$propertyName] = new EnumColumn($columnName, $enum->getValues(), $nullable, $defaultValue); + } else { + $maxLength = self::getAttribute($property, MaxLength::class); + $this->columns[$propertyName] = new StringColumn($columnName, $maxLength?->getValue(), $nullable, $defaultValue); + } } else if ($propertyTypeName === 'int') { - $this->columns[$propertyName] = new IntColumn($columnName, $nullable); + $this->columns[$propertyName] = new IntColumn($columnName, $nullable, $defaultValue); } else if ($propertyTypeName === 'float') { - $this->columns[$propertyName] = new FloatColumn($columnName, $nullable); + $this->columns[$propertyName] = new FloatColumn($columnName, $nullable, $defaultValue); } else if ($propertyTypeName === 'double') { - $this->columns[$propertyName] = new DoubleColumn($columnName, $nullable); + $this->columns[$propertyName] = new DoubleColumn($columnName, $nullable, $defaultValue); } else if ($propertyTypeName === 'bool') { - $this->columns[$propertyName] = new BoolColumn($columnName, $nullable); + $this->columns[$propertyName] = new BoolColumn($columnName, $defaultValue ?? false); } else if ($propertyTypeName === 'DateTime') { - $this->columns[$propertyName] = new DateTimeColumn($columnName, $nullable); - } else { + $this->columns[$propertyName] = new DateTimeColumn($columnName, $nullable, $defaultValue); + /*} else if ($propertyName === 'array') { + $many = self::getAttribute($property, Many::class); + if ($many) { + $requestedType = $many->getValue(); + if (isClass($requestedType)) { + $requestedClass = new \ReflectionClass($requestedType); + } else { + $this->raiseError("Cannot persist class '$className': Property '$propertyName' has non persist-able type: $requestedType"); + } + } else { + $this->raiseError("Cannot persist class '$className': Property '$propertyName' has non persist-able type: $propertyTypeName"); + }*/ + } else if ($propertyTypeName !== "mixed") { try { $requestedClass = new \ReflectionClass($propertyTypeName); if ($requestedClass->isSubclassOf(DatabaseEntity::class)) { + $columnName .= "_id"; $requestedHandler = ($requestedClass->getName() === $this->entityClass->getName()) ? $this : DatabaseEntity::getHandler($this->sql, $requestedClass); $strategy = $nullable ? new SetNullStrategy() : new CascadeStrategy(); - $this->columns[$propertyName] = new IntColumn($columnName, $nullable); - $this->relations[$propertyName] = new ForeignKey($columnName, $requestedHandler->tableName, "id", $strategy); + $this->columns[$propertyName] = new IntColumn($columnName, $nullable, $defaultValue); + $this->constraints[] = new ForeignKey($columnName, $requestedHandler->tableName, "id", $strategy); + $this->relations[$propertyName] = $requestedHandler; + } else { + $this->raiseError("Cannot persist class '$className': Property '$propertyName' has non persist-able type: $propertyTypeName"); } } catch (\Exception $ex) { + $this->raiseError("Cannot persist class '$className' property '$propertyTypeName': " . $ex->getMessage()); + } + } else { + if (!empty($property->getAttributes(Json::class))) { + $this->columns[$propertyName] = new JsonColumn($columnName, $nullable, $defaultValue); + } else { $this->raiseError("Cannot persist class '$className': Property '$propertyName' has non persist-able type: $propertyTypeName"); } } $this->properties[$propertyName] = $property; + + if ($isUnique) { + $this->constraints[] = new \Driver\SQL\Constraint\Unique($columnName); + } } } - private static function getColumnName(string $propertyName): string { + private static function getAttribute(\ReflectionProperty $property, string $attributeClass): ?object { + $attributes = $property->getAttributes($attributeClass); + $attribute = array_shift($attributes); + return $attribute?->newInstance(); + } + + public static function getColumnName(string $propertyName): string { // abcTestLOL => abc_test_lol return strtolower(preg_replace_callback("/([a-z])([A-Z]+)/", function ($m) { return $m[1] . "_" . strtolower($m[2]); @@ -108,46 +164,111 @@ class DatabaseEntityHandler { return $this->tableName; } - private function entityFromRow(array $row): DatabaseEntity { + public function getRelations(): array { + return $this->relations; + } + + public function getColumnNames(): array { + $columns = ["$this->tableName.id"]; + foreach ($this->columns as $column) { + $columns[] = $this->tableName . "." . $column->getName(); + } + + return $columns; + } + + public function getColumns(): array { + return $this->columns; + } + + public function dependsOn(): array { + $foreignTables = array_map(function (DatabaseEntityHandler $relationHandler) { + return $relationHandler->getTableName(); + }, $this->relations); + return array_unique($foreignTables); + } + + public static function getPrefixedRow(array $row, string $prefix): array { + $rel_row = []; + foreach ($row as $relKey => $relValue) { + if (startsWith($relKey, $prefix)) { + $rel_row[substr($relKey, strlen($prefix))] = $relValue; + } + } + return $rel_row; + } + + public function entityFromRow(array $row): ?DatabaseEntity { try { - $entity = $this->entityClass->newInstanceWithoutConstructor(); - foreach ($this->columns as $propertyName => $column) { - $value = $row[$column->getName()]; - $property = $this->properties[$propertyName]; - if ($property->getType()->getName() === "DateTime") { - $value = new \DateTime($value); - } - - $property->setValue($entity, $value); + $entity = call_user_func($this->entityClass->getName() . "::newInstance", $this->entityClass, $row); + if (!($entity instanceof DatabaseEntity)) { + $this->logger->error("Created Object is not of type DatabaseEntity"); + return null; } - self::$ID_FIELD->setAccessible(true); - self::$ID_FIELD->setValue($entity, $row["id"]); + foreach ($this->columns as $propertyName => $column) { + $columnName = $column->getName(); + if (array_key_exists($columnName, $row)) { + $value = $row[$columnName]; + $property = $this->properties[$propertyName]; + + if ($column instanceof DateTimeColumn) { + $value = new \DateTime($value); + } else if ($column instanceof JsonColumn) { + $value = json_decode($value); + } else if (isset($this->relations[$propertyName])) { + $relColumnPrefix = self::getColumnName($propertyName) . "_"; + if (array_key_exists($relColumnPrefix . "id", $row)) { + $relId = $row[$relColumnPrefix . "id"]; + if ($relId !== null) { + $relationHandler = $this->relations[$propertyName]; + $value = $relationHandler->entityFromRow(self::getPrefixedRow($row, $relColumnPrefix)); + } else if (!$column->notNull()) { + $value = null; + } else { + continue; + } + } else { + continue; + } + } + + $property->setAccessible(true); + $property->setValue($entity, $value); + } + } + + $this->properties["id"]->setAccessible(true); + $this->properties["id"]->setValue($entity, $row["id"]); + $entity->postFetch($this->sql, $row); return $entity; } catch (\Exception $exception) { $this->logger->error("Error creating entity from database row: " . $exception->getMessage()); - throw $exception; + return null; } } - public function fetchOne(int $id): ?DatabaseEntity { - $res = $this->sql->select("id", ...array_keys($this->columns)) - ->from($this->tableName) - ->where(new Compare("id", $id)) + public function getSelectQuery(): Select { + return $this->sql->select(...$this->getColumnNames()) + ->from($this->tableName); + } + + public function fetchOne(int $id): DatabaseEntity|bool|null { + $res = $this->getSelectQuery() + ->where(new Compare($this->tableName . ".id", $id)) ->first() ->execute(); - if (empty($res)) { - return null; + if ($res === false || $res === null) { + return $res; } else { return $this->entityFromRow($res); } } public function fetchMultiple(?Condition $condition = null): ?array { - $query = $this->sql->select("id", ...array_keys($this->columns)) - ->from($this->tableName); + $query = $this->getSelectQuery(); if ($condition) { $query->where($condition); @@ -159,7 +280,10 @@ class DatabaseEntityHandler { } else { $entities = []; foreach ($res as $row) { - $entities[] = $this->entityFromRow($row); + $entity = $this->entityFromRow($row); + if ($entity) { + $entities[$entity->getId()] = $entity; + } } return $entities; } @@ -175,7 +299,7 @@ class DatabaseEntityHandler { $query->addColumn($column); } - foreach ($this->relations as $constraint) { + foreach ($this->constraints as $constraint) { $query->addConstraint($constraint); } @@ -187,29 +311,43 @@ class DatabaseEntityHandler { return $query->execute(); } - public function insertOrUpdate(DatabaseEntity $entity) { + public function insertOrUpdate(DatabaseEntity $entity, ?array $columns = null) { $id = $entity->getId(); - if ($id === null) { - $columns = []; - $row = []; + $action = $id === null ? "insert" : "update"; - foreach ($this->columns as $propertyName => $column) { - $columns[] = $column->getName(); - $property = $this->properties[$propertyName]; - if ($property->isInitialized($entity)) { - $value = $property->getValue($entity); - } else if (!$this->columns[$propertyName]->notNull()) { - $value = null; - } else { - $this->logger->error("Cannot insert entity: property '$propertyName' was not initialized yet."); - return false; - } - - $row[] = $value; + $row = []; + foreach ($this->columns as $propertyName => $column) { + if ($columns && !in_array($column->getName(), $columns)) { + continue; } - $res = $this->sql->insert($this->tableName, $columns) - ->addRow(...$row) + $property = $this->properties[$propertyName]; + $property->setAccessible(true); + if ($property->isInitialized($entity)) { + $value = $property->getValue($entity); + if (isset($this->relations[$propertyName])) { + $value = $value->getId(); + } + } else if (!$this->columns[$propertyName]->notNull()) { + $value = null; + } else { + if ($action !== "update") { + $this->logger->error("Cannot $action entity: property '$propertyName' was not initialized yet."); + return false; + } else { + continue; + } + } + + $row[$column->getName()] = $value; + } + + $entity->preInsert($row); + + + if ($id === null) { + $res = $this->sql->insert($this->tableName, array_keys($row)) + ->addRow(...array_values($row)) ->returning("id") ->execute(); @@ -220,20 +358,9 @@ class DatabaseEntityHandler { } } else { $query = $this->sql->update($this->tableName) - ->where(new Compare("id", $id)); - - foreach ($this->columns as $propertyName => $column) { - $columnName = $column->getName(); - $property = $this->properties[$propertyName]; - if ($property->isInitialized($entity)) { - $value = $property->getValue($entity); - } else if (!$this->columns[$propertyName]->notNull()) { - $value = null; - } else { - $this->logger->error("Cannot update entity: property '$propertyName' was not initialized yet."); - return false; - } + ->where(new Compare($this->tableName . ".id", $id)); + foreach ($row as $columnName => $value) { $query->set($columnName, $value); } @@ -242,15 +369,14 @@ class DatabaseEntityHandler { } public function delete(int $id) { - return $this->sql->delete($this->tableName)->where(new Compare("id", $id))->execute(); + return $this->sql + ->delete($this->tableName) + ->where(new Compare($this->tableName . ".id", $id)) + ->execute(); } private function raiseError(string $message) { $this->logger->error($message); throw new Exception($message); } - - private function getPropertyValue() { - - } } \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/DatabaseEntityQuery.class.php b/core/Objects/DatabaseEntity/DatabaseEntityQuery.class.php new file mode 100644 index 0000000..00ba75d --- /dev/null +++ b/core/Objects/DatabaseEntity/DatabaseEntityQuery.class.php @@ -0,0 +1,135 @@ +handler = $handler; + $this->selectQuery = $handler->getSelectQuery(); + $this->resultType = $resultType; + + if ($this->resultType === SQL::FETCH_ONE) { + $this->selectQuery->first(); + } + } + + public static function fetchAll(DatabaseEntityHandler $handler): DatabaseEntityQuery { + return new DatabaseEntityQuery($handler, SQL::FETCH_ALL); + } + + public static function fetchOne(DatabaseEntityHandler $handler): DatabaseEntityQuery { + return new DatabaseEntityQuery($handler, SQL::FETCH_ONE); + } + + public function limit(int $limit): DatabaseEntityQuery { + $this->selectQuery->limit($limit); + return $this; + } + + public function where(Condition ...$condition): DatabaseEntityQuery { + $this->selectQuery->where(...$condition); + return $this; + } + + public function orderBy(string ...$column): DatabaseEntityQuery { + $this->selectQuery->orderBy(...$column); + return $this; + } + + public function ascending(): DatabaseEntityQuery { + $this->selectQuery->ascending(); + return $this; + } + + public function descending(): DatabaseEntityQuery { + $this->selectQuery->descending(); + return $this; + } + + // TODO: clean this up + public function fetchEntities(bool $recursive = false): DatabaseEntityQuery { + + // $this->selectQuery->dump(); + + $relIndex = 1; + foreach ($this->handler->getRelations() as $propertyName => $relationHandler) { + $this->fetchRelation($propertyName, $this->handler->getTableName(), $this->handler, $relationHandler, $relIndex, $recursive); + } + + return $this; + } + + private function fetchRelation(string $propertyName, string $tableName, DatabaseEntityHandler $src, DatabaseEntityHandler $relationHandler, + int &$relIndex = 1, bool $recursive = false, string $relationColumnPrefix = "") { + + $columns = $src->getColumns(); + + $foreignColumn = $columns[$propertyName]; + $foreignColumnName = $foreignColumn->getName(); + $referencedTable = $relationHandler->getTableName(); + $isNullable = !$foreignColumn->notNull(); + $alias = "t$relIndex"; // t1, t2, t3, ... + $relIndex++; + + + if ($isNullable) { + $this->selectQuery->leftJoin($referencedTable, "$tableName.$foreignColumnName", "$alias.id", $alias); + } else { + $this->selectQuery->innerJoin($referencedTable, "$tableName.$foreignColumnName", "$alias.id", $alias); + } + + $relationColumnPrefix .= DatabaseEntityHandler::getColumnName($propertyName) . "_"; + $recursiveRelations = $relationHandler->getRelations(); + foreach ($relationHandler->getColumns() as $relPropertyName => $relColumn) { + $relColumnName = $relColumn->getName(); + if (!isset($recursiveRelations[$relPropertyName]) || $recursive) { + $this->selectQuery->addValue("$alias.$relColumnName as $relationColumnPrefix$relColumnName"); + if (isset($recursiveRelations[$relPropertyName]) && $recursive) { + $this->fetchRelation($relPropertyName, $alias, $relationHandler, $recursiveRelations[$relPropertyName], $relIndex, $recursive, $relationColumnPrefix); + } + } + } + } + + public function execute(): DatabaseEntity|array|null { + $res = $this->selectQuery->execute(); + if ($res === null || $res === false) { + return null; + } + + if ($this->resultType === SQL::FETCH_ALL) { + $entities = []; + foreach ($res as $row) { + $entity = $this->handler->entityFromRow($row); + if ($entity) { + $entities[$entity->getId()] = $entity; + } + } + return $entities; + } else if ($this->resultType === SQL::FETCH_ONE) { + return $this->handler->entityFromRow($res); + } else { + $this->handler->getLogger()->error("Invalid result type for query builder, must be FETCH_ALL or FETCH_ONE"); + return null; + } + } + + public function addJoin(Join $join): DatabaseEntityQuery { + $this->selectQuery->addJoin($join); + return $this; + } +} \ No newline at end of file diff --git a/core/Objects/GpgKey.class.php b/core/Objects/DatabaseEntity/GpgKey.class.php similarity index 73% rename from core/Objects/GpgKey.class.php rename to core/Objects/DatabaseEntity/GpgKey.class.php index 357931b..99c1099 100644 --- a/core/Objects/GpgKey.class.php +++ b/core/Objects/DatabaseEntity/GpgKey.class.php @@ -1,19 +1,23 @@ id = $id; + parent::__construct($id); $this->confirmed = $confirmed; $this->fingerprint = $fingerprint; $this->algorithm = $algorithm; @@ -25,26 +29,17 @@ class GpgKey extends ApiObject { $cmd = self::GPG2 . " --encrypt --output - --recipient $gpgFingerprint --trust-model always --batch --armor"; list($out, $err) = self::proc_exec($cmd, $body, true); if ($out === null) { - return self::createError("Error while communicating with GPG agent"); + return createError("Error while communicating with GPG agent"); } else if ($err) { - return self::createError($err); + return createError($err); } else { return ["success" => true, "data" => $out]; } } - public function jsonSerialize(): array { - return array( - "fingerprint" => $this->fingerprint, - "algorithm" => $this->algorithm, - "expires" => $this->expires->getTimestamp(), - "confirmed" => $this->confirmed - ); - } - private static function proc_exec(string $cmd, ?string $stdin = null, bool $raw = false): ?array { $descriptorSpec = array(0 => ["pipe", "r"], 1 => ["pipe", "w"], 2 => ["pipe", "w"]); - $process = proc_open($cmd, $descriptorSpec,$pipes); + $process = proc_open($cmd, $descriptorSpec, $pipes); if (!is_resource($process)) { return null; } @@ -62,29 +57,25 @@ class GpgKey extends ApiObject { return [($raw ? $out : trim($out)), $err]; } - private static function createError(string $error) : array { - return ["success" => false, "error" => $error]; - } - public static function getKeyInfo(string $key): array { list($out, $err) = self::proc_exec(self::GPG2 . " --show-key", $key); if ($out === null) { - return self::createError("Error while communicating with GPG agent"); + return createError("Error while communicating with GPG agent"); } if ($err) { - return self::createError($err); + return createError($err); } $lines = explode("\n", $out); if (count($lines) > 4) { - return self::createError("It seems like you have uploaded more than one GPG-Key"); + return createError("It seems like you have uploaded more than one GPG-Key"); } else if (count($lines) !== 4 || !preg_match("/(\S+)\s+(\w+)\s+.*\[expires: ([0-9-]+)]/", $lines[0], $matches)) { - return self::createError("Error parsing GPG output"); + return createError("Error parsing GPG output"); } $keyType = $matches[1]; - $keyAlg = $matches[2]; + $keyAlg = $matches[2]; $expires = \DateTime::createFromFormat("Y-m-d", $matches[3]); $fingerprint = trim($lines[1]); $keyData = ["type" => $keyType, "algorithm" => $keyAlg, "expires" => $expires, "fingerprint" => $fingerprint]; @@ -94,17 +85,17 @@ class GpgKey extends ApiObject { public static function importKey(string $key): array { list($out, $err) = self::proc_exec(self::GPG2 . " --import", $key); if ($out === null) { - return self::createError("Error while communicating with GPG agent"); + return createError("Error while communicating with GPG agent"); } if (preg_match("/gpg:\s+Total number processed:\s+(\d+)/", $err, $matches) && intval($matches[1]) > 0) { if ((preg_match("/.*\s+unchanged:\s+(\d+)/", $err, $matches) && intval($matches[1]) > 0) || - (preg_match("/.*\s+imported:\s+(\d+)/", $err, $matches) && intval($matches[1]) > 0)) { + (preg_match("/.*\s+imported:\s+(\d+)/", $err, $matches) && intval($matches[1]) > 0)) { return ["success" => true]; } } - return self::createError($err); + return createError($err); } public static function export($gpgFingerprint, bool $armored): array { @@ -115,7 +106,7 @@ class GpgKey extends ApiObject { $cmd .= escapeshellarg($gpgFingerprint); list($out, $err) = self::proc_exec($cmd); if ($err) { - return self::createError($err); + return createError($err); } return ["success" => true, "data" => $out]; @@ -125,12 +116,18 @@ class GpgKey extends ApiObject { return $this->confirmed; } - public function getId(): int { - return $this->id; - } - public function getFingerprint(): string { return $this->fingerprint; } + public function jsonSerialize(): array { + return [ + "id" => $this->getId(), + "fingerprint" => $this->fingerprint, + "algorithm" => $this->algorithm, + "expires" => $this->expires->getTimestamp(), + "added" => $this->added->getTimestamp(), + "confirmed" => $this->confirmed + ]; + } } \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Group.class.php b/core/Objects/DatabaseEntity/Group.class.php new file mode 100644 index 0000000..9e9414f --- /dev/null +++ b/core/Objects/DatabaseEntity/Group.class.php @@ -0,0 +1,23 @@ + $this->getId(), + "name" => $this->name, + "color" => $this->color + ]; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Language.class.php b/core/Objects/DatabaseEntity/Language.class.php new file mode 100644 index 0000000..99b7b4a --- /dev/null +++ b/core/Objects/DatabaseEntity/Language.class.php @@ -0,0 +1,103 @@ +code = $code; + $this->name = $name; + $this->entries = array(); + $this->modules = array(); + } + + public function getCode(): string { + return $this->code; + } + + public function getShortCode(): string { + return substr($this->code, 0, 2); + } + + public function getName(): string { + return $this->name; + } + + public function loadModule(LanguageModule|string $module) { + if (!is_object($module)) { + $module = new $module(); + } + + $moduleEntries = $module->getEntries($this->code); + $this->entries = array_merge($this->entries, $moduleEntries); + $this->modules[] = $module; + } + + public function translate(string $key): string { + return $this->entries[$key] ?? $key; + } + + public function sendCookie(string $domain) { + setcookie('lang', $this->code, 0, "/", $domain, false, false); + } + + public function jsonSerialize(): array { + return array( + 'id' => $this->getId(), + 'code' => $this->code, + 'shortCode' => explode("_", $this->code)[0], + 'name' => $this->name, + ); + } + + public function activate() { + global $LANGUAGE; + $LANGUAGE = $this; + } + + public static function DEFAULT_LANGUAGE(bool $fromCookie = true): Language { + if ($fromCookie && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $acceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $acceptedLanguages = explode(',', $acceptLanguage); + foreach ($acceptedLanguages as $code) { + if (strlen($code) == 2) { + $code = $code . '_' . strtoupper($code); + } + + $code = str_replace("-", "_", $code); + if (!preg_match(self::LANG_CODE_PATTERN, $code)) { + continue; + } + + return new Language(0, $code, ""); + } + } + + return new Language(1, "en_US", "American English"); + } + } +} + +namespace { + function L($key) { + if (!array_key_exists('LANGUAGE', $GLOBALS)) + return $key; + + global $LANGUAGE; + return $LANGUAGE->translate($key); + } +} diff --git a/core/Objects/DatabaseEntity/News.class.php b/core/Objects/DatabaseEntity/News.class.php new file mode 100644 index 0000000..2466527 --- /dev/null +++ b/core/Objects/DatabaseEntity/News.class.php @@ -0,0 +1,30 @@ + $this->getId(), + "publishedBy" => $this->publishedBy->jsonSerialize(), + "publishedAt" => $this->publishedAt->format(Parameter::DATE_TIME_FORMAT), + "title" => $this->title, + "text" => $this->text + ]; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Notification.class.php b/core/Objects/DatabaseEntity/Notification.class.php new file mode 100644 index 0000000..9172d79 --- /dev/null +++ b/core/Objects/DatabaseEntity/Notification.class.php @@ -0,0 +1,30 @@ + $this->getId(), + "createdAt" => $this->createdAt->format(Parameter::DATE_TIME_FORMAT), + "title" => $this->title, + "message" => $this->message + ]; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/Session.class.php b/core/Objects/DatabaseEntity/Session.class.php new file mode 100644 index 0000000..9bc5657 --- /dev/null +++ b/core/Objects/DatabaseEntity/Session.class.php @@ -0,0 +1,134 @@ +context = $context; + $this->user = $user; + $this->stayLoggedIn = false; + $this->csrfToken = $csrfToken ?? generateRandomString(16); + $this->expires = (new DateTime())->modify(sprintf("+%d second", Session::DURATION)); + $this->active = true; + } + + public static function init(Context $context, int $userId, int $sessionId): ?Session { + $session = Session::find($context->getSQL(), $sessionId, true, true); + if (!$session || !$session->active || $session->user->getId() !== $userId) { + return null; + } + + $session->context = $context; + return $session; + } + + public function getUser(): User { + return $this->user; + } + + private function updateMetaData() { + $this->expires = (new \DateTime())->modify(sprintf("+%d minutes", Session::DURATION)); + $this->ipAddress = $this->context->isCLI() ? "127.0.0.1" : $_SERVER['REMOTE_ADDR']; + try { + $userAgent = @get_browser($_SERVER['HTTP_USER_AGENT'], true); + $this->os = $userAgent['platform'] ?? "Unknown"; + $this->browser = $userAgent['parent'] ?? "Unknown"; + } catch (Exception $ex) { + $this->os = "Unknown"; + $this->browser = "Unknown"; + } + } + + public function setData(array $data) { + foreach ($data as $key => $value) { + $_SESSION[$key] = $value; + } + } + + public function getCookie(): string { + $this->updateMetaData(); + $settings = $this->context->getSettings(); + $token = ['userId' => $this->user->getId(), 'sessionId' => $this->getId()]; + $jwtKey = $settings->getJwtKey(); + return JWT::encode($token, $jwtKey->getKeyMaterial(), $jwtKey->getAlgorithm()); + } + + public function sendCookie(string $domain) { + $sessionCookie = $this->getCookie(); + $secure = strcmp(getProtocol(), "https") === 0; + setcookie('session', $sessionCookie, $this->getExpiresTime(), "/", $domain, $secure, true); + } + + public function getExpiresTime(): int { + return ($this->stayLoggedIn ? $this->expires->getTimestamp() : 0); + } + + public function getExpiresSeconds(): int { + return ($this->stayLoggedIn ? $this->expires->getTimestamp() - time() : -1); + } + + public function jsonSerialize(): array { + return array( + 'id' => $this->getId(), + 'active' => $this->active, + 'expires' => $this->expires, + 'ipAddress' => $this->ipAddress, + 'os' => $this->os, + 'browser' => $this->browser, + 'csrf_token' => $this->csrfToken, + 'data' => $this->data, + ); + } + + public function insert(bool $stayLoggedIn = false): bool { + $this->stayLoggedIn = $stayLoggedIn; + $this->active = true; + return $this->update(); + } + + public function destroy(): bool { + session_destroy(); + $this->active = false; + return $this->save($this->context->getSQL()); + } + + public function update(): bool { + $this->updateMetaData(); + + $this->expires = (new DateTime())->modify(sprintf("+%d second", Session::DURATION)); + $this->data = json_encode($_SESSION ?? []); + + $sql = $this->context->getSQL(); + return $this->user->update($sql) && + $this->save($sql); + } + + public function getCsrfToken(): string { + return $this->csrfToken; + } +} diff --git a/core/Objects/DatabaseEntity/SystemLog.class.php b/core/Objects/DatabaseEntity/SystemLog.class.php new file mode 100644 index 0000000..f514c73 --- /dev/null +++ b/core/Objects/DatabaseEntity/SystemLog.class.php @@ -0,0 +1,31 @@ + $this->getId(), + "timestamp" => $this->timestamp->format(Parameter::DATE_TIME_FORMAT), + "message" => $this->message, + "module" => $this->module, + "severity" => $this->severity + ]; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/TwoFactorToken.class.php b/core/Objects/DatabaseEntity/TwoFactorToken.class.php new file mode 100644 index 0000000..e490efc --- /dev/null +++ b/core/Objects/DatabaseEntity/TwoFactorToken.class.php @@ -0,0 +1,78 @@ +id = $id; + $this->type = $type; + $this->confirmed = $confirmed; + $this->authenticated = $_SESSION["2faAuthenticated"] ?? false; + } + + public function jsonSerialize(): array { + return [ + "id" => $this->getId(), + "type" => $this->type, + "confirmed" => $this->confirmed, + "authenticated" => $this->authenticated, + ]; + } + + public abstract function getData(): string; + protected abstract function readData(string $data); + + public function preInsert(array &$row) { + $row["data"] = $this->getData(); + } + + public function postFetch(SQL $sql, array $row) { + parent::postFetch($sql, $row); + $this->readData($row["data"]); + } + + public function authenticate() { + $this->authenticated = true; + $_SESSION["2faAuthenticated"] = true; + } + + public function getType(): string { + return $this->type; + } + + public function isConfirmed(): bool { + return $this->confirmed; + } + + public function getId(): int { + return $this->id; + } + + public static function newInstance(\ReflectionClass $reflectionClass, array $row) { + if ($row["type"] === TimeBasedTwoFactorToken::TYPE) { + return (new \ReflectionClass(TimeBasedTwoFactorToken::class))->newInstanceWithoutConstructor(); + } else if ($row["type"] === KeyBasedTwoFactorToken::TYPE) { + return (new \ReflectionClass(KeyBasedTwoFactorToken::class))->newInstanceWithoutConstructor(); + } else { + // TODO: error message + return null; + } + } + + public function isAuthenticated(): bool { + return $this->authenticated; + } +} \ No newline at end of file diff --git a/core/Objects/DatabaseEntity/User.class.php b/core/Objects/DatabaseEntity/User.class.php new file mode 100644 index 0000000..27d896c --- /dev/null +++ b/core/Objects/DatabaseEntity/User.class.php @@ -0,0 +1,109 @@ +groups = []; + } + + public function postFetch(SQL $sql, array $row) { + parent::postFetch($sql, $row); + $this->groups = []; + + $groups = Group::findAllBuilder($sql) + ->fetchEntities() + ->addJoin(new Join("INNER", "UserGroup", "UserGroup.group_id", "Group.id")) + ->where(new Compare("UserGroup.user_id", $this->id)) + ->execute(); + + if ($groups) { + $this->groups = $groups; + } + } + + public function getUsername(): string { + return $this->name; + } + + public function getFullName(): string { + return $this->fullName; + } + + public function getEmail(): ?string { + return $this->email; + } + + public function getGroups(): array { + return $this->groups; + } + + public function hasGroup(int $group): bool { + return isset($this->groups[$group]); + } + + public function getGPG(): ?GpgKey { + return $this->gpgKey; + } + + public function getTwoFactorToken(): ?TwoFactorToken { + return $this->twoFactorToken; + } + + public function getProfilePicture(): ?string { + return $this->profilePicture; + } + + public function __debugInfo(): array { + return [ + 'id' => $this->getId(), + 'username' => $this->name, + 'language' => $this->language->getName(), + ]; + } + + public function jsonSerialize(): array { + return [ + 'id' => $this->getId(), + 'name' => $this->name, + 'fullName' => $this->fullName, + 'profilePicture' => $this->profilePicture, + 'email' => $this->email, + 'groups' => $this->groups ?? null, + 'language' => (isset($this->language) ? $this->language->jsonSerialize() : null), + 'session' => (isset($this->session) ? $this->session->jsonSerialize() : null), + "gpg" => (isset($this->gpgKey) ? $this->gpgKey->jsonSerialize() : null), + "2fa" => (isset($this->twoFactorToken) ? $this->twoFactorToken->jsonSerialize() : null), + ]; + } + + public function update(SQL $sql): bool { + $this->lastOnline = new \DateTime(); + return $this->save($sql, ["last_online", "language_id"]); + } +} \ No newline at end of file diff --git a/core/Objects/Language.class.php b/core/Objects/Language.class.php deleted file mode 100644 index 59354db..0000000 --- a/core/Objects/Language.class.php +++ /dev/null @@ -1,139 +0,0 @@ -languageId = $languageId; - $this->langCode = $langCode; - $this->langName = $langName; - $this->entries = array(); - $this->modules = array(); - } - - public function getId() { return $this->languageId; } - public function getCode(): string { return $this->langCode; } - public function getShortCode() { return substr($this->langCode, 0, 2); } - public function getName() { return $this->langName; } - - /** - * @param $module LanguageModule class or object - */ - public function loadModule($module) { - if(!is_object($module)) - $module = new $module; - - $aModuleEntries = $module->getEntries($this->langCode); - $this->entries = array_merge($this->entries, $aModuleEntries); - $this->modules[] = $module; - } - - public function translate(string $key): string { - if(isset($this->entries[$key])) - return $this->entries[$key]; - - return $key; - } - - public function sendCookie(?string $domain = null) { - $domain = empty($domain) ? "" : $domain; - setcookie('lang', $this->langCode, 0, "/", $domain, false, false); - } - - public function jsonSerialize(): array { - return array( - 'uid' => $this->languageId, - 'code' => $this->langCode, - 'shortCode' => explode("_", $this->langCode)[0], - 'name' => $this->langName, - ); - } - - public static function newInstance($languageId, $langCode, $langName) { - - if(!preg_match(Language::LANG_CODE_PATTERN, $langCode)) { - return false; - } - - // TODO: include dynamically wanted Language - return new Language($languageId, $langCode, $langName); - - // $className = $langCode - // return new $className($languageId, $langCode); - } - - public function load() { - global $LANGUAGE; - $LANGUAGE = $this; - } - - public static function DEFAULT_LANGUAGE() { - if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - $acceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE']; - $aSplit = explode(',',$acceptLanguage); - foreach($aSplit as $code) { - if(strlen($code) == 2) { - $code = $code . '_' . strtoupper($code); - } - - $code = str_replace("-", "_", $code); - if(strlen($code) != 5) - continue; - - $lang = Language::newInstance(0, $code, ""); - if($lang) - return $lang; - } - } - - return Language::newInstance(1, "en_US", "American English"); - } - }; -} - -namespace { - - function L($key) { - if(!array_key_exists('LANGUAGE', $GLOBALS)) - return $key; - - global $LANGUAGE; - return $LANGUAGE->translate($key); - } - - function LANG_NAME() { - if(!array_key_exists('LANGUAGE', $GLOBALS)) - return "LANG_NAME"; - - global $LANGUAGE; - return $LANGUAGE->getName(); - } - - function LANG_CODE() { - if(!array_key_exists('LANGUAGE', $GLOBALS)) - return "LANG_CODE"; - - global $LANGUAGE; - return $LANGUAGE->getCode(); - } - - function SHORT_LANG_CODE() { - if(!array_key_exists('LANGUAGE', $GLOBALS)) - return "SHORT_LANG_CODE"; - - global $LANGUAGE; - return $LANGUAGE->getShortCode(); - } -} diff --git a/core/Objects/Router/ApiRoute.class.php b/core/Objects/Router/ApiRoute.class.php index b8248f9..9301fa0 100644 --- a/core/Objects/Router/ApiRoute.class.php +++ b/core/Objects/Router/ApiRoute.class.php @@ -13,7 +13,6 @@ class ApiRoute extends AbstractRoute { } public function call(Router $router, array $params): string { - $user = $router->getUser(); if (empty($params["endpoint"])) { header("Content-Type: text/html"); $document = new \Elements\TemplateDocument($router, "swagger.twig"); @@ -43,9 +42,11 @@ class ApiRoute extends AbstractRoute { http_response_code(400); $response = createError("Invalid Method"); } else { - $request = $apiClass->newInstanceArgs(array($user, true)); - $request->execute(); - $response = $request->getJsonResult(); + $request = $apiClass->newInstanceArgs(array($router->getContext(), true)); + $success = $request->execute(); + $response = $request->getResult(); + $response["success"] = $success; + $response["msg"] = $request->getLastError(); } } } catch (ReflectionException $e) { @@ -55,6 +56,6 @@ class ApiRoute extends AbstractRoute { } header("Content-Type: application/json"); - return $response; + return json_encode($response); } } \ No newline at end of file diff --git a/core/Objects/Router/Router.class.php b/core/Objects/Router/Router.class.php index a479da6..5bf3c25 100644 --- a/core/Objects/Router/Router.class.php +++ b/core/Objects/Router/Router.class.php @@ -3,23 +3,24 @@ namespace Objects\Router; use Driver\Logger\Logger; -use Objects\User; +use Objects\Context; class Router { - private ?User $user; + private Context $context; private Logger $logger; protected array $routes; protected array $statusCodeRoutes; - public function __construct(?User $user = null) { - $this->user = $user; + public function __construct(Context $context) { + $this->context = $context; $this->routes = []; $this->statusCodeRoutes = []; - if ($user) { + $sql = $context->getSQL(); + if ($sql) { $this->addRoute(new ApiRoute()); - $this->logger = new Logger("Router", $user->getSQL()); + $this->logger = new Logger("Router", $sql); } else { $this->logger = new Logger("Router"); } @@ -48,7 +49,7 @@ class Router { if ($route) { return $route->call($this, $params); } else { - $req = new \Api\Template\Render($this->user); + $req = new \Api\Template\Render($this->context); $res = $req->execute(["file" => "error_document.twig", "parameters" => $params]); if ($res) { return $req->getResult()["html"]; @@ -90,13 +91,13 @@ class Router { */ namespace Cache; -use Objects\User; +use Objects\Context; use Objects\Router\Router; class RouterCache extends Router { - public function __construct(User \$user) { - parent::__construct(\$user);$routes + public function __construct(Context \$context) { + parent::__construct(\$context);$routes } } "; @@ -109,8 +110,8 @@ class RouterCache extends Router { return true; } - public function getUser(): User { - return $this->user; + public function getContext(): Context { + return $this->context; } public function getLogger(): Logger { diff --git a/core/Objects/Router/StaticFileRoute.class.php b/core/Objects/Router/StaticFileRoute.class.php index a548bd9..bc58eda 100644 --- a/core/Objects/Router/StaticFileRoute.class.php +++ b/core/Objects/Router/StaticFileRoute.class.php @@ -37,9 +37,9 @@ class StaticFileRoute extends AbstractRoute { } $pathInfo = pathinfo($path); - if ($router !== null && ($user = $router->getUser()) !== null) { + if ($router !== null) { $ext = $pathInfo["extension"] ?? ""; - if (!$user->getConfiguration()->getSettings()->isExtensionAllowed($ext)) { + if (!$router->getContext()->getSettings()->isExtensionAllowed($ext)) { http_response_code(406); echo "Access restricted: Extension '" . htmlspecialchars($ext) . "' not allowed to serve."; } diff --git a/core/Objects/Session.class.php b/core/Objects/Session.class.php deleted file mode 100644 index 6e2c6f2..0000000 --- a/core/Objects/Session.class.php +++ /dev/null @@ -1,164 +0,0 @@ -user = $user; - $this->sessionId = $sessionId; - $this->stayLoggedIn = false; - $this->csrfToken = $csrfToken ?? generateRandomString(16); - } - - public static function create(User $user, bool $stayLoggedIn = false): ?Session { - $session = new Session($user, null, null); - if ($session->insert($stayLoggedIn)) { - $session->stayLoggedIn = $stayLoggedIn; - return $session; - } - - return null; - } - - private function updateMetaData() { - $this->expires = time() + Session::DURATION; - $this->ipAddress = is_cli() ? "127.0.0.1" : $_SERVER['REMOTE_ADDR']; - try { - $userAgent = @get_browser($_SERVER['HTTP_USER_AGENT'], true); - $this->os = $userAgent['platform'] ?? "Unknown"; - $this->browser = $userAgent['parent'] ?? "Unknown"; - } catch(Exception $ex) { - $this->os = "Unknown"; - $this->browser = "Unknown"; - } - } - - public function setData(array $data) { - foreach($data as $key => $value) { - $_SESSION[$key] = $value; - } - } - - public function stayLoggedIn(bool $val) { - $this->stayLoggedIn = $val; - } - - public function getCookie(): string { - $this->updateMetaData(); - $settings = $this->user->getConfiguration()->getSettings(); - $token = ['userId' => $this->user->getId(), 'sessionId' => $this->sessionId]; - $jwtKey = $settings->getJwtKey(); - return JWT::encode($token, $jwtKey->getKeyMaterial(), $jwtKey->getAlgorithm()); - } - - public function sendCookie(?string $domain = null) { - $domain = empty($domain) ? "" : $domain; - $sessionCookie = $this->getCookie(); - $secure = strcmp(getProtocol(), "https") === 0; - setcookie('session', $sessionCookie, $this->getExpiresTime(), "/", $domain, $secure, true); - } - - public function getExpiresTime(): int { - return ($this->stayLoggedIn ? $this->expires : 0); - } - - public function getExpiresSeconds(): int { - return ($this->stayLoggedIn ? $this->expires - time() : -1); - } - - public function jsonSerialize(): array { - return array( - 'uid' => $this->sessionId, - 'user_id' => $this->user->getId(), - 'expires' => $this->expires, - 'ipAddress' => $this->ipAddress, - 'os' => $this->os, - 'browser' => $this->browser, - 'csrf_token' => $this->csrfToken - ); - } - - public function insert(bool $stayLoggedIn = false): bool { - $this->updateMetaData(); - $sql = $this->user->getSQL(); - - $minutes = Session::DURATION; - $data = [ - "expires" => (new DateTime())->modify("+$minutes minute"), - "user_id" => $this->user->getId(), - "ipAddress" => $this->ipAddress, - "os" => $this->os, - "browser" => $this->browser, - "data" => json_encode($_SESSION ?? []), - "stay_logged_in" => $stayLoggedIn, - "csrf_token" => $this->csrfToken - ]; - - $success = $sql - ->insert("Session", array_keys($data)) - ->addRow(...array_values($data)) - ->returning("uid") - ->execute(); - - if ($success) { - $this->sessionId = $this->user->getSQL()->getLastInsertId(); - return true; - } - - return false; - } - - public function destroy(): bool { - session_destroy(); - return $this->user->getSQL()->update("Session") - ->set("active", false) - ->where(new Compare("Session.uid", $this->sessionId)) - ->where(new Compare("Session.user_id", $this->user->getId())) - ->execute(); - } - - public function update(): bool { - $this->updateMetaData(); - $minutes = Session::DURATION; - - $sql = $this->user->getSQL(); - return - $sql->update("User") - ->set("last_online", new CurrentTimeStamp()) - ->where(new Compare("uid", $this->user->getId())) - ->execute() && - $sql->update("Session") - ->set("Session.expires", (new DateTime())->modify("+$minutes second")) - ->set("Session.ipAddress", $this->ipAddress) - ->set("Session.os", $this->os) - ->set("Session.browser", $this->browser) - ->set("Session.data", json_encode($_SESSION ?? [])) - ->set("Session.csrf_token", $this->csrfToken) - ->where(new Compare("Session.uid", $this->sessionId)) - ->where(new Compare("Session.user_id", $this->user->getId())) - ->execute(); - } - - public function getCsrfToken(): string { - return $this->csrfToken; - } -} diff --git a/core/Objects/TwoFactor/KeyBasedTwoFactorToken.class.php b/core/Objects/TwoFactor/KeyBasedTwoFactorToken.class.php index 4549e25..db406e9 100644 --- a/core/Objects/TwoFactor/KeyBasedTwoFactorToken.class.php +++ b/core/Objects/TwoFactor/KeyBasedTwoFactorToken.class.php @@ -3,18 +3,19 @@ namespace Objects\TwoFactor; use Cose\Algorithm\Signature\ECDSA\ECSignature; +use Objects\DatabaseEntity\Attribute\Transient; +use Objects\DatabaseEntity\TwoFactorToken; class KeyBasedTwoFactorToken extends TwoFactorToken { const TYPE = "fido"; - private ?string $challenge; - private ?string $credentialId; - private ?PublicKey $publicKey; + #[Transient] private ?string $challenge; + #[Transient] private ?string $credentialId; + #[Transient] private ?PublicKey $publicKey; - public function __construct(string $data, ?int $id = null, bool $confirmed = false) { - parent::__construct(self::TYPE, $id, $confirmed); - if (!$confirmed) { + protected function readData(string $data) { + if ($this->isConfirmed()) { $this->challenge = base64_decode($data); $this->credentialId = null; $this->publicKey = null; @@ -34,7 +35,7 @@ class KeyBasedTwoFactorToken extends TwoFactorToken { return $this->publicKey; } - public function getCredentialId() { + public function getCredentialId(): ?string { return $this->credentialId; } diff --git a/core/Objects/TwoFactor/TimeBasedTwoFactorToken.class.php b/core/Objects/TwoFactor/TimeBasedTwoFactorToken.class.php index 88d18c1..7424c35 100644 --- a/core/Objects/TwoFactor/TimeBasedTwoFactorToken.class.php +++ b/core/Objects/TwoFactor/TimeBasedTwoFactorToken.class.php @@ -5,22 +5,29 @@ namespace Objects\TwoFactor; use Base32\Base32; use chillerlan\QRCode\QRCode; use chillerlan\QRCode\QROptions; -use Objects\User; +use Objects\Context; +use Objects\DatabaseEntity\Attribute\Transient; +use Objects\DatabaseEntity\TwoFactorToken; +use Objects\DatabaseEntity\User; class TimeBasedTwoFactorToken extends TwoFactorToken { const TYPE = "totp"; - private string $secret; + #[Transient] private string $secret; - public function __construct(string $secret, ?int $id = null, bool $confirmed = false) { - parent::__construct(self::TYPE, $id, $confirmed); + public function __construct(string $secret) { + parent::__construct(self::TYPE); $this->secret = $secret; } - public function getUrl(User $user): string { + protected function readData(string $data) { + $this->secret = $data; + } + + public function getUrl(Context $context): string { $otpType = self::TYPE; - $name = rawurlencode($user->getUsername()); - $settings = $user->getConfiguration()->getSettings(); + $name = rawurlencode($context->getUser()->getUsername()); + $settings = $context->getSettings(); $urlArgs = [ "secret" => $this->secret, "issuer" => $settings->getSiteName(), @@ -30,10 +37,10 @@ class TimeBasedTwoFactorToken extends TwoFactorToken { return "otpauth://$otpType/$name?$urlArgs"; } - public function generateQRCode(User $user) { + public function generateQRCode(Context $context) { $options = new QROptions(['outputType' => QRCode::OUTPUT_IMAGE_PNG, "imageBase64" => false]); $qrcode = new QRCode($options); - return $qrcode->render($this->getUrl($user)); + return $qrcode->render($this->getUrl($context)); } public function generate(?int $at = null, int $length = 6, int $period = 30): string { diff --git a/core/Objects/TwoFactor/TwoFactorToken.class.php b/core/Objects/TwoFactor/TwoFactorToken.class.php deleted file mode 100644 index c693dcf..0000000 --- a/core/Objects/TwoFactor/TwoFactorToken.class.php +++ /dev/null @@ -1,62 +0,0 @@ -id = $id; - $this->type = $type; - $this->confirmed = $confirmed; - $this->authenticated = $_SESSION["2faAuthenticated"] ?? false; - } - - public function jsonSerialize(): array { - return [ - "id" => $this->id, - "type" => $this->type, - "confirmed" => $this->confirmed, - "authenticated" => $this->authenticated, - ]; - } - - public abstract function getData(): string; - - public function authenticate() { - $this->authenticated = true; - $_SESSION["2faAuthenticated"] = true; - } - - public function getType(): string { - return $this->type; - } - - public function isConfirmed(): bool { - return $this->confirmed; - } - - public function getId(): int { - return $this->id; - } - - public static function newInstance(string $type, string $data, ?int $id = null, bool $confirmed = false) { - if ($type === TimeBasedTwoFactorToken::TYPE) { - return new TimeBasedTwoFactorToken($data, $id, $confirmed); - } else if ($type === KeyBasedTwoFactorToken::TYPE) { - return new KeyBasedTwoFactorToken($data, $id, $confirmed); - } else { - // TODO: error message - return null; - } - } - - public function isAuthenticated(): bool { - return $this->authenticated; - } -} \ No newline at end of file diff --git a/core/Objects/User.class.php b/core/Objects/User.class.php deleted file mode 100644 index b379e06..0000000 --- a/core/Objects/User.class.php +++ /dev/null @@ -1,376 +0,0 @@ -configuration = $configuration; - $this->reset(); - $this->connectDB(); - - if (!is_cli()) { - @session_start(); - $this->setLanguage(Language::DEFAULT_LANGUAGE()); - $this->parseCookies(); - } - } - - public function __destruct() { - if ($this->sql && $this->sql->isConnected()) { - $this->sql->close(); - } - } - - public function connectDB(): bool { - $databaseConf = $this->configuration->getDatabase(); - if ($databaseConf) { - $this->sql = SQL::createConnection($databaseConf); - if ($this->sql->isConnected()) { - $settings = $this->configuration->getSettings(); - $settings->loadFromDatabase($this); - return true; - } - } else { - $this->sql = null; - } - - return false; - } - - public function getId(): int { - return $this->uid; - } - - public function isLoggedIn(): bool { - return $this->loggedIn; - } - - public function getUsername(): string { - return $this->username; - } - - public function getFullName(): string { - return $this->fullName; - } - - public function getEmail(): ?string { - return $this->email; - } - - public function getSQL(): ?SQL { - return $this->sql; - } - - public function getLanguage(): Language { - return $this->language; - } - - public function setLanguage(Language $language) { - $this->language = $language; - $language->load(); - } - - public function getSession(): ?Session { - return $this->session; - } - - public function getConfiguration(): Configuration { - return $this->configuration; - } - - public function getGroups(): array { - return $this->groups; - } - - public function hasGroup(int $group): bool { - return isset($this->groups[$group]); - } - - public function getGPG(): ?GpgKey { - return $this->gpgKey; - } - - public function getTwoFactorToken(): ?TwoFactorToken { - return $this->twoFactorToken; - } - - public function getProfilePicture(): ?string { - return $this->profilePicture; - } - - public function __debugInfo(): array { - $debugInfo = array( - 'loggedIn' => $this->loggedIn, - 'language' => $this->language->getName(), - ); - - if ($this->loggedIn) { - $debugInfo['uid'] = $this->uid; - $debugInfo['username'] = $this->username; - } - - return $debugInfo; - } - - public function jsonSerialize(): array { - if ($this->isLoggedIn()) { - return array( - 'uid' => $this->uid, - 'name' => $this->username, - 'fullName' => $this->fullName, - 'profilePicture' => $this->profilePicture, - 'email' => $this->email, - 'groups' => $this->groups, - 'language' => $this->language->jsonSerialize(), - 'session' => $this->session->jsonSerialize(), - "gpg" => ($this->gpgKey ? $this->gpgKey->jsonSerialize() : null), - "2fa" => ($this->twoFactorToken ? $this->twoFactorToken->jsonSerialize() : null), - ); - } else { - return array( - 'language' => $this->language->jsonSerialize(), - ); - } - } - - private function reset() { - $this->uid = 0; - $this->username = ''; - $this->email = ''; - $this->groups = []; - $this->loggedIn = false; - $this->session = null; - $this->profilePicture = null; - $this->gpgKey = null; - $this->twoFactorToken = null; - } - - public function logout(): bool { - $success = true; - if ($this->loggedIn) { - $success = $this->session->destroy(); - $this->reset(); - } - - return $success; - } - - public function updateLanguage($lang): bool { - if ($this->sql) { - $request = new \Api\Language\Set($this); - return $request->execute(array("langCode" => $lang)); - } else { - return false; - } - } - - public function sendCookies() { - - $baseUrl = $this->getConfiguration()->getSettings()->getBaseUrl(); - $domain = parse_url($baseUrl, PHP_URL_HOST); - - if ($this->loggedIn) { - $this->session->sendCookie($domain); - } - - $this->language->sendCookie($domain); - session_write_close(); - } - - /** - * @param $userId user's id - * @param $sessionId session's id - * @param bool $sessionUpdate update session information, including session's lifetime and browser information - * @return bool true, if the data could be loaded - */ - public function loadSession($userId, $sessionId, bool $sessionUpdate = true): bool { - - $userRow = $this->loadUser("Session", ["Session.data", "Session.stay_logged_in", "Session.csrf_token"], [ - new Compare("User.uid", $userId), - new Compare("Session.uid", $sessionId), - new Compare("Session.active", true), - ]); - - if ($userRow !== false) { - $this->session = new Session($this, $sessionId, $userRow["csrf_token"]); - $this->session->setData(json_decode($userRow["data"] ?? '{}', true)); - $this->session->stayLoggedIn($this->sql->parseBool($userRow["stay_logged_in"])); - if ($sessionUpdate) { - $this->session->update(); - } - $this->loggedIn = true; - } - - return $userRow !== false; - } - - private function parseCookies() { - if (isset($_COOKIE['session']) && is_string($_COOKIE['session']) && !empty($_COOKIE['session'])) { - try { - $token = $_COOKIE['session']; - $settings = $this->configuration->getSettings(); - $decoded = (array)JWT::decode($token, $settings->getJwtKey()); - if (!is_null($decoded)) { - $userId = ($decoded['userId'] ?? NULL); - $sessionId = ($decoded['sessionId'] ?? NULL); - if (!is_null($userId) && !is_null($sessionId)) { - $this->loadSession($userId, $sessionId); - } - } - } catch (Exception $e) { - // ignored - } - } - - if (isset($_GET['lang']) && is_string($_GET["lang"]) && !empty($_GET["lang"])) { - $this->updateLanguage($_GET['lang']); - } else if (isset($_COOKIE['lang']) && is_string($_COOKIE["lang"]) && !empty($_COOKIE["lang"])) { - $this->updateLanguage($_COOKIE['lang']); - } - } - - public function createSession(int $userId, bool $stayLoggedIn = false): bool { - $this->uid = $userId; - $this->session = Session::create($this, $stayLoggedIn); - if ($this->session) { - $this->loggedIn = true; - return true; - } - - return false; - } - - private function loadUser(string $table, array $columns, array $conditions) { - $userRow = $this->sql->select( - // User meta - "User.uid as userId", "User.name", "User.email", "User.fullName", "User.profilePicture", "User.confirmed", - - // GPG - "User.gpg_id", "GpgKey.confirmed as gpg_confirmed", "GpgKey.fingerprint as gpg_fingerprint", - "GpgKey.expires as gpg_expires", "GpgKey.algorithm as gpg_algorithm", - - // 2FA - "User.2fa_id", "2FA.confirmed as 2fa_confirmed", "2FA.data as 2fa_data", "2FA.type as 2fa_type", - - // Language - "Language.uid as langId", "Language.code as langCode", "Language.name as langName", - - // additional data - ...$columns) - ->from("User") - ->innerJoin("$table", "$table.user_id", "User.uid") - ->leftJoin("Language", "User.language_id", "Language.uid") - ->leftJoin("GpgKey", "User.gpg_id", "GpgKey.uid") - ->leftJoin("2FA", "User.2fa_id", "2FA.uid") - ->where(new CondAnd(...$conditions)) - ->first() - ->execute(); - - if ($userRow === null || $userRow === false) { - return false; - } - - // Meta data - $userId = $userRow["userId"]; - $this->uid = $userId; - $this->username = $userRow['name']; - $this->fullName = $userRow["fullName"]; - $this->email = $userRow['email']; - $this->profilePicture = $userRow["profilePicture"]; - - // GPG - if (!empty($userRow["gpg_id"])) { - $this->gpgKey = new GpgKey($userRow["gpg_id"], $this->sql->parseBool($userRow["gpg_confirmed"]), - $userRow["gpg_fingerprint"], $userRow["gpg_algorithm"], $userRow["gpg_expires"] - ); - } - - // 2FA - if (!empty($userRow["2fa_id"])) { - $this->twoFactorToken = TwoFactorToken::newInstance($userRow["2fa_type"], $userRow["2fa_data"], - $userRow["2fa_id"], $this->sql->parseBool($userRow["2fa_confirmed"])); - } - - // Language - if (!is_null($userRow['langId'])) { - $this->setLanguage(Language::newInstance($userRow['langId'], $userRow['langCode'], $userRow['langName'])); - } - - // select groups - $groupRows = $this->sql->select("Group.uid as groupId", "Group.name as groupName") - ->from("UserGroup") - ->where(new Compare("UserGroup.user_id", $userId)) - ->innerJoin("Group", "UserGroup.group_id", "Group.uid") - ->execute(); - if (is_array($groupRows)) { - foreach ($groupRows as $row) { - $this->groups[$row["groupId"]] = $row["groupName"]; - } - } - - return $userRow; - } - - public function loadApiKey($apiKey): bool { - - if ($this->loggedIn) { - return true; - } - - $userRow = $this->loadUser("ApiKey", [], [ - new Compare("ApiKey.api_key", $apiKey), - new Compare("valid_until", $this->sql->currentTimestamp(), ">"), - new Compare("ApiKey.active", 1), - ]); - - // User must be confirmed to use API-Keys - if ($userRow === false || !$this->sql->parseBool($userRow["confirmed"])) { - return false; - } - - return true; - } - - public function processVisit() { - if ($this->sql && $this->sql->isConnected() && isset($_COOKIE["PHPSESSID"]) && !empty($_COOKIE["PHPSESSID"])) { - if ($this->isBot()) { - return; - } - - $cookie = $_COOKIE["PHPSESSID"]; - $req = new \Api\Visitors\ProcessVisit($this); - $req->execute(array("cookie" => $cookie)); - } - } - - private function isBot(): bool { - if (empty($_SERVER["HTTP_USER_AGENT"])) { - return false; - } - - return preg_match('/robot|spider|crawler|curl|^$/i', $_SERVER['HTTP_USER_AGENT']) === 1; - } -} diff --git a/core/core.php b/core/core.php index bd6d6d3..23baeeb 100644 --- a/core/core.php +++ b/core/core.php @@ -10,7 +10,7 @@ if (is_file($autoLoad)) { require_once $autoLoad; } -define("WEBBASE_VERSION", "1.5.2"); +define("WEBBASE_VERSION", "2.0.0-alpha"); spl_autoload_extensions(".php"); spl_autoload_register(function ($class) { @@ -28,10 +28,6 @@ spl_autoload_register(function ($class) { } }); -function is_cli(): bool { - return php_sapi_name() === "cli"; -} - function getProtocol(): string { $isSecure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') || @@ -246,7 +242,7 @@ function getClassName($class, bool $short = true): string { } function createError($msg) { - return json_encode(array("success" => false, "msg" => $msg)); + return ["success" => false, "msg" => $msg]; } function downloadFile($handle, $offset = 0, $length = null): bool { @@ -278,3 +274,8 @@ function parseClass($class): string { $parts = array_map('ucfirst', $parts); return implode("\\", $parts); } + +function isClass(string $str): bool { + $path = getClassPath($str); + return is_file($path) && class_exists($str); +} \ No newline at end of file diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index ca9cdde..e4385ad 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -1,5 +1,5 @@ FROM composer:latest AS composer -FROM php:7.4-fpm +FROM php:8.0-fpm WORKDIR "/application" RUN mkdir -p /application/core/Configuration RUN chown -R www-data:www-data /application diff --git a/index.php b/index.php index 89748a8..2043ca7 100644 --- a/index.php +++ b/index.php @@ -20,12 +20,12 @@ if (!is_readable(getClassPath(Configuration::class))) { die(json_encode([ "success" => false, "msg" => "Configuration class is not readable, check permissions before proceeding." ])); } -$config = new Configuration(); -$user = new Objects\User($config); -$sql = $user->getSQL(); -$settings = $config->getSettings(); -$installation = !$sql || ($sql->isConnected() && !$settings->isInstalled()); +$context = new \Objects\Context(); +$sql = $context->initSQL(); +$settings = $context->getSettings(); +$context->parseCookies(); +$installation = !$sql || ($sql->isConnected() && !$settings->isInstalled()); $requestedUri = $_GET["site"] ?? $_GET["api"] ?? $_SERVER["REQUEST_URI"]; if ($installation) { @@ -34,7 +34,7 @@ if ($installation) { $response = "Redirecting to /"; header("Location: /"); } else { - $document = new Documents\Install(new Router($user)); + $document = new Documents\Install(new Router($context)); $response = $document->getCode(); } } else { @@ -45,17 +45,17 @@ if ($installation) { if (is_file($routerCachePath)) { @include_once $routerCachePath; if (class_exists($routerCacheClass)) { - $router = new $routerCacheClass($user); + $router = new $routerCacheClass($context); } } if ($router === null) { - $req = new \Api\Routes\GenerateCache($user); + $req = new \Api\Routes\GenerateCache($context); if ($req->execute()) { $router = $req->getRouter(); } else { $message = "Unable to generate router cache: " . $req->getLastError(); - $response = (new Router($user))->returnStatusCode(500, [ "message" => $message ]); + $response = (new Router($context))->returnStatusCode(500, [ "message" => $message ]); } } @@ -68,8 +68,8 @@ if ($installation) { } } - $user->processVisit(); + $context->processVisit(); } -$user->sendCookies(); +$context->sendCookies(); die($response); \ No newline at end of file diff --git a/js/admin.min.js b/js/admin.min.js index f1d95f3..b942ead 100644 --- a/js/admin.min.js +++ b/js/admin.min.js @@ -338,4 +338,4 @@ e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var n="function"==typeof Symbol&&Symbol.for,a=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,c=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,m=n?Symbol.for("react.suspense"):60113,b=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,k=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case u:case p:case i:case s:case c:case m:return e;default:switch(e=e&&e.$$typeof){case d:case f:case g:case h:case l:return e;default:return t}}case o:return t}}}function x(e){return _(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=d,t.ContextProvider=l,t.Element=a,t.ForwardRef=f,t.Fragment=i,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=s,t.StrictMode=c,t.Suspense=m,t.isAsyncMode=function(e){return x(e)||_(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return _(e)===d},t.isContextProvider=function(e){return _(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.isForwardRef=function(e){return _(e)===f},t.isFragment=function(e){return _(e)===i},t.isLazy=function(e){return _(e)===g},t.isMemo=function(e){return _(e)===h},t.isPortal=function(e){return _(e)===o},t.isProfiler=function(e){return _(e)===s},t.isStrictMode=function(e){return _(e)===c},t.isSuspense=function(e){return _(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===p||e===s||e===c||e===m||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===l||e.$$typeof===d||e.$$typeof===f||e.$$typeof===y||e.$$typeof===w||e.$$typeof===k||e.$$typeof===v)},t.typeOf=_},function(e,t){var r,n,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var s,l=[],d=!1,u=-1;function p(){d&&s&&(d=!1,s.length?l=s.concat(l):u=-1,l.length&&f())}function f(){if(!d){var e=c(p);d=!0;for(var t=l.length;t;){for(s=l,l=[];++u1)for(var r=1;r-1}},function(e,t,r){var n=r(122);e.exports=function(e,t){var r=this.__data__,a=n(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}},function(e,t,r){var n=r(121);e.exports=function(){this.__data__=new n,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,r){var n=r(121),a=r(171),o=r(173);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var i=r.__data__;if(!a||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new o(i)}return r.set(e,t),this.size=r.size,this}},function(e,t,r){var n=r(378),a=r(653),o=r(172),i=r(380),c=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,d=s.toString,u=l.hasOwnProperty,p=RegExp("^"+d.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||a(e))&&(n(e)?p:c).test(i(e))}},function(e,t,r){var n=r(123),a=Object.prototype,o=a.hasOwnProperty,i=a.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(e){}var a=i.call(e);return n&&(t?e[c]=r:delete e[c]),a}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t,r){var n,a=r(654),o=(n=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},function(e,t,r){var n=r(50)["__core-js_shared__"];e.exports=n},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,r){var n=r(657),a=r(121),o=r(171);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||a),string:new n}}},function(e,t,r){var n=r(658),a=r(659),o=r(660),i=r(661),c=r(662);function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function u(e,t){for(var r=0;r.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFFFFFF\', endColorstr=\'#FFEEEEEE\', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFEEEEEE\', endColorstr=\'#FFCCCCCC\', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFFFFFF\', endColorstr=\'#FFEEEEEE\', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFEEEEEE\', endColorstr=\'#FFFFFFFF\', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}\n',""]),t.default=a},function(e,t,r){var n=r(77),a=r(733);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},function(e,t,r){"use strict";r.r(t);var n=r(29),a=r.n(n)()(!1);a.push([e.i,".rc-color-picker-panel-inner {\n position: relative;\n border-radius: 4px;\n box-shadow: 0 1px 5px #ccc;\n border: 1px solid #ccc;\n padding-bottom: 8px;\n}\n.rc-color-picker-panel-wrap {\n margin: 5px 0 0;\n height: 30px;\n width: 100%;\n position: relative;\n}\n.rc-color-picker-panel-wrap-preview {\n position: absolute;\n right: 8px;\n}\n.rc-color-picker-panel-wrap-ribbon {\n position: absolute;\n left: 8px;\n top: 0;\n right: 43px;\n height: 30px;\n}\n.rc-color-picker-panel-wrap-alpha {\n position: absolute;\n left: 8px;\n right: 43px;\n bottom: 0;\n height: 12.5px;\n}\n.rc-color-picker-panel-wrap-has-alpha .rc-color-picker-panel-wrap-ribbon {\n height: 12.5px;\n}\n.rc-color-picker-trigger {\n border: 1px solid #999;\n display: inline-block;\n padding: 2px;\n border-radius: 2px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n box-shadow: 0 0 0 2px #fff inset;\n}\n.rc-color-picker-trigger-open {\n box-shadow: 0px 0px 3px #999;\n}\n.rc-color-picker-panel {\n width: 218px;\n background-color: #fff;\n box-sizing: border-box;\n outline: none;\n z-index: 9;\n border-radius: 4px;\n -moz-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel * {\n box-sizing: border-box;\n}\n.rc-color-picker-panel-open {\n display: block;\n}\n.rc-color-picker-panel-close {\n display: none;\n}\n.rc-color-picker-panel-preview {\n height: 30px;\n width: 30px;\n overflow: hidden;\n border-radius: 2px;\n background-image: url('data:image/png;base64,R0lGODdhCgAKAPAAAOXl5f///ywAAAAACgAKAEACEIQdqXt9GxyETrI279OIgwIAOw==');\n}\n.rc-color-picker-panel-preview span {\n box-shadow: 0 0 2px #808080 inset;\n}\n.rc-color-picker-panel-preview span,\n.rc-color-picker-panel-preview input[type=color] {\n position: absolute;\n display: block;\n height: 100%;\n width: 30px;\n border-radius: 2px;\n}\n.rc-color-picker-panel-preview input[type=color] {\n opacity: 0;\n}\n.rc-color-picker-panel-board {\n position: relative;\n font-size: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n margin: 8px 8px 0px;\n}\n.rc-color-picker-panel-board span {\n position: absolute;\n border-radius: 10px;\n border: 1px solid #fff;\n width: 9px;\n height: 9px;\n margin: -4px 0 0 -4px;\n left: -999px;\n top: -999px;\n box-shadow: 0 0 1px rgba(120, 120, 120, 0.7);\n z-index: 2;\n}\n.rc-color-picker-panel-board-hsv {\n width: 200px;\n height: 150px;\n position: relative;\n z-index: 1;\n border-radius: 2px;\n}\n.rc-color-picker-panel-board-value {\n border-radius: 2px;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 2;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9InJnYigwLDAsMCkiIHN0b3Atb3BhY2l0eT0iMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: -moz-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: -o-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: linear-gradient(to bottom, transparent 0%, #000000 100%);\n}\n.rc-color-picker-panel-board-saturation {\n border-radius: 2px;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0icmdiKDAsMCwwKSIgc3RvcC1vcGFjaXR5PSIwIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: -moz-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: -o-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: linear-gradient(to right, #ffffff 0%, transparent 100%);\n}\n.rc-color-picker-panel-board-handler {\n box-shadow: 0 0 2px #808080 inset;\n border-radius: 2px;\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 3;\n}\n.rc-color-picker-panel-ribbon {\n position: relative;\n height: 100%;\n border-radius: 2px;\n box-shadow: 0 0 2px #808080 inset;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmZjAwMDAiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAlIiBzdG9wLWNvbG9yPSIjZmY5OTAwIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjIwJSIgc3RvcC1jb2xvcj0iI2NkZmYwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSIzMCUiIHN0b3AtY29sb3I9IiMzNWZmMDAiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iNDAlIiBzdG9wLWNvbG9yPSIjMDBmZjY2IiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzAwZmZmZCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSI2MCUiIHN0b3AtY29sb3I9IiMwMDY2ZmYiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iNzAlIiBzdG9wLWNvbG9yPSIjMzIwMGZmIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjgwJSIgc3RvcC1jb2xvcj0iI2NkMDBmZiIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSI5MCUiIHN0b3AtY29sb3I9IiNmZjAwOTkiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: -moz-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: -o-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: linear-gradient(to right, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n}\n.rc-color-picker-panel-ribbon span {\n position: absolute;\n top: 0;\n height: 100%;\n width: 4px;\n border: 1px solid #000000;\n padding: 1px 0;\n margin-left: -2px;\n background-color: #fff;\n border-radius: 3px;\n}\n.rc-color-picker-panel-ribbon-handler {\n position: absolute;\n width: 104%;\n height: 100%;\n left: -2%;\n cursor: pointer;\n}\n.rc-color-picker-panel-alpha {\n position: relative;\n height: 100%;\n width: 100%;\n border-radius: 2px;\n background-image: url('data:image/png;base64,R0lGODdhCgAKAPAAAOXl5f///ywAAAAACgAKAEACEIQdqXt9GxyETrI279OIgwIAOw==');\n background-repeat: repeat;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel-alpha-bg {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n box-shadow: 0 0 2px #808080 inset;\n}\n.rc-color-picker-panel-alpha span {\n position: absolute;\n top: 0;\n height: 100%;\n width: 4px;\n border: 1px solid #000000;\n padding: 1px 0;\n margin-left: -2px;\n background-color: #fff;\n border-radius: 3px;\n}\n.rc-color-picker-panel-alpha-handler {\n position: absolute;\n width: 104%;\n height: 100%;\n left: -2%;\n cursor: pointer;\n}\n.rc-color-picker-panel-params {\n font-size: 12px;\n}\n.rc-color-picker-panel-params-input {\n overflow: hidden;\n padding: 2px 8px;\n}\n.rc-color-picker-panel-params input {\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n text-align: center;\n padding: 1px;\n margin: 0;\n float: left;\n border-radius: 2px;\n border: 1px solid #CACACA;\n font-family: 'Helvetica Neue', Helvetica, sans-serif;\n}\n.rc-color-picker-panel-params-hex {\n width: 52px;\n}\n.rc-color-picker-panel-params input[type=number] {\n margin-left: 5px;\n width: 44px;\n}\n.rc-color-picker-panel-params input[type=number]::-webkit-inner-spin-button {\n -webkit-appearance: none;\n}\n.rc-color-picker-panel-params-lable {\n padding: 2px 8px;\n height: 22px;\n line-height: 18px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel-params-lable label {\n float: left;\n text-align: center;\n}\n.rc-color-picker-panel-params-lable-hex {\n width: 52px;\n}\n.rc-color-picker-panel-params-lable-number,\n.rc-color-picker-panel-params-lable-alpha {\n margin-left: 5px;\n width: 44px;\n text-transform: uppercase;\n}\n.rc-color-picker-panel-params-lable-number:hover {\n border-radius: 2px;\n background-color: #eee;\n box-shadow: 0 0 0 1px #ccc inset;\n cursor: pointer;\n}\n.rc-color-picker-panel-params-has-alpha input[type=number] {\n width: 32px;\n}\n.rc-color-picker-panel-params-has-alpha .rc-color-picker-panel-params-lable-number,\n.rc-color-picker-panel-params-has-alpha .rc-color-picker-panel-params-lable-alpha {\n width: 32px;\n}\n.rc-color-picker {\n position: absolute;\n left: -9999px;\n top: -9999px;\n z-index: 1000;\n}\n.rc-color-picker-wrap {\n display: inline-block;\n}\n.rc-color-picker-slide-up-enter {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 0;\n animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-appear {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 0;\n animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-leave {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 1;\n animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-bottomRight,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-bottomRight {\n animation-name: rcColorPickerSlideUpIn;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-topRight,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-topRight {\n animation-name: rcColorPickerSlideDownIn;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-bottomRight {\n animation-name: rcColorPickerSlideUpOut;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-topRight {\n animation-name: rcColorPickerSlideDownOut;\n animation-play-state: running;\n}\n@keyframes rcColorPickerSlideUpIn {\n 0% {\n opacity: 0;\n transform-origin: 0% 0%;\n transform: scaleY(0);\n }\n 100% {\n opacity: 1;\n transform-origin: 0% 0%;\n transform: scaleY(1);\n }\n}\n@keyframes rcColorPickerSlideUpOut {\n 0% {\n opacity: 1;\n transform-origin: 0% 0%;\n transform: scaleY(1);\n }\n 100% {\n opacity: 0;\n transform-origin: 0% 0%;\n transform: scaleY(0);\n }\n}\n@keyframes rcColorPickerSlideDownIn {\n 0% {\n opacity: 0;\n transform-origin: 100% 100%;\n transform: scaleY(0);\n }\n 100% {\n opacity: 1;\n transform-origin: 100% 100%;\n transform: scaleY(1);\n }\n}\n@keyframes rcColorPickerSlideDownOut {\n 0% {\n opacity: 1;\n transform-origin: 100% 100%;\n transform: scaleY(1);\n }\n 100% {\n opacity: 0;\n transform-origin: 100% 100%;\n transform: scaleY(0);\n }\n}\n",""]),t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{!n&&c.return&&c.return()}finally{if(a)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=Object.assign||function(e){for(var t=1;td;)for(var f,m=s(arguments[d++]),b=u?a(m).concat(u(m)):a(m),h=b.length,g=0;h>g;)f=b[g++],n&&!p.call(m,f)||(r[f]=m[f]);return r}:l},function(e,t,r){var n=r(85),a=r(741),o=r(742);e.exports=function(e){return function(t,r,i){var c,s=n(t),l=a(s.length),d=o(i,l);if(e&&r!=r){for(;l>d;)if((c=s[d++])!=c)return!0}else for(;l>d;d++)if((e||d in s)&&s[d]===r)return e||d||0;return!e&&-1}}},function(e,t,r){var n=r(180),a=Math.min;e.exports=function(e){return e>0?a(n(e),9007199254740991):0}},function(e,t,r){var n=r(180),a=Math.max,o=Math.min;e.exports=function(e,t){return(e=n(e))<0?a(e+t,0):o(e,t)}},function(e,t,r){"use strict";var n=r(106),a={};function o(e,t,r,n,a,o,i,c){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,a,o,i,c],d=0;(s=new Error(t.replace(/%s/g,(function(){return l[d++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}e.exports=function(e,t,r){var i=[],c={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},s={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},l={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var r=0;r=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})}))},function(e,t,r){var n=r(180),a=r(179);e.exports=function(e){return function(t,r){var o,i,c=String(a(t)),s=n(r),l=c.length;return s<0||s>=l?e?"":void 0:(o=c.charCodeAt(s))<55296||o>56319||s+1===l||(i=c.charCodeAt(s+1))<56320||i>57343?e?c.charAt(s):o:e?c.slice(s,s+2):i-56320+(o-55296<<10)+65536}}},function(e,t,r){"use strict";var n=r(187),a=r(127),o=r(188),i={};r(83)(i,r(86)("iterator"),(function(){return this})),e.exports=function(e,t,r){e.prototype=n(i,{next:a(1,r)}),o(e,t+" Iterator")}},function(e,t,r){var n=r(72),a=r(100),o=r(128);e.exports=r(58)?Object.defineProperties:function(e,t){a(e);for(var r,i=o(t),c=i.length,s=0;c>s;)n.f(e,r=i[s++],t[r]);return e}},function(e,t,r){var n=r(56).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(73),a=r(185),o=r(181)("IE_PROTO"),i=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),n(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?i:null}},function(e,t,r){r(757);for(var n=r(56),a=r(83),o=r(186),i=r(86)("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),s=0;s=e.length?(this._t=void 0,a(1)):a(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])}),"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){e.exports={default:r(761),__esModule:!0}},function(e,t,r){r(762),r(767),r(768),r(769),e.exports=r(57).Symbol},function(e,t,r){"use strict";var n=r(56),a=r(73),o=r(58),i=r(82),c=r(399),s=r(763).KEY,l=r(101),d=r(182),u=r(188),p=r(130),f=r(86),m=r(189),b=r(190),h=r(764),g=r(765),v=r(100),y=r(84),w=r(185),k=r(85),_=r(178),x=r(127),M=r(187),L=r(766),E=r(401),D=r(184),S=r(72),T=r(128),O=E.f,Y=S.f,C=L.f,P=n.Symbol,j=n.JSON,A=j&&j.stringify,N=f("_hidden"),F=f("toPrimitive"),I={}.propertyIsEnumerable,H=d("symbol-registry"),R=d("symbols"),z=d("op-symbols"),W=Object.prototype,B="function"==typeof P&&!!D.f,U=n.QObject,V=!U||!U.prototype||!U.prototype.findChild,q=o&&l((function(){return 7!=M(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=O(W,t);n&&delete W[t],Y(e,t,r),n&&e!==W&&Y(W,t,n)}:Y,G=function(e){var t=R[e]=M(P.prototype);return t._k=e,t},J=B&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},$=function(e,t,r){return e===W&&$(z,t,r),v(e),t=_(t,!0),v(r),a(R,t)?(r.enumerable?(a(e,N)&&e[N][t]&&(e[N][t]=!1),r=M(r,{enumerable:x(0,!1)})):(a(e,N)||Y(e,N,x(1,{})),e[N][t]=!0),q(e,t,r)):Y(e,t,r)},K=function(e,t){v(e);for(var r,n=h(t=k(t)),a=0,o=n.length;o>a;)$(e,r=n[a++],t[r]);return e},X=function(e){var t=I.call(this,e=_(e,!0));return!(this===W&&a(R,e)&&!a(z,e))&&(!(t||!a(this,e)||!a(R,e)||a(this,N)&&this[N][e])||t)},Q=function(e,t){if(e=k(e),t=_(t,!0),e!==W||!a(R,t)||a(z,t)){var r=O(e,t);return!r||!a(R,t)||a(e,N)&&e[N][t]||(r.enumerable=!0),r}},Z=function(e){for(var t,r=C(k(e)),n=[],o=0;r.length>o;)a(R,t=r[o++])||t==N||t==s||n.push(t);return n},ee=function(e){for(var t,r=e===W,n=C(r?z:k(e)),o=[],i=0;n.length>i;)!a(R,t=n[i++])||r&&!a(W,t)||o.push(R[t]);return o};B||(c((P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(r){this===W&&t.call(z,r),a(this,N)&&a(this[N],e)&&(this[N][e]=!1),q(this,e,x(1,r))};return o&&V&&q(W,e,{configurable:!0,set:t}),G(e)}).prototype,"toString",(function(){return this._k})),E.f=Q,S.f=$,r(400).f=L.f=Z,r(131).f=X,D.f=ee,o&&!r(129)&&c(W,"propertyIsEnumerable",X,!0),m.f=function(e){return G(f(e))}),i(i.G+i.W+i.F*!B,{Symbol:P});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;te.length>re;)f(te[re++]);for(var ne=T(f.store),ae=0;ne.length>ae;)b(ne[ae++]);i(i.S+i.F*!B,"Symbol",{for:function(e){return a(H,e+="")?H[e]:H[e]=P(e)},keyFor:function(e){if(!J(e))throw TypeError(e+" is not a symbol!");for(var t in H)if(H[t]===e)return t},useSetter:function(){V=!0},useSimple:function(){V=!1}}),i(i.S+i.F*!B,"Object",{create:function(e,t){return void 0===t?M(e):K(M(e),t)},defineProperty:$,defineProperties:K,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:ee});var oe=l((function(){D.f(1)}));i(i.S+i.F*oe,"Object",{getOwnPropertySymbols:function(e){return D.f(w(e))}}),j&&i(i.S+i.F*(!B||l((function(){var e=P();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))}))),"JSON",{stringify:function(e){for(var t,r,n=[e],a=1;arguments.length>a;)n.push(arguments[a++]);if(r=t=n[1],(y(t)||void 0!==e)&&!J(e))return g(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!J(t))return t}),n[1]=t,A.apply(j,n)}}),P.prototype[F]||r(83)(P.prototype,F,P.prototype.valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(n.JSON,"JSON",!0)},function(e,t,r){var n=r(130)("meta"),a=r(84),o=r(73),i=r(72).f,c=0,s=Object.isExtensible||function(){return!0},l=!r(101)((function(){return s(Object.preventExtensions({}))})),d=function(e){i(e,n,{value:{i:"O"+ ++c,w:{}}})},u=e.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,n)){if(!s(e))return"F";if(!t)return"E";d(e)}return e[n].i},getWeak:function(e,t){if(!o(e,n)){if(!s(e))return!0;if(!t)return!1;d(e)}return e[n].w},onFreeze:function(e){return l&&u.NEED&&s(e)&&!o(e,n)&&d(e),e}}},function(e,t,r){var n=r(128),a=r(184),o=r(131);e.exports=function(e){var t=n(e),r=a.f;if(r)for(var i,c=r(e),s=o.f,l=0;c.length>l;)s.call(e,i=c[l++])&&t.push(i);return t}},function(e,t,r){var n=r(396);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,r){var n=r(85),a=r(400).f,o={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return i&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return i.slice()}}(e):a(n(e))}},function(e,t){},function(e,t,r){r(190)("asyncIterator")},function(e,t,r){r(190)("observable")},function(e,t,r){e.exports={default:r(771),__esModule:!0}},function(e,t,r){r(772),e.exports=r(57).Object.setPrototypeOf},function(e,t,r){var n=r(82);n(n.S,"Object",{setPrototypeOf:r(773).set})},function(e,t,r){var n=r(84),a=r(100),o=function(e,t){if(a(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=r(391)(Function.call,r(401).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return o(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:o}},function(e,t,r){e.exports={default:r(775),__esModule:!0}},function(e,t,r){r(776);var n=r(57).Object;e.exports=function(e,t){return n.create(e,t)}},function(e,t,r){var n=r(82);n(n.S,"Object",{create:r(187)})},function(e,t,r){var n;!function(a){var o=/^\s+/,i=/\s+$/,c=0,s=a.round,l=a.min,d=a.max,u=a.random;function p(e,t){if(t=t||{},(e=e||"")instanceof p)return e;if(!(this instanceof p))return new p(e,t);var r=function(e){var t={r:0,g:0,b:0},r=1,n=null,c=null,s=null,u=!1,p=!1;"string"==typeof e&&(e=function(e){e=e.replace(o,"").replace(i,"").toLowerCase();var t,r=!1;if(O[e])e=O[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=B.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=B.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=B.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=B.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=B.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=B.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=B.hex8.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),a:H(t[4]),format:r?"name":"hex8"};if(t=B.hex6.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),format:r?"name":"hex"};if(t=B.hex4.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),a:H(t[4]+""+t[4]),format:r?"name":"hex8"};if(t=B.hex3.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),format:r?"name":"hex"};return!1}(e));"object"==typeof e&&(U(e.r)&&U(e.g)&&U(e.b)?(f=e.r,m=e.g,b=e.b,t={r:255*P(f,255),g:255*P(m,255),b:255*P(b,255)},u=!0,p="%"===String(e.r).substr(-1)?"prgb":"rgb"):U(e.h)&&U(e.s)&&U(e.v)?(n=F(e.s),c=F(e.v),t=function(e,t,r){e=6*P(e,360),t=P(t,100),r=P(r,100);var n=a.floor(e),o=e-n,i=r*(1-t),c=r*(1-o*t),s=r*(1-(1-o)*t),l=n%6;return{r:255*[r,c,i,i,s,r][l],g:255*[s,r,r,c,i,i][l],b:255*[i,i,s,r,r,c][l]}}(e.h,n,c),u=!0,p="hsv"):U(e.h)&&U(e.s)&&U(e.l)&&(n=F(e.s),s=F(e.l),t=function(e,t,r){var n,a,o;function i(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=P(e,360),t=P(t,100),r=P(r,100),0===t)n=a=o=r;else{var c=r<.5?r*(1+t):r+t-r*t,s=2*r-c;n=i(s,c,e+1/3),a=i(s,c,e),o=i(s,c,e-1/3)}return{r:255*n,g:255*a,b:255*o}}(e.h,n,s),u=!0,p="hsl"),e.hasOwnProperty("a")&&(r=e.a));var f,m,b;return r=C(r),{ok:u,format:e.format||p,r:l(255,d(t.r,0)),g:l(255,d(t.g,0)),b:l(255,d(t.b,0)),a:r}}(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=s(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=s(this._r)),this._g<1&&(this._g=s(this._g)),this._b<1&&(this._b=s(this._b)),this._ok=r.ok,this._tc_id=c++}function f(e,t,r){e=P(e,255),t=P(t,255),r=P(r,255);var n,a,o=d(e,t,r),i=l(e,t,r),c=(o+i)/2;if(o==i)n=a=0;else{var s=o-i;switch(a=c>.5?s/(2-o-i):s/(o+i),o){case e:n=(t-r)/s+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,o.push(p(n));return o}function T(e,t){t=t||6;for(var r=p(e).toHsv(),n=r.h,a=r.s,o=r.v,i=[],c=1/t;t--;)i.push(p({h:n,s:a,v:o})),o=(o+c)%1;return i}p.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,t=n.g/255,r=n.b/255,.2126*(e<=.03928?e/12.92:a.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:a.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:a.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=s(100*this._a)/100,this},toHsv:function(){var e=m(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=m(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),n=s(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=f(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),n=s(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return b(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[N(s(e).toString(16)),N(s(t).toString(16)),N(s(r).toString(16)),N(I(n))];if(a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:s(this._r),g:s(this._g),b:s(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+s(this._r)+", "+s(this._g)+", "+s(this._b)+")":"rgba("+s(this._r)+", "+s(this._g)+", "+s(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:s(100*P(this._r,255))+"%",g:s(100*P(this._g,255))+"%",b:s(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%)":"rgba("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[b(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+h(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=p(e);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return p(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(g,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(M,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(D,arguments)},triad:function(){return this._applyCombination(L,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},p.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:F(e[n]));e=r}return p(e,t)},p.equals=function(e,t){return!(!e||!t)&&p(e).toRgbString()==p(t).toRgbString()},p.random=function(){return p.fromRatio({r:u(),g:u(),b:u()})},p.mix=function(e,t,r){r=0===r?0:r||50;var n=p(e).toRgb(),a=p(t).toRgb(),o=r/100;return p({r:(a.r-n.r)*o+n.r,g:(a.g-n.g)*o+n.g,b:(a.b-n.b)*o+n.b,a:(a.a-n.a)*o+n.a})},p.readability=function(e,t){var r=p(e),n=p(t);return(a.max(r.getLuminance(),n.getLuminance())+.05)/(a.min(r.getLuminance(),n.getLuminance())+.05)},p.isReadable=function(e,t,r){var n,a,o=p.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},p.mostReadable=function(e,t,r){var n,a,o,i,c=null,s=0;a=(r=r||{}).includeFallbackColors,o=r.level,i=r.size;for(var l=0;ls&&(s=n,c=p(t[l]));return p.isReadable(e,c,{level:o,size:i})||!a?c:(r.includeFallbackColors=!1,p.mostReadable(e,["#fff","#000"],r))};var O=p.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=p.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(O);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=l(t,d(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),a.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function j(e){return l(1,d(0,e))}function A(e){return parseInt(e,16)}function N(e){return 1==e.length?"0"+e:""+e}function F(e){return e<=1&&(e=100*e+"%"),e}function I(e){return a.round(255*parseFloat(e)).toString(16)}function H(e){return A(e)/255}var R,z,W,B=(z="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",W="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+z),rgba:new RegExp("rgba"+W),hsl:new RegExp("hsl"+z),hsla:new RegExp("hsla"+W),hsv:new RegExp("hsv"+z),hsva:new RegExp("hsva"+W),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function U(e){return!!B.CSS_UNIT.exec(e)}e.exports?e.exports=p:void 0===(n=function(){return p}.call(t,r,t,e))||(e.exports=n)}(Math)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(r(0)),a=s(r(11)),o=s(r(1)),i=s(r(88)),c=s(r(102));function s(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):function(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n div {\n display: inline-block;\n}\n.rdw-left-aligned-block > div {\n display: inline-block;\n}\n.rdw-center-aligned-block > div {\n display: inline-block;\n}\n.rdw-justify-aligned-block > div {\n display: inline-block;\n}\n\n.rdw-colorpicker-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-colorpicker-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 175px;\n height: 175px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-colorpicker-modal-header {\n display: flex;\n padding-bottom: 5px;\n}\n.rdw-colorpicker-modal-style-label {\n font-size: 15px;\n width: 50%;\n text-align: center;\n cursor: pointer;\n padding: 0 10px 5px;\n}\n.rdw-colorpicker-modal-style-label-active {\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-colorpicker-modal-options {\n margin: 5px auto;\n display: flex;\n width: 100%;\n height: 100%;\n flex-wrap: wrap;\n overflow: scroll;\n}\n.rdw-colorpicker-cube {\n width: 22px;\n height: 22px;\n border: 1px solid #F1F1F1;\n}\n.rdw-colorpicker-option {\n margin: 3px;\n padding: 0;\n min-height: 20px;\n border: none;\n width: 22px;\n height: 22px;\n min-width: 22px;\n box-shadow: 1px 2px 1px #BFBDBD inset;\n}\n.rdw-colorpicker-option:hover {\n box-shadow: 1px 2px 1px #BFBDBD;\n}\n.rdw-colorpicker-option:active {\n box-shadow: -1px -2px 1px #BFBDBD;\n}\n.rdw-colorpicker-option-active {\n box-shadow: 0px 0px 2px 2px #BFBDBD;\n}\n\n.rdw-link-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-link-dropdown {\n width: 50px;\n}\n.rdw-link-dropdownOption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-link-dropdownPlaceholder {\n margin-left: 8px;\n}\n.rdw-link-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n height: 205px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-link-modal-label {\n font-size: 15px;\n}\n.rdw-link-modal-input {\n margin-top: 5px;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n height: 25px;\n margin-bottom: 15px;\n padding: 0 5px;\n}\n.rdw-link-modal-input:focus {\n outline: none;\n}\n.rdw-link-modal-buttonsection {\n margin: 0 auto;\n}\n.rdw-link-modal-target-option {\n margin-bottom: 20px;\n}\n.rdw-link-modal-target-option > span {\n margin-left: 5px;\n}\n.rdw-link-modal-btn {\n margin-left: 10px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-link-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-link-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-link-modal-btn:focus {\n outline: none !important;\n}\n.rdw-link-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-link-dropdownoption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-history-dropdown {\n width: 50px;\n}\n\n.rdw-embedded-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-embedded-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n height: 180px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n justify-content: space-between;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-embedded-modal-header {\n font-size: 15px;\n display: flex;\n}\n.rdw-embedded-modal-header-option {\n width: 50%;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n.rdw-embedded-modal-header-label {\n width: 95px;\n border: 1px solid #f1f1f1;\n margin-top: 5px;\n background: #6EB8D4;\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-embedded-modal-link-section {\n display: flex;\n flex-direction: column;\n}\n.rdw-embedded-modal-link-input {\n width: 88%;\n height: 35px;\n margin: 10px 0;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 15px;\n padding: 0 5px;\n}\n.rdw-embedded-modal-link-input-wrapper {\n display: flex;\n align-items: center;\n}\n.rdw-embedded-modal-link-input:focus {\n outline: none;\n}\n.rdw-embedded-modal-btn-section {\n display: flex;\n justify-content: center;\n}\n.rdw-embedded-modal-btn {\n margin: 0 3px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-embedded-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-embedded-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-embedded-modal-btn:focus {\n outline: none !important;\n}\n.rdw-embedded-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-embedded-modal-size {\n align-items: center;\n display: flex;\n margin: 8px 0;\n justify-content: space-between;\n}\n.rdw-embedded-modal-size-input {\n width: 80%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n}\n.rdw-embedded-modal-size-input:focus {\n outline: none;\n}\n\n.rdw-emoji-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-emoji-modal {\n overflow: auto;\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-wrap: wrap;\n width: 235px;\n height: 180px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-emoji-icon {\n margin: 2.5px;\n height: 24px;\n width: 24px;\n cursor: pointer;\n font-size: 22px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.rdw-spinner {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.rdw-spinner > div {\n width: 12px;\n height: 12px;\n background-color: #333;\n\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;\n animation: sk-bouncedelay 1.4s infinite ease-in-out both;\n}\n.rdw-spinner .rdw-bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.rdw-spinner .rdw-bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%, 80%, 100% { -webkit-transform: scale(0) }\n 40% { -webkit-transform: scale(1.0) }\n}\n@keyframes sk-bouncedelay {\n 0%, 80%, 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n } 40% {\n -webkit-transform: scale(1.0);\n transform: scale(1.0);\n }\n}\n\n.rdw-image-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-image-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-image-modal-header {\n font-size: 15px;\n margin: 10px 0;\n display: flex;\n}\n.rdw-image-modal-header-option {\n width: 50%;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n.rdw-image-modal-header-label {\n width: 80px;\n background: #f1f1f1;\n border: 1px solid #f1f1f1;\n margin-top: 5px;\n}\n.rdw-image-modal-header-label-highlighted {\n background: #6EB8D4;\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-image-modal-upload-option {\n width: 100%;\n color: gray;\n cursor: pointer;\n display: flex;\n border: none;\n font-size: 15px;\n align-items: center;\n justify-content: center;\n background-color: #f1f1f1;\n outline: 2px dashed gray;\n outline-offset: -10px;\n margin: 10px 0;\n padding: 9px 0;\n}\n.rdw-image-modal-upload-option-highlighted {\n outline: 2px dashed #0a66b7;\n}\n.rdw-image-modal-upload-option-label {\n cursor: pointer;\n height: 100%;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 15px;\n}\n.rdw-image-modal-upload-option-label span{\n padding: 0 20px;\n}\n.rdw-image-modal-upload-option-image-preview {\n max-width: 100%;\n max-height: 200px;\n}\n.rdw-image-modal-upload-option-input {\n\twidth: 0.1px;\n\theight: 0.1px;\n\topacity: 0;\n\toverflow: hidden;\n\tposition: absolute;\n\tz-index: -1;\n}\n.rdw-image-modal-url-section {\n display: flex;\n align-items: center;\n}\n.rdw-image-modal-url-input {\n width: 90%;\n height: 35px;\n margin: 15px 0 12px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 15px;\n padding: 0 5px;\n}\n.rdw-image-modal-btn-section {\n margin: 10px auto 0;\n}\n.rdw-image-modal-url-input:focus {\n outline: none;\n}\n.rdw-image-modal-btn {\n margin: 0 5px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-image-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-image-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-image-modal-btn:focus {\n outline: none !important;\n}\n.rdw-image-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-image-modal-spinner {\n position: absolute;\n top: -3px;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0.5;\n}\n.rdw-image-modal-alt-input {\n width: 70%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n margin-left: 5px;\n}\n.rdw-image-modal-alt-input:focus {\n outline: none;\n}\n.rdw-image-modal-alt-lbl {\n font-size: 12px;\n}\n.rdw-image-modal-size {\n align-items: center;\n display: flex;\n margin: 8px 0;\n justify-content: space-between;\n}\n.rdw-image-modal-size-input {\n width: 40%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n}\n.rdw-image-modal-size-input:focus {\n outline: none;\n}\n.rdw-image-mandatory-sign {\n color: red;\n margin-left: 3px;\n margin-right: 3px;\n}\n\n.rdw-remove-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n\n.rdw-history-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n flex-wrap: wrap\n}\n.rdw-history-dropdownoption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-history-dropdown {\n width: 50px;\n}\n\n.rdw-link-decorator-wrapper {\n position: relative;\n}\n.rdw-link-decorator-icon {\n position: absolute;\n left: 40%;\n top: 0;\n cursor: pointer;\n background-color: white;\n}\n\n.rdw-mention-link {\n text-decoration: none;\n color: #1236ff;\n background-color: #f0fbff;\n padding: 1px 2px;\n border-radius: 2px;\n}\n\n.rdw-suggestion-wrapper {\n position: relative;\n}\n.rdw-suggestion-dropdown {\n position: absolute;\n display: flex;\n flex-direction: column;\n border: 1px solid #F1F1F1;\n min-width: 100px;\n max-height: 150px;\n overflow: auto;\n background: white;\n z-index: 100;\n}\n.rdw-suggestion-option {\n padding: 7px 5px;\n border-bottom: 1px solid #f1f1f1;\n}\n.rdw-suggestion-option-active {\n background-color: #F1F1F1;\n}\n\n.rdw-hashtag-link {\n text-decoration: none;\n color: #1236ff;\n background-color: #f0fbff;\n padding: 1px 2px;\n border-radius: 2px;\n}\n\n.rdw-image-alignment-options-popup {\n position: absolute;\n background: white;\n display: flex;\n padding: 5px 2px;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n width: 105px;\n cursor: pointer;\n z-index: 100;\n}\n.rdw-alignment-option-left {\n justify-content: flex-start;\n}\n.rdw-image-alignment-option {\n height: 15px;\n width: 15px;\n min-width: 15px;\n}\n.rdw-image-alignment {\n position: relative;\n}\n.rdw-image-imagewrapper {\n position: relative;\n}\n.rdw-image-center {\n display: flex;\n justify-content: center;\n}\n.rdw-image-left {\n display: flex;\n}\n.rdw-image-right {\n display: flex;\n justify-content: flex-end;\n}\n.rdw-image-alignment-options-popup-right {\n right: 0;\n}\n\n.rdw-editor-main {\n height: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n.rdw-editor-toolbar {\n padding: 6px 5px 0;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n display: flex;\n justify-content: flex-start;\n background: white;\n flex-wrap: wrap;\n font-size: 15px;\n margin-bottom: 5px;\n user-select: none;\n}\n.public-DraftStyleDefault-block {\n margin: 1em 0;\n}\n.rdw-editor-wrapper:focus {\n outline: none;\n}\n.rdw-editor-wrapper {\n box-sizing: content-box;\n}\n.rdw-editor-main blockquote {\n border-left: 5px solid #f1f1f1;\n padding-left: 5px;\n}\n.rdw-editor-main pre {\n background: #f1f1f1;\n border-radius: 3px;\n padding: 1px 10px;\n}\n/**\n * Draft v0.9.1\n *\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n.DraftEditor-editorContainer,.DraftEditor-root,.public-DraftEditor-content{height:inherit;text-align:initial}.public-DraftEditor-content[contenteditable=true]{-webkit-user-modify:read-write-plaintext-only}.DraftEditor-root{position:relative}.DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:.1px solid transparent;position:relative;z-index:1}.public-DraftEditor-block{position:relative}.DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left}.DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left}.DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center}.DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%}.DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right}.DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right}.public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;z-index:0}.public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9}.DraftEditorPlaceholder-hidden{display:none}.public-DraftStyleDefault-block{position:relative;white-space:pre-wrap}.public-DraftStyleDefault-ltr{direction:ltr;text-align:left}.public-DraftStyleDefault-rtl{direction:rtl;text-align:right}.public-DraftStyleDefault-listLTR{direction:ltr}.public-DraftStyleDefault-listRTL{direction:rtl}.public-DraftStyleDefault-ol,.public-DraftStyleDefault-ul{margin:16px 0;padding:0}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em}.public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative}.public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc}.public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth1{list-style-type:circle}.public-DraftStyleDefault-orderedListItem{list-style-type:none;position:relative}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listLTR:before{left:-36px;position:absolute;text-align:right;width:30px}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listRTL:before{position:absolute;right:-36px;text-align:left;width:30px}.public-DraftStyleDefault-orderedListItem:before{content:counter(ol0) ". ";counter-increment:ol0}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth1:before{content:counter(ol1) ". ";counter-increment:ol1}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth2:before{content:counter(ol2) ". ";counter-increment:ol2}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth3:before{content:counter(ol3) ". ";counter-increment:ol3}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth4:before{content:counter(ol4) ". ";counter-increment:ol4}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-reset{counter-reset:ol0}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-reset{counter-reset:ol1}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-reset{counter-reset:ol2}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-reset{counter-reset:ol3}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-reset{counter-reset:ol4}',""]),t.default=a},function(e,t,r){var n=r(77),a=r(789);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},function(e,t,r){"use strict";r.r(t);var n=r(29),a=r.n(n)()(!1);a.push([e.i,'.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n margin-left: -8px;\n position: absolute;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow, .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n box-sizing: content-box;\n position: absolute;\n border: 8px solid transparent;\n height: 0;\n width: 1px;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n content: "";\n z-index: -1;\n border-width: 8px;\n left: -8px;\n border-bottom-color: #aeaeae;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle {\n top: 0;\n margin-top: -8px;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before {\n border-top: none;\n border-bottom-color: #f0f0f0;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before {\n top: -1px;\n border-bottom-color: #aeaeae;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n bottom: 0;\n margin-bottom: -8px;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n border-bottom: none;\n border-top-color: #fff;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n bottom: -1px;\n border-top-color: #aeaeae;\n}\n\n.react-datepicker-wrapper {\n display: inline-block;\n padding: 0;\n border: 0;\n}\n\n.react-datepicker {\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n font-size: 0.8rem;\n background-color: #fff;\n color: #000;\n border: 1px solid #aeaeae;\n border-radius: 0.3rem;\n display: inline-block;\n position: relative;\n}\n\n.react-datepicker--time-only .react-datepicker__triangle {\n left: 35px;\n}\n\n.react-datepicker--time-only .react-datepicker__time-container {\n border-left: 0;\n}\n\n.react-datepicker--time-only .react-datepicker__time {\n border-radius: 0.3rem;\n}\n\n.react-datepicker--time-only .react-datepicker__time-box {\n border-radius: 0.3rem;\n}\n\n.react-datepicker__triangle {\n position: absolute;\n left: 50px;\n}\n\n.react-datepicker-popper {\n z-index: 1;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] {\n margin-top: 10px;\n}\n\n.react-datepicker-popper[data-placement="bottom-end"] .react-datepicker__triangle, .react-datepicker-popper[data-placement="top-end"] .react-datepicker__triangle {\n left: auto;\n right: 50px;\n}\n\n.react-datepicker-popper[data-placement^="top"] {\n margin-bottom: 10px;\n}\n\n.react-datepicker-popper[data-placement^="right"] {\n margin-left: 8px;\n}\n\n.react-datepicker-popper[data-placement^="right"] .react-datepicker__triangle {\n left: auto;\n right: 42px;\n}\n\n.react-datepicker-popper[data-placement^="left"] {\n margin-right: 8px;\n}\n\n.react-datepicker-popper[data-placement^="left"] .react-datepicker__triangle {\n left: 42px;\n right: auto;\n}\n\n.react-datepicker__header {\n text-align: center;\n background-color: #f0f0f0;\n border-bottom: 1px solid #aeaeae;\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n padding-top: 8px;\n position: relative;\n}\n\n.react-datepicker__header--time {\n padding-bottom: 8px;\n padding-left: 5px;\n padding-right: 5px;\n}\n\n.react-datepicker__year-dropdown-container--select,\n.react-datepicker__month-dropdown-container--select,\n.react-datepicker__month-year-dropdown-container--select,\n.react-datepicker__year-dropdown-container--scroll,\n.react-datepicker__month-dropdown-container--scroll,\n.react-datepicker__month-year-dropdown-container--scroll {\n display: inline-block;\n margin: 0 2px;\n}\n\n.react-datepicker__current-month,\n.react-datepicker-time__header,\n.react-datepicker-year-header {\n margin-top: 0;\n color: #000;\n font-weight: bold;\n font-size: 0.944rem;\n}\n\n.react-datepicker-time__header {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n.react-datepicker__navigation {\n background: none;\n line-height: 1.7rem;\n text-align: center;\n cursor: pointer;\n position: absolute;\n top: 10px;\n width: 0;\n padding: 0;\n border: 0.45rem solid transparent;\n z-index: 1;\n height: 10px;\n width: 10px;\n text-indent: -999em;\n overflow: hidden;\n}\n\n.react-datepicker__navigation--previous {\n left: 10px;\n border-right-color: #ccc;\n}\n\n.react-datepicker__navigation--previous:hover {\n border-right-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--previous--disabled, .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__navigation--next {\n right: 10px;\n border-left-color: #ccc;\n}\n\n.react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {\n right: 80px;\n}\n\n.react-datepicker__navigation--next:hover {\n border-left-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--next--disabled, .react-datepicker__navigation--next--disabled:hover {\n border-left-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__navigation--years {\n position: relative;\n top: 0;\n display: block;\n margin-left: auto;\n margin-right: auto;\n}\n\n.react-datepicker__navigation--years-previous {\n top: 4px;\n border-top-color: #ccc;\n}\n\n.react-datepicker__navigation--years-previous:hover {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--years-upcoming {\n top: -4px;\n border-bottom-color: #ccc;\n}\n\n.react-datepicker__navigation--years-upcoming:hover {\n border-bottom-color: #b3b3b3;\n}\n\n.react-datepicker__month-container {\n float: left;\n}\n\n.react-datepicker__year-container {\n margin: 0.4rem;\n text-align: center;\n display: flex;\n flex-wrap: wrap;\n}\n\n.react-datepicker__year-container-text {\n display: inline-block;\n cursor: pointer;\n flex: 1 0 30%;\n width: 12px;\n padding: 2px;\n}\n\n.react-datepicker__month {\n margin: 0.4rem;\n text-align: center;\n}\n\n.react-datepicker__month .react-datepicker__month-text,\n.react-datepicker__month .react-datepicker__quarter-text {\n display: inline-block;\n width: 4rem;\n margin: 2px;\n}\n\n.react-datepicker__input-time-container {\n clear: both;\n width: 100%;\n float: left;\n margin: 5px 0 10px 15px;\n text-align: left;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__caption {\n display: inline-block;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container {\n display: inline-block;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input {\n display: inline-block;\n margin-left: 10px;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input {\n width: 85px;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"]::-webkit-inner-spin-button,\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"] {\n -moz-appearance: textfield;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__delimiter {\n margin-left: 5px;\n display: inline-block;\n}\n\n.react-datepicker__time-container {\n float: right;\n border-left: 1px solid #aeaeae;\n width: 85px;\n}\n\n.react-datepicker__time-container--with-today-button {\n display: inline;\n border: 1px solid #aeaeae;\n border-radius: 0.3rem;\n position: absolute;\n right: -72px;\n top: 0;\n}\n\n.react-datepicker__time-container .react-datepicker__time {\n position: relative;\n background: white;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box {\n width: 85px;\n overflow-x: hidden;\n margin: 0 auto;\n text-align: center;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list {\n list-style: none;\n margin: 0;\n height: calc(195px + (1.7rem / 2));\n overflow-y: scroll;\n padding-right: 0px;\n padding-left: 0px;\n width: 100%;\n box-sizing: content-box;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item {\n height: 30px;\n padding: 5px 10px;\n white-space: nowrap;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover {\n cursor: pointer;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected {\n background-color: #216ba5;\n color: white;\n font-weight: bold;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected:hover {\n background-color: #216ba5;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled {\n color: #ccc;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled:hover {\n cursor: default;\n background-color: transparent;\n}\n\n.react-datepicker__week-number {\n color: #ccc;\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n}\n\n.react-datepicker__week-number.react-datepicker__week-number--clickable {\n cursor: pointer;\n}\n\n.react-datepicker__week-number.react-datepicker__week-number--clickable:hover {\n border-radius: 0.3rem;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__day-names,\n.react-datepicker__week {\n white-space: nowrap;\n}\n\n.react-datepicker__day-name,\n.react-datepicker__day,\n.react-datepicker__time-name {\n color: #000;\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n}\n\n.react-datepicker__month--selected, .react-datepicker__month--in-selecting-range, .react-datepicker__month--in-range,\n.react-datepicker__quarter--selected,\n.react-datepicker__quarter--in-selecting-range,\n.react-datepicker__quarter--in-range,\n.react-datepicker__year-container-text--selected,\n.react-datepicker__year-container-text--in-selecting-range,\n.react-datepicker__year-container-text--in-range {\n border-radius: 0.3rem;\n background-color: #216ba5;\n color: #fff;\n}\n\n.react-datepicker__month--selected:hover, .react-datepicker__month--in-selecting-range:hover, .react-datepicker__month--in-range:hover,\n.react-datepicker__quarter--selected:hover,\n.react-datepicker__quarter--in-selecting-range:hover,\n.react-datepicker__quarter--in-range:hover,\n.react-datepicker__year-container-text--selected:hover,\n.react-datepicker__year-container-text--in-selecting-range:hover,\n.react-datepicker__year-container-text--in-range:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__month--disabled,\n.react-datepicker__quarter--disabled,\n.react-datepicker__year-container-text--disabled {\n color: #ccc;\n pointer-events: none;\n}\n\n.react-datepicker__month--disabled:hover,\n.react-datepicker__quarter--disabled:hover,\n.react-datepicker__year-container-text--disabled:hover {\n cursor: default;\n background-color: transparent;\n}\n\n.react-datepicker__day,\n.react-datepicker__month-text,\n.react-datepicker__quarter-text {\n cursor: pointer;\n}\n\n.react-datepicker__day:hover,\n.react-datepicker__month-text:hover,\n.react-datepicker__quarter-text:hover {\n border-radius: 0.3rem;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__day--today,\n.react-datepicker__month-text--today,\n.react-datepicker__quarter-text--today {\n font-weight: bold;\n}\n\n.react-datepicker__day--highlighted,\n.react-datepicker__month-text--highlighted,\n.react-datepicker__quarter-text--highlighted {\n border-radius: 0.3rem;\n background-color: #3dcc4a;\n color: #fff;\n}\n\n.react-datepicker__day--highlighted:hover,\n.react-datepicker__month-text--highlighted:hover,\n.react-datepicker__quarter-text--highlighted:hover {\n background-color: #32be3f;\n}\n\n.react-datepicker__day--highlighted-custom-1,\n.react-datepicker__month-text--highlighted-custom-1,\n.react-datepicker__quarter-text--highlighted-custom-1 {\n color: magenta;\n}\n\n.react-datepicker__day--highlighted-custom-2,\n.react-datepicker__month-text--highlighted-custom-2,\n.react-datepicker__quarter-text--highlighted-custom-2 {\n color: green;\n}\n\n.react-datepicker__day--selected, .react-datepicker__day--in-selecting-range, .react-datepicker__day--in-range,\n.react-datepicker__month-text--selected,\n.react-datepicker__month-text--in-selecting-range,\n.react-datepicker__month-text--in-range,\n.react-datepicker__quarter-text--selected,\n.react-datepicker__quarter-text--in-selecting-range,\n.react-datepicker__quarter-text--in-range {\n border-radius: 0.3rem;\n background-color: #216ba5;\n color: #fff;\n}\n\n.react-datepicker__day--selected:hover, .react-datepicker__day--in-selecting-range:hover, .react-datepicker__day--in-range:hover,\n.react-datepicker__month-text--selected:hover,\n.react-datepicker__month-text--in-selecting-range:hover,\n.react-datepicker__month-text--in-range:hover,\n.react-datepicker__quarter-text--selected:hover,\n.react-datepicker__quarter-text--in-selecting-range:hover,\n.react-datepicker__quarter-text--in-range:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__day--keyboard-selected,\n.react-datepicker__month-text--keyboard-selected,\n.react-datepicker__quarter-text--keyboard-selected {\n border-radius: 0.3rem;\n background-color: #2a87d0;\n color: #fff;\n}\n\n.react-datepicker__day--keyboard-selected:hover,\n.react-datepicker__month-text--keyboard-selected:hover,\n.react-datepicker__quarter-text--keyboard-selected:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__day--in-selecting-range ,\n.react-datepicker__month-text--in-selecting-range ,\n.react-datepicker__quarter-text--in-selecting-range {\n background-color: rgba(33, 107, 165, 0.5);\n}\n\n.react-datepicker__month--selecting-range .react-datepicker__day--in-range , .react-datepicker__month--selecting-range\n.react-datepicker__month-text--in-range , .react-datepicker__month--selecting-range\n.react-datepicker__quarter-text--in-range {\n background-color: #f0f0f0;\n color: #000;\n}\n\n.react-datepicker__day--disabled,\n.react-datepicker__month-text--disabled,\n.react-datepicker__quarter-text--disabled {\n cursor: default;\n color: #ccc;\n}\n\n.react-datepicker__day--disabled:hover,\n.react-datepicker__month-text--disabled:hover,\n.react-datepicker__quarter-text--disabled:hover {\n background-color: transparent;\n}\n\n.react-datepicker__month-text.react-datepicker__month--selected:hover, .react-datepicker__month-text.react-datepicker__month--in-range:hover, .react-datepicker__month-text.react-datepicker__quarter--selected:hover, .react-datepicker__month-text.react-datepicker__quarter--in-range:hover,\n.react-datepicker__quarter-text.react-datepicker__month--selected:hover,\n.react-datepicker__quarter-text.react-datepicker__month--in-range:hover,\n.react-datepicker__quarter-text.react-datepicker__quarter--selected:hover,\n.react-datepicker__quarter-text.react-datepicker__quarter--in-range:hover {\n background-color: #216ba5;\n}\n\n.react-datepicker__month-text:hover,\n.react-datepicker__quarter-text:hover {\n background-color: #f0f0f0;\n}\n\n.react-datepicker__input-container {\n position: relative;\n display: inline-block;\n width: 100%;\n}\n\n.react-datepicker__year-read-view,\n.react-datepicker__month-read-view,\n.react-datepicker__month-year-read-view {\n border: 1px solid transparent;\n border-radius: 0.3rem;\n}\n\n.react-datepicker__year-read-view:hover,\n.react-datepicker__month-read-view:hover,\n.react-datepicker__month-year-read-view:hover {\n cursor: pointer;\n}\n\n.react-datepicker__year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__year-read-view:hover .react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view:hover .react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-year-read-view:hover .react-datepicker__month-read-view--down-arrow {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n border-top-color: #ccc;\n float: right;\n margin-left: 20px;\n top: 8px;\n position: relative;\n border-width: 0.45rem;\n}\n\n.react-datepicker__year-dropdown,\n.react-datepicker__month-dropdown,\n.react-datepicker__month-year-dropdown {\n background-color: #f0f0f0;\n position: absolute;\n width: 50%;\n left: 25%;\n top: 30px;\n z-index: 1;\n text-align: center;\n border-radius: 0.3rem;\n border: 1px solid #aeaeae;\n}\n\n.react-datepicker__year-dropdown:hover,\n.react-datepicker__month-dropdown:hover,\n.react-datepicker__month-year-dropdown:hover {\n cursor: pointer;\n}\n\n.react-datepicker__year-dropdown--scrollable,\n.react-datepicker__month-dropdown--scrollable,\n.react-datepicker__month-year-dropdown--scrollable {\n height: 150px;\n overflow-y: scroll;\n}\n\n.react-datepicker__year-option,\n.react-datepicker__month-option,\n.react-datepicker__month-year-option {\n line-height: 20px;\n width: 100%;\n display: block;\n margin-left: auto;\n margin-right: auto;\n}\n\n.react-datepicker__year-option:first-of-type,\n.react-datepicker__month-option:first-of-type,\n.react-datepicker__month-year-option:first-of-type {\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n}\n\n.react-datepicker__year-option:last-of-type,\n.react-datepicker__month-option:last-of-type,\n.react-datepicker__month-year-option:last-of-type {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n border-bottom-left-radius: 0.3rem;\n border-bottom-right-radius: 0.3rem;\n}\n\n.react-datepicker__year-option:hover,\n.react-datepicker__month-option:hover,\n.react-datepicker__month-year-option:hover {\n background-color: #ccc;\n}\n\n.react-datepicker__year-option:hover .react-datepicker__navigation--years-upcoming,\n.react-datepicker__month-option:hover .react-datepicker__navigation--years-upcoming,\n.react-datepicker__month-year-option:hover .react-datepicker__navigation--years-upcoming {\n border-bottom-color: #b3b3b3;\n}\n\n.react-datepicker__year-option:hover .react-datepicker__navigation--years-previous,\n.react-datepicker__month-option:hover .react-datepicker__navigation--years-previous,\n.react-datepicker__month-year-option:hover .react-datepicker__navigation--years-previous {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__year-option--selected,\n.react-datepicker__month-option--selected,\n.react-datepicker__month-year-option--selected {\n position: absolute;\n left: 15px;\n}\n\n.react-datepicker__close-icon {\n cursor: pointer;\n background-color: transparent;\n border: 0;\n outline: 0;\n padding: 0px 6px 0px 0px;\n position: absolute;\n top: 0;\n right: 0;\n height: 100%;\n display: table-cell;\n vertical-align: middle;\n}\n\n.react-datepicker__close-icon::after {\n cursor: pointer;\n background-color: #216ba5;\n color: #fff;\n border-radius: 50%;\n height: 16px;\n width: 16px;\n padding: 2px;\n font-size: 12px;\n line-height: 1;\n text-align: center;\n display: table-cell;\n vertical-align: middle;\n content: "\\00d7";\n}\n\n.react-datepicker__today-button {\n background: #f0f0f0;\n border-top: 1px solid #aeaeae;\n cursor: pointer;\n text-align: center;\n font-weight: bold;\n padding: 5px 0;\n clear: left;\n}\n\n.react-datepicker__portal {\n position: fixed;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n left: 0;\n top: 0;\n justify-content: center;\n align-items: center;\n display: flex;\n z-index: 2147483647;\n}\n\n.react-datepicker__portal .react-datepicker__day-name,\n.react-datepicker__portal .react-datepicker__day,\n.react-datepicker__portal .react-datepicker__time-name {\n width: 3rem;\n line-height: 3rem;\n}\n\n@media (max-width: 400px), (max-height: 550px) {\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 2rem;\n line-height: 2rem;\n }\n}\n\n.react-datepicker__portal .react-datepicker__current-month,\n.react-datepicker__portal .react-datepicker-time__header {\n font-size: 1.44rem;\n}\n\n.react-datepicker__portal .react-datepicker__navigation {\n border: 0.81rem solid transparent;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous {\n border-right-color: #ccc;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous:hover {\n border-right-color: #b3b3b3;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous--disabled, .react-datepicker__portal .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next {\n border-left-color: #ccc;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next:hover {\n border-left-color: #b3b3b3;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next--disabled, .react-datepicker__portal .react-datepicker__navigation--next--disabled:hover {\n border-left-color: #e6e6e6;\n cursor: default;\n}\n',""]),t.default=a},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return a}));var n=r(3);function a(e){return Object(n.a)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(197),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(198),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(104),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(199),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(105),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(200),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getSeconds();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getMinutes();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getHours();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getDay();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getDate();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getMonth();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=Math.floor(t.getMonth()/3)+1;return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getFullYear();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getTime();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setSeconds(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setMinutes(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setHours(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return c}));var n=r(6),a=r(5),o=r(202),i=r(3);function c(e,t){Object(i.a)(2,arguments);var r=Object(a.default)(e),c=Object(n.a)(t),s=Math.floor(r.getMonth()/3)+1,l=c-s;return Object(o.default)(r,r.getMonth()+3*l)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return isNaN(r)?new Date(NaN):(r.setFullYear(i),r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){var t,r;if(Object(a.a)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Object(n.default)(e);(void 0===r||r>t||isNaN(t))&&(r=t)})),r||new Date(NaN)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){var t,r;if(Object(a.a)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Object(n.default)(e);(void 0===r||r=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Object(n.default)(e),u=d.getDay(),p=6+(uo.getTime()}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e,t){Object(a.a)(2,arguments);var r=Object(n.default)(e),o=Object(n.default)(t);return r.getTime()=i&&o<=c}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return l}));var n=r(6),a=r(3),o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},i=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,s=/^([+-])(\d{2})(?::?(\d{2}))?$/;function l(e,t){Object(a.a)(1,arguments);var r=t||{},o=null==r.additionalDigits?2:Object(n.a)(r.additionalDigits);if(2!==o&&1!==o&&0!==o)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,c=d(e);if(c.date){var s=u(c.date,o);i=p(s.restDateString,s.year)}if(isNaN(i)||!i)return new Date(NaN);var l,f=i.getTime(),b=0;if(c.time&&(b=m(c.time),isNaN(b)||null===b))return new Date(NaN);if(!c.timezone){var g=new Date(f+b),v=new Date(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate(),g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds());return v.setFullYear(g.getUTCFullYear()),v}return l=h(c.timezone),isNaN(l)?new Date(NaN):new Date(f+b+l)}function d(e){var t,r={},n=e.split(o.dateTimeDelimiter);if(/:/.test(n[0])?(r.date=null,t=n[0]):(r.date=n[0],t=n[1],o.timeZoneDelimiter.test(r.date)&&(r.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(r.date.length,e.length))),t){var a=o.timezone.exec(t);a?(r.time=t.replace(a[1],""),r.timezone=a[1]):r.time=t}return r}function u(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:null};var a=n[1]&&parseInt(n[1]),o=n[2]&&parseInt(n[2]);return{year:null==o?a:100*o,restDateString:e.slice((n[1]||n[2]).length)}}function p(e,t){if(null===t)return null;var r=e.match(i);if(!r)return null;var n=!!r[4],a=f(r[1]),o=f(r[2])-1,c=f(r[3]),s=f(r[4]),l=f(r[5])-1;if(n)return function(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}(0,s,l)?function(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,o=7*(t-1)+r+1-a;return n.setUTCDate(n.getUTCDate()+o),n}(t,s,l):new Date(NaN);var d=new Date(0);return function(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(g[t]||(v(e)?29:28))}(t,o,c)&&function(e,t){return t>=1&&t<=(v(e)?366:365)}(t,a)?(d.setUTCFullYear(t,o,Math.max(a,c)),d):new Date(NaN)}function f(e){return e?parseInt(e):1}function m(e){var t=e.match(c);if(!t)return null;var r=b(t[1]),n=b(t[2]),a=b(t[3]);return function(e,t,r){if(24===e)return 0===t&&0===r;return r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}(r,n,a)?36e5*r+6e4*n+1e3*a:NaN}function b(e){return e&&parseFloat(e.replace(",","."))||0}function h(e){if("Z"===e)return 0;var t=e.match(s);if(!t)return 0;var r="+"===t[1]?-1:1,n=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,a)?r*(36e5*n+6e4*a):NaN}var g=[31,null,31,30,31,30,31,31,30,31,30,31];function v(e){return e%400==0||e%4==0&&e%100}},function(e,t,r){"use strict";r.r(t),r.d(t,"IGNORE_CLASS_NAME",(function(){return p}));var n=r(0),a=r(11);function o(e,t,r){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(r):e.classList.contains(r))}var i,c,s=(void 0===i&&(i=0),function(){return++i}),l={},d={},u=["touchstart","touchmove"],p="ignore-react-onclickoutside";function f(e,t){var r=null;return-1!==u.indexOf(t)&&c&&(r={passive:!e.props.preventDefault}),r}t.default=function(e,t){var r,i,u=e.displayName||e.name||"Component";return i=r=function(r){var i,p;function m(e){var n;return(n=r.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof n.__clickOutsideHandlerProp){var t=n.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+u+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else n.__clickOutsideHandlerProp(e)},n.__getComponentNode=function(){var e=n.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(a.findDOMNode)(e)},n.enableOnClickOutside=function(){if("undefined"!=typeof document&&!d[n._uid]){void 0===c&&(c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=function(){};return window.addEventListener("testPassiveEventSupport",r,t),window.removeEventListener("testPassiveEventSupport",r,t),e}}()),d[n._uid]=!0;var e=n.props.eventTypes;e.forEach||(e=[e]),l[n._uid]=function(e){var t;null!==n.componentNode&&(n.props.preventDefault&&e.preventDefault(),n.props.stopPropagation&&e.stopPropagation(),n.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,r){if(e===t)return!0;for(;e.parentNode;){if(o(e,t,r))return!0;e=e.parentNode}return e}(e.target,n.componentNode,n.props.outsideClickIgnoreClass)===document&&n.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,l[n._uid],f(n,e))}))}},n.disableOnClickOutside=function(){delete d[n._uid];var e=l[n._uid];if(e&&"undefined"!=typeof document){var t=n.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(n,t))})),delete l[n._uid]}},n.getRef=function(e){return n.instanceRef=e},n._uid=s(),n}p=r,(i=m).prototype=Object.create(p.prototype),i.prototype.constructor=i,i.__proto__=p;var b=m.prototype;return b.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},b.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+u+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},b.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},b.componentWillUnmount=function(){this.disableOnClickOutside()},b.render=function(){var t=this.props,r=(t.excludeScrollbar,function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?r.ref=this.getRef:r.wrappedRef=this.getRef,r.disableOnClickOutside=this.disableOnClickOutside,r.enableOnClickOutside=this.enableOnClickOutside,Object(n.createElement)(e,r)},m}(n.Component),r.displayName="OnClickOutside("+u+")",r.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:p,preventDefault:!1,stopPropagation:!1},r.getClass=function(){return e.getClass?e.getClass():e},i}},function(e,t,r){"use strict";var n;if(!Object.keys){var a=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=r(405),c=Object.prototype.propertyIsEnumerable,s=!c.call({toString:null},"toString"),l=c.call((function(){}),"prototype"),d=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],u=function(e){var t=e.constructor;return t&&t.prototype===e},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!p["$"+e]&&a.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{u(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=i(e),c=t&&"[object String]"===o.call(e),p=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var m=l&&r;if(c&&e.length>0&&!a.call(e,0))for(var b=0;b0)for(var h=0;h=0&&"[object Array]"!==a.call(e)&&"[object Function]"===a.call(e.callee)},c=function(){return o(arguments)}();o.isLegacyArguments=i,e.exports=c?o:i},function(e,t,r){"use strict";var n=r(103),a=r(835),o=r(408),i=r(409),c=r(839),s=a(i(),Object);n(s,{getPolyfill:i,implementation:o,shim:c}),e.exports=s},function(e,t,r){"use strict";e.exports=r(192)},function(e,t,r){"use strict";var n="Function.prototype.bind called on incompatible ",a=Array.prototype.slice,o=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==o.call(t))throw new TypeError(n+t);for(var r,i=a.call(arguments,1),c=function(){if(this instanceof r){var n=t.apply(this,i.concat(a.call(arguments)));return Object(n)===n?n:this}return t.apply(e,i.concat(a.call(arguments)))},s=Math.max(0,t.length-i.length),l=[],d=0;d-1?a(r):r}},function(e,t,r){"use strict";var n=r(103),a=r(192),o=r(410),i=r(411),c=r(843),s=a(o);n(s,{getPolyfill:i,implementation:o,shim:c}),e.exports=s},function(e,t,r){"use strict";var n=r(103).supportsDescriptors,a=r(411),o=Object.getOwnPropertyDescriptor,i=Object.defineProperty,c=TypeError,s=Object.getPrototypeOf,l=/a/;e.exports=function(){if(!n||!s)throw new c("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=a(),t=s(l),r=o(t,"flags");return r&&r.get===e||i(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},function(e,t,r){"use strict";var n=Date.prototype.getDay,a=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){return"object"==typeof e&&null!==e&&(o?function(e){try{return n.call(e),!0}catch(e){return!1}}(e):"[object Date]"===a.call(e))}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(0),a=(i(n),i(r(1))),o=i(r(846));i(r(201));function i(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function d(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}t.default=function(e,t){var r,i,u="__create-react-context-"+(0,o.default)()+"__",p=function(e){function r(){var t,n;c(this,r);for(var a=arguments.length,o=Array(a),i=0;i0&&void 0!==r[0])||r[0],e.abrupt("return",this.apiCall("notifications/fetch",{new:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"markNotificationsSeen",value:(E=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("notifications/seen"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"getUser",value:(L=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/get",{id:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"deleteUser",value:(M=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/delete",{id:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"fetchUsers",value:(x=s(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:1,r=n.length>1&&void 0!==n[1]?n[1]:20,e.abrupt("return",this.apiCall("user/fetch",{page:t,count:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"fetchGroups",value:(_=s(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:1,r=n.length>1&&void 0!==n[1]?n[1]:20,e.abrupt("return",this.apiCall("groups/fetch",{page:t,count:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"inviteUser",value:(k=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/invite",{username:t,email:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"createUser",value:(w=s(regeneratorRuntime.mark((function e(t,r,n,a){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/create",{username:t,email:r,password:n,confirmPassword:a}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return w.apply(this,arguments)})},{key:"getStats",value:(y=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("stats"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getRoutes",value:(v=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("routes/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"saveRoutes",value:(g=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("routes/save",{routes:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"createGroup",value:(h=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("groups/create",{name:t,color:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"deleteGroup",value:(b=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("groups/delete",{uid:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getSettings",value:(m=s(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"",e.abrupt("return",this.apiCall("settings/get",{key:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"saveSettings",value:(f=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("settings/set",{settings:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"sendTestMail",value:(p=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("mail/test",{receiver:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"fetchPermissions",value:(u=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("permission/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"savePermissions",value:(d=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("permission/save",{permissions:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"getVisitors",value:(c=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("visitors/stats",{type:t,date:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"fetchContactRequests",value:(i=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getContactMessages",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/get",{requestId:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"sendContactMessage",value:(a=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/respond",{requestId:t,message:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})}])&&l(t.prototype,r),n&&l(t,n),e}();function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0;d--){var u=a[d];"."===u?x(a,d):".."===u?(x(a,d),l++):l&&(x(a,d),l--)}if(!c)for(;l--;l)a.unshift("..");!c||""===a[0]||a[0]&&_(a[0])||a.unshift("");var p=a.join("/");return r&&"/"!==p.substr(-1)&&(p+="/"),p};var L=function(e,t){if(!e)throw new Error("Invariant failed")};function E(e){return"/"===e.charAt(0)?e:"/"+e}function D(e){return"/"===e.charAt(0)?e.substr(1):e}function S(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function T(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function O(e){var t=e.pathname,r=e.search,n=e.hash,a=t||"/";return r&&"?"!==r&&(a+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(a+="#"===n.charAt(0)?n:"#"+n),a}function Y(e,t,r,n){var a;"string"==typeof e?(a=function(e){var t=e||"/",r="",n="",a=t.indexOf("#");-1!==a&&(n=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(r=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===r?"":r,hash:"#"===n?"":n}}(e)).state=t:(void 0===(a=k({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return r&&(a.key=r),n?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=M(a.pathname,n.pathname)):a.pathname=n.pathname:a.pathname||(a.pathname="/"),a}function C(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,r,n,a){if(null!=e){var o="function"==typeof e?e(t,r):e;"string"==typeof o?"function"==typeof n?n(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var r=!0;function n(){r&&e.apply(void 0,arguments)}return t.push(n),function(){r=!1,t=t.filter((function(e){return e!==n}))}},notifyListeners:function(){for(var e=arguments.length,r=new Array(e),n=0;nt?r.splice(t,r.length-t,n):r.push(n),d({action:"PUSH",location:n,index:t,entries:r})}}))},replace:function(e,t){var n=Y(e,t,u(),h.location);l.confirmTransitionTo(n,"REPLACE",r,(function(e){e&&(h.entries[h.index]=n,d({action:"REPLACE",location:n}))}))},go:b,goBack:function(){b(-1)},goForward:function(){b(1)},canGo:function(e){var t=h.index+e;return t>=0&&t=0||(a[r]=e[r]);return a}r(412);var J=function(e){var t=Object(U.a)();return t.displayName=e,t}("Router-History"),$=function(e){var t=Object(U.a)();return t.displayName=e,t}("Router"),K=function(e){function t(t){var r;return(r=e.call(this,t)||this).state={location:t.history.location},r._isMounted=!1,r._pendingLocation=null,t.staticContext||(r.unlisten=t.history.listen((function(e){r._isMounted?r.setState({location:e}):r._pendingLocation=e}))),r}Object(v.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var r=t.prototype;return r.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},r.componentWillUnmount=function(){this.unlisten&&this.unlisten()},r.render=function(){return a.a.createElement($.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.a.createElement(J.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.a.Component);a.a.Component;a.a.Component;var X={},Q=0;function Z(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var r=t,n=r.path,a=r.exact,o=void 0!==a&&a,i=r.strict,c=void 0!==i&&i,s=r.sensitive,l=void 0!==s&&s;return[].concat(n).reduce((function(t,r){if(!r&&""!==r)return null;if(t)return t;var n=function(e,t){var r=""+t.end+t.strict+t.sensitive,n=X[r]||(X[r]={});if(n[e])return n[e];var a=[],o={regexp:q()(e,a,t),keys:a};return Q<1e4&&(n[e]=o,Q++),o}(r,{end:o,strict:c,sensitive:l}),a=n.regexp,i=n.keys,s=a.exec(e);if(!s)return null;var d=s[0],u=s.slice(1),p=e===d;return o&&!p?null:{path:r,url:"/"===r&&""===d?"/":d,isExact:p,params:i.reduce((function(e,t,r){return e[t.name]=u[r],e}),{})}}),null)}var ee=function(e){function t(){return e.apply(this,arguments)||this}return Object(v.a)(t,e),t.prototype.render=function(){var e=this;return a.a.createElement($.Consumer,null,(function(t){t||L(!1);var r=e.props.location||t.location,n=k({},t,{location:r,match:e.props.computedMatch?e.props.computedMatch:e.props.path?Z(r.pathname,e.props):t.match}),o=e.props,i=o.children,c=o.component,s=o.render;return Array.isArray(i)&&0===i.length&&(i=null),a.a.createElement($.Provider,{value:n},n.match?i?"function"==typeof i?i(n):i:c?a.a.createElement(c,n):s?s(n):null:"function"==typeof i?i(n):null)}))},t}(a.a.Component);function te(e){return"/"===e.charAt(0)?e:"/"+e}function re(e,t){if(!e)return t;var r=te(e);return 0!==t.pathname.indexOf(r)?t:k({},t,{pathname:t.pathname.substr(r.length)})}function ne(e){return"string"==typeof e?e:O(e)}function ae(e){return function(){L(!1)}}function oe(){}a.a.Component;var ie=function(e){function t(){return e.apply(this,arguments)||this}return Object(v.a)(t,e),t.prototype.render=function(){var e=this;return a.a.createElement($.Consumer,null,(function(t){t||L(!1);var r,n,o=e.props.location||t.location;return a.a.Children.forEach(e.props.children,(function(e){if(null==n&&a.a.isValidElement(e)){r=e;var i=e.props.path||e.props.from;n=i?Z(o.pathname,k({},e.props,{path:i})):t.match}})),n?a.a.cloneElement(r,{location:o,computedMatch:n}):null}))},t}(a.a.Component);var ce=a.a.useContext;function se(){return ce($).location}var le=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&(s=c+" new notification");for(var l=[],d=0;d0?"block":"none"}},c)),n.createElement("div",{className:"dropdown-menu dropdown-menu-lg dropdown-menu-right "+(a?" show":"")},n.createElement("span",{className:"dropdown-item dropdown-header"},s),l,n.createElement("div",{className:"dropdown-divider"}),n.createElement(be,{to:"/admin/logs",className:"dropdown-item dropdown-footer"},"See All Notifications")))))}function _e(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return xe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xe(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(n>9&&(n="9+"),r.logs.badge={type:"warning",value:n}),console.log("sidebar",t.contactRequests);var o,i=0,c=_e(t.contactRequests);try{for(c.s();!(o=c.n()).done;){i+=o.value.unread}}catch(e){c.e(e)}finally{c.f()}i>0&&(r.contact.badge={type:"info",value:i});var s=[];for(var l in r){var d=r[l],u=d.badge?a.a.createElement("span",{className:"right badge badge-"+d.badge.type},d.badge.value):a.a.createElement(a.a.Fragment,null);s.push(a.a.createElement("li",{key:l,className:"nav-item"},a.a.createElement(ve,{to:"/admin/"+l,className:"nav-link",activeClassName:"active"},a.a.createElement(m,{icon:d.icon,className:"nav-icon"}),a.a.createElement("p",null,d.name,u))))}var p=t.filesPath;return p&&s.push(a.a.createElement("li",{className:"nav-item",key:"files"},a.a.createElement("a",{href:p,className:"nav-link",target:"_blank",rel:"noopener"},a.a.createElement(m,{icon:"folder",className:"nav-icon"}),a.a.createElement("p",null,"Files")))),s.push(a.a.createElement("li",{className:"nav-item",key:"logout"},a.a.createElement("a",{href:"#",onClick:function(){t.api.logout().then((function(e){e.success?document.location="/admin":t.showDialog("Error logging out: "+e.msg,"Error logging out")}))},className:"nav-link"},a.a.createElement(m,{icon:"arrow-left",className:"nav-icon"}),a.a.createElement("p",null,"Logout")))),a.a.createElement("aside",{className:"main-sidebar sidebar-dark-primary elevation-4"},a.a.createElement(be,{href:"#",className:"brand-link",to:"/admin/dashboard"},a.a.createElement("img",{src:"/img/icons/logo.png",alt:"Logo",className:"brand-image img-circle elevation-3",style:{opacity:".8"}}),a.a.createElement("span",{className:"brand-text font-weight-light ml-2"},"WebBase")),a.a.createElement("div",{className:"sidebar os-host os-theme-light os-host-overflow os-host-overflow-y os-host-resize-disabled os-host-scrollbar-horizontal-hidden os-host-transition"},a.a.createElement("div",{className:"os-resize-observer-host"},a.a.createElement("div",{className:"os-resize-observer observed",style:{left:"0px",right:"auto"}})),a.a.createElement("div",{className:"os-size-auto-observer",style:{height:"calc(100% + 1px)",float:"left"}},a.a.createElement("div",{className:"os-resize-observer observed"})),a.a.createElement("div",{className:"os-content-glue",style:{margin:"0px -8px"}}),a.a.createElement("div",{className:"os-padding"},a.a.createElement("div",{className:"os-viewport os-viewport-native-scrollbars-invisible",style:{right:"0px",bottom:"0px"}},a.a.createElement("div",{className:"os-content",style:{padding:"0px 0px",height:"100%",width:"100%"}},a.a.createElement("div",{className:"user-panel mt-3 pb-3 mb-3 d-flex"},a.a.createElement("div",{className:"info"},a.a.createElement("a",{href:"#",className:"d-block"},"Logged in as: ",t.api.user.name))),a.a.createElement("nav",{className:"mt-2"},a.a.createElement("ul",{className:"nav nav-pills nav-sidebar flex-column","data-widget":"treeview",role:"menu","data-accordion":"false"},s)))))))}function Le(e){var t=e.onClose||null,r=e.title||"Untitled Alert",n=e.message||"Alert message",o=e.type||"danger",i="ban";return"warning"===o?i="exclamation-triangle":"success"===o&&(i="check"),a.a.createElement("div",{className:"alert alert-"+o+" alert-dismissible"},t?a.a.createElement("button",{type:"button",className:"close","data-dismiss":"alert","aria-hidden":"true",onClick:t},"×"):null,a.a.createElement("h5",null,a.a.createElement(m,{icon:i,className:"icon"})," ",r),n)}var Ee="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),De=new Uint8Array(16);function Se(){if(!Ee)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ee(De)}for(var Te=[],Oe=0;Oe<256;++Oe)Te[Oe]=(Oe+256).toString(16).substr(1);var Ye=function(e,t){var r=t||0,n=Te;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")};var Ce=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||Se)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var o=0;o<16;++o)t[n+o]=a[o];return t||Ye(a)};function Pe(e,t){for(var r=0;rw},S=function(e){return function(e){var t=h[e].b;return b+t+y}(e)>k},T=function(e){return function(e){return L(e)<0}(e)||D(e)||function(e){return E(e)<0}(e)||S(e)},O=function(e){return!T(e)},Y=["top","bottom","left","right"],C=[],P=0;P<4;P++){var j=Y[P];O(j)&&C.push(j)}var A,N=!1,F=a!==n;return O(a)&&F?(N=!0,A=a):C.length>0&&T(a)&&T(n)&&(N=!0,A=C[0]),N?{isNewState:!0,newState:{place:A}}:{isNewState:!1,position:{left:parseInt(L(n)-M,10),top:parseInt(E(n)-x,10)}}}var Xe=function(e){var t=e.getBoundingClientRect(),r=t.height,n=t.width;return{height:parseInt(r,10),width:parseInt(n,10)}},Qe=function(e,t,r){var n=t.getBoundingClientRect(),a=n.top,o=n.left,i=Xe(t),c=i.width,s=i.height;return"float"===r?{mouseX:e.clientX,mouseY:e.clientY}:{mouseX:o+c/2,mouseY:a+s/2}},Ze=function(e,t,r,n,a){var o,i,c,s;return"float"===e?(o={l:-n/2,r:n/2,t:-(a+3+2),b:-3},c={l:-n/2,r:n/2,t:15,b:a+3+2+12},s={l:-(n+3+2),r:-3,t:-a/2,b:a/2},i={l:3,r:n+3+2,t:-a/2,b:a/2}):"solid"===e&&(o={l:-n/2,r:n/2,t:-(r/2+a+2),b:-r/2},c={l:-n/2,r:n/2,t:r/2,b:r/2+a+2},s={l:-(n+t/2+2),r:-t/2,t:-a/2,b:a/2},i={l:t/2,r:n+t/2+2,t:-a/2,b:a/2}),{top:o,bottom:c,left:s,right:i}},et=function(e){var t=0,r=0;for(var n in"[object String]"===Object.prototype.toString.apply(e)&&(e=JSON.parse(e.toString().replace(/'/g,'"'))),e)"top"===n?r-=parseInt(e[n],10):"bottom"===n?r+=parseInt(e[n],10):"left"===n?t-=parseInt(e[n],10):"right"===n&&(t+=parseInt(e[n],10));return{extraOffsetX:t,extraOffsetY:r}},tt=function(e){for(var t=e;t&&"none"===window.getComputedStyle(t).getPropertyValue("transform");)t=t.parentElement;return{parentTop:t&&t.getBoundingClientRect().top||0,parentLeft:t&&t.getBoundingClientRect().left||0}};function rt(e,t,r,n){if(t)return t;if(null!=r)return r;if(null===r)return null;var o=//;return n&&"false"!==n&&o.test(e)?e.split(o).map((function(e,t){return a.a.createElement("span",{key:t,className:"multi-line"},e)})):e}function nt(e){var t={};return Object.keys(e).filter((function(e){return/(^aria-\w+$|^role$)/.test(e)})).forEach((function(r){t[r]=e[r]})),t}function at(e){var t=e.length;return e.hasOwnProperty?Array.prototype.slice.call(e):new Array(t).fill().map((function(t){return e[t]}))}!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t)}}('.__react_component_tooltip {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n left: -999em;\n opacity: 0;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n top: -999em;\n visibility: hidden;\n z-index: 999;\n}\n.__react_component_tooltip.allow_hover, .__react_component_tooltip.allow_click {\n pointer-events: auto;\n}\n.__react_component_tooltip::before, .__react_component_tooltip::after {\n content: "";\n width: 0;\n height: 0;\n position: absolute;\n}\n.__react_component_tooltip.show {\n opacity: 0.9;\n margin-top: 0;\n margin-left: 0;\n visibility: visible;\n}\n.__react_component_tooltip.place-top::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n bottom: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-bottom::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n top: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-left::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n right: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip.place-right::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n left: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip .multi-line {\n display: block;\n padding: 2px 0;\n text-align: center;\n}');var ot,it,ct,st={dark:{text:"#fff",background:"#222",border:"transparent",arrow:"#222"},success:{text:"#fff",background:"#8DC572",border:"transparent",arrow:"#8DC572"},warning:{text:"#fff",background:"#F0AD4E",border:"transparent",arrow:"#F0AD4E"},error:{text:"#fff",background:"#BE6464",border:"transparent",arrow:"#BE6464"},info:{text:"#fff",background:"#337AB7",border:"transparent",arrow:"#337AB7"},light:{text:"#222",background:"#fff",border:"transparent",arrow:"#fff"}};function lt(e,t,r,n){return function(e,t){var r=t.text,n=t.background,a=t.border,o=t.arrow;return"\n \t.".concat(e," {\n\t color: ").concat(r,";\n\t background: ").concat(n,";\n\t border: 1px solid ").concat(a,";\n \t}\n\n \t.").concat(e,".place-top {\n margin-top: -10px;\n }\n .").concat(e,".place-top::before {\n border-top: 8px solid ").concat(a,";\n }\n .").concat(e,".place-top::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n bottom: -6px;\n left: 50%;\n margin-left: -8px;\n border-top-color: ").concat(o,";\n border-top-style: solid;\n border-top-width: 6px;\n }\n\n .").concat(e,".place-bottom {\n margin-top: 10px;\n }\n .").concat(e,".place-bottom::before {\n border-bottom: 8px solid ").concat(a,";\n }\n .").concat(e,".place-bottom::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n top: -6px;\n left: 50%;\n margin-left: -8px;\n border-bottom-color: ").concat(o,";\n border-bottom-style: solid;\n border-bottom-width: 6px;\n }\n\n .").concat(e,".place-left {\n margin-left: -10px;\n }\n .").concat(e,".place-left::before {\n border-left: 8px solid ").concat(a,";\n }\n .").concat(e,".place-left::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n right: -6px;\n top: 50%;\n margin-top: -4px;\n border-left-color: ").concat(o,";\n border-left-style: solid;\n border-left-width: 6px;\n }\n\n .").concat(e,".place-right {\n margin-left: 10px;\n }\n .").concat(e,".place-right::before {\n border-right: 8px solid ").concat(a,";\n }\n .").concat(e,".place-right::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n left: -6px;\n top: 50%;\n margin-top: -4px;\n border-right-color: ").concat(o,";\n border-right-style: solid;\n border-right-width: 6px;\n }\n ")}(e,function(e,t,r){var n=e.text,a=e.background,o=e.border,i=e.arrow?e.arrow:e.background,c=function(e){return st[e]?Ie({},st[e]):void 0}(t);n&&(c.text=n);a&&(c.background=a);r&&(c.border=o||("light"===t?"black":"white"));i&&(c.arrow=i);return c}(t,r,n))}var dt,ut=function(e){e.hide=function(e){Be(We.HIDE,{target:e})},e.rebuild=function(){Be(We.REBUILD)},e.show=function(e){Be(We.SHOW,{target:e})},e.prototype.globalRebuild=function(){this.mount&&(this.unbindListener(),this.bindListener())},e.prototype.globalShow=function(e){if(this.mount){var t=!!(e&&e.detail&&e.detail.target);this.showTooltip({currentTarget:t&&e.detail.target},!0)}},e.prototype.globalHide=function(e){if(this.mount){var t=!!(e&&e.detail&&e.detail.target);this.hideTooltip({currentTarget:t&&e.detail.target},t)}}}(ot=function(e){e.prototype.bindWindowEvents=function(e){window.removeEventListener(We.HIDE,this.globalHide),window.addEventListener(We.HIDE,this.globalHide,!1),window.removeEventListener(We.REBUILD,this.globalRebuild),window.addEventListener(We.REBUILD,this.globalRebuild,!1),window.removeEventListener(We.SHOW,this.globalShow),window.addEventListener(We.SHOW,this.globalShow,!1),e&&(window.removeEventListener("resize",this.onWindowResize),window.addEventListener("resize",this.onWindowResize,!1))},e.prototype.unbindWindowEvents=function(){window.removeEventListener(We.HIDE,this.globalHide),window.removeEventListener(We.REBUILD,this.globalRebuild),window.removeEventListener(We.SHOW,this.globalShow),window.removeEventListener("resize",this.onWindowResize)},e.prototype.onWindowResize=function(){this.mount&&this.hideTooltip()}}(ot=function(e){e.prototype.isCustomEvent=function(e){return this.state.event||!!e.getAttribute("data-event")},e.prototype.customBindListener=function(e){var t=this,r=this.state,n=r.event,a=r.eventOff,o=e.getAttribute("data-event")||n,i=e.getAttribute("data-event-off")||a;o.split(" ").forEach((function(r){e.removeEventListener(r,qe.get(e,r));var n=Ue.bind(t,i);qe.set(e,r,n),e.addEventListener(r,n,!1)})),i&&i.split(" ").forEach((function(r){e.removeEventListener(r,t.hideTooltip),e.addEventListener(r,t.hideTooltip,!1)}))},e.prototype.customUnbindListener=function(e){var t=this.state,r=t.event,n=t.eventOff,a=r||e.getAttribute("data-event"),o=n||e.getAttribute("data-event-off");e.removeEventListener(a,qe.get(e,r)),o&&e.removeEventListener(o,this.hideTooltip)}}(ot=function(e){e.prototype.isCapture=function(e){return e&&"true"===e.getAttribute("data-iscapture")||this.props.isCapture||!1}}(ot=function(e){e.prototype.getEffect=function(e){return e.getAttribute("data-effect")||this.props.effect||"float"}}(ot=function(e){e.prototype.isBodyMode=function(){return!!this.props.bodyMode},e.prototype.bindBodyListener=function(e){var t=this,r=this.state,n=r.event,a=r.eventOff,o=r.possibleCustomEvents,i=r.possibleCustomEventsOff,c=$e(),s=Je(e,"data-event"),l=Je(e,"data-event-off");null!=n&&(s[n]=!0),null!=a&&(l[a]=!0),o.split(" ").forEach((function(e){return s[e]=!0})),i.split(" ").forEach((function(e){return l[e]=!0})),this.unbindBodyListener(c);var d=this.bodyModeListeners={};for(var u in null==n&&(d.mouseover=Ge.bind(this,this.showTooltip,{}),d.mousemove=Ge.bind(this,this.updateTooltip,{respectEffect:!0}),d.mouseout=Ge.bind(this,this.hideTooltip,{})),s)d[u]=Ge.bind(this,(function(e){var r=e.currentTarget.getAttribute("data-event-off")||a;Ue.call(t,r,e)}),{customEvent:!0});for(var p in l)d[p]=Ge.bind(this,this.hideTooltip,{customEvent:!0});for(var f in d)c.addEventListener(f,d[f])},e.prototype.unbindBodyListener=function(e){e=e||$e();var t=this.bodyModeListeners;for(var r in t)e.removeEventListener(r,t[r])}}((ct=it=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=ze(this,He(t).call(this,e))).state={uuid:e.uuid||"t"+Ce(),place:e.place||"top",desiredPlace:e.place||"top",type:"dark",effect:"float",show:!1,border:!1,customColors:{},offset:{},extraClass:"",html:!1,delayHide:0,delayShow:0,event:e.event||null,eventOff:e.eventOff||null,currentEvent:null,currentTarget:null,ariaProps:nt(e),isEmptyTip:!1,disable:!1,possibleCustomEvents:e.possibleCustomEvents||"",possibleCustomEventsOff:e.possibleCustomEventsOff||"",originTooltip:null,isMultiline:!1},r.bind(["showTooltip","updateTooltip","hideTooltip","hideTooltipOnScroll","getTooltipContent","globalRebuild","globalShow","globalHide","onWindowResize","mouseOnToolTip"]),r.mount=!0,r.delayShowLoop=null,r.delayHideLoop=null,r.delayReshow=null,r.intervalUpdateContent=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,e),je(t,null,[{key:"propTypes",get:function(){return{uuid:w.a.string,children:w.a.any,place:w.a.string,type:w.a.string,effect:w.a.string,offset:w.a.object,multiline:w.a.bool,border:w.a.bool,textColor:w.a.string,backgroundColor:w.a.string,borderColor:w.a.string,arrowColor:w.a.string,insecure:w.a.bool,class:w.a.string,className:w.a.string,id:w.a.string,html:w.a.bool,delayHide:w.a.number,delayUpdate:w.a.number,delayShow:w.a.number,event:w.a.string,eventOff:w.a.string,isCapture:w.a.bool,globalEventOff:w.a.string,getContent:w.a.any,afterShow:w.a.func,afterHide:w.a.func,overridePosition:w.a.func,disable:w.a.bool,scrollHide:w.a.bool,resizeHide:w.a.bool,wrapper:w.a.string,bodyMode:w.a.bool,possibleCustomEvents:w.a.string,possibleCustomEventsOff:w.a.string,clickable:w.a.bool}}}]),je(t,[{key:"bind",value:function(e){var t=this;e.forEach((function(e){t[e]=t[e].bind(t)}))}},{key:"componentDidMount",value:function(){var e=this.props,t=(e.insecure,e.resizeHide);this.bindListener(),this.bindWindowEvents(t)}},{key:"componentWillUnmount",value:function(){this.mount=!1,this.clearTimer(),this.unbindListener(),this.removeScrollListener(this.state.currentTarget),this.unbindWindowEvents()}},{key:"mouseOnToolTip",value:function(){return!(!this.state.show||!this.tooltipRef)&&(this.tooltipRef.matches||(this.tooltipRef.msMatchesSelector?this.tooltipRef.matches=this.tooltipRef.msMatchesSelector:this.tooltipRef.matches=this.tooltipRef.mozMatchesSelector),this.tooltipRef.matches(":hover"))}},{key:"getTargetArray",value:function(e){var t,r=[];if(e){var n=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');t='[data-tip][data-for="'.concat(n,'"]')}else t="[data-tip]:not([data-for])";return at(document.getElementsByTagName("*")).filter((function(e){return e.shadowRoot})).forEach((function(e){r=r.concat(at(e.shadowRoot.querySelectorAll(t)))})),r.concat(at(document.querySelectorAll(t)))}},{key:"bindListener",value:function(){var e=this,t=this.props,r=t.id,n=t.globalEventOff,a=t.isCapture,o=this.getTargetArray(r);o.forEach((function(t){null===t.getAttribute("currentItem")&&t.setAttribute("currentItem","false"),e.unbindBasicListener(t),e.isCustomEvent(t)&&e.customUnbindListener(t)})),this.isBodyMode()?this.bindBodyListener(o):o.forEach((function(t){var r=e.isCapture(t),n=e.getEffect(t);e.isCustomEvent(t)?e.customBindListener(t):(t.addEventListener("mouseenter",e.showTooltip,r),"float"===n&&t.addEventListener("mousemove",e.updateTooltip,r),t.addEventListener("mouseleave",e.hideTooltip,r))})),n&&(window.removeEventListener(n,this.hideTooltip),window.addEventListener(n,this.hideTooltip,a)),this.bindRemovalTracker()}},{key:"unbindListener",value:function(){var e=this,t=this.props,r=t.id,n=t.globalEventOff;this.isBodyMode()?this.unbindBodyListener():this.getTargetArray(r).forEach((function(t){e.unbindBasicListener(t),e.isCustomEvent(t)&&e.customUnbindListener(t)})),n&&window.removeEventListener(n,this.hideTooltip),this.unbindRemovalTracker()}},{key:"unbindBasicListener",value:function(e){var t=this.isCapture(e);e.removeEventListener("mouseenter",this.showTooltip,t),e.removeEventListener("mousemove",this.updateTooltip,t),e.removeEventListener("mouseleave",this.hideTooltip,t)}},{key:"getTooltipContent",value:function(){var e,t=this.props,r=t.getContent,n=t.children;return r&&(e=Array.isArray(r)?r[0]&&r[0](this.state.originTooltip):r(this.state.originTooltip)),rt(this.state.originTooltip,n,e,this.state.isMultiline)}},{key:"isEmptyTip",value:function(e){return"string"==typeof e&&""===e||null===e}},{key:"showTooltip",value:function(e,t){if(!t||this.getTargetArray(this.props.id).some((function(t){return t===e.currentTarget}))){var r=this.props,n=r.multiline,a=r.getContent,o=e.currentTarget.getAttribute("data-tip"),i=e.currentTarget.getAttribute("data-multiline")||n||!1,c=e instanceof window.FocusEvent||t,s=!0;e.currentTarget.getAttribute("data-scroll-hide")?s="true"===e.currentTarget.getAttribute("data-scroll-hide"):null!=this.props.scrollHide&&(s=this.props.scrollHide);var l=e.currentTarget.getAttribute("data-place")||this.props.place||"top",d=c?"solid":this.getEffect(e.currentTarget),u=e.currentTarget.getAttribute("data-offset")||this.props.offset||{},p=Ke(e,e.currentTarget,this.tooltipRef,l,l,d,u);p.position&&this.props.overridePosition&&(p.position=this.props.overridePosition(p.position,e,e.currentTarget,this.tooltipRef,l,l,d,u));var f=p.isNewState?p.newState.place:l;this.clearTimer();var m=e.currentTarget,b=this.state.show?m.getAttribute("data-delay-update")||this.props.delayUpdate:0,h=this,g=function(){h.setState({originTooltip:o,isMultiline:i,desiredPlace:l,place:f,type:m.getAttribute("data-type")||h.props.type||"dark",customColors:{text:m.getAttribute("data-text-color")||h.props.textColor||null,background:m.getAttribute("data-background-color")||h.props.backgroundColor||null,border:m.getAttribute("data-border-color")||h.props.borderColor||null,arrow:m.getAttribute("data-arrow-color")||h.props.arrowColor||null},effect:d,offset:u,html:(m.getAttribute("data-html")?"true"===m.getAttribute("data-html"):h.props.html)||!1,delayShow:m.getAttribute("data-delay-show")||h.props.delayShow||0,delayHide:m.getAttribute("data-delay-hide")||h.props.delayHide||0,delayUpdate:m.getAttribute("data-delay-update")||h.props.delayUpdate||0,border:(m.getAttribute("data-border")?"true"===m.getAttribute("data-border"):h.props.border)||!1,extraClass:m.getAttribute("data-class")||h.props.class||h.props.className||"",disable:(m.getAttribute("data-tip-disable")?"true"===m.getAttribute("data-tip-disable"):h.props.disable)||!1,currentTarget:m},(function(){s&&h.addScrollListener(h.state.currentTarget),h.updateTooltip(e),a&&Array.isArray(a)&&(h.intervalUpdateContent=setInterval((function(){if(h.mount){var e=h.props.getContent,t=rt(o,"",e[0](),i),r=h.isEmptyTip(t);h.setState({isEmptyTip:r}),h.updatePosition()}}),a[1]))}))};b?this.delayReshow=setTimeout(g,b):g()}}},{key:"updateTooltip",value:function(e){var t=this,r=this.state,n=r.delayShow,a=r.disable,o=this.props.afterShow,i=this.getTooltipContent(),c=parseInt(n,10),s=e.currentTarget||e.target;if(!this.mouseOnToolTip()&&!this.isEmptyTip(i)&&!a){var l=function(){if(Array.isArray(i)&&i.length>0||i){var r=!t.state.show;t.setState({currentEvent:e,currentTarget:s,show:!0},(function(){t.updatePosition(),r&&o&&o(e)}))}};clearTimeout(this.delayShowLoop),n?this.delayShowLoop=setTimeout(l,c):l()}}},{key:"listenForTooltipExit",value:function(){this.state.show&&this.tooltipRef&&this.tooltipRef.addEventListener("mouseleave",this.hideTooltip)}},{key:"removeListenerForTooltipExit",value:function(){this.state.show&&this.tooltipRef&&this.tooltipRef.removeEventListener("mouseleave",this.hideTooltip)}},{key:"hideTooltip",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isScroll:!1},a=this.state.disable,o=n.isScroll,i=o?0:this.state.delayHide,c=this.props.afterHide,s=this.getTooltipContent();if(this.mount&&!this.isEmptyTip(s)&&!a){if(t){var l=this.getTargetArray(this.props.id),d=l.some((function(t){return t===e.currentTarget}));if(!d||!this.state.show)return}var u=function(){var t=r.state.show;r.mouseOnToolTip()?r.listenForTooltipExit():(r.removeListenerForTooltipExit(),r.setState({show:!1},(function(){r.removeScrollListener(r.state.currentTarget),t&&c&&c(e)})))};this.clearTimer(),i?this.delayHideLoop=setTimeout(u,parseInt(i,10)):u()}}},{key:"hideTooltipOnScroll",value:function(e,t){this.hideTooltip(e,t,{isScroll:!0})}},{key:"addScrollListener",value:function(e){var t=this.isCapture(e);window.addEventListener("scroll",this.hideTooltipOnScroll,t)}},{key:"removeScrollListener",value:function(e){var t=this.isCapture(e);window.removeEventListener("scroll",this.hideTooltipOnScroll,t)}},{key:"updatePosition",value:function(){var e=this,t=this.state,r=t.currentEvent,n=t.currentTarget,a=t.place,o=t.desiredPlace,i=t.effect,c=t.offset,s=this.tooltipRef,l=Ke(r,n,s,a,o,i,c);if(l.position&&this.props.overridePosition&&(l.position=this.props.overridePosition(l.position,r,n,s,a,o,i,c)),l.isNewState)return this.setState(l.newState,(function(){e.updatePosition()}));s.style.left=l.position.left+"px",s.style.top=l.position.top+"px"}},{key:"clearTimer",value:function(){clearTimeout(this.delayShowLoop),clearTimeout(this.delayHideLoop),clearTimeout(this.delayReshow),clearInterval(this.intervalUpdateContent)}},{key:"hasCustomColors",value:function(){var e=this;return Boolean(Object.keys(this.state.customColors).find((function(t){return"border"!==t&&e.state.customColors[t]}))||this.state.border&&this.state.customColors.border)}},{key:"render",value:function(){var e=this,r=this.state,n=r.extraClass,o=r.html,i=r.ariaProps,c=r.disable,s=this.getTooltipContent(),l=this.isEmptyTip(s),d=lt(this.state.uuid,this.state.customColors,this.state.type,this.state.border),u="__react_component_tooltip"+" ".concat(this.state.uuid)+(!this.state.show||c||l?"":" show")+(this.state.border?" border":"")+" place-".concat(this.state.place)+" type-".concat(this.hasCustomColors()?"custom":this.state.type)+(this.props.delayUpdate?" allow_hover":"")+(this.props.clickable?" allow_click":""),p=this.props.wrapper;t.supportedWrappers.indexOf(p)<0&&(p=t.defaultProps.wrapper);var f=[u,n].filter(Boolean).join(" ");if(o){var m="".concat(s,"\n");return a.a.createElement(p,Ne({className:"".concat(f),id:this.props.id,ref:function(t){return e.tooltipRef=t}},i,{"data-id":"tooltip",dangerouslySetInnerHTML:{__html:m}}))}return a.a.createElement(p,Ne({className:"".concat(f),id:this.props.id},i,{ref:function(t){return e.tooltipRef=t},"data-id":"tooltip"}),a.a.createElement("style",{dangerouslySetInnerHTML:{__html:d}}),s)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var r=t.ariaProps,n=nt(e);return Object.keys(n).some((function(e){return n[e]!==r[e]}))?Ie({},t,{ariaProps:n}):null}}]),t}(a.a.Component),Ae(it,"defaultProps",{insecure:!0,resizeHide:!0,wrapper:"div",clickable:!1}),Ae(it,"supportedWrappers",["div","span"]),Ae(it,"displayName","ReactTooltip"),(dt=ot=ct).prototype.bindRemovalTracker=function(){var e=this,t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(null!=t){var r=new t((function(t){for(var r=0;r=0&&e=this.state.users.pageCount?" disabled":"",f=function(t){var r=e.state.users.page===t?" active":"";d.push(n.createElement("li",{key:"page-"+t,className:"page-item"+r},n.createElement("a",{className:"page-link",href:"#",onClick:function(){e.state.users.page!==t&&e.fetchUsers(t)}},t)))},b=1;b<=this.state.users.pageCount;b++)f(b);return n.createElement("div",{className:"card"},n.createElement("div",{className:"card-header border-0"},n.createElement("h3",{className:"card-title"},"Users"),n.createElement("div",{className:"card-tools"},n.createElement(be,{href:"#",className:"btn btn-tool btn-sm",to:"/admin/user/add"},n.createElement(m,{icon:"plus"})),n.createElement("a",{href:"#",className:"btn btn-tool btn-sm",onClick:function(){return e.fetchUsers()}},n.createElement(m,{icon:"sync"})))),n.createElement("div",{className:"card-body table-responsive p-0"},n.createElement("table",{className:"table table-striped table-valign-middle"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Username"),n.createElement("th",null,"Email"),n.createElement("th",null,"Groups"),n.createElement("th",null,"Registered"),n.createElement("th",{className:"text-center"},"Confirmed"),n.createElement("th",null,n.createElement(m,{icon:"tools"})))),n.createElement("tbody",null,t)),n.createElement("nav",{className:"row m-0"},n.createElement("div",{className:"col-6 pl-3 pt-3 pb-3 text-muted"},"Total: ",this.state.users.totalCount),n.createElement("div",{className:"col-6 p-0"},n.createElement("ul",{className:"pagination p-2 m-0 justify-content-end"},n.createElement("li",{className:"page-item"+u},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchUsers(e.state.users.page-1)}},"Previous")),d,n.createElement("li",{className:"page-item"+p},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchUsers(e.state.users.page+1)}},"Next")))))))}},{key:"createGroupCard",value:function(){var e=this,t=[],r=function(r){if(!e.state.groups.data.hasOwnProperty(r))return"continue";var a=e.state.groups.data[r];t.push(n.createElement("tr",{key:"group-"+r},n.createElement("td",null,a.name),n.createElement("td",{className:"text-center"},a.memberCount),n.createElement("td",null,n.createElement("span",{className:"badge text-white mr-1",style:{backgroundColor:a.color,fontFamily:"monospace"}},a.color)),n.createElement("td",null,n.createElement(m,{icon:"trash",style:{color:"red",cursor:"pointer"},onClick:function(t){return e.onDeleteGroup(t,r)},"data-effect":"solid","data-tip":"Delete","data-type":"error","data-place":"bottom"}))))};for(var a in this.state.groups.data)r(a);for(;t.length=this.state.groups.pageCount?" disabled":"",s=function(t){var r=e.state.groups.page===t?" active":"";o.push(n.createElement("li",{key:"page-"+t,className:"page-item"+r},n.createElement("a",{className:"page-link",href:"#",onClick:function(){e.state.groups.page!==t&&e.fetchGroups(t)}},t)))},l=1;l<=this.state.groups.pageCount;l++)s(l);return n.createElement("div",{className:"card"},n.createElement("div",{className:"card-header border-0"},n.createElement("h3",{className:"card-title"},"Groups"),n.createElement("div",{className:"card-tools"},n.createElement(be,{href:"#",className:"btn btn-tool btn-sm",to:"/admin/group/add"},n.createElement(m,{icon:"plus"})),n.createElement("a",{href:"#",className:"btn btn-tool btn-sm",onClick:function(){return e.fetchGroups()}},n.createElement(m,{icon:"sync"})))),n.createElement("div",{className:"card-body table-responsive p-0"},n.createElement("table",{className:"table table-striped table-valign-middle"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Name"),n.createElement("th",{className:"text-center"},"Members"),n.createElement("th",null,"Color"),n.createElement("th",null,n.createElement(m,{icon:"tools"})))),n.createElement("tbody",null,t)),n.createElement("nav",{className:"row m-0"},n.createElement("div",{className:"col-6 pl-3 pt-3 pb-3 text-muted"},"Total: ",this.state.groups.totalCount),n.createElement("div",{className:"col-6 p-0"},n.createElement("ul",{className:"pagination p-2 m-0 justify-content-end"},n.createElement("li",{className:"page-item"+i},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchGroups(e.state.groups.page-1)}},"Previous")),o,n.createElement("li",{className:"page-item"+c},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchGroups(e.state.groups.page+1)}},"Next")))))))}},{key:"onDeleteGroup",value:function(e,t){var r=this;e.stopPropagation(),this.parent.showDialog("Are you really sure you want to delete this group?","Delete Group?",["Yes","No"],(function(e){"Yes"===e&&r.parent.api.deleteGroup(t).then((function(e){if(e.success)r.setState(bt(bt({},r.state),{},{loaded:!1})),r.fetchGroups();else{var t=r.state.errors.slice();t.push({title:"Error deleting group",message:e.msg}),r.setState(bt(bt({},r.state),{},{errors:t}))}}))}))}}])&>(t.prototype,r),a&>(t,a),i}(n.Component),xt=r(133),Mt=r(75);function Lt(e){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Et(){return(Et=Object.assign||function(e){for(var t=1;t=0&&e=0&&i1&&void 0!==arguments[1]?arguments[1]:1,r=1024;if(Math.abs(e)=r&&a=0&&e0){var i=this.state.errors.slice();return i.push({title:"Missing input",message:"The following fields are missing: "+r.join(", "),type:"warning"}),void this.setState(Rt(Rt({},this.state),{},{errors:i}))}this.setState(Rt(Rt({},this.state),{},{isSubmitting:!0}));var c=this.state.username,s=this.state.email||"",l=this.state.password,d=this.state.confirmPassword;if(this.state.sendInvite)this.parent.api.inviteUser(c,s).then((function(e){var r=t.state.errors.slice();e.success?(r.push({title:"Success",message:"The invitation was successfully sent.",type:"success"}),t.setState(Rt(Rt({},t.state),{},{errors:r,username:"",email:"",isSubmitting:!1}))):(r.push({title:"Error inviting User",message:e.msg,type:"danger"}),t.setState(Rt(Rt({},t.state),{},{errors:r,isSubmitting:!1})))}));else{if(this.state.password!==this.state.confirmPassword){var u=this.state.errors.slice();return u.push({title:"Error creating User",message:"The given passwords do not match",type:"danger"}),void this.setState(Rt(Rt({},this.state),{},{errors:u,password:"",confirmPassword:"",isSubmitting:!1}))}this.parent.api.createUser(c,s,l,d).then((function(e){var r=t.state.errors.slice();e.success?(r.push({title:"Success",message:"The user was successfully created.",type:"success"}),t.setState(Rt(Rt({},t.state),{},{errors:r,username:"",email:"",password:"",confirmPassword:"",isSubmitting:!1}))):(r.push({title:"Error creating User",message:e.msg,type:"danger"}),t.setState(Rt(Rt({},t.state),{},{errors:r,password:"",confirmPassword:"",isSubmitting:!1})))}))}}}},{key:"onCheckboxChange",value:function(){this.setState(Rt(Rt({},this.state),{},{sendInvite:!this.state.sendInvite}))}},{key:"onChangeInput",value:function(e){var t=e.target,r=t.value,n=t.name;this.setState(Rt(Rt({},this.state),{},zt({},n,r)))}}])&&Wt(t.prototype,r),a&&Wt(t,a),i}(n.Component);function Jt(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return $t(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $t(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function $t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&en&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(b,"$1"+e.trim());case 58:return e.trim()+t.replace(b,"$1"+e.trim());default:if(0<1*r&&0s.charCodeAt(8))break;case 115:i=i.replace(s,"-webkit-"+s)+";"+i;break;case 207:case 102:i=i.replace(s,"-webkit-"+(102c.charCodeAt(0)&&(c=c.trim()),c=[c],0f)&&(H=(W=W.replace(" ",":")).length),0=4;++n,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(a){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)},xr={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var Mr=/[A-Z]|^ms/g,Lr=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Er=function(e){return 45===e.charCodeAt(1)},Dr=function(e){return null!=e&&"boolean"!=typeof e},Sr=function(e){var t={};return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}((function(e){return Er(e)?e:e.replace(Mr,"-$&").toLowerCase()})),Tr=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Lr,(function(e,t,r){return Yr={name:t,styles:r,next:Yr},t}))}return 1===xr[e]||Er(e)||"number"!=typeof t||0===t?t:t+"px"};function Or(e,t,r,n){if(null==r)return"";if(void 0!==r.__emotion_styles)return r;switch(typeof r){case"boolean":return"";case"object":if(1===r.anim)return Yr={name:r.name,styles:r.styles,next:Yr},r.name;if(void 0!==r.styles){var a=r.next;if(void 0!==a)for(;void 0!==a;)Yr={name:a.name,styles:a.styles,next:Yr},a=a.next;return r.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a-1}function Qr(e){return Xr(e)?window.pageYOffset:e.scrollTop}function Zr(e,t){Xr(e)?window.scrollTo(0,t):e.scrollTop=t}function en(e,t,r,n){void 0===r&&(r=200),void 0===n&&(n=Gr);var a=Qr(e),o=t-a,i=0;!function t(){var c,s=o*((c=(c=i+=10)/r-1)*c*c+1)+a;Zr(e,s),i=f)return{placement:"bottom",maxHeight:t};if(x>=f&&!i)return o&&en(s,M,160),{placement:"bottom",maxHeight:t};if(!i&&x>=n||i&&k>=n)return o&&en(s,M,160),{placement:"bottom",maxHeight:i?k-v:x-v};if("auto"===a||i){var E=t,D=i?w:_;return D>=n&&(E=Math.min(D-v-c.controlHeight,t)),{placement:"top",maxHeight:E}}if("bottom"===a)return Zr(s,M),{placement:"bottom",maxHeight:t};break;case"top":if(w>=f)return{placement:"top",maxHeight:t};if(_>=f&&!i)return o&&en(s,L,160),{placement:"top",maxHeight:t};if(!i&&_>=n||i&&w>=n){var S=t;return(!i&&_>=n||i&&w>=n)&&(S=i?w-y:_-y),o&&en(s,L,160),{placement:"top",maxHeight:S}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'+a+'".')}return l}var sn=function(e){return"auto"===e?"bottom":e},ln=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a=0||(a[r]=e[r]);return a}(e,["size"]);return Br("svg",_n({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:xn},r))},Ln=function(e){return Br(Mn,_n({size:20},e),Br("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},En=function(e){return Br(Mn,_n({size:20},e),Br("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Dn=function(e){var t=e.isFocused,r=e.theme,n=r.spacing.baseUnit,a=r.colors;return{label:"indicatorContainer",color:t?a.neutral60:a.neutral20,display:"flex",padding:2*n,transition:"color 150ms",":hover":{color:t?a.neutral80:a.neutral40}}},Sn=Dn,Tn=Dn,On=function(){var e=jr.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(kn()),Yn=function(e){var t=e.delay,r=e.offset;return Br("span",{css:jr({animation:On+" 1s ease-in-out "+t+"ms infinite;",backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"")})},Cn=function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerProps,o=e.isRtl;return Br("div",_n({},a,{css:n("loadingIndicator",e),className:r({indicator:!0,"loading-indicator":!0},t)}),Br(Yn,{delay:0,offset:o}),Br(Yn,{delay:160,offset:!0}),Br(Yn,{delay:320,offset:!o}))};function Pn(){return(Pn=Object.assign||function(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,["className","cx","getStyles","theme","selectProps"]));return Br("div",jn({css:n("groupHeading",jn({theme:a},o)),className:r({"group-heading":!0},t)},o))},IndicatorsContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles;return Br("div",{css:a("indicatorsContainer",e),className:n({indicators:!0},r)},t)},IndicatorSeparator:function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerProps;return Br("span",_n({},a,{css:n("indicatorSeparator",e),className:r({"indicator-separator":!0},t)}))},Input:function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerRef,o=e.isHidden,i=e.isDisabled,c=e.theme,s=(e.selectProps,function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(e,["className","cx","getStyles","innerRef","isHidden","isDisabled","theme","selectProps"]));return Br("div",{css:n("input",An({theme:c},s))},Br(nn.a,An({className:r({input:!0},t),inputRef:a,inputStyle:Nn(o),disabled:i},s)))},LoadingIndicator:Cn,Menu:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerRef,i=e.innerProps;return Br("div",an({css:a("menu",e),className:n({menu:!0},r)},i,{ref:o}),t)},MenuList:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isMulti,i=e.innerRef;return Br("div",{css:a("menuList",e),className:n({"menu-list":!0,"menu-list--is-multi":o},r),ref:i},t)},MenuPortal:bn,LoadingMessage:mn,NoOptionsMessage:fn,MultiValue:zn,MultiValueContainer:Hn,MultiValueLabel:Rn,MultiValueRemove:function(e){var t=e.children,r=e.innerProps;return Br("div",r,t||Br(Ln,{size:14}))},Option:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isDisabled,i=e.isFocused,c=e.isSelected,s=e.innerRef,l=e.innerProps;return Br("div",Wn({css:a("option",e),className:n({option:!0,"option--is-disabled":o,"option--is-focused":i,"option--is-selected":c},r),ref:s},l),t)},Placeholder:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerProps;return Br("div",Bn({css:a("placeholder",e),className:n({placeholder:!0},r)},o),t)},SelectContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerProps,i=e.isDisabled,c=e.isRtl;return Br("div",wn({css:a("container",e),className:n({"--is-disabled":i,"--is-rtl":c},r)},o),t)},SingleValue:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isDisabled,i=e.innerProps;return Br("div",Un({css:a("singleValue",e),className:n({"single-value":!0,"single-value--is-disabled":o},r)},i),t)},ValueContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.isMulti,o=e.getStyles,i=e.hasValue;return Br("div",{css:o("valueContainer",e),className:n({"value-container":!0,"value-container--is-multi":a,"value-container--has-value":i},r)},t)}},Gn=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}],Jn=function(e){for(var t=0;t=0||(a[r]=e[r]);return a}(e,["in","out","onExited","appear","enter","exit","innerRef","emotion"]));return Br("input",ta({ref:t},r,{css:jr({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"")}))}var na=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a=n.prototype;return a.componentDidMount=function(){this.props.innerRef(Object(o.findDOMNode)(this))},a.componentWillUnmount=function(){this.props.innerRef(null)},a.render=function(){return this.props.children},n}(n.Component),aa=["boxSizing","height","overflow","paddingRight","position"],oa={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ia(e){e.preventDefault()}function ca(e){e.stopPropagation()}function sa(){var e=this.scrollTop,t=this.scrollHeight,r=e+this.offsetHeight;0===e?this.scrollTop=1:r===t&&(this.scrollTop=e-1)}function la(){return"ontouchstart"in window||navigator.maxTouchPoints}var da=!(!window.document||!window.document.createElement),ua=0,pa=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),a=0;a0,m=d-u-l,b=!1;m>r&&t.isBottom&&(o&&o(e),t.isBottom=!1),f&&t.isTop&&(c&&c(e),t.isTop=!1),f&&r>m?(a&&!t.isBottom&&a(e),p.scrollTop=d,b=!0,t.isBottom=!0):!f&&-r>l&&(i&&!t.isTop&&i(e),p.scrollTop=0,b=!0,t.isTop=!0),b&&t.cancelScroll(e)},t.onWheel=function(e){t.handleEventDelta(e,e.deltaY)},t.onTouchStart=function(e){t.touchStart=e.changedTouches[0].clientY},t.onTouchMove=function(e){var r=t.touchStart-e.changedTouches[0].clientY;t.handleEventDelta(e,r)},t.getScrollTarget=function(e){t.scrollTarget=e},t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.componentDidMount=function(){this.startListening(this.scrollTarget)},o.componentWillUnmount=function(){this.stopListening(this.scrollTarget)},o.startListening=function(e){e&&("function"==typeof e.addEventListener&&e.addEventListener("wheel",this.onWheel,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchmove",this.onTouchMove,!1))},o.stopListening=function(e){"function"==typeof e.removeEventListener&&e.removeEventListener("wheel",this.onWheel,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchmove",this.onTouchMove,!1)},o.render=function(){return a.a.createElement(na,{innerRef:this.getScrollTarget},this.props.children)},n}(n.Component);function ha(e){var t=e.isEnabled,r=void 0===t||t,n=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(e,["isEnabled"]);return r?a.a.createElement(ba,n):n.children}var ga=function(e,t){void 0===t&&(t={});var r=t,n=r.isSearchable,a=r.isMulti,o=r.label,i=r.isDisabled;switch(e){case"menu":return"Use Up and Down to choose options"+(i?"":", press Enter to select the currently focused option")+", press Escape to exit the menu, press Tab to select the option and exit the menu.";case"input":return(o||"Select")+" is focused "+(n?",type to refine list":"")+", press Down to open the menu, "+(a?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value"}},va=function(e,t){var r=t.value,n=t.isDisabled;if(r)switch(e){case"deselect-option":case"pop-value":case"remove-value":return"option "+r+", deselected.";case"select-option":return n?"option "+r+" is disabled. Select another option.":"option "+r+", selected."}},ya=function(e){return!!e.isDisabled};var wa={clearIndicator:Tn,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":null,pointerEvents:t?"none":null,position:"relative"}},control:function(e){var t=e.isDisabled,r=e.isFocused,n=e.theme,a=n.colors,o=n.borderRadius,i=n.spacing;return{label:"control",alignItems:"center",backgroundColor:t?a.neutral5:a.neutral0,borderColor:t?a.neutral10:r?a.primary:a.neutral20,borderRadius:o,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px "+a.primary:null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:i.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:r?a.primary:a.neutral30}}},dropdownIndicator:Sn,group:function(e){var t=e.theme.spacing;return{paddingBottom:2*t.baseUnit,paddingTop:2*t.baseUnit}},groupHeading:function(e){var t=e.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:3*t.baseUnit,paddingRight:3*t.baseUnit,textTransform:"uppercase"}},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing.baseUnit,a=r.colors;return{label:"indicatorSeparator",alignSelf:"stretch",backgroundColor:t?a.neutral10:a.neutral20,marginBottom:2*n,marginTop:2*n,width:1}},input:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing,a=r.colors;return{margin:n.baseUnit/2,paddingBottom:n.baseUnit/2,paddingTop:n.baseUnit/2,visibility:t?"hidden":"visible",color:a.neutral80}},loadingIndicator:function(e){var t=e.isFocused,r=e.size,n=e.theme,a=n.colors,o=n.spacing.baseUnit;return{label:"loadingIndicator",color:t?a.neutral60:a.neutral20,display:"flex",padding:2*o,transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"}},loadingMessage:pn,menu:function(e){var t,r=e.placement,n=e.theme,a=n.borderRadius,o=n.spacing,i=n.colors;return(t={label:"menu"})[function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(r)]="100%",t.backgroundColor=i.neutral0,t.borderRadius=a,t.boxShadow="0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",t.marginBottom=o.menuGutter,t.marginTop=o.menuGutter,t.position="absolute",t.width="100%",t.zIndex=1,t},menuList:function(e){var t=e.maxHeight,r=e.theme.spacing.baseUnit;return{maxHeight:t,overflowY:"auto",paddingBottom:r,paddingTop:r,position:"relative",WebkitOverflowScrolling:"touch"}},menuPortal:function(e){var t=e.rect,r=e.offset,n=e.position;return{left:t.left,position:n,top:r,width:t.width,zIndex:1}},multiValue:function(e){var t=e.theme,r=t.spacing,n=t.borderRadius;return{label:"multiValue",backgroundColor:t.colors.neutral10,borderRadius:n/2,display:"flex",margin:r.baseUnit/2,minWidth:0}},multiValueLabel:function(e){var t=e.theme,r=t.borderRadius,n=t.colors,a=e.cropWithEllipsis;return{borderRadius:r/2,color:n.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:a?"ellipsis":null,whiteSpace:"nowrap"}},multiValueRemove:function(e){var t=e.theme,r=t.spacing,n=t.borderRadius,a=t.colors;return{alignItems:"center",borderRadius:n/2,backgroundColor:e.isFocused&&a.dangerLight,display:"flex",paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:a.dangerLight,color:a.danger}}},noOptionsMessage:un,option:function(e){var t=e.isDisabled,r=e.isFocused,n=e.isSelected,a=e.theme,o=a.spacing,i=a.colors;return{label:"option",backgroundColor:n?i.primary:r?i.primary25:"transparent",color:t?i.neutral20:n?i.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:2*o.baseUnit+"px "+3*o.baseUnit+"px",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!t&&(n?i.primary:i.primary50)}}},placeholder:function(e){var t=e.theme,r=t.spacing;return{label:"placeholder",color:t.colors.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}},singleValue:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing,a=r.colors;return{label:"singleValue",color:t?a.neutral40:a.neutral80,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2,maxWidth:"calc(100% - "+2*n.baseUnit+"px)",overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},valueContainer:function(e){var t=e.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:t.baseUnit/2+"px "+2*t.baseUnit+"px",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}}};var ka={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}};function _a(){return(_a=Object.assign||function(e){for(var t=1;t-1},formatGroupLabel:function(e){return e.label},getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:ya,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return t+" result"+(1!==t?"s":"")+" available"},styles:{},tabIndex:"0",tabSelectsValue:!0},Ea=1,Da=function(e){var t,r;function n(t){var r;(r=e.call(this,t)||this).state={ariaLiveSelection:"",ariaLiveContext:"",focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,menuOptions:{render:[],focusable:[]},selectValue:[]},r.blockOptionHover=!1,r.isComposing=!1,r.clearFocusValueOnUpdate=!1,r.commonProps=void 0,r.components=void 0,r.hasGroups=!1,r.initialTouchX=0,r.initialTouchY=0,r.inputIsHiddenAfterUpdate=void 0,r.instancePrefix="",r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(e){r.controlRef=e},r.focusedOptionRef=null,r.getFocusedOptionRef=function(e){r.focusedOptionRef=e},r.menuListRef=null,r.getMenuListRef=function(e){r.menuListRef=e},r.inputRef=null,r.getInputRef=function(e){r.inputRef=e},r.cacheComponents=function(e){r.components=Vn({},qn,{components:e}.components)},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(e,t){var n=r.props;(0,n.onChange)(e,_a({},t,{name:n.name}))},r.setValue=function(e,t,n){void 0===t&&(t="set-value");var a=r.props,o=a.closeMenuOnSelect,i=a.isMulti;r.onInputChange("",{action:"set-value"}),o&&(r.inputIsHiddenAfterUpdate=!i,r.onMenuClose()),r.clearFocusValueOnUpdate=!0,r.onChange(e,{action:t,option:n})},r.selectOption=function(e){var t=r.props,n=t.blurInputOnSelect,a=t.isMulti,o=r.state.selectValue;if(a)if(r.isOptionSelected(e,o)){var i=r.getOptionValue(e);r.setValue(o.filter((function(e){return r.getOptionValue(e)!==i})),"deselect-option",e),r.announceAriaLiveSelection({event:"deselect-option",context:{value:r.getOptionLabel(e)}})}else r.isOptionDisabled(e,o)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue([].concat(o,[e]),"select-option",e),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));else r.isOptionDisabled(e,o)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue(e,"select-option"),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));n&&r.blurInput()},r.removeValue=function(e){var t=r.state.selectValue,n=r.getOptionValue(e),a=t.filter((function(e){return r.getOptionValue(e)!==n}));r.onChange(a.length?a:null,{action:"remove-value",removedValue:e}),r.announceAriaLiveSelection({event:"remove-value",context:{value:e?r.getOptionLabel(e):""}}),r.focusInput()},r.clearValue=function(){var e=r.props.isMulti;r.onChange(e?[]:null,{action:"clear"})},r.popValue=function(){var e=r.state.selectValue,t=e[e.length-1],n=e.slice(0,e.length-1);r.announceAriaLiveSelection({event:"pop-value",context:{value:t?r.getOptionLabel(t):""}}),r.onChange(n.length?n:null,{action:"pop-value",removedValue:t})},r.getOptionLabel=function(e){return r.props.getOptionLabel(e)},r.getOptionValue=function(e){return r.props.getOptionValue(e)},r.getStyles=function(e,t){var n=wa[e](t);n.boxSizing="border-box";var a=r.props.styles[e];return a?a(n,t):n},r.getElementId=function(e){return r.instancePrefix+"-"+e},r.getActiveDescendentId=function(){var e=r.props.menuIsOpen,t=r.state,n=t.menuOptions,a=t.focusedOption;if(a&&e){var o=n.focusable.indexOf(a),i=n.render[o];return i&&i.key}},r.announceAriaLiveSelection=function(e){var t=e.event,n=e.context;r.setState({ariaLiveSelection:va(t,n)})},r.announceAriaLiveContext=function(e){var t=e.event,n=e.context;r.setState({ariaLiveContext:ga(t,_a({},n,{label:r.props["aria-label"]}))})},r.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(e){r.blockOptionHover=!1},r.onControlMouseDown=function(e){var t=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&r.onMenuClose():t&&r.openMenu("first"):(t&&(r.openAfterFocus=!0),r.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()},r.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button||r.props.isDisabled)){var t=r.props,n=t.isMulti,a=t.menuIsOpen;r.focusInput(),a?(r.inputIsHiddenAfterUpdate=!n,r.onMenuClose()):r.openMenu("first"),e.preventDefault(),e.stopPropagation()}},r.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(r.clearValue(),e.stopPropagation(),r.openAfterFocus=!1,"touchend"===e.type?r.focusInput():setTimeout((function(){return r.focusInput()})))},r.onScroll=function(e){"boolean"==typeof r.props.closeMenuOnScroll?e.target instanceof HTMLElement&&Xr(e.target)&&r.props.onMenuClose():"function"==typeof r.props.closeMenuOnScroll&&r.props.closeMenuOnScroll(e)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(e){var t=e.touches.item(0);t&&(r.initialTouchX=t.clientX,r.initialTouchY=t.clientY,r.userIsDragging=!1)},r.onTouchMove=function(e){var t=e.touches.item(0);if(t){var n=Math.abs(t.clientX-r.initialTouchX),a=Math.abs(t.clientY-r.initialTouchY);r.userIsDragging=n>5||a>5}},r.onTouchEnd=function(e){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(e.target)&&r.menuListRef&&!r.menuListRef.contains(e.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(e){r.userIsDragging||r.onControlMouseDown(e)},r.onClearIndicatorTouchEnd=function(e){r.userIsDragging||r.onClearIndicatorMouseDown(e)},r.onDropdownIndicatorTouchEnd=function(e){r.userIsDragging||r.onDropdownIndicatorMouseDown(e)},r.handleInputChange=function(e){var t=e.currentTarget.value;r.inputIsHiddenAfterUpdate=!1,r.onInputChange(t,{action:"input-change"}),r.onMenuOpen()},r.onInputFocus=function(e){var t=r.props,n=t.isSearchable,a=t.isMulti;r.props.onFocus&&r.props.onFocus(e),r.inputIsHiddenAfterUpdate=!1,r.announceAriaLiveContext({event:"input",context:{isSearchable:n,isMulti:a}}),r.setState({isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(e){r.menuListRef&&r.menuListRef.contains(document.activeElement)?r.inputRef.focus():(r.props.onBlur&&r.props.onBlur(e),r.onInputChange("",{action:"input-blur"}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1}))},r.onOptionHover=function(e){r.blockOptionHover||r.state.focusedOption===e||r.setState({focusedOption:e})},r.shouldHideSelectedOptions=function(){var e=r.props,t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},r.onKeyDown=function(e){var t=r.props,n=t.isMulti,a=t.backspaceRemovesValue,o=t.escapeClearsValue,i=t.inputValue,c=t.isClearable,s=t.isDisabled,l=t.menuIsOpen,d=t.onKeyDown,u=t.tabSelectsValue,p=t.openMenuOnFocus,f=r.state,m=f.focusedOption,b=f.focusedValue,h=f.selectValue;if(!(s||"function"==typeof d&&(d(e),e.defaultPrevented))){switch(r.blockOptionHover=!0,e.key){case"ArrowLeft":if(!n||i)return;r.focusValue("previous");break;case"ArrowRight":if(!n||i)return;r.focusValue("next");break;case"Delete":case"Backspace":if(i)return;if(b)r.removeValue(b);else{if(!a)return;n?r.popValue():c&&r.clearValue()}break;case"Tab":if(r.isComposing)return;if(e.shiftKey||!l||!u||!m||p&&r.isOptionSelected(m,h))return;r.selectOption(m);break;case"Enter":if(229===e.keyCode)break;if(l){if(!m)return;if(r.isComposing)return;r.selectOption(m);break}return;case"Escape":l?(r.inputIsHiddenAfterUpdate=!1,r.onInputChange("",{action:"menu-close"}),r.onMenuClose()):c&&o&&r.clearValue();break;case" ":if(i)return;if(!l){r.openMenu("first");break}if(!m)return;r.selectOption(m);break;case"ArrowUp":l?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":l?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!l)return;r.focusOption("pageup");break;case"PageDown":if(!l)return;r.focusOption("pagedown");break;case"Home":if(!l)return;r.focusOption("first");break;case"End":if(!l)return;r.focusOption("last");break;default:return}e.preventDefault()}},r.buildMenuOptions=function(e,t){var n=e.inputValue,a=void 0===n?"":n,o=e.options,i=function(e,n){var o=r.isOptionDisabled(e,t),i=r.isOptionSelected(e,t),c=r.getOptionLabel(e),s=r.getOptionValue(e);if(!(r.shouldHideSelectedOptions()&&i||!r.filterOption({label:c,value:s,data:e},a))){var l=o?void 0:function(){return r.onOptionHover(e)},d=o?void 0:function(){return r.selectOption(e)},u=r.getElementId("option")+"-"+n;return{innerProps:{id:u,onClick:d,onMouseMove:l,onMouseOver:l,tabIndex:-1},data:e,isDisabled:o,isSelected:i,key:u,label:c,type:"option",value:s}}};return o.reduce((function(e,t,n){if(t.options){r.hasGroups||(r.hasGroups=!0);var a=t.options.map((function(t,r){var a=i(t,n+"-"+r);return a&&e.focusable.push(t),a})).filter(Boolean);if(a.length){var o=r.getElementId("group")+"-"+n;e.render.push({type:"group",key:o,data:t,options:a})}}else{var c=i(t,""+n);c&&(e.render.push(c),e.focusable.push(t))}return e}),{render:[],focusable:[]})};var n=t.value;r.cacheComponents=ur(r.cacheComponents,yn).bind(xa(xa(r))),r.cacheComponents(t.components),r.instancePrefix="react-select-"+(r.props.instanceId||++Ea);var a=Kr(n);r.buildMenuOptions=ur(r.buildMenuOptions,(function(e,t){var r=e,n=r[0],a=r[1],o=t,i=o[0];return yn(a,o[1])&&yn(n.inputValue,i.inputValue)&&yn(n.options,i.options)})).bind(xa(xa(r)));var o=t.menuIsOpen?r.buildMenuOptions(t,a):{render:[],focusable:[]};return r.state.menuOptions=o,r.state.selectValue=a,r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.componentDidMount=function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()},o.UNSAFE_componentWillReceiveProps=function(e){var t=this.props,r=t.options,n=t.value,a=t.menuIsOpen,o=t.inputValue;if(this.cacheComponents(e.components),e.value!==n||e.options!==r||e.menuIsOpen!==a||e.inputValue!==o){var i=Kr(e.value),c=e.menuIsOpen?this.buildMenuOptions(e,i):{render:[],focusable:[]},s=this.getNextFocusedValue(i),l=this.getNextFocusedOption(c.focusable);this.setState({menuOptions:c,selectValue:i,focusedOption:l,focusedValue:s})}null!=this.inputIsHiddenAfterUpdate&&(this.setState({inputIsHidden:this.inputIsHiddenAfterUpdate}),delete this.inputIsHiddenAfterUpdate)},o.componentDidUpdate=function(e){var t,r,n,a,o,i=this.props,c=i.isDisabled,s=i.menuIsOpen,l=this.state.isFocused;(l&&!c&&e.isDisabled||l&&s&&!e.menuIsOpen)&&this.focusInput(),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(t=this.menuListRef,r=this.focusedOptionRef,n=t.getBoundingClientRect(),a=r.getBoundingClientRect(),o=r.offsetHeight/3,a.bottom+o>n.bottom?Zr(t,Math.min(r.offsetTop+r.clientHeight-t.offsetHeight+o,t.scrollHeight)):a.top-o-1&&(c=s)}this.scrollToFocusedOptionOnUpdate=!(a&&this.menuListRef),this.inputIsHiddenAfterUpdate=!1,this.setState({menuOptions:o,focusedValue:null,focusedOption:o.focusable[c]},(function(){t.onMenuOpen(),t.announceAriaLiveContext({event:"menu"})}))},o.focusValue=function(e){var t=this.props,r=t.isMulti,n=t.isSearchable,a=this.state,o=a.selectValue,i=a.focusedValue;if(r){this.setState({focusedOption:null});var c=o.indexOf(i);i||(c=-1,this.announceAriaLiveContext({event:"value"}));var s=o.length-1,l=-1;if(o.length){switch(e){case"previous":l=0===c?0:-1===c?s:c-1;break;case"next":c>-1&&c0?i-1:a.length-1:"down"===e?o=(i+1)%a.length:"pageup"===e?(o=i-t)<0&&(o=0):"pagedown"===e?(o=i+t)>a.length-1&&(o=a.length-1):"last"===e&&(o=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[o],focusedValue:null}),this.announceAriaLiveContext({event:"menu",context:{isDisabled:ya(a[o])}})}},o.getTheme=function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(ka):_a({},ka,this.props.theme):ka},o.getCommonProps=function(){var e=this.clearValue,t=this.getStyles,r=this.setValue,n=this.selectOption,a=this.props,o=a.classNamePrefix,i=a.isMulti,c=a.isRtl,s=a.options,l=this.state.selectValue,d=this.hasValue();return{cx:$r.bind(null,o),clearValue:e,getStyles:t,getValue:function(){return l},hasValue:d,isMulti:i,isRtl:c,options:s,selectOption:n,setValue:r,selectProps:a,theme:this.getTheme()}},o.getNextFocusedValue=function(e){if(this.clearFocusValueOnUpdate)return this.clearFocusValueOnUpdate=!1,null;var t=this.state,r=t.focusedValue,n=t.selectValue.indexOf(r);if(n>-1){if(e.indexOf(r)>-1)return r;if(n-1?t:e[0]},o.hasValue=function(){return this.state.selectValue.length>0},o.hasOptions=function(){return!!this.state.menuOptions.render.length},o.countOptions=function(){return this.state.menuOptions.focusable.length},o.isClearable=function(){var e=this.props,t=e.isClearable,r=e.isMulti;return void 0===t?r:t},o.isOptionDisabled=function(e,t){return"function"==typeof this.props.isOptionDisabled&&this.props.isOptionDisabled(e,t)},o.isOptionSelected=function(e,t){var r=this;if(t.indexOf(e)>-1)return!0;if("function"==typeof this.props.isOptionSelected)return this.props.isOptionSelected(e,t);var n=this.getOptionValue(e);return t.some((function(e){return r.getOptionValue(e)===n}))},o.filterOption=function(e,t){return!this.props.filterOption||this.props.filterOption(e,t)},o.formatOptionLabel=function(e,t){if("function"==typeof this.props.formatOptionLabel){var r=this.props.inputValue,n=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:r,selectValue:n})}return this.getOptionLabel(e)},o.formatGroupLabel=function(e){return this.props.formatGroupLabel(e)},o.startListeningComposition=function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))},o.stopListeningComposition=function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))},o.startListeningToTouch=function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))},o.stopListeningToTouch=function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))},o.constructAriaLiveMessage=function(){var e=this.state,t=e.ariaLiveContext,r=e.selectValue,n=e.focusedValue,a=e.focusedOption,o=this.props,i=o.options,c=o.menuIsOpen,s=o.inputValue,l=o.screenReaderStatus;return(n?function(e){var t=e.focusedValue,r=e.getOptionLabel,n=e.selectValue;return"value "+r(t)+" focused, "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedValue:n,getOptionLabel:this.getOptionLabel,selectValue:r}):"")+" "+(a&&c?function(e){var t=e.focusedOption,r=e.getOptionLabel,n=e.options;return"option "+r(t)+" focused"+(t.isDisabled?" disabled":"")+", "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedOption:a,getOptionLabel:this.getOptionLabel,options:i}):"")+" "+function(e){var t=e.inputValue;return e.screenReaderMessage+(t?" for search term "+t:"")+"."}({inputValue:s,screenReaderMessage:l({count:this.countOptions()})})+" "+t},o.renderInput=function(){var e=this.props,t=e.isDisabled,r=e.isSearchable,n=e.inputId,o=e.inputValue,i=e.tabIndex,c=this.components.Input,s=this.state.inputIsHidden,l=n||this.getElementId("input"),d={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};if(!r)return a.a.createElement(ra,_a({id:l,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Gr,onFocus:this.onInputFocus,readOnly:!0,disabled:t,tabIndex:i,value:""},d));var u=this.commonProps,p=u.cx,f=u.theme,m=u.selectProps;return a.a.createElement(c,_a({autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",cx:p,getStyles:this.getStyles,id:l,innerRef:this.getInputRef,isDisabled:t,isHidden:s,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,selectProps:m,spellCheck:"false",tabIndex:i,theme:f,type:"text",value:o},d))},o.renderPlaceholderOrValue=function(){var e=this,t=this.components,r=t.MultiValue,n=t.MultiValueContainer,o=t.MultiValueLabel,i=t.MultiValueRemove,c=t.SingleValue,s=t.Placeholder,l=this.commonProps,d=this.props,u=d.controlShouldRenderValue,p=d.isDisabled,f=d.isMulti,m=d.inputValue,b=d.placeholder,h=this.state,g=h.selectValue,v=h.focusedValue,y=h.isFocused;if(!this.hasValue()||!u)return m?null:a.a.createElement(s,_a({},l,{key:"placeholder",isDisabled:p,isFocused:y}),b);if(f)return g.map((function(t,c){var s=t===v;return a.a.createElement(r,_a({},l,{components:{Container:n,Label:o,Remove:i},isFocused:s,isDisabled:p,key:e.getOptionValue(t),index:c,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault(),e.stopPropagation()}},data:t}),e.formatOptionLabel(t,"value"))}));if(m)return null;var w=g[0];return a.a.createElement(c,_a({},l,{data:w,isDisabled:p}),this.formatOptionLabel(w,"value"))},o.renderClearIndicator=function(){var e=this.components.ClearIndicator,t=this.commonProps,r=this.props,n=r.isDisabled,o=r.isLoading,i=this.state.isFocused;if(!this.isClearable()||!e||n||!this.hasValue()||o)return null;var c={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return a.a.createElement(e,_a({},t,{innerProps:c,isFocused:i}))},o.renderLoadingIndicator=function(){var e=this.components.LoadingIndicator,t=this.commonProps,r=this.props,n=r.isDisabled,o=r.isLoading,i=this.state.isFocused;if(!e||!o)return null;return a.a.createElement(e,_a({},t,{innerProps:{"aria-hidden":"true"},isDisabled:n,isFocused:i}))},o.renderIndicatorSeparator=function(){var e=this.components,t=e.DropdownIndicator,r=e.IndicatorSeparator;if(!t||!r)return null;var n=this.commonProps,o=this.props.isDisabled,i=this.state.isFocused;return a.a.createElement(r,_a({},n,{isDisabled:o,isFocused:i}))},o.renderDropdownIndicator=function(){var e=this.components.DropdownIndicator;if(!e)return null;var t=this.commonProps,r=this.props.isDisabled,n=this.state.isFocused,o={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return a.a.createElement(e,_a({},t,{innerProps:o,isDisabled:r,isFocused:n}))},o.renderMenu=function(){var e=this,t=this.components,r=t.Group,n=t.GroupHeading,o=t.Menu,i=t.MenuList,c=t.MenuPortal,s=t.LoadingMessage,l=t.NoOptionsMessage,d=t.Option,u=this.commonProps,p=this.state,f=p.focusedOption,m=p.menuOptions,b=this.props,h=b.captureMenuScroll,g=b.inputValue,v=b.isLoading,y=b.loadingMessage,w=b.minMenuHeight,k=b.maxMenuHeight,_=b.menuIsOpen,x=b.menuPlacement,M=b.menuPosition,L=b.menuPortalTarget,E=b.menuShouldBlockScroll,D=b.menuShouldScrollIntoView,S=b.noOptionsMessage,T=b.onMenuScrollToTop,O=b.onMenuScrollToBottom;if(!_)return null;var Y,C=function(t){var r=f===t.data;return t.innerRef=r?e.getFocusedOptionRef:void 0,a.a.createElement(d,_a({},u,t,{isFocused:r}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())Y=m.render.map((function(t){if("group"===t.type){t.type;var o=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(t,["type"]),i=t.key+"-heading";return a.a.createElement(r,_a({},u,o,{Heading:n,headingProps:{id:i},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return C(e)})))}if("option"===t.type)return C(t)}));else if(v){var P=y({inputValue:g});if(null===P)return null;Y=a.a.createElement(s,u,P)}else{var j=S({inputValue:g});if(null===j)return null;Y=a.a.createElement(l,u,j)}var A={minMenuHeight:w,maxMenuHeight:k,menuPlacement:x,menuPosition:M,menuShouldScrollIntoView:D},N=a.a.createElement(ln,_a({},u,A),(function(t){var r=t.ref,n=t.placerProps,c=n.placement,s=n.maxHeight;return a.a.createElement(o,_a({},u,A,{innerRef:r,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:v,placement:c}),a.a.createElement(ha,{isEnabled:h,onTopArrive:T,onBottomArrive:O},a.a.createElement(ma,{isEnabled:E},a.a.createElement(i,_a({},u,{innerRef:e.getMenuListRef,isLoading:v,maxHeight:s}),Y))))}));return L||"fixed"===M?a.a.createElement(c,_a({},u,{appendTo:L,controlElement:this.controlRef,menuPlacement:x,menuPosition:M}),N):N},o.renderFormField=function(){var e=this,t=this.props,r=t.delimiter,n=t.isDisabled,o=t.isMulti,i=t.name,c=this.state.selectValue;if(i&&!n){if(o){if(r){var s=c.map((function(t){return e.getOptionValue(t)})).join(r);return a.a.createElement("input",{name:i,type:"hidden",value:s})}var l=c.length>0?c.map((function(t,r){return a.a.createElement("input",{key:"i-"+r,name:i,type:"hidden",value:e.getOptionValue(t)})})):a.a.createElement("input",{name:i,type:"hidden"});return a.a.createElement("div",null,l)}var d=c[0]?this.getOptionValue(c[0]):"";return a.a.createElement("input",{name:i,type:"hidden",value:d})}},o.renderLiveRegion=function(){return this.state.isFocused?a.a.createElement(ea,{"aria-live":"polite"},a.a.createElement("p",{id:"aria-selection-event"}," ",this.state.ariaLiveSelection),a.a.createElement("p",{id:"aria-context"}," ",this.constructAriaLiveMessage())):null},o.render=function(){var e=this.components,t=e.Control,r=e.IndicatorsContainer,n=e.SelectContainer,o=e.ValueContainer,i=this.props,c=i.className,s=i.id,l=i.isDisabled,d=i.menuIsOpen,u=this.state.isFocused,p=this.commonProps=this.getCommonProps();return a.a.createElement(n,_a({},p,{className:c,innerProps:{id:s,onKeyDown:this.onKeyDown},isDisabled:l,isFocused:u}),this.renderLiveRegion(),a.a.createElement(t,_a({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:l,isFocused:u,menuIsOpen:d}),a.a.createElement(o,_a({},p,{isDisabled:l}),this.renderPlaceholderOrValue(),this.renderInput()),a.a.createElement(r,_a({},p,{isDisabled:l}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())},n}(n.Component);function Sa(){return(Sa=Object.assign||function(e){for(var t=1;t1?r-1:0),a=1;a=0||(a[r]=e[r]);return a}(t,["defaultInputValue","defaultMenuIsOpen","defaultValue"]));return a.a.createElement(Oa,Sa({},r,{ref:function(t){e.select=t},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))},n}(n.Component),Ya.defaultProps=Ta,Ca);function ja(){return(ja=Object.assign||function(e){for(var t=1;t=0&&e=this.state.routes.length)){var n=this.state.routes.slice();n[e][t]=r,this.setState(Na(Na({},this.state),{},{routes:n}))}}},{key:"removeRoute",value:function(e){if(!(e<0||e>=this.state.routes.length)){var t=this.state.routes.slice();t.splice(e,1),this.setState(Na(Na({},this.state),{},{routes:t}))}}},{key:"onAddRoute",value:function(){var e=this.state.routes.slice();e.push({request:"",action:"dynamic",target:"",extra:"",active:1,exact:1}),this.setState(Na(Na({},this.state),{},{routes:e}))}},{key:"changeAction",value:function(e,t){this.changeRoute(e,"action",t)}},{key:"changeActive",value:function(e,t){this.changeRoute(e,"active",t.target.checked?1:0)}},{key:"changeExact",value:function(e,t){this.changeRoute(e,"exact",t.target.checked?1:0)}},{key:"changeRequest",value:function(e,t){this.changeRoute(e,"request",t.target.value)}},{key:"changeTarget",value:function(e,t){this.changeRoute(e,"target",t.target.value)}},{key:"changeExtra",value:function(e,t){this.changeRoute(e,"extra",t.target.value)}},{key:"fetchRoutes",value:function(){var e=this;this.parent.api.getRoutes().then((function(t){if(t.success)e.setState(Na(Na({},e.state),{},{routes:t.routes,isResetting:!1})),ut.rebuild();else{var r=e.state.errors.slice();r.push({title:"Error fetching routes",message:t.msg}),e.setState(Na(Na({},e.state),{},{errors:r,isResetting:!1}))}}))}}])&&Ha(t.prototype,r),a&&Ha(t,a),i}(n.Component);function Va(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qa(e,t)}(e,t)||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 qa(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&e0?this.state.user.password:null,i=Object.keys(this.state.user.groups),c=this.state.user.confirmed;this.setState(Qa(Qa({},this.state),{},{isSaving:!0})),this.parent.api.editUser(r,n,a,o,i,c).then((function(e){var r=t.state.alerts.slice();e.success?(r.push({title:"Success",message:"User was successfully updated.",type:"success"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})}))):(r.push({title:"Error updating user",message:e.msg,type:"danger"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})})))}))}},{key:"onDeleteUser",value:function(e){var t=this;e.preventDefault(),e.stopPropagation();var r=this.props.match.params.userId;this.parent.showDialog("Are you sure you want to delete this user permanently?","Delete User?",["Yes","No"],(function(e){"Yes"===e&&t.parent.api.deleteUser(r).then((function(e){if(e.success)t.props.history.push("/admin/users");else{var r=t.state.alerts.slice();r.push({title:"Error deleting user",message:e.msg,type:"danger"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})}))}}))}))}},{key:"onRemoveGroup",value:function(e,t){if(e.stopPropagation(),this.state.user.groups.hasOwnProperty(t)){var r=Qa({},this.state.user.groups);delete r[t],this.setState(Qa(Qa({},this.state),{},{user:Qa(Qa({},this.state.user),{},{groups:r})}))}}},{key:"onAddGroup",value:function(e,t){if(e.stopPropagation(),!this.state.user.groups.hasOwnProperty(t)){var r=Qa(Qa({},this.state.user.groups),{},Za({},t,Qa({},this.state.groups[t])));this.setState(Qa(Qa({},this.state),{},{user:Qa(Qa({},this.state.user),{},{groups:r}),searchActive:!1,searchString:""}))}}},{key:"render",value:function(){var e=this;if(!this.state.loaded)return n.createElement("h2",{className:"text-center"},"Loading…",n.createElement("br",null),n.createElement(m,{icon:"spinner",className:"mt-3 text-muted fa-2x"}));var t=[],r=null;if(this.state.fetchError)t.push(n.createElement(Le,{key:"error-fetch",title:"Error fetching data",type:"danger",message:n.createElement("div",null,this.state.fetchError,n.createElement("br",null),"You can meanwhile return to the ",n.createElement(be,{to:"/admin/users"},"user overview"))}));else{for(var a=function(r){t.push(n.createElement(Le,Ka({key:"error-"+r,onClose:function(){return e.removeAlert(r)}},e.state.alerts[r])))},o=0;o0||this.state.searchActive?"block":"none";c.length>0&&(d=.75+.75*this.state.searchString.length+"em",u=""),this.state.searchString.length>0&&0===i.length&&i.push(n.createElement("li",{className:"select2-results__option",role:"option",key:"group-notfound","aria-selected":!0},"Group not found")),r=n.createElement("form",{role:"form",onSubmit:function(e){return e.preventDefault()}},n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"username"},"Username"),n.createElement("input",{type:"text",className:"form-control",placeholder:"Enter username",name:"username",id:"username",maxLength:32,value:this.state.user.name,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"email"},"E-Mail"),n.createElement("input",{type:"email",className:"form-control",placeholder:"E-Mail address",id:"email",name:"email",maxLength:64,value:this.state.user.email,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"password"},"Password"),n.createElement("input",{type:"password",className:"form-control",placeholder:"(unchanged)",id:"password",name:"password",value:this.state.user.password,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group position-relative"},n.createElement("label",null,"Groups"),n.createElement("span",{className:"select2 select2-container select2-container--default select2-container--below",dir:"ltr",style:{width:"100%"}},n.createElement("span",{className:"selection"},n.createElement("span",{className:"select2-selection select2-selection--multiple",role:"combobox","aria-haspopup":"true","aria-expanded":!1,"aria-disabled":!1,onClick:this.onToggleSearch.bind(this)},n.createElement("ul",{className:"select2-selection__rendered"},c,n.createElement("li",{className:"select2-search select2-search--inline"},n.createElement("input",{className:"select2-search__field",type:"search",tabIndex:0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,role:"searchbox","aria-autocomplete":"list",placeholder:u,name:"search",style:{width:d},value:this.state.searchString,onChange:this.onChangeInput.bind(this),ref:this.searchBox}))))),n.createElement("span",{className:"dropdown-wrapper","aria-hidden":"true"})),n.createElement("span",{className:"select2-container select2-container--default select2-container--open",style:{position:"absolute",bottom:0,left:0,width:"100%",display:p}},n.createElement("span",{className:"select2-dropdown select2-dropdown--below",dir:"ltr"},n.createElement("span",{className:"select2-results"},n.createElement("ul",{className:"select2-results__options",role:"listbox","aria-multiselectable":!0,"aria-expanded":!0,"aria-hidden":!1},i))))),n.createElement("div",{className:"form-check"},n.createElement("input",{type:"checkbox",className:"form-check-input",onChange:this.onChangeInput.bind(this),id:"confirmed",name:"confirmed",checked:this.state.user.confirmed}),n.createElement("label",{className:"form-check-label",htmlFor:"confirmed"},"Confirmed")),n.createElement(be,{to:"/admin/users",className:"btn btn-info mt-2 mr-2"},n.createElement(m,{icon:"arrow-left"})," Back"),this.state.isSaving?n.createElement("button",{type:"submit",className:"btn btn-primary mt-2 mr-2",disabled:!0},"Saving… ",n.createElement(m,{icon:"circle-notch"})):n.createElement("button",{type:"submit",className:"btn btn-primary mt-2 mr-2",onClick:this.onSubmitForm.bind(this)},"Save"),this.state.isDeleting?n.createElement("button",{type:"submit",className:"btn btn-danger mt-2",disabled:!0},"Deleting… ",n.createElement(m,{icon:"circle-notch"})):n.createElement("button",{type:"submit",className:"btn btn-danger mt-2",onClick:this.onDeleteUser.bind(this)},"Delete"))}return n.createElement(n.Fragment,null,n.createElement("div",{className:"content-header"},n.createElement("div",{className:"container-fluid"},n.createElement("div",{className:"row mb-2"},n.createElement("div",{className:"col-sm-6"},n.createElement("h1",{className:"m-0 text-dark"},"Edit User")),n.createElement("div",{className:"col-sm-6"},n.createElement("ol",{className:"breadcrumb float-sm-right"},n.createElement("li",{className:"breadcrumb-item"},n.createElement(be,{to:"/admin/dashboard"},"Home")),n.createElement("li",{className:"breadcrumb-item"},n.createElement(be,{to:"/admin/users"},"Users")),n.createElement("li",{className:"breadcrumb-item active"},"Add User")))))),n.createElement("div",{className:"content"},n.createElement("div",{className:"row"},n.createElement("div",{className:"col-lg-6 pl-5 pr-5"},t,r))))}}])&&eo(t.prototype,r),a&&eo(t,a),i}(n.Component),io=(r(732),r(414)),co=r.n(io);function so(e){return(so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lo(){return(lo=Object.assign||function(e){for(var t=1;t=0&&e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function _o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=this.state.uncategorised.settings.length)){var t=this.state.uncategorised.settings.slice();t.splice(e,1),this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:t})}))}}},{key:"onChangeUncategorisedValue",value:function(e,t,r){if(!(t<0||t>=this.state.uncategorised.settings.length)){var n=this.state.uncategorised.settings.slice();r?n[t].key=e.target.value:n[t].value=e.target.value,this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:n})}))}}},{key:"onAddUncategorisedProperty",value:function(){var e=this.state.uncategorised.settings.slice();e.push({key:"",value:""}),this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:e})}))}},{key:"componentDidMount",value:function(){var e=this;this.parent.api.getSettings().then((function(t){if(t.success){var r=Lo(Lo({},e.state),{},{settings:t.settings,uncategorised:Lo(Lo({},e.state.uncategorised),{},{settings:e.getUncategorisedValues(t)})});e.setState(r)}else{var n=e.state.errors.slice();n.push({title:"Error fetching settings",message:t.msg}),e.setState(Lo(Lo({},e.state),{},{errors:n}))}}))}},{key:"removeError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){if(e>=0&&e=0&&e=0&&e=this.state.permissions.length)){var r=e.target.value,n=this.state.permissions.slice();n[t].method=r,this.setState(No(No({},this.state),{},{permissions:n}))}}},{key:"render",value:function(){for(var e=this,t=[],r=function(r){t.push(n.createElement(Le,jo({key:"error-"+r,onClose:function(){return e.removeAlert(r)}},e.state.alerts[r])))},a=0;a=this.state.permissions.length)){var t=this.state.permissions.slice();t.splice(e,1),this.setState(No(No({},this.state),{},{permissions:t}))}}},{key:"onChangePermission",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!(t<0||t>=this.state.permissions.length)){var n=e.target.checked,a=this.state.permissions.slice();if(null===r){if(!n)return;a[t].groups=[]}else if(n&&!a[t].groups.includes(r))a[t].groups.push(r);else{if(n)return;var o=a[t].groups.indexOf(r);if(-1===o)return;a[t].groups.splice(o,1)}this.setState(No(No({},this.state),{},{permissions:a}))}}}])&&Io(t.prototype,r),a&&Io(t,a),i}(n.Component),Uo=r(420),Vo=r.n(Uo);r(788);function qo(e){return(qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Go(){return(Go=Object.assign||function(e){for(var t=1;t=0&&e0&&void 0!==arguments[0]?arguments[0]:[];for(var t in this.state.visitors)if(this.state.visitors.hasOwnProperty(t)){var r=t.split("/"),n=parseInt(this.state.visitors[t]);if("weekly"===this.state.type){var a=h()(t).day();a>=0&&a<7&&(e[a]=n)}else if("monthly"===this.state.type){var o=parseInt(r[2])-1;o>=0&&o=0&&i<12&&(e[i]=n)}}}},{key:"handleChange",value:function(e){this.fetchData(this.state.type,e)}},{key:"render",value:function(){for(var e=this,t=[],r=function(r){t.push(n.createElement(Le,Go({key:"error-"+r,onClose:function(){return e.removeError(r)}},e.state.alerts[r])))},a=0;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function di(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:["Close"],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a={show:!0,message:e,title:t,options:r,onOption:n};this.setState(pi(pi({},this.state),{},{dialog:pi(pi({},this.state.dialog),a)}))}},{key:"hideDialog",value:function(){this.setState(pi(pi({},this.state),{},{dialog:pi(pi({},this.state.dialog),{},{show:!1})}))}},{key:"fetchNotifications",value:function(){var e=this;this.api.getNotifications().then((function(t){t.success?e.setState(pi(pi({},e.state),{},{notifications:t.notifications})):e.showDialog("Error fetching notifications: "+t.msg,"Error fetching notifications")}))}},{key:"fetchContactRequests",value:function(){var e=this;this.api.fetchContactRequests().then((function(t){t.success?e.setState(pi(pi({},e.state),{},{contactRequests:t.contactRequests})):e.showDialog("Error fetching contact requests: "+t.msg,"Error fetching contact requests")}))}},{key:"fetchFilesPath",value:function(){var e=this;this.api.getRoutes().then((function(t){if(t.success){var r,n=li(t.routes);try{for(n.s();!(r=n.n()).done;){var a=r.value;if("\\Documents\\Files"===a.target){var o=a.request;o=(o=(o=(o=o.replace(/\(.*\)([?*])/g,"")).replace(/.\*/g,"")).replace(/\[.*]\*/g,"")).replace(/(.*)\+/g,"$1"),e.setState(pi(pi({},e.state),{},{filesPath:o}));break}}}catch(e){n.e(e)}finally{n.f()}}else e.showDialog("Error fetching routes: "+t.msg,"Error fetching routes")}))}},{key:"componentDidMount",value:function(){var e=this;this.api.fetchUser().then((function(t){t?(e.fetchNotifications(),e.fetchFilesPath(),e.fetchContactRequests(),setInterval(e.onUpdate.bind(e),6e4),e.setState(pi(pi({},e.state),{},{loaded:!0}))):document.location="/admin"}))}},{key:"render",value:function(){var e=this;return this.state.loaded?(this.controlObj={showDialog:this.showDialog.bind(this),fetchNotifications:this.fetchNotifications.bind(this),api:this.api},a.a.createElement(le,null,a.a.createElement(ke,si({},this.controlObj,{notifications:this.state.notifications})),a.a.createElement(Me,si({},this.controlObj,{notifications:this.state.notifications,contactRequests:this.state.contactRequests,filesPath:this.state.filesPath})),a.a.createElement("div",{className:"content-wrapper p-2"},a.a.createElement("section",{className:"content"},a.a.createElement(ie,null,a.a.createElement(ee,{path:"/admin/dashboard"},a.a.createElement(At,si({},this.controlObj,{notifications:this.state.notifications}))),a.a.createElement(ee,{exact:!0,path:"/admin/users"},a.a.createElement(_t,this.controlObj)),a.a.createElement(ee,{path:"/admin/user/add"},a.a.createElement(Gt,this.controlObj)),a.a.createElement(ee,{path:"/admin/user/edit/:userId",render:function(t){var r=pi(pi({},t),e.controlObj);return a.a.createElement(oo,r)}}),a.a.createElement(ee,{path:"/admin/user/permissions"},a.a.createElement(Bo,this.controlObj)),a.a.createElement(ee,{path:"/admin/group/add"},a.a.createElement(yo,this.controlObj)),a.a.createElement(ee,{exact:!0,path:"/admin/contact/"},a.a.createElement(ii,this.controlObj)),a.a.createElement(ee,{path:"/admin/visitors"},a.a.createElement(ri,this.controlObj)),a.a.createElement(ee,{path:"/admin/logs"},a.a.createElement(lr,si({},this.controlObj,{notifications:this.state.notifications}))),a.a.createElement(ee,{path:"/admin/settings"},a.a.createElement(Co,this.controlObj)),a.a.createElement(ee,{path:"/admin/pages"},a.a.createElement(Ua,this.controlObj)),a.a.createElement(ee,{path:"/admin/help"},a.a.createElement(Ga,this.controlObj)),a.a.createElement(ee,{path:"*"},a.a.createElement(Xt,null))),a.a.createElement(Kt,this.state.dialog))),a.a.createElement(Ja,null))):a.a.createElement("b",null,"Loading… ",a.a.createElement(m,{icon:"spinner"}))}}])&&mi(t.prototype,r),n&&mi(t,n),i}(a.a.Component);i.a.render(a.a.createElement(yi,null),document.getElementById("root"))},function(e,t,r){"use strict";r.r(t);var n=r(44),a=r.n(n),o=r(0),i=r.n(o),c=r(1),s=r.n(c),l=r(11),d=r.n(l),u=r(415),p=r.n(u);function f(e,t){for(var r=t;r;){if(r===e)return!0;r=r.parentNode}return!1}var m,b=r(88),h=r.n(b),g=r(30),v=r.n(g),y=r(31),w=r.n(y),k=r(23),_=r.n(k),x=r(32),M=r.n(x);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var S={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function T(){if(void 0!==m)return m;m="";var e=document.createElement("p").style;for(var t in S)t+"Transform"in e&&(m=t);return m}function O(){return T()?"".concat(T(),"TransitionProperty"):"transitionProperty"}function Y(){return T()?"".concat(T(),"Transform"):"transform"}function C(e,t){var r=O();r&&(e.style[r]=t,"transitionProperty"!==r&&(e.style.transitionProperty=t))}function P(e,t){var r=Y();r&&(e.style[r]=t,"transform"!==r&&(e.style.transform=t))}var j,A=/matrix\((.*)\)/,N=/matrix3d\((.*)\)/;function F(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function I(e,t,r){var n=r;if("object"!==L(t))return void 0!==n?("number"==typeof n&&(n="".concat(n,"px")),void(e.style[t]=n)):j(e,t);for(var a in t)t.hasOwnProperty(a)&&I(e,a,t[a])}function H(e,t){var r=e["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if("number"!=typeof r){var a=e.document;"number"!=typeof(r=a.documentElement[n])&&(r=a.body[n])}return r}function R(e){return H(e)}function z(e){return H(e,!0)}function W(e){var t=function(e){var t,r,n,a=e.ownerDocument,o=a.body,i=a&&a.documentElement;return r=(t=e.getBoundingClientRect()).left,n=t.top,{left:r-=i.clientLeft||o.clientLeft||0,top:n-=i.clientTop||o.clientTop||0}}(e),r=e.ownerDocument,n=r.defaultView||r.parentWindow;return t.left+=R(n),t.top+=z(n),t}function B(e){return null!=e&&e==e.window}function U(e){return B(e)?e.document:9===e.nodeType?e:e.ownerDocument}var V=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),q=/^(top|right|bottom|left)$/,G="left";function J(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function $(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function K(e,t,r){"static"===I(e,"position")&&(e.style.position="relative");var n=-999,a=-999,o=J("left",r),i=J("top",r),c=$(o),s=$(i);"left"!==o&&(n=999),"top"!==i&&(a=999);var l,d="",u=W(e);("left"in t||"top"in t)&&(d=(l=e).style.transitionProperty||l.style[O()]||"",C(e,"none")),"left"in t&&(e.style[c]="",e.style[o]="".concat(n,"px")),"top"in t&&(e.style[s]="",e.style[i]="".concat(a,"px")),F(e);var p=W(e),f={};for(var m in t)if(t.hasOwnProperty(m)){var b=J(m,r),h="left"===m?n:a,g=u[m]-p[m];f[b]=b===m?h+g:h-g}I(e,f),F(e),("left"in t||"top"in t)&&C(e,d);var v={};for(var y in t)if(t.hasOwnProperty(y)){var w=J(y,r),k=t[y]-u[y];v[w]=y===w?f[w]+k:f[w]-k}I(e,v)}function X(e,t){var r=W(e),n=function(e){var t=window.getComputedStyle(e,null),r=t.getPropertyValue("transform")||t.getPropertyValue(Y());if(r&&"none"!==r){var n=r.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(n[12]||n[4],0),y:parseFloat(n[13]||n[5],0)}}return{x:0,y:0}}(e),a={x:n.x,y:n.y};"left"in t&&(a.x=n.x+t.left-r.left),"top"in t&&(a.y=n.y+t.top-r.top),function(e,t){var r=window.getComputedStyle(e,null),n=r.getPropertyValue("transform")||r.getPropertyValue(Y());if(n&&"none"!==n){var a,o=n.match(A);if(o)(a=(o=o[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,a[5]=t.y,P(e,"matrix(".concat(a.join(","),")"));else(a=n.match(N)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,a[13]=t.y,P(e,"matrix3d(".concat(a.join(","),")"))}else P(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,a)}function Q(e,t){for(var r=0;r=0&&r.left>=0&&r.bottom>r.top&&r.right>r.left?r:null}function fe(e){var t,r,n;if(se.isWindow(e)||9===e.nodeType){var a=se.getWindow(e);t={left:se.getWindowScrollLeft(a),top:se.getWindowScrollTop(a)},r=se.viewportWidth(a),n=se.viewportHeight(a)}else t=se.offset(e),r=se.outerWidth(e),n=se.outerHeight(e);return t.width=r,t.height=n,t}function me(e,t){var r=t.charAt(0),n=t.charAt(1),a=e.width,o=e.height,i=e.left,c=e.top;return"c"===r?c+=o/2:"b"===r&&(c+=o),"c"===n?i+=a/2:"r"===n&&(i+=a),{left:i,top:c}}function be(e,t,r,n,a){var o=me(t,r[1]),i=me(e,r[0]),c=[i.left-o.left,i.top-o.top];return{left:Math.round(e.left-c[0]+n[0]-a[0]),top:Math.round(e.top-c[1]+n[1]-a[1])}}function he(e,t,r){return e.leftr.right}function ge(e,t,r){return e.topr.bottom}function ve(e,t,r){var n=[];return se.each(e,(function(e){n.push(e.replace(t,(function(e){return r[e]})))})),n}function ye(e,t){return e[t]=-e[t],e}function we(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function ke(e,t){e[0]=we(e[0],t.width),e[1]=we(e[1],t.height)}function _e(e,t,r,n){var a=r.points,o=r.offset||[0,0],i=r.targetOffset||[0,0],c=r.overflow,s=r.source||e;o=[].concat(o),i=[].concat(i);var l={},d=0,u=pe(s,!(!(c=c||{})||!c.alwaysByViewport)),p=fe(s);ke(o,p),ke(i,t);var f=be(p,t,a,o,i),m=se.merge(p,f);if(u&&(c.adjustX||c.adjustY)&&n){if(c.adjustX&&he(f,p,u)){var b=ve(a,/[lr]/gi,{l:"r",r:"l"}),h=ye(o,0),g=ye(i,0);(function(e,t,r){return e.left>r.right||e.left+t.widthr.bottom||e.top+t.height=r.left&&a.left+o.width>r.right&&(o.width-=a.left+o.width-r.right),n.adjustX&&a.left+o.width>r.right&&(a.left=Math.max(r.right-o.width,r.left)),n.adjustY&&a.top=r.top&&a.top+o.height>r.bottom&&(o.height-=a.top+o.height-r.bottom),n.adjustY&&a.top+o.height>r.bottom&&(a.top=Math.max(r.bottom-o.height,r.top)),se.mix(a,o)}(f,p,u,l))}return m.width!==p.width&&se.css(s,"width",se.width(s)+m.width-p.width),m.height!==p.height&&se.css(s,"height",se.height(s)+m.height-p.height),se.offset(s,{left:m.left,top:m.top},{useCssRight:r.useCssRight,useCssBottom:r.useCssBottom,useCssTransform:r.useCssTransform,ignoreShake:r.ignoreShake}),{points:a,offset:o,targetOffset:i,overflow:l}}function xe(e,t,r){var n=r.target||t;return _e(e,fe(n),r,!function(e,t){var r=pe(e,t),n=fe(e);return!r||n.left+n.width<=r.left||n.top+n.height<=r.top||n.left>=r.right||n.top>=r.bottom}(n,r.overflow&&r.overflow.alwaysByViewport))}function Me(e,t,r){var n,a,o=se.getDocument(e),i=o.defaultView||o.parentWindow,c=se.getWindowScrollLeft(i),s=se.getWindowScrollTop(i),l=se.viewportWidth(i),d=se.viewportHeight(i);n="pageX"in t?t.pageX:c+t.clientX,a="pageY"in t?t.pageY:s+t.clientY;var u=n>=0&&n<=c+l&&a>=0&&a<=s+d;return _e(e,{left:n,top:a,width:0,height:0},function(e){for(var t=1;t children");n=e}})),n}var Re=r(132),ze=r.n(Re),We={transitionstart:{transition:"transitionstart",WebkitTransition:"webkitTransitionStart",MozTransition:"mozTransitionStart",OTransition:"oTransitionStart",msTransition:"MSTransitionStart"},animationstart:{animation:"animationstart",WebkitAnimation:"webkitAnimationStart",MozAnimation:"mozAnimationStart",OAnimation:"oAnimationStart",msAnimation:"MSAnimationStart"}},Be={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},Ue=[],Ve=[];function qe(e,t,r){e.addEventListener(t,r,!1)}function Ge(e,t,r){e.removeEventListener(t,r,!1)}"undefined"!=typeof window&&"undefined"!=typeof document&&function(){var e=document.createElement("div").style;function t(t,r){for(var n in t)if(t.hasOwnProperty(n)){var a=t[n];for(var o in a)if(o in e){r.push(a[o]);break}}}"AnimationEvent"in window||(delete We.animationstart.animation,delete Be.animationend.animation),"TransitionEvent"in window||(delete We.transitionstart.transition,delete Be.transitionend.transition),t(We,Ue),t(Be,Ve)}();var Je={startEvents:Ue,addStartEventListener:function(e,t){0!==Ue.length?Ue.forEach((function(r){qe(e,r,t)})):window.setTimeout(t,0)},removeStartEventListener:function(e,t){0!==Ue.length&&Ue.forEach((function(r){Ge(e,r,t)}))},endEvents:Ve,addEndEventListener:function(e,t){0!==Ve.length?Ve.forEach((function(r){qe(e,r,t)})):window.setTimeout(t,0)},removeEndEventListener:function(e,t){0!==Ve.length&&Ve.forEach((function(r){Ge(e,r,t)}))}},$e=r(417),Ke=r.n($e),Xe=0!==Je.endEvents.length,Qe=["Webkit","Moz","O","ms"],Ze=["-webkit-","-moz-","-o-","ms-",""];function et(e,t){for(var r=window.getComputedStyle(e,null),n="",a=0;a children");return i.a.createElement(st,{key:r.key,ref:function(t){e.childrenRefs[r.key]=t},animation:t.animation,transitionName:t.transitionName,transitionEnter:t.transitionEnter,transitionAppear:t.transitionAppear,transitionLeave:t.transitionLeave},r)})));var o=t.component;if(o){var c=t;return"string"==typeof o&&(c=a()({className:t.className,style:t.style},t.componentProps)),i.a.createElement(o,c,n)}return n[0]||null}}]),t}(i.a.Component);pt.isAnimate=!0,pt.propTypes={className:s.a.string,style:s.a.object,component:s.a.any,componentProps:s.a.object,animation:s.a.object,transitionName:s.a.oneOfType([s.a.string,s.a.object]),transitionEnter:s.a.bool,transitionAppear:s.a.bool,exclusive:s.a.bool,transitionLeave:s.a.bool,onEnd:s.a.func,onEnter:s.a.func,onLeave:s.a.func,onAppear:s.a.func,showProp:s.a.string,children:s.a.node},pt.defaultProps={animation:{},component:"span",componentProps:{},transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:ut,onEnter:ut,onLeave:ut,onAppear:ut};var ft=function(){var e=this;this.performEnter=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillEnter(e.handleDoneAdding.bind(e,t,"enter")))},this.performAppear=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillAppear(e.handleDoneAdding.bind(e,t,"appear")))},this.handleDoneAdding=function(t,r){var n=e.props;if(delete e.currentlyAnimatingKeys[t],!n.exclusive||n===e.nextProps){var a=Fe(dt(n));e.isValidChildByKey(a,t)?"appear"===r?ot.allowAppearCallback(n)&&(n.onAppear(t),n.onEnd(t,!0)):ot.allowEnterCallback(n)&&(n.onEnter(t),n.onEnd(t,!0)):e.performLeave(t)}},this.performLeave=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillLeave(e.handleDoneLeaving.bind(e,t)))},this.handleDoneLeaving=function(t){var r=e.props;if(delete e.currentlyAnimatingKeys[t],!r.exclusive||r===e.nextProps){var n,a,o,i,c=Fe(dt(r));if(e.isValidChildByKey(c,t))e.performEnter(t);else{var s=function(){ot.allowLeaveCallback(r)&&(r.onLeave(t),r.onEnd(t,!1))};n=e.state.children,a=c,o=r.showProp,(i=n.length===a.length)&&n.forEach((function(e,t){var r=a[t];e&&r&&(e&&!r||!e&&r||e.key!==r.key||o&&e.props[o]!==r.props[o])&&(i=!1)})),i?s():e.setState({children:c},s)}}}},mt=Ne(pt),bt=r(418),ht=r.n(bt),gt=function(e){function t(){return v()(this,t),_()(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return M()(t,e),w()(t,[{key:"shouldComponentUpdate",value:function(e){return e.hiddenClassName||e.visible}},{key:"render",value:function(){var e=this.props,t=e.hiddenClassName,r=e.visible,n=ht()(e,["hiddenClassName","visible"]);return t||i.a.Children.count(n.children)>1?(!r&&t&&(n.className+=" "+t),i.a.createElement("div",n)):i.a.Children.only(n.children)}}]),t}(o.Component);gt.propTypes={children:s.a.any,className:s.a.string,visible:s.a.bool,hiddenClassName:s.a.string};var vt=gt,yt=function(e){function t(){return v()(this,t),_()(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return M()(t,e),w()(t,[{key:"render",value:function(){var e=this.props,t=e.className;return e.visible||(t+=" "+e.hiddenClassName),i.a.createElement("div",{className:t,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:e.style},i.a.createElement(vt,{className:e.prefixCls+"-content",visible:e.visible},e.children))}}]),t}(o.Component);yt.propTypes={hiddenClassName:s.a.string,className:s.a.string,prefixCls:s.a.string,onMouseEnter:s.a.func,onMouseLeave:s.a.func,children:s.a.any};var wt=yt;function kt(e,t){this[e]=t}var _t=function(e){function t(e){v()(this,t);var r=_()(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return xt.call(r),r.savePopupRef=kt.bind(r,"popupInstance"),r.saveAlignRef=kt.bind(r,"alignInstance"),r}return M()(t,e),w()(t,[{key:"componentDidMount",value:function(){this.rootNode=this.getPopupDomNode()}},{key:"getPopupDomNode",value:function(){return d.a.findDOMNode(this.popupInstance)}},{key:"getMaskTransitionName",value:function(){var e=this.props,t=e.maskTransitionName,r=e.maskAnimation;return!t&&r&&(t=e.prefixCls+"-"+r),t}},{key:"getTransitionName",value:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t}},{key:"getClassName",value:function(e){return this.props.prefixCls+" "+this.props.className+" "+e}},{key:"getPopupElement",value:function(){var e=this.savePopupRef,t=this.props,r=t.align,n=t.style,o=t.visible,c=t.prefixCls,s=t.destroyPopupOnHide,l=this.getClassName(this.currentAlignClassName||t.getClassNameFromAlign(r)),d=c+"-hidden";o||(this.currentAlignClassName=null);var u=a()({},n,this.getZIndexStyle()),p={className:l,prefixCls:c,ref:e,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,style:u};return s?i.a.createElement(mt,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName()},o?i.a.createElement(Pe,{target:this.getTarget,key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,align:r,onAlign:this.onAlign},i.a.createElement(wt,a()({visible:!0},p),t.children)):null):i.a.createElement(mt,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName(),showProp:"xVisible"},i.a.createElement(Pe,{target:this.getTarget,key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,xVisible:o,childrenProps:{visible:"xVisible"},disabled:!o,align:r,onAlign:this.onAlign},i.a.createElement(wt,a()({hiddenClassName:d},p),t.children)))}},{key:"getZIndexStyle",value:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e}},{key:"getMaskElement",value:function(){var e=this.props,t=void 0;if(e.mask){var r=this.getMaskTransitionName();t=i.a.createElement(vt,{style:this.getZIndexStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),r&&(t=i.a.createElement(mt,{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:r},t))}return t}},{key:"render",value:function(){return i.a.createElement("div",null,this.getMaskElement(),this.getPopupElement())}}]),t}(o.Component);_t.propTypes={visible:s.a.bool,style:s.a.object,getClassNameFromAlign:s.a.func,onAlign:s.a.func,getRootDomNode:s.a.func,onMouseEnter:s.a.func,align:s.a.any,destroyPopupOnHide:s.a.bool,className:s.a.string,prefixCls:s.a.string,onMouseLeave:s.a.func};var xt=function(){var e=this;this.onAlign=function(t,r){var n=e.props,a=n.getClassNameFromAlign(r);e.currentAlignClassName!==a&&(e.currentAlignClassName=a,t.className=e.getClassName(a)),n.onAlign(t,r)},this.getTarget=function(){return e.props.getRootDomNode()}},Mt=_t,Lt=r(419),Et=r.n(Lt);function Dt(){}function St(){return""}function Tt(){return window.document}var Ot="undefined"!=typeof navigator&&!!navigator.userAgent.match(/(Android|iPhone|iPad|iPod|iOS|UCWEB)/i),Yt=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"],Ct=p()({displayName:"Trigger",propTypes:{children:s.a.any,action:s.a.oneOfType([s.a.string,s.a.arrayOf(s.a.string)]),showAction:s.a.any,hideAction:s.a.any,getPopupClassNameFromAlign:s.a.any,onPopupVisibleChange:s.a.func,afterPopupVisibleChange:s.a.func,popup:s.a.oneOfType([s.a.node,s.a.func]).isRequired,popupStyle:s.a.object,prefixCls:s.a.string,popupClassName:s.a.string,popupPlacement:s.a.string,builtinPlacements:s.a.object,popupTransitionName:s.a.oneOfType([s.a.string,s.a.object]),popupAnimation:s.a.any,mouseEnterDelay:s.a.number,mouseLeaveDelay:s.a.number,zIndex:s.a.number,focusDelay:s.a.number,blurDelay:s.a.number,getPopupContainer:s.a.func,getDocument:s.a.func,destroyPopupOnHide:s.a.bool,mask:s.a.bool,maskClosable:s.a.bool,onPopupAlign:s.a.func,popupAlign:s.a.object,popupVisible:s.a.bool,maskTransitionName:s.a.oneOfType([s.a.string,s.a.object]),maskAnimation:s.a.string},mixins:[Et()({autoMount:!1,isVisible:function(e){return e.state.popupVisible},getContainer:function(e){var t=e.props,r=document.createElement("div");return r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",(t.getPopupContainer?t.getPopupContainer(Object(l.findDOMNode)(e)):t.getDocument().body).appendChild(r),r}})],getDefaultProps:function(){return{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:St,getDocument:Tt,onPopupVisibleChange:Dt,afterPopupVisibleChange:Dt,onPopupAlign:Dt,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[]}},getInitialState:function(){var e=this.props;return{popupVisible:"popupVisible"in e?!!e.popupVisible:!!e.defaultPopupVisible}},componentWillMount:function(){var e=this;Yt.forEach((function(t){e["fire"+t]=function(r){e.fireEvents(t,r)}}))},componentDidMount:function(){this.componentDidUpdate({},{popupVisible:this.state.popupVisible})},componentWillReceiveProps:function(e){var t=e.popupVisible;void 0!==t&&this.setState({popupVisible:t})},componentDidUpdate:function(e,t){var r=this.props,n=this.state;if(this.renderComponent(null,(function(){t.popupVisible!==n.popupVisible&&r.afterPopupVisibleChange(n.popupVisible)})),n.popupVisible){var a=void 0;return!this.clickOutsideHandler&&this.isClickToHide()&&(a=r.getDocument(),this.clickOutsideHandler=h()(a,"mousedown",this.onDocumentClick)),void(!this.touchOutsideHandler&&Ot&&(a=a||r.getDocument(),this.touchOutsideHandler=h()(a,"click",this.onDocumentClick)))}this.clearOutsideHandler()},componentWillUnmount:function(){this.clearDelayTimer(),this.clearOutsideHandler()},onMouseEnter:function(e){this.fireEvents("onMouseEnter",e),this.delaySetPopupVisible(!0,this.props.mouseEnterDelay)},onMouseLeave:function(e){this.fireEvents("onMouseLeave",e),this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onPopupMouseEnter:function(){this.clearDelayTimer()},onPopupMouseLeave:function(e){e.relatedTarget&&!e.relatedTarget.setTimeout&&this._component&&this._component.getPopupDomNode&&f(this._component.getPopupDomNode(),e.relatedTarget)||this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onFocus:function(e){this.fireEvents("onFocus",e),this.clearDelayTimer(),this.isFocusToShow()&&(this.focusTime=Date.now(),this.delaySetPopupVisible(!0,this.props.focusDelay))},onMouseDown:function(e){this.fireEvents("onMouseDown",e),this.preClickTime=Date.now()},onTouchStart:function(e){this.fireEvents("onTouchStart",e),this.preTouchTime=Date.now()},onBlur:function(e){this.fireEvents("onBlur",e),this.clearDelayTimer(),this.isBlurToHide()&&this.delaySetPopupVisible(!1,this.props.blurDelay)},onClick:function(e){if(this.fireEvents("onClick",e),this.focusTime){var t=void 0;if(this.preClickTime&&this.preTouchTime?t=Math.min(this.preClickTime,this.preTouchTime):this.preClickTime?t=this.preClickTime:this.preTouchTime&&(t=this.preTouchTime),Math.abs(t-this.focusTime)<20)return;this.focusTime=0}this.preClickTime=0,this.preTouchTime=0,e.preventDefault();var r=!this.state.popupVisible;(this.isClickToHide()&&!r||r&&this.isClickToShow())&&this.setPopupVisible(!this.state.popupVisible)},onDocumentClick:function(e){if(!this.props.mask||this.props.maskClosable){var t=e.target,r=Object(l.findDOMNode)(this),n=this.getPopupDomNode();f(r,t)||f(n,t)||this.close()}},getPopupDomNode:function(){return this._component&&this._component.getPopupDomNode?this._component.getPopupDomNode():null},getRootDomNode:function(){return Object(l.findDOMNode)(this)},getPopupClassNameFromAlign:function(e){var t=[],r=this.props,n=r.popupPlacement,a=r.builtinPlacements,o=r.prefixCls;return n&&a&&t.push(function(e,t,r){var n,a,o=r.points;for(var i in e)if(e.hasOwnProperty(i)&&(n=e[i].points,a=o,n[0]===a[0]&&n[1]===a[1]))return t+"-placement-"+i;return""}(a,o,e)),r.getPopupClassNameFromAlign&&t.push(r.getPopupClassNameFromAlign(e)),t.join(" ")},getPopupAlign:function(){var e=this.props,t=e.popupPlacement,r=e.popupAlign,n=e.builtinPlacements;return t&&n?function(e,t,r){var n=e[t]||{};return a()({},n,r)}(n,t,r):r},getComponent:function(){var e=this.props,t=this.state,r={};return this.isMouseEnterToShow()&&(r.onMouseEnter=this.onPopupMouseEnter),this.isMouseLeaveToHide()&&(r.onMouseLeave=this.onPopupMouseLeave),i.a.createElement(Mt,a()({prefixCls:e.prefixCls,destroyPopupOnHide:e.destroyPopupOnHide,visible:t.popupVisible,className:e.popupClassName,action:e.action,align:this.getPopupAlign(),onAlign:e.onPopupAlign,animation:e.popupAnimation,getClassNameFromAlign:this.getPopupClassNameFromAlign},r,{getRootDomNode:this.getRootDomNode,style:e.popupStyle,mask:e.mask,zIndex:e.zIndex,transitionName:e.popupTransitionName,maskAnimation:e.maskAnimation,maskTransitionName:e.maskTransitionName}),"function"==typeof e.popup?e.popup():e.popup)},setPopupVisible:function(e){this.clearDelayTimer(),this.state.popupVisible!==e&&("popupVisible"in this.props||this.setState({popupVisible:e}),this.props.onPopupVisibleChange(e))},delaySetPopupVisible:function(e,t){var r=this,n=1e3*t;this.clearDelayTimer(),n?this.delayTimer=setTimeout((function(){r.setPopupVisible(e),r.clearDelayTimer()}),n):this.setPopupVisible(e)},clearDelayTimer:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},clearOutsideHandler:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)},createTwoChains:function(e){var t=this.props.children.props,r=this.props;return t[e]&&r[e]?this["fire"+e]:t[e]||r[e]},isClickToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},isClickToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},isMouseEnterToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseEnter")},isMouseLeaveToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseLeave")},isFocusToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("focus")},isBlurToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("blur")},forcePopupAlign:function(){this.state.popupVisible&&this._component&&this._component.alignInstance&&this._component.alignInstance.forceAlign()},fireEvents:function(e,t){var r=this.props.children.props[e];r&&r(t);var n=this.props[e];n&&n(t)},close:function(){this.setPopupVisible(!1)},render:function(){var e=this.props.children,t=i.a.Children.only(e),r={};return this.isClickToHide()||this.isClickToShow()?(r.onClick=this.onClick,r.onMouseDown=this.onMouseDown,r.onTouchStart=this.onTouchStart):(r.onClick=this.createTwoChains("onClick"),r.onMouseDown=this.createTwoChains("onMouseDown"),r.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?r.onMouseEnter=this.onMouseEnter:r.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?r.onMouseLeave=this.onMouseLeave:r.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(r.onFocus=this.onFocus,r.onBlur=this.onBlur):(r.onFocus=this.createTwoChains("onFocus"),r.onBlur=this.createTwoChains("onBlur")),i.a.cloneElement(t,r)}});t.default=Ct},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return oe}));var n=r(138),a=r(134),o=r(5);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var r in t=t||{})t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var c=r(135),s=r(45),l=r(47),d=r(6),u=r(90),p=r(3);function f(e,t,r){Object(p.a)(2,arguments);var n=r||{},a=n.locale,i=a&&a.options&&a.options.weekStartsOn,c=null==i?0:Object(d.a)(i),s=null==n.weekStartsOn?c:Object(d.a)(n.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=Object(o.default)(e),u=Object(d.a)(t),f=l.getUTCDay(),m=u%7,b=(m+7)%7,h=(b0,a=n?t:1-t;if(a<=50)r=e||100;else{var o=a+50;r=e+100*Math.floor(o/100)-(e>=o%100?100:0)}return n?r:1-r}var $=[31,28,31,30,31,30,31,31,30,31,30,31],K=[31,29,31,30,31,30,31,31,30,31,30,31];function X(e){return e%400==0||e%4==0&&e%100!=0}var Q={G:{priority:140,parse:function(e,t,r,n){switch(t){case"G":case"GG":case"GGG":return r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"});case"GGGGG":return r.era(e,{width:"narrow"});case"GGGG":default:return r.era(e,{width:"wide"})||r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"})}},set:function(e,t,r,n){return t.era=r,e.setUTCFullYear(r,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,r,n){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return V(4,e,a);case"yo":return r.ordinalNumber(e,{unit:"year",valueCallback:a});default:return V(t.length,e,a)}},validate:function(e,t,r){return t.isTwoDigitYear||t.year>0},set:function(e,t,r,n){var a=e.getUTCFullYear();if(r.isTwoDigitYear){var o=J(r.year,a);return e.setUTCFullYear(o,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-r.year:r.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,r,n){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return V(4,e,a);case"Yo":return r.ordinalNumber(e,{unit:"year",valueCallback:a});default:return V(t.length,e,a)}},validate:function(e,t,r){return t.isTwoDigitYear||t.year>0},set:function(e,t,r,n){var a=Object(u.a)(e,n);if(r.isTwoDigitYear){var o=J(r.year,a);return e.setUTCFullYear(o,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),Object(g.a)(e,n)}var i="era"in t&&1!==t.era?1-r.year:r.year;return e.setUTCFullYear(i,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),Object(g.a)(e,n)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,r,n){return q("R"===t?4:t.length,e)},set:function(e,t,r,n){var a=new Date(0);return a.setUTCFullYear(r,0,4),a.setUTCHours(0,0,0,0),Object(h.a)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,r,n){return q("u"===t?4:t.length,e)},set:function(e,t,r,n){return e.setUTCFullYear(r,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,r,n){switch(t){case"Q":case"QQ":return V(t.length,e);case"Qo":return r.ordinalNumber(e,{unit:"quarter"});case"QQQ":return r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(e,{width:"wide",context:"formatting"})||r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=1&&t<=4},set:function(e,t,r,n){return e.setUTCMonth(3*(r-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,r,n){switch(t){case"q":case"qq":return V(t.length,e);case"qo":return r.ordinalNumber(e,{unit:"quarter"});case"qqq":return r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(e,{width:"wide",context:"standalone"})||r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=1&&t<=4},set:function(e,t,r,n){return e.setUTCMonth(3*(r-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,r,n){var a=function(e){return e-1};switch(t){case"M":return W(v,e,a);case"MM":return V(2,e,a);case"Mo":return r.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(e,{width:"wide",context:"formatting"})||r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.setUTCMonth(r,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,r,n){var a=function(e){return e-1};switch(t){case"L":return W(v,e,a);case"LL":return V(2,e,a);case"Lo":return r.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(e,{width:"wide",context:"standalone"})||r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.setUTCMonth(r,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,r,n){switch(t){case"w":return W(k,e);case"wo":return r.ordinalNumber(e,{unit:"week"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=53},set:function(e,t,r,n){return Object(g.a)(function(e,t,r){Object(p.a)(2,arguments);var n=Object(o.default)(e),a=Object(d.a)(t),i=Object(b.a)(n,r)-a;return n.setUTCDate(n.getUTCDate()-7*i),n}(e,r,n),n)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,r,n){switch(t){case"I":return W(k,e);case"Io":return r.ordinalNumber(e,{unit:"week"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=53},set:function(e,t,r,n){return Object(h.a)(function(e,t){Object(p.a)(2,arguments);var r=Object(o.default)(e),n=Object(d.a)(t),a=Object(m.a)(r)-n;return r.setUTCDate(r.getUTCDate()-7*a),r}(e,r,n),n)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,parse:function(e,t,r,n){switch(t){case"d":return W(y,e);case"do":return r.ordinalNumber(e,{unit:"date"});default:return V(t.length,e)}},validate:function(e,t,r){var n=X(e.getUTCFullYear()),a=e.getUTCMonth();return n?t>=1&&t<=K[a]:t>=1&&t<=$[a]},set:function(e,t,r,n){return e.setUTCDate(r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,parse:function(e,t,r,n){switch(t){case"D":case"DD":return W(w,e);case"Do":return r.ordinalNumber(e,{unit:"date"});default:return V(t.length,e)}},validate:function(e,t,r){return X(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,r,n){return e.setUTCMonth(0,r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,r,n){switch(t){case"E":case"EE":case"EEE":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,r,n){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return V(t.length,e,a);case"eo":return r.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeeee":return r.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,r,n){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return V(t.length,e,a);case"co":return r.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"ccccc":return r.day(e,{width:"narrow",context:"standalone"});case"cccccc":return r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return r.day(e,{width:"wide",context:"standalone"})||r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,r,n){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return V(t.length,e);case"io":return r.ordinalNumber(e,{unit:"day"});case"iii":return r.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiii":default:return r.day(e,{width:"wide",context:"formatting",valueCallback:a})||r.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,r){return t>=1&&t<=7},set:function(e,t,r,n){return(e=function(e,t){Object(p.a)(2,arguments);var r=Object(d.a)(t);r%7==0&&(r-=7);var n=1,a=Object(o.default)(e),i=a.getUTCDay(),c=r%7,s=(c+7)%7,l=(s=1&&t<=12},set:function(e,t,r,n){var a=e.getUTCHours()>=12;return a&&r<12?e.setUTCHours(r+12,0,0,0):a||12!==r?e.setUTCHours(r,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,r,n){switch(t){case"H":return W(_,e);case"Ho":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=23},set:function(e,t,r,n){return e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,r,n){switch(t){case"K":return W(M,e);case"Ko":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.getUTCHours()>=12&&r<12?e.setUTCHours(r+12,0,0,0):e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","H","k","t","T"]},k:{priority:70,parse:function(e,t,r,n){switch(t){case"k":return W(x,e);case"ko":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=24},set:function(e,t,r,n){var a=r<=24?r%24:r;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,r,n){switch(t){case"m":return W(E,e);case"mo":return r.ordinalNumber(e,{unit:"minute"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=59},set:function(e,t,r,n){return e.setUTCMinutes(r,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,r,n){switch(t){case"s":return W(D,e);case"so":return r.ordinalNumber(e,{unit:"second"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=59},set:function(e,t,r,n){return e.setUTCSeconds(r,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,r,n){return V(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,r,n){return e.setUTCMilliseconds(r),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,r,n){switch(t){case"X":return B(F,e);case"XX":return B(I,e);case"XXXX":return B(H,e);case"XXXXX":return B(z,e);case"XXX":default:return B(R,e)}},set:function(e,t,r,n){return t.timestampIsSet?e:new Date(e.getTime()-r)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,r,n){switch(t){case"x":return B(F,e);case"xx":return B(I,e);case"xxxx":return B(H,e);case"xxxxx":return B(z,e);case"xxx":default:return B(R,e)}},set:function(e,t,r,n){return t.timestampIsSet?e:new Date(e.getTime()-r)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,r,n){return U(e)},set:function(e,t,r,n){return[new Date(1e3*r),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,r,n){return U(e)},set:function(e,t,r,n){return[new Date(r),{timestampIsSet:!0}]},incompatibleTokens:"*"}},Z=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,re=/''/g,ne=/\S/,ae=/[a-zA-Z]/;function oe(e,t,r,u){Object(p.a)(3,arguments);var f=String(e),m=String(t),b=u||{},h=b.locale||n.a;if(!h.match)throw new RangeError("locale must contain match property");var g=h.options&&h.options.firstWeekContainsDate,v=null==g?1:Object(d.a)(g),y=null==b.firstWeekContainsDate?v:Object(d.a)(b.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=h.options&&h.options.weekStartsOn,k=null==w?0:Object(d.a)(w),_=null==b.weekStartsOn?k:Object(d.a)(b.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===m)return""===f?Object(o.default)(r):new Date(NaN);var x,M={firstWeekContainsDate:y,weekStartsOn:_,locale:h},L=[{priority:10,set:ie,index:0}],E=m.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,c.a[t])(e,h.formatLong,M):e})).join("").match(Z),D=[];for(x=0;x0&&ne.test(f))return new Date(NaN);var N=L.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,r){return r.indexOf(e)===t})).map((function(e){return L.filter((function(t){return t.priority===e})).reverse()})).map((function(e){return e[0]})),F=Object(o.default)(r);if(isNaN(F))return new Date(NaN);var I=Object(a.a)(F,Object(s.a)(F)),H={};for(x=0;x0?r:1-r;return c("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):c(r+1,2)},d:function(e,t){return c(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":case"aaa":return r.toUpperCase();case"aaaaa":return r[0];case"aaaa":default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return c(e.getUTCHours()%12||12,t.length)},H:function(e,t){return c(e.getUTCHours(),t.length)},m:function(e,t){return c(e.getUTCMinutes(),t.length)},s:function(e,t){return c(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return c(Math.floor(n*Math.pow(10,r-3)),t.length)}},l=r(3);var d=r(140),u=r(136),p=r(139),f=r(90),m="midnight",b="noon",h="morning",g="afternoon",v="evening",y="night";function w(e,t){var r=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),o=n%60;if(0===o)return r+String(a);var i=t||"";return r+String(a)+i+c(o,2)}function k(e,t){return e%60==0?(e>0?"-":"+")+c(Math.abs(e)/60,2):_(e,t)}function _(e,t){var r=t||"",n=e>0?"-":"+",a=Math.abs(e);return n+c(Math.floor(a/60),2)+r+c(a%60,2)}var x={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return s.y(e,t)},Y:function(e,t,r,n){var a=Object(f.a)(e,n),o=a>0?a:1-a;return"YY"===t?c(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):c(o,t.length)},R:function(e,t){return c(Object(u.a)(e),t.length)},u:function(e,t){return c(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return c(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return s.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var a=Object(p.a)(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):c(a,t.length)},I:function(e,t,r){var n=Object(d.a)(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):c(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):s.d(e,t)},D:function(e,t,r){var n=function(e){Object(l.a)(1,arguments);var t=Object(i.default)(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),a=r-n;return Math.floor(a/864e5)+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):c(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var a=e.getUTCDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return c(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var a=e.getUTCDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return c(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return c(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,a=e.getUTCHours();switch(n=12===a?b:0===a?m:a/12>=1?"pm":"am",t){case"b":case"bb":case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,a=e.getUTCHours();switch(n=a>=17?v:a>=12?g:a>=4?h:y,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return s.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):s.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):c(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):c(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):s.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):s.s(e,t)},S:function(e,t){return s.S(e,t)},X:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return k(a);case"XXXX":case"XX":return _(a);case"XXXXX":case"XXX":default:return _(a,":")}},x:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return k(a);case"xxxx":case"xx":return _(a);case"xxxxx":case"xxx":default:return _(a,":")}},O:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+w(a,":");case"OOOO":default:return"GMT"+_(a,":")}},z:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+w(a,":");case"zzzz":default:return"GMT"+_(a,":")}},t:function(e,t,r,n){var a=n._originalDate||e;return c(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,r,n){return c((n._originalDate||e).getTime(),t.length)}},M=r(135),L=r(45),E=r(47),D=r(6),S=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,T=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,Y=/''/g,C=/[a-zA-Z]/;function P(e,t,r){Object(l.a)(2,arguments);var c=String(t),s=r||{},d=s.locale||a.a,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:Object(D.a)(u),f=null==s.firstWeekContainsDate?p:Object(D.a)(s.firstWeekContainsDate);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=d.options&&d.options.weekStartsOn,b=null==m?0:Object(D.a)(m),h=null==s.weekStartsOn?b:Object(D.a)(s.weekStartsOn);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var g=Object(i.default)(e);if(!Object(n.default)(g))throw new RangeError("Invalid time value");var v=Object(L.a)(g),y=Object(o.a)(g,v),w={firstWeekContainsDate:f,weekStartsOn:h,locale:d,_originalDate:g},k=c.match(T).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,M.a[t])(e,d.formatLong,w):e})).join("").match(S).map((function(e){if("''"===e)return"'";var t=e[0];if("'"===t)return j(e);var r=x[t];if(r)return!s.useAdditionalWeekYearTokens&&Object(E.b)(e)&&Object(E.c)(e),!s.useAdditionalDayOfYearTokens&&Object(E.a)(e)&&Object(E.c)(e),r(y,e,d.localize,w);if(t.match(C))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return e})).join("");return k}function j(e){return e.match(O)[1].replace(Y,"'")}},function(e,t,r){"use strict";r.r(t),r.d(t,"Popper",(function(){return T})),r.d(t,"placements",(function(){return S})),r.d(t,"Manager",(function(){return k})),r.d(t,"Reference",(function(){return P}));var n=r(421),a=r.n(n),o=r(76),i=r.n(o),c=r(15),s=r.n(c),l=r(59),d=r.n(l),u=r(16),p=r.n(u),f=r(422),m=r.n(f),b=r(0),h=r(205),g=r(206),v=r.n(g),y=v()(),w=v()(),k=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a1?t-1:0),n=1;n=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var f=new Date(0);f.setFullYear(c+1,0,p),f.setHours(0,0,0,0);var m=Object(n.default)(f,t),b=new Date(0);b.setFullYear(c,0,p),b.setHours(0,0,0,0);var h=Object(n.default)(b,t);return r.getTime()>=m.getTime()?c+1:r.getTime()>=h.getTime()?c:c-1}function s(e,t){Object(i.a)(1,arguments);var r=t||{},a=r.locale,s=a&&a.options&&a.options.firstWeekContainsDate,l=null==s?1:Object(o.a)(s),d=null==r.firstWeekContainsDate?l:Object(o.a)(r.firstWeekContainsDate),u=c(e,t),p=new Date(0);p.setFullYear(u,0,d),p.setHours(0,0,0,0);var f=Object(n.default)(p,t);return f}function l(e,t){Object(i.a)(1,arguments);var r=Object(a.default)(e),o=Object(n.default)(r,t).getTime()-s(r,t).getTime();return Math.round(o/6048e5)+1}}]); \ No newline at end of file + */var n="function"==typeof Symbol&&Symbol.for,a=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,c=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,p=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,m=n?Symbol.for("react.suspense"):60113,b=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,k=n?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case u:case p:case i:case s:case c:case m:return e;default:switch(e=e&&e.$$typeof){case d:case f:case g:case h:case l:return e;default:return t}}case o:return t}}}function x(e){return _(e)===p}t.AsyncMode=u,t.ConcurrentMode=p,t.ContextConsumer=d,t.ContextProvider=l,t.Element=a,t.ForwardRef=f,t.Fragment=i,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=s,t.StrictMode=c,t.Suspense=m,t.isAsyncMode=function(e){return x(e)||_(e)===u},t.isConcurrentMode=x,t.isContextConsumer=function(e){return _(e)===d},t.isContextProvider=function(e){return _(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.isForwardRef=function(e){return _(e)===f},t.isFragment=function(e){return _(e)===i},t.isLazy=function(e){return _(e)===g},t.isMemo=function(e){return _(e)===h},t.isPortal=function(e){return _(e)===o},t.isProfiler=function(e){return _(e)===s},t.isStrictMode=function(e){return _(e)===c},t.isSuspense=function(e){return _(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===p||e===s||e===c||e===m||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===l||e.$$typeof===d||e.$$typeof===f||e.$$typeof===y||e.$$typeof===w||e.$$typeof===k||e.$$typeof===v)},t.typeOf=_},function(e,t){var r,n,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var s,l=[],d=!1,u=-1;function p(){d&&s&&(d=!1,s.length?l=s.concat(l):u=-1,l.length&&f())}function f(){if(!d){var e=c(p);d=!0;for(var t=l.length;t;){for(s=l,l=[];++u1)for(var r=1;r-1}},function(e,t,r){var n=r(122);e.exports=function(e,t){var r=this.__data__,a=n(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this}},function(e,t,r){var n=r(121);e.exports=function(){this.__data__=new n,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,r){var n=r(121),a=r(171),o=r(173);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var i=r.__data__;if(!a||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new o(i)}return r.set(e,t),this.size=r.size,this}},function(e,t,r){var n=r(378),a=r(653),o=r(172),i=r(380),c=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,d=s.toString,u=l.hasOwnProperty,p=RegExp("^"+d.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!o(e)||a(e))&&(n(e)?p:c).test(i(e))}},function(e,t,r){var n=r(123),a=Object.prototype,o=a.hasOwnProperty,i=a.toString,c=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,c),r=e[c];try{e[c]=void 0;var n=!0}catch(e){}var a=i.call(e);return n&&(t?e[c]=r:delete e[c]),a}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t,r){var n,a=r(654),o=(n=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";e.exports=function(e){return!!o&&o in e}},function(e,t,r){var n=r(50)["__core-js_shared__"];e.exports=n},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,r){var n=r(657),a=r(121),o=r(171);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(o||a),string:new n}}},function(e,t,r){var n=r(658),a=r(659),o=r(660),i=r(661),c=r(662);function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function u(e,t){for(var r=0;r.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFFFFFF\', endColorstr=\'#FFEEEEEE\', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFEEEEEE\', endColorstr=\'#FFCCCCCC\', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFFFFFFF\', endColorstr=\'#FFEEEEEE\', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#FFEEEEEE\', endColorstr=\'#FFFFFFFF\', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}\n',""]),t.default=a},function(e,t,r){var n=r(77),a=r(733);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},function(e,t,r){"use strict";r.r(t);var n=r(29),a=r.n(n)()(!1);a.push([e.i,".rc-color-picker-panel-inner {\n position: relative;\n border-radius: 4px;\n box-shadow: 0 1px 5px #ccc;\n border: 1px solid #ccc;\n padding-bottom: 8px;\n}\n.rc-color-picker-panel-wrap {\n margin: 5px 0 0;\n height: 30px;\n width: 100%;\n position: relative;\n}\n.rc-color-picker-panel-wrap-preview {\n position: absolute;\n right: 8px;\n}\n.rc-color-picker-panel-wrap-ribbon {\n position: absolute;\n left: 8px;\n top: 0;\n right: 43px;\n height: 30px;\n}\n.rc-color-picker-panel-wrap-alpha {\n position: absolute;\n left: 8px;\n right: 43px;\n bottom: 0;\n height: 12.5px;\n}\n.rc-color-picker-panel-wrap-has-alpha .rc-color-picker-panel-wrap-ribbon {\n height: 12.5px;\n}\n.rc-color-picker-trigger {\n border: 1px solid #999;\n display: inline-block;\n padding: 2px;\n border-radius: 2px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n width: 20px;\n height: 20px;\n cursor: pointer;\n box-shadow: 0 0 0 2px #fff inset;\n}\n.rc-color-picker-trigger-open {\n box-shadow: 0px 0px 3px #999;\n}\n.rc-color-picker-panel {\n width: 218px;\n background-color: #fff;\n box-sizing: border-box;\n outline: none;\n z-index: 9;\n border-radius: 4px;\n -moz-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel * {\n box-sizing: border-box;\n}\n.rc-color-picker-panel-open {\n display: block;\n}\n.rc-color-picker-panel-close {\n display: none;\n}\n.rc-color-picker-panel-preview {\n height: 30px;\n width: 30px;\n overflow: hidden;\n border-radius: 2px;\n background-image: url('data:image/png;base64,R0lGODdhCgAKAPAAAOXl5f///ywAAAAACgAKAEACEIQdqXt9GxyETrI279OIgwIAOw==');\n}\n.rc-color-picker-panel-preview span {\n box-shadow: 0 0 2px #808080 inset;\n}\n.rc-color-picker-panel-preview span,\n.rc-color-picker-panel-preview input[type=color] {\n position: absolute;\n display: block;\n height: 100%;\n width: 30px;\n border-radius: 2px;\n}\n.rc-color-picker-panel-preview input[type=color] {\n opacity: 0;\n}\n.rc-color-picker-panel-board {\n position: relative;\n font-size: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n margin: 8px 8px 0px;\n}\n.rc-color-picker-panel-board span {\n position: absolute;\n border-radius: 10px;\n border: 1px solid #fff;\n width: 9px;\n height: 9px;\n margin: -4px 0 0 -4px;\n left: -999px;\n top: -999px;\n box-shadow: 0 0 1px rgba(120, 120, 120, 0.7);\n z-index: 2;\n}\n.rc-color-picker-panel-board-hsv {\n width: 200px;\n height: 150px;\n position: relative;\n z-index: 1;\n border-radius: 2px;\n}\n.rc-color-picker-panel-board-value {\n border-radius: 2px;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 2;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9InJnYigwLDAsMCkiIHN0b3Atb3BhY2l0eT0iMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: -moz-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: -o-linear-gradient(top, transparent 0%, #000000 100%);\n background-image: linear-gradient(to bottom, transparent 0%, #000000 100%);\n}\n.rc-color-picker-panel-board-saturation {\n border-radius: 2px;\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n z-index: 1;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0icmdiKDAsMCwwKSIgc3RvcC1vcGFjaXR5PSIwIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: -moz-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: -o-linear-gradient(left, #ffffff 0%, transparent 100%);\n background-image: linear-gradient(to right, #ffffff 0%, transparent 100%);\n}\n.rc-color-picker-panel-board-handler {\n box-shadow: 0 0 2px #808080 inset;\n border-radius: 2px;\n cursor: crosshair;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 3;\n}\n.rc-color-picker-panel-ribbon {\n position: relative;\n height: 100%;\n border-radius: 2px;\n box-shadow: 0 0 2px #808080 inset;\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmZjAwMDAiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAlIiBzdG9wLWNvbG9yPSIjZmY5OTAwIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjIwJSIgc3RvcC1jb2xvcj0iI2NkZmYwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSIzMCUiIHN0b3AtY29sb3I9IiMzNWZmMDAiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iNDAlIiBzdG9wLWNvbG9yPSIjMDBmZjY2IiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iIzAwZmZmZCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSI2MCUiIHN0b3AtY29sb3I9IiMwMDY2ZmYiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iNzAlIiBzdG9wLWNvbG9yPSIjMzIwMGZmIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjgwJSIgc3RvcC1jb2xvcj0iI2NkMDBmZiIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSI5MCUiIHN0b3AtY29sb3I9IiNmZjAwOTkiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmMDAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);\n background-image: -webkit-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: -moz-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: -o-linear-gradient(left, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n background-image: linear-gradient(to right, #ff0000 0%, #ff9900 10%, #cdff00 20%, #35ff00 30%, #00ff66 40%, #00fffd 50%, #0066ff 60%, #3200ff 70%, #cd00ff 80%, #ff0099 90%, #ff0000 100%);\n}\n.rc-color-picker-panel-ribbon span {\n position: absolute;\n top: 0;\n height: 100%;\n width: 4px;\n border: 1px solid #000000;\n padding: 1px 0;\n margin-left: -2px;\n background-color: #fff;\n border-radius: 3px;\n}\n.rc-color-picker-panel-ribbon-handler {\n position: absolute;\n width: 104%;\n height: 100%;\n left: -2%;\n cursor: pointer;\n}\n.rc-color-picker-panel-alpha {\n position: relative;\n height: 100%;\n width: 100%;\n border-radius: 2px;\n background-image: url('data:image/png;base64,R0lGODdhCgAKAPAAAOXl5f///ywAAAAACgAKAEACEIQdqXt9GxyETrI279OIgwIAOw==');\n background-repeat: repeat;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel-alpha-bg {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n box-shadow: 0 0 2px #808080 inset;\n}\n.rc-color-picker-panel-alpha span {\n position: absolute;\n top: 0;\n height: 100%;\n width: 4px;\n border: 1px solid #000000;\n padding: 1px 0;\n margin-left: -2px;\n background-color: #fff;\n border-radius: 3px;\n}\n.rc-color-picker-panel-alpha-handler {\n position: absolute;\n width: 104%;\n height: 100%;\n left: -2%;\n cursor: pointer;\n}\n.rc-color-picker-panel-params {\n font-size: 12px;\n}\n.rc-color-picker-panel-params-input {\n overflow: hidden;\n padding: 2px 8px;\n}\n.rc-color-picker-panel-params input {\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n text-align: center;\n padding: 1px;\n margin: 0;\n float: left;\n border-radius: 2px;\n border: 1px solid #CACACA;\n font-family: 'Helvetica Neue', Helvetica, sans-serif;\n}\n.rc-color-picker-panel-params-hex {\n width: 52px;\n}\n.rc-color-picker-panel-params input[type=number] {\n margin-left: 5px;\n width: 44px;\n}\n.rc-color-picker-panel-params input[type=number]::-webkit-inner-spin-button {\n -webkit-appearance: none;\n}\n.rc-color-picker-panel-params-lable {\n padding: 2px 8px;\n height: 22px;\n line-height: 18px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.rc-color-picker-panel-params-lable label {\n float: left;\n text-align: center;\n}\n.rc-color-picker-panel-params-lable-hex {\n width: 52px;\n}\n.rc-color-picker-panel-params-lable-number,\n.rc-color-picker-panel-params-lable-alpha {\n margin-left: 5px;\n width: 44px;\n text-transform: uppercase;\n}\n.rc-color-picker-panel-params-lable-number:hover {\n border-radius: 2px;\n background-color: #eee;\n box-shadow: 0 0 0 1px #ccc inset;\n cursor: pointer;\n}\n.rc-color-picker-panel-params-has-alpha input[type=number] {\n width: 32px;\n}\n.rc-color-picker-panel-params-has-alpha .rc-color-picker-panel-params-lable-number,\n.rc-color-picker-panel-params-has-alpha .rc-color-picker-panel-params-lable-alpha {\n width: 32px;\n}\n.rc-color-picker {\n position: absolute;\n left: -9999px;\n top: -9999px;\n z-index: 1000;\n}\n.rc-color-picker-wrap {\n display: inline-block;\n}\n.rc-color-picker-slide-up-enter {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 0;\n animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-appear {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 0;\n animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-leave {\n animation-duration: .3s;\n animation-fill-mode: both;\n transform-origin: 0 0;\n display: block !important;\n opacity: 1;\n animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);\n animation-play-state: paused;\n}\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-bottomRight,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-bottomRight {\n animation-name: rcColorPickerSlideUpIn;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-enter.rc-color-picker-slide-up-enter-active.rc-color-picker-placement-topRight,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-appear.rc-color-picker-slide-up-appear-active.rc-color-picker-placement-topRight {\n animation-name: rcColorPickerSlideDownIn;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-bottomLeft,\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-bottomRight {\n animation-name: rcColorPickerSlideUpOut;\n animation-play-state: running;\n}\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-topLeft,\n.rc-color-picker-slide-up-leave.rc-color-picker-slide-up-leave-active.rc-color-picker-placement-topRight {\n animation-name: rcColorPickerSlideDownOut;\n animation-play-state: running;\n}\n@keyframes rcColorPickerSlideUpIn {\n 0% {\n opacity: 0;\n transform-origin: 0% 0%;\n transform: scaleY(0);\n }\n 100% {\n opacity: 1;\n transform-origin: 0% 0%;\n transform: scaleY(1);\n }\n}\n@keyframes rcColorPickerSlideUpOut {\n 0% {\n opacity: 1;\n transform-origin: 0% 0%;\n transform: scaleY(1);\n }\n 100% {\n opacity: 0;\n transform-origin: 0% 0%;\n transform: scaleY(0);\n }\n}\n@keyframes rcColorPickerSlideDownIn {\n 0% {\n opacity: 0;\n transform-origin: 100% 100%;\n transform: scaleY(0);\n }\n 100% {\n opacity: 1;\n transform-origin: 100% 100%;\n transform: scaleY(1);\n }\n}\n@keyframes rcColorPickerSlideDownOut {\n 0% {\n opacity: 1;\n transform-origin: 100% 100%;\n transform: scaleY(1);\n }\n 100% {\n opacity: 0;\n transform-origin: 100% 100%;\n transform: scaleY(0);\n }\n}\n",""]),t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{!n&&c.return&&c.return()}finally{if(a)throw o}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=Object.assign||function(e){for(var t=1;td;)for(var f,m=s(arguments[d++]),b=u?a(m).concat(u(m)):a(m),h=b.length,g=0;h>g;)f=b[g++],n&&!p.call(m,f)||(r[f]=m[f]);return r}:l},function(e,t,r){var n=r(85),a=r(741),o=r(742);e.exports=function(e){return function(t,r,i){var c,s=n(t),l=a(s.length),d=o(i,l);if(e&&r!=r){for(;l>d;)if((c=s[d++])!=c)return!0}else for(;l>d;d++)if((e||d in s)&&s[d]===r)return e||d||0;return!e&&-1}}},function(e,t,r){var n=r(180),a=Math.min;e.exports=function(e){return e>0?a(n(e),9007199254740991):0}},function(e,t,r){var n=r(180),a=Math.max,o=Math.min;e.exports=function(e,t){return(e=n(e))<0?a(e+t,0):o(e,t)}},function(e,t,r){"use strict";var n=r(106),a={};function o(e,t,r,n,a,o,i,c){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,a,o,i,c],d=0;(s=new Error(t.replace(/%s/g,(function(){return l[d++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}e.exports=function(e,t,r){var i=[],c={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},s={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},l={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var r=0;r=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})}))},function(e,t,r){var n=r(180),a=r(179);e.exports=function(e){return function(t,r){var o,i,c=String(a(t)),s=n(r),l=c.length;return s<0||s>=l?e?"":void 0:(o=c.charCodeAt(s))<55296||o>56319||s+1===l||(i=c.charCodeAt(s+1))<56320||i>57343?e?c.charAt(s):o:e?c.slice(s,s+2):i-56320+(o-55296<<10)+65536}}},function(e,t,r){"use strict";var n=r(187),a=r(127),o=r(188),i={};r(83)(i,r(86)("iterator"),(function(){return this})),e.exports=function(e,t,r){e.prototype=n(i,{next:a(1,r)}),o(e,t+" Iterator")}},function(e,t,r){var n=r(72),a=r(100),o=r(128);e.exports=r(58)?Object.defineProperties:function(e,t){a(e);for(var r,i=o(t),c=i.length,s=0;c>s;)n.f(e,r=i[s++],t[r]);return e}},function(e,t,r){var n=r(56).document;e.exports=n&&n.documentElement},function(e,t,r){var n=r(73),a=r(185),o=r(181)("IE_PROTO"),i=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=a(e),n(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?i:null}},function(e,t,r){r(757);for(var n=r(56),a=r(83),o=r(186),i=r(86)("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),s=0;s=e.length?(this._t=void 0,a(1)):a(0,"keys"==t?r:"values"==t?e[r]:[r,e[r]])}),"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,r){e.exports={default:r(761),__esModule:!0}},function(e,t,r){r(762),r(767),r(768),r(769),e.exports=r(57).Symbol},function(e,t,r){"use strict";var n=r(56),a=r(73),o=r(58),i=r(82),c=r(399),s=r(763).KEY,l=r(101),d=r(182),u=r(188),p=r(130),f=r(86),m=r(189),b=r(190),h=r(764),g=r(765),v=r(100),y=r(84),w=r(185),k=r(85),_=r(178),x=r(127),M=r(187),L=r(766),E=r(401),D=r(184),S=r(72),T=r(128),O=E.f,Y=S.f,C=L.f,P=n.Symbol,j=n.JSON,A=j&&j.stringify,N=f("_hidden"),F=f("toPrimitive"),I={}.propertyIsEnumerable,H=d("symbol-registry"),R=d("symbols"),z=d("op-symbols"),W=Object.prototype,B="function"==typeof P&&!!D.f,U=n.QObject,V=!U||!U.prototype||!U.prototype.findChild,q=o&&l((function(){return 7!=M(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=O(W,t);n&&delete W[t],Y(e,t,r),n&&e!==W&&Y(W,t,n)}:Y,G=function(e){var t=R[e]=M(P.prototype);return t._k=e,t},J=B&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},$=function(e,t,r){return e===W&&$(z,t,r),v(e),t=_(t,!0),v(r),a(R,t)?(r.enumerable?(a(e,N)&&e[N][t]&&(e[N][t]=!1),r=M(r,{enumerable:x(0,!1)})):(a(e,N)||Y(e,N,x(1,{})),e[N][t]=!0),q(e,t,r)):Y(e,t,r)},K=function(e,t){v(e);for(var r,n=h(t=k(t)),a=0,o=n.length;o>a;)$(e,r=n[a++],t[r]);return e},X=function(e){var t=I.call(this,e=_(e,!0));return!(this===W&&a(R,e)&&!a(z,e))&&(!(t||!a(this,e)||!a(R,e)||a(this,N)&&this[N][e])||t)},Q=function(e,t){if(e=k(e),t=_(t,!0),e!==W||!a(R,t)||a(z,t)){var r=O(e,t);return!r||!a(R,t)||a(e,N)&&e[N][t]||(r.enumerable=!0),r}},Z=function(e){for(var t,r=C(k(e)),n=[],o=0;r.length>o;)a(R,t=r[o++])||t==N||t==s||n.push(t);return n},ee=function(e){for(var t,r=e===W,n=C(r?z:k(e)),o=[],i=0;n.length>i;)!a(R,t=n[i++])||r&&!a(W,t)||o.push(R[t]);return o};B||(c((P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(r){this===W&&t.call(z,r),a(this,N)&&a(this[N],e)&&(this[N][e]=!1),q(this,e,x(1,r))};return o&&V&&q(W,e,{configurable:!0,set:t}),G(e)}).prototype,"toString",(function(){return this._k})),E.f=Q,S.f=$,r(400).f=L.f=Z,r(131).f=X,D.f=ee,o&&!r(129)&&c(W,"propertyIsEnumerable",X,!0),m.f=function(e){return G(f(e))}),i(i.G+i.W+i.F*!B,{Symbol:P});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;te.length>re;)f(te[re++]);for(var ne=T(f.store),ae=0;ne.length>ae;)b(ne[ae++]);i(i.S+i.F*!B,"Symbol",{for:function(e){return a(H,e+="")?H[e]:H[e]=P(e)},keyFor:function(e){if(!J(e))throw TypeError(e+" is not a symbol!");for(var t in H)if(H[t]===e)return t},useSetter:function(){V=!0},useSimple:function(){V=!1}}),i(i.S+i.F*!B,"Object",{create:function(e,t){return void 0===t?M(e):K(M(e),t)},defineProperty:$,defineProperties:K,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:ee});var oe=l((function(){D.f(1)}));i(i.S+i.F*oe,"Object",{getOwnPropertySymbols:function(e){return D.f(w(e))}}),j&&i(i.S+i.F*(!B||l((function(){var e=P();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))}))),"JSON",{stringify:function(e){for(var t,r,n=[e],a=1;arguments.length>a;)n.push(arguments[a++]);if(r=t=n[1],(y(t)||void 0!==e)&&!J(e))return g(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!J(t))return t}),n[1]=t,A.apply(j,n)}}),P.prototype[F]||r(83)(P.prototype,F,P.prototype.valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(n.JSON,"JSON",!0)},function(e,t,r){var n=r(130)("meta"),a=r(84),o=r(73),i=r(72).f,c=0,s=Object.isExtensible||function(){return!0},l=!r(101)((function(){return s(Object.preventExtensions({}))})),d=function(e){i(e,n,{value:{i:"O"+ ++c,w:{}}})},u=e.exports={KEY:n,NEED:!1,fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,n)){if(!s(e))return"F";if(!t)return"E";d(e)}return e[n].i},getWeak:function(e,t){if(!o(e,n)){if(!s(e))return!0;if(!t)return!1;d(e)}return e[n].w},onFreeze:function(e){return l&&u.NEED&&s(e)&&!o(e,n)&&d(e),e}}},function(e,t,r){var n=r(128),a=r(184),o=r(131);e.exports=function(e){var t=n(e),r=a.f;if(r)for(var i,c=r(e),s=o.f,l=0;c.length>l;)s.call(e,i=c[l++])&&t.push(i);return t}},function(e,t,r){var n=r(396);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,r){var n=r(85),a=r(400).f,o={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return i&&"[object Window]"==o.call(e)?function(e){try{return a(e)}catch(e){return i.slice()}}(e):a(n(e))}},function(e,t){},function(e,t,r){r(190)("asyncIterator")},function(e,t,r){r(190)("observable")},function(e,t,r){e.exports={default:r(771),__esModule:!0}},function(e,t,r){r(772),e.exports=r(57).Object.setPrototypeOf},function(e,t,r){var n=r(82);n(n.S,"Object",{setPrototypeOf:r(773).set})},function(e,t,r){var n=r(84),a=r(100),o=function(e,t){if(a(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=r(391)(Function.call,r(401).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,r){return o(e,r),t?e.__proto__=r:n(e,r),e}}({},!1):void 0),check:o}},function(e,t,r){e.exports={default:r(775),__esModule:!0}},function(e,t,r){r(776);var n=r(57).Object;e.exports=function(e,t){return n.create(e,t)}},function(e,t,r){var n=r(82);n(n.S,"Object",{create:r(187)})},function(e,t,r){var n;!function(a){var o=/^\s+/,i=/\s+$/,c=0,s=a.round,l=a.min,d=a.max,u=a.random;function p(e,t){if(t=t||{},(e=e||"")instanceof p)return e;if(!(this instanceof p))return new p(e,t);var r=function(e){var t={r:0,g:0,b:0},r=1,n=null,c=null,s=null,u=!1,p=!1;"string"==typeof e&&(e=function(e){e=e.replace(o,"").replace(i,"").toLowerCase();var t,r=!1;if(O[e])e=O[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=B.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=B.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=B.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=B.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=B.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=B.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=B.hex8.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),a:H(t[4]),format:r?"name":"hex8"};if(t=B.hex6.exec(e))return{r:A(t[1]),g:A(t[2]),b:A(t[3]),format:r?"name":"hex"};if(t=B.hex4.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),a:H(t[4]+""+t[4]),format:r?"name":"hex8"};if(t=B.hex3.exec(e))return{r:A(t[1]+""+t[1]),g:A(t[2]+""+t[2]),b:A(t[3]+""+t[3]),format:r?"name":"hex"};return!1}(e));"object"==typeof e&&(U(e.r)&&U(e.g)&&U(e.b)?(f=e.r,m=e.g,b=e.b,t={r:255*P(f,255),g:255*P(m,255),b:255*P(b,255)},u=!0,p="%"===String(e.r).substr(-1)?"prgb":"rgb"):U(e.h)&&U(e.s)&&U(e.v)?(n=F(e.s),c=F(e.v),t=function(e,t,r){e=6*P(e,360),t=P(t,100),r=P(r,100);var n=a.floor(e),o=e-n,i=r*(1-t),c=r*(1-o*t),s=r*(1-(1-o)*t),l=n%6;return{r:255*[r,c,i,i,s,r][l],g:255*[s,r,r,c,i,i][l],b:255*[i,i,s,r,r,c][l]}}(e.h,n,c),u=!0,p="hsv"):U(e.h)&&U(e.s)&&U(e.l)&&(n=F(e.s),s=F(e.l),t=function(e,t,r){var n,a,o;function i(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=P(e,360),t=P(t,100),r=P(r,100),0===t)n=a=o=r;else{var c=r<.5?r*(1+t):r+t-r*t,s=2*r-c;n=i(s,c,e+1/3),a=i(s,c,e),o=i(s,c,e-1/3)}return{r:255*n,g:255*a,b:255*o}}(e.h,n,s),u=!0,p="hsl"),e.hasOwnProperty("a")&&(r=e.a));var f,m,b;return r=C(r),{ok:u,format:e.format||p,r:l(255,d(t.r,0)),g:l(255,d(t.g,0)),b:l(255,d(t.b,0)),a:r}}(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=s(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=s(this._r)),this._g<1&&(this._g=s(this._g)),this._b<1&&(this._b=s(this._b)),this._ok=r.ok,this._tc_id=c++}function f(e,t,r){e=P(e,255),t=P(t,255),r=P(r,255);var n,a,o=d(e,t,r),i=l(e,t,r),c=(o+i)/2;if(o==i)n=a=0;else{var s=o-i;switch(a=c>.5?s/(2-o-i):s/(o+i),o){case e:n=(t-r)/s+(t>1)+720)%360;--t;)n.h=(n.h+a)%360,o.push(p(n));return o}function T(e,t){t=t||6;for(var r=p(e).toHsv(),n=r.h,a=r.s,o=r.v,i=[],c=1/t;t--;)i.push(p({h:n,s:a,v:o})),o=(o+c)%1;return i}p.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,t=n.g/255,r=n.b/255,.2126*(e<=.03928?e/12.92:a.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:a.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:a.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=C(e),this._roundA=s(100*this._a)/100,this},toHsv:function(){var e=m(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=m(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),n=s(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=f(this._r,this._g,this._b),t=s(360*e.h),r=s(100*e.s),n=s(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return b(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[N(s(e).toString(16)),N(s(t).toString(16)),N(s(r).toString(16)),N(I(n))];if(a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:s(this._r),g:s(this._g),b:s(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+s(this._r)+", "+s(this._g)+", "+s(this._b)+")":"rgba("+s(this._r)+", "+s(this._g)+", "+s(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:s(100*P(this._r,255))+"%",g:s(100*P(this._g,255))+"%",b:s(100*P(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%)":"rgba("+s(100*P(this._r,255))+"%, "+s(100*P(this._g,255))+"%, "+s(100*P(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Y[b(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+h(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=p(e);r="#"+h(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return p(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(_,arguments)},desaturate:function(){return this._applyModification(g,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(x,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(M,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(D,arguments)},triad:function(){return this._applyCombination(L,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},p.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:F(e[n]));e=r}return p(e,t)},p.equals=function(e,t){return!(!e||!t)&&p(e).toRgbString()==p(t).toRgbString()},p.random=function(){return p.fromRatio({r:u(),g:u(),b:u()})},p.mix=function(e,t,r){r=0===r?0:r||50;var n=p(e).toRgb(),a=p(t).toRgb(),o=r/100;return p({r:(a.r-n.r)*o+n.r,g:(a.g-n.g)*o+n.g,b:(a.b-n.b)*o+n.b,a:(a.a-n.a)*o+n.a})},p.readability=function(e,t){var r=p(e),n=p(t);return(a.max(r.getLuminance(),n.getLuminance())+.05)/(a.min(r.getLuminance(),n.getLuminance())+.05)},p.isReadable=function(e,t,r){var n,a,o=p.readability(e,t);switch(a=!1,(n=function(e){var t,r;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==r&&"large"!==r&&(r="small");return{level:t,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},p.mostReadable=function(e,t,r){var n,a,o,i,c=null,s=0;a=(r=r||{}).includeFallbackColors,o=r.level,i=r.size;for(var l=0;ls&&(s=n,c=p(t[l]));return p.isReadable(e,c,{level:o,size:i})||!a?c:(r.includeFallbackColors=!1,p.mostReadable(e,["#fff","#000"],r))};var O=p.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Y=p.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(O);function C(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function P(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=l(t,d(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),a.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function j(e){return l(1,d(0,e))}function A(e){return parseInt(e,16)}function N(e){return 1==e.length?"0"+e:""+e}function F(e){return e<=1&&(e=100*e+"%"),e}function I(e){return a.round(255*parseFloat(e)).toString(16)}function H(e){return A(e)/255}var R,z,W,B=(z="[\\s|\\(]+("+(R="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",W="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+z),rgba:new RegExp("rgba"+W),hsl:new RegExp("hsl"+z),hsla:new RegExp("hsla"+W),hsv:new RegExp("hsv"+z),hsva:new RegExp("hsva"+W),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function U(e){return!!B.CSS_UNIT.exec(e)}e.exports?e.exports=p:void 0===(n=function(){return p}.call(t,r,t,e))||(e.exports=n)}(Math)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=s(r(0)),a=s(r(11)),o=s(r(1)),i=s(r(88)),c=s(r(102));function s(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):function(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n div {\n display: inline-block;\n}\n.rdw-left-aligned-block > div {\n display: inline-block;\n}\n.rdw-center-aligned-block > div {\n display: inline-block;\n}\n.rdw-justify-aligned-block > div {\n display: inline-block;\n}\n\n.rdw-colorpicker-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-colorpicker-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 175px;\n height: 175px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-colorpicker-modal-header {\n display: flex;\n padding-bottom: 5px;\n}\n.rdw-colorpicker-modal-style-label {\n font-size: 15px;\n width: 50%;\n text-align: center;\n cursor: pointer;\n padding: 0 10px 5px;\n}\n.rdw-colorpicker-modal-style-label-active {\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-colorpicker-modal-options {\n margin: 5px auto;\n display: flex;\n width: 100%;\n height: 100%;\n flex-wrap: wrap;\n overflow: scroll;\n}\n.rdw-colorpicker-cube {\n width: 22px;\n height: 22px;\n border: 1px solid #F1F1F1;\n}\n.rdw-colorpicker-option {\n margin: 3px;\n padding: 0;\n min-height: 20px;\n border: none;\n width: 22px;\n height: 22px;\n min-width: 22px;\n box-shadow: 1px 2px 1px #BFBDBD inset;\n}\n.rdw-colorpicker-option:hover {\n box-shadow: 1px 2px 1px #BFBDBD;\n}\n.rdw-colorpicker-option:active {\n box-shadow: -1px -2px 1px #BFBDBD;\n}\n.rdw-colorpicker-option-active {\n box-shadow: 0px 0px 2px 2px #BFBDBD;\n}\n\n.rdw-link-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-link-dropdown {\n width: 50px;\n}\n.rdw-link-dropdownOption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-link-dropdownPlaceholder {\n margin-left: 8px;\n}\n.rdw-link-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n height: 205px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-link-modal-label {\n font-size: 15px;\n}\n.rdw-link-modal-input {\n margin-top: 5px;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n height: 25px;\n margin-bottom: 15px;\n padding: 0 5px;\n}\n.rdw-link-modal-input:focus {\n outline: none;\n}\n.rdw-link-modal-buttonsection {\n margin: 0 auto;\n}\n.rdw-link-modal-target-option {\n margin-bottom: 20px;\n}\n.rdw-link-modal-target-option > span {\n margin-left: 5px;\n}\n.rdw-link-modal-btn {\n margin-left: 10px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-link-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-link-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-link-modal-btn:focus {\n outline: none !important;\n}\n.rdw-link-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-link-dropdownoption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-history-dropdown {\n width: 50px;\n}\n\n.rdw-embedded-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-embedded-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n height: 180px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n justify-content: space-between;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-embedded-modal-header {\n font-size: 15px;\n display: flex;\n}\n.rdw-embedded-modal-header-option {\n width: 50%;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n.rdw-embedded-modal-header-label {\n width: 95px;\n border: 1px solid #f1f1f1;\n margin-top: 5px;\n background: #6EB8D4;\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-embedded-modal-link-section {\n display: flex;\n flex-direction: column;\n}\n.rdw-embedded-modal-link-input {\n width: 88%;\n height: 35px;\n margin: 10px 0;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 15px;\n padding: 0 5px;\n}\n.rdw-embedded-modal-link-input-wrapper {\n display: flex;\n align-items: center;\n}\n.rdw-embedded-modal-link-input:focus {\n outline: none;\n}\n.rdw-embedded-modal-btn-section {\n display: flex;\n justify-content: center;\n}\n.rdw-embedded-modal-btn {\n margin: 0 3px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-embedded-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-embedded-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-embedded-modal-btn:focus {\n outline: none !important;\n}\n.rdw-embedded-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-embedded-modal-size {\n align-items: center;\n display: flex;\n margin: 8px 0;\n justify-content: space-between;\n}\n.rdw-embedded-modal-size-input {\n width: 80%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n}\n.rdw-embedded-modal-size-input:focus {\n outline: none;\n}\n\n.rdw-emoji-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-emoji-modal {\n overflow: auto;\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-wrap: wrap;\n width: 235px;\n height: 180px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-emoji-icon {\n margin: 2.5px;\n height: 24px;\n width: 24px;\n cursor: pointer;\n font-size: 22px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.rdw-spinner {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n}\n.rdw-spinner > div {\n width: 12px;\n height: 12px;\n background-color: #333;\n\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;\n animation: sk-bouncedelay 1.4s infinite ease-in-out both;\n}\n.rdw-spinner .rdw-bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.rdw-spinner .rdw-bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%, 80%, 100% { -webkit-transform: scale(0) }\n 40% { -webkit-transform: scale(1.0) }\n}\n@keyframes sk-bouncedelay {\n 0%, 80%, 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n } 40% {\n -webkit-transform: scale(1.0);\n transform: scale(1.0);\n }\n}\n\n.rdw-image-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n.rdw-image-modal {\n position: absolute;\n top: 35px;\n left: 5px;\n display: flex;\n flex-direction: column;\n width: 235px;\n border: 1px solid #F1F1F1;\n padding: 15px;\n border-radius: 2px;\n z-index: 100;\n background: white;\n box-shadow: 3px 3px 5px #BFBDBD;\n}\n.rdw-image-modal-header {\n font-size: 15px;\n margin: 10px 0;\n display: flex;\n}\n.rdw-image-modal-header-option {\n width: 50%;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n}\n.rdw-image-modal-header-label {\n width: 80px;\n background: #f1f1f1;\n border: 1px solid #f1f1f1;\n margin-top: 5px;\n}\n.rdw-image-modal-header-label-highlighted {\n background: #6EB8D4;\n border-bottom: 2px solid #0a66b7;\n}\n.rdw-image-modal-upload-option {\n width: 100%;\n color: gray;\n cursor: pointer;\n display: flex;\n border: none;\n font-size: 15px;\n align-items: center;\n justify-content: center;\n background-color: #f1f1f1;\n outline: 2px dashed gray;\n outline-offset: -10px;\n margin: 10px 0;\n padding: 9px 0;\n}\n.rdw-image-modal-upload-option-highlighted {\n outline: 2px dashed #0a66b7;\n}\n.rdw-image-modal-upload-option-label {\n cursor: pointer;\n height: 100%;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 15px;\n}\n.rdw-image-modal-upload-option-label span{\n padding: 0 20px;\n}\n.rdw-image-modal-upload-option-image-preview {\n max-width: 100%;\n max-height: 200px;\n}\n.rdw-image-modal-upload-option-input {\n\twidth: 0.1px;\n\theight: 0.1px;\n\topacity: 0;\n\toverflow: hidden;\n\tposition: absolute;\n\tz-index: -1;\n}\n.rdw-image-modal-url-section {\n display: flex;\n align-items: center;\n}\n.rdw-image-modal-url-input {\n width: 90%;\n height: 35px;\n margin: 15px 0 12px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 15px;\n padding: 0 5px;\n}\n.rdw-image-modal-btn-section {\n margin: 10px auto 0;\n}\n.rdw-image-modal-url-input:focus {\n outline: none;\n}\n.rdw-image-modal-btn {\n margin: 0 5px;\n width: 75px;\n height: 30px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n cursor: pointer;\n background: white;\n text-transform: capitalize;\n}\n.rdw-image-modal-btn:hover {\n box-shadow: 1px 1px 0px #BFBDBD;\n}\n.rdw-image-modal-btn:active {\n box-shadow: 1px 1px 0px #BFBDBD inset;\n}\n.rdw-image-modal-btn:focus {\n outline: none !important;\n}\n.rdw-image-modal-btn:disabled {\n background: #ece9e9;\n}\n.rdw-image-modal-spinner {\n position: absolute;\n top: -3px;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: 0.5;\n}\n.rdw-image-modal-alt-input {\n width: 70%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n margin-left: 5px;\n}\n.rdw-image-modal-alt-input:focus {\n outline: none;\n}\n.rdw-image-modal-alt-lbl {\n font-size: 12px;\n}\n.rdw-image-modal-size {\n align-items: center;\n display: flex;\n margin: 8px 0;\n justify-content: space-between;\n}\n.rdw-image-modal-size-input {\n width: 40%;\n height: 20px;\n border: 1px solid #F1F1F1;\n border-radius: 2px;\n font-size: 12px;\n}\n.rdw-image-modal-size-input:focus {\n outline: none;\n}\n.rdw-image-mandatory-sign {\n color: red;\n margin-left: 3px;\n margin-right: 3px;\n}\n\n.rdw-remove-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n position: relative;\n flex-wrap: wrap\n}\n\n.rdw-history-wrapper {\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n flex-wrap: wrap\n}\n.rdw-history-dropdownoption {\n height: 40px;\n display: flex;\n justify-content: center;\n}\n.rdw-history-dropdown {\n width: 50px;\n}\n\n.rdw-link-decorator-wrapper {\n position: relative;\n}\n.rdw-link-decorator-icon {\n position: absolute;\n left: 40%;\n top: 0;\n cursor: pointer;\n background-color: white;\n}\n\n.rdw-mention-link {\n text-decoration: none;\n color: #1236ff;\n background-color: #f0fbff;\n padding: 1px 2px;\n border-radius: 2px;\n}\n\n.rdw-suggestion-wrapper {\n position: relative;\n}\n.rdw-suggestion-dropdown {\n position: absolute;\n display: flex;\n flex-direction: column;\n border: 1px solid #F1F1F1;\n min-width: 100px;\n max-height: 150px;\n overflow: auto;\n background: white;\n z-index: 100;\n}\n.rdw-suggestion-option {\n padding: 7px 5px;\n border-bottom: 1px solid #f1f1f1;\n}\n.rdw-suggestion-option-active {\n background-color: #F1F1F1;\n}\n\n.rdw-hashtag-link {\n text-decoration: none;\n color: #1236ff;\n background-color: #f0fbff;\n padding: 1px 2px;\n border-radius: 2px;\n}\n\n.rdw-image-alignment-options-popup {\n position: absolute;\n background: white;\n display: flex;\n padding: 5px 2px;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n width: 105px;\n cursor: pointer;\n z-index: 100;\n}\n.rdw-alignment-option-left {\n justify-content: flex-start;\n}\n.rdw-image-alignment-option {\n height: 15px;\n width: 15px;\n min-width: 15px;\n}\n.rdw-image-alignment {\n position: relative;\n}\n.rdw-image-imagewrapper {\n position: relative;\n}\n.rdw-image-center {\n display: flex;\n justify-content: center;\n}\n.rdw-image-left {\n display: flex;\n}\n.rdw-image-right {\n display: flex;\n justify-content: flex-end;\n}\n.rdw-image-alignment-options-popup-right {\n right: 0;\n}\n\n.rdw-editor-main {\n height: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n.rdw-editor-toolbar {\n padding: 6px 5px 0;\n border-radius: 2px;\n border: 1px solid #F1F1F1;\n display: flex;\n justify-content: flex-start;\n background: white;\n flex-wrap: wrap;\n font-size: 15px;\n margin-bottom: 5px;\n user-select: none;\n}\n.public-DraftStyleDefault-block {\n margin: 1em 0;\n}\n.rdw-editor-wrapper:focus {\n outline: none;\n}\n.rdw-editor-wrapper {\n box-sizing: content-box;\n}\n.rdw-editor-main blockquote {\n border-left: 5px solid #f1f1f1;\n padding-left: 5px;\n}\n.rdw-editor-main pre {\n background: #f1f1f1;\n border-radius: 3px;\n padding: 1px 10px;\n}\n/**\n * Draft v0.9.1\n *\n * Copyright (c) 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n.DraftEditor-editorContainer,.DraftEditor-root,.public-DraftEditor-content{height:inherit;text-align:initial}.public-DraftEditor-content[contenteditable=true]{-webkit-user-modify:read-write-plaintext-only}.DraftEditor-root{position:relative}.DraftEditor-editorContainer{background-color:rgba(255,255,255,0);border-left:.1px solid transparent;position:relative;z-index:1}.public-DraftEditor-block{position:relative}.DraftEditor-alignLeft .public-DraftStyleDefault-block{text-align:left}.DraftEditor-alignLeft .public-DraftEditorPlaceholder-root{left:0;text-align:left}.DraftEditor-alignCenter .public-DraftStyleDefault-block{text-align:center}.DraftEditor-alignCenter .public-DraftEditorPlaceholder-root{margin:0 auto;text-align:center;width:100%}.DraftEditor-alignRight .public-DraftStyleDefault-block{text-align:right}.DraftEditor-alignRight .public-DraftEditorPlaceholder-root{right:0;text-align:right}.public-DraftEditorPlaceholder-root{color:#9197a3;position:absolute;z-index:0}.public-DraftEditorPlaceholder-hasFocus{color:#bdc1c9}.DraftEditorPlaceholder-hidden{display:none}.public-DraftStyleDefault-block{position:relative;white-space:pre-wrap}.public-DraftStyleDefault-ltr{direction:ltr;text-align:left}.public-DraftStyleDefault-rtl{direction:rtl;text-align:right}.public-DraftStyleDefault-listLTR{direction:ltr}.public-DraftStyleDefault-listRTL{direction:rtl}.public-DraftStyleDefault-ol,.public-DraftStyleDefault-ul{margin:16px 0;padding:0}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-listLTR{margin-left:1.5em}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-listRTL{margin-right:1.5em}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-listLTR{margin-left:3em}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-listRTL{margin-right:3em}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-listLTR{margin-left:4.5em}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-listRTL{margin-right:4.5em}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-listLTR{margin-left:6em}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-listRTL{margin-right:6em}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-listLTR{margin-left:7.5em}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-listRTL{margin-right:7.5em}.public-DraftStyleDefault-unorderedListItem{list-style-type:square;position:relative}.public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth0{list-style-type:disc}.public-DraftStyleDefault-unorderedListItem.public-DraftStyleDefault-depth1{list-style-type:circle}.public-DraftStyleDefault-orderedListItem{list-style-type:none;position:relative}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listLTR:before{left:-36px;position:absolute;text-align:right;width:30px}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-listRTL:before{position:absolute;right:-36px;text-align:left;width:30px}.public-DraftStyleDefault-orderedListItem:before{content:counter(ol0) ". ";counter-increment:ol0}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth1:before{content:counter(ol1) ". ";counter-increment:ol1}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth2:before{content:counter(ol2) ". ";counter-increment:ol2}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth3:before{content:counter(ol3) ". ";counter-increment:ol3}.public-DraftStyleDefault-orderedListItem.public-DraftStyleDefault-depth4:before{content:counter(ol4) ". ";counter-increment:ol4}.public-DraftStyleDefault-depth0.public-DraftStyleDefault-reset{counter-reset:ol0}.public-DraftStyleDefault-depth1.public-DraftStyleDefault-reset{counter-reset:ol1}.public-DraftStyleDefault-depth2.public-DraftStyleDefault-reset{counter-reset:ol2}.public-DraftStyleDefault-depth3.public-DraftStyleDefault-reset{counter-reset:ol3}.public-DraftStyleDefault-depth4.public-DraftStyleDefault-reset{counter-reset:ol4}',""]),t.default=a},function(e,t,r){var n=r(77),a=r(789);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},function(e,t,r){"use strict";r.r(t);var n=r(29),a=r.n(n)()(!1);a.push([e.i,'.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n margin-left: -8px;\n position: absolute;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow, .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n box-sizing: content-box;\n position: absolute;\n border: 8px solid transparent;\n height: 0;\n width: 1px;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n content: "";\n z-index: -1;\n border-width: 8px;\n left: -8px;\n border-bottom-color: #aeaeae;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle {\n top: 0;\n margin-top: -8px;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before {\n border-top: none;\n border-bottom-color: #f0f0f0;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle::before {\n top: -1px;\n border-bottom-color: #aeaeae;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n bottom: 0;\n margin-bottom: -8px;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n border-bottom: none;\n border-top-color: #fff;\n}\n\n.react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle::before, .react-datepicker__year-read-view--down-arrow::before,\n.react-datepicker__month-read-view--down-arrow::before,\n.react-datepicker__month-year-read-view--down-arrow::before {\n bottom: -1px;\n border-top-color: #aeaeae;\n}\n\n.react-datepicker-wrapper {\n display: inline-block;\n padding: 0;\n border: 0;\n}\n\n.react-datepicker {\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n font-size: 0.8rem;\n background-color: #fff;\n color: #000;\n border: 1px solid #aeaeae;\n border-radius: 0.3rem;\n display: inline-block;\n position: relative;\n}\n\n.react-datepicker--time-only .react-datepicker__triangle {\n left: 35px;\n}\n\n.react-datepicker--time-only .react-datepicker__time-container {\n border-left: 0;\n}\n\n.react-datepicker--time-only .react-datepicker__time {\n border-radius: 0.3rem;\n}\n\n.react-datepicker--time-only .react-datepicker__time-box {\n border-radius: 0.3rem;\n}\n\n.react-datepicker__triangle {\n position: absolute;\n left: 50px;\n}\n\n.react-datepicker-popper {\n z-index: 1;\n}\n\n.react-datepicker-popper[data-placement^="bottom"] {\n margin-top: 10px;\n}\n\n.react-datepicker-popper[data-placement="bottom-end"] .react-datepicker__triangle, .react-datepicker-popper[data-placement="top-end"] .react-datepicker__triangle {\n left: auto;\n right: 50px;\n}\n\n.react-datepicker-popper[data-placement^="top"] {\n margin-bottom: 10px;\n}\n\n.react-datepicker-popper[data-placement^="right"] {\n margin-left: 8px;\n}\n\n.react-datepicker-popper[data-placement^="right"] .react-datepicker__triangle {\n left: auto;\n right: 42px;\n}\n\n.react-datepicker-popper[data-placement^="left"] {\n margin-right: 8px;\n}\n\n.react-datepicker-popper[data-placement^="left"] .react-datepicker__triangle {\n left: 42px;\n right: auto;\n}\n\n.react-datepicker__header {\n text-align: center;\n background-color: #f0f0f0;\n border-bottom: 1px solid #aeaeae;\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n padding-top: 8px;\n position: relative;\n}\n\n.react-datepicker__header--time {\n padding-bottom: 8px;\n padding-left: 5px;\n padding-right: 5px;\n}\n\n.react-datepicker__year-dropdown-container--select,\n.react-datepicker__month-dropdown-container--select,\n.react-datepicker__month-year-dropdown-container--select,\n.react-datepicker__year-dropdown-container--scroll,\n.react-datepicker__month-dropdown-container--scroll,\n.react-datepicker__month-year-dropdown-container--scroll {\n display: inline-block;\n margin: 0 2px;\n}\n\n.react-datepicker__current-month,\n.react-datepicker-time__header,\n.react-datepicker-year-header {\n margin-top: 0;\n color: #000;\n font-weight: bold;\n font-size: 0.944rem;\n}\n\n.react-datepicker-time__header {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n\n.react-datepicker__navigation {\n background: none;\n line-height: 1.7rem;\n text-align: center;\n cursor: pointer;\n position: absolute;\n top: 10px;\n width: 0;\n padding: 0;\n border: 0.45rem solid transparent;\n z-index: 1;\n height: 10px;\n width: 10px;\n text-indent: -999em;\n overflow: hidden;\n}\n\n.react-datepicker__navigation--previous {\n left: 10px;\n border-right-color: #ccc;\n}\n\n.react-datepicker__navigation--previous:hover {\n border-right-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--previous--disabled, .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__navigation--next {\n right: 10px;\n border-left-color: #ccc;\n}\n\n.react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {\n right: 80px;\n}\n\n.react-datepicker__navigation--next:hover {\n border-left-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--next--disabled, .react-datepicker__navigation--next--disabled:hover {\n border-left-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__navigation--years {\n position: relative;\n top: 0;\n display: block;\n margin-left: auto;\n margin-right: auto;\n}\n\n.react-datepicker__navigation--years-previous {\n top: 4px;\n border-top-color: #ccc;\n}\n\n.react-datepicker__navigation--years-previous:hover {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__navigation--years-upcoming {\n top: -4px;\n border-bottom-color: #ccc;\n}\n\n.react-datepicker__navigation--years-upcoming:hover {\n border-bottom-color: #b3b3b3;\n}\n\n.react-datepicker__month-container {\n float: left;\n}\n\n.react-datepicker__year-container {\n margin: 0.4rem;\n text-align: center;\n display: flex;\n flex-wrap: wrap;\n}\n\n.react-datepicker__year-container-text {\n display: inline-block;\n cursor: pointer;\n flex: 1 0 30%;\n width: 12px;\n padding: 2px;\n}\n\n.react-datepicker__month {\n margin: 0.4rem;\n text-align: center;\n}\n\n.react-datepicker__month .react-datepicker__month-text,\n.react-datepicker__month .react-datepicker__quarter-text {\n display: inline-block;\n width: 4rem;\n margin: 2px;\n}\n\n.react-datepicker__input-time-container {\n clear: both;\n width: 100%;\n float: left;\n margin: 5px 0 10px 15px;\n text-align: left;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__caption {\n display: inline-block;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container {\n display: inline-block;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input {\n display: inline-block;\n margin-left: 10px;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input {\n width: 85px;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"]::-webkit-inner-spin-button,\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__input input[type="time"] {\n -moz-appearance: textfield;\n}\n\n.react-datepicker__input-time-container .react-datepicker-time__input-container .react-datepicker-time__delimiter {\n margin-left: 5px;\n display: inline-block;\n}\n\n.react-datepicker__time-container {\n float: right;\n border-left: 1px solid #aeaeae;\n width: 85px;\n}\n\n.react-datepicker__time-container--with-today-button {\n display: inline;\n border: 1px solid #aeaeae;\n border-radius: 0.3rem;\n position: absolute;\n right: -72px;\n top: 0;\n}\n\n.react-datepicker__time-container .react-datepicker__time {\n position: relative;\n background: white;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box {\n width: 85px;\n overflow-x: hidden;\n margin: 0 auto;\n text-align: center;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list {\n list-style: none;\n margin: 0;\n height: calc(195px + (1.7rem / 2));\n overflow-y: scroll;\n padding-right: 0px;\n padding-left: 0px;\n width: 100%;\n box-sizing: content-box;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item {\n height: 30px;\n padding: 5px 10px;\n white-space: nowrap;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover {\n cursor: pointer;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected {\n background-color: #216ba5;\n color: white;\n font-weight: bold;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected:hover {\n background-color: #216ba5;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled {\n color: #ccc;\n}\n\n.react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled:hover {\n cursor: default;\n background-color: transparent;\n}\n\n.react-datepicker__week-number {\n color: #ccc;\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n}\n\n.react-datepicker__week-number.react-datepicker__week-number--clickable {\n cursor: pointer;\n}\n\n.react-datepicker__week-number.react-datepicker__week-number--clickable:hover {\n border-radius: 0.3rem;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__day-names,\n.react-datepicker__week {\n white-space: nowrap;\n}\n\n.react-datepicker__day-name,\n.react-datepicker__day,\n.react-datepicker__time-name {\n color: #000;\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n}\n\n.react-datepicker__month--selected, .react-datepicker__month--in-selecting-range, .react-datepicker__month--in-range,\n.react-datepicker__quarter--selected,\n.react-datepicker__quarter--in-selecting-range,\n.react-datepicker__quarter--in-range,\n.react-datepicker__year-container-text--selected,\n.react-datepicker__year-container-text--in-selecting-range,\n.react-datepicker__year-container-text--in-range {\n border-radius: 0.3rem;\n background-color: #216ba5;\n color: #fff;\n}\n\n.react-datepicker__month--selected:hover, .react-datepicker__month--in-selecting-range:hover, .react-datepicker__month--in-range:hover,\n.react-datepicker__quarter--selected:hover,\n.react-datepicker__quarter--in-selecting-range:hover,\n.react-datepicker__quarter--in-range:hover,\n.react-datepicker__year-container-text--selected:hover,\n.react-datepicker__year-container-text--in-selecting-range:hover,\n.react-datepicker__year-container-text--in-range:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__month--disabled,\n.react-datepicker__quarter--disabled,\n.react-datepicker__year-container-text--disabled {\n color: #ccc;\n pointer-events: none;\n}\n\n.react-datepicker__month--disabled:hover,\n.react-datepicker__quarter--disabled:hover,\n.react-datepicker__year-container-text--disabled:hover {\n cursor: default;\n background-color: transparent;\n}\n\n.react-datepicker__day,\n.react-datepicker__month-text,\n.react-datepicker__quarter-text {\n cursor: pointer;\n}\n\n.react-datepicker__day:hover,\n.react-datepicker__month-text:hover,\n.react-datepicker__quarter-text:hover {\n border-radius: 0.3rem;\n background-color: #f0f0f0;\n}\n\n.react-datepicker__day--today,\n.react-datepicker__month-text--today,\n.react-datepicker__quarter-text--today {\n font-weight: bold;\n}\n\n.react-datepicker__day--highlighted,\n.react-datepicker__month-text--highlighted,\n.react-datepicker__quarter-text--highlighted {\n border-radius: 0.3rem;\n background-color: #3dcc4a;\n color: #fff;\n}\n\n.react-datepicker__day--highlighted:hover,\n.react-datepicker__month-text--highlighted:hover,\n.react-datepicker__quarter-text--highlighted:hover {\n background-color: #32be3f;\n}\n\n.react-datepicker__day--highlighted-custom-1,\n.react-datepicker__month-text--highlighted-custom-1,\n.react-datepicker__quarter-text--highlighted-custom-1 {\n color: magenta;\n}\n\n.react-datepicker__day--highlighted-custom-2,\n.react-datepicker__month-text--highlighted-custom-2,\n.react-datepicker__quarter-text--highlighted-custom-2 {\n color: green;\n}\n\n.react-datepicker__day--selected, .react-datepicker__day--in-selecting-range, .react-datepicker__day--in-range,\n.react-datepicker__month-text--selected,\n.react-datepicker__month-text--in-selecting-range,\n.react-datepicker__month-text--in-range,\n.react-datepicker__quarter-text--selected,\n.react-datepicker__quarter-text--in-selecting-range,\n.react-datepicker__quarter-text--in-range {\n border-radius: 0.3rem;\n background-color: #216ba5;\n color: #fff;\n}\n\n.react-datepicker__day--selected:hover, .react-datepicker__day--in-selecting-range:hover, .react-datepicker__day--in-range:hover,\n.react-datepicker__month-text--selected:hover,\n.react-datepicker__month-text--in-selecting-range:hover,\n.react-datepicker__month-text--in-range:hover,\n.react-datepicker__quarter-text--selected:hover,\n.react-datepicker__quarter-text--in-selecting-range:hover,\n.react-datepicker__quarter-text--in-range:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__day--keyboard-selected,\n.react-datepicker__month-text--keyboard-selected,\n.react-datepicker__quarter-text--keyboard-selected {\n border-radius: 0.3rem;\n background-color: #2a87d0;\n color: #fff;\n}\n\n.react-datepicker__day--keyboard-selected:hover,\n.react-datepicker__month-text--keyboard-selected:hover,\n.react-datepicker__quarter-text--keyboard-selected:hover {\n background-color: #1d5d90;\n}\n\n.react-datepicker__day--in-selecting-range ,\n.react-datepicker__month-text--in-selecting-range ,\n.react-datepicker__quarter-text--in-selecting-range {\n background-color: rgba(33, 107, 165, 0.5);\n}\n\n.react-datepicker__month--selecting-range .react-datepicker__day--in-range , .react-datepicker__month--selecting-range\n.react-datepicker__month-text--in-range , .react-datepicker__month--selecting-range\n.react-datepicker__quarter-text--in-range {\n background-color: #f0f0f0;\n color: #000;\n}\n\n.react-datepicker__day--disabled,\n.react-datepicker__month-text--disabled,\n.react-datepicker__quarter-text--disabled {\n cursor: default;\n color: #ccc;\n}\n\n.react-datepicker__day--disabled:hover,\n.react-datepicker__month-text--disabled:hover,\n.react-datepicker__quarter-text--disabled:hover {\n background-color: transparent;\n}\n\n.react-datepicker__month-text.react-datepicker__month--selected:hover, .react-datepicker__month-text.react-datepicker__month--in-range:hover, .react-datepicker__month-text.react-datepicker__quarter--selected:hover, .react-datepicker__month-text.react-datepicker__quarter--in-range:hover,\n.react-datepicker__quarter-text.react-datepicker__month--selected:hover,\n.react-datepicker__quarter-text.react-datepicker__month--in-range:hover,\n.react-datepicker__quarter-text.react-datepicker__quarter--selected:hover,\n.react-datepicker__quarter-text.react-datepicker__quarter--in-range:hover {\n background-color: #216ba5;\n}\n\n.react-datepicker__month-text:hover,\n.react-datepicker__quarter-text:hover {\n background-color: #f0f0f0;\n}\n\n.react-datepicker__input-container {\n position: relative;\n display: inline-block;\n width: 100%;\n}\n\n.react-datepicker__year-read-view,\n.react-datepicker__month-read-view,\n.react-datepicker__month-year-read-view {\n border: 1px solid transparent;\n border-radius: 0.3rem;\n}\n\n.react-datepicker__year-read-view:hover,\n.react-datepicker__month-read-view:hover,\n.react-datepicker__month-year-read-view:hover {\n cursor: pointer;\n}\n\n.react-datepicker__year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__year-read-view:hover .react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view:hover .react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-year-read-view:hover .react-datepicker__month-read-view--down-arrow {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__year-read-view--down-arrow,\n.react-datepicker__month-read-view--down-arrow,\n.react-datepicker__month-year-read-view--down-arrow {\n border-top-color: #ccc;\n float: right;\n margin-left: 20px;\n top: 8px;\n position: relative;\n border-width: 0.45rem;\n}\n\n.react-datepicker__year-dropdown,\n.react-datepicker__month-dropdown,\n.react-datepicker__month-year-dropdown {\n background-color: #f0f0f0;\n position: absolute;\n width: 50%;\n left: 25%;\n top: 30px;\n z-index: 1;\n text-align: center;\n border-radius: 0.3rem;\n border: 1px solid #aeaeae;\n}\n\n.react-datepicker__year-dropdown:hover,\n.react-datepicker__month-dropdown:hover,\n.react-datepicker__month-year-dropdown:hover {\n cursor: pointer;\n}\n\n.react-datepicker__year-dropdown--scrollable,\n.react-datepicker__month-dropdown--scrollable,\n.react-datepicker__month-year-dropdown--scrollable {\n height: 150px;\n overflow-y: scroll;\n}\n\n.react-datepicker__year-option,\n.react-datepicker__month-option,\n.react-datepicker__month-year-option {\n line-height: 20px;\n width: 100%;\n display: block;\n margin-left: auto;\n margin-right: auto;\n}\n\n.react-datepicker__year-option:first-of-type,\n.react-datepicker__month-option:first-of-type,\n.react-datepicker__month-year-option:first-of-type {\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n}\n\n.react-datepicker__year-option:last-of-type,\n.react-datepicker__month-option:last-of-type,\n.react-datepicker__month-year-option:last-of-type {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n border-bottom-left-radius: 0.3rem;\n border-bottom-right-radius: 0.3rem;\n}\n\n.react-datepicker__year-option:hover,\n.react-datepicker__month-option:hover,\n.react-datepicker__month-year-option:hover {\n background-color: #ccc;\n}\n\n.react-datepicker__year-option:hover .react-datepicker__navigation--years-upcoming,\n.react-datepicker__month-option:hover .react-datepicker__navigation--years-upcoming,\n.react-datepicker__month-year-option:hover .react-datepicker__navigation--years-upcoming {\n border-bottom-color: #b3b3b3;\n}\n\n.react-datepicker__year-option:hover .react-datepicker__navigation--years-previous,\n.react-datepicker__month-option:hover .react-datepicker__navigation--years-previous,\n.react-datepicker__month-year-option:hover .react-datepicker__navigation--years-previous {\n border-top-color: #b3b3b3;\n}\n\n.react-datepicker__year-option--selected,\n.react-datepicker__month-option--selected,\n.react-datepicker__month-year-option--selected {\n position: absolute;\n left: 15px;\n}\n\n.react-datepicker__close-icon {\n cursor: pointer;\n background-color: transparent;\n border: 0;\n outline: 0;\n padding: 0px 6px 0px 0px;\n position: absolute;\n top: 0;\n right: 0;\n height: 100%;\n display: table-cell;\n vertical-align: middle;\n}\n\n.react-datepicker__close-icon::after {\n cursor: pointer;\n background-color: #216ba5;\n color: #fff;\n border-radius: 50%;\n height: 16px;\n width: 16px;\n padding: 2px;\n font-size: 12px;\n line-height: 1;\n text-align: center;\n display: table-cell;\n vertical-align: middle;\n content: "\\00d7";\n}\n\n.react-datepicker__today-button {\n background: #f0f0f0;\n border-top: 1px solid #aeaeae;\n cursor: pointer;\n text-align: center;\n font-weight: bold;\n padding: 5px 0;\n clear: left;\n}\n\n.react-datepicker__portal {\n position: fixed;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n left: 0;\n top: 0;\n justify-content: center;\n align-items: center;\n display: flex;\n z-index: 2147483647;\n}\n\n.react-datepicker__portal .react-datepicker__day-name,\n.react-datepicker__portal .react-datepicker__day,\n.react-datepicker__portal .react-datepicker__time-name {\n width: 3rem;\n line-height: 3rem;\n}\n\n@media (max-width: 400px), (max-height: 550px) {\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 2rem;\n line-height: 2rem;\n }\n}\n\n.react-datepicker__portal .react-datepicker__current-month,\n.react-datepicker__portal .react-datepicker-time__header {\n font-size: 1.44rem;\n}\n\n.react-datepicker__portal .react-datepicker__navigation {\n border: 0.81rem solid transparent;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous {\n border-right-color: #ccc;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous:hover {\n border-right-color: #b3b3b3;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--previous--disabled, .react-datepicker__portal .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: #e6e6e6;\n cursor: default;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next {\n border-left-color: #ccc;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next:hover {\n border-left-color: #b3b3b3;\n}\n\n.react-datepicker__portal .react-datepicker__navigation--next--disabled, .react-datepicker__portal .react-datepicker__navigation--next--disabled:hover {\n border-left-color: #e6e6e6;\n cursor: default;\n}\n',""]),t.default=a},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return a}));var n=r(3);function a(e){return Object(n.a)(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(197),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(198),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(104),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(199),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(105),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(200),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(n.a)(t);return Object(a.default)(e,-r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getSeconds();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getMinutes();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getHours();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getDay();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getDate();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getMonth();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=Math.floor(t.getMonth()/3)+1;return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getFullYear();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){Object(a.a)(1,arguments);var t=Object(n.default)(e),r=t.getTime();return r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setSeconds(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setMinutes(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return r.setHours(i),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return c}));var n=r(6),a=r(5),o=r(202),i=r(3);function c(e,t){Object(i.a)(2,arguments);var r=Object(a.default)(e),c=Object(n.a)(t),s=Math.floor(r.getMonth()/3)+1,l=c-s;return Object(o.default)(r,r.getMonth()+3*l)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return i}));var n=r(6),a=r(5),o=r(3);function i(e,t){Object(o.a)(2,arguments);var r=Object(a.default)(e),i=Object(n.a)(t);return isNaN(r)?new Date(NaN):(r.setFullYear(i),r)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){var t,r;if(Object(a.a)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Object(n.default)(e);(void 0===r||r>t||isNaN(t))&&(r=t)})),r||new Date(NaN)}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e){var t,r;if(Object(a.a)(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!=typeof e||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Object(n.default)(e);(void 0===r||r=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var d=Object(n.default)(e),u=d.getDay(),p=6+(uo.getTime()}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return o}));var n=r(5),a=r(3);function o(e,t){Object(a.a)(2,arguments);var r=Object(n.default)(e),o=Object(n.default)(t);return r.getTime()=i&&o<=c}},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return l}));var n=r(6),a=r(3),o={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},i=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,c=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,s=/^([+-])(\d{2})(?::?(\d{2}))?$/;function l(e,t){Object(a.a)(1,arguments);var r=t||{},o=null==r.additionalDigits?2:Object(n.a)(r.additionalDigits);if(2!==o&&1!==o&&0!==o)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var i,c=d(e);if(c.date){var s=u(c.date,o);i=p(s.restDateString,s.year)}if(isNaN(i)||!i)return new Date(NaN);var l,f=i.getTime(),b=0;if(c.time&&(b=m(c.time),isNaN(b)||null===b))return new Date(NaN);if(!c.timezone){var g=new Date(f+b),v=new Date(g.getUTCFullYear(),g.getUTCMonth(),g.getUTCDate(),g.getUTCHours(),g.getUTCMinutes(),g.getUTCSeconds(),g.getUTCMilliseconds());return v.setFullYear(g.getUTCFullYear()),v}return l=h(c.timezone),isNaN(l)?new Date(NaN):new Date(f+b+l)}function d(e){var t,r={},n=e.split(o.dateTimeDelimiter);if(/:/.test(n[0])?(r.date=null,t=n[0]):(r.date=n[0],t=n[1],o.timeZoneDelimiter.test(r.date)&&(r.date=e.split(o.timeZoneDelimiter)[0],t=e.substr(r.date.length,e.length))),t){var a=o.timezone.exec(t);a?(r.time=t.replace(a[1],""),r.timezone=a[1]):r.time=t}return r}function u(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:null};var a=n[1]&&parseInt(n[1]),o=n[2]&&parseInt(n[2]);return{year:null==o?a:100*o,restDateString:e.slice((n[1]||n[2]).length)}}function p(e,t){if(null===t)return null;var r=e.match(i);if(!r)return null;var n=!!r[4],a=f(r[1]),o=f(r[2])-1,c=f(r[3]),s=f(r[4]),l=f(r[5])-1;if(n)return function(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}(0,s,l)?function(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var a=n.getUTCDay()||7,o=7*(t-1)+r+1-a;return n.setUTCDate(n.getUTCDate()+o),n}(t,s,l):new Date(NaN);var d=new Date(0);return function(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(g[t]||(v(e)?29:28))}(t,o,c)&&function(e,t){return t>=1&&t<=(v(e)?366:365)}(t,a)?(d.setUTCFullYear(t,o,Math.max(a,c)),d):new Date(NaN)}function f(e){return e?parseInt(e):1}function m(e){var t=e.match(c);if(!t)return null;var r=b(t[1]),n=b(t[2]),a=b(t[3]);return function(e,t,r){if(24===e)return 0===t&&0===r;return r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}(r,n,a)?36e5*r+6e4*n+1e3*a:NaN}function b(e){return e&&parseFloat(e.replace(",","."))||0}function h(e){if("Z"===e)return 0;var t=e.match(s);if(!t)return 0;var r="+"===t[1]?-1:1,n=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,a)?r*(36e5*n+6e4*a):NaN}var g=[31,null,31,30,31,30,31,31,30,31,30,31];function v(e){return e%400==0||e%4==0&&e%100}},function(e,t,r){"use strict";r.r(t),r.d(t,"IGNORE_CLASS_NAME",(function(){return p}));var n=r(0),a=r(11);function o(e,t,r){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(r):e.classList.contains(r))}var i,c,s=(void 0===i&&(i=0),function(){return++i}),l={},d={},u=["touchstart","touchmove"],p="ignore-react-onclickoutside";function f(e,t){var r=null;return-1!==u.indexOf(t)&&c&&(r={passive:!e.props.preventDefault}),r}t.default=function(e,t){var r,i,u=e.displayName||e.name||"Component";return i=r=function(r){var i,p;function m(e){var n;return(n=r.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof n.__clickOutsideHandlerProp){var t=n.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+u+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else n.__clickOutsideHandlerProp(e)},n.__getComponentNode=function(){var e=n.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(a.findDOMNode)(e)},n.enableOnClickOutside=function(){if("undefined"!=typeof document&&!d[n._uid]){void 0===c&&(c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),r=function(){};return window.addEventListener("testPassiveEventSupport",r,t),window.removeEventListener("testPassiveEventSupport",r,t),e}}()),d[n._uid]=!0;var e=n.props.eventTypes;e.forEach||(e=[e]),l[n._uid]=function(e){var t;null!==n.componentNode&&(n.props.preventDefault&&e.preventDefault(),n.props.stopPropagation&&e.stopPropagation(),n.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,r){if(e===t)return!0;for(;e.parentNode;){if(o(e,t,r))return!0;e=e.parentNode}return e}(e.target,n.componentNode,n.props.outsideClickIgnoreClass)===document&&n.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,l[n._uid],f(n,e))}))}},n.disableOnClickOutside=function(){delete d[n._uid];var e=l[n._uid];if(e&&"undefined"!=typeof document){var t=n.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,f(n,t))})),delete l[n._uid]}},n.getRef=function(e){return n.instanceRef=e},n._uid=s(),n}p=r,(i=m).prototype=Object.create(p.prototype),i.prototype.constructor=i,i.__proto__=p;var b=m.prototype;return b.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},b.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+u+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},b.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},b.componentWillUnmount=function(){this.disableOnClickOutside()},b.render=function(){var t=this.props,r=(t.excludeScrollbar,function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?r.ref=this.getRef:r.wrappedRef=this.getRef,r.disableOnClickOutside=this.disableOnClickOutside,r.enableOnClickOutside=this.enableOnClickOutside,Object(n.createElement)(e,r)},m}(n.Component),r.displayName="OnClickOutside("+u+")",r.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:p,preventDefault:!1,stopPropagation:!1},r.getClass=function(){return e.getClass?e.getClass():e},i}},function(e,t,r){"use strict";var n;if(!Object.keys){var a=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=r(405),c=Object.prototype.propertyIsEnumerable,s=!c.call({toString:null},"toString"),l=c.call((function(){}),"prototype"),d=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],u=function(e){var t=e.constructor;return t&&t.prototype===e},p={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!p["$"+e]&&a.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{u(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=i(e),c=t&&"[object String]"===o.call(e),p=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var m=l&&r;if(c&&e.length>0&&!a.call(e,0))for(var b=0;b0)for(var h=0;h=0&&"[object Array]"!==a.call(e)&&"[object Function]"===a.call(e.callee)},c=function(){return o(arguments)}();o.isLegacyArguments=i,e.exports=c?o:i},function(e,t,r){"use strict";var n=r(103),a=r(835),o=r(408),i=r(409),c=r(839),s=a(i(),Object);n(s,{getPolyfill:i,implementation:o,shim:c}),e.exports=s},function(e,t,r){"use strict";e.exports=r(192)},function(e,t,r){"use strict";var n="Function.prototype.bind called on incompatible ",a=Array.prototype.slice,o=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==o.call(t))throw new TypeError(n+t);for(var r,i=a.call(arguments,1),c=function(){if(this instanceof r){var n=t.apply(this,i.concat(a.call(arguments)));return Object(n)===n?n:this}return t.apply(e,i.concat(a.call(arguments)))},s=Math.max(0,t.length-i.length),l=[],d=0;d-1?a(r):r}},function(e,t,r){"use strict";var n=r(103),a=r(192),o=r(410),i=r(411),c=r(843),s=a(o);n(s,{getPolyfill:i,implementation:o,shim:c}),e.exports=s},function(e,t,r){"use strict";var n=r(103).supportsDescriptors,a=r(411),o=Object.getOwnPropertyDescriptor,i=Object.defineProperty,c=TypeError,s=Object.getPrototypeOf,l=/a/;e.exports=function(){if(!n||!s)throw new c("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=a(),t=s(l),r=o(t,"flags");return r&&r.get===e||i(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},function(e,t,r){"use strict";var n=Date.prototype.getDay,a=Object.prototype.toString,o="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){return"object"==typeof e&&null!==e&&(o?function(e){try{return n.call(e),!0}catch(e){return!1}}(e):"[object Date]"===a.call(e))}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(0),a=(i(n),i(r(1))),o=i(r(846));i(r(201));function i(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function d(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}t.default=function(e,t){var r,i,u="__create-react-context-"+(0,o.default)()+"__",p=function(e){function r(){var t,n;c(this,r);for(var a=arguments.length,o=Array(a),i=0;i0&&void 0!==r[0])||r[0],e.abrupt("return",this.apiCall("notifications/fetch",{new:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"markNotificationsSeen",value:(E=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("notifications/seen"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"getUser",value:(L=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/get",{id:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"deleteUser",value:(M=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/delete",{id:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"fetchUsers",value:(x=s(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:1,r=n.length>1&&void 0!==n[1]?n[1]:20,e.abrupt("return",this.apiCall("user/fetch",{page:t,count:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:"fetchGroups",value:(_=s(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:1,r=n.length>1&&void 0!==n[1]?n[1]:20,e.abrupt("return",this.apiCall("groups/fetch",{page:t,count:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"inviteUser",value:(k=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/invite",{username:t,email:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"createUser",value:(w=s(regeneratorRuntime.mark((function e(t,r,n,a){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("user/create",{username:t,email:r,password:n,confirmPassword:a}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return w.apply(this,arguments)})},{key:"getStats",value:(y=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("stats"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getRoutes",value:(v=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("routes/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"saveRoutes",value:(g=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("routes/save",{routes:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"createGroup",value:(h=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("groups/create",{name:t,color:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"deleteGroup",value:(b=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("groups/delete",{id:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"getSettings",value:(m=s(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"",e.abrupt("return",this.apiCall("settings/get",{key:t}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return m.apply(this,arguments)})},{key:"saveSettings",value:(f=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("settings/set",{settings:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"sendTestMail",value:(p=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("mail/test",{receiver:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"fetchPermissions",value:(u=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("permission/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"savePermissions",value:(d=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("permission/save",{permissions:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"getVisitors",value:(c=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("visitors/stats",{type:t,date:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"fetchContactRequests",value:(i=s(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/fetch"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"getContactMessages",value:(o=s(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/get",{requestId:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"sendContactMessage",value:(a=s(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.apiCall("contact/respond",{requestId:t,message:r}));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})}])&&l(t.prototype,r),n&&l(t,n),e}();function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0;d--){var u=a[d];"."===u?x(a,d):".."===u?(x(a,d),l++):l&&(x(a,d),l--)}if(!c)for(;l--;l)a.unshift("..");!c||""===a[0]||a[0]&&_(a[0])||a.unshift("");var p=a.join("/");return r&&"/"!==p.substr(-1)&&(p+="/"),p};var L=function(e,t){if(!e)throw new Error("Invariant failed")};function E(e){return"/"===e.charAt(0)?e:"/"+e}function D(e){return"/"===e.charAt(0)?e.substr(1):e}function S(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function T(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function O(e){var t=e.pathname,r=e.search,n=e.hash,a=t||"/";return r&&"?"!==r&&(a+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(a+="#"===n.charAt(0)?n:"#"+n),a}function Y(e,t,r,n){var a;"string"==typeof e?(a=function(e){var t=e||"/",r="",n="",a=t.indexOf("#");-1!==a&&(n=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(r=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===r?"":r,hash:"#"===n?"":n}}(e)).state=t:(void 0===(a=k({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return r&&(a.key=r),n?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=M(a.pathname,n.pathname)):a.pathname=n.pathname:a.pathname||(a.pathname="/"),a}function C(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,r,n,a){if(null!=e){var o="function"==typeof e?e(t,r):e;"string"==typeof o?"function"==typeof n?n(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var r=!0;function n(){r&&e.apply(void 0,arguments)}return t.push(n),function(){r=!1,t=t.filter((function(e){return e!==n}))}},notifyListeners:function(){for(var e=arguments.length,r=new Array(e),n=0;nt?r.splice(t,r.length-t,n):r.push(n),d({action:"PUSH",location:n,index:t,entries:r})}}))},replace:function(e,t){var n=Y(e,t,u(),h.location);l.confirmTransitionTo(n,"REPLACE",r,(function(e){e&&(h.entries[h.index]=n,d({action:"REPLACE",location:n}))}))},go:b,goBack:function(){b(-1)},goForward:function(){b(1)},canGo:function(e){var t=h.index+e;return t>=0&&t=0||(a[r]=e[r]);return a}r(412);var J=function(e){var t=Object(U.a)();return t.displayName=e,t}("Router-History"),$=function(e){var t=Object(U.a)();return t.displayName=e,t}("Router"),K=function(e){function t(t){var r;return(r=e.call(this,t)||this).state={location:t.history.location},r._isMounted=!1,r._pendingLocation=null,t.staticContext||(r.unlisten=t.history.listen((function(e){r._isMounted?r.setState({location:e}):r._pendingLocation=e}))),r}Object(v.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var r=t.prototype;return r.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},r.componentWillUnmount=function(){this.unlisten&&this.unlisten()},r.render=function(){return a.a.createElement($.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.a.createElement(J.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.a.Component);a.a.Component;a.a.Component;var X={},Q=0;function Z(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var r=t,n=r.path,a=r.exact,o=void 0!==a&&a,i=r.strict,c=void 0!==i&&i,s=r.sensitive,l=void 0!==s&&s;return[].concat(n).reduce((function(t,r){if(!r&&""!==r)return null;if(t)return t;var n=function(e,t){var r=""+t.end+t.strict+t.sensitive,n=X[r]||(X[r]={});if(n[e])return n[e];var a=[],o={regexp:q()(e,a,t),keys:a};return Q<1e4&&(n[e]=o,Q++),o}(r,{end:o,strict:c,sensitive:l}),a=n.regexp,i=n.keys,s=a.exec(e);if(!s)return null;var d=s[0],u=s.slice(1),p=e===d;return o&&!p?null:{path:r,url:"/"===r&&""===d?"/":d,isExact:p,params:i.reduce((function(e,t,r){return e[t.name]=u[r],e}),{})}}),null)}var ee=function(e){function t(){return e.apply(this,arguments)||this}return Object(v.a)(t,e),t.prototype.render=function(){var e=this;return a.a.createElement($.Consumer,null,(function(t){t||L(!1);var r=e.props.location||t.location,n=k({},t,{location:r,match:e.props.computedMatch?e.props.computedMatch:e.props.path?Z(r.pathname,e.props):t.match}),o=e.props,i=o.children,c=o.component,s=o.render;return Array.isArray(i)&&0===i.length&&(i=null),a.a.createElement($.Provider,{value:n},n.match?i?"function"==typeof i?i(n):i:c?a.a.createElement(c,n):s?s(n):null:"function"==typeof i?i(n):null)}))},t}(a.a.Component);function te(e){return"/"===e.charAt(0)?e:"/"+e}function re(e,t){if(!e)return t;var r=te(e);return 0!==t.pathname.indexOf(r)?t:k({},t,{pathname:t.pathname.substr(r.length)})}function ne(e){return"string"==typeof e?e:O(e)}function ae(e){return function(){L(!1)}}function oe(){}a.a.Component;var ie=function(e){function t(){return e.apply(this,arguments)||this}return Object(v.a)(t,e),t.prototype.render=function(){var e=this;return a.a.createElement($.Consumer,null,(function(t){t||L(!1);var r,n,o=e.props.location||t.location;return a.a.Children.forEach(e.props.children,(function(e){if(null==n&&a.a.isValidElement(e)){r=e;var i=e.props.path||e.props.from;n=i?Z(o.pathname,k({},e.props,{path:i})):t.match}})),n?a.a.cloneElement(r,{location:o,computedMatch:n}):null}))},t}(a.a.Component);var ce=a.a.useContext;function se(){return ce($).location}var le=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&(s=c+" new notification");for(var l=[],d=0;d0?"block":"none"}},c)),n.createElement("div",{className:"dropdown-menu dropdown-menu-lg dropdown-menu-right "+(a?" show":"")},n.createElement("span",{className:"dropdown-item dropdown-header"},s),l,n.createElement("div",{className:"dropdown-divider"}),n.createElement(be,{to:"/admin/logs",className:"dropdown-item dropdown-footer"},"See All Notifications")))))}function _e(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return xe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xe(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(n>9&&(n="9+"),r.logs.badge={type:"warning",value:n}),console.log("sidebar",t.contactRequests);var o,i=0,c=_e(t.contactRequests);try{for(c.s();!(o=c.n()).done;){i+=o.value.unread}}catch(e){c.e(e)}finally{c.f()}i>0&&(r.contact.badge={type:"info",value:i});var s=[];for(var l in r){var d=r[l],u=d.badge?a.a.createElement("span",{className:"right badge badge-"+d.badge.type},d.badge.value):a.a.createElement(a.a.Fragment,null);s.push(a.a.createElement("li",{key:l,className:"nav-item"},a.a.createElement(ve,{to:"/admin/"+l,className:"nav-link",activeClassName:"active"},a.a.createElement(m,{icon:d.icon,className:"nav-icon"}),a.a.createElement("p",null,d.name,u))))}return s.push(a.a.createElement("li",{className:"nav-item",key:"logout"},a.a.createElement("a",{href:"#",onClick:function(){t.api.logout().then((function(e){e.success?document.location="/admin":t.showDialog("Error logging out: "+e.msg,"Error logging out")}))},className:"nav-link"},a.a.createElement(m,{icon:"arrow-left",className:"nav-icon"}),a.a.createElement("p",null,"Logout")))),a.a.createElement("aside",{className:"main-sidebar sidebar-dark-primary elevation-4"},a.a.createElement(be,{href:"#",className:"brand-link",to:"/admin/dashboard"},a.a.createElement("img",{src:"/img/icons/logo.png",alt:"Logo",className:"brand-image img-circle elevation-3",style:{opacity:".8"}}),a.a.createElement("span",{className:"brand-text font-weight-light ml-2"},"WebBase")),a.a.createElement("div",{className:"sidebar os-host os-theme-light os-host-overflow os-host-overflow-y os-host-resize-disabled os-host-scrollbar-horizontal-hidden os-host-transition"},a.a.createElement("div",{className:"os-resize-observer-host"},a.a.createElement("div",{className:"os-resize-observer observed",style:{left:"0px",right:"auto"}})),a.a.createElement("div",{className:"os-size-auto-observer",style:{height:"calc(100% + 1px)",float:"left"}},a.a.createElement("div",{className:"os-resize-observer observed"})),a.a.createElement("div",{className:"os-content-glue",style:{margin:"0px -8px"}}),a.a.createElement("div",{className:"os-padding"},a.a.createElement("div",{className:"os-viewport os-viewport-native-scrollbars-invisible",style:{right:"0px",bottom:"0px"}},a.a.createElement("div",{className:"os-content",style:{padding:"0px 0px",height:"100%",width:"100%"}},a.a.createElement("div",{className:"user-panel mt-3 pb-3 mb-3 d-flex"},a.a.createElement("div",{className:"info"},a.a.createElement("a",{href:"#",className:"d-block"},"Logged in as: ",t.api.user.name))),a.a.createElement("nav",{className:"mt-2"},a.a.createElement("ul",{className:"nav nav-pills nav-sidebar flex-column","data-widget":"treeview",role:"menu","data-accordion":"false"},s)))))))}function Le(e){var t=e.onClose||null,r=e.title||"Untitled Alert",n=e.message||"Alert message",o=e.type||"danger",i="ban";return"warning"===o?i="exclamation-triangle":"success"===o&&(i="check"),a.a.createElement("div",{className:"alert alert-"+o+" alert-dismissible"},t?a.a.createElement("button",{type:"button",className:"close","data-dismiss":"alert","aria-hidden":"true",onClick:t},"×"):null,a.a.createElement("h5",null,a.a.createElement(m,{icon:i,className:"icon"})," ",r),n)}var Ee="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),De=new Uint8Array(16);function Se(){if(!Ee)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ee(De)}for(var Te=[],Oe=0;Oe<256;++Oe)Te[Oe]=(Oe+256).toString(16).substr(1);var Ye=function(e,t){var r=t||0,n=Te;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")};var Ce=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||Se)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var o=0;o<16;++o)t[n+o]=a[o];return t||Ye(a)};function Pe(e,t){for(var r=0;rw},S=function(e){return function(e){var t=h[e].b;return b+t+y}(e)>k},T=function(e){return function(e){return L(e)<0}(e)||D(e)||function(e){return E(e)<0}(e)||S(e)},O=function(e){return!T(e)},Y=["top","bottom","left","right"],C=[],P=0;P<4;P++){var j=Y[P];O(j)&&C.push(j)}var A,N=!1,F=a!==n;return O(a)&&F?(N=!0,A=a):C.length>0&&T(a)&&T(n)&&(N=!0,A=C[0]),N?{isNewState:!0,newState:{place:A}}:{isNewState:!1,position:{left:parseInt(L(n)-M,10),top:parseInt(E(n)-x,10)}}}var Xe=function(e){var t=e.getBoundingClientRect(),r=t.height,n=t.width;return{height:parseInt(r,10),width:parseInt(n,10)}},Qe=function(e,t,r){var n=t.getBoundingClientRect(),a=n.top,o=n.left,i=Xe(t),c=i.width,s=i.height;return"float"===r?{mouseX:e.clientX,mouseY:e.clientY}:{mouseX:o+c/2,mouseY:a+s/2}},Ze=function(e,t,r,n,a){var o,i,c,s;return"float"===e?(o={l:-n/2,r:n/2,t:-(a+3+2),b:-3},c={l:-n/2,r:n/2,t:15,b:a+3+2+12},s={l:-(n+3+2),r:-3,t:-a/2,b:a/2},i={l:3,r:n+3+2,t:-a/2,b:a/2}):"solid"===e&&(o={l:-n/2,r:n/2,t:-(r/2+a+2),b:-r/2},c={l:-n/2,r:n/2,t:r/2,b:r/2+a+2},s={l:-(n+t/2+2),r:-t/2,t:-a/2,b:a/2},i={l:t/2,r:n+t/2+2,t:-a/2,b:a/2}),{top:o,bottom:c,left:s,right:i}},et=function(e){var t=0,r=0;for(var n in"[object String]"===Object.prototype.toString.apply(e)&&(e=JSON.parse(e.toString().replace(/'/g,'"'))),e)"top"===n?r-=parseInt(e[n],10):"bottom"===n?r+=parseInt(e[n],10):"left"===n?t-=parseInt(e[n],10):"right"===n&&(t+=parseInt(e[n],10));return{extraOffsetX:t,extraOffsetY:r}},tt=function(e){for(var t=e;t&&"none"===window.getComputedStyle(t).getPropertyValue("transform");)t=t.parentElement;return{parentTop:t&&t.getBoundingClientRect().top||0,parentLeft:t&&t.getBoundingClientRect().left||0}};function rt(e,t,r,n){if(t)return t;if(null!=r)return r;if(null===r)return null;var o=//;return n&&"false"!==n&&o.test(e)?e.split(o).map((function(e,t){return a.a.createElement("span",{key:t,className:"multi-line"},e)})):e}function nt(e){var t={};return Object.keys(e).filter((function(e){return/(^aria-\w+$|^role$)/.test(e)})).forEach((function(r){t[r]=e[r]})),t}function at(e){var t=e.length;return e.hasOwnProperty?Array.prototype.slice.call(e):new Array(t).fill().map((function(t){return e[t]}))}!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t)}}('.__react_component_tooltip {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n left: -999em;\n opacity: 0;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n top: -999em;\n visibility: hidden;\n z-index: 999;\n}\n.__react_component_tooltip.allow_hover, .__react_component_tooltip.allow_click {\n pointer-events: auto;\n}\n.__react_component_tooltip::before, .__react_component_tooltip::after {\n content: "";\n width: 0;\n height: 0;\n position: absolute;\n}\n.__react_component_tooltip.show {\n opacity: 0.9;\n margin-top: 0;\n margin-left: 0;\n visibility: visible;\n}\n.__react_component_tooltip.place-top::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n bottom: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-bottom::before {\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n top: -8px;\n left: 50%;\n margin-left: -10px;\n}\n.__react_component_tooltip.place-left::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n right: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip.place-right::before {\n border-top: 6px solid transparent;\n border-bottom: 6px solid transparent;\n left: -8px;\n top: 50%;\n margin-top: -5px;\n}\n.__react_component_tooltip .multi-line {\n display: block;\n padding: 2px 0;\n text-align: center;\n}');var ot,it,ct,st={dark:{text:"#fff",background:"#222",border:"transparent",arrow:"#222"},success:{text:"#fff",background:"#8DC572",border:"transparent",arrow:"#8DC572"},warning:{text:"#fff",background:"#F0AD4E",border:"transparent",arrow:"#F0AD4E"},error:{text:"#fff",background:"#BE6464",border:"transparent",arrow:"#BE6464"},info:{text:"#fff",background:"#337AB7",border:"transparent",arrow:"#337AB7"},light:{text:"#222",background:"#fff",border:"transparent",arrow:"#fff"}};function lt(e,t,r,n){return function(e,t){var r=t.text,n=t.background,a=t.border,o=t.arrow;return"\n \t.".concat(e," {\n\t color: ").concat(r,";\n\t background: ").concat(n,";\n\t border: 1px solid ").concat(a,";\n \t}\n\n \t.").concat(e,".place-top {\n margin-top: -10px;\n }\n .").concat(e,".place-top::before {\n border-top: 8px solid ").concat(a,";\n }\n .").concat(e,".place-top::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n bottom: -6px;\n left: 50%;\n margin-left: -8px;\n border-top-color: ").concat(o,";\n border-top-style: solid;\n border-top-width: 6px;\n }\n\n .").concat(e,".place-bottom {\n margin-top: 10px;\n }\n .").concat(e,".place-bottom::before {\n border-bottom: 8px solid ").concat(a,";\n }\n .").concat(e,".place-bottom::after {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n top: -6px;\n left: 50%;\n margin-left: -8px;\n border-bottom-color: ").concat(o,";\n border-bottom-style: solid;\n border-bottom-width: 6px;\n }\n\n .").concat(e,".place-left {\n margin-left: -10px;\n }\n .").concat(e,".place-left::before {\n border-left: 8px solid ").concat(a,";\n }\n .").concat(e,".place-left::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n right: -6px;\n top: 50%;\n margin-top: -4px;\n border-left-color: ").concat(o,";\n border-left-style: solid;\n border-left-width: 6px;\n }\n\n .").concat(e,".place-right {\n margin-left: 10px;\n }\n .").concat(e,".place-right::before {\n border-right: 8px solid ").concat(a,";\n }\n .").concat(e,".place-right::after {\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n left: -6px;\n top: 50%;\n margin-top: -4px;\n border-right-color: ").concat(o,";\n border-right-style: solid;\n border-right-width: 6px;\n }\n ")}(e,function(e,t,r){var n=e.text,a=e.background,o=e.border,i=e.arrow?e.arrow:e.background,c=function(e){return st[e]?Ie({},st[e]):void 0}(t);n&&(c.text=n);a&&(c.background=a);r&&(c.border=o||("light"===t?"black":"white"));i&&(c.arrow=i);return c}(t,r,n))}var dt,ut=function(e){e.hide=function(e){Be(We.HIDE,{target:e})},e.rebuild=function(){Be(We.REBUILD)},e.show=function(e){Be(We.SHOW,{target:e})},e.prototype.globalRebuild=function(){this.mount&&(this.unbindListener(),this.bindListener())},e.prototype.globalShow=function(e){if(this.mount){var t=!!(e&&e.detail&&e.detail.target);this.showTooltip({currentTarget:t&&e.detail.target},!0)}},e.prototype.globalHide=function(e){if(this.mount){var t=!!(e&&e.detail&&e.detail.target);this.hideTooltip({currentTarget:t&&e.detail.target},t)}}}(ot=function(e){e.prototype.bindWindowEvents=function(e){window.removeEventListener(We.HIDE,this.globalHide),window.addEventListener(We.HIDE,this.globalHide,!1),window.removeEventListener(We.REBUILD,this.globalRebuild),window.addEventListener(We.REBUILD,this.globalRebuild,!1),window.removeEventListener(We.SHOW,this.globalShow),window.addEventListener(We.SHOW,this.globalShow,!1),e&&(window.removeEventListener("resize",this.onWindowResize),window.addEventListener("resize",this.onWindowResize,!1))},e.prototype.unbindWindowEvents=function(){window.removeEventListener(We.HIDE,this.globalHide),window.removeEventListener(We.REBUILD,this.globalRebuild),window.removeEventListener(We.SHOW,this.globalShow),window.removeEventListener("resize",this.onWindowResize)},e.prototype.onWindowResize=function(){this.mount&&this.hideTooltip()}}(ot=function(e){e.prototype.isCustomEvent=function(e){return this.state.event||!!e.getAttribute("data-event")},e.prototype.customBindListener=function(e){var t=this,r=this.state,n=r.event,a=r.eventOff,o=e.getAttribute("data-event")||n,i=e.getAttribute("data-event-off")||a;o.split(" ").forEach((function(r){e.removeEventListener(r,qe.get(e,r));var n=Ue.bind(t,i);qe.set(e,r,n),e.addEventListener(r,n,!1)})),i&&i.split(" ").forEach((function(r){e.removeEventListener(r,t.hideTooltip),e.addEventListener(r,t.hideTooltip,!1)}))},e.prototype.customUnbindListener=function(e){var t=this.state,r=t.event,n=t.eventOff,a=r||e.getAttribute("data-event"),o=n||e.getAttribute("data-event-off");e.removeEventListener(a,qe.get(e,r)),o&&e.removeEventListener(o,this.hideTooltip)}}(ot=function(e){e.prototype.isCapture=function(e){return e&&"true"===e.getAttribute("data-iscapture")||this.props.isCapture||!1}}(ot=function(e){e.prototype.getEffect=function(e){return e.getAttribute("data-effect")||this.props.effect||"float"}}(ot=function(e){e.prototype.isBodyMode=function(){return!!this.props.bodyMode},e.prototype.bindBodyListener=function(e){var t=this,r=this.state,n=r.event,a=r.eventOff,o=r.possibleCustomEvents,i=r.possibleCustomEventsOff,c=$e(),s=Je(e,"data-event"),l=Je(e,"data-event-off");null!=n&&(s[n]=!0),null!=a&&(l[a]=!0),o.split(" ").forEach((function(e){return s[e]=!0})),i.split(" ").forEach((function(e){return l[e]=!0})),this.unbindBodyListener(c);var d=this.bodyModeListeners={};for(var u in null==n&&(d.mouseover=Ge.bind(this,this.showTooltip,{}),d.mousemove=Ge.bind(this,this.updateTooltip,{respectEffect:!0}),d.mouseout=Ge.bind(this,this.hideTooltip,{})),s)d[u]=Ge.bind(this,(function(e){var r=e.currentTarget.getAttribute("data-event-off")||a;Ue.call(t,r,e)}),{customEvent:!0});for(var p in l)d[p]=Ge.bind(this,this.hideTooltip,{customEvent:!0});for(var f in d)c.addEventListener(f,d[f])},e.prototype.unbindBodyListener=function(e){e=e||$e();var t=this.bodyModeListeners;for(var r in t)e.removeEventListener(r,t[r])}}((ct=it=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=ze(this,He(t).call(this,e))).state={uuid:e.uuid||"t"+Ce(),place:e.place||"top",desiredPlace:e.place||"top",type:"dark",effect:"float",show:!1,border:!1,customColors:{},offset:{},extraClass:"",html:!1,delayHide:0,delayShow:0,event:e.event||null,eventOff:e.eventOff||null,currentEvent:null,currentTarget:null,ariaProps:nt(e),isEmptyTip:!1,disable:!1,possibleCustomEvents:e.possibleCustomEvents||"",possibleCustomEventsOff:e.possibleCustomEventsOff||"",originTooltip:null,isMultiline:!1},r.bind(["showTooltip","updateTooltip","hideTooltip","hideTooltipOnScroll","getTooltipContent","globalRebuild","globalShow","globalHide","onWindowResize","mouseOnToolTip"]),r.mount=!0,r.delayShowLoop=null,r.delayHideLoop=null,r.delayReshow=null,r.intervalUpdateContent=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,e),je(t,null,[{key:"propTypes",get:function(){return{uuid:w.a.string,children:w.a.any,place:w.a.string,type:w.a.string,effect:w.a.string,offset:w.a.object,multiline:w.a.bool,border:w.a.bool,textColor:w.a.string,backgroundColor:w.a.string,borderColor:w.a.string,arrowColor:w.a.string,insecure:w.a.bool,class:w.a.string,className:w.a.string,id:w.a.string,html:w.a.bool,delayHide:w.a.number,delayUpdate:w.a.number,delayShow:w.a.number,event:w.a.string,eventOff:w.a.string,isCapture:w.a.bool,globalEventOff:w.a.string,getContent:w.a.any,afterShow:w.a.func,afterHide:w.a.func,overridePosition:w.a.func,disable:w.a.bool,scrollHide:w.a.bool,resizeHide:w.a.bool,wrapper:w.a.string,bodyMode:w.a.bool,possibleCustomEvents:w.a.string,possibleCustomEventsOff:w.a.string,clickable:w.a.bool}}}]),je(t,[{key:"bind",value:function(e){var t=this;e.forEach((function(e){t[e]=t[e].bind(t)}))}},{key:"componentDidMount",value:function(){var e=this.props,t=(e.insecure,e.resizeHide);this.bindListener(),this.bindWindowEvents(t)}},{key:"componentWillUnmount",value:function(){this.mount=!1,this.clearTimer(),this.unbindListener(),this.removeScrollListener(this.state.currentTarget),this.unbindWindowEvents()}},{key:"mouseOnToolTip",value:function(){return!(!this.state.show||!this.tooltipRef)&&(this.tooltipRef.matches||(this.tooltipRef.msMatchesSelector?this.tooltipRef.matches=this.tooltipRef.msMatchesSelector:this.tooltipRef.matches=this.tooltipRef.mozMatchesSelector),this.tooltipRef.matches(":hover"))}},{key:"getTargetArray",value:function(e){var t,r=[];if(e){var n=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');t='[data-tip][data-for="'.concat(n,'"]')}else t="[data-tip]:not([data-for])";return at(document.getElementsByTagName("*")).filter((function(e){return e.shadowRoot})).forEach((function(e){r=r.concat(at(e.shadowRoot.querySelectorAll(t)))})),r.concat(at(document.querySelectorAll(t)))}},{key:"bindListener",value:function(){var e=this,t=this.props,r=t.id,n=t.globalEventOff,a=t.isCapture,o=this.getTargetArray(r);o.forEach((function(t){null===t.getAttribute("currentItem")&&t.setAttribute("currentItem","false"),e.unbindBasicListener(t),e.isCustomEvent(t)&&e.customUnbindListener(t)})),this.isBodyMode()?this.bindBodyListener(o):o.forEach((function(t){var r=e.isCapture(t),n=e.getEffect(t);e.isCustomEvent(t)?e.customBindListener(t):(t.addEventListener("mouseenter",e.showTooltip,r),"float"===n&&t.addEventListener("mousemove",e.updateTooltip,r),t.addEventListener("mouseleave",e.hideTooltip,r))})),n&&(window.removeEventListener(n,this.hideTooltip),window.addEventListener(n,this.hideTooltip,a)),this.bindRemovalTracker()}},{key:"unbindListener",value:function(){var e=this,t=this.props,r=t.id,n=t.globalEventOff;this.isBodyMode()?this.unbindBodyListener():this.getTargetArray(r).forEach((function(t){e.unbindBasicListener(t),e.isCustomEvent(t)&&e.customUnbindListener(t)})),n&&window.removeEventListener(n,this.hideTooltip),this.unbindRemovalTracker()}},{key:"unbindBasicListener",value:function(e){var t=this.isCapture(e);e.removeEventListener("mouseenter",this.showTooltip,t),e.removeEventListener("mousemove",this.updateTooltip,t),e.removeEventListener("mouseleave",this.hideTooltip,t)}},{key:"getTooltipContent",value:function(){var e,t=this.props,r=t.getContent,n=t.children;return r&&(e=Array.isArray(r)?r[0]&&r[0](this.state.originTooltip):r(this.state.originTooltip)),rt(this.state.originTooltip,n,e,this.state.isMultiline)}},{key:"isEmptyTip",value:function(e){return"string"==typeof e&&""===e||null===e}},{key:"showTooltip",value:function(e,t){if(!t||this.getTargetArray(this.props.id).some((function(t){return t===e.currentTarget}))){var r=this.props,n=r.multiline,a=r.getContent,o=e.currentTarget.getAttribute("data-tip"),i=e.currentTarget.getAttribute("data-multiline")||n||!1,c=e instanceof window.FocusEvent||t,s=!0;e.currentTarget.getAttribute("data-scroll-hide")?s="true"===e.currentTarget.getAttribute("data-scroll-hide"):null!=this.props.scrollHide&&(s=this.props.scrollHide);var l=e.currentTarget.getAttribute("data-place")||this.props.place||"top",d=c?"solid":this.getEffect(e.currentTarget),u=e.currentTarget.getAttribute("data-offset")||this.props.offset||{},p=Ke(e,e.currentTarget,this.tooltipRef,l,l,d,u);p.position&&this.props.overridePosition&&(p.position=this.props.overridePosition(p.position,e,e.currentTarget,this.tooltipRef,l,l,d,u));var f=p.isNewState?p.newState.place:l;this.clearTimer();var m=e.currentTarget,b=this.state.show?m.getAttribute("data-delay-update")||this.props.delayUpdate:0,h=this,g=function(){h.setState({originTooltip:o,isMultiline:i,desiredPlace:l,place:f,type:m.getAttribute("data-type")||h.props.type||"dark",customColors:{text:m.getAttribute("data-text-color")||h.props.textColor||null,background:m.getAttribute("data-background-color")||h.props.backgroundColor||null,border:m.getAttribute("data-border-color")||h.props.borderColor||null,arrow:m.getAttribute("data-arrow-color")||h.props.arrowColor||null},effect:d,offset:u,html:(m.getAttribute("data-html")?"true"===m.getAttribute("data-html"):h.props.html)||!1,delayShow:m.getAttribute("data-delay-show")||h.props.delayShow||0,delayHide:m.getAttribute("data-delay-hide")||h.props.delayHide||0,delayUpdate:m.getAttribute("data-delay-update")||h.props.delayUpdate||0,border:(m.getAttribute("data-border")?"true"===m.getAttribute("data-border"):h.props.border)||!1,extraClass:m.getAttribute("data-class")||h.props.class||h.props.className||"",disable:(m.getAttribute("data-tip-disable")?"true"===m.getAttribute("data-tip-disable"):h.props.disable)||!1,currentTarget:m},(function(){s&&h.addScrollListener(h.state.currentTarget),h.updateTooltip(e),a&&Array.isArray(a)&&(h.intervalUpdateContent=setInterval((function(){if(h.mount){var e=h.props.getContent,t=rt(o,"",e[0](),i),r=h.isEmptyTip(t);h.setState({isEmptyTip:r}),h.updatePosition()}}),a[1]))}))};b?this.delayReshow=setTimeout(g,b):g()}}},{key:"updateTooltip",value:function(e){var t=this,r=this.state,n=r.delayShow,a=r.disable,o=this.props.afterShow,i=this.getTooltipContent(),c=parseInt(n,10),s=e.currentTarget||e.target;if(!this.mouseOnToolTip()&&!this.isEmptyTip(i)&&!a){var l=function(){if(Array.isArray(i)&&i.length>0||i){var r=!t.state.show;t.setState({currentEvent:e,currentTarget:s,show:!0},(function(){t.updatePosition(),r&&o&&o(e)}))}};clearTimeout(this.delayShowLoop),n?this.delayShowLoop=setTimeout(l,c):l()}}},{key:"listenForTooltipExit",value:function(){this.state.show&&this.tooltipRef&&this.tooltipRef.addEventListener("mouseleave",this.hideTooltip)}},{key:"removeListenerForTooltipExit",value:function(){this.state.show&&this.tooltipRef&&this.tooltipRef.removeEventListener("mouseleave",this.hideTooltip)}},{key:"hideTooltip",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isScroll:!1},a=this.state.disable,o=n.isScroll,i=o?0:this.state.delayHide,c=this.props.afterHide,s=this.getTooltipContent();if(this.mount&&!this.isEmptyTip(s)&&!a){if(t){var l=this.getTargetArray(this.props.id),d=l.some((function(t){return t===e.currentTarget}));if(!d||!this.state.show)return}var u=function(){var t=r.state.show;r.mouseOnToolTip()?r.listenForTooltipExit():(r.removeListenerForTooltipExit(),r.setState({show:!1},(function(){r.removeScrollListener(r.state.currentTarget),t&&c&&c(e)})))};this.clearTimer(),i?this.delayHideLoop=setTimeout(u,parseInt(i,10)):u()}}},{key:"hideTooltipOnScroll",value:function(e,t){this.hideTooltip(e,t,{isScroll:!0})}},{key:"addScrollListener",value:function(e){var t=this.isCapture(e);window.addEventListener("scroll",this.hideTooltipOnScroll,t)}},{key:"removeScrollListener",value:function(e){var t=this.isCapture(e);window.removeEventListener("scroll",this.hideTooltipOnScroll,t)}},{key:"updatePosition",value:function(){var e=this,t=this.state,r=t.currentEvent,n=t.currentTarget,a=t.place,o=t.desiredPlace,i=t.effect,c=t.offset,s=this.tooltipRef,l=Ke(r,n,s,a,o,i,c);if(l.position&&this.props.overridePosition&&(l.position=this.props.overridePosition(l.position,r,n,s,a,o,i,c)),l.isNewState)return this.setState(l.newState,(function(){e.updatePosition()}));s.style.left=l.position.left+"px",s.style.top=l.position.top+"px"}},{key:"clearTimer",value:function(){clearTimeout(this.delayShowLoop),clearTimeout(this.delayHideLoop),clearTimeout(this.delayReshow),clearInterval(this.intervalUpdateContent)}},{key:"hasCustomColors",value:function(){var e=this;return Boolean(Object.keys(this.state.customColors).find((function(t){return"border"!==t&&e.state.customColors[t]}))||this.state.border&&this.state.customColors.border)}},{key:"render",value:function(){var e=this,r=this.state,n=r.extraClass,o=r.html,i=r.ariaProps,c=r.disable,s=this.getTooltipContent(),l=this.isEmptyTip(s),d=lt(this.state.uuid,this.state.customColors,this.state.type,this.state.border),u="__react_component_tooltip"+" ".concat(this.state.uuid)+(!this.state.show||c||l?"":" show")+(this.state.border?" border":"")+" place-".concat(this.state.place)+" type-".concat(this.hasCustomColors()?"custom":this.state.type)+(this.props.delayUpdate?" allow_hover":"")+(this.props.clickable?" allow_click":""),p=this.props.wrapper;t.supportedWrappers.indexOf(p)<0&&(p=t.defaultProps.wrapper);var f=[u,n].filter(Boolean).join(" ");if(o){var m="".concat(s,"\n");return a.a.createElement(p,Ne({className:"".concat(f),id:this.props.id,ref:function(t){return e.tooltipRef=t}},i,{"data-id":"tooltip",dangerouslySetInnerHTML:{__html:m}}))}return a.a.createElement(p,Ne({className:"".concat(f),id:this.props.id},i,{ref:function(t){return e.tooltipRef=t},"data-id":"tooltip"}),a.a.createElement("style",{dangerouslySetInnerHTML:{__html:d}}),s)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var r=t.ariaProps,n=nt(e);return Object.keys(n).some((function(e){return n[e]!==r[e]}))?Ie({},t,{ariaProps:n}):null}}]),t}(a.a.Component),Ae(it,"defaultProps",{insecure:!0,resizeHide:!0,wrapper:"div",clickable:!1}),Ae(it,"supportedWrappers",["div","span"]),Ae(it,"displayName","ReactTooltip"),(dt=ot=ct).prototype.bindRemovalTracker=function(){var e=this,t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(null!=t){var r=new t((function(t){for(var r=0;r=0&&e=this.state.users.pageCount?" disabled":"",f=function(t){var r=e.state.users.page===t?" active":"";d.push(n.createElement("li",{key:"page-"+t,className:"page-item"+r},n.createElement("a",{className:"page-link",href:"#",onClick:function(){e.state.users.page!==t&&e.fetchUsers(t)}},t)))},b=1;b<=this.state.users.pageCount;b++)f(b);return n.createElement("div",{className:"card"},n.createElement("div",{className:"card-header border-0"},n.createElement("h3",{className:"card-title"},"Users"),n.createElement("div",{className:"card-tools"},n.createElement(be,{href:"#",className:"btn btn-tool btn-sm",to:"/admin/user/add"},n.createElement(m,{icon:"plus"})),n.createElement("a",{href:"#",className:"btn btn-tool btn-sm",onClick:function(){return e.fetchUsers()}},n.createElement(m,{icon:"sync"})))),n.createElement("div",{className:"card-body table-responsive p-0"},n.createElement("table",{className:"table table-striped table-valign-middle"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Username"),n.createElement("th",null,"Email"),n.createElement("th",null,"Groups"),n.createElement("th",null,"Registered"),n.createElement("th",{className:"text-center"},"Confirmed"),n.createElement("th",null,n.createElement(m,{icon:"tools"})))),n.createElement("tbody",null,t)),n.createElement("nav",{className:"row m-0"},n.createElement("div",{className:"col-6 pl-3 pt-3 pb-3 text-muted"},"Total: ",this.state.users.totalCount),n.createElement("div",{className:"col-6 p-0"},n.createElement("ul",{className:"pagination p-2 m-0 justify-content-end"},n.createElement("li",{className:"page-item"+u},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchUsers(e.state.users.page-1)}},"Previous")),d,n.createElement("li",{className:"page-item"+p},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchUsers(e.state.users.page+1)}},"Next")))))))}},{key:"createGroupCard",value:function(){var e=this,t=[],r=function(r){if(!e.state.groups.data.hasOwnProperty(r))return"continue";var a=e.state.groups.data[r];t.push(n.createElement("tr",{key:"group-"+r},n.createElement("td",null,a.name),n.createElement("td",{className:"text-center"},a.memberCount),n.createElement("td",null,n.createElement("span",{className:"badge text-white mr-1",style:{backgroundColor:a.color,fontFamily:"monospace"}},a.color)),n.createElement("td",null,n.createElement(m,{icon:"trash",style:{color:"red",cursor:"pointer"},onClick:function(t){return e.onDeleteGroup(t,r)},"data-effect":"solid","data-tip":"Delete","data-type":"error","data-place":"bottom"}))))};for(var a in this.state.groups.data)r(a);for(;t.length=this.state.groups.pageCount?" disabled":"",s=function(t){var r=e.state.groups.page===t?" active":"";o.push(n.createElement("li",{key:"page-"+t,className:"page-item"+r},n.createElement("a",{className:"page-link",href:"#",onClick:function(){e.state.groups.page!==t&&e.fetchGroups(t)}},t)))},l=1;l<=this.state.groups.pageCount;l++)s(l);return n.createElement("div",{className:"card"},n.createElement("div",{className:"card-header border-0"},n.createElement("h3",{className:"card-title"},"Groups"),n.createElement("div",{className:"card-tools"},n.createElement(be,{href:"#",className:"btn btn-tool btn-sm",to:"/admin/group/add"},n.createElement(m,{icon:"plus"})),n.createElement("a",{href:"#",className:"btn btn-tool btn-sm",onClick:function(){return e.fetchGroups()}},n.createElement(m,{icon:"sync"})))),n.createElement("div",{className:"card-body table-responsive p-0"},n.createElement("table",{className:"table table-striped table-valign-middle"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Name"),n.createElement("th",{className:"text-center"},"Members"),n.createElement("th",null,"Color"),n.createElement("th",null,n.createElement(m,{icon:"tools"})))),n.createElement("tbody",null,t)),n.createElement("nav",{className:"row m-0"},n.createElement("div",{className:"col-6 pl-3 pt-3 pb-3 text-muted"},"Total: ",this.state.groups.totalCount),n.createElement("div",{className:"col-6 p-0"},n.createElement("ul",{className:"pagination p-2 m-0 justify-content-end"},n.createElement("li",{className:"page-item"+i},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchGroups(e.state.groups.page-1)}},"Previous")),o,n.createElement("li",{className:"page-item"+c},n.createElement("a",{className:"page-link",href:"#",onClick:function(){return e.fetchGroups(e.state.groups.page+1)}},"Next")))))))}},{key:"onDeleteGroup",value:function(e,t){var r=this;e.stopPropagation(),this.parent.showDialog("Are you really sure you want to delete this group?","Delete Group?",["Yes","No"],(function(e){"Yes"===e&&r.parent.api.deleteGroup(t).then((function(e){if(e.success)r.setState(bt(bt({},r.state),{},{loaded:!1})),r.fetchGroups();else{var t=r.state.errors.slice();t.push({title:"Error deleting group",message:e.msg}),r.setState(bt(bt({},r.state),{},{errors:t}))}}))}))}}])&>(t.prototype,r),a&>(t,a),i}(n.Component),xt=r(133),Mt=r(75);function Lt(e){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Et(){return(Et=Object.assign||function(e){for(var t=1;t=0&&e=0&&i1&&void 0!==arguments[1]?arguments[1]:1,r=1024;if(Math.abs(e)=r&&a=0&&e0){var i=this.state.errors.slice();return i.push({title:"Missing input",message:"The following fields are missing: "+r.join(", "),type:"warning"}),void this.setState(Rt(Rt({},this.state),{},{errors:i}))}this.setState(Rt(Rt({},this.state),{},{isSubmitting:!0}));var c=this.state.username,s=this.state.email||"",l=this.state.password,d=this.state.confirmPassword;if(this.state.sendInvite)this.parent.api.inviteUser(c,s).then((function(e){var r=t.state.errors.slice();e.success?(r.push({title:"Success",message:"The invitation was successfully sent.",type:"success"}),t.setState(Rt(Rt({},t.state),{},{errors:r,username:"",email:"",isSubmitting:!1}))):(r.push({title:"Error inviting User",message:e.msg,type:"danger"}),t.setState(Rt(Rt({},t.state),{},{errors:r,isSubmitting:!1})))}));else{if(this.state.password!==this.state.confirmPassword){var u=this.state.errors.slice();return u.push({title:"Error creating User",message:"The given passwords do not match",type:"danger"}),void this.setState(Rt(Rt({},this.state),{},{errors:u,password:"",confirmPassword:"",isSubmitting:!1}))}this.parent.api.createUser(c,s,l,d).then((function(e){var r=t.state.errors.slice();e.success?(r.push({title:"Success",message:"The user was successfully created.",type:"success"}),t.setState(Rt(Rt({},t.state),{},{errors:r,username:"",email:"",password:"",confirmPassword:"",isSubmitting:!1}))):(r.push({title:"Error creating User",message:e.msg,type:"danger"}),t.setState(Rt(Rt({},t.state),{},{errors:r,password:"",confirmPassword:"",isSubmitting:!1})))}))}}}},{key:"onCheckboxChange",value:function(){this.setState(Rt(Rt({},this.state),{},{sendInvite:!this.state.sendInvite}))}},{key:"onChangeInput",value:function(e){var t=e.target,r=t.value,n=t.name;this.setState(Rt(Rt({},this.state),{},zt({},n,r)))}}])&&Wt(t.prototype,r),a&&Wt(t,a),i}(n.Component);function Jt(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return $t(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $t(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function $t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&en&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(b,"$1"+e.trim());case 58:return e.trim()+t.replace(b,"$1"+e.trim());default:if(0<1*r&&0s.charCodeAt(8))break;case 115:i=i.replace(s,"-webkit-"+s)+";"+i;break;case 207:case 102:i=i.replace(s,"-webkit-"+(102c.charCodeAt(0)&&(c=c.trim()),c=[c],0f)&&(H=(W=W.replace(" ",":")).length),0=4;++n,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(a){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)},xr={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var Mr=/[A-Z]|^ms/g,Lr=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Er=function(e){return 45===e.charCodeAt(1)},Dr=function(e){return null!=e&&"boolean"!=typeof e},Sr=function(e){var t={};return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}((function(e){return Er(e)?e:e.replace(Mr,"-$&").toLowerCase()})),Tr=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Lr,(function(e,t,r){return Yr={name:t,styles:r,next:Yr},t}))}return 1===xr[e]||Er(e)||"number"!=typeof t||0===t?t:t+"px"};function Or(e,t,r,n){if(null==r)return"";if(void 0!==r.__emotion_styles)return r;switch(typeof r){case"boolean":return"";case"object":if(1===r.anim)return Yr={name:r.name,styles:r.styles,next:Yr},r.name;if(void 0!==r.styles){var a=r.next;if(void 0!==a)for(;void 0!==a;)Yr={name:a.name,styles:a.styles,next:Yr},a=a.next;return r.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a-1}function Qr(e){return Xr(e)?window.pageYOffset:e.scrollTop}function Zr(e,t){Xr(e)?window.scrollTo(0,t):e.scrollTop=t}function en(e,t,r,n){void 0===r&&(r=200),void 0===n&&(n=Gr);var a=Qr(e),o=t-a,i=0;!function t(){var c,s=o*((c=(c=i+=10)/r-1)*c*c+1)+a;Zr(e,s),i=f)return{placement:"bottom",maxHeight:t};if(x>=f&&!i)return o&&en(s,M,160),{placement:"bottom",maxHeight:t};if(!i&&x>=n||i&&k>=n)return o&&en(s,M,160),{placement:"bottom",maxHeight:i?k-v:x-v};if("auto"===a||i){var E=t,D=i?w:_;return D>=n&&(E=Math.min(D-v-c.controlHeight,t)),{placement:"top",maxHeight:E}}if("bottom"===a)return Zr(s,M),{placement:"bottom",maxHeight:t};break;case"top":if(w>=f)return{placement:"top",maxHeight:t};if(_>=f&&!i)return o&&en(s,L,160),{placement:"top",maxHeight:t};if(!i&&_>=n||i&&w>=n){var S=t;return(!i&&_>=n||i&&w>=n)&&(S=i?w-y:_-y),o&&en(s,L,160),{placement:"top",maxHeight:S}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'+a+'".')}return l}var sn=function(e){return"auto"===e?"bottom":e},ln=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a=0||(a[r]=e[r]);return a}(e,["size"]);return Br("svg",_n({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:xn},r))},Ln=function(e){return Br(Mn,_n({size:20},e),Br("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},En=function(e){return Br(Mn,_n({size:20},e),Br("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Dn=function(e){var t=e.isFocused,r=e.theme,n=r.spacing.baseUnit,a=r.colors;return{label:"indicatorContainer",color:t?a.neutral60:a.neutral20,display:"flex",padding:2*n,transition:"color 150ms",":hover":{color:t?a.neutral80:a.neutral40}}},Sn=Dn,Tn=Dn,On=function(){var e=jr.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(kn()),Yn=function(e){var t=e.delay,r=e.offset;return Br("span",{css:jr({animation:On+" 1s ease-in-out "+t+"ms infinite;",backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:r?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"")})},Cn=function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerProps,o=e.isRtl;return Br("div",_n({},a,{css:n("loadingIndicator",e),className:r({indicator:!0,"loading-indicator":!0},t)}),Br(Yn,{delay:0,offset:o}),Br(Yn,{delay:160,offset:!0}),Br(Yn,{delay:320,offset:!o}))};function Pn(){return(Pn=Object.assign||function(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,["className","cx","getStyles","theme","selectProps"]));return Br("div",jn({css:n("groupHeading",jn({theme:a},o)),className:r({"group-heading":!0},t)},o))},IndicatorsContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles;return Br("div",{css:a("indicatorsContainer",e),className:n({indicators:!0},r)},t)},IndicatorSeparator:function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerProps;return Br("span",_n({},a,{css:n("indicatorSeparator",e),className:r({"indicator-separator":!0},t)}))},Input:function(e){var t=e.className,r=e.cx,n=e.getStyles,a=e.innerRef,o=e.isHidden,i=e.isDisabled,c=e.theme,s=(e.selectProps,function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(e,["className","cx","getStyles","innerRef","isHidden","isDisabled","theme","selectProps"]));return Br("div",{css:n("input",An({theme:c},s))},Br(nn.a,An({className:r({input:!0},t),inputRef:a,inputStyle:Nn(o),disabled:i},s)))},LoadingIndicator:Cn,Menu:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerRef,i=e.innerProps;return Br("div",an({css:a("menu",e),className:n({menu:!0},r)},i,{ref:o}),t)},MenuList:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isMulti,i=e.innerRef;return Br("div",{css:a("menuList",e),className:n({"menu-list":!0,"menu-list--is-multi":o},r),ref:i},t)},MenuPortal:bn,LoadingMessage:mn,NoOptionsMessage:fn,MultiValue:zn,MultiValueContainer:Hn,MultiValueLabel:Rn,MultiValueRemove:function(e){var t=e.children,r=e.innerProps;return Br("div",r,t||Br(Ln,{size:14}))},Option:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isDisabled,i=e.isFocused,c=e.isSelected,s=e.innerRef,l=e.innerProps;return Br("div",Wn({css:a("option",e),className:n({option:!0,"option--is-disabled":o,"option--is-focused":i,"option--is-selected":c},r),ref:s},l),t)},Placeholder:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerProps;return Br("div",Bn({css:a("placeholder",e),className:n({placeholder:!0},r)},o),t)},SelectContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.innerProps,i=e.isDisabled,c=e.isRtl;return Br("div",wn({css:a("container",e),className:n({"--is-disabled":i,"--is-rtl":c},r)},o),t)},SingleValue:function(e){var t=e.children,r=e.className,n=e.cx,a=e.getStyles,o=e.isDisabled,i=e.innerProps;return Br("div",Un({css:a("singleValue",e),className:n({"single-value":!0,"single-value--is-disabled":o},r)},i),t)},ValueContainer:function(e){var t=e.children,r=e.className,n=e.cx,a=e.isMulti,o=e.getStyles,i=e.hasValue;return Br("div",{css:o("valueContainer",e),className:n({"value-container":!0,"value-container--is-multi":a,"value-container--has-value":i},r)},t)}},Gn=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}],Jn=function(e){for(var t=0;t=0||(a[r]=e[r]);return a}(e,["in","out","onExited","appear","enter","exit","innerRef","emotion"]));return Br("input",ta({ref:t},r,{css:jr({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"")}))}var na=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a=n.prototype;return a.componentDidMount=function(){this.props.innerRef(Object(o.findDOMNode)(this))},a.componentWillUnmount=function(){this.props.innerRef(null)},a.render=function(){return this.props.children},n}(n.Component),aa=["boxSizing","height","overflow","paddingRight","position"],oa={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function ia(e){e.preventDefault()}function ca(e){e.stopPropagation()}function sa(){var e=this.scrollTop,t=this.scrollHeight,r=e+this.offsetHeight;0===e?this.scrollTop=1:r===t&&(this.scrollTop=e-1)}function la(){return"ontouchstart"in window||navigator.maxTouchPoints}var da=!(!window.document||!window.document.createElement),ua=0,pa=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),a=0;a0,m=d-u-l,b=!1;m>r&&t.isBottom&&(o&&o(e),t.isBottom=!1),f&&t.isTop&&(c&&c(e),t.isTop=!1),f&&r>m?(a&&!t.isBottom&&a(e),p.scrollTop=d,b=!0,t.isBottom=!0):!f&&-r>l&&(i&&!t.isTop&&i(e),p.scrollTop=0,b=!0,t.isTop=!0),b&&t.cancelScroll(e)},t.onWheel=function(e){t.handleEventDelta(e,e.deltaY)},t.onTouchStart=function(e){t.touchStart=e.changedTouches[0].clientY},t.onTouchMove=function(e){var r=t.touchStart-e.changedTouches[0].clientY;t.handleEventDelta(e,r)},t.getScrollTarget=function(e){t.scrollTarget=e},t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.componentDidMount=function(){this.startListening(this.scrollTarget)},o.componentWillUnmount=function(){this.stopListening(this.scrollTarget)},o.startListening=function(e){e&&("function"==typeof e.addEventListener&&e.addEventListener("wheel",this.onWheel,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchmove",this.onTouchMove,!1))},o.stopListening=function(e){"function"==typeof e.removeEventListener&&e.removeEventListener("wheel",this.onWheel,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchmove",this.onTouchMove,!1)},o.render=function(){return a.a.createElement(na,{innerRef:this.getScrollTarget},this.props.children)},n}(n.Component);function ha(e){var t=e.isEnabled,r=void 0===t||t,n=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(e,["isEnabled"]);return r?a.a.createElement(ba,n):n.children}var ga=function(e,t){void 0===t&&(t={});var r=t,n=r.isSearchable,a=r.isMulti,o=r.label,i=r.isDisabled;switch(e){case"menu":return"Use Up and Down to choose options"+(i?"":", press Enter to select the currently focused option")+", press Escape to exit the menu, press Tab to select the option and exit the menu.";case"input":return(o||"Select")+" is focused "+(n?",type to refine list":"")+", press Down to open the menu, "+(a?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value"}},va=function(e,t){var r=t.value,n=t.isDisabled;if(r)switch(e){case"deselect-option":case"pop-value":case"remove-value":return"option "+r+", deselected.";case"select-option":return n?"option "+r+" is disabled. Select another option.":"option "+r+", selected."}},ya=function(e){return!!e.isDisabled};var wa={clearIndicator:Tn,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":null,pointerEvents:t?"none":null,position:"relative"}},control:function(e){var t=e.isDisabled,r=e.isFocused,n=e.theme,a=n.colors,o=n.borderRadius,i=n.spacing;return{label:"control",alignItems:"center",backgroundColor:t?a.neutral5:a.neutral0,borderColor:t?a.neutral10:r?a.primary:a.neutral20,borderRadius:o,borderStyle:"solid",borderWidth:1,boxShadow:r?"0 0 0 1px "+a.primary:null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:i.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:r?a.primary:a.neutral30}}},dropdownIndicator:Sn,group:function(e){var t=e.theme.spacing;return{paddingBottom:2*t.baseUnit,paddingTop:2*t.baseUnit}},groupHeading:function(e){var t=e.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:3*t.baseUnit,paddingRight:3*t.baseUnit,textTransform:"uppercase"}},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing.baseUnit,a=r.colors;return{label:"indicatorSeparator",alignSelf:"stretch",backgroundColor:t?a.neutral10:a.neutral20,marginBottom:2*n,marginTop:2*n,width:1}},input:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing,a=r.colors;return{margin:n.baseUnit/2,paddingBottom:n.baseUnit/2,paddingTop:n.baseUnit/2,visibility:t?"hidden":"visible",color:a.neutral80}},loadingIndicator:function(e){var t=e.isFocused,r=e.size,n=e.theme,a=n.colors,o=n.spacing.baseUnit;return{label:"loadingIndicator",color:t?a.neutral60:a.neutral20,display:"flex",padding:2*o,transition:"color 150ms",alignSelf:"center",fontSize:r,lineHeight:1,marginRight:r,textAlign:"center",verticalAlign:"middle"}},loadingMessage:pn,menu:function(e){var t,r=e.placement,n=e.theme,a=n.borderRadius,o=n.spacing,i=n.colors;return(t={label:"menu"})[function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(r)]="100%",t.backgroundColor=i.neutral0,t.borderRadius=a,t.boxShadow="0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",t.marginBottom=o.menuGutter,t.marginTop=o.menuGutter,t.position="absolute",t.width="100%",t.zIndex=1,t},menuList:function(e){var t=e.maxHeight,r=e.theme.spacing.baseUnit;return{maxHeight:t,overflowY:"auto",paddingBottom:r,paddingTop:r,position:"relative",WebkitOverflowScrolling:"touch"}},menuPortal:function(e){var t=e.rect,r=e.offset,n=e.position;return{left:t.left,position:n,top:r,width:t.width,zIndex:1}},multiValue:function(e){var t=e.theme,r=t.spacing,n=t.borderRadius;return{label:"multiValue",backgroundColor:t.colors.neutral10,borderRadius:n/2,display:"flex",margin:r.baseUnit/2,minWidth:0}},multiValueLabel:function(e){var t=e.theme,r=t.borderRadius,n=t.colors,a=e.cropWithEllipsis;return{borderRadius:r/2,color:n.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:a?"ellipsis":null,whiteSpace:"nowrap"}},multiValueRemove:function(e){var t=e.theme,r=t.spacing,n=t.borderRadius,a=t.colors;return{alignItems:"center",borderRadius:n/2,backgroundColor:e.isFocused&&a.dangerLight,display:"flex",paddingLeft:r.baseUnit,paddingRight:r.baseUnit,":hover":{backgroundColor:a.dangerLight,color:a.danger}}},noOptionsMessage:un,option:function(e){var t=e.isDisabled,r=e.isFocused,n=e.isSelected,a=e.theme,o=a.spacing,i=a.colors;return{label:"option",backgroundColor:n?i.primary:r?i.primary25:"transparent",color:t?i.neutral20:n?i.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:2*o.baseUnit+"px "+3*o.baseUnit+"px",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!t&&(n?i.primary:i.primary50)}}},placeholder:function(e){var t=e.theme,r=t.spacing;return{label:"placeholder",color:t.colors.neutral50,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}},singleValue:function(e){var t=e.isDisabled,r=e.theme,n=r.spacing,a=r.colors;return{label:"singleValue",color:t?a.neutral40:a.neutral80,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2,maxWidth:"calc(100% - "+2*n.baseUnit+"px)",overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},valueContainer:function(e){var t=e.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:t.baseUnit/2+"px "+2*t.baseUnit+"px",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}}};var ka={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}};function _a(){return(_a=Object.assign||function(e){for(var t=1;t-1},formatGroupLabel:function(e){return e.label},getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:ya,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return t+" result"+(1!==t?"s":"")+" available"},styles:{},tabIndex:"0",tabSelectsValue:!0},Ea=1,Da=function(e){var t,r;function n(t){var r;(r=e.call(this,t)||this).state={ariaLiveSelection:"",ariaLiveContext:"",focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,menuOptions:{render:[],focusable:[]},selectValue:[]},r.blockOptionHover=!1,r.isComposing=!1,r.clearFocusValueOnUpdate=!1,r.commonProps=void 0,r.components=void 0,r.hasGroups=!1,r.initialTouchX=0,r.initialTouchY=0,r.inputIsHiddenAfterUpdate=void 0,r.instancePrefix="",r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(e){r.controlRef=e},r.focusedOptionRef=null,r.getFocusedOptionRef=function(e){r.focusedOptionRef=e},r.menuListRef=null,r.getMenuListRef=function(e){r.menuListRef=e},r.inputRef=null,r.getInputRef=function(e){r.inputRef=e},r.cacheComponents=function(e){r.components=Vn({},qn,{components:e}.components)},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(e,t){var n=r.props;(0,n.onChange)(e,_a({},t,{name:n.name}))},r.setValue=function(e,t,n){void 0===t&&(t="set-value");var a=r.props,o=a.closeMenuOnSelect,i=a.isMulti;r.onInputChange("",{action:"set-value"}),o&&(r.inputIsHiddenAfterUpdate=!i,r.onMenuClose()),r.clearFocusValueOnUpdate=!0,r.onChange(e,{action:t,option:n})},r.selectOption=function(e){var t=r.props,n=t.blurInputOnSelect,a=t.isMulti,o=r.state.selectValue;if(a)if(r.isOptionSelected(e,o)){var i=r.getOptionValue(e);r.setValue(o.filter((function(e){return r.getOptionValue(e)!==i})),"deselect-option",e),r.announceAriaLiveSelection({event:"deselect-option",context:{value:r.getOptionLabel(e)}})}else r.isOptionDisabled(e,o)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue([].concat(o,[e]),"select-option",e),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));else r.isOptionDisabled(e,o)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue(e,"select-option"),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));n&&r.blurInput()},r.removeValue=function(e){var t=r.state.selectValue,n=r.getOptionValue(e),a=t.filter((function(e){return r.getOptionValue(e)!==n}));r.onChange(a.length?a:null,{action:"remove-value",removedValue:e}),r.announceAriaLiveSelection({event:"remove-value",context:{value:e?r.getOptionLabel(e):""}}),r.focusInput()},r.clearValue=function(){var e=r.props.isMulti;r.onChange(e?[]:null,{action:"clear"})},r.popValue=function(){var e=r.state.selectValue,t=e[e.length-1],n=e.slice(0,e.length-1);r.announceAriaLiveSelection({event:"pop-value",context:{value:t?r.getOptionLabel(t):""}}),r.onChange(n.length?n:null,{action:"pop-value",removedValue:t})},r.getOptionLabel=function(e){return r.props.getOptionLabel(e)},r.getOptionValue=function(e){return r.props.getOptionValue(e)},r.getStyles=function(e,t){var n=wa[e](t);n.boxSizing="border-box";var a=r.props.styles[e];return a?a(n,t):n},r.getElementId=function(e){return r.instancePrefix+"-"+e},r.getActiveDescendentId=function(){var e=r.props.menuIsOpen,t=r.state,n=t.menuOptions,a=t.focusedOption;if(a&&e){var o=n.focusable.indexOf(a),i=n.render[o];return i&&i.key}},r.announceAriaLiveSelection=function(e){var t=e.event,n=e.context;r.setState({ariaLiveSelection:va(t,n)})},r.announceAriaLiveContext=function(e){var t=e.event,n=e.context;r.setState({ariaLiveContext:ga(t,_a({},n,{label:r.props["aria-label"]}))})},r.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(e){r.blockOptionHover=!1},r.onControlMouseDown=function(e){var t=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&r.onMenuClose():t&&r.openMenu("first"):(t&&(r.openAfterFocus=!0),r.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()},r.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button||r.props.isDisabled)){var t=r.props,n=t.isMulti,a=t.menuIsOpen;r.focusInput(),a?(r.inputIsHiddenAfterUpdate=!n,r.onMenuClose()):r.openMenu("first"),e.preventDefault(),e.stopPropagation()}},r.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(r.clearValue(),e.stopPropagation(),r.openAfterFocus=!1,"touchend"===e.type?r.focusInput():setTimeout((function(){return r.focusInput()})))},r.onScroll=function(e){"boolean"==typeof r.props.closeMenuOnScroll?e.target instanceof HTMLElement&&Xr(e.target)&&r.props.onMenuClose():"function"==typeof r.props.closeMenuOnScroll&&r.props.closeMenuOnScroll(e)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(e){var t=e.touches.item(0);t&&(r.initialTouchX=t.clientX,r.initialTouchY=t.clientY,r.userIsDragging=!1)},r.onTouchMove=function(e){var t=e.touches.item(0);if(t){var n=Math.abs(t.clientX-r.initialTouchX),a=Math.abs(t.clientY-r.initialTouchY);r.userIsDragging=n>5||a>5}},r.onTouchEnd=function(e){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(e.target)&&r.menuListRef&&!r.menuListRef.contains(e.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(e){r.userIsDragging||r.onControlMouseDown(e)},r.onClearIndicatorTouchEnd=function(e){r.userIsDragging||r.onClearIndicatorMouseDown(e)},r.onDropdownIndicatorTouchEnd=function(e){r.userIsDragging||r.onDropdownIndicatorMouseDown(e)},r.handleInputChange=function(e){var t=e.currentTarget.value;r.inputIsHiddenAfterUpdate=!1,r.onInputChange(t,{action:"input-change"}),r.onMenuOpen()},r.onInputFocus=function(e){var t=r.props,n=t.isSearchable,a=t.isMulti;r.props.onFocus&&r.props.onFocus(e),r.inputIsHiddenAfterUpdate=!1,r.announceAriaLiveContext({event:"input",context:{isSearchable:n,isMulti:a}}),r.setState({isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(e){r.menuListRef&&r.menuListRef.contains(document.activeElement)?r.inputRef.focus():(r.props.onBlur&&r.props.onBlur(e),r.onInputChange("",{action:"input-blur"}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1}))},r.onOptionHover=function(e){r.blockOptionHover||r.state.focusedOption===e||r.setState({focusedOption:e})},r.shouldHideSelectedOptions=function(){var e=r.props,t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},r.onKeyDown=function(e){var t=r.props,n=t.isMulti,a=t.backspaceRemovesValue,o=t.escapeClearsValue,i=t.inputValue,c=t.isClearable,s=t.isDisabled,l=t.menuIsOpen,d=t.onKeyDown,u=t.tabSelectsValue,p=t.openMenuOnFocus,f=r.state,m=f.focusedOption,b=f.focusedValue,h=f.selectValue;if(!(s||"function"==typeof d&&(d(e),e.defaultPrevented))){switch(r.blockOptionHover=!0,e.key){case"ArrowLeft":if(!n||i)return;r.focusValue("previous");break;case"ArrowRight":if(!n||i)return;r.focusValue("next");break;case"Delete":case"Backspace":if(i)return;if(b)r.removeValue(b);else{if(!a)return;n?r.popValue():c&&r.clearValue()}break;case"Tab":if(r.isComposing)return;if(e.shiftKey||!l||!u||!m||p&&r.isOptionSelected(m,h))return;r.selectOption(m);break;case"Enter":if(229===e.keyCode)break;if(l){if(!m)return;if(r.isComposing)return;r.selectOption(m);break}return;case"Escape":l?(r.inputIsHiddenAfterUpdate=!1,r.onInputChange("",{action:"menu-close"}),r.onMenuClose()):c&&o&&r.clearValue();break;case" ":if(i)return;if(!l){r.openMenu("first");break}if(!m)return;r.selectOption(m);break;case"ArrowUp":l?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":l?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!l)return;r.focusOption("pageup");break;case"PageDown":if(!l)return;r.focusOption("pagedown");break;case"Home":if(!l)return;r.focusOption("first");break;case"End":if(!l)return;r.focusOption("last");break;default:return}e.preventDefault()}},r.buildMenuOptions=function(e,t){var n=e.inputValue,a=void 0===n?"":n,o=e.options,i=function(e,n){var o=r.isOptionDisabled(e,t),i=r.isOptionSelected(e,t),c=r.getOptionLabel(e),s=r.getOptionValue(e);if(!(r.shouldHideSelectedOptions()&&i||!r.filterOption({label:c,value:s,data:e},a))){var l=o?void 0:function(){return r.onOptionHover(e)},d=o?void 0:function(){return r.selectOption(e)},u=r.getElementId("option")+"-"+n;return{innerProps:{id:u,onClick:d,onMouseMove:l,onMouseOver:l,tabIndex:-1},data:e,isDisabled:o,isSelected:i,key:u,label:c,type:"option",value:s}}};return o.reduce((function(e,t,n){if(t.options){r.hasGroups||(r.hasGroups=!0);var a=t.options.map((function(t,r){var a=i(t,n+"-"+r);return a&&e.focusable.push(t),a})).filter(Boolean);if(a.length){var o=r.getElementId("group")+"-"+n;e.render.push({type:"group",key:o,data:t,options:a})}}else{var c=i(t,""+n);c&&(e.render.push(c),e.focusable.push(t))}return e}),{render:[],focusable:[]})};var n=t.value;r.cacheComponents=ur(r.cacheComponents,yn).bind(xa(xa(r))),r.cacheComponents(t.components),r.instancePrefix="react-select-"+(r.props.instanceId||++Ea);var a=Kr(n);r.buildMenuOptions=ur(r.buildMenuOptions,(function(e,t){var r=e,n=r[0],a=r[1],o=t,i=o[0];return yn(a,o[1])&&yn(n.inputValue,i.inputValue)&&yn(n.options,i.options)})).bind(xa(xa(r)));var o=t.menuIsOpen?r.buildMenuOptions(t,a):{render:[],focusable:[]};return r.state.menuOptions=o,r.state.selectValue=a,r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o=n.prototype;return o.componentDidMount=function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()},o.UNSAFE_componentWillReceiveProps=function(e){var t=this.props,r=t.options,n=t.value,a=t.menuIsOpen,o=t.inputValue;if(this.cacheComponents(e.components),e.value!==n||e.options!==r||e.menuIsOpen!==a||e.inputValue!==o){var i=Kr(e.value),c=e.menuIsOpen?this.buildMenuOptions(e,i):{render:[],focusable:[]},s=this.getNextFocusedValue(i),l=this.getNextFocusedOption(c.focusable);this.setState({menuOptions:c,selectValue:i,focusedOption:l,focusedValue:s})}null!=this.inputIsHiddenAfterUpdate&&(this.setState({inputIsHidden:this.inputIsHiddenAfterUpdate}),delete this.inputIsHiddenAfterUpdate)},o.componentDidUpdate=function(e){var t,r,n,a,o,i=this.props,c=i.isDisabled,s=i.menuIsOpen,l=this.state.isFocused;(l&&!c&&e.isDisabled||l&&s&&!e.menuIsOpen)&&this.focusInput(),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(t=this.menuListRef,r=this.focusedOptionRef,n=t.getBoundingClientRect(),a=r.getBoundingClientRect(),o=r.offsetHeight/3,a.bottom+o>n.bottom?Zr(t,Math.min(r.offsetTop+r.clientHeight-t.offsetHeight+o,t.scrollHeight)):a.top-o-1&&(c=s)}this.scrollToFocusedOptionOnUpdate=!(a&&this.menuListRef),this.inputIsHiddenAfterUpdate=!1,this.setState({menuOptions:o,focusedValue:null,focusedOption:o.focusable[c]},(function(){t.onMenuOpen(),t.announceAriaLiveContext({event:"menu"})}))},o.focusValue=function(e){var t=this.props,r=t.isMulti,n=t.isSearchable,a=this.state,o=a.selectValue,i=a.focusedValue;if(r){this.setState({focusedOption:null});var c=o.indexOf(i);i||(c=-1,this.announceAriaLiveContext({event:"value"}));var s=o.length-1,l=-1;if(o.length){switch(e){case"previous":l=0===c?0:-1===c?s:c-1;break;case"next":c>-1&&c0?i-1:a.length-1:"down"===e?o=(i+1)%a.length:"pageup"===e?(o=i-t)<0&&(o=0):"pagedown"===e?(o=i+t)>a.length-1&&(o=a.length-1):"last"===e&&(o=a.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:a[o],focusedValue:null}),this.announceAriaLiveContext({event:"menu",context:{isDisabled:ya(a[o])}})}},o.getTheme=function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(ka):_a({},ka,this.props.theme):ka},o.getCommonProps=function(){var e=this.clearValue,t=this.getStyles,r=this.setValue,n=this.selectOption,a=this.props,o=a.classNamePrefix,i=a.isMulti,c=a.isRtl,s=a.options,l=this.state.selectValue,d=this.hasValue();return{cx:$r.bind(null,o),clearValue:e,getStyles:t,getValue:function(){return l},hasValue:d,isMulti:i,isRtl:c,options:s,selectOption:n,setValue:r,selectProps:a,theme:this.getTheme()}},o.getNextFocusedValue=function(e){if(this.clearFocusValueOnUpdate)return this.clearFocusValueOnUpdate=!1,null;var t=this.state,r=t.focusedValue,n=t.selectValue.indexOf(r);if(n>-1){if(e.indexOf(r)>-1)return r;if(n-1?t:e[0]},o.hasValue=function(){return this.state.selectValue.length>0},o.hasOptions=function(){return!!this.state.menuOptions.render.length},o.countOptions=function(){return this.state.menuOptions.focusable.length},o.isClearable=function(){var e=this.props,t=e.isClearable,r=e.isMulti;return void 0===t?r:t},o.isOptionDisabled=function(e,t){return"function"==typeof this.props.isOptionDisabled&&this.props.isOptionDisabled(e,t)},o.isOptionSelected=function(e,t){var r=this;if(t.indexOf(e)>-1)return!0;if("function"==typeof this.props.isOptionSelected)return this.props.isOptionSelected(e,t);var n=this.getOptionValue(e);return t.some((function(e){return r.getOptionValue(e)===n}))},o.filterOption=function(e,t){return!this.props.filterOption||this.props.filterOption(e,t)},o.formatOptionLabel=function(e,t){if("function"==typeof this.props.formatOptionLabel){var r=this.props.inputValue,n=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:r,selectValue:n})}return this.getOptionLabel(e)},o.formatGroupLabel=function(e){return this.props.formatGroupLabel(e)},o.startListeningComposition=function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))},o.stopListeningComposition=function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))},o.startListeningToTouch=function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))},o.stopListeningToTouch=function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))},o.constructAriaLiveMessage=function(){var e=this.state,t=e.ariaLiveContext,r=e.selectValue,n=e.focusedValue,a=e.focusedOption,o=this.props,i=o.options,c=o.menuIsOpen,s=o.inputValue,l=o.screenReaderStatus;return(n?function(e){var t=e.focusedValue,r=e.getOptionLabel,n=e.selectValue;return"value "+r(t)+" focused, "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedValue:n,getOptionLabel:this.getOptionLabel,selectValue:r}):"")+" "+(a&&c?function(e){var t=e.focusedOption,r=e.getOptionLabel,n=e.options;return"option "+r(t)+" focused"+(t.isDisabled?" disabled":"")+", "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedOption:a,getOptionLabel:this.getOptionLabel,options:i}):"")+" "+function(e){var t=e.inputValue;return e.screenReaderMessage+(t?" for search term "+t:"")+"."}({inputValue:s,screenReaderMessage:l({count:this.countOptions()})})+" "+t},o.renderInput=function(){var e=this.props,t=e.isDisabled,r=e.isSearchable,n=e.inputId,o=e.inputValue,i=e.tabIndex,c=this.components.Input,s=this.state.inputIsHidden,l=n||this.getElementId("input"),d={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};if(!r)return a.a.createElement(ra,_a({id:l,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:Gr,onFocus:this.onInputFocus,readOnly:!0,disabled:t,tabIndex:i,value:""},d));var u=this.commonProps,p=u.cx,f=u.theme,m=u.selectProps;return a.a.createElement(c,_a({autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",cx:p,getStyles:this.getStyles,id:l,innerRef:this.getInputRef,isDisabled:t,isHidden:s,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,selectProps:m,spellCheck:"false",tabIndex:i,theme:f,type:"text",value:o},d))},o.renderPlaceholderOrValue=function(){var e=this,t=this.components,r=t.MultiValue,n=t.MultiValueContainer,o=t.MultiValueLabel,i=t.MultiValueRemove,c=t.SingleValue,s=t.Placeholder,l=this.commonProps,d=this.props,u=d.controlShouldRenderValue,p=d.isDisabled,f=d.isMulti,m=d.inputValue,b=d.placeholder,h=this.state,g=h.selectValue,v=h.focusedValue,y=h.isFocused;if(!this.hasValue()||!u)return m?null:a.a.createElement(s,_a({},l,{key:"placeholder",isDisabled:p,isFocused:y}),b);if(f)return g.map((function(t,c){var s=t===v;return a.a.createElement(r,_a({},l,{components:{Container:n,Label:o,Remove:i},isFocused:s,isDisabled:p,key:e.getOptionValue(t),index:c,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault(),e.stopPropagation()}},data:t}),e.formatOptionLabel(t,"value"))}));if(m)return null;var w=g[0];return a.a.createElement(c,_a({},l,{data:w,isDisabled:p}),this.formatOptionLabel(w,"value"))},o.renderClearIndicator=function(){var e=this.components.ClearIndicator,t=this.commonProps,r=this.props,n=r.isDisabled,o=r.isLoading,i=this.state.isFocused;if(!this.isClearable()||!e||n||!this.hasValue()||o)return null;var c={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return a.a.createElement(e,_a({},t,{innerProps:c,isFocused:i}))},o.renderLoadingIndicator=function(){var e=this.components.LoadingIndicator,t=this.commonProps,r=this.props,n=r.isDisabled,o=r.isLoading,i=this.state.isFocused;if(!e||!o)return null;return a.a.createElement(e,_a({},t,{innerProps:{"aria-hidden":"true"},isDisabled:n,isFocused:i}))},o.renderIndicatorSeparator=function(){var e=this.components,t=e.DropdownIndicator,r=e.IndicatorSeparator;if(!t||!r)return null;var n=this.commonProps,o=this.props.isDisabled,i=this.state.isFocused;return a.a.createElement(r,_a({},n,{isDisabled:o,isFocused:i}))},o.renderDropdownIndicator=function(){var e=this.components.DropdownIndicator;if(!e)return null;var t=this.commonProps,r=this.props.isDisabled,n=this.state.isFocused,o={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return a.a.createElement(e,_a({},t,{innerProps:o,isDisabled:r,isFocused:n}))},o.renderMenu=function(){var e=this,t=this.components,r=t.Group,n=t.GroupHeading,o=t.Menu,i=t.MenuList,c=t.MenuPortal,s=t.LoadingMessage,l=t.NoOptionsMessage,d=t.Option,u=this.commonProps,p=this.state,f=p.focusedOption,m=p.menuOptions,b=this.props,h=b.captureMenuScroll,g=b.inputValue,v=b.isLoading,y=b.loadingMessage,w=b.minMenuHeight,k=b.maxMenuHeight,_=b.menuIsOpen,x=b.menuPlacement,M=b.menuPosition,L=b.menuPortalTarget,E=b.menuShouldBlockScroll,D=b.menuShouldScrollIntoView,S=b.noOptionsMessage,T=b.onMenuScrollToTop,O=b.onMenuScrollToBottom;if(!_)return null;var Y,C=function(t){var r=f===t.data;return t.innerRef=r?e.getFocusedOptionRef:void 0,a.a.createElement(d,_a({},u,t,{isFocused:r}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())Y=m.render.map((function(t){if("group"===t.type){t.type;var o=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n=0||(a[r]=e[r]);return a}(t,["type"]),i=t.key+"-heading";return a.a.createElement(r,_a({},u,o,{Heading:n,headingProps:{id:i},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return C(e)})))}if("option"===t.type)return C(t)}));else if(v){var P=y({inputValue:g});if(null===P)return null;Y=a.a.createElement(s,u,P)}else{var j=S({inputValue:g});if(null===j)return null;Y=a.a.createElement(l,u,j)}var A={minMenuHeight:w,maxMenuHeight:k,menuPlacement:x,menuPosition:M,menuShouldScrollIntoView:D},N=a.a.createElement(ln,_a({},u,A),(function(t){var r=t.ref,n=t.placerProps,c=n.placement,s=n.maxHeight;return a.a.createElement(o,_a({},u,A,{innerRef:r,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:v,placement:c}),a.a.createElement(ha,{isEnabled:h,onTopArrive:T,onBottomArrive:O},a.a.createElement(ma,{isEnabled:E},a.a.createElement(i,_a({},u,{innerRef:e.getMenuListRef,isLoading:v,maxHeight:s}),Y))))}));return L||"fixed"===M?a.a.createElement(c,_a({},u,{appendTo:L,controlElement:this.controlRef,menuPlacement:x,menuPosition:M}),N):N},o.renderFormField=function(){var e=this,t=this.props,r=t.delimiter,n=t.isDisabled,o=t.isMulti,i=t.name,c=this.state.selectValue;if(i&&!n){if(o){if(r){var s=c.map((function(t){return e.getOptionValue(t)})).join(r);return a.a.createElement("input",{name:i,type:"hidden",value:s})}var l=c.length>0?c.map((function(t,r){return a.a.createElement("input",{key:"i-"+r,name:i,type:"hidden",value:e.getOptionValue(t)})})):a.a.createElement("input",{name:i,type:"hidden"});return a.a.createElement("div",null,l)}var d=c[0]?this.getOptionValue(c[0]):"";return a.a.createElement("input",{name:i,type:"hidden",value:d})}},o.renderLiveRegion=function(){return this.state.isFocused?a.a.createElement(ea,{"aria-live":"polite"},a.a.createElement("p",{id:"aria-selection-event"}," ",this.state.ariaLiveSelection),a.a.createElement("p",{id:"aria-context"}," ",this.constructAriaLiveMessage())):null},o.render=function(){var e=this.components,t=e.Control,r=e.IndicatorsContainer,n=e.SelectContainer,o=e.ValueContainer,i=this.props,c=i.className,s=i.id,l=i.isDisabled,d=i.menuIsOpen,u=this.state.isFocused,p=this.commonProps=this.getCommonProps();return a.a.createElement(n,_a({},p,{className:c,innerProps:{id:s,onKeyDown:this.onKeyDown},isDisabled:l,isFocused:u}),this.renderLiveRegion(),a.a.createElement(t,_a({},p,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:l,isFocused:u,menuIsOpen:d}),a.a.createElement(o,_a({},p,{isDisabled:l}),this.renderPlaceholderOrValue(),this.renderInput()),a.a.createElement(r,_a({},p,{isDisabled:l}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())},n}(n.Component);function Sa(){return(Sa=Object.assign||function(e){for(var t=1;t1?r-1:0),a=1;a=0||(a[r]=e[r]);return a}(t,["defaultInputValue","defaultMenuIsOpen","defaultValue"]));return a.a.createElement(Oa,Sa({},r,{ref:function(t){e.select=t},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))},n}(n.Component),Ya.defaultProps=Ta,Ca);function ja(){return(ja=Object.assign||function(e){for(var t=1;t=0&&e=this.state.routes.length)){var n=this.state.routes.slice();n[e][t]=r,this.setState(Na(Na({},this.state),{},{routes:n}))}}},{key:"removeRoute",value:function(e){if(!(e<0||e>=this.state.routes.length)){var t=this.state.routes.slice();t.splice(e,1),this.setState(Na(Na({},this.state),{},{routes:t}))}}},{key:"onAddRoute",value:function(){var e=this.state.routes.slice();e.push({request:"",action:"dynamic",target:"",extra:"",active:1,exact:1}),this.setState(Na(Na({},this.state),{},{routes:e}))}},{key:"changeAction",value:function(e,t){this.changeRoute(e,"action",t)}},{key:"changeActive",value:function(e,t){this.changeRoute(e,"active",t.target.checked?1:0)}},{key:"changeExact",value:function(e,t){this.changeRoute(e,"exact",t.target.checked?1:0)}},{key:"changeRequest",value:function(e,t){this.changeRoute(e,"request",t.target.value)}},{key:"changeTarget",value:function(e,t){this.changeRoute(e,"target",t.target.value)}},{key:"changeExtra",value:function(e,t){this.changeRoute(e,"extra",t.target.value)}},{key:"fetchRoutes",value:function(){var e=this;this.parent.api.getRoutes().then((function(t){if(t.success)e.setState(Na(Na({},e.state),{},{routes:t.routes,isResetting:!1})),ut.rebuild();else{var r=e.state.errors.slice();r.push({title:"Error fetching routes",message:t.msg}),e.setState(Na(Na({},e.state),{},{errors:r,isResetting:!1}))}}))}}])&&Ha(t.prototype,r),a&&Ha(t,a),i}(n.Component);function Va(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return qa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qa(e,t)}(e,t)||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 qa(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&e0?this.state.user.password:null,i=Object.keys(this.state.user.groups),c=this.state.user.confirmed;this.setState(Qa(Qa({},this.state),{},{isSaving:!0})),this.parent.api.editUser(r,n,a,o,i,c).then((function(e){var r=t.state.alerts.slice();e.success?(r.push({title:"Success",message:"User was successfully updated.",type:"success"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})}))):(r.push({title:"Error updating user",message:e.msg,type:"danger"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})})))}))}},{key:"onDeleteUser",value:function(e){var t=this;e.preventDefault(),e.stopPropagation();var r=this.props.match.params.userId;this.parent.showDialog("Are you sure you want to delete this user permanently?","Delete User?",["Yes","No"],(function(e){"Yes"===e&&t.parent.api.deleteUser(r).then((function(e){if(e.success)t.props.history.push("/admin/users");else{var r=t.state.alerts.slice();r.push({title:"Error deleting user",message:e.msg,type:"danger"}),t.setState(Qa(Qa({},t.state),{},{isSaving:!1,alerts:r,user:Qa(Qa({},t.state.user),{},{password:""})}))}}))}))}},{key:"onRemoveGroup",value:function(e,t){if(e.stopPropagation(),this.state.user.groups.hasOwnProperty(t)){var r=Qa({},this.state.user.groups);delete r[t],this.setState(Qa(Qa({},this.state),{},{user:Qa(Qa({},this.state.user),{},{groups:r})}))}}},{key:"onAddGroup",value:function(e,t){if(e.stopPropagation(),!this.state.user.groups.hasOwnProperty(t)){var r=Qa(Qa({},this.state.user.groups),{},Za({},t,Qa({},this.state.groups[t])));this.setState(Qa(Qa({},this.state),{},{user:Qa(Qa({},this.state.user),{},{groups:r}),searchActive:!1,searchString:""}))}}},{key:"render",value:function(){var e=this;if(!this.state.loaded)return n.createElement("h2",{className:"text-center"},"Loading…",n.createElement("br",null),n.createElement(m,{icon:"spinner",className:"mt-3 text-muted fa-2x"}));var t=[],r=null;if(this.state.fetchError)t.push(n.createElement(Le,{key:"error-fetch",title:"Error fetching data",type:"danger",message:n.createElement("div",null,this.state.fetchError,n.createElement("br",null),"You can meanwhile return to the ",n.createElement(be,{to:"/admin/users"},"user overview"))}));else{for(var a=function(r){t.push(n.createElement(Le,Ka({key:"error-"+r,onClose:function(){return e.removeAlert(r)}},e.state.alerts[r])))},o=0;o0||this.state.searchActive?"block":"none";c.length>0&&(d=.75+.75*this.state.searchString.length+"em",u=""),this.state.searchString.length>0&&0===i.length&&i.push(n.createElement("li",{className:"select2-results__option",role:"option",key:"group-notfound","aria-selected":!0},"Group not found")),r=n.createElement("form",{role:"form",onSubmit:function(e){return e.preventDefault()}},n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"username"},"Username"),n.createElement("input",{type:"text",className:"form-control",placeholder:"Enter username",name:"username",id:"username",maxLength:32,value:this.state.user.name,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"email"},"E-Mail"),n.createElement("input",{type:"email",className:"form-control",placeholder:"E-Mail address",id:"email",name:"email",maxLength:64,value:this.state.user.email,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group"},n.createElement("label",{htmlFor:"password"},"Password"),n.createElement("input",{type:"password",className:"form-control",placeholder:"(unchanged)",id:"password",name:"password",value:this.state.user.password,onChange:this.onChangeInput.bind(this)})),n.createElement("div",{className:"form-group position-relative"},n.createElement("label",null,"Groups"),n.createElement("span",{className:"select2 select2-container select2-container--default select2-container--below",dir:"ltr",style:{width:"100%"}},n.createElement("span",{className:"selection"},n.createElement("span",{className:"select2-selection select2-selection--multiple",role:"combobox","aria-haspopup":"true","aria-expanded":!1,"aria-disabled":!1,onClick:this.onToggleSearch.bind(this)},n.createElement("ul",{className:"select2-selection__rendered"},c,n.createElement("li",{className:"select2-search select2-search--inline"},n.createElement("input",{className:"select2-search__field",type:"search",tabIndex:0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,role:"searchbox","aria-autocomplete":"list",placeholder:u,name:"search",style:{width:d},value:this.state.searchString,onChange:this.onChangeInput.bind(this),ref:this.searchBox}))))),n.createElement("span",{className:"dropdown-wrapper","aria-hidden":"true"})),n.createElement("span",{className:"select2-container select2-container--default select2-container--open",style:{position:"absolute",bottom:0,left:0,width:"100%",display:p}},n.createElement("span",{className:"select2-dropdown select2-dropdown--below",dir:"ltr"},n.createElement("span",{className:"select2-results"},n.createElement("ul",{className:"select2-results__options",role:"listbox","aria-multiselectable":!0,"aria-expanded":!0,"aria-hidden":!1},i))))),n.createElement("div",{className:"form-check"},n.createElement("input",{type:"checkbox",className:"form-check-input",onChange:this.onChangeInput.bind(this),id:"confirmed",name:"confirmed",checked:this.state.user.confirmed}),n.createElement("label",{className:"form-check-label",htmlFor:"confirmed"},"Confirmed")),n.createElement(be,{to:"/admin/users",className:"btn btn-info mt-2 mr-2"},n.createElement(m,{icon:"arrow-left"})," Back"),this.state.isSaving?n.createElement("button",{type:"submit",className:"btn btn-primary mt-2 mr-2",disabled:!0},"Saving… ",n.createElement(m,{icon:"circle-notch"})):n.createElement("button",{type:"submit",className:"btn btn-primary mt-2 mr-2",onClick:this.onSubmitForm.bind(this)},"Save"),this.state.isDeleting?n.createElement("button",{type:"submit",className:"btn btn-danger mt-2",disabled:!0},"Deleting… ",n.createElement(m,{icon:"circle-notch"})):n.createElement("button",{type:"submit",className:"btn btn-danger mt-2",onClick:this.onDeleteUser.bind(this)},"Delete"))}return n.createElement(n.Fragment,null,n.createElement("div",{className:"content-header"},n.createElement("div",{className:"container-fluid"},n.createElement("div",{className:"row mb-2"},n.createElement("div",{className:"col-sm-6"},n.createElement("h1",{className:"m-0 text-dark"},"Edit User")),n.createElement("div",{className:"col-sm-6"},n.createElement("ol",{className:"breadcrumb float-sm-right"},n.createElement("li",{className:"breadcrumb-item"},n.createElement(be,{to:"/admin/dashboard"},"Home")),n.createElement("li",{className:"breadcrumb-item"},n.createElement(be,{to:"/admin/users"},"Users")),n.createElement("li",{className:"breadcrumb-item active"},"Add User")))))),n.createElement("div",{className:"content"},n.createElement("div",{className:"row"},n.createElement("div",{className:"col-lg-6 pl-5 pr-5"},t,r))))}}])&&eo(t.prototype,r),a&&eo(t,a),i}(n.Component),io=(r(732),r(414)),co=r.n(io);function so(e){return(so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lo(){return(lo=Object.assign||function(e){for(var t=1;t=0&&e=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,c=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){c=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw o}}}}function _o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=this.state.uncategorised.settings.length)){var t=this.state.uncategorised.settings.slice();t.splice(e,1),this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:t})}))}}},{key:"onChangeUncategorisedValue",value:function(e,t,r){if(!(t<0||t>=this.state.uncategorised.settings.length)){var n=this.state.uncategorised.settings.slice();r?n[t].key=e.target.value:n[t].value=e.target.value,this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:n})}))}}},{key:"onAddUncategorisedProperty",value:function(){var e=this.state.uncategorised.settings.slice();e.push({key:"",value:""}),this.setState(Lo(Lo({},this.state),{},{uncategorised:Lo(Lo({},this.state.uncategorised),{},{settings:e})}))}},{key:"componentDidMount",value:function(){var e=this;this.parent.api.getSettings().then((function(t){if(t.success){var r=Lo(Lo({},e.state),{},{settings:t.settings,uncategorised:Lo(Lo({},e.state.uncategorised),{},{settings:e.getUncategorisedValues(t)})});e.setState(r)}else{var n=e.state.errors.slice();n.push({title:"Error fetching settings",message:t.msg}),e.setState(Lo(Lo({},e.state),{},{errors:n}))}}))}},{key:"removeError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){if(e>=0&&e=0&&e=0&&e=this.state.permissions.length)){var r=e.target.value,n=this.state.permissions.slice();n[t].method=r,this.setState(No(No({},this.state),{},{permissions:n}))}}},{key:"render",value:function(){for(var e=this,t=[],r=function(r){t.push(n.createElement(Le,jo({key:"error-"+r,onClose:function(){return e.removeAlert(r)}},e.state.alerts[r])))},a=0;a=this.state.permissions.length)){var t=this.state.permissions.slice();t.splice(e,1),this.setState(No(No({},this.state),{},{permissions:t}))}}},{key:"onChangePermission",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!(t<0||t>=this.state.permissions.length)){var n=e.target.checked,a=this.state.permissions.slice();if(null===r){if(!n)return;a[t].groups=[]}else if(n&&!a[t].groups.includes(r))a[t].groups.push(r);else{if(n)return;var o=a[t].groups.indexOf(r);if(-1===o)return;a[t].groups.splice(o,1)}this.setState(No(No({},this.state),{},{permissions:a}))}}}])&&Io(t.prototype,r),a&&Io(t,a),i}(n.Component),Uo=r(420),Vo=r.n(Uo);r(788);function qo(e){return(qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Go(){return(Go=Object.assign||function(e){for(var t=1;t=0&&e0&&void 0!==arguments[0]?arguments[0]:[];for(var t in this.state.visitors)if(this.state.visitors.hasOwnProperty(t)){var r=t.split("/"),n=parseInt(this.state.visitors[t]);if("weekly"===this.state.type){var a=h()(t).day();a>=0&&a<7&&(e[a]=n)}else if("monthly"===this.state.type){var o=parseInt(r[2])-1;o>=0&&o=0&&i<12&&(e[i]=n)}}}},{key:"handleChange",value:function(e){this.fetchData(this.state.type,e)}},{key:"render",value:function(){for(var e=this,t=[],r=function(r){t.push(n.createElement(Le,Go({key:"error-"+r,onClose:function(){return e.removeError(r)}},e.state.alerts[r])))},a=0;ae.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0&&e2&&void 0!==arguments[2]?arguments[2]:["Close"],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a={show:!0,message:e,title:t,options:r,onOption:n};this.setState(di(di({},this.state),{},{dialog:di(di({},this.state.dialog),a)}))}},{key:"hideDialog",value:function(){this.setState(di(di({},this.state),{},{dialog:di(di({},this.state.dialog),{},{show:!1})}))}},{key:"fetchNotifications",value:function(){var e=this;this.api.getNotifications().then((function(t){t.success?e.setState(di(di({},e.state),{},{notifications:t.notifications})):e.showDialog("Error fetching notifications: "+t.msg,"Error fetching notifications")}))}},{key:"fetchContactRequests",value:function(){var e=this;this.api.fetchContactRequests().then((function(t){t.success?e.setState(di(di({},e.state),{},{contactRequests:t.contactRequests})):e.showDialog("Error fetching contact requests: "+t.msg,"Error fetching contact requests")}))}},{key:"componentDidMount",value:function(){var e=this;this.api.fetchUser().then((function(t){t?(e.fetchNotifications(),e.fetchContactRequests(),setInterval(e.onUpdate.bind(e),6e4),e.setState(di(di({},e.state),{},{loaded:!0}))):document.location="/admin"}))}},{key:"render",value:function(){var e=this;return this.state.loaded?(this.controlObj={showDialog:this.showDialog.bind(this),fetchNotifications:this.fetchNotifications.bind(this),api:this.api},a.a.createElement(le,null,a.a.createElement(ke,si({},this.controlObj,{notifications:this.state.notifications})),a.a.createElement(Me,si({},this.controlObj,{notifications:this.state.notifications,contactRequests:this.state.contactRequests})),a.a.createElement("div",{className:"content-wrapper p-2"},a.a.createElement("section",{className:"content"},a.a.createElement(ie,null,a.a.createElement(ee,{path:"/admin/dashboard"},a.a.createElement(At,si({},this.controlObj,{notifications:this.state.notifications}))),a.a.createElement(ee,{exact:!0,path:"/admin/users"},a.a.createElement(_t,this.controlObj)),a.a.createElement(ee,{path:"/admin/user/add"},a.a.createElement(Gt,this.controlObj)),a.a.createElement(ee,{path:"/admin/user/edit/:userId",render:function(t){var r=di(di({},t),e.controlObj);return a.a.createElement(oo,r)}}),a.a.createElement(ee,{path:"/admin/user/permissions"},a.a.createElement(Bo,this.controlObj)),a.a.createElement(ee,{path:"/admin/group/add"},a.a.createElement(yo,this.controlObj)),a.a.createElement(ee,{exact:!0,path:"/admin/contact/"},a.a.createElement(ii,this.controlObj)),a.a.createElement(ee,{path:"/admin/visitors"},a.a.createElement(ri,this.controlObj)),a.a.createElement(ee,{path:"/admin/logs"},a.a.createElement(lr,si({},this.controlObj,{notifications:this.state.notifications}))),a.a.createElement(ee,{path:"/admin/settings"},a.a.createElement(Co,this.controlObj)),a.a.createElement(ee,{path:"/admin/pages"},a.a.createElement(Ua,this.controlObj)),a.a.createElement(ee,{path:"/admin/help"},a.a.createElement(Ga,this.controlObj)),a.a.createElement(ee,{path:"*"},a.a.createElement(Xt,null))),a.a.createElement(Kt,this.state.dialog))),a.a.createElement(Ja,null))):a.a.createElement("b",null,"Loading… ",a.a.createElement(m,{icon:"spinner"}))}}])&&pi(t.prototype,r),n&&pi(t,n),i}(a.a.Component);i.a.render(a.a.createElement(gi,null),document.getElementById("root"))},function(e,t,r){"use strict";r.r(t);var n=r(44),a=r.n(n),o=r(0),i=r.n(o),c=r(1),s=r.n(c),l=r(11),d=r.n(l),u=r(415),p=r.n(u);function f(e,t){for(var r=t;r;){if(r===e)return!0;r=r.parentNode}return!1}var m,b=r(88),h=r.n(b),g=r(30),v=r.n(g),y=r(31),w=r.n(y),k=r(23),_=r.n(k),x=r(32),M=r.n(x);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var S={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-",O:"-o-"};function T(){if(void 0!==m)return m;m="";var e=document.createElement("p").style;for(var t in S)t+"Transform"in e&&(m=t);return m}function O(){return T()?"".concat(T(),"TransitionProperty"):"transitionProperty"}function Y(){return T()?"".concat(T(),"Transform"):"transform"}function C(e,t){var r=O();r&&(e.style[r]=t,"transitionProperty"!==r&&(e.style.transitionProperty=t))}function P(e,t){var r=Y();r&&(e.style[r]=t,"transform"!==r&&(e.style.transform=t))}var j,A=/matrix\((.*)\)/,N=/matrix3d\((.*)\)/;function F(e){var t=e.style.display;e.style.display="none",e.offsetHeight,e.style.display=t}function I(e,t,r){var n=r;if("object"!==L(t))return void 0!==n?("number"==typeof n&&(n="".concat(n,"px")),void(e.style[t]=n)):j(e,t);for(var a in t)t.hasOwnProperty(a)&&I(e,a,t[a])}function H(e,t){var r=e["page".concat(t?"Y":"X","Offset")],n="scroll".concat(t?"Top":"Left");if("number"!=typeof r){var a=e.document;"number"!=typeof(r=a.documentElement[n])&&(r=a.body[n])}return r}function R(e){return H(e)}function z(e){return H(e,!0)}function W(e){var t=function(e){var t,r,n,a=e.ownerDocument,o=a.body,i=a&&a.documentElement;return r=(t=e.getBoundingClientRect()).left,n=t.top,{left:r-=i.clientLeft||o.clientLeft||0,top:n-=i.clientTop||o.clientTop||0}}(e),r=e.ownerDocument,n=r.defaultView||r.parentWindow;return t.left+=R(n),t.top+=z(n),t}function B(e){return null!=e&&e==e.window}function U(e){return B(e)?e.document:9===e.nodeType?e:e.ownerDocument}var V=new RegExp("^(".concat(/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,")(?!px)[a-z%]+$"),"i"),q=/^(top|right|bottom|left)$/,G="left";function J(e,t){return"left"===e?t.useCssRight?"right":e:t.useCssBottom?"bottom":e}function $(e){return"left"===e?"right":"right"===e?"left":"top"===e?"bottom":"bottom"===e?"top":void 0}function K(e,t,r){"static"===I(e,"position")&&(e.style.position="relative");var n=-999,a=-999,o=J("left",r),i=J("top",r),c=$(o),s=$(i);"left"!==o&&(n=999),"top"!==i&&(a=999);var l,d="",u=W(e);("left"in t||"top"in t)&&(d=(l=e).style.transitionProperty||l.style[O()]||"",C(e,"none")),"left"in t&&(e.style[c]="",e.style[o]="".concat(n,"px")),"top"in t&&(e.style[s]="",e.style[i]="".concat(a,"px")),F(e);var p=W(e),f={};for(var m in t)if(t.hasOwnProperty(m)){var b=J(m,r),h="left"===m?n:a,g=u[m]-p[m];f[b]=b===m?h+g:h-g}I(e,f),F(e),("left"in t||"top"in t)&&C(e,d);var v={};for(var y in t)if(t.hasOwnProperty(y)){var w=J(y,r),k=t[y]-u[y];v[w]=y===w?f[w]+k:f[w]-k}I(e,v)}function X(e,t){var r=W(e),n=function(e){var t=window.getComputedStyle(e,null),r=t.getPropertyValue("transform")||t.getPropertyValue(Y());if(r&&"none"!==r){var n=r.replace(/[^0-9\-.,]/g,"").split(",");return{x:parseFloat(n[12]||n[4],0),y:parseFloat(n[13]||n[5],0)}}return{x:0,y:0}}(e),a={x:n.x,y:n.y};"left"in t&&(a.x=n.x+t.left-r.left),"top"in t&&(a.y=n.y+t.top-r.top),function(e,t){var r=window.getComputedStyle(e,null),n=r.getPropertyValue("transform")||r.getPropertyValue(Y());if(n&&"none"!==n){var a,o=n.match(A);if(o)(a=(o=o[1]).split(",").map((function(e){return parseFloat(e,10)})))[4]=t.x,a[5]=t.y,P(e,"matrix(".concat(a.join(","),")"));else(a=n.match(N)[1].split(",").map((function(e){return parseFloat(e,10)})))[12]=t.x,a[13]=t.y,P(e,"matrix3d(".concat(a.join(","),")"))}else P(e,"translateX(".concat(t.x,"px) translateY(").concat(t.y,"px) translateZ(0)"))}(e,a)}function Q(e,t){for(var r=0;r=0&&r.left>=0&&r.bottom>r.top&&r.right>r.left?r:null}function fe(e){var t,r,n;if(se.isWindow(e)||9===e.nodeType){var a=se.getWindow(e);t={left:se.getWindowScrollLeft(a),top:se.getWindowScrollTop(a)},r=se.viewportWidth(a),n=se.viewportHeight(a)}else t=se.offset(e),r=se.outerWidth(e),n=se.outerHeight(e);return t.width=r,t.height=n,t}function me(e,t){var r=t.charAt(0),n=t.charAt(1),a=e.width,o=e.height,i=e.left,c=e.top;return"c"===r?c+=o/2:"b"===r&&(c+=o),"c"===n?i+=a/2:"r"===n&&(i+=a),{left:i,top:c}}function be(e,t,r,n,a){var o=me(t,r[1]),i=me(e,r[0]),c=[i.left-o.left,i.top-o.top];return{left:Math.round(e.left-c[0]+n[0]-a[0]),top:Math.round(e.top-c[1]+n[1]-a[1])}}function he(e,t,r){return e.leftr.right}function ge(e,t,r){return e.topr.bottom}function ve(e,t,r){var n=[];return se.each(e,(function(e){n.push(e.replace(t,(function(e){return r[e]})))})),n}function ye(e,t){return e[t]=-e[t],e}function we(e,t){return(/%$/.test(e)?parseInt(e.substring(0,e.length-1),10)/100*t:parseInt(e,10))||0}function ke(e,t){e[0]=we(e[0],t.width),e[1]=we(e[1],t.height)}function _e(e,t,r,n){var a=r.points,o=r.offset||[0,0],i=r.targetOffset||[0,0],c=r.overflow,s=r.source||e;o=[].concat(o),i=[].concat(i);var l={},d=0,u=pe(s,!(!(c=c||{})||!c.alwaysByViewport)),p=fe(s);ke(o,p),ke(i,t);var f=be(p,t,a,o,i),m=se.merge(p,f);if(u&&(c.adjustX||c.adjustY)&&n){if(c.adjustX&&he(f,p,u)){var b=ve(a,/[lr]/gi,{l:"r",r:"l"}),h=ye(o,0),g=ye(i,0);(function(e,t,r){return e.left>r.right||e.left+t.widthr.bottom||e.top+t.height=r.left&&a.left+o.width>r.right&&(o.width-=a.left+o.width-r.right),n.adjustX&&a.left+o.width>r.right&&(a.left=Math.max(r.right-o.width,r.left)),n.adjustY&&a.top=r.top&&a.top+o.height>r.bottom&&(o.height-=a.top+o.height-r.bottom),n.adjustY&&a.top+o.height>r.bottom&&(a.top=Math.max(r.bottom-o.height,r.top)),se.mix(a,o)}(f,p,u,l))}return m.width!==p.width&&se.css(s,"width",se.width(s)+m.width-p.width),m.height!==p.height&&se.css(s,"height",se.height(s)+m.height-p.height),se.offset(s,{left:m.left,top:m.top},{useCssRight:r.useCssRight,useCssBottom:r.useCssBottom,useCssTransform:r.useCssTransform,ignoreShake:r.ignoreShake}),{points:a,offset:o,targetOffset:i,overflow:l}}function xe(e,t,r){var n=r.target||t;return _e(e,fe(n),r,!function(e,t){var r=pe(e,t),n=fe(e);return!r||n.left+n.width<=r.left||n.top+n.height<=r.top||n.left>=r.right||n.top>=r.bottom}(n,r.overflow&&r.overflow.alwaysByViewport))}function Me(e,t,r){var n,a,o=se.getDocument(e),i=o.defaultView||o.parentWindow,c=se.getWindowScrollLeft(i),s=se.getWindowScrollTop(i),l=se.viewportWidth(i),d=se.viewportHeight(i);n="pageX"in t?t.pageX:c+t.clientX,a="pageY"in t?t.pageY:s+t.clientY;var u=n>=0&&n<=c+l&&a>=0&&a<=s+d;return _e(e,{left:n,top:a,width:0,height:0},function(e){for(var t=1;t children");n=e}})),n}var Re=r(132),ze=r.n(Re),We={transitionstart:{transition:"transitionstart",WebkitTransition:"webkitTransitionStart",MozTransition:"mozTransitionStart",OTransition:"oTransitionStart",msTransition:"MSTransitionStart"},animationstart:{animation:"animationstart",WebkitAnimation:"webkitAnimationStart",MozAnimation:"mozAnimationStart",OAnimation:"oAnimationStart",msAnimation:"MSAnimationStart"}},Be={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},Ue=[],Ve=[];function qe(e,t,r){e.addEventListener(t,r,!1)}function Ge(e,t,r){e.removeEventListener(t,r,!1)}"undefined"!=typeof window&&"undefined"!=typeof document&&function(){var e=document.createElement("div").style;function t(t,r){for(var n in t)if(t.hasOwnProperty(n)){var a=t[n];for(var o in a)if(o in e){r.push(a[o]);break}}}"AnimationEvent"in window||(delete We.animationstart.animation,delete Be.animationend.animation),"TransitionEvent"in window||(delete We.transitionstart.transition,delete Be.transitionend.transition),t(We,Ue),t(Be,Ve)}();var Je={startEvents:Ue,addStartEventListener:function(e,t){0!==Ue.length?Ue.forEach((function(r){qe(e,r,t)})):window.setTimeout(t,0)},removeStartEventListener:function(e,t){0!==Ue.length&&Ue.forEach((function(r){Ge(e,r,t)}))},endEvents:Ve,addEndEventListener:function(e,t){0!==Ve.length?Ve.forEach((function(r){qe(e,r,t)})):window.setTimeout(t,0)},removeEndEventListener:function(e,t){0!==Ve.length&&Ve.forEach((function(r){Ge(e,r,t)}))}},$e=r(417),Ke=r.n($e),Xe=0!==Je.endEvents.length,Qe=["Webkit","Moz","O","ms"],Ze=["-webkit-","-moz-","-o-","ms-",""];function et(e,t){for(var r=window.getComputedStyle(e,null),n="",a=0;a children");return i.a.createElement(st,{key:r.key,ref:function(t){e.childrenRefs[r.key]=t},animation:t.animation,transitionName:t.transitionName,transitionEnter:t.transitionEnter,transitionAppear:t.transitionAppear,transitionLeave:t.transitionLeave},r)})));var o=t.component;if(o){var c=t;return"string"==typeof o&&(c=a()({className:t.className,style:t.style},t.componentProps)),i.a.createElement(o,c,n)}return n[0]||null}}]),t}(i.a.Component);pt.isAnimate=!0,pt.propTypes={className:s.a.string,style:s.a.object,component:s.a.any,componentProps:s.a.object,animation:s.a.object,transitionName:s.a.oneOfType([s.a.string,s.a.object]),transitionEnter:s.a.bool,transitionAppear:s.a.bool,exclusive:s.a.bool,transitionLeave:s.a.bool,onEnd:s.a.func,onEnter:s.a.func,onLeave:s.a.func,onAppear:s.a.func,showProp:s.a.string,children:s.a.node},pt.defaultProps={animation:{},component:"span",componentProps:{},transitionEnter:!0,transitionLeave:!0,transitionAppear:!1,onEnd:ut,onEnter:ut,onLeave:ut,onAppear:ut};var ft=function(){var e=this;this.performEnter=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillEnter(e.handleDoneAdding.bind(e,t,"enter")))},this.performAppear=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillAppear(e.handleDoneAdding.bind(e,t,"appear")))},this.handleDoneAdding=function(t,r){var n=e.props;if(delete e.currentlyAnimatingKeys[t],!n.exclusive||n===e.nextProps){var a=Fe(dt(n));e.isValidChildByKey(a,t)?"appear"===r?ot.allowAppearCallback(n)&&(n.onAppear(t),n.onEnd(t,!0)):ot.allowEnterCallback(n)&&(n.onEnter(t),n.onEnd(t,!0)):e.performLeave(t)}},this.performLeave=function(t){e.childrenRefs[t]&&(e.currentlyAnimatingKeys[t]=!0,e.childrenRefs[t].componentWillLeave(e.handleDoneLeaving.bind(e,t)))},this.handleDoneLeaving=function(t){var r=e.props;if(delete e.currentlyAnimatingKeys[t],!r.exclusive||r===e.nextProps){var n,a,o,i,c=Fe(dt(r));if(e.isValidChildByKey(c,t))e.performEnter(t);else{var s=function(){ot.allowLeaveCallback(r)&&(r.onLeave(t),r.onEnd(t,!1))};n=e.state.children,a=c,o=r.showProp,(i=n.length===a.length)&&n.forEach((function(e,t){var r=a[t];e&&r&&(e&&!r||!e&&r||e.key!==r.key||o&&e.props[o]!==r.props[o])&&(i=!1)})),i?s():e.setState({children:c},s)}}}},mt=Ne(pt),bt=r(418),ht=r.n(bt),gt=function(e){function t(){return v()(this,t),_()(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return M()(t,e),w()(t,[{key:"shouldComponentUpdate",value:function(e){return e.hiddenClassName||e.visible}},{key:"render",value:function(){var e=this.props,t=e.hiddenClassName,r=e.visible,n=ht()(e,["hiddenClassName","visible"]);return t||i.a.Children.count(n.children)>1?(!r&&t&&(n.className+=" "+t),i.a.createElement("div",n)):i.a.Children.only(n.children)}}]),t}(o.Component);gt.propTypes={children:s.a.any,className:s.a.string,visible:s.a.bool,hiddenClassName:s.a.string};var vt=gt,yt=function(e){function t(){return v()(this,t),_()(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return M()(t,e),w()(t,[{key:"render",value:function(){var e=this.props,t=e.className;return e.visible||(t+=" "+e.hiddenClassName),i.a.createElement("div",{className:t,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,style:e.style},i.a.createElement(vt,{className:e.prefixCls+"-content",visible:e.visible},e.children))}}]),t}(o.Component);yt.propTypes={hiddenClassName:s.a.string,className:s.a.string,prefixCls:s.a.string,onMouseEnter:s.a.func,onMouseLeave:s.a.func,children:s.a.any};var wt=yt;function kt(e,t){this[e]=t}var _t=function(e){function t(e){v()(this,t);var r=_()(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return xt.call(r),r.savePopupRef=kt.bind(r,"popupInstance"),r.saveAlignRef=kt.bind(r,"alignInstance"),r}return M()(t,e),w()(t,[{key:"componentDidMount",value:function(){this.rootNode=this.getPopupDomNode()}},{key:"getPopupDomNode",value:function(){return d.a.findDOMNode(this.popupInstance)}},{key:"getMaskTransitionName",value:function(){var e=this.props,t=e.maskTransitionName,r=e.maskAnimation;return!t&&r&&(t=e.prefixCls+"-"+r),t}},{key:"getTransitionName",value:function(){var e=this.props,t=e.transitionName;return!t&&e.animation&&(t=e.prefixCls+"-"+e.animation),t}},{key:"getClassName",value:function(e){return this.props.prefixCls+" "+this.props.className+" "+e}},{key:"getPopupElement",value:function(){var e=this.savePopupRef,t=this.props,r=t.align,n=t.style,o=t.visible,c=t.prefixCls,s=t.destroyPopupOnHide,l=this.getClassName(this.currentAlignClassName||t.getClassNameFromAlign(r)),d=c+"-hidden";o||(this.currentAlignClassName=null);var u=a()({},n,this.getZIndexStyle()),p={className:l,prefixCls:c,ref:e,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,style:u};return s?i.a.createElement(mt,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName()},o?i.a.createElement(Pe,{target:this.getTarget,key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,align:r,onAlign:this.onAlign},i.a.createElement(wt,a()({visible:!0},p),t.children)):null):i.a.createElement(mt,{component:"",exclusive:!0,transitionAppear:!0,transitionName:this.getTransitionName(),showProp:"xVisible"},i.a.createElement(Pe,{target:this.getTarget,key:"popup",ref:this.saveAlignRef,monitorWindowResize:!0,xVisible:o,childrenProps:{visible:"xVisible"},disabled:!o,align:r,onAlign:this.onAlign},i.a.createElement(wt,a()({hiddenClassName:d},p),t.children)))}},{key:"getZIndexStyle",value:function(){var e={},t=this.props;return void 0!==t.zIndex&&(e.zIndex=t.zIndex),e}},{key:"getMaskElement",value:function(){var e=this.props,t=void 0;if(e.mask){var r=this.getMaskTransitionName();t=i.a.createElement(vt,{style:this.getZIndexStyle(),key:"mask",className:e.prefixCls+"-mask",hiddenClassName:e.prefixCls+"-mask-hidden",visible:e.visible}),r&&(t=i.a.createElement(mt,{key:"mask",showProp:"visible",transitionAppear:!0,component:"",transitionName:r},t))}return t}},{key:"render",value:function(){return i.a.createElement("div",null,this.getMaskElement(),this.getPopupElement())}}]),t}(o.Component);_t.propTypes={visible:s.a.bool,style:s.a.object,getClassNameFromAlign:s.a.func,onAlign:s.a.func,getRootDomNode:s.a.func,onMouseEnter:s.a.func,align:s.a.any,destroyPopupOnHide:s.a.bool,className:s.a.string,prefixCls:s.a.string,onMouseLeave:s.a.func};var xt=function(){var e=this;this.onAlign=function(t,r){var n=e.props,a=n.getClassNameFromAlign(r);e.currentAlignClassName!==a&&(e.currentAlignClassName=a,t.className=e.getClassName(a)),n.onAlign(t,r)},this.getTarget=function(){return e.props.getRootDomNode()}},Mt=_t,Lt=r(419),Et=r.n(Lt);function Dt(){}function St(){return""}function Tt(){return window.document}var Ot="undefined"!=typeof navigator&&!!navigator.userAgent.match(/(Android|iPhone|iPad|iPod|iOS|UCWEB)/i),Yt=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"],Ct=p()({displayName:"Trigger",propTypes:{children:s.a.any,action:s.a.oneOfType([s.a.string,s.a.arrayOf(s.a.string)]),showAction:s.a.any,hideAction:s.a.any,getPopupClassNameFromAlign:s.a.any,onPopupVisibleChange:s.a.func,afterPopupVisibleChange:s.a.func,popup:s.a.oneOfType([s.a.node,s.a.func]).isRequired,popupStyle:s.a.object,prefixCls:s.a.string,popupClassName:s.a.string,popupPlacement:s.a.string,builtinPlacements:s.a.object,popupTransitionName:s.a.oneOfType([s.a.string,s.a.object]),popupAnimation:s.a.any,mouseEnterDelay:s.a.number,mouseLeaveDelay:s.a.number,zIndex:s.a.number,focusDelay:s.a.number,blurDelay:s.a.number,getPopupContainer:s.a.func,getDocument:s.a.func,destroyPopupOnHide:s.a.bool,mask:s.a.bool,maskClosable:s.a.bool,onPopupAlign:s.a.func,popupAlign:s.a.object,popupVisible:s.a.bool,maskTransitionName:s.a.oneOfType([s.a.string,s.a.object]),maskAnimation:s.a.string},mixins:[Et()({autoMount:!1,isVisible:function(e){return e.state.popupVisible},getContainer:function(e){var t=e.props,r=document.createElement("div");return r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",(t.getPopupContainer?t.getPopupContainer(Object(l.findDOMNode)(e)):t.getDocument().body).appendChild(r),r}})],getDefaultProps:function(){return{prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:St,getDocument:Tt,onPopupVisibleChange:Dt,afterPopupVisibleChange:Dt,onPopupAlign:Dt,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[]}},getInitialState:function(){var e=this.props;return{popupVisible:"popupVisible"in e?!!e.popupVisible:!!e.defaultPopupVisible}},componentWillMount:function(){var e=this;Yt.forEach((function(t){e["fire"+t]=function(r){e.fireEvents(t,r)}}))},componentDidMount:function(){this.componentDidUpdate({},{popupVisible:this.state.popupVisible})},componentWillReceiveProps:function(e){var t=e.popupVisible;void 0!==t&&this.setState({popupVisible:t})},componentDidUpdate:function(e,t){var r=this.props,n=this.state;if(this.renderComponent(null,(function(){t.popupVisible!==n.popupVisible&&r.afterPopupVisibleChange(n.popupVisible)})),n.popupVisible){var a=void 0;return!this.clickOutsideHandler&&this.isClickToHide()&&(a=r.getDocument(),this.clickOutsideHandler=h()(a,"mousedown",this.onDocumentClick)),void(!this.touchOutsideHandler&&Ot&&(a=a||r.getDocument(),this.touchOutsideHandler=h()(a,"click",this.onDocumentClick)))}this.clearOutsideHandler()},componentWillUnmount:function(){this.clearDelayTimer(),this.clearOutsideHandler()},onMouseEnter:function(e){this.fireEvents("onMouseEnter",e),this.delaySetPopupVisible(!0,this.props.mouseEnterDelay)},onMouseLeave:function(e){this.fireEvents("onMouseLeave",e),this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onPopupMouseEnter:function(){this.clearDelayTimer()},onPopupMouseLeave:function(e){e.relatedTarget&&!e.relatedTarget.setTimeout&&this._component&&this._component.getPopupDomNode&&f(this._component.getPopupDomNode(),e.relatedTarget)||this.delaySetPopupVisible(!1,this.props.mouseLeaveDelay)},onFocus:function(e){this.fireEvents("onFocus",e),this.clearDelayTimer(),this.isFocusToShow()&&(this.focusTime=Date.now(),this.delaySetPopupVisible(!0,this.props.focusDelay))},onMouseDown:function(e){this.fireEvents("onMouseDown",e),this.preClickTime=Date.now()},onTouchStart:function(e){this.fireEvents("onTouchStart",e),this.preTouchTime=Date.now()},onBlur:function(e){this.fireEvents("onBlur",e),this.clearDelayTimer(),this.isBlurToHide()&&this.delaySetPopupVisible(!1,this.props.blurDelay)},onClick:function(e){if(this.fireEvents("onClick",e),this.focusTime){var t=void 0;if(this.preClickTime&&this.preTouchTime?t=Math.min(this.preClickTime,this.preTouchTime):this.preClickTime?t=this.preClickTime:this.preTouchTime&&(t=this.preTouchTime),Math.abs(t-this.focusTime)<20)return;this.focusTime=0}this.preClickTime=0,this.preTouchTime=0,e.preventDefault();var r=!this.state.popupVisible;(this.isClickToHide()&&!r||r&&this.isClickToShow())&&this.setPopupVisible(!this.state.popupVisible)},onDocumentClick:function(e){if(!this.props.mask||this.props.maskClosable){var t=e.target,r=Object(l.findDOMNode)(this),n=this.getPopupDomNode();f(r,t)||f(n,t)||this.close()}},getPopupDomNode:function(){return this._component&&this._component.getPopupDomNode?this._component.getPopupDomNode():null},getRootDomNode:function(){return Object(l.findDOMNode)(this)},getPopupClassNameFromAlign:function(e){var t=[],r=this.props,n=r.popupPlacement,a=r.builtinPlacements,o=r.prefixCls;return n&&a&&t.push(function(e,t,r){var n,a,o=r.points;for(var i in e)if(e.hasOwnProperty(i)&&(n=e[i].points,a=o,n[0]===a[0]&&n[1]===a[1]))return t+"-placement-"+i;return""}(a,o,e)),r.getPopupClassNameFromAlign&&t.push(r.getPopupClassNameFromAlign(e)),t.join(" ")},getPopupAlign:function(){var e=this.props,t=e.popupPlacement,r=e.popupAlign,n=e.builtinPlacements;return t&&n?function(e,t,r){var n=e[t]||{};return a()({},n,r)}(n,t,r):r},getComponent:function(){var e=this.props,t=this.state,r={};return this.isMouseEnterToShow()&&(r.onMouseEnter=this.onPopupMouseEnter),this.isMouseLeaveToHide()&&(r.onMouseLeave=this.onPopupMouseLeave),i.a.createElement(Mt,a()({prefixCls:e.prefixCls,destroyPopupOnHide:e.destroyPopupOnHide,visible:t.popupVisible,className:e.popupClassName,action:e.action,align:this.getPopupAlign(),onAlign:e.onPopupAlign,animation:e.popupAnimation,getClassNameFromAlign:this.getPopupClassNameFromAlign},r,{getRootDomNode:this.getRootDomNode,style:e.popupStyle,mask:e.mask,zIndex:e.zIndex,transitionName:e.popupTransitionName,maskAnimation:e.maskAnimation,maskTransitionName:e.maskTransitionName}),"function"==typeof e.popup?e.popup():e.popup)},setPopupVisible:function(e){this.clearDelayTimer(),this.state.popupVisible!==e&&("popupVisible"in this.props||this.setState({popupVisible:e}),this.props.onPopupVisibleChange(e))},delaySetPopupVisible:function(e,t){var r=this,n=1e3*t;this.clearDelayTimer(),n?this.delayTimer=setTimeout((function(){r.setPopupVisible(e),r.clearDelayTimer()}),n):this.setPopupVisible(e)},clearDelayTimer:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)},clearOutsideHandler:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)},createTwoChains:function(e){var t=this.props.children.props,r=this.props;return t[e]&&r[e]?this["fire"+e]:t[e]||r[e]},isClickToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},isClickToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("click")||-1!==r.indexOf("click")},isMouseEnterToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseEnter")},isMouseLeaveToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("hover")||-1!==r.indexOf("mouseLeave")},isFocusToShow:function(){var e=this.props,t=e.action,r=e.showAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("focus")},isBlurToHide:function(){var e=this.props,t=e.action,r=e.hideAction;return-1!==t.indexOf("focus")||-1!==r.indexOf("blur")},forcePopupAlign:function(){this.state.popupVisible&&this._component&&this._component.alignInstance&&this._component.alignInstance.forceAlign()},fireEvents:function(e,t){var r=this.props.children.props[e];r&&r(t);var n=this.props[e];n&&n(t)},close:function(){this.setPopupVisible(!1)},render:function(){var e=this.props.children,t=i.a.Children.only(e),r={};return this.isClickToHide()||this.isClickToShow()?(r.onClick=this.onClick,r.onMouseDown=this.onMouseDown,r.onTouchStart=this.onTouchStart):(r.onClick=this.createTwoChains("onClick"),r.onMouseDown=this.createTwoChains("onMouseDown"),r.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?r.onMouseEnter=this.onMouseEnter:r.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?r.onMouseLeave=this.onMouseLeave:r.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(r.onFocus=this.onFocus,r.onBlur=this.onBlur):(r.onFocus=this.createTwoChains("onFocus"),r.onBlur=this.createTwoChains("onBlur")),i.a.cloneElement(t,r)}});t.default=Ct},function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return oe}));var n=r(138),a=r(134),o=r(5);function i(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var r in t=t||{})t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var c=r(135),s=r(45),l=r(47),d=r(6),u=r(90),p=r(3);function f(e,t,r){Object(p.a)(2,arguments);var n=r||{},a=n.locale,i=a&&a.options&&a.options.weekStartsOn,c=null==i?0:Object(d.a)(i),s=null==n.weekStartsOn?c:Object(d.a)(n.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var l=Object(o.default)(e),u=Object(d.a)(t),f=l.getUTCDay(),m=u%7,b=(m+7)%7,h=(b0,a=n?t:1-t;if(a<=50)r=e||100;else{var o=a+50;r=e+100*Math.floor(o/100)-(e>=o%100?100:0)}return n?r:1-r}var $=[31,28,31,30,31,30,31,31,30,31,30,31],K=[31,29,31,30,31,30,31,31,30,31,30,31];function X(e){return e%400==0||e%4==0&&e%100!=0}var Q={G:{priority:140,parse:function(e,t,r,n){switch(t){case"G":case"GG":case"GGG":return r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"});case"GGGGG":return r.era(e,{width:"narrow"});case"GGGG":default:return r.era(e,{width:"wide"})||r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"})}},set:function(e,t,r,n){return t.era=r,e.setUTCFullYear(r,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,t,r,n){var a=function(e){return{year:e,isTwoDigitYear:"yy"===t}};switch(t){case"y":return V(4,e,a);case"yo":return r.ordinalNumber(e,{unit:"year",valueCallback:a});default:return V(t.length,e,a)}},validate:function(e,t,r){return t.isTwoDigitYear||t.year>0},set:function(e,t,r,n){var a=e.getUTCFullYear();if(r.isTwoDigitYear){var o=J(r.year,a);return e.setUTCFullYear(o,0,1),e.setUTCHours(0,0,0,0),e}var i="era"in t&&1!==t.era?1-r.year:r.year;return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,t,r,n){var a=function(e){return{year:e,isTwoDigitYear:"YY"===t}};switch(t){case"Y":return V(4,e,a);case"Yo":return r.ordinalNumber(e,{unit:"year",valueCallback:a});default:return V(t.length,e,a)}},validate:function(e,t,r){return t.isTwoDigitYear||t.year>0},set:function(e,t,r,n){var a=Object(u.a)(e,n);if(r.isTwoDigitYear){var o=J(r.year,a);return e.setUTCFullYear(o,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),Object(g.a)(e,n)}var i="era"in t&&1!==t.era?1-r.year:r.year;return e.setUTCFullYear(i,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),Object(g.a)(e,n)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,t,r,n){return q("R"===t?4:t.length,e)},set:function(e,t,r,n){var a=new Date(0);return a.setUTCFullYear(r,0,4),a.setUTCHours(0,0,0,0),Object(h.a)(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,t,r,n){return q("u"===t?4:t.length,e)},set:function(e,t,r,n){return e.setUTCFullYear(r,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,t,r,n){switch(t){case"Q":case"QQ":return V(t.length,e);case"Qo":return r.ordinalNumber(e,{unit:"quarter"});case"QQQ":return r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(e,{width:"wide",context:"formatting"})||r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=1&&t<=4},set:function(e,t,r,n){return e.setUTCMonth(3*(r-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,t,r,n){switch(t){case"q":case"qq":return V(t.length,e);case"qo":return r.ordinalNumber(e,{unit:"quarter"});case"qqq":return r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(e,{width:"wide",context:"standalone"})||r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=1&&t<=4},set:function(e,t,r,n){return e.setUTCMonth(3*(r-1),1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,t,r,n){var a=function(e){return e-1};switch(t){case"M":return W(v,e,a);case"MM":return V(2,e,a);case"Mo":return r.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(e,{width:"wide",context:"formatting"})||r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.setUTCMonth(r,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,t,r,n){var a=function(e){return e-1};switch(t){case"L":return W(v,e,a);case"LL":return V(2,e,a);case"Lo":return r.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(e,{width:"wide",context:"standalone"})||r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.setUTCMonth(r,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,t,r,n){switch(t){case"w":return W(k,e);case"wo":return r.ordinalNumber(e,{unit:"week"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=53},set:function(e,t,r,n){return Object(g.a)(function(e,t,r){Object(p.a)(2,arguments);var n=Object(o.default)(e),a=Object(d.a)(t),i=Object(b.a)(n,r)-a;return n.setUTCDate(n.getUTCDate()-7*i),n}(e,r,n),n)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,t,r,n){switch(t){case"I":return W(k,e);case"Io":return r.ordinalNumber(e,{unit:"week"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=53},set:function(e,t,r,n){return Object(h.a)(function(e,t){Object(p.a)(2,arguments);var r=Object(o.default)(e),n=Object(d.a)(t),a=Object(m.a)(r)-n;return r.setUTCDate(r.getUTCDate()-7*a),r}(e,r,n),n)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,parse:function(e,t,r,n){switch(t){case"d":return W(y,e);case"do":return r.ordinalNumber(e,{unit:"date"});default:return V(t.length,e)}},validate:function(e,t,r){var n=X(e.getUTCFullYear()),a=e.getUTCMonth();return n?t>=1&&t<=K[a]:t>=1&&t<=$[a]},set:function(e,t,r,n){return e.setUTCDate(r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,parse:function(e,t,r,n){switch(t){case"D":case"DD":return W(w,e);case"Do":return r.ordinalNumber(e,{unit:"date"});default:return V(t.length,e)}},validate:function(e,t,r){return X(e.getUTCFullYear())?t>=1&&t<=366:t>=1&&t<=365},set:function(e,t,r,n){return e.setUTCMonth(0,r),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,t,r,n){switch(t){case"E":case"EE":case"EEE":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,t,r,n){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return V(t.length,e,a);case"eo":return r.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeeee":return r.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,t,r,n){var a=function(e){var t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return V(t.length,e,a);case"co":return r.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"ccccc":return r.day(e,{width:"narrow",context:"standalone"});case"cccccc":return r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return r.day(e,{width:"wide",context:"standalone"})||r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,t,r){return t>=0&&t<=6},set:function(e,t,r,n){return(e=f(e,r,n)).setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,t,r,n){var a=function(e){return 0===e?7:e};switch(t){case"i":case"ii":return V(t.length,e);case"io":return r.ordinalNumber(e,{unit:"day"});case"iii":return r.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiii":default:return r.day(e,{width:"wide",context:"formatting",valueCallback:a})||r.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||r.day(e,{width:"short",context:"formatting",valueCallback:a})||r.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,t,r){return t>=1&&t<=7},set:function(e,t,r,n){return(e=function(e,t){Object(p.a)(2,arguments);var r=Object(d.a)(t);r%7==0&&(r-=7);var n=1,a=Object(o.default)(e),i=a.getUTCDay(),c=r%7,s=(c+7)%7,l=(s=1&&t<=12},set:function(e,t,r,n){var a=e.getUTCHours()>=12;return a&&r<12?e.setUTCHours(r+12,0,0,0):a||12!==r?e.setUTCHours(r,0,0,0):e.setUTCHours(0,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,t,r,n){switch(t){case"H":return W(_,e);case"Ho":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=23},set:function(e,t,r,n){return e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,t,r,n){switch(t){case"K":return W(M,e);case"Ko":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=11},set:function(e,t,r,n){return e.getUTCHours()>=12&&r<12?e.setUTCHours(r+12,0,0,0):e.setUTCHours(r,0,0,0),e},incompatibleTokens:["a","b","h","H","k","t","T"]},k:{priority:70,parse:function(e,t,r,n){switch(t){case"k":return W(x,e);case"ko":return r.ordinalNumber(e,{unit:"hour"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=1&&t<=24},set:function(e,t,r,n){var a=r<=24?r%24:r;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,t,r,n){switch(t){case"m":return W(E,e);case"mo":return r.ordinalNumber(e,{unit:"minute"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=59},set:function(e,t,r,n){return e.setUTCMinutes(r,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,t,r,n){switch(t){case"s":return W(D,e);case"so":return r.ordinalNumber(e,{unit:"second"});default:return V(t.length,e)}},validate:function(e,t,r){return t>=0&&t<=59},set:function(e,t,r,n){return e.setUTCSeconds(r,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,t,r,n){return V(t.length,e,(function(e){return Math.floor(e*Math.pow(10,3-t.length))}))},set:function(e,t,r,n){return e.setUTCMilliseconds(r),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,t,r,n){switch(t){case"X":return B(F,e);case"XX":return B(I,e);case"XXXX":return B(H,e);case"XXXXX":return B(z,e);case"XXX":default:return B(R,e)}},set:function(e,t,r,n){return t.timestampIsSet?e:new Date(e.getTime()-r)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,t,r,n){switch(t){case"x":return B(F,e);case"xx":return B(I,e);case"xxxx":return B(H,e);case"xxxxx":return B(z,e);case"xxx":default:return B(R,e)}},set:function(e,t,r,n){return t.timestampIsSet?e:new Date(e.getTime()-r)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,t,r,n){return U(e)},set:function(e,t,r,n){return[new Date(1e3*r),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,t,r,n){return U(e)},set:function(e,t,r,n){return[new Date(r),{timestampIsSet:!0}]},incompatibleTokens:"*"}},Z=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,te=/^'([^]*?)'?$/,re=/''/g,ne=/\S/,ae=/[a-zA-Z]/;function oe(e,t,r,u){Object(p.a)(3,arguments);var f=String(e),m=String(t),b=u||{},h=b.locale||n.a;if(!h.match)throw new RangeError("locale must contain match property");var g=h.options&&h.options.firstWeekContainsDate,v=null==g?1:Object(d.a)(g),y=null==b.firstWeekContainsDate?v:Object(d.a)(b.firstWeekContainsDate);if(!(y>=1&&y<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=h.options&&h.options.weekStartsOn,k=null==w?0:Object(d.a)(w),_=null==b.weekStartsOn?k:Object(d.a)(b.weekStartsOn);if(!(_>=0&&_<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(""===m)return""===f?Object(o.default)(r):new Date(NaN);var x,M={firstWeekContainsDate:y,weekStartsOn:_,locale:h},L=[{priority:10,set:ie,index:0}],E=m.match(ee).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,c.a[t])(e,h.formatLong,M):e})).join("").match(Z),D=[];for(x=0;x0&&ne.test(f))return new Date(NaN);var N=L.map((function(e){return e.priority})).sort((function(e,t){return t-e})).filter((function(e,t,r){return r.indexOf(e)===t})).map((function(e){return L.filter((function(t){return t.priority===e})).reverse()})).map((function(e){return e[0]})),F=Object(o.default)(r);if(isNaN(F))return new Date(NaN);var I=Object(a.a)(F,Object(s.a)(F)),H={};for(x=0;x0?r:1-r;return c("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):c(r+1,2)},d:function(e,t){return c(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":case"aaa":return r.toUpperCase();case"aaaaa":return r[0];case"aaaa":default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return c(e.getUTCHours()%12||12,t.length)},H:function(e,t){return c(e.getUTCHours(),t.length)},m:function(e,t){return c(e.getUTCMinutes(),t.length)},s:function(e,t){return c(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return c(Math.floor(n*Math.pow(10,r-3)),t.length)}},l=r(3);var d=r(140),u=r(136),p=r(139),f=r(90),m="midnight",b="noon",h="morning",g="afternoon",v="evening",y="night";function w(e,t){var r=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),o=n%60;if(0===o)return r+String(a);var i=t||"";return r+String(a)+i+c(o,2)}function k(e,t){return e%60==0?(e>0?"-":"+")+c(Math.abs(e)/60,2):_(e,t)}function _(e,t){var r=t||"",n=e>0?"-":"+",a=Math.abs(e);return n+c(Math.floor(a/60),2)+r+c(a%60,2)}var x={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return s.y(e,t)},Y:function(e,t,r,n){var a=Object(f.a)(e,n),o=a>0?a:1-a;return"YY"===t?c(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):c(o,t.length)},R:function(e,t){return c(Object(u.a)(e),t.length)},u:function(e,t){return c(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return c(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return s.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var a=Object(p.a)(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):c(a,t.length)},I:function(e,t,r){var n=Object(d.a)(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):c(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):s.d(e,t)},D:function(e,t,r){var n=function(e){Object(l.a)(1,arguments);var t=Object(i.default)(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),a=r-n;return Math.floor(a/864e5)+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):c(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var a=e.getUTCDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return c(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var a=e.getUTCDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return c(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return c(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,a=e.getUTCHours();switch(n=12===a?b:0===a?m:a/12>=1?"pm":"am",t){case"b":case"bb":case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,a=e.getUTCHours();switch(n=a>=17?v:a>=12?g:a>=4?h:y,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return s.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):s.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):c(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):c(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):s.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):s.s(e,t)},S:function(e,t){return s.S(e,t)},X:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return k(a);case"XXXX":case"XX":return _(a);case"XXXXX":case"XXX":default:return _(a,":")}},x:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return k(a);case"xxxx":case"xx":return _(a);case"xxxxx":case"xxx":default:return _(a,":")}},O:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+w(a,":");case"OOOO":default:return"GMT"+_(a,":")}},z:function(e,t,r,n){var a=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+w(a,":");case"zzzz":default:return"GMT"+_(a,":")}},t:function(e,t,r,n){var a=n._originalDate||e;return c(Math.floor(a.getTime()/1e3),t.length)},T:function(e,t,r,n){return c((n._originalDate||e).getTime(),t.length)}},M=r(135),L=r(45),E=r(47),D=r(6),S=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,T=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,O=/^'([^]*?)'?$/,Y=/''/g,C=/[a-zA-Z]/;function P(e,t,r){Object(l.a)(2,arguments);var c=String(t),s=r||{},d=s.locale||a.a,u=d.options&&d.options.firstWeekContainsDate,p=null==u?1:Object(D.a)(u),f=null==s.firstWeekContainsDate?p:Object(D.a)(s.firstWeekContainsDate);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=d.options&&d.options.weekStartsOn,b=null==m?0:Object(D.a)(m),h=null==s.weekStartsOn?b:Object(D.a)(s.weekStartsOn);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!d.localize)throw new RangeError("locale must contain localize property");if(!d.formatLong)throw new RangeError("locale must contain formatLong property");var g=Object(i.default)(e);if(!Object(n.default)(g))throw new RangeError("Invalid time value");var v=Object(L.a)(g),y=Object(o.a)(g,v),w={firstWeekContainsDate:f,weekStartsOn:h,locale:d,_originalDate:g},k=c.match(T).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,M.a[t])(e,d.formatLong,w):e})).join("").match(S).map((function(e){if("''"===e)return"'";var t=e[0];if("'"===t)return j(e);var r=x[t];if(r)return!s.useAdditionalWeekYearTokens&&Object(E.b)(e)&&Object(E.c)(e),!s.useAdditionalDayOfYearTokens&&Object(E.a)(e)&&Object(E.c)(e),r(y,e,d.localize,w);if(t.match(C))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return e})).join("");return k}function j(e){return e.match(O)[1].replace(Y,"'")}},function(e,t,r){"use strict";r.r(t),r.d(t,"Popper",(function(){return T})),r.d(t,"placements",(function(){return S})),r.d(t,"Manager",(function(){return k})),r.d(t,"Reference",(function(){return P}));var n=r(421),a=r.n(n),o=r(76),i=r.n(o),c=r(15),s=r.n(c),l=r(59),d=r.n(l),u=r(16),p=r.n(u),f=r(422),m=r.n(f),b=r(0),h=r(205),g=r(206),v=r.n(g),y=v()(),w=v()(),k=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),a=0;a1?t-1:0),n=1;n=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var f=new Date(0);f.setFullYear(c+1,0,p),f.setHours(0,0,0,0);var m=Object(n.default)(f,t),b=new Date(0);b.setFullYear(c,0,p),b.setHours(0,0,0,0);var h=Object(n.default)(b,t);return r.getTime()>=m.getTime()?c+1:r.getTime()>=h.getTime()?c:c-1}function s(e,t){Object(i.a)(1,arguments);var r=t||{},a=r.locale,s=a&&a.options&&a.options.firstWeekContainsDate,l=null==s?1:Object(o.a)(s),d=null==r.firstWeekContainsDate?l:Object(o.a)(r.firstWeekContainsDate),u=c(e,t),p=new Date(0);p.setFullYear(u,0,d),p.setHours(0,0,0,0);var f=Object(n.default)(p,t);return f}function l(e,t){Object(i.a)(1,arguments);var r=Object(a.default)(e),o=Object(n.default)(r,t).getTime()-s(r,t).getTime();return Math.round(o/6048e5)+1}}]); \ No newline at end of file diff --git a/test/DatabaseEntity.test.php b/test/DatabaseEntity.test.php index dce45ec..c9f280f 100644 --- a/test/DatabaseEntity.test.php +++ b/test/DatabaseEntity.test.php @@ -1,21 +1,33 @@ getSQL(); + self::$CONTEXT = new Context(); + if (!self::$CONTEXT->initSQL()) { + throw new Exception("Could not establish database connection"); + } + + self::$SQL = self::$CONTEXT->getSQL(); self::$HANDLER = TestEntity::getHandler(self::$SQL); self::$HANDLER->getLogger()->unitTestMode(); } public function testCreateTable() { - $this->assertInstanceOf(\Driver\SQL\Query\CreateTable::class, self::$HANDLER->getTableQuery()); + $this->assertInstanceOf(CreateTable::class, self::$HANDLER->getTableQuery()); $this->assertTrue(self::$HANDLER->createTable()); } @@ -60,7 +72,8 @@ class DatabaseEntityTest extends \PHPUnit\Framework\TestCase { $allEntities = TestEntity::findAll(self::$SQL); $this->assertIsArray($allEntities); $this->assertCount(1, $allEntities); - $this->assertEquals($entityId, $allEntities[0]->getId()); + $this->assertTrue(array_key_exists($entityId, $allEntities)); + $this->assertEquals($entityId, $allEntities[$entityId]->getId()); // delete $this->assertTrue($entity->delete(self::$SQL)); @@ -94,4 +107,16 @@ class TestEntity extends \Objects\DatabaseEntity\DatabaseEntity { public float $d; public \DateTime $e; public ?int $f; + + public function jsonSerialize(): array { + return [ + "id" => $this->getId(), + "a" => $this->a, + "b" => $this->b, + "c" => $this->c, + "d" => $this->d, + "e" => $this->e, + "f" => $this->f, + ]; + } } \ No newline at end of file diff --git a/test/Request.test.php b/test/Request.test.php index a93a48e..d7dd5c0 100644 --- a/test/Request.test.php +++ b/test/Request.test.php @@ -2,7 +2,8 @@ use Api\Request; use Configuration\Configuration; -use Objects\User; +use Objects\Context; +use Objects\DatabaseEntity\User; function __new_header_impl(string $line) { if (preg_match("/^HTTP\/([0-9.]+) (\d+) (.*)$/", $line, $m)) { @@ -34,6 +35,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase { const FUNCTION_OVERRIDES = ["header", "http_response_code"]; static User $USER; static User $USER_LOGGED_IN; + static Context $CONTEXT; static ?string $SENT_CONTENT; static array $SENT_HEADERS; @@ -41,13 +43,9 @@ class RequestTest extends \PHPUnit\Framework\TestCase { public static function setUpBeforeClass(): void { - $config = new Configuration(); - RequestTest::$USER = new User($config); - RequestTest::$USER_LOGGED_IN = new User($config); - if (!RequestTest::$USER->getSQL() || !RequestTest::$USER->getSQL()->isConnected()) { + RequestTest::$CONTEXT = new Context(); + if (!RequestTest::$CONTEXT->initSQL()) { throw new Exception("Could not establish database connection"); - } else { - RequestTest::$USER->setLanguage(\Objects\Language::DEFAULT_LANGUAGE()); } if (!function_exists("runkit7_function_rename") || !function_exists("runkit7_function_remove")) { @@ -65,7 +63,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase { } public static function tearDownAfterClass(): void { - RequestTest::$USER->getSQL()->close(); + RequestTest::$CONTEXT->getSQL()?->close(); foreach (self::FUNCTION_OVERRIDES as $functionName) { runkit7_function_remove($functionName); runkit7_function_rename("__orig_${functionName}_impl", $functionName); @@ -74,7 +72,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase { private function simulateRequest(Request $request, string $method, array $get = [], array $post = [], array $headers = []): bool { - if (!is_cli()) { + if (!self::$CONTEXT->isCLI()) { self::throwException(new \Exception("Cannot simulate request outside cli")); } @@ -97,7 +95,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase { public function testAllMethods() { // all methods allowed - $allMethodsAllowed = new RequestAllMethods(RequestTest::$USER, true); + $allMethodsAllowed = new RequestAllMethods(RequestTest::$CONTEXT, true); $this->assertTrue($this->simulateRequest($allMethodsAllowed, "GET"), $allMethodsAllowed->getLastError()); $this->assertTrue($this->simulateRequest($allMethodsAllowed, "POST"), $allMethodsAllowed->getLastError()); $this->assertFalse($this->simulateRequest($allMethodsAllowed, "PUT"), $allMethodsAllowed->getLastError()); @@ -109,7 +107,7 @@ class RequestTest extends \PHPUnit\Framework\TestCase { public function testOnlyPost() { // only post allowed - $onlyPostAllowed = new RequestOnlyPost(RequestTest::$USER, true); + $onlyPostAllowed = new RequestOnlyPost(RequestTest::$CONTEXT, true); $this->assertFalse($this->simulateRequest($onlyPostAllowed, "GET")); $this->assertEquals("This method is not allowed", $onlyPostAllowed->getLastError(), $onlyPostAllowed->getLastError()); $this->assertEquals(405, self::$SENT_STATUS_CODE); @@ -121,25 +119,25 @@ class RequestTest extends \PHPUnit\Framework\TestCase { public function testPrivate() { // private method - $privateExternal = new RequestPrivate(RequestTest::$USER, true); + $privateExternal = new RequestPrivate(RequestTest::$CONTEXT, true); $this->assertFalse($this->simulateRequest($privateExternal, "GET")); $this->assertEquals("This function is private.", $privateExternal->getLastError()); $this->assertEquals(403, self::$SENT_STATUS_CODE); - $privateInternal = new RequestPrivate(RequestTest::$USER, false); + $privateInternal = new RequestPrivate(RequestTest::$CONTEXT, false); $this->assertTrue($privateInternal->execute()); } public function testDisabled() { // disabled method - $disabledMethod = new RequestDisabled(RequestTest::$USER, true); + $disabledMethod = new RequestDisabled(RequestTest::$CONTEXT, true); $this->assertFalse($this->simulateRequest($disabledMethod, "GET")); $this->assertEquals("This function is currently disabled.", $disabledMethod->getLastError(), $disabledMethod->getLastError()); $this->assertEquals(503, self::$SENT_STATUS_CODE); } public function testLoginRequired() { - $loginRequired = new RequestLoginRequired(RequestTest::$USER, true); + $loginRequired = new RequestLoginRequired(RequestTest::$CONTEXT, true); $this->assertFalse($this->simulateRequest($loginRequired, "GET")); $this->assertEquals("You are not logged in.", $loginRequired->getLastError(), $loginRequired->getLastError()); $this->assertEquals(401, self::$SENT_STATUS_CODE); @@ -147,8 +145,8 @@ class RequestTest extends \PHPUnit\Framework\TestCase { } abstract class TestRequest extends Request { - public function __construct(User $user, bool $externalCall = false, $params = []) { - parent::__construct($user, $externalCall, $params); + public function __construct(Context $context, bool $externalCall = false, $params = []) { + parent::__construct($context, $externalCall, $params); } protected function _die(string $data = ""): bool { @@ -162,35 +160,35 @@ abstract class TestRequest extends Request { } class RequestAllMethods extends TestRequest { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); } } class RequestOnlyPost extends TestRequest { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->forbidMethod("GET"); } } class RequestPrivate extends TestRequest { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->isPublic = false; } } class RequestDisabled extends TestRequest { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->isDisabled = true; } } class RequestLoginRequired extends TestRequest { - public function __construct(User $user, bool $externalCall = false) { - parent::__construct($user, $externalCall, []); + public function __construct(Context $context, bool $externalCall = false) { + parent::__construct($context, $externalCall, []); $this->loginRequired = true; } } \ No newline at end of file diff --git a/test/Router.test.php b/test/Router.test.php index c47ed12..4a1ad2a 100644 --- a/test/Router.test.php +++ b/test/Router.test.php @@ -1,20 +1,17 @@ $token = new TimeBasedTwoFactorToken($secret); - $siteName = $configuration->getSettings()->getSiteName(); - $username = $user->getUsername(); - $url = $token->getUrl($user); + $siteName = $context->getSettings()->getSiteName(); + $username = $context->getUser()->getUsername(); + $url = $token->getUrl($context); $this->assertEquals("otpauth://totp/$username?secret=$secret&issuer=$siteName", $url); } } \ No newline at end of file