diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a30f492..fe7dae8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,9 @@ name: Build packages -# A tag vX.Y.Z builds luci-app-dawnline as .ipk (OpenWrt 24.10, opkg) and .apk -# (OpenWrt 25.12, apk) with the OpenWrt SDK and publishes a GitHub release with -# both packages and sha256sums.txt, the files install.sh and the in-app updater +# A tag vX.Y.Z builds luci-app-dawnline and its translation packages +# (luci-i18n-dawnline-) as .ipk (OpenWrt 24.10, opkg) and .apk (OpenWrt +# 25.12, apk) with the OpenWrt SDK and publishes a GitHub release with the +# packages and sha256sums.txt, the files install.sh and the in-app updater # download. The release notes list what changed since the previous tag, from the # commits (scripts/release-notes.sh). Run it by hand to get the packages as # workflow artifacts only. @@ -89,7 +90,8 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: package-${{ matrix.type }} - path: dist/luci-app-dawnline-${{ needs.version.outputs.version }}.${{ matrix.type }} + # The app and its translation packages (luci-i18n-dawnline-). + path: dist/luci-*-${{ needs.version.outputs.version }}.${{ matrix.type }} if-no-files-found: error retention-days: 7 @@ -123,7 +125,7 @@ jobs: - name: Checksums working-directory: release run: | - sha256sum luci-app-dawnline-* > sha256sums.txt + sha256sum luci-* > sha256sums.txt cat sha256sums.txt - name: Publish the release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7858ea0..ef87b38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,15 @@ jobs: id: types run: npm run --silent typecheck + # The catalogs follow the code: every string collected, translated, its placeholders kept. + - name: Translations + id: i18n + run: | + if ! npm run --silent i18n:check; then + echo "::error::The translation catalogs are out of date or incomplete. Run 'npm run i18n' in web/, translate the new entries in each ru.po and commit them (rules/i18n.md)." + exit 1 + fi + - name: Tests id: tests run: npm test @@ -79,6 +88,7 @@ jobs: echo "|---|---|" echo "| Formatting | ${{ steps.format.outcome }} |" echo "| Types | ${{ steps.types.outcome }} |" + echo "| Translations | ${{ steps.i18n.outcome }} |" echo "| Tests | ${{ steps.tests.outcome }} |" echo "| Bundles | ${{ steps.build.outcome }} |" } >> "$GITHUB_STEP_SUMMARY" diff --git a/AGENTS.md b/AGENTS.md index e469334..34c4a84 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,13 +9,15 @@ Guidance for coding agents working in this repository (`tickcount/luci-app-dawnl - `rules/frontend.md` — TypeScript admin UI and portal: layout of `web/src`, pollers and the live revision. - `rules/shell.md` — install, uninstall, init and CI scripts. - `rules/ui-design.md` — how the admin UI and the portal look: modern product quality, mock first from the real CSS and components, verified in the browser. +- `rules/i18n.md` — translations: every visible string and backend message wrapped, the catalogs, the Russian style guide and glossary. Anything added to the admin UI or the portal is localized in the same change; anything removed takes its catalog entries with it. This repo usually sits inside the router-admin workspace (`../AGENTS.md`). Its rules apply to anything that touches the router: read-only first, backup before mutating, router shell as a literal stdin heredoc over SSH (`../rules/`). ## Layout - `package/luci-app-dawnline/root/` — what lands on the router: ucode modules in `usr/share/ucode/dawnline/` (`rpc/` for the LuCI backend), the agent and updater in `usr/libexec/dawnline/`, the portal in `usr/share/dawnline/portal/`, the init script, rpcd ACL. -- `web/` — TypeScript sources of the admin UI (`src/admin`) and the portal (`src/portal`), shared code in `src/shared`; the built bundles are committed under `package/`. +- `web/` — TypeScript sources of the admin UI (`src/admin`) and the portal (`src/portal`), shared code in `src/shared`; the built bundles are committed under `package/`. `web/i18n/` — the string catalogs' tools (`extract.ts`, `po.ts`, `lmo.ts`). +- `package/luci-app-dawnline/po/` — the admin's catalog (`templates/dawnline.pot`, `ru/dawnline.po`): luci.mk builds the `luci-i18n-dawnline-ru` package from it. The portal's catalog is `web/src/portal/i18n/ru.po`, bundled into the portal. - `install.sh`, `uninstall.sh` — the standalone installer and uninstaller (both have `--dry-run`). - `scripts/` — `lint-ucode.py`, `compile-ucode.sh` (compiles every ucode file of a tree wherever ucode runs), `check-ucode.sh` (the same on the router, without installing), `ucode-container.sh` (compile and unit tests in the OpenWrt rootfs containers CI uses), `deploy.sh` (dev deploy over SSH), `build-packages.sh`, `build-release.sh`, `release-notes.sh`. - `tests/ucode/` — unit tests of the ucode modules (`run.uc` runs every `*.test.uc`; fixtures for `/etc/config` and a stand-in `awg`), run in a container by `run.sh`. @@ -24,7 +26,7 @@ This repo usually sits inside the router-admin workspace (`../AGENTS.md`). Its r - `python3 scripts/lint-ucode.py` (use before definition, exports, POSIX regexes, rpcd methods; layering notes are informational). - `scripts/ucode-container.sh` (needs docker): compiles every ucode file and runs `tests/ucode` on OpenWrt 24.10 and 25.12, exactly what CI does. `scripts/check-ucode.sh` compiles on the router instead when there is no docker. New ucode entry points are added to the compile list in `scripts/compile-ucode.sh`, to `lint-ucode.py`, and to the executables list in `.github/workflows/ci.yml`; a pure function gets a case in `tests/ucode/.test.uc`. -- In `web/`: `npm run format:check`, `npm run typecheck` (sources and tests), `npm test`, `npm run build` — and commit the rebuilt bundles (CI fails on a changed or new file under `package/`). +- In `web/`: `npm run format:check`, `npm run typecheck` (sources and tests), `npm run i18n:check` (after changing visible text: `npm run i18n`, translate the new entries in each `ru.po`), `npm test`, `npm run build` — and commit the rebuilt bundles and the catalogs (CI fails on a changed or new file under `package/`). - `shellcheck -S warning` for the shell scripts (CI finds them by shebang). - A tag builds only after CI passes on it (`build.yml` calls `ci.yml`). @@ -33,6 +35,6 @@ This repo usually sits inside the router-admin workspace (`../AGENTS.md`). Its r - A release is one commit on `main` titled `Dawnline X.Y.Z`; its body is `- ` points, which become the GitHub release notes and the Components "What's new". Work from a branch is squashed into that one commit. - Bump the version in `package/luci-app-dawnline/Makefile` (`PKG_VERSION`), `util.uc` (`VERSION`), `web/package.json` and `web/package-lock.json` (CI checks they agree). - No `Co-Authored-By` or other agent attribution in commits. -- Push `main`, then an annotated tag `vX.Y.Z` ("Dawnline X.Y.Z"); the "Build packages" workflow publishes the `.ipk`, `.apk` and `sha256sums.txt`. +- Push `main`, then an annotated tag `vX.Y.Z` ("Dawnline X.Y.Z"); the "Build packages" workflow publishes the `.ipk`, `.apk` (the app and `luci-i18n-dawnline-ru`) and `sha256sums.txt`. - Re-cutting a release (fixes before anyone installs) rewrites `main`: force-push, `gh release delete vX.Y.Z --cleanup-tag`, cancel a running build of the old tag, tag again. Only with the user's go-ahead. - On the router, install a release the way Components does: `/usr/libexec/dawnline/updater install app@vX.Y.Z` (verified against the release's sha256). diff --git a/README.md b/README.md index 3859cbb..d7e897e 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ [**Quick start**](#-quick-start)  ·  [**Live demo**](https://dawnline-demo.vercel.app)  ·  [Features](#-features)  ·  [How it works](#-how-it-works)  ·  [Screenshots](#-a-closer-look)  ·  [FAQ](#-faq)  ·  [Development](#-development) +**English**  ·  [Русский](README_ru.md) +
@@ -124,6 +126,13 @@ follows a modern design.

Dawnline and AmneziaWG built for your firmware in one place; nightly backups, and export and import to move to another router.

+ + +

🌐 English and Russian

+

The portal follows the visitor's language and switches in its header. The admin pages and the router's messages come in Russian with the luci-i18n-dawnline-ru package.

+ + + ## 🧩 How it works @@ -187,7 +196,8 @@ The installer checks the firmware, the clock, free space and DNS, lets you pick a release (the latest is the default), shows the plan and asks before it changes anything. It downloads the package for your package manager, checks it against `sha256sums.txt`, installs AmneziaWG built for your firmware if it is -missing, then installs Dawnline and checks that LuCI can reach it. +missing, then installs Dawnline (with its Russian translation when LuCI is in +Russian) and checks that LuCI can reach it. > [!NOTE] > Before changing anything it saves `/etc/config/{dawnline,network,firewall,dhcp,uhttpd}` @@ -208,6 +218,7 @@ wget -O /tmp/dawnline-install.sh https://raw.githubusercontent.com/tickcount/luc sh /tmp/dawnline-install.sh --dry-run # check everything, change nothing sh /tmp/dawnline-install.sh -y --tag 0.3.1 # a given release, no questions sh /tmp/dawnline-install.sh --awg grey # AmneziaWG from 2Grey +sh /tmp/dawnline-install.sh --lang ru # with the admin's Russian translation ``` | Option | | @@ -216,8 +227,9 @@ sh /tmp/dawnline-install.sh --awg grey # AmneziaWG from 2Grey | `-n`, `--dry-run` | Check the system, resolve, download and verify the release; change nothing | | `-v`, `--verbose` / `-q`, `--quiet` | More detail / only warnings and errors | | `--tag X.Y.Z` | A given release (`sh install.sh 0.3.1` works too) | -| `--awg auto\|slava\|grey\|skip` | Where AmneziaWG comes from when it is missing: [Slava-Shchipunov], then [2Grey] (`auto`, the default), only one of them, or not at all (install it later from **Dawnline → Updates**). `DAWNLINE_AWG` does the same | +| `--awg auto\|slava\|grey\|skip` | Where AmneziaWG comes from when it is missing: [Slava-Shchipunov], then [2Grey] (`auto`, the default), only one of them, or not at all (install it later from **Dawnline → Components**). `DAWNLINE_AWG` does the same | | `--no-awg` | Same as `--awg skip` | +| `--lang auto\|ru\|none` | The admin's translation, `luci-i18n-dawnline-`: `auto` (the default) adds it when LuCI is set to that language or has its LuCI translation; `none` adds none. An installed one is always kept up to date. Later: **Dawnline → Components → Translation**. `DAWNLINE_LANG` does the same | @@ -248,9 +260,12 @@ opkg update && opkg install ./luci-app-dawnline-0.1.0.ipk # Open apk update && apk add --allow-untrusted ./luci-app-dawnline-0.1.0.apk # OpenWrt 25.12 ``` +The Russian translation is `luci-i18n-dawnline-ru-` from the same +release, installed the same way after the app (then `/etc/init.d/uhttpd restart`). + -**Upgrade** from Dawnline › Updates, or run the installer +**Upgrade** from Dawnline › Components, or run the installer again. Settings, keys and history are kept, and a backup is made first. ### Remove @@ -374,7 +389,9 @@ package/luci-app-dawnline/ root/usr/share/dawnline/portal/ portal CGI wrapper and its (minified) assets root/usr/bin/dawnline command line (`dawnline help`) htdocs/ LuCI views and the generated module dawnline/app.js + po/ the admin's string catalog (dawnline.pot, ru/dawnline.po) web/ TypeScript sources of the admin UI and the portal +web/i18n/ catalog tools: collect strings, merge .po files, compile .lmo build/Dockerfile package build with the OpenWrt SDK scripts/ build, deploy and check scripts ``` @@ -383,7 +400,8 @@ scripts/ build, deploy and check scripts cd web npm ci npm run format # Prettier -npm run ci # format check, types, tests, minified bundles +npm run ci # format check, types, catalogs, tests, minified bundles +npm run i18n # collect new strings into the catalogs (then translate them in ru.po) scripts/lint-ucode.py # static ucode checks scripts/check-ucode.sh root@router # compile every ucode file on a router @@ -393,9 +411,10 @@ scripts/capture-screenshots.mjs --demo # README screenshots from a router, a d scripts/frame-screenshots.py # frame them for this README ``` -The web bundles are committed: CI fails when they are out of date. Pushing a -tag `vX.Y.Z` (matching `PKG_VERSION`) builds both packages with the OpenWrt SDK -and publishes a release with `sha256sums.txt`. +The web bundles and the catalogs are committed: CI fails when they are out of +date or a string is untranslated (`rules/i18n.md`). Pushing a tag `vX.Y.Z` +(matching `PKG_VERSION`) builds the packages and their translations with the +OpenWrt SDK and publishes a release with `sha256sums.txt`. --- diff --git a/README_ru.md b/README_ru.md new file mode 100644 index 0000000..33cfbc0 --- /dev/null +++ b/README_ru.md @@ -0,0 +1,431 @@ +
+ + + + Dawnline + + +

Dawnline

+ +**Ваш роутер на OpenWrt как личный VPN для тех, кого вы выберете.** + +Последний релиз +CI +Загрузки +Лицензия +
+OpenWrt 24.10 +OpenWrt 25.12 +AmneziaWG 2.0 и 3.1 + +[**Быстрый старт**](#-быстрый-старт)  ·  [**Демо**](https://dawnline-demo.vercel.app)  ·  [Возможности](#-возможности)  ·  [Как это работает](#-как-это-работает)  ·  [Скриншоты](#-как-это-выглядит)  ·  [Вопросы](#-вопросы-и-ответы)  ·  [Разработка](#-разработка) + +[English](README.md)  ·  **Русский** + +
+ +
+ +Dawnline запускает сервер [AmneziaWG] на вашем роутере с OpenWrt и даёт каждому, +кого вы пригласите, **личную ссылку**. По ней человек **сам добавляет свои +телефоны и компьютеры** и подключается через AmneziaVPN, AmneziaWG или WireGuard. +Вы решаете, **что ему доступно** (домашняя сеть, интернет или и то и другое), и +**на какой срок, сколько трафика и в какие часы**. + +

+ Личный портал: устройства и доступ, добавление телефона в три шага +
+ Личная страница человека: его устройства и доступ. Телефон добавляется в три шага, и страница видит, когда он подключился. + Попробуйте в демо: ничего не устанавливается и никуда не подключается. +

+ +## 💡 Почему Dawnline? + +Обычно, чтобы поделиться домашним VPN, приходится вручную делать файл +конфигурации, отправлять его в мессенджере и надеяться, что дальше он никуда не +уйдёт. Dawnline делает наоборот: + +| | VPN вручную | С Dawnline | +|---|---|---| +| **Настройка устройства** | Вы делаете конфиг и отправляете его | Человек добавляет устройство сам по своей ссылке | +| **Кому что можно** | Всем одно и то же | Дом, интернет или и то и другое, для каждого своё | +| **Конец доступа** | Найти и удалить его пиры | Дата, лимит трафика или один клик | +| **Что происходит** | Читать `wg show` | Кто в сети, трафик, места, журнал | +| **Когда что-то ломается** | Узнаёте от людей | Автовосстановление замечает и чинит | + +Это преемник [Liminal]: та же идея, перестроенная вокруг людей, а не пиров, с +личным порталом, лимитами, трафиком в реальном времени и современной админкой +в LuCI. + +## 🚀 Быстрый старт + +1. **Установите** на роутер (установщик спрашивает, прежде чем что-то менять): + + ```sh + sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)" + ``` + +2. **Настройте** в LuCI: Network › Dawnline, дальше по + мастеру. Он предложит порт, публичный адрес и сети. +3. **Пригласите** человека: Добавить человека, затем отправьте ему + ссылку или карточку приглашения с QR-кодом. Остальное он сделает сам. + +> [!TIP] +> Если портал за Cloudflare, дайте ему порт, который Cloudflare проксирует: +> 2053, 2083, 2087, 2096 или 8443. + +## ✨ Возможности + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

🔗 Ссылка вместо аккаунта

+

Три слова, например vpn.example.com/kamiro-telosu-bavine. Ссылка и есть ключ: без регистрации и пароля, а новая ссылка сразу отключает старую.

+
+

📱 Свои устройства

+

Люди сами добавляют, переименовывают и удаляют устройства в пределах лимита. При добавлении портал ведёт по шагам: нужное приложение, затем QR-код, ссылка, ключ или файл.

+
+

👥 Люди, а не пиры

+

Карточка на каждого человека: устройства, кто в сети, трафик, дата окончания и лимит. Фильтры по тем, кто требует внимания или на паузе.

+
+

🧭 Кому что доступно

+

Домашняя сеть, интернет или и то и другое; только часть домашних сетей или устройств (NAS, Home Assistant). Семья видит семью, гости видят гостей.

+
+

⏳ Лимиты

+

Даты окончания, лимит трафика на месяц или за всё время, часы доступа, кнопка паузы. Изменения применяются сразу и не обрывают подключения остальных.

+
+

🕶️ Маскировка

+

Пресеты, которые мешают распознать и заблокировать VPN-трафик, и что каждый из них требует от приложений.

+
+

🏠 Интернет как у домашних устройств

+

Устройства людей выходят в интернет так же, как домашние, поэтому ваши прокси, фильтры рекламы и DNS работают и для них.

+
+

🗺️ Обзор и места

+

Кто в сети и с чего, скорость сейчас, последние 30 дней и карта, откуда подключаются, с точностью до города.

+
+

🩺 Чинит себя сам

+

Проверки состояния с исправлением в один клик и автовосстановление, которое каждую минуту проверяет туннели, правила доступа и портал и чинит их.

+
+

📦 Обновления и резервные копии

+

Dawnline и AmneziaWG, собранный под вашу прошивку, в одном месте; ночные резервные копии, экспорт и импорт для переезда на другой роутер.

+
+

🌐 Английский и русский

+

Портал подстраивается под язык посетителя и переключается в шапке. Админка и сообщения роутера на русском с пакетом luci-i18n-dawnline-ru.

+
+ +## 🧩 Как это работает + +```mermaid +flowchart LR + you(["🛠️ Вы, в LuCI"]) -- "добавляете человека" --> link["🔗 Его ссылка"] + link -- "он открывает её" --> portal["📱 Его портал"] + portal -- "добавляет устройство" --> app["Приложение и подключение"] + app == "туннель AmneziaWG" ==> router["🌅 Dawnline
на вашем роутере"] + router -- "если разрешено" --> home["🏠 Домашняя сеть"] + router -- "если разрешено" --> net["🌍 Интернет"] +``` + +1. **Вы добавляете человека** в LuCI и выбираете, что ему доступно, лимит + устройств, дату окончания или лимит трафика. +2. **Он открывает свою ссылку** на любом устройстве. Портал только его: там его + устройства и его доступ; доступ и лимиты меняете только вы. +3. **Он добавляет устройство.** Портал подсказывает приложение для его системы и + передаёт подключение; роутер выдаёт каждому устройству свои ключи. +4. **Устройство подключается** через сервер AmneziaWG на роутере, а Dawnline + пропускает только то, что доступно этому человеку, считает его трафик и + следит за лимитами. + +## 📸 Как это выглядит + +

+ Обзор: кто в сети, скорость, последние 30 дней и откуда подключаются +
+ Обзор: кто в сети, скорость сейчас, последние 30 дней и карта, откуда подключаются. +

+ + + + + + +
+ Люди: все на сервере, с устройствами, трафиком и состоянием +

Люди: в сети, доступ скоро закончится, сверх лимита, вне часов доступа, на паузе.

+
+ Человек: его устройства, трафик, места и лимиты +

Человек: его устройства, трафик, места и лимиты.

+
+ +## 📋 Требования + +| | Что нужно Dawnline | +|---|---| +| **OpenWrt** | 24.10 (opkg, `.ipk`) или 25.12 (apk, `.apk`) | +| **AmneziaWG** | `kmod-amneziawg`, `amneziawg-tools`, `luci-proto-amneziawg`: если их нет, установщик поставит сборку для вашей прошивки | +| **Свободная флеш-память** | около 2 МБ | + +## 📥 Установка + +```sh +sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)" +``` + +Установщик проверяет прошивку, часы, свободное место и DNS, даёт выбрать релиз +(по умолчанию последний), показывает план и спрашивает, прежде чем что-то +менять. Он скачивает пакет для вашего менеджера пакетов, сверяет его с +`sha256sums.txt`, ставит AmneziaWG для вашей прошивки, если его нет, затем +ставит Dawnline (с русским переводом, если LuCI на русском) и проверяет, что +LuCI его видит. + +> [!NOTE] +> Прежде чем что-то менять, он сохраняет `/etc/config/{dawnline,network,firewall,dhcp,uhttpd}` +> и состояние служб в `/etc/dawnline/installer-backups/` (хранятся три последние +> копии) и возвращает их, если какой-то шаг не удался. Пакеты не откатываются: +> чтобы вернуться к старому релизу, запустите установщик с `--tag`. Всё, что он +> делает, записывается в `/tmp/dawnline-install.log`. + +
+Параметры установщика + +
+ +С параметрами его нужно сначала скачать: + +```sh +wget -O /tmp/dawnline-install.sh https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh +sh /tmp/dawnline-install.sh --dry-run # всё проверить, ничего не менять +sh /tmp/dawnline-install.sh -y --tag 0.3.1 # конкретный релиз, без вопросов +sh /tmp/dawnline-install.sh --awg grey # AmneziaWG от 2Grey +sh /tmp/dawnline-install.sh --lang ru # с русским переводом админки +``` + +| Параметр | | +|---|---| +| `-y`, `--yes` | Без вопросов: последний релиз (или `--tag`) и рекомендуемые варианты | +| `-n`, `--dry-run` | Проверить систему, найти, скачать и проверить релиз; ничего не менять | +| `-v`, `--verbose` / `-q`, `--quiet` | Подробнее / только предупреждения и ошибки | +| `--tag X.Y.Z` | Конкретный релиз (`sh install.sh 0.3.1` тоже работает) | +| `--awg auto\|slava\|grey\|skip` | Откуда брать AmneziaWG, если его нет: [Slava-Shchipunov], затем [2Grey] (`auto`, по умолчанию), только один из них или вообще не ставить (потом можно в **Dawnline → Компоненты**). То же самое делает `DAWNLINE_AWG` | +| `--no-awg` | То же, что `--awg skip` | +| `--lang auto\|ru\|none` | Перевод админки, `luci-i18n-dawnline-<язык>`: `auto` (по умолчанию) ставит его, если LuCI настроен на этот язык или в нём стоит перевод LuCI на него; `none` не ставит. Уже установленный перевод всегда обновляется вместе с Dawnline. Позже: **Dawnline → Компоненты → Перевод**. То же самое делает `DAWNLINE_LANG` | + +
+ +
+Если GitHub медленный или заблокирован + +
+ +Установщик сам повторяет загрузки через `ghfast.top` и `gh-proxy.com`. Чтобы +скачать сам установщик через зеркало: + +```sh +sh -c "$(wget -qO- https://cdn.jsdelivr.net/gh/tickcount/luci-app-dawnline@main/install.sh)" +sh -c "$(wget -qO- https://ghfast.top/https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/install.sh)" +``` + +
+ +
+Установка вручную + +
+ +Из [релиза](https://github.com/tickcount/luci-app-dawnline/releases): + +```sh +opkg update && opkg install ./luci-app-dawnline-0.1.0.ipk # OpenWrt 24.10 +apk update && apk add --allow-untrusted ./luci-app-dawnline-0.1.0.apk # OpenWrt 25.12 +``` + +Русский перевод: `luci-i18n-dawnline-ru-<версия>` из того же релиза, ставится +так же, после приложения (затем `/etc/init.d/uhttpd restart`). + +
+ +**Обновление**: в Dawnline › Компоненты или повторным +запуском установщика. Настройки, ключи и история сохраняются, перед обновлением +делается резервная копия. + +### Удаление + +```sh +sh -c "$(wget -qO- https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/uninstall.sh)" +``` + +Деинсталлятор сохраняет конфигурацию в `/etc/dawnline/backups`, запускает +удаление средствами самого Dawnline (как Настройки › Удалить +Dawnline с этого роутера), удаляет пакет и подчищает остатки. После +повторной установки Dawnline восстановите копию в Настройки › +Резервные копии. + +> [!IMPORTANT] +> AmneziaWG остаётся установленным: его могут использовать другие туннели. +> Чтобы удалить и его, добавьте `--remove-awg`. + +
+Параметры деинсталлятора + +
+ +С параметрами его нужно сначала скачать: + +```sh +wget -O /tmp/dawnline-uninstall.sh https://raw.githubusercontent.com/tickcount/luci-app-dawnline/main/uninstall.sh +sh /tmp/dawnline-uninstall.sh --dry-run +``` + +| Параметр | | +|---|---| +| `-y`, `--yes` | Не спрашивать подтверждения | +| `-p`, `--purge` | Удалить также конфигурацию, ключи, историю и все резервные копии (`/etc/config/dawnline`, `/etc/dawnline`); копия не делается | +| `--remove-awg` | Удалить также AmneziaWG, если его не использует другой интерфейс (`--keep-awg`, по умолчанию, оставляет его) | +| `-n`, `--dry-run` | Показать, что будет удалено; ничего не менять | + +Вручную: Настройки › Удалить Dawnline с этого роутера +(резервная копия сохраняется), затем `opkg remove luci-app-dawnline` или +`apk del luci-app-dawnline`. + +
+ +## ❓ Вопросы и ответы + +
+Какими приложениями пользуются люди? + +
+ +AmneziaVPN или AmneziaWG на телефонах и компьютерах, а обычный WireGuard, если +маскировка выключена. Портал показывает каждому приложение для его системы и +как добавить в нём подключение. + +
+ +
+Что делать, если человек потерял ссылку? + +
+ +Создайте новую на его странице. Старая ссылка сразу перестанет работать; его +устройства продолжат работать, если не отметить те, что нужно удалить вместе с +ней. + +
+ +
+Затрагивает ли он остальной роутер? + +
+ +Только то, что создал сам, и `dawnline teardown` убирает всё это. Полный список: +[Что Dawnline меняет на роутере](#-что-dawnline-меняет-на-роутере). + +
+ +
+Как переехать на другой роутер? + +
+ +Экспорт JSON в Настройки › Резервные копии на +старом роутере, установите Dawnline на новый и импортируйте там этот файл. + +
+ +
+Откуда берутся места на карте? + +
+ +Из адреса, с которого подключается устройство: город определяется по нему и +кешируется на роутере. Это можно выключить в Настройках. + +
+ +## 🧾 Что Dawnline меняет на роутере + +Только то, что создал сам: сетевые интерфейсы с меткой `_dawnline`, секции +межсетевого экрана `dawnline_*`, таблицу nft `inet dawnline`, `/tmp/hosts/dawnline`, +сетевое пространство имён `dawnline` с двумя veth-связями (`dlx0` и `dll0`, +вторая подключена к мосту LAN и требует `kmod-veth`), правила маршрутизации для +интерфейсов туннелей с одной таблицей маршрутизации, второй экземпляр dnsmasq на +порту 5354 (`/var/etc/dawnline-dns.conf`), строку cron для проверки пульса +агента и, пока портал включён, экземпляр uhttpd для него. `dawnline teardown` +убирает всё это. + +Данные хранятся в `/etc/config/dawnline` (права 0600, там приватные ключи) и в +`/etc/dawnline/` (трафик, события, выданные конфигурации, резервные копии). +Текущие счётчики живут в `/var/run/dawnline` и записываются во флеш-память не +чаще раза в час. Изменения доступа доходят до туннеля через `awg syncconf`, без +перезапуска интерфейса; `dawnline log` на роутере показывает журнал служб. + +## 🧰 Разработка + +``` +package/luci-app-dawnline/ + root/usr/share/ucode/dawnline/ библиотека на ucode: модель (core), AmneziaWG (awg), apply, live, + ops, view, loop, portal + root/usr/share/rpcd/ucode/ объект RPC luci.dawnline + root/usr/libexec/dawnline/ агент (трафик, лимиты, присутствие) и апдейтер + root/usr/share/dawnline/portal/ CGI-обёртка портала и его (минифицированные) файлы + root/usr/bin/dawnline командная строка (`dawnline help`) + htdocs/ представления LuCI и сгенерированный модуль dawnline/app.js + po/ каталог строк админки (dawnline.pot, ru/dawnline.po) +web/ исходники админки и портала на TypeScript +web/i18n/ инструменты каталогов: сбор строк, слияние .po, сборка .lmo +build/Dockerfile сборка пакетов в OpenWrt SDK +scripts/ скрипты сборки, деплоя и проверок +``` + +```sh +cd web +npm ci +npm run format # Prettier +npm run ci # форматирование, типы, каталоги, тесты, минифицированные бандлы +npm run i18n # собрать новые строки в каталоги (затем перевести их в ru.po) + +scripts/lint-ucode.py # статические проверки ucode +scripts/check-ucode.sh root@router # скомпилировать все файлы ucode на роутере +scripts/deploy.sh root@router # поставить рабочую копию (сначала сохраняет конфиги) +scripts/build-packages.sh all # .ipk и .apk в OpenWrt SDK в Docker +scripts/capture-screenshots.mjs --demo # скриншоты для README с роутера, с демо-людьми вместо настоящих +scripts/frame-screenshots.py # оформить их для README +``` + +Бандлы и каталоги лежат в репозитории: CI падает, если они устарели или строка +не переведена (`rules/i18n.md`). Тег `vX.Y.Z` (совпадающий с `PKG_VERSION`) +собирает пакеты и переводы в OpenWrt SDK и публикует релиз с `sha256sums.txt`. + +--- + +
+Сделано для OpenWrt · лицензия MIT · Наверх ↑ +
+ +[AmneziaWG]: https://docs.amnezia.org/ +[Liminal]: https://github.com/tickcount/openwrt-liminal +[Slava-Shchipunov]: https://github.com/Slava-Shchipunov/awg-openwrt +[2Grey]: https://github.com/2Grey/awg-openwrt diff --git a/build/Dockerfile b/build/Dockerfile index 9e09bef..d4128ce 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -9,13 +9,17 @@ COPY package/luci-app-dawnline /builder/package/feeds/luci/luci-app-dawnline # The SDK's default config builds every kernel module and every package in the # feeds; turn that off and select only this package (it ships scripts and web -# files, so nothing else needs building). +# files, so nothing else needs building) and its translations: luci.mk makes +# luci-i18n-dawnline- from po/ when LuCI's language is selected. RUN make defconfig && \ sed -i -e 's/^CONFIG_ALL_KMODS=y/# CONFIG_ALL_KMODS is not set/' \ -e 's/^CONFIG_ALL_NONSHARED=y/# CONFIG_ALL_NONSHARED is not set/' \ -e 's/^CONFIG_ALL=y/# CONFIG_ALL is not set/' .config && \ echo 'CONFIG_PACKAGE_luci-app-dawnline=m' >> .config && \ + for l in $(ls /builder/package/feeds/luci/luci-app-dawnline/po | grep -v '^templates$'); do \ + sed -i "/CONFIG_LUCI_LANG_$l[= ]/d" .config && echo "CONFIG_LUCI_LANG_$l=y" >> .config; done && \ make defconfig && \ make package/luci-app-dawnline/compile V=s -j4 && \ mkdir -p /builder/out && \ - find /builder/bin/packages -name 'luci-app-dawnline*' \( -name '*.ipk' -o -name '*.apk' \) -exec cp {} /builder/out/ \; + find /builder/bin/packages \( -name 'luci-app-dawnline*' -o -name 'luci-i18n-dawnline-*' \) \ + \( -name '*.ipk' -o -name '*.apk' \) -exec cp {} /builder/out/ \; diff --git a/install.sh b/install.sh index c6d11a1..7432a66 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,8 @@ # sh /tmp/dawnline-install.sh [options] [version] # # Installs AmneziaWG built for this firmware when it is missing, then the -# Dawnline package with its dependencies from the OpenWrt feeds. Settings and +# Dawnline package with its dependencies from the OpenWrt feeds, and the admin's +# translation when LuCI speaks that language (--lang). Settings and # keys survive reinstalls and upgrades. A recovery snapshot of the configs it # may touch is taken first and restored if anything fails. `--help` lists the # options. @@ -18,6 +19,8 @@ INSTALLER_VERSION="1.0.0" REPO="${DAWNLINE_REPO:-tickcount/luci-app-dawnline}" PKG_NAME="luci-app-dawnline" AWG_PKGS="kmod-amneziawg amneziawg-tools luci-proto-amneziawg" +# The admin's translations a release has: luci-i18n-dawnline-. +I18N_LANGS="ru" CONNECT_TIMEOUT=15 METADATA_TIMEOUT=60 @@ -43,6 +46,7 @@ VERBOSE=0 QUIET=0 TAG="" AWG_SOURCE="${DAWNLINE_AWG:-auto}" +I18N_CHOICE="${DAWNLINE_LANG:-auto}" LOG_READY=0 TMP_DIR="" @@ -67,6 +71,11 @@ WAS_ENABLED=0 WAS_RUNNING=0 MODE="install" +I18N_LANG="" +I18N_PKG="" +I18N_ASSET="" +I18N_FILE="" + AWG_ACTION="keep" AWG_CANDIDATES="" AWG_REPO="" @@ -175,12 +184,18 @@ Usage: sh install.sh [options] [version] grey 2Grey/awg-openwrt skip do not install it (add it later in Dawnline → Components) --no-awg Same as --awg skip + --lang LANG The admin's translation (luci-i18n-dawnline-LANG): + auto when LuCI is set to that language or has its + LuCI translation installed (default) + ru Russian + none add none (an installed one is kept up to date) --version Print the installer version -h, --help Show this help Environment: DAWNLINE_REPO=owner/name GitHub repository with the releases ($REPO) DAWNLINE_AWG=SOURCE Same as --awg (the option wins) + DAWNLINE_LANG=LANG Same as --lang (the option wins) DAWNLINE_SNAPSHOT_KEEP=N Recovery snapshots to keep (default 3) Log: $LOG_FILE @@ -214,6 +229,17 @@ set_awg() { esac } +set_lang() { + for _l in auto none $I18N_LANGS; do + [ "$1" = "$_l" ] && { + I18N_CHOICE="$1" + return 0 + } + done + err "Unknown language: $1 (auto, none or one of: $I18N_LANGS)" + return 1 +} + parse_args() { while [ "$#" -gt 0 ]; do case "$1" in @@ -240,6 +266,15 @@ parse_args() { ;; --awg=*) set_awg "${1#*=}" || return 2 ;; --no-awg) AWG_SOURCE="skip" ;; + --lang) + [ "$#" -gt 1 ] || { + err "--lang needs a language (auto, none or one of: $I18N_LANGS)" + return 2 + } + shift + set_lang "$1" || return 2 + ;; + --lang=*) set_lang "${1#*=}" || return 2 ;; --version) printf 'dawnline-installer %s\n' "$INSTALLER_VERSION" exit 0 @@ -268,6 +303,7 @@ parse_args() { return 2 fi set_awg "$AWG_SOURCE" || return 2 + set_lang "$I18N_CHOICE" || return 2 return 0 } @@ -895,6 +931,68 @@ resolve_release() { fi } +lang_name() { + case "$1" in + ru) printf 'Russian' ;; + *) printf '%s' "$1" ;; + esac +} + +# LuCI's language, when Dawnline has a translation for it: its setting, or with +# "auto" (the browser's) a LuCI translation that is installed (base..lmo). +luci_lang() { + _ll="$(uci -q get luci.main.lang)" + for _l in $I18N_LANGS; do + case "$_ll" in "$_l" | "$_l"[_-]*) + printf '%s' "$_l" + return 0 + ;; + esac + done + case "$_ll" in '' | auto) ;; *) return 0 ;; esac + for _l in $I18N_LANGS; do + [ -f "/usr/lib/lua/luci/i18n/base.$_l.lmo" ] && { + printf '%s' "$_l" + return 0 + } + done + return 0 +} + +# The admin's translation: an installed one is kept (it must match the app's +# version), else --lang or LuCI's own language decides. +resolve_i18n() { + I18N_LANG="" + for _l in $I18N_LANGS; do + pkg_is_installed "luci-i18n-dawnline-$_l" && I18N_LANG="$_l" + done + if [ -z "$I18N_LANG" ]; then + case "$I18N_CHOICE" in + none) ;; + auto) I18N_LANG="$(luci_lang)" ;; + *) I18N_LANG="$I18N_CHOICE" ;; + esac + fi + [ -n "$I18N_LANG" ] || return 0 + I18N_PKG="luci-i18n-dawnline-$I18N_LANG" + I18N_ASSET="$I18N_PKG-$VERSION.$EXT" + _rj="$TMP_DIR/release.json" + if [ -s "$_rj" ]; then + _size="$(jsonfilter -i "$_rj" -e "@.assets[@.name='$I18N_ASSET'].size" 2>/dev/null | head -n 1)" + if [ -z "$_size" ]; then + # Releases before the translations have none. + warn "Release $VERSION has no $(lang_name "$I18N_LANG") translation: Dawnline stays in English" + I18N_LANG="" + I18N_PKG="" + I18N_ASSET="" + return 0 + fi + DOWNLOAD_BYTES=$((DOWNLOAD_BYTES + _size)) + else + DOWNLOAD_BYTES=$((DOWNLOAD_BYTES + 262144)) + fi +} + # AmneziaWG packages are built per firmware version and target by the # awg-openwrt projects: _v___. awg_postfix() { @@ -981,6 +1079,11 @@ print_plan() { downgrade) msg " Dawnline: downgrade $WAS_VERSION → $VERSION (a backup is made first)" ;; esac msg " Package manager: $PKG_MANAGER ($ASSET)" + if [ -n "$I18N_PKG" ]; then + msg " Translation: $(lang_name "$I18N_LANG") ($I18N_PKG)" + else + msg " Translation: none (Russian: --lang ru)" + fi case "$AWG_ACTION" in keep) msg " AmneziaWG: keep the installed one" ;; skip) msg " AmneziaWG: skip (install it later from Dawnline → Components)" ;; @@ -1011,28 +1114,37 @@ confirm() { # ---------- download phase ---------- -download_dawnline() { +# download_release_file NAME: one file of the release into $TMP_DIR, verified. +download_release_file() { + _name="$1" _sums="$TMP_DIR/sha256sums.txt" - ASSET_FILE="$TMP_DIR/$ASSET" # The checksum: GitHub's own (API), else the release's sha256sums.txt straight from github.com. - _want="$(asset_digest "$TMP_DIR/release.json" "$ASSET")" + _want="$(asset_digest "$TMP_DIR/release.json" "$_name")" if [ -z "$_want" ]; then - download "$ASSET_BASE/sha256sums.txt" "$_sums" sha256sums.txt || { + [ -s "$_sums" ] || download "$ASSET_BASE/sha256sums.txt" "$_sums" sha256sums.txt || { err "Download failed: sha256sums.txt (does release $VERSION exist?)" return 1 } - _want="$(awk -v f="$ASSET" '$2 == f || $2 == "*" f { print $1; exit }' "$_sums")" + _want="$(awk -v f="$_name" '$2 == f || $2 == "*" f { print $1; exit }' "$_sums")" [ -n "$_want" ] || { - err "sha256sums.txt has no entry for $ASSET: not installing an unverified package" + err "sha256sums.txt has no entry for $_name: not installing an unverified package" return 1 } fi - download "$ASSET_BASE/$ASSET" "$ASSET_FILE" "$ASSET" "$_want" || { - err "Download failed: $ASSET" + download "$ASSET_BASE/$_name" "$TMP_DIR/$_name" "$_name" "$_want" || { + err "Download failed: $_name" return 1 } - verify_archive "$ASSET_FILE" || return 1 - ok "$ASSET verified (sha256, package format)" + verify_archive "$TMP_DIR/$_name" || return 1 + ok "$_name verified (sha256, package format)" +} + +download_dawnline() { + download_release_file "$ASSET" || return 1 + ASSET_FILE="$TMP_DIR/$ASSET" + [ -n "$I18N_ASSET" ] || return 0 + download_release_file "$I18N_ASSET" || return 1 + I18N_FILE="$TMP_DIR/$I18N_ASSET" } download_awg() { @@ -1156,11 +1268,16 @@ install_dawnline() { _force=0 case "$MODE" in reinstall | downgrade) _force=1 ;; esac if [ "$DRY_RUN" -eq 1 ]; then - dry "$MODE Dawnline $VERSION ($ASSET)" + dry "$MODE Dawnline $VERSION ($ASSET${I18N_ASSET:+, $I18N_ASSET})" return 0 fi msg "Installing Dawnline $VERSION" - pkg_install_files dawnline "$_force" "$ASSET_FILE" + # The translation in the same transaction: it depends on this very version. + if [ -n "$I18N_FILE" ]; then + pkg_install_files dawnline "$_force" "$ASSET_FILE" "$I18N_FILE" + else + pkg_install_files dawnline "$_force" "$ASSET_FILE" + fi } healthcheck() { @@ -1201,6 +1318,9 @@ healthcheck() { if [ "$_r" != true ]; then warn "The Dawnline agent is not running yet (see Dawnline → Diagnostics)" fi + if [ -n "$I18N_PKG" ] && [ "$(pkg_version "$I18N_PKG")" != "$VERSION" ]; then + warn "$I18N_PKG $VERSION is not installed: Dawnline shows in English" + fi ok "Healthcheck passed: $PKG_NAME $VERSION, LuCI backend answers" } @@ -1215,6 +1335,15 @@ keep_service_intent() { return 0 } +# LuCI reads a language's catalogs once per web server process: a new or +# replaced translation needs a fresh one. +reload_luci() { + [ "$DRY_RUN" -eq 0 ] && [ -n "$I18N_FILE" ] || return 0 + msg "Restarting the web server so LuCI reads the translation" + /etc/init.d/uhttpd restart >/dev/null 2>&1 || + warn "uhttpd did not restart: the translation shows after a reboot" +} + commit_transaction() { TX_COMMITTED=1 TX_ACTIVE=0 @@ -1328,6 +1457,7 @@ main() { select_release resolve_release || fail "Could not resolve the Dawnline release" + resolve_i18n resolve_awg || fail "AmneziaWG is not available for this firmware" check_tmp_space || fail "Not enough free memory for the downloads" print_plan @@ -1348,6 +1478,7 @@ main() { healthcheck || fail "The installed Dawnline did not pass the healthcheck" keep_service_intent commit_transaction + reload_luci trap on_hup HUP _took=$(($(date +%s 2>/dev/null || echo "$START_TS") - START_TS)) diff --git a/package/luci-app-dawnline/Makefile b/package/luci-app-dawnline/Makefile index 46c1377..269c72d 100644 --- a/package/luci-app-dawnline/Makefile +++ b/package/luci-app-dawnline/Makefile @@ -6,9 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-dawnline -PKG_VERSION:=0.10.0 +PKG_VERSION:=0.11.0 PKG_RELEASE:=1 PKG_LICENSE:=MIT +# po//dawnline.po becomes luci-i18n-dawnline- (luci.mk), released +# with the app and at its version (luci.mk would take a git revision otherwise). +PKG_PO_VERSION:=$(PKG_VERSION)-r$(PKG_RELEASE) LUCI_TITLE:=Dawnline - AmneziaWG access server # AmneziaWG itself (kmod-amneziawg, amneziawg-tools, luci-proto-amneziawg) is not diff --git a/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js b/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js index a343a53..7953e6f 100644 --- a/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js +++ b/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js @@ -5,25 +5,27 @@ 'require poll'; 'require rpc'; 'require ui'; -var vi=Object.create;var Po=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var wi=Object.getPrototypeOf,yi=Object.prototype.hasOwnProperty;var ki=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var $i=(n,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of xi(e))!yi.call(n,a)&&a!==r&&Po(n,a,{get:()=>e[a],enumerable:!(o=bi(e,a))||o.enumerable});return n};var Ci=(n,e,r)=>(r=n!=null?vi(wi(n)):{},$i(e||!n||!n.__esModule?Po(r,"default",{value:n,enumerable:!0}):r,n));var Wo=ki((Uo,Go)=>{"use strict";var jo=(function(){var n=function(C,k){var y=236,w=17,b=C,H=r[k],f=null,g=0,M=null,T=[],z={},W=function(A,N){g=b*4+17,f=(function(S){for(var O=new Array(S),_=0;_=7&&Q(A),M==null&&(M=F(b,H,T)),ee(M,N)},q=function(A,N){for(var S=-1;S<=7;S+=1)if(!(A+S<=-1||g<=A+S))for(var O=-1;O<=7;O+=1)N+O<=-1||g<=N+O||(0<=S&&S<=6&&(O==0||O==6)||0<=O&&O<=6&&(S==0||S==6)||2<=S&&S<=4&&2<=O&&O<=4?f[A+S][N+O]=!0:f[A+S][N+O]=!1)},Z=function(){for(var A=0,N=0,S=0;S<8;S+=1){W(!0,S);var O=a.getLostPoint(z);(S==0||A>O)&&(A=O,N=S)}return N},I=function(){for(var A=8;A>S&1)==1;f[Math.floor(S/3)][S%3+g-8-3]=O}for(var S=0;S<18;S+=1){var O=!A&&(N>>S&1)==1;f[S%3+g-8-3][Math.floor(S/3)]=O}},de=function(A,N){for(var S=H<<3|N,O=a.getBCHTypeInfo(S),_=0;_<15;_+=1){var j=!A&&(O>>_&1)==1;_<6?f[_][8]=j:_<8?f[_+1][8]=j:f[g-15+_][8]=j}for(var _=0;_<15;_+=1){var j=!A&&(O>>_&1)==1;_<8?f[8][g-_-1]=j:_<9?f[8][15-_-1+1]=j:f[8][15-_-1]=j}f[g-8][8]=!A},ee=function(A,N){for(var S=-1,O=g-1,_=7,j=0,Y=a.getMaskFunction(N),J=g-1;J>0;J-=2)for(J==6&&(J-=1);;){for(var ue=0;ue<2;ue+=1)if(f[O][J-ue]==null){var xe=!1;j>>_&1)==1);var te=Y(O,J-ue);te&&(xe=!xe),f[O][J-ue]=xe,_-=1,_==-1&&(j+=1,_=7)}if(O+=S,O<0||g<=O){O-=S,S=-S;break}}},B=function(A,N){for(var S=0,O=0,_=0,j=new Array(N.length),Y=new Array(N.length),J=0;J=0?So.getAt(To):0}}for(var _o=0,te=0;teJ*8)throw"code length overflow. ("+_.getLengthInBits()+">"+J*8+")";for(_.getLengthInBits()+4<=J*8&&_.put(0,4);_.getLengthInBits()%8!=0;)_.putBit(!1);for(;!(_.getLengthInBits()>=J*8||(_.put(y,8),_.getLengthInBits()>=J*8));)_.put(w,8);return B(_,O)};z.addData=function(A,N){N=N||"Byte";var S=null;switch(N){case"Numeric":S=c(A);break;case"Alphanumeric":S=p(A);break;case"Byte":S=u(A);break;case"Kanji":S=x(A);break;default:throw"mode:"+N}T.push(S),M=null},z.isDark=function(A,N){if(A<0||g<=A||N<0||g<=N)throw A+","+N;return f[A][N]},z.getModuleCount=function(){return g},z.make=function(){if(b<1){for(var A=1;A<40;A++){for(var N=l.getRSBlocks(A,H),S=d(),O=0;O"u"?A*4:N;var S="";S+='";for(var _=0;_';S+=""}return S+="",S+="
",S},z.createSvgTag=function(A,N,S,O){var _={};typeof arguments[0]=="object"&&(_=arguments[0],A=_.cellSize,N=_.margin,S=_.alt,O=_.title),A=A||2,N=typeof N>"u"?A*4:N,S=typeof S=="string"?{text:S}:S||{},S.text=S.text||null,S.id=S.text?S.id||"qrcode-description":null,O=typeof O=="string"?{text:O}:O||{},O.text=O.text||null,O.id=O.text?O.id||"qrcode-title":null;var j=z.getModuleCount()*A+N*2,Y,J,ue,xe,te="",De;for(De="l"+A+",0 0,"+A+" -"+A+",0 0,-"+A+"z ",te+=''+ne(O.text)+"":"",te+=S.text?''+ne(S.text)+"":"",te+='',te+='"u"?A*4:N;var S=z.getModuleCount()*A+N*2,O=N,_=S-N;return R(S,S,function(j,Y){if(O<=j&&j<_&&O<=Y&&Y<_){var J=Math.floor((j-O)/A),ue=Math.floor((Y-O)/A);return z.isDark(ue,J)?0:1}else return 1})},z.createImgTag=function(A,N,S){A=A||2,N=typeof N>"u"?A*4:N;var O=z.getModuleCount()*A+N*2,_="";return _+="",_};var ne=function(A){for(var N="",S=0;S":N+=">";break;case"&":N+="&";break;case'"':N+=""";break;default:N+=O;break}}return N},pe=function(A){var N=1;A=typeof A>"u"?N*2:A;var S=z.getModuleCount()*N+A*2,O=A,_=S-A,j,Y,J,ue,xe,te={"██":"█","█ ":"▀"," █":"▄"," ":" "},De={"██":"▀","█ ":"▀"," █":" "," ":" "},Ae="";for(j=0;j=_?De[xe]:te[xe];Ae+=` -`}return S%2&&A>0?Ae.substring(0,Ae.length-S-1)+Array(S+1).join("▀"):Ae.substring(0,Ae.length-1)};return z.createASCII=function(A,N){if(A=A||1,A<2)return pe(N);A-=1,N=typeof N>"u"?A*2:N;var S=z.getModuleCount()*A+N*2,O=N,_=S-N,j,Y,J,ue,xe=Array(A+1).join("██"),te=Array(A+1).join(" "),De="",Ae="";for(j=0;j>>8),H.push(M&255)):H.push(w)}}return H}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},r={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},a=(function(){var C=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],k=1335,y=7973,w=21522,b={},H=function(f){for(var g=0;f!=0;)g+=1,f>>>=1;return g};return b.getBCHTypeInfo=function(f){for(var g=f<<10;H(g)-H(k)>=0;)g^=k<=0;)g^=y<5&&(M+=3+W-5)}for(var T=0;T=256;)b-=255;return C[b]},w})();function s(C,k){if(typeof C.length>"u")throw C.length+"/"+k;var y=(function(){for(var b=0;b"u")throw"bad rs block @ typeNumber:"+b+"/errorCorrectionLevel:"+H;for(var g=f.length/3,M=[],T=0;T>>7-w%8&1)==1},y.put=function(w,b){for(var H=0;H>>b-H-1&1)==1)},y.getLengthInBits=function(){return k},y.putBit=function(w){var b=Math.floor(k/8);C.length<=b&&C.push(0),w&&(C[b]|=128>>>k%8),k+=1},y},c=function(C){var k=e.MODE_NUMBER,y=C,w={};w.getMode=function(){return k},w.getLength=function(f){return y.length},w.write=function(f){for(var g=y,M=0;M+2>>8&255)*192+(T&255),f.put(T,13),M+=2}if(M>>8)},k.writeBytes=function(y,w,b){w=w||0,b=b||y.length;for(var H=0;H0&&(y+=","),y+=C[w];return y+="]",y},k},h=function(){var C=0,k=0,y=0,w="",b={},H=function(g){w+=String.fromCharCode(f(g&63))},f=function(g){if(!(g<0)){if(g<26)return 65+g;if(g<52)return 97+(g-26);if(g<62)return 48+(g-52);if(g==62)return 43;if(g==63)return 47}throw"n:"+g};return b.writeByte=function(g){for(C=C<<8|g&255,k+=8,y+=1;k>=6;)H(C>>>k-6),k-=6},b.flush=function(){if(k>0&&(H(C<<6-k),C=0,k=0),y%3!=0)for(var g=3-y%3,M=0;M=k.length){if(b==0)return-1;throw"unexpected end of file./"+b}var g=k.charAt(y);if(y+=1,g=="=")return b=0,-1;if(g.match(/^\s$/))continue;w=w<<6|f(g.charCodeAt(0)),b+=6}var M=w>>>b-8&255;return b-=8,M};var f=function(g){if(65<=g&&g<=90)return g-65;if(97<=g&&g<=122)return g-97+26;if(48<=g&&g<=57)return g-48+52;if(g==43)return 62;if(g==47)return 63;throw"c:"+g};return H},E=function(C,k){var y=C,w=k,b=new Array(C*k),H={};H.setPixel=function(T,z,W){b[z*y+T]=W},H.write=function(T){T.writeString("GIF87a"),T.writeShort(y),T.writeShort(w),T.writeByte(128),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(255),T.writeByte(255),T.writeByte(255),T.writeString(","),T.writeShort(0),T.writeShort(0),T.writeShort(y),T.writeShort(w),T.writeByte(0);var z=2,W=g(z);T.writeByte(z);for(var q=0;W.length-q>255;)T.writeByte(255),T.writeBytes(W,q,255),q+=255;T.writeByte(W.length-q),T.writeBytes(W,q,W.length-q),T.writeByte(0),T.writeString(";")};var f=function(T){var z=T,W=0,q=0,Z={};return Z.write=function(I,V){if(I>>>V)throw"length over";for(;W+V>=8;)z.writeByte(255&(I<>>=8-W,q=0,W=0;q=I<0&&z.writeByte(q)},Z},g=function(T){for(var z=1<>6,128|i&63):i<55296||i>=57344?o.push(224|i>>12,128|i>>6&63,128|i&63):(a++,i=65536+((i&1023)<<10|r.charCodeAt(a)&1023),o.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63))}return o}return e(n)}})();(function(n){typeof define=="function"&&define.amd?define([],n):typeof Uo=="object"&&(Go.exports=n())})(function(){return jo})});function Wn(n,e){return n==null||n===!1||n===""||(Array.isArray(n)?n.forEach(r=>Wn(r,e)):e.push(n instanceof Node?n:String(n))),e}function t(n,e,r){let o=window.E,a=e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Node);return!a&&r===void 0?o(n,{},Wn(e,[])):o(n,a?e:{},Wn(r,[]))}var Do={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function ft(n,e="dl-icon"){let r=Do[n]??Do.phone;return``}function v(n,e="dl-icon"){let r=document.createElement("span");return r.className="dl-icon-wrap",r.innerHTML=ft(n,e),r}function U(n,e="info",r=0){let o=document.querySelector(".dl-toasts");o||(o=t("div",{class:"dl-toasts dl-root",role:"status","aria-live":"polite"}),document.body.appendChild(o));let a=e==="error"?"x":e==="warning"?"alert":e==="success"?"check":null,i=()=>{s.classList.remove("show"),setTimeout(()=>s.remove(),200)},s=t("div",{class:`dl-toast ${e}`},[a?v(a):"",t("span",{},n),e==="error"?t("button",{type:"button","aria-label":"Close",click:i},v("x")):""]);o.appendChild(s),requestAnimationFrame(()=>s.classList.add("show")),setTimeout(i,r||(e==="error"?8e3:e==="warning"?5e3:2600))}function be(n){return n instanceof Error?n.message:String(n)}async function G(n,e){try{let r=await n();return e&&U(e,"success",3500),r}catch(r){U(be(r),"error",1e4);return}}function Ao(n){try{let e=n();e&&typeof e.then=="function"&&e.catch(r=>U(be(r),"error"))}catch(e){U(be(e),"error")}}function Ho(n){if(n&&typeof n=="object"){if(typeof n.error=="string")throw new Error(n.error);typeof n.warning=="string"&&n.warning&&U(n.warning,"warning",12e3)}return n}function K(n,e=[]){let r=rpc.declare({object:"luci.dawnline",method:n,params:e});return async(...o)=>Ho(await r(...o))}var Ei=K("logs_clear",["person","device","category","older_days"]),Li=(n={})=>Ei(n.person??"",n.device??"",n.category??"",n.older_days??""),Mi=rpc.declare({object:"luci.dawnline",method:"person_update",params:["id","name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode","paused","services","circle","home_nets","server"]});async function Si(n,e){let o=[n,...["name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode"].map(a=>e[a]),e.paused,e.services,e.circle,e.home_nets,e.server];return Ho(await Mi(...o))}var Ti=K("status",["days"]),P={rev:K("rev"),personUpdate:Si,settingsGet:K("settings_get"),portalInfo:K("portal_info"),settingsUpdate:K("settings_update",["values"]),serviceSet:K("service_set",["id","name","address","ports"]),serviceDelete:K("service_delete",["id"]),geoClear:K("geo_clear"),events:K("events",["limit","person","since"]),logsClear:Li,interfaces:K("interfaces",["id"]),serverInterfaces:K("server_interfaces",["id","auto_wan","wan_device","auto_lan","lan_devices","lan_like","device_mesh","mesh"]),circleSet:K("circle_set",["id","server","name","color","members"]),circleDelete:K("circle_delete",["id"]),accessCheck:K("access_check",["from","to"]),homeHosts:K("home_hosts",["id"]),usageClear:K("usage_clear",["scope","id"]),uninstall:K("uninstall",["confirm"]),status:Ti,setupDefaults:K("setup_defaults"),serverCreate:K("server_create",["id","name","ifname","port","subnet","endpoint","mtu","preset","lan_zone","wan_zone","lan_like","portal_enabled","portal_port"]),serverObfuscation:K("server_obfuscation",["id","preset"]),serverUpdate:K("server_update",["id","values"]),serverPorts:K("server_ports",["id"]),endpointProbe:K("endpoint_probe",["host","id","port"]),serverDelete:K("server_delete",["id"]),personLinks:K("person_links",["id"]),personCreate:K("person_create",["name","slug","server","access","device_limit","expires","quota_gb","quota_period"]),personPause:K("person_pause",["id","paused"]),personRegen:K("person_regen",["id","remove"]),personDelete:K("person_delete",["id"]),personUsage:K("person_usage",["id","days"]),deviceCreate:K("device_create",["person","name","kind"]),deviceConfig:K("device_config",["id"]),deviceUpdate:K("device_update",["id","name","disabled"]),deviceDelete:K("device_delete",["id"]),deviceRotate:K("device_rotate",["id"]),apply:K("apply"),health:K("health"),healthFix:K("health_fix",["id"]),serviceLog:K("service_log"),serviceLogClear:K("service_log_clear",["older_days"]),backupList:K("backup_list"),backupCreate:K("backup_create"),backupRestore:K("backup_restore",["name"]),backupDelete:K("backup_delete",["name"]),backupRead:K("backup_read",["name"]),backupUpload:K("backup_upload",["data"]),exportJson:K("export"),importJson:K("import",["data"]),updatesStatus:K("updates_status"),updatesRun:K("updates_run",["what"]),updatesReleases:K("updates_releases",["page"]),updatesNotes:K("updates_notes",["component","tag","build"]),updatesChanges:K("updates_changes",["from","to"])};function D(n,e,r="neutral",o={}){let{disabled:a,...i}=o,s=t("button",{class:`cbi-button cbi-button-${r}`,type:"button",...i,click:async l=>{if(l.preventDefault(),l.stopPropagation(),!s.disabled){s.disabled=!0,s.classList.add("spinning");try{await e(l)}catch(d){U(be(d),"error")}finally{s.disabled=!1,s.classList.remove("spinning")}}}},n);return s.disabled=!!a,s}function Le(n,e,r,o="neutral",a=""){return D([v(n),t("span",{class:"dl-btn-label"},e)],r,o,{title:e,class:`cbi-button cbi-button-${o} dl-icon-btn ${a}`.trim()})}function $e(n){return document.addEventListener("luci-navigate",n),()=>document.removeEventListener("luci-navigate",n)}var gt=null;function Fn(n=!1){let e=gt;gt=null,e?.(n)}function oe(n,e,r,o=""){Fn();let a=t("div",{class:`dl-modal ${o}`},e),i=t("div",{class:"button-row"},r);a.addEventListener("keydown",s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),ae();return}if(s.key!=="Enter"||s.shiftKey||s.ctrlKey||s.metaKey||s.altKey)return;let l=s.target;if(!l||["TEXTAREA","BUTTON","SELECT","A"].includes(l.tagName))return;let d=i.querySelector(".cbi-button-positive");!d||d.disabled||(s.preventDefault(),d.click())}),ui.showModal(n,[a,i])}function ae(){Fn(),ui.hideModal()}function ie(n="Cancel",e=!1){return t("button",{class:`cbi-button ${e?"cbi-button-negative":"cbi-button-neutral"}`,type:"button",click:ae},n)}function se(n,e,r="Confirm",o=!1){return new Promise(a=>{oe(n,e,[ie()," ",t("button",{class:`cbi-button ${o?"cbi-button-negative":"cbi-button-positive"}`,type:"button",click:()=>{let i=gt;gt=null,ui.hideModal(),i?.(!0)}},r)]),gt=a})}$e(()=>{gt&&(Fn(),ui.hideModal())});async function me(n,e="Copied to clipboard",r=!1){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{let o=t("textarea",{style:"position:fixed;opacity:0"},n);document.body.appendChild(o),o.select();let a=document.execCommand("copy");if(o.remove(),!a)throw new Error("Copying is blocked here. Select the text and copy it by hand.")}return U(e,"success",2500),!0}catch(o){return r||U(be(o),"error"),!1}}function Te(n,e,r="text/plain"){let o=globalThis,a=typeof e=="string"?new o.Blob([e],{type:r}):e,i=URL.createObjectURL(a),s=t("a",{href:i,download:n,style:"display:none"});document.body.appendChild(s),s.click(),setTimeout(()=>{URL.revokeObjectURL(i),s.remove()},1e3)}function qn(n,e){return new Promise(r=>{let o=t("input",{type:"file",accept:n,style:"display:none"});o.addEventListener("cancel",()=>{o.remove(),r(null)}),o.addEventListener("change",()=>{let a=o.files?.[0];if(o.remove(),!a)return r(null);let i=new FileReader;i.onload=()=>{let s=String(i.result??"");r({name:a.name,data:e==="base64"?s.replace(/^data:[^,]*,/,""):s})},i.onerror=()=>r(null),e==="base64"?i.readAsDataURL(a):i.readAsText(a)}),document.body.appendChild(o),o.click()})}function Ce(n,e){let r=document.querySelector(".dl-dd");if(r&&(r.dlClose?r.dlClose():r.remove(),r.dlAnchor===n))return;let o=t("div",{class:"dl-dd dl-root",role:"menu"},e.map(u=>u?t("button",{type:"button",role:"menuitem",class:u.danger?"danger":u.warn?"warn":"",click:()=>{p(),Ao(u.run)}},[u.icon??"",t("span",{},u.label)]):t("hr")));document.body.appendChild(o);let a=n.getBoundingClientRect(),i=o.offsetWidth,s=o.offsetHeight;o.style.top=`${a.bottom+6+s>window.innerHeight-8&&a.top-6-s>8?a.top-6-s:a.bottom+6}px`,o.style.left=`${Math.max(8,Math.min(a.right-i,window.innerWidth-i-8))}px`;let l=u=>{!o.contains(u.target)&&!n.contains(u.target)&&p()},d=u=>{if(u.key==="Escape"||u.key==="Tab")return p();let x=[...o.querySelectorAll("button:not([disabled])")];if(!x.length||!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let $=x.indexOf(document.activeElement),h=u.key==="Home"?0:u.key==="End"?x.length-1:u.key==="ArrowDown"?($+1)%x.length:($-1+x.length)%x.length;x[h].focus({preventScroll:!0})},c=$e(p);o.dlAnchor=n,o.dlClose=p;function p(){o.remove(),c(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",d,!0),window.removeEventListener("scroll",p,!0)}setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",d,!0),window.addEventListener("scroll",p,!0)}),o.querySelector("button")?.focus({preventScroll:!0})}var lt=null,Je=null,Kn=0;function vt(){lt&&(lt.style.display="none"),Je=null,clearInterval(Kn),Kn=0}function he(n,e){let r=o=>{lt??(lt=document.body.appendChild(t("div",{class:"dl-tip dl-tip-float dl-root"}))),lt.replaceChildren(...e().map(a=>typeof a=="string"?document.createTextNode(a):a)),lt.style.display="",lt.style.left=`${o.clientX}px`,lt.style.top=`${o.clientY-10}px`,Je=n,Kn||(Kn=window.setInterval(()=>{(!Je?.isConnected||!Je.getClientRects().length)&&vt()},400))};n.addEventListener("mouseenter",r),n.addEventListener("mousemove",r),n.addEventListener("mouseleave",vt),n.addEventListener("pointerup",o=>{o.pointerType!=="mouse"&&(Je===n?vt():r(o))})}$e(vt);window.addEventListener("scroll",()=>Je&&vt(),{capture:!0,passive:!0});document.addEventListener("pointerdown",n=>{Je&&!Je.contains(n.target)&&vt()},!0);function X(n){if(!n||n<0)return"0 B";let e=["B","KB","MB","GB","TB"],r=0,o=n;for(;o>=1024&&r=100||r===0?Math.round(o):o.toFixed(1)} ${e[r]}`}function Oe(n){let e=n*8;return e<1e3?`${Math.round(e)} bit/s`:e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)} kbit/s`:e<1e9?`${(e/1e6).toFixed(e<1e7?1:0)} Mbit/s`:`${(e/1e9).toFixed(1)} Gbit/s`}function re(n,e=Date.now()/1e3){if(!n)return"never";let r=Math.max(0,Math.round(e-n));return r<60?"just now":r<3600?`${Math.floor(r/60)} min ago`:r<86400?`${Math.floor(r/3600)} h ago`:r<86400*30?`${Math.floor(r/86400)} d ago`:new Date(n*1e3).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function xt(n){if(!n||n<0)return"—";let e=Math.floor(n/86400),r=Math.floor(n%86400/3600),o=Math.floor(n%3600/60);return e?`${e}d ${r}h`:r?`${r}h ${o}m`:`${o}m`}function Ht(n){let e=new Date(n*1e3),r=new Date,o=e.toDateString()===r.toDateString(),a=e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return o?a:`${e.toLocaleDateString("en-GB",{day:"numeric",month:"short"})} ${a}`}function je(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function wt(n){let[e,r,o]=n.split("-").map(Number);return new Date(e,(r||1)-1,o||1,12)}function Ue(n){return(typeof n=="string"?/^\d{4}-\d{2}-\d{2}$/.test(n)?wt(n):new Date(n):n).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function Me(n){return n?Ue(n):""}function Vn(n,e){let r=o=>{let[a,i,s]=o.split("-").map(Number);return Date.UTC(a,i-1,s)};return Math.round((r(n)-r(e))/864e5)}function At(n,e){let r=wt(n);return r.setDate(r.getDate()+e),je(r)}function bt(n,e){let[r,o,a]=n.split("-").map(Number),i=new Date(r,o-1+e,1,12),s=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();return i.setDate(Math.min(a,s)),je(i)}function Ie(n){return n?.length?n[n.length-1].day:je(new Date)}function zo(n,e,r,o,a=30){let i=n||o;return e==="day"?At(i,r):e==="week"?At(i,7*r):e==="month"?bt(i,r):e==="year"?bt(i,12*r):At(i,a*r)}function Ye(n,e=Date.now()){if(!n)return null;let r=typeof e=="number"?je(new Date(e)):e,o=Vn(n,r);return o>=0?o+1:o}function Ze(n,e){return e!=null&&e>0&&n.expire_warn>0&&e<=n.expire_warn}function Xt(n){return n<=1?"ends today":n===2?"ends tomorrow":`ends in ${n} days`}function en(n,e,r=`${e}s`){return`${n.toLocaleString("en-GB")} ${n===1?e:r}`}function zt(n){return n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(n<10240?1:0)} KB`:`${(n/1048576).toFixed(1)} MB`}var dt={lan:"Home network",internet:"Internet",both:"Home network + Internet"};var No=["computer","phone","tablet","router","other"],Qe={computer:"PC",phone:"Phone",tablet:"Tablet",router:"Router",other:"Other"},Ro={active:"Active",paused:"Paused",expired:"Expired",quota:"Data limit reached",hours:"Outside allowed hours",no_server:"No server",server_off:"Server is turned off"};function He(n){let e=n.trim().split(/\s+/).filter(Boolean);if(!e.length)return"?";let r=e[0][0]??"",o=e.length>1?e[e.length-1][0]??"":e[0][1]??"";return(r+o).toUpperCase()}function tn(n){let e=r=>r.disabled?3:r.online?0:r.handshake?1:2;return n.map((r,o)=>[r,o]).sort((r,o)=>e(r[0])-e(o[0])||r[1]-o[1]).map(([r])=>r)}function Ee(n,e,r){return t("span",{class:`dl-pill ${n}`,title:r??null},e)}function _i(n){return n.state==="active"?"ok":n.state==="quota"||n.state==="expired"?"bad":"warn"}function Pi(n){return n.state==="server_off"&&n.paused?"paused":n.state}function Io(n){let e=Pi(n);return e==="active"||e==="server_off"?"":Ee(_i({...n,state:e}),Ro[e])}function Bo(n){let e=n.access==="both"?["lan","inet"]:n.access==="lan"?["lan"]:["inet"],r=t("span",{class:"dl-access","aria-label":dt[n.access]},e.map(o=>t("span",{class:`dl-ibadge ${o}`},v(o==="lan"?"home":"globe"))));return he(r,()=>[t("div",{class:"dl-tip-title"},dt[n.access]),n.access==="lan"&&n.services?.length?t("div",{class:"dl-muted"},`${n.services.length} home service${n.services.length===1?"":"s"} only`):""]),r}var Di={paused:"Paused",expired:"Access ended",quota:"Data limit",hours:"Outside hours",server_off:"Server off",no_server:"No server"};function nn(n,e,r="Not set up yet",o){let a=n.handshake?`Last seen ${re(n.handshake,e)} · ${new Date(n.handshake*1e3).toLocaleString()}`:"";if(n.disabled)return t("span",{class:"dl-dstat",title:a},"Disabled");if(n.online)return t("span",{class:"dl-dstat ok"},"Connected");let i=o&&Di[o.state];return i?t("span",{class:"dl-dstat warn",title:a||"Not connected yet"},i):n.handshake?t("span",{class:"dl-dstat",title:new Date(n.handshake*1e3).toLocaleString()},`Last seen ${re(n.handshake,e)}`):t("span",{class:"dl-dstat warn",title:"Waiting for the first connection"},r)}var on=null;function Oo(n,e,r,o){on?.close();let a=t("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[t("div",{class:"dl-drawer-head"},[n,t("button",{type:"button",class:"dl-drawer-x","aria-label":"Close",click:()=>c()},v("x"))]),t("div",{class:"dl-drawer-body"},e),r?t("div",{class:"dl-drawer-foot"},r):""]),i=t("div",{class:"dl-drawer-overlay dl-root",click:u=>{u.target===i&&c()}},a),s=u=>{u.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&c()},l=!1,d=$e(()=>c());function c(){l||(l=!0,d(),document.removeEventListener("keydown",s),i.classList.remove("open"),setTimeout(()=>i.remove(),220),on===p&&(on=null),o())}let p={close:c,panel:a};return document.addEventListener("keydown",s),document.body.appendChild(i),requestAnimationFrame(()=>i.classList.add("open")),on=p,p}function ce(n,e,r){return t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},n),r?t("span",{class:"dl-sub"},r):""]),t("div",{class:"dl-setrow-ctl"},e)])}function ge(n,e,r,o=e){let a=ce(n,o," "),i=a.querySelector(".dl-sub"),s=()=>{let l=r();i.textContent=l.text,i.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",s),a.refresh=s,a.help=r,s(),a}function ye(n,e,r,o=e){let a=t("div",{class:"dl-sub"}),i=t("div",{class:"cbi-value dl-live"},[t("div",{class:"cbi-value-title"},[t("label",{},n),a]),t("div",{class:"cbi-value-field"},o)]),s=()=>{let l=r();a.textContent=l.text,a.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",s),e.addEventListener("change",s),i.refresh=s,i.help=r,s(),i}function ze(n,e=[]){for(let r of n){let o=r.help?.();if(o?.bad)return o.text}for(let r of e){let o=r();if(o.bad)return o.text}return null}function Nt(n,e,r,o=""){return t("section",{class:`dl-setsec ${o}`},[t("div",{class:"dl-setsec-body"},[n?t("h3",{},n):"",...e]),r.length?t("div",{class:"dl-setsec-foot"},r):""])}function fe(n,e,r,o){return t("div",{class:"dl-group"},[t("div",{class:"dl-group-head"},[t("span",{class:"dl-group-ic"},v(n)),t("span",{class:"dl-stack"},[t("b",{},e),r?t("span",{class:"dl-sub"},r):""])]),t("div",{class:"dl-group-body"},o.filter(a=>a!==""))])}function Xe(n,e,r,o,a){return t("div",{class:`dl-row dl-need-row ${e}`},[e?t("span",{class:"dl-need-ic"},v(n)):v(n),t("span",{class:"dl-row-main dl-stack"},[t("b",{},r),t("span",{class:"dl-sub"},o)]),a])}function ct(n,e){let r={ok:"success",warn:"warning",error:"error",info:"notice"}[n];return t("div",{class:`alert-message ${r}`},e)}function yt(n,e=""){let r=t("div",{class:e});return r.innerHTML=n,r}var qo=Ci(Wo(),1),Ai=n=>``,Fo="#0a0a0a",Hi="#f2f2f2",zi={night:[Fo,Hi],day:["#ffffff",Fo]},Ni=n=>n.length>300,kt=n=>+n.toFixed(2);function Jn(n,e,r,o,a){return`M${kt(n+a)} ${kt(e)}h${kt(r-2*a)}a${a} ${a} 0 0 1 ${a} ${a}v${kt(o-2*a)}a${a} ${a} 0 0 1 -${a} ${a}h-${kt(r-2*a)}a${a} ${a} 0 0 1 -${a} -${a}v-${kt(o-2*a)}a${a} ${a} 0 0 1 ${a} -${a}z`}function rn(n,e=3,r=!0,o="plain"){let a=Ni(n),i=o!=="plain",[s,l]=i?zi[o]:["#fff","#000"],d=(0,qo.default)(0,a?"L":"H");d.addData(n,"Byte"),d.make();let c=d.getModuleCount(),p=c+e*2,u=r&&!a?Math.round(c*.22):0;u&&(c-u)%2&&u++;let x=(c-u)/2,$=x+u,h=(y,w)=>u>0&&y>=x&&y<$&&w>=x&&w<$,m=(y,w)=>i&&(w<7&&y<7||w<7&&y>=c-7||w>=c-7&&y<7),E="";if(i){let y=a?.48:.42;for(let w=0;w${Ai(i?s:"#fff")}`}let k=``;return i?`${k}${C}`:`${k}${C}`}function pt(){let n=document.documentElement.getAttribute("data-darkmode");return n!=null?n==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function an(n){let e=pt();return yt(rn(n,3,!0,e?"night":"day"),`dl-qr${e?"":" light"}`)}function Yn(n){let e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/.exec(n.trim());if(!e)return null;let[r,o,a,i]=e.slice(1,5).map(Number),s=Number(e[5]);if([r,o,a,i].some(c=>c>255)||s<8||s>30)return null;let l=r*2**24+o*2**16+a*2**8+i,d=2**(32-s);return{net:l-l%d,size:d}}var Ri=(n,e)=>n.netYn(n));function Ct(n){return n.split("/")[0].split(".").slice(0,3).join(".")}function ln(n){return`${n.trim()}.0/24`}function Qn(n,e,r){let o=n.trim(),a=/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o)?Yn(ln(o)):null;if(!a)return{text:"Three numbers, like 10.77.0.",bad:!0};if(!Ii.some(s=>a.net>=s.net&&a.net+a.size<=s.net+s.size))return{text:"Use a private range: 10.x.x, 172.16–31.x or 192.168.x.",bad:!0};let i=e.find(s=>{let l=Yn(s.cidr);return l!=null&&Ri(a,l)});if(i){let s=i.cidr.endsWith("/24")?`${Ct(i.cidr)}.x`:i.cidr,l=r&&r!==o?` Try ${r}.`:"";return{text:`${i.name} already uses ${s}.${l}`,bad:!0}}return{text:`Devices get ${o}.2 – ${o}.254, the router ${o}.1.`,bad:!1}}var Vo=(n,e)=>e.find(r=>r.from<=n&&n<=r.to)?.who??null,Bi=n=>Number.isInteger(n)&&n>=1&&n<=65535;function Rt(n,e,r){if(!Bi(n))return{text:"Use a port from 1 to 65535.",bad:!0};let o=Vo(n,e);return o?{text:`Used by ${o}. Choose another port.`,bad:!0}:{text:r,bad:!1}}function dn(n,e,r){let o=r?`HTTPS here, plain HTTP for links on IP addresses on ${n+1}.`:"HTTPS on this port, opened on WAN.",a=Rt(n,e,o);if(a.bad||!r)return a;if(n===65535)return{text:"Links on IP addresses also need the next port: choose a lower one.",bad:!0};let i=Vo(n+1,e);return i?{text:`Links on IP addresses also need ${n+1}, used by ${i}. Choose another port.`,bad:!0}:a}var sn=n=>Array.from(n).length,Ko=48,Oi=/[<>"\\\u0000-\u001f\u007f]/;function _e(n,e=[],r=""){let o=n.trim();return o?sn(n)>Ko?{text:`Up to ${Ko} characters (${sn(n)} now).`,bad:!0}:Oi.test(n)?{text:'Names can’t contain < > " or \\.',bad:!0}:e.some(a=>a.toLowerCase()===o.toLowerCase())?{text:`“${o}” already exists — pick another name.`,bad:!0}:{text:r,bad:!1}:{text:"Enter a name.",bad:!0}}function Jo(n,e=[]){return sn(n)>32?{text:`Up to 32 characters (${sn(n)} now).`,bad:!0}:_e(n,e,"Shown on the person cards.")}var ji=/^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,Ui=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Et(n){let e=Ui.exec(n);return!!e&&e.slice(1).every(r=>Number(r)<=255)}function Zn(n){return/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(n)&&!/:::/.test(n)}function $t(n,e,r=null){let o=n.trim();if(!o)return r!=null?{text:r,bad:!1}:{text:"Enter a hostname or IP address.",bad:!0};if(/^[a-z]+:\/\//i.test(o))return{text:"Leave out https:// — just the name.",bad:!0};if(/\/.*/.test(o))return{text:"Just the name, without a path.",bad:!0};if(/^[^:\[]+:\d+$/.test(o))return{text:"Just the name, without a port (the port is on AmneziaWG).",bad:!0};if(/\s/.test(o))return{text:"A hostname has no spaces.",bad:!0};if(o.length>253||!(ji.test(o)||Et(o)||Zn(o)))return{text:"Use a hostname or an IP address.",bad:!0};let a=Zn(o)?`[${o}]`:o;return{text:e?`Devices connect to ${a}:${e}.`:`Links use ${a}.`,bad:!1}}function Yo(n,e){let r=n.split(/[ ,]+/).filter(Boolean);if(!r.length)return{text:`This router (${e}): queries go where your home network sends them, and home names work.`,bad:!1};let o=r.find(a=>!Et(a)&&!Zn(a));return o?{text:`“${o}” is not an IP address. Separate several with commas.`,bad:!0}:{text:`Devices use ${r.join(" and ")} — home names and your LAN’s DNS filters no longer apply to them.`,bad:!1}}function Zo(n,e){let r=n.trim();if(!r)return{text:`Automatic by device type and disguise: ${e.computer} for computers and routers, ${e.phone} for phones and tablets.`,bad:!1};if(!/^\d{1,4}$/.test(r)||Number(r)<1280||Number(r)>1500)return{text:"MTU must be 1280–1500, or empty for automatic.",bad:!0};let o=Number(r);return{text:`Computers and routers get ${o}, phones and tablets ${Math.min(o,1280)}.`,bad:!1}}function Qo(n){let e=n.trim();return e?!/^\d{1,3}$/.test(e)||Number(e)>600?{text:"Use 0–600 seconds.",bad:!0}:Number(e)===0?{text:"Off: NAT may close the tunnel when idle, and “Connected” lags.",bad:!1}:{text:`Devices send a packet every ${e} s to keep NAT open (a little battery on phones).`,bad:!1}:{text:"Default: a packet every 25 s keeps NAT open and “Connected” accurate.",bad:!1}}function cn(n,e=0){let r=n.trim();if(!/^\d{1,2}$/.test(r)||Number(r)<1||Number(r)>32)return{text:"Use 1–32.",bad:!0};let o=Number(r);return e>o?{text:`Already has ${e} devices: remove ${e-o===1?"one":`${e-o}`} first, or allow more.`,bad:!0}:{text:`They can add ${o} device${o===1?"":"s"} themselves.`,bad:!1}}function pn(n,e=!0){let r=n.trim();if(!r)return{text:"Optional. No data limit.",bad:!1};let o=Number(r);return!/^\d+(\.\d+)?$/.test(r)||o<0||o>1e5?{text:"A number of GB, up to 100000.",bad:!0}:o===0?{text:"Optional. No data limit.",bad:!1}:{text:e?`Paused after ${r} GB this month, resumed on the 1st.`:`Paused after ${r} GB in total.`,bad:!1}}function Xo(n,e,r,o){let a=n.trim();if(!a)return{text:"Optional. No end date.",bad:!1};let i=r(a,e);return i==null?{text:"Use a date.",bad:!0}:i<0?{text:"That date has passed: access would end at once.",bad:!0}:{text:i===1?`Access ends today (${o(a)}).`:`Access ends in ${i} days (${o(a)}).`,bad:!1}}function er(n,e=null){let r=n.trim();return r?Et(r)?e&&!e(r)?{text:`${r} is not in any home network of this server: nobody would reach it.`,bad:!1}:{text:"",bad:!1}:{text:"Use an IPv4 address, like 192.168.1.10.",bad:!0}:{text:"The device’s address at home.",bad:!0}}function tr(n){let e=n.split(/[ ,]+/).filter(Boolean);if(!e.length)return{text:"All ports.",bad:!1};let r=e.find(o=>!/^\d{1,5}$/.test(o)||Number(o)<1||Number(o)>65535);return r?{text:`“${r}” is not a port (1–65535).`,bad:!0}:{text:`Port${e.length===1?"":"s"} ${e.join(", ")}.`,bad:!1}}function nr(n){let e=n.trim();return e?/^https?:\/\//i.test(e)?e.length>300||!/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(e)?{text:"Not a usable address (no spaces or quotes).",bad:!0}:{text:"Wrong links are sent there instead of a “Not found”.",bad:!1}:{text:"Must start with http:// or https://.",bad:!0}:{text:"Wrong links get a bare “Not found”.",bad:!1}}function or(n,e="phone.myata"){let r=n.trim();return r?/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(r)?{text:`Devices get names like ${e}.${r}.`,bad:!1}:{text:/[A-Z]/.test(r)?"Lowercase only.":"Lowercase letters, digits, dashes and dots.",bad:!0}:{text:`The default, lan: devices get names like ${e}.lan.`,bad:!1}}function rr(n){let e=n.trim();return e?Et(e)?{text:`${e} takes over when the tunnel is down.`,bad:!1}:{text:"Use an IPv4 address, or leave it empty.",bad:!0}:{text:"None: without the tunnel those devices have no DNS.",bad:!1}}function ar(n){let e=n.trim();return/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e)?{text:`Runs within an hour after ${e} (router time).`,bad:!1}:{text:"Use HH:MM, 00:00–23:59.",bad:!0}}function Xn(n,e,r,o={}){let a=0,i="",s=null;return{help:()=>{let{host:c,port:p}=n(),u=$t(c,p,o.empty??null);if(u.bad||!c.trim())return u;if(s&&s.host===c.trim())return{text:s.text,bad:s.bad};let x=o.idle?.();return{text:x?`${x} Checking where it points…`:`${u.text} Checking where it points…`,bad:!1}},schedule:()=>{let{host:c}=n(),p=$t(c,n().port,o.empty??null);p.bad||!c.trim()||c.trim()===s?.host||(clearTimeout(a),a=window.setTimeout(async()=>{let u=c.trim();i=u;try{let{id:x,port:$}=n(),h=await e(u,x,$);if(i!==u)return;s={host:u,text:h.text,bad:h.status==="error"}}catch{if(i!==u)return;s={host:u,text:p.text,bad:!1}}r()},700))}}}var Gi={connect:"connections",disconnect:"connections",roam:"connections",device_added:"people",device_removed:"people",devices_removed:"people",device_changed:"people",device_keys:"people",link_changed:"people",person_added:"people",person_removed:"people",person_changed:"people",paused:"people",resumed:"people",expiring:"people",expired_kept:"people",portal_blocked:"problems"},Lt=["connections","people","problems"],ut={connections:"Connections",people:"People",problems:"Problems"},ir={connections:"Connects, disconnects and IP changes",people:"People and their devices added, changed, paused, removed",problems:"Blocked portal sign-ins (tunnels and services are in the service log)"},It=n=>Gi[n]??"problems",Bt={awg:"AmneziaWG",dawnline:"Dawnline",portal:"Portal"},Wi=["person_added","person_removed","person_changed"];function Ne(n){return n.by?n.by:Wi.includes(n.type)||n.detail==="by admin"||n.detail?.endsWith(" (admin)")?"admin":n.detail?.endsWith(" (portal)")?"portal":null}function sr(n){return(n.detail??"").replace(/ \((admin|portal)\)$/,"").replace(/^by admin$/,"")}var un=n=>n.sys?["error","repair","down"].includes(n.sys.level):It(n.ev.type)==="problems";function mn(n){let e=n.keep_days>0?`${n.keep_days} day${n.keep_days===1?"":"s"}`:"no age limit",r=n.persist==="off"?"kept in memory only (lost on reboot)":`saved to flash ${n.persist==="10min"?"every 10 minutes":"hourly"}`;return`Kept for ${e}, up to ${n.max.toLocaleString("en-GB")} events, ${r}.`}function lr(n,e=120,r=26,o=je(new Date)){let a=Math.max(1,...n),i=t("div",{class:"dl-spark"});return i.style.width=`${e}px`,i.style.height=`${r}px`,n.forEach((s,l)=>{let d=t("i");d.style.height=`${Math.max(6,s/a*100)}%`,s||d.classList.add("zero");let c=n.length-1-l;he(d,()=>[t("div",{class:"dl-tip-title"},c===0?"Today":c===1?"Yesterday":wt(At(o,-c)).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})),t("div",{class:"dl-muted"},X(s))]),i.appendChild(d)}),i}function Fi(n){let e=n==null?"":String(n);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function dr(n,e){return[n.join(","),...e.map(r=>n.map(o=>Fi(r[o])).join(","))].join(` -`)}function qi(n){let e=new Map(n.people.map(o=>[o.id,o.name])),r=new Map(n.people.flatMap(o=>o.devices.map(a=>[a.id,a.name])));return{people:e,devices:r}}function Fe(n,e,r,o="",a=[]){let i=qi(n),s=[...e.map(p=>({ts:p.ts,category:It(p.type),type:p.type,person:p.person?i.people.get(p.person)??p.pname??p.person:"",device:p.device?i.devices.get(p.device)??p.dname??p.device:"",detail:p.detail??"",where:p.where??"",by:Ne(p)??""})),...a.map(p=>({ts:p.ts,category:"system",type:`${p.src}.${p.level}`,person:"",device:"",detail:`${p.who?`${p.who} `:""}${p.msg}${p.detail?` -${p.detail}`:""}`,where:Bt[p.src]??p.src,by:""}))].sort((p,u)=>p.ts-u.ts).map(({ts:p,...u})=>({time:new Date(p*1e3).toISOString(),...u})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${o?`-${o}`:""}-${l}.${r}`;if(r==="json"){Te(d,JSON.stringify(s,null,2),"application/json");return}Te(d,dr(["time","category","type","person","device","detail","where","by"],s),"text/csv")}var Ki=[["","Everything"],["7","Older than 7 days"],["30","Older than 30 days"],["90","Older than 90 days"]],cr=n=>n?`${n} event${n===1?"":"s"} removed`:"Nothing matched";function et(n,e,r,o,a,i=!1){let s=t("select",{class:"cbi-input-select"},[t("option",{value:""},"All categories"),...Lt.map(d=>t("option",{value:d,selected:d===a?"selected":null},ut[d])),i?t("option",{value:"system",selected:a==="system"?"selected":null},"System"):""]),l=t("select",{class:"cbi-input-select"},Ki.map(([d,c])=>t("option",{value:d},c)));oe(n,[t("p",{class:"dl-muted"},`${e} This cannot be undone; export first if you want a copy.`),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Category"),s]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Which events"),l])],[ie()," ",D("Clear",async()=>{let d=0;if(s.value!=="system")try{d+=(await P.logsClear({...r,category:s.value,older_days:l.value})).removed}catch(c){U(be(c),"error",1e4);return}if(i&&(s.value==="system"||s.value===""))try{d+=(await P.serviceLogClear(l.value)).removed}catch(c){ae(),U(`${s.value==="system"?"":`Activity: ${cr(d).toLowerCase()}. `}The service log was not cleared: ${be(c)}`,"error",1e4),o();return}ae(),U(cr(d),"success",3e3),o()},"negative")])}function Mt(n,e,r,o){let a=n==="device"?`Clears ${r}'s daily and monthly traffic history. Their person's totals and data limit are not changed.`:n==="person"?`Clears ${r}'s traffic history and that of their devices. Their data limit starts again from zero.`:"Clears traffic history for everyone. Data limits start again from zero.";oe(n==="all"?"Reset all traffic history?":`Reset traffic history for ${r}?`,[t("p",{class:"dl-muted"},a)],[ie()," ",D("Reset",async()=>{await G(()=>P.usageClear(n,e),"Traffic history reset")&&(ae(),o())},"negative")])}function ve(n,e,r){let o=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let a=!o.classList.contains("on");eo(o,a),r?.(a)}},t("i"));return o}function eo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var Pe=n=>n.classList.contains("on");function we(n,e,r={}){n.some(([i])=>i===e)||(n=[...n,[e,e]]);let o=t("div",{class:`dl-seg${r.cls?` ${r.cls}`:""}`,role:"radiogroup","aria-label":r.label??null,"data-value":e}),a=()=>o.querySelectorAll(":scope > button").forEach(i=>{let s=i.dataset.v===o.dataset.value;i.classList.toggle("on",s),i.setAttribute("aria-checked",s?"true":"false")});for(let[i,s]of n)o.appendChild(t("button",{type:"button",role:"radio","data-v":i,click:()=>{i!==o.dataset.value&&(r.optimistic!==!1&&(o.dataset.value=i,a()),r.onChange?.(i))}},s));return a(),o}function qe(n,e,r,o={}){return t("button",{type:"button",...o,class:`dl-chipbtn${e?" on":""}${o.class?` ${o.class}`:""}`,"aria-pressed":e?"true":"false",click:r},n)}function hn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function le(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var Vi={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},Ji={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function Yi(n){let e={};for(let[r,o]of Object.entries(Ji))n[r]!=null&&n[r]!==""&&(e[o]=String(n[r]));return e}function Zi(n,e){let r=n.amnezia,o=r.obfuscation??{},a=d=>o[d]!=null&&o[d]!==""?String(o[d]):Vi[d],i=r.host.replace(/^\[(.*)\]$/,"$1"),s={H1:a("h1"),H2:a("h2"),H3:a("h3"),H4:a("h4"),I1:a("i1"),I2:a("i2"),I3:a("i3"),I4:a("i4"),I5:a("i5"),Jc:a("jc"),Jmin:a("jmin"),Jmax:a("jmax"),S1:a("s1"),S2:a("s2"),S3:a("s3"),S4:a("s4"),...Yi(o),allowed_ips:r.allowed_ips,client_ip:r.client_ip,client_priv_key:r.client_priv_key,client_pub_key:r.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r -`),hostName:i,mtu:r.mtu,persistent_keep_alive:r.persistent_keep_alive,port:Number(r.port),psk_key:r.psk_key,server_pub_key:r.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(s),port:String(r.port),protocol_version:o.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:i};return r.dns[0]&&(l.dns1=r.dns[0]),r.dns[1]&&(l.dns2=r.dns[1]),l}function Qi(n){let e="";for(let r=0;r"u")return null;try{let r=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),o=new Uint8Array(await new e.Response(r).arrayBuffer()),a=new Uint8Array(4+o.length);return new DataView(a.buffer).setUint32(0,n.length,!1),a.set(o,4),a}catch{return null}}async function to(n,e,r=!0){let o=new TextEncoder().encode(JSON.stringify(Zi(n,e))),a=r?await Xi(o):null;return`vpn://${Qi(a??o)}`}var ur=[{id:"off",title:"Off",ic:"zap",stealth:0,speed:4,text:"Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block.",apps:"Any WireGuard app",short:"Any WireGuard app"},{id:"balanced",title:"Balanced",ic:"shield",stealth:3,speed:4,needs:"v2",text:"AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk.",apps:"AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps",short:"AmneziaWG 2.0+ apps"},{id:"max",title:"Maximum",ic:"lock",stealth:4,speed:3,needs:"v3",text:"AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS.",apps:"Apps with AmneziaWG 3.1 (current AmneziaVPN)",short:"AmneziaWG 3.1 apps"}],Ot=n=>ur.find(e=>e.id===n),fn=n=>n.v3?"max":n.v2?"balanced":"off",jt=n=>n==="standard"?"Standard (old)":n==="strong"?"Strong (old)":null,es={v2:"Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on).",v3:"Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."},ts={v2:"Needs AmneziaWG on the router.",v3:"Needs AmneziaWG 3.1 on the router: install it first."};function pr(n,e){return t("span",{class:"dl-dots",title:`${e}: ${n} of 4`},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(r=>t("i",{class:rdom.content(i,ur.map(l=>{let d=!l.needs||n[l.needs],c=l.id===e;return t("button",{type:"button",role:"radio","aria-checked":c?"true":"false","aria-disabled":d?null:"true",class:`dl-method${c?" on":""}${d?"":" off"}`,click:()=>{!d||c||(e=l.id,s(),r(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===o?t("span",{class:"dl-pill ok"},"Current"):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[pr(l.stealth,"Stealth"),pr(l.speed,"Speed")]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},(a?es:ts)[l.needs])])])}));return s(),i}function mr(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var hr=[["jc","Jc"],["jmin","Jmin"],["jmax","Jmax"],["s1","S1"],["s2","S2"],["s3","S3"],["s4","S4"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["i1","I1"],["i2","I2"],["i3","I3"],["i4","I4"],["i5","I5"],["header_protection_key","HeaderProtectionKey"],["content_padding_addition","ContentPaddingAddition"],["rekey_after_time","RekeyAfterTime"],["rekey_timeout","RekeyTimeout"],["reject_after_time","RejectAfterTime"],["keepalive_timeout","KeepaliveTimeout"],["max_handshake_attempts","MaxHandshakeAttempts"],["random_trailers","RandomTrailers"],["disable_cookies","DisableCookies"]];function ns(n){let e=c=>n[c]!=null&&n[c]!=="",r=hr.filter(([c])=>e(c));if(!r.length)return null;let o=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),a=(c,p,u,x)=>{let $=hr.filter(([h])=>x.includes(h)&&e(h));return $.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},$.map(([h,m])=>o(h,m)))]):""},i=Number(n.jc||0),s=(n.i1??"").includes("0x8580")?"A first packet shaped like a DNS answer.":"Extra packets sent before the handshake.",l=r.map(([c,p])=>`${p} = ${n[c]}`).join(` -`),d=t("div",{class:"dl-pgrid"},[a("Junk packets","zap",i?`${i} random packet${i===1?"":"s"} of ${n.jmin}–${n.jmax} bytes before each handshake.`:"No junk packets.",["jc","jmin","jmax"]),a("Padding","archive","Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.",["s1","s2","s3","s4"]),a("Packet types","key","The values that replace WireGuard’s recognisable message types.",["h1","h2","h3","h4"]),a("Signatures","globe",s,["i1","i2","i3","i4","i5"]),a("Protection","lock","AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.",["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),a("Timing","clock","Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.",["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},"Current parameters"),t("span",{class:"dl-pcount"},String(r.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),me(l,"Parameters copied")}},"Copy as config")]),d])}function fr(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let r=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!r)return document.createTextNode(n);let o=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},r[1])," ",o&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):r[2]])}function os(n){let e=!1,r=t("pre",{class:"dl-conf"}),o=()=>dom.content(r,n.conf.split(` -`).flatMap((s,l)=>l?[` -`,fr(s,e)]:[fr(s,e)])),a=t("button",{type:"button",class:"dl-chipbtn",click:s=>{s.preventDefault(),e=!e,dom.content(a,[v(e?"x":"key"),e?"Hide key":"Show key"]),o()}},[v("key"),"Show key"]);o();let i=new Blob([n.conf]).size;return t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-filecard"},[t("span",{class:"dl-filecard-ic"},".conf"),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono dl-ellipsis"},n.filename),t("span",{class:"dl-sub"},`AmneziaWG · ${i} bytes`)]),D([v("download")," Download"],()=>Te(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},"Configuration"),t("span",{class:"dl-spacer"}),a,t("button",{type:"button",class:"dl-chipbtn",click:s=>{s.preventDefault(),me(n.conf,"Configuration copied")}},[v("copy"),"Copy"])]),r])])}function no(n){let e=n.amnezia.obfuscation??{},r={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([o,a])=>a==null||a===""||a===(r[o]??"0"))}async function rs(n,e="file"){if(!n.has_private_key)return t("div",{class:"dl-hint"},"This device generated its own keys in the browser, so its full configuration only exists on that device.");let r=await to(n,n.server),o={qr:()=>t("div",{class:"dl-qr-pane"},[an(n.conf),t("span",{class:"dl-sub"},no(n)?"Scan with AmneziaVPN or any WireGuard app on the device.":"Scan with AmneziaVPN or AmneziaWG on the device.")]),key:()=>t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-linkbox"},[t("span",{class:"dl-mono"},r),D("Copy",()=>me(r,"Key copied"))]),t("span",{class:"dl-sub"},"AmneziaVPN → Add server → Insert key. Keep it private.")]),file:()=>os(n)},a=t("div",{class:"dl-connect-body"}),i=t("div",{class:"dl-seg"}),s=l=>{i.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(a,o[l]())};for(let[l,d]of[["file","File"],["key","Key"],["qr","QR code"]])i.appendChild(t("button",{type:"button","data-id":l,click:()=>s(l)},d));return s(e),t("div",{class:"dl-stack gap12"},[i,a])}async function as(n,e,r,o){let a=Ot(r),s=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await se(o?"Generate new disguise values?":`Switch to ${a.title}?`,`${s} AmneziaWG device${s===1?" stops":"s stop"} connecting until ${s===1?"it imports its":"they import their"} configuration again (from their personal link or from you).${r==="max"?" They need an app with AmneziaWG 3.1.":r==="balanced"?" They need an app with AmneziaWG 2.0 or newer.":""}${n.st.servers.length===1&&s?" To keep the old disguise for some people, add a second server and move them there.":""}`,o?"Generate and apply":"Switch and apply",!0)&&await G(()=>P.serverObfuscation(e.id,r),o?"New values applied":`${a.title} applied`)&&(U("Devices are marked “Update config” until they import again.","info",6e3),await n.refresh())}function is(n,e){let r=n.st,o=le(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=le(e.mtu?String(e.mtu):"",{placeholder:"Auto",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=le(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),s=Ot(e.preset)?e.preset:void 0,l=s??fn(r.awg),d=D("",()=>as(n,e,l,l===s),"neutral"),c=()=>dom.content(d,l===s?[v("reset")," Generate new values"]:[`Switch to ${Ot(l).title}`]);c();let p=r.awg_state?.tools!==!1,u=[],x=ge("UDP port",o,()=>Rt(Number(o.value),u,`Opened on the WAN firewall automatically.${Number(o.value)===4500?" 4500 is IPsec’s port: most networks let it through.":""}`));P.serverPorts(e.id).then(m=>{u=m.udp_taken??[],x.refresh()}).catch(()=>{});let $=ge("MTU",a,()=>Zo(a.value,e.mtus)),h=ge("Keep-alive",i,()=>Qo(i.value));return Nt("",[mr("AmneziaWG",e.ifname),fe("globe","Listening","Where devices reach this core from the internet",[x]),fe("file","In every device configuration","Changing these marks devices “Update config” until they import again",[$,h]),fe("shield","Disguise","So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard",[jt(e.preset)?ct("warn",[t("b",{},jt(e.preset))," is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to ",t("b",{},"Balanced")," or ",t("b",{},"Maximum"),": devices import their configuration again."]):"",gn(r.awg,l,m=>{l=m,c()},s,p),p&&!r.awg.v3?ct("info",["This router runs an older AmneziaWG. ",t("b",{},"Maximum")," becomes available with kmod-amneziawg and amneziawg-tools 3.1."]):"",ns(e.obf??{})??"",t("div",{class:"dl-row-end"},[t("span",{class:"dl-sub"},"Applies at once: every AmneziaWG device imports its configuration again."),d])]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},"Tunnel"),t("span",{class:"dl-pcount"},"3")]),t("div",{class:"dl-params-body"},[ce("Interface",t("span",{class:"dl-mono"},`${e.ifname} · router ${e.address}`)),ce("Tunnel subnet",t("span",{class:"dl-mono"},e.subnet),"Device addresses come from it."),ce("Server public key",t("span",{class:"dl-keyrow"},[t("code",{class:"dl-mono"},e.public_key),D([v("copy")],()=>me(e.public_key,"Public key copied"),"neutral",{title:"Copy",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]))])])],[t("span",{class:"dl-sub"},"Port, MTU and keep-alive apply at once."),D("Save",()=>{let m=ze([x,$,h]);if(m){U(m,"warning");return}return n.save({port:o.value,mtu:a.value,keepalive:i.value},"AmneziaWG saved")},"positive")])}function ss(n){let e=Ot(n.preset),r=n.obf??{},o=(s,l)=>t("span",{class:`dl-segs ${l}`},[0,1,2,3].map(d=>t("i",{class:d+r[s]).map(s=>`${s.toUpperCase()} ${r[s]}`);return i.length&&a.push(i.slice(0,2).join(" · ")+(i.length>2?` +${i.length-2}`:"")),["h1","h2","h3","h4"].some(s=>r[s]&&r[s]!==String(["h1","h2","h3","h4"].indexOf(s)+1))&&a.push("H1–H4 random"),r.i1&&a.push(/0x(8580|0100)0001/.test(r.i1)?"DNS-like first packets":"Signature packets"),r.header_protection_key&&a.push("Encrypted headers"),a.length||a.push(e?.id==="off"?"Plain WireGuard":"No values yet"),t("div",{class:"dl-bento-tile dl-disg"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Disguise"),t("a",{href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(n.id)}§ion=awg`},"Change")]),t("div",{class:"dl-disg-id"},[t("span",{class:`dl-disg-ic${e?.id==="off"?" off":""}`},v(e?.ic??"shield")),t("span",{class:"dl-stack"},[t("b",{},e?e.title:jt(n.preset)??"Custom"),t("span",{class:"dl-sub"},e?e.short:jt(n.preset)?"Switch to Balanced or Maximum":"Set by hand")])]),e?t("div",{class:"dl-disg-meters"},[t("span",{},"Stealth"),o(e.stealth,"acc"),t("span",{},"Speed"),o(e.speed,"ok")]):"",t("div",{class:"dl-disg-chips"},a.map(s=>t("span",{},s)))])}var oo={id:"awg",label:"AmneziaWG",settingsCard:is,overviewTile:ss,connectBlock:rs,qrText:n=>n.conf,appKey:{label:"Copy AmneziaVPN config",make:n=>to(n,n.server)},file:{label:"Download AmneziaWG config",make:n=>({name:n.filename,text:n.conf})}};var ls={awg:oo};function Be(n){return ls[n?.core||"awg"]??oo}function St(n,e){return Be(n.find(r=>r.id===e))}var ds=2,Ut=new Set,ro=null,vn=null;async function gr(){if(document.visibilityState!=="visible"||!Ut.size)return;let n=await P.rev().catch(()=>null);if(!n)return;let e=ro!=null&&n.rev!==ro;ro=n.rev,n.version&&(vn&&n.version!==vn?(U(`Dawnline was updated to ${n.version}: reload the page.`,"warning",15e3),vn=null):vn??(vn=n.version)),e&&Ut.forEach(r=>r())}function bn(n){return Ut.add(n),poll.add(gr,ds),()=>{Ut.delete(n),Ut.size||poll.remove(gr)}}function xr(n,e,r,o,a=0){let i=[],s=null,l=p=>{s&&p>s.from&&i.push({...s,to:p}),s=null},d=n.filter(p=>p.device===e).sort((p,u)=>p.ts-u.ts);for(let p of d)if(p.type==="connect")l(p.ts),p.detail&&(s={ip:p.detail,from:p.ts,to:p.ts,live:!1});else if(p.type==="roam"){let u=p.detail?.split("→")[1]?.trim();l(p.ts),u&&(s={ip:u,from:p.ts,to:p.ts,live:!1})}else p.type==="disconnect"&&l(p.ts);let c=s;return c&&o?i.push({...c,to:Math.max(r,c.from),live:!0}):l(Math.min(r,a)),i}function Ke(n){return`${n.city||`${n.lat.toFixed(1)},${n.lon.toFixed(1)}`}|${n.cc}`}function wr(n,e,r,o){let a=new Map;for(let s of e)(s.device===r||!a.has(s.ip))&&a.set(s.ip,s);let i=[];for(let s of n){let l=a.get(s.ip);!l||s.to<=o||i.push({key:Ke(l),point:l,from:Math.max(s.from,o),to:s.to,live:s.live})}return i}function yr(n){let e=new Map,r=0;for(let o of n)e.set(o.key,(e.get(o.key)??0)+(o.to-o.from)),r+=o.to-o.from;return new Map([...e].map(([o,a])=>[o,r?a/r:0]))}function vr(n,e=2700){let r=[];for(let o of n){let a=r[r.length-1];if(a&&o.key!==a.key&&!o.live&&o.to-o.from{i&&(r.push({kind:"move",k:i,start:o,ms:e}),o+=e);let s=Math.min(1100,Math.max(350,(a.to-a.from)/3600*45));r.push({kind:"stay",k:i,start:o,ms:s}),o+=s}),{steps:r,total:o}}function Er(n,e,r){let o=e.findIndex(l=>r>=l.start&&rr>=s.from&&rs.kind==="stay"&&s.k===o),i=n[o];return a.start+a.ms*Math.min(.999,Math.max(0,(r-i.from)/Math.max(1,i.to-i.from)))}var cs=n=>n<=0?0:n>=1?1:n<.5?2*n*n:1-(-2*n+2)**2/2;function Mr(n){return-ao/2+(1+ao)*cs((n-br)/(1-br))}var Sr=n=>n+$r>=1;function Tr(n){return["interpolate",["linear"],["abs",["-",["get","pos"],n]],0,1,$r,1,ao/2,0]}function _r(n,e){let r=n==="24h"?86400:n==="7d"?604800:2592e3,o=e-r,a=[],i=(l,d)=>{let c=(l-o)/r;c>.02&&c<.98&&a.push([c,d])},s=new Date(o*1e3);if(n==="24h")for(s.setMinutes(0,0,0);s.getTime()/1e3<=e;)s.getHours()%6===0&&i(s.getTime()/1e3,`${String(s.getHours()).padStart(2,"0")}:00`),s.setHours(s.getHours()+1);else if(n==="7d")for(s.setHours(12,0,0,0);s.getTime()/1e3<=e;s.setDate(s.getDate()+1))i(s.getTime()/1e3,s.toLocaleDateString("en-GB",{weekday:"short"}));else{let l=new Date(e*1e3);l.setHours(0,0,0,0);for(let d=0;d<5;d++){let c=new Date(l);c.setDate(l.getDate()-7*d),i(c.getTime()/1e3,c.toLocaleDateString("en-GB",{day:"numeric",month:"short"}))}a.reverse()}return a}var xn=n=>new Date(n*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});function Pr(n,e){let r=o=>new Date(o*1e3).toDateString();return r(n)===r(e)?"Today":r(n)===r(e-86400)?"Yesterday":new Date(n*1e3).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}var so="https://unpkg.com/maplibre-gl@6.14.0/dist",Dr={module:"sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk",css:"sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04"},Ar="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",Hr="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",ps={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Gt=null;function us(n){if(n.appendChild(t("link",{rel:"stylesheet",href:`${so}/maplibre-gl.css`,integrity:Dr.css,crossorigin:"anonymous"})),Gt)return Gt;let e=`${so}/maplibre-gl.mjs`;return Gt=new Promise((o,a)=>{let i=t("link",{rel:"modulepreload",href:e,integrity:Dr.module,crossorigin:"anonymous"});i.addEventListener("load",()=>o()),i.addEventListener("error",()=>a(new Error("integrity"))),document.head.appendChild(i)}).then(()=>import(e)).then(o=>(o.getWorkerUrl()||o.setWorkerUrl(`${so}/maplibre-gl-worker.mjs`),o),o=>{throw Gt=null,new Error(o?.message==="integrity"?"The map library from the CDN is not the expected file: not loading it.":"Could not load the map library (no internet access from this browser?)")}),Gt}var ms=10,zr=30,hs=62,fs=4,Nr=4.5,gs=7,wn="#3b82f6",lo="#8a8a8a";function Rr(n,e,r=.2,o=64){let[a,i]=n,[s,l]=e,d=s-a,c=d>180?s-360:d<-180?s+360:s,p=c-a,u=l-i,x=Math.hypot(p,u);if(x===0||r===0)return[n,[c,l]];let $=-u/x,h=p/x,m=x*r,E=(a+c)/2+$*m,R=(i+l)/2+h*m,C=[],k=Math.max(2,Math.floor(o));for(let y=0;y<=k;y+=1){let w=y/k,b=1-w;C.push([b*b*a+2*b*w*E+w*w*c,b*b*i+2*b*w*R+w*w*l])}return C}function co(n,e){let r=new Map;for(let o of n.geo.points){if(n.person&&o.person!==n.person||n.device&&o.device!==n.device||(e==="online"?!o.online:n.now-o.ts>ps[e]))continue;let a=n.device?Ke(o):n.person?`${o.device}|${o.city}|${o.cc}`:o.device,i=r.get(a);(!i||o.online&&!i.online||o.online===i.online&&o.ts>i.ts)&&r.set(a,o)}return[...r.values()]}function po(n,e){let r=0;return co(n,e).sort((o,a)=>Number(a.online)-Number(o.online)||a.ts-o.ts).map(o=>({...o,n:o.online?0:++r}))}var tt=class{constructor(e,r="online",o=380){this.cb=e;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.theme=null;this.resize=null;this.fitBlind=!1;this.data=null;this.fitted=!1;this.fitKey=null;this.people=[];this.slots=[];this.merged=[];this.piles=new Map;this.dock=null;this.dockKey="";this.dockQuiet=!1;this.piledKeys=new Set;this.foldedKeys=new Set;this.targetZoom=null;this.before=null;this.hiddenKey="";this.focused=null;this.dead=!1;this.places=new Map;this.replaying=null;this.bandDots=[];this.range=r,this.status=t("div",{class:"dl-map-status"}),this.card=t("div",{class:"dl-map-card","aria-live":"polite"}),this.el=t("div",{class:"dl-geomap",style:`height:${o}px`},[this.status,this.card])}async mount(e){this.data=e;try{this.gl=await us(this.el)}catch(o){this.status.textContent=o.message;return}if(this.dead)return;this.map=new this.gl.Map({container:this.el,style:pt()?Ar:Hr,center:[e.geo.home?.lon??20,e.geo.home?.lat??50],zoom:1,renderWorldCopies:!1,attributionControl:{compact:!0},minZoom:1}),this.map.on("style.load",()=>this.layers()),this.map.on("move",()=>this.declutter()),this.map.once("idle",()=>{let o=this.el.querySelector(".maplibregl-ctrl-attrib");o?.classList.remove("maplibregl-compact-show"),o?.removeAttribute("open")}),this.resize=new ResizeObserver(()=>{!this.map||!this.el.clientWidth||!this.el.clientHeight||(this.map.resize(),this.fitBlind&&(this.fitKey=null,this.draw()))}),this.resize.observe(this.el);let r=pt();this.theme=new MutationObserver(()=>{!this.map||pt()===r||(r=pt(),this.map.setStyle(r?Ar:Hr))}),this.theme.observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})}layers(){if(this.map){this.hiddenKey="",this.map.setProjection({type:"globe"}),this.map.addSource("dl-areas",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"dl-area",type:"circle",source:"dl-areas",paint:{"circle-radius":["interpolate",["exponential",2],["zoom"],2,6,6,26,9,140,12,900],"circle-color":["case",["get","online"],wn,lo],"circle-opacity":["case",["get","online"],.12,.06],"circle-stroke-width":1,"circle-stroke-color":["case",["get","online"],wn,lo],"circle-stroke-opacity":["case",["get","online"],.35,.15]}}),this.map.addSource("dl-band",{type:"geojson",data:{type:"FeatureCollection",features:this.bandDots}}),this.map.addLayer({id:"dl-band",type:"circle",source:"dl-band",paint:{"circle-radius":1.4,"circle-color":wn,"circle-opacity":0}}),this.map.addSource("dl-arcs",{type:"geojson",data:{type:"FeatureCollection",features:[]}});for(let e of[!1,!0])this.map.addLayer({id:e?"dl-arc-live":"dl-arc-recent",type:"line",source:"dl-arcs",filter:["==",["get","online"],e],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":e?wn:lo,"line-width":2,"line-opacity":.85,"line-dasharray":[2,2]}});this.draw()}}setRange(e){this.range=e,this.fitKey=null,this.draw()}update(e){this.data=e,this.draw()}destroy(){this.dead=!0,this.dropCard();for(let e of this.piles.values())e.marker.remove();this.piles.clear(),this.theme?.disconnect(),this.resize?.disconnect(),this.map?.remove(),this.map=null}groups(e){let r=new Map;for(let o of e){let a=`${o.person}|${Ke(o)}`,i=r.get(a);i||(i={key:a,person:o.person,lat:o.lat,lon:o.lon,city:o.city,country:o.country,cc:o.cc,asn:o.asn,org:o.org,online:!1,ts:0,points:[]},r.set(a,i)),i.points.push(o),i.online||(i.online=o.online),i.ts=Math.max(i.ts,o.ts)}return[...r.values()]}draw(){if(!this.map||!this.data||!this.map.getSource("dl-arcs"))return;let e=this.data,r=this.groups(co(e,this.range)),o=e.person||e.device?null:e.geo.home;for(let d of this.markers)d.remove();this.markers=[];let a=e.person||e.device?null:bs(r,o),i=r.map(d=>({g:d,at:a?.get(d.key)??[d.lon,d.lat]}));if(this.slots=[],this.map.getSource("dl-areas").setData({type:"FeatureCollection",features:i.map(({g:d})=>({type:"Feature",properties:{online:d.online,key:d.key},geometry:{type:"Point",coordinates:[d.lon,d.lat]}}))}),this.map.getSource("dl-arcs").setData({type:"FeatureCollection",features:o?i.map(({g:d,at:c})=>({type:"Feature",properties:{online:d.online,person:d.person,key:d.key},geometry:{type:"LineString",coordinates:Rr([o.lon,o.lat],c)}})):[]}),o){let d=t("span",{class:"dl-mk-host"});d.innerHTML=`${ft("server","dl-mk-host-ic")}`,this.dock=d.appendChild(t("span",{class:"dl-mk-dock"})),this.dockQuiet=this.dockKey!=="",this.dockKey="";let c=t("div",{class:"dl-mk-hub",title:`Home router${o.city?` · ${o.city}`:""}${o.org?` · ${o.org}`:""}`},[d,t("span",{class:"dl-mk-label chip"},o.city||"Home")]);c.addEventListener("mouseenter",()=>this.showMerged(o.city||"the server")),c.addEventListener("mouseleave",()=>this.focus(this.focused)),c.addEventListener("click",()=>this.zoomToMerged()),this.add(c,[o.lon,o.lat],!0)}let s=new Map(e.device?po(e,this.range).map(d=>[Ke(d),d.n]):[]);this.people=[],this.places.clear();for(let{g:d,at:c}of i){let p=d.points.length,u=e.people.find(m=>m.id===d.person);if(e.person){let m=e.device?this.deviceMarker(d,c,u,s.get(Ke(d))??0):this.placeMarker(d,c,u);this.add(m,c);continue}let x=d.points.map(m=>u?.devices.find(E=>E.id===m.device)?.kind??"other"),$=t("span",{class:"dl-mk-badge"});$.innerHTML=p<=2?x.map(m=>ft(m,"dl-mk-badge-ic")).join(""):String(p);let h=t("button",{type:"button",class:`dl-mk${d.online?" online":""}`,"aria-label":`${u?.name??"Someone"}: ${p} device${p===1?"":"s"} in ${d.city||"an unknown city"}`},[t("span",{class:"dl-mk-av"},[He(u?.name??"?"),$]),t("span",{class:"dl-mk-label below"},d.city||d.cc||"?")]);h.addEventListener("mouseenter",()=>this.focus(d.person)),h.addEventListener("mouseleave",()=>this.focus(null)),this.people.push({el:h,person:d.person}),h.addEventListener("click",m=>{m.stopPropagation(),this.openPopup(d,c,h)}),this.add(h,c,!1,u?.name??"Someone",`${d.city||d.cc||"?"} · ${d.online?"now":re(d.ts,e.now)}`,d.key,d)}this.declutter();let l=i.map(d=>d.g.key).sort().join(";");if(l!==this.fitKey&&!this.popup){let d=this.fitted&&!this.fitBlind;if(this.fitBlind=!this.el.clientWidth||!this.el.clientHeight,this.fitKey=l,this.fitted=!0,o&&!i.length){let c={center:[o.lon,o.lat],zoom:12};d?this.glide(12,()=>this.map.flyTo({...c,duration:1200})):this.map.jumpTo(c)}else{let c=i.map(p=>p.at);o&&(c.length===0||this.range!=="online"||i.some(p=>p.g.online))&&c.push([o.lon,o.lat]),this.fit(c,d)}}this.status.textContent=i.length||o?"":"No locations yet",this.status.style.display=this.status.textContent?"":"none",this.focus(this.focused&&this.people.some(d=>d.person===this.focused)?this.focused:null)}add(e,r,o=!1,a,i,s,l){s&&this.foldedKeys.has(s)&&e.classList.add("merged"),s&&this.piledKeys.has(s)&&e.classList.add("piled"),e.dataset.key=s??"",e.classList.add("dl-mk-new"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("dl-mk-new")));let d=new this.gl.Marker({element:e}).setLngLat(r).addTo(this.map);this.markers.push(d),this.slots.push({marker:d,el:e,at:r,fixed:o,who:a,where:i,g:l})}declutter(){if(!this.map)return;let e=this.map.getZoom();this.el.classList.toggle("dl-lod-far",e=Nr&&e{let l=this.map.project(s.at),d=s.el.querySelector(":scope > .dl-mk-host, :scope > .dl-mk-av, :scope > .dl-mk-tile");return{x:l.x,y:l.y,r:(d?.offsetWidth||24)/2+3,fixed:s.fixed}}),o=r.filter(s=>s.fixed);this.merged=[],this.foldedKeys.clear();let a=this.targetZoom==null?1:Math.min(1,2**(this.targetZoom-this.map.getZoom()));r.forEach((s,l)=>{if(s.fixed)return;let d=this.slots[l],c=d.el.classList.contains("merged")?12:6,p=o.find(u=>Math.hypot(u.x-s.x,u.y-s.y)*a{let c=this.slots[d];!c||c.fixed||(r[d].fixed&&([s,l]=[0,0]),c.marker.setOffset([s,l]),ws(c.el,s,l))})}closePopup(e=!1){let r=this.popup;if(!r||r.card.classList.contains("leaving"))return;r.card.classList.add("leaving"),setTimeout(()=>{this.popup===r&&this.dropCard()},140);let o=this.before;if(this.before=null,!o)return;let a=()=>this.map?.flyTo({...o,duration:800});if(!e)return a();let i=!1,s=()=>{i||(i=!0,window.removeEventListener("pointerup",s,!0),window.removeEventListener("pointercancel",s,!0),setTimeout(a,0))};window.addEventListener("pointerup",s,!0),window.addEventListener("pointercancel",s,!0),setTimeout(s,1500)}dropCard(){this.popup?.off(),this.popup?.card.remove(),this.popup=null}showMerged(e){this.merged.length&&(dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},`Near ${e}`)," · click to zoom in"]),...this.merged.map(r=>t("div",{class:"dl-map-card-row"},[t("span",{},r.who),t("span",{class:"dl-faint"},r.where)]))]),this.card.classList.add("on"))}paintDock(){let e=this.dock;if(!e)return;let r=this.merged.map(a=>`${a.key}:${a.online?1:0}`).join("|");if(r===this.dockKey)return;this.dockKey=r,e.parentElement?.classList.toggle("docked",this.merged.length>0);let o=this.slots.find(a=>a.fixed).at;this.merged.length&&Br(e,this.merged,this.faceActions(()=>[o]),this.dockQuiet),this.dockQuiet=!1}faceActions(e){return{click:(r,o)=>this.openFace(r,o,e()),hover:r=>this.focus(r?.g?.person??null)}}pileUp(e){let r=new Set;if(!this.data?.person&&!this.data?.device){let o=e.flatMap((l,d)=>!l.fixed&&this.slots[d].el.querySelector(":scope > .dl-mk-av")?[d]:[]),a=new Map(o.map(l=>[l,l])),i=l=>a.get(l)===l?l:i(a.get(l));for(let l of o)for(let d of o){if(d<=l)continue;let c=this.slots[l].el.classList.contains("piled")&&this.slots[d].el.classList.contains("piled");Math.hypot(e[l].x-e[d].x,e[l].y-e[d].y)this.slots[m]),c=d.map(Ir),p=c.map(m=>m.key).sort().join(",");r.add(p);let u=[d.reduce((m,E)=>m+E.at[0],0)/d.length,d.reduce((m,E)=>m+E.at[1],0)/d.length],x=this.piles.get(p);if(!x){let m=t("span",{class:"dl-mk-pile-box"}),E=[...new Set(d.map(k=>k.g?.city||k.g?.cc||"?"))],R=t("div",{class:"dl-mk-pile"},[m,t("span",{class:"dl-mk-label below"},E.length===1?E[0]:`${d.length} people`)]);x={marker:new this.gl.Marker({element:R}).setLngLat(u).addTo(this.map),el:R,box:m,faces:c},R.addEventListener("mouseleave",()=>this.focus(this.focused));let C=x;R.addEventListener("click",k=>{k.stopPropagation(),this.zoomInTo(C.faces.map(y=>y.at),!1)}),this.piles.set(p,x)}x.faces=c;let $=x;Br(x.box,c,this.faceActions(()=>$.faces.map(m=>m.at)));for(let m of l)this.slots[m].el.classList.add("piled"),Object.assign(e[m],{r:0,fixed:!0});let h=this.map.project(u);e.push({x:h.x,y:h.y,r:(x.el.offsetWidth||60)/2+3,fixed:!0})}}this.piledKeys=new Set(this.slots.filter(o=>o.el.classList.contains("piled")).map(o=>o.el.dataset.key??"")),this.slots.forEach((o,a)=>{(!e[a].fixed||o.fixed||o.el.classList.contains("merged"))&&o.el.classList.remove("piled")});for(let[o,a]of this.piles)r.has(o)||(this.piles.delete(o),a.el.classList.add("out"),setTimeout(()=>a.marker.remove(),200))}zoomToMerged(){!this.map||!this.merged.length||this.zoomInTo([this.slots.find(e=>e.fixed).at,...this.merged.map(e=>e.at)],!1)}openFace(e,r,o){if(!e.g)return;if(o.every(i=>yn(i,e.at)<1))return this.openPopup(e.g,e.at,r);let a=()=>{let i=this.slots.find(s=>s.el.dataset.key===e.key);i?.g&&!i.el.classList.contains("merged")&&!i.el.classList.contains("piled")&&this.openPopup(i.g,i.at,i.el)};this.zoomInTo(this.nearby(e.at),!0)?this.map.once("moveend",a):a()}nearby(e){return[e,...this.slots.filter(r=>!r.fixed&&r.at!==e&&yn(r.at,e)<=zr).map(r=>r.at)]}zoomInTo(e,r){let o=new this.gl.LngLatBounds;for(let p of e)o.extend(p);let a=e.some(p=>e.some(u=>yn(p,u)>zr)),i=this.map.cameraForBounds(o,{padding:50,maxZoom:a?12:ms}),s=this.map.getZoom(),l=e.map(p=>this.map.project(p)),d=0;l.forEach((p,u)=>l.slice(u+1).forEach(x=>{let $=Math.hypot(p.x-x.x,p.y-x.y),h=s+Math.log2(hs/Math.max($,1e-6));h<=12&&(d=Math.max(d,h))}));let c=Math.min(12,Math.max(i?.zoom??0,d));return c<=s+.05?!1:(r&&!this.before&&(this.before={center:this.map.getCenter().toArray(),zoom:s}),this.map.flyTo({center:i?.center??o.getCenter(),zoom:c,duration:800}),!0)}placeMarker(e,r,o){let a=this.data.now,i=[...e.points].sort((u,x)=>Number(x.online)-Number(u.online)||x.ts-u.ts)[0],s=o?.devices.find(u=>u.id===i.device)?.kind??"other",l=e.points.length,d=t("span",{class:"dl-mk-tile"});d.innerHTML=ft(s,"dl-mk-tile-ic")+(l>1?`${l}`:"");let c=e.online?"now":re(e.ts,a),p=t("button",{type:"button",class:`dl-mk place${e.online?" online":""}`,style:e.online?null:`--dl-mk-fade:${Math.max(.4,1-.6*(a-e.ts)/(30*86400)).toFixed(2)}`,"aria-label":`${l} device${l===1?"":"s"} in ${e.city||"an unknown city"}, ${c}`},[d,t("span",{class:"dl-mk-label below"},[e.city||e.cc||"?",t("span",{class:"dl-mk-when"},c)])]);return p.addEventListener("click",u=>{u.stopPropagation(),this.openPopup(e,r,p)}),p}deviceMarker(e,r,o,a){let i=o?.devices.find(p=>p.id===e.points[0].device)?.kind??"other",s=t("span",{class:"dl-mk-tile"}),l=t("span",{class:"dl-mk-label below"}),d=t("button",{type:"button",class:"dl-mk place step"},[s,l]);d.addEventListener("click",p=>{p.stopPropagation(),this.openPopup(e,r,d)});let c=Ke(e);return this.places.set(c,{el:d,tile:s,label:l,when:null,g:e,n:a,kind:i}),this.paintPlace(c,!1),d}paintPlace(e,r){let o=this.places.get(e);if(!o)return;let a=this.replaying,i=a?a.active===e:o.g.online,s=o.el.classList.contains("online"),l=o.g.city||o.g.cc||"?";o.el.classList.toggle("online",i),o.el.classList.toggle("faded",!!a&&!i),o.tile.classList.toggle("sm",!i),i||!o.n?o.tile.innerHTML=ft(o.kind,"dl-mk-tile-ic"):o.tile.textContent=String(o.n),o.when=null,i?(o.when=t("span",{class:`dl-mk-when${a?" inline":""}`},a?a.when:"now"),o.label.replaceChildren(l,a?" · ":"",o.when)):o.label.replaceChildren(`${l} · ${o.g.online?"now":re(o.g.ts,this.data.now)}`);let d=i?a?a.when:"now":o.g.online?"now":re(o.g.ts,this.data.now);o.el.setAttribute("aria-label",`${o.n?`${o.n}: `:""}${o.g.city||"an unknown city"}, ${d}`),r&&i&&!s&&(o.el.classList.remove("arrive"),o.el.offsetWidth,o.el.classList.add("arrive"),setTimeout(()=>o.el.classList.remove("arrive"),500))}replay(e,r=!0){let o=this.replaying;if(this.replaying=e,o&&e&&o.active===e.active){let a=e.active?this.places.get(e.active):null;a?.when&&(a.when.textContent=e.when);return}for(let a of this.places.keys())a!==e?.active&&this.paintPlace(a,r);e?.active&&this.paintPlace(e.active,r),this.declutter(),setTimeout(()=>this.declutter(),320)}hoverPlace(e){for(let[r,o]of this.places)o.el.classList.toggle("hl",r===e)}band(e,r){if(this.bandDots=[],this.map&&e&&r){let o=Rr(e,r),a=o.map(c=>this.map.project(c)),i=[0];for(let c=1;ci[d]?(p-i[d])/(i[d+1]-i[d]):0,x=[o[d][0]+(o[d+1][0]-o[d][0])*u,o[d][1]+(o[d+1][1]-o[d][1])*u];this.bandDots.push({type:"Feature",properties:{pos:c/l},geometry:{type:"Point",coordinates:x}})}}this.map?.getLayer("dl-band")&&(this.map.setPaintProperty("dl-band","circle-opacity",0),this.map.getSource("dl-band").setData({type:"FeatureCollection",features:this.bandDots}))}bandAt(e){this.map?.getLayer("dl-band")&&this.map.setPaintProperty("dl-band","circle-opacity",Tr(e))}focus(e){this.focused=e;for(let s of this.people)s.el.classList.toggle("dim",!!e&&s.person!==e),s.el.classList.toggle("hl",s.person===e);let r=e?["case",["==",["get","person"],e],.85,.15]:.85;for(let s of["dl-arc-live","dl-arc-recent"])this.map?.getLayer(s)&&this.map.setPaintProperty(s,"line-opacity",r);if(this.card.classList.toggle("on",!!e),!e||!this.data)return;let o=this.data,a=o.people.find(s=>s.id===e),i=co(o,this.range).filter(s=>s.person===e).sort((s,l)=>Number(l.online)-Number(s.online)||l.ts-s.ts);dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},a?.name??e),` · ${i.length} device${i.length===1?"":"s"}`]),...i.map(s=>t("div",{class:"dl-map-card-row"},[t("span",{},a?.devices.find(l=>l.id===s.device)?.name??"Device"),t("span",{class:"dl-faint"},`${s.city||s.cc||"?"} · ${s.online?"now":re(s.ts,o.now)}`)]))])}fit(e,r=!1){if(!e.length)return;let o=(p,u)=>{let x=Math.PI/180,$=(u[1]-p[1])*x,h=(u[0]-p[0])*x,m=Math.sin($/2)**2+Math.cos(p[1]*x)*Math.cos(u[1]*x)*Math.sin(h/2)**2;return 12742*Math.asin(Math.sqrt(m))},a=[e.reduce((p,u)=>p+u[0],0)/e.length,e.reduce((p,u)=>p+u[1],0)/e.length],i=e;if(e.length>=5){let p=[...e].sort((u,x)=>o(a,u)-o(a,x));i=p.slice(0,Math.ceil(p.length*.9))}let s=new this.gl.LngLatBounds(i[0],i[0]);i.forEach(p=>s.extend(p));let l=this.el.clientHeight||380,d=!!this.data?.person,c={padding:{top:this.data?.device?Math.min(56,l/4):Math.min(60,l/5),bottom:d?Math.min(52,l/4):Math.min(40,l/8),left:48,right:48},maxZoom:this.data?.person?11:12};r?this.glide(this.map.cameraForBounds(s,c)?.zoom??null,()=>this.map.fitBounds(s,{...c,duration:1200})):this.map.fitBounds(s,{...c,duration:0})}glide(e,r){this.targetZoom=e,this.declutter(),this.map.once("moveend",()=>{this.targetZoom=null,this.declutter()}),r()}openPopup(e,r,o){let a=this.data,i=[e.city,e.cc||e.country].filter(Boolean).join(", "),s=[...new Set(e.points.map(k=>k.person))],l=e.points.sort((k,y)=>Number(y.online)-Number(k.online)||y.ts-k.ts).map(k=>{let y=a.people.find(b=>b.id===k.person),w=y?.devices.find(b=>b.id===k.device);return t("button",{type:"button",class:"dl-pop-row",click:()=>this.cb.openDevice(k.person,k.device)},[t("span",{class:`dl-pop-dot${k.online?" on":""}`}),t("span",{class:"dl-pop-name"},[t("b",{},y?.name??k.person),` · ${w?.name??"device"}`]),t("span",{class:"dl-faint dl-nowrap"},k.online?"now":re(k.ts,a.now))])}),d=t("div",{class:"dl-pop"},[t("div",{class:"dl-pop-head"},[t("span",{class:"dl-pop-net"},v("globe")),t("div",{class:"dl-stack"},[t("strong",{},e.org||"Unknown network"),t("span",{class:"dl-faint"},[e.asn?`AS${e.asn} · `:"",i?`${i} · approximate`:"approximate location"])])]),t("div",{class:"dl-pop-list"},l),s.length===1?t("div",{class:"dl-pop-actions"},[t("button",{type:"button",class:"cbi-button cbi-button-positive important",click:()=>this.cb.openPerson(s[0])},`Open ${a.people.find(k=>k.id===s[0])?.name??"person"}`)]):""]);this.zoomInTo(this.nearby(r),!0),this.dropCard();let c=t("div",{class:"dl-root dl-popcard",role:"dialog"},[t("span",{class:"dl-popcard-tip"}),d]);document.body.appendChild(c);let p=this.el,u=o?.querySelector(".dl-mk-av, .dl-mk-tile")??o??null,x=()=>{if(!u)return;let k=u.getBoundingClientRect(),y=p.getBoundingClientRect(),w=k.left+k.width/2,b=k.top+k.height/2;c.classList.toggle("away",wy.right||by.bottom);let H=c.offsetWidth,f=c.offsetHeight,g=k.top-f-12>=8||k.top>window.innerHeight-k.bottom,M=Math.min(Math.max(8,w-H/2),window.innerWidth-H-8);c.classList.toggle("above",g),c.classList.toggle("below",!g),c.style.left=`${M}px`,c.style.top=`${g?k.top-f-12:k.bottom+12}px`,c.style.setProperty("--tip-x",`${w-M}px`)},$=k=>{k.target?.closest(".dl-popcard, .maplibregl-marker")||this.closePopup(!0)},h=k=>{k.key==="Escape"&&this.closePopup()},m=k=>{k.target instanceof Element&&k.target.closest(".dl-popcard")||this.closePopup()},E=()=>this.closePopup();this.map.on("move",x),window.addEventListener("scroll",m,{capture:!0,passive:!0}),window.addEventListener("resize",x),document.addEventListener("pointerdown",$,!0),document.addEventListener("keydown",h);let R=$e(E);window.addEventListener("pagehide",E),this.popup={card:c,off:()=>{this.map?.off("move",x),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",x),document.removeEventListener("pointerdown",$,!0),document.removeEventListener("keydown",h),R(),window.removeEventListener("pagehide",E)}};let C=window.setInterval(()=>{if(this.popup?.card!==c)return clearInterval(C);(!p.isConnected||!p.getClientRects().length)&&this.dropCard()},400);x()}};function vs(n,e=6){let r=n.map(o=>({x:o.x,y:o.y}));for(let o=0;o<16;o++){let a=!1;for(let i=0;i[o.x-n[a].x,o.y-n[a].y])}function bs(n,e){let r=new Map,o=e?[[e.lon,e.lat]]:[],a=i=>o.some(s=>yn(i,s)<1.3);for(let i of[...n].sort((s,l)=>s.key>>12)/1048575),d=(s&4095)/4096*2*Math.PI,c=[i.lon,i.lat];for(let p=0;p<24;p++){let u=d+p*2.39996,x=Math.min(8,l+p*.25);if(c=[i.lon+x*Math.sin(u)/(111.32*Math.cos(i.lat*Math.PI/180)),i.lat+x*Math.cos(u)/111.32],!a(c))break}o.push(c),r.set(i.key,c)}return r}function xs(n){let e=2166136261;for(let r=0;r>>0}function Ir(n){return{key:n.el.dataset.key??"",who:n.who??"Someone",where:n.where??"",online:!!n.g?.online,at:n.at,badge:n.el.querySelector(".dl-mk-badge")?.innerHTML??"",g:n.g}}function Br(n,e,r,o=!1){let a=e.length>3,i=()=>[...n.children].filter(h=>!h.classList.contains("out")),s=new Map(i().map(h=>[h,h.getBoundingClientRect().left])),l=n.getBoundingClientRect().width,d=new Map;n.querySelectorAll(".dl-mk-face:not(.out)").forEach(h=>d.set(h.dataset.key??"",h));let c=n.querySelector(".dl-mk-more:not(.out)"),p=h=>{Object.assign(h.style,{position:"absolute",left:`${h.offsetLeft}px`,top:`${h.offsetTop}px`,transform:""}),h.classList.add("out"),setTimeout(()=>h.remove(),200)},u=[];for(let h of e.slice(0,a?2:3)){let m=d.get(h.key);if(d.delete(h.key),!m){let C=t("button",{type:"button",class:`dl-mk-face${o?"":" in"}`,"data-key":h.key},[t("span",{class:"dl-mk-av"},He(h.who)),t("span",{class:"dl-mk-badge"})]);C.addEventListener("animationend",()=>C.classList.remove("in"),{once:!0}),m=C}let E=m,R=E.querySelector(".dl-mk-badge");R.innerHTML!==h.badge&&(R.innerHTML=h.badge),E.title=`${h.who} · ${h.where}`,E.setAttribute("aria-label",`${h.who}, ${h.where}`),E.classList.toggle("on",h.online),E.onclick=C=>{C.stopPropagation(),r.click(h,E)},E.onmouseenter=()=>r.hover(h),E.onmouseleave=()=>r.hover(null),u.push(E)}for(let h of d.values())p(h);if(a){if(!c){c=t("span",{class:`dl-mk-more${o?"":" in"}`});let h=c;h.addEventListener("animationend",()=>h.classList.remove("in"),{once:!0})}c.textContent=`+${e.length-2}`,u.push(c)}else c&&p(c);let x=null;for(let h of u)(x?x.nextElementSibling:n.firstElementChild)!==h&&(x?x.after(h):n.prepend(h)),x=h;for(let h of u){let m=s.get(h);if(m==null)continue;let E=m-h.getBoundingClientRect().left;Math.abs(E)<.5||(h.style.transition="none",h.style.transform=`translateX(${E}px)`,h.offsetWidth,h.style.transition="",h.style.transform="")}n.style.width="";let $=n.getBoundingClientRect().width;if(l&&Math.abs($-l)>.5){n.style.width=`${l}px`,n.offsetWidth,n.style.width=`${$}px`;let h=()=>{n.style.width="",n.removeEventListener("transitionend",h)};n.addEventListener("transitionend",h),setTimeout(h,400)}}function yn(n,e){let r=Math.PI/180,o=Math.sin((e[1]-n[1])*r/2)**2+Math.cos(n[1]*r)*Math.cos(e[1]*r)*Math.sin((e[0]-n[0])*r/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(o)))}function ws(n,e,r){let o=n.querySelector(":scope > .dl-mk-ptr"),a=Math.hypot(e,r);if(a<1){o?.remove();return}o||(o=t("span",{class:"dl-mk-ptr"},[t("i",{class:"line"}),t("i",{class:"spot"})]),n.prepend(o));let i=o.firstElementChild,s=o.lastElementChild;i.style.width=`${a}px`,i.style.transform=`rotate(${Math.atan2(-r,-e)}rad)`,s.style.transform=`translate(${-e}px, ${-r}px)`}function Tt(n,e,r=!0){let o=[["online","Online now"],["24h","24h"],["7d","7 days"],["30d","30 days"]],a=t("div",{class:"dl-seg",role:"tablist"});for(let[i,s]of o)i==="online"&&!r||a.appendChild(t("button",{type:"button",role:"tab",class:i===n?"on":"","data-v":i,click:()=>{a.querySelectorAll("button").forEach(l=>l.classList.toggle("on",l.dataset.v===i)),e(i)}},s));return a}var Or={"24h":86400,"7d":7*86400,"30d":30*86400},uo=(n,e)=>`${(n/e*100).toFixed(3)}%`,kn=class{constructor(e,r,o){this.map=e;this.range=r;this.el=t("div",{class:"dl-dplaces"});this.controls=t("div",{class:"dl-map-replay"});this.pending=null;this.rows=new Map;this.st=[];this.steps=[];this.total=0;this.ms=0;this.stepI=-1;this.on=!1;this.playing=!1;this.raf=0;this.last=0;this.endTimer=0;this.play=t("button",{type:"button",class:"dl-map-btn"});this.chip=t("span",{class:"dl-map-chip"});this.stop=t("button",{type:"button",class:"dl-map-btn",title:"Back to now","aria-label":"Back to now"},v("x"));this.reduced=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;this.data=o,this.play.addEventListener("click",()=>this.toggle()),this.stop.addEventListener("click",()=>this.end()),this.paint()}mapData(){let e=this.data;return{geo:e.geo,people:[e.person],now:e.now,person:e.person.id,device:e.device.id}}update(e){let r={...this.pending??this.data,...e};if(this.on){this.pending=r;return}this.data=r,this.map.update(this.mapData()),this.paint()}setRange(e){this.end(),this.range=e,this.map.setRange(e),this.paint()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.endTimer)}paint(){let e=this.data,r=Or[this.range],o=e.now-r,a=wr(xr(e.events??[],e.device.id,e.now,e.device.online,e.device.handshake),e.geo.points,e.device.id,o),i=yr(a);this.st=kr(a);let s=po(this.mapData(),this.range),l=a.length>0;this.el.classList.toggle("strips",l),this.el.classList.toggle("can-replay",this.st.length>1),this.rows.clear(),dom.content(this.el,s.length?[...s.map(d=>{let c=Ke(d),p=i.get(c),u=l?t("div",{class:`dl-dplace-strip${d.online?" live":""}`},a.filter($=>$.key===c).map($=>t("i",{style:`left:${uo($.from-o,r)};width:${uo($.to-$.from,r)}`}))):"",x=t("div",{class:"dl-dplace-row"},[t("span",{class:`dl-dplace-n${d.online?" live":""}`},d.online?v(e.device.kind):String(d.n)),t("span",{class:"dl-row-main dl-stack"},[t("span",{},[d.city||d.cc||"Unknown city",d.org?t("span",{class:"dl-muted"},` · ${d.org}`):""]),t("span",{class:"dl-faint"},[t("span",{class:"dl-mono"},d.ip),p!=null?` · ${p>0&&p<.005?"<1":Math.round(p*100)}% of the time`:""])]),t("span",{class:d.online?"dl-dplace-now":"dl-faint dl-nowrap"},d.online?"now":re(d.ts,e.now)),u]);if(x.addEventListener("mouseenter",()=>this.map.hoverPlace(c)),x.addEventListener("mouseleave",()=>this.map.hoverPlace(null)),u){let $=h=>{let m=u.getBoundingClientRect();this.seek(o+r*Math.min(1,Math.max(0,(h.clientX-m.left)/m.width)))};u.addEventListener("pointerdown",h=>{u.setPointerCapture(h.pointerId),$(h)}),u.addEventListener("pointermove",h=>h.buttons&&$(h))}return this.rows.set(c,x),x}),l?t("div",{class:"dl-dplace-axis"},_r(this.range,e.now).map(([d,c])=>t("span",{style:`left:${(d*100).toFixed(2)}%`},c))):""]:t("div",{class:"dl-sub"},"No locations in this period.")),this.paintControls()}paintControls(){dom.content(this.play,v(this.playing?"pause":"play")),this.play.title=this.playing?"Pause":"Replay this period",this.play.setAttribute("aria-label",this.play.title),dom.content(this.controls,this.on?[this.play,this.chip,this.stop]:this.st.length>1?[this.play]:[])}begin(){this.on=!0,{steps:this.steps,total:this.total}=Cr(this.st,this.reduced?400:io),this.ms=0,this.stepI=-1,this.map.replay({active:null,when:""},!0)}toggle(){if(this.playing){this.playing=!1,cancelAnimationFrame(this.raf),this.paintControls();return}clearTimeout(this.endTimer),(!this.on||this.ms>=this.total)&&this.begin(),this.playing=!0,this.last=performance.now(),this.paintControls(),this.raf=requestAnimationFrame(e=>this.frame(e))}frame(e){if(this.playing){if(this.ms=Math.min(this.total,this.ms+(e-this.last)),this.last=e,this.show(!0),this.msthis.frame(r));return}this.playing=!1,this.paintControls(),this.endTimer=window.setTimeout(()=>this.end(),1500)}}seek(e){this.st.length<2||(clearTimeout(this.endTimer),this.on||this.begin(),this.ms=Lr(this.st,this.steps,e),this.stepI=-1,this.show(!1),this.paintControls())}show(e){let r=Er(this.st,this.steps,this.ms),o=this.st[r.step.k];if(r.step.kind==="move"){let s=this.st[r.step.k-1];r.i!==this.stepI&&(this.map.replay({active:null,when:""},e),this.map.band([s.point.lon,s.point.lat],[o.point.lon,o.point.lat]));let l=Mr(r.q);this.reduced||this.map.bandAt(l),(this.reduced?r.q>=.5:Sr(l))&&this.map.replay({active:o.key,when:xn(r.t)},e)}else r.i!==this.stepI&&this.map.band(),this.map.replay({active:o.key,when:xn(r.t)},e);this.stepI=r.i;let a=this.data,i=a.now-Or[this.range];this.el.classList.add("replay"),this.el.style.setProperty("--at",uo(r.t-i,a.now-i));for(let[s,l]of this.rows)l.classList.toggle("cur",s===o.key);this.chip.textContent=`${Pr(r.t,a.now)}, ${xn(r.t)} · ${o.point.city||o.point.cc||"?"}`}end(){if(cancelAnimationFrame(this.raf),clearTimeout(this.endTimer),!!this.on){this.on=!1,this.playing=!1,this.ms=0,this.stepI=-1,this.map.band(),this.map.replay(null,!1),this.el.classList.remove("replay");for(let e of this.rows.values())e.classList.remove("cur");this.pending?(this.data=this.pending,this.pending=null,this.map.update(this.mapData()),this.paint()):this.paintControls()}}};function _t(n){return`${L.url("admin/network/dawnline/server")}?${n?`server=${encodeURIComponent(n)}&`:""}section=people`}function ke(n,e){return`${L.url("admin/network/dawnline/person")}?id=${encodeURIComponent(n)}${e?`&device=${encodeURIComponent(e)}`:""}`}function ys(n){return n?new Date(n*1e3).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function mo(n,e,r=!1){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("button",{type:"button",class:`dl-kvrow-v copy${r?" dl-mono":""}`,title:"Copy",click:()=>me(e,`${n} copied`)},[t("span",{},e),v("copy")])])}function $n(n,e){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("span",{class:"dl-kvrow-v"},e)])}var jr={connect:["ok","Connected","plug"],disconnect:["","Went offline","plug"],roam:["","Changed network","network"],device_added:["ok","Added","plus"],device_removed:["","Removed","trash"],device_keys:["","New keys","reset"]};function ks(n,e,r){let o=n.filter(a=>a.device===e&&jr[a.type]).reverse().slice(0,12);return o.length?t("div",{class:"dl-dev-log"},o.map(a=>{let[i,s,l]=jr[a.type],d=a.type==="connect"?[a.detail?t("span",{class:"dl-muted"},` from ${a.detail}`):"",a.where?t("span",{class:"dl-muted"},` · ${a.where}`):""]:a.type==="roam"?[t("span",{class:"dl-muted"},` · ${a.detail??""}`)]:a.type==="device_added"||a.type==="device_removed"||a.type==="device_keys"?[t("span",{class:"dl-muted"},Ne(a)==="portal"?" on the portal":Ne(a)==="admin"?" by you":"")]:[],c=new Date(a.ts*1e3);return t("div",{class:`dl-dev-log-row${Ne(a)==="admin"?" dl-ev-by-admin":""}`},[Ne(a)==="admin"?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},v("admin")):t("span",{class:`dl-ev-tile ev ${i}`},v(l)),t("span",{class:"dl-row-main"},[t("span",{},s),...d]),t("span",{class:"dl-faint dl-nowrap",title:c.toLocaleString()},re(a.ts,r))])})):t("div",{class:"dl-sub"},"No activity yet.")}async function Ur(n,e,r){let o=await P.status(1).catch(()=>null),a=o?.people.find(s=>s.id===n),i=a?.devices.find(s=>s.id===e);o&&a&&i&&Ge(a,i,{...r,geo:o.geo,now:o.now,today:Ie(o.series),core:St(o.servers,a.server)})}async function Ge(n,e,r){let o=await G(()=>P.deviceConfig(e.id));if(!o)return;let a=r.core??Be(null),i=e,s=n,l=r.geo,d=r.now,c=r.today??je(new Date),p=await a.connectBlock(o,e.kind==="phone"||e.kind==="tablet"?"qr":"file"),u=t("div",{class:"dl-drawer-title"}),x=t("div",{}),$=t("div",{}),h=t("div",{},t("div",{class:"dl-sub"},"Loading…")),m=[],E=ee=>{m=ee.filter(B=>B.device===i.id),dom.content(h,ks(ee,i.id,d)),y?.update({events:ee})},R=async(ee=!1)=>{let B=r.events?.();if(B&&!ee)return E(B);let F=await P.events(2e3,n.id).catch(()=>null);F&&E(F.events)},C="30d",k=null,y=null,w=()=>{dom.content(u,[t("span",{class:`dl-dcard-ic${i.online?" on":""}`},v(i.kind)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h3",{},i.name),D([v("edit")],()=>f(),"neutral",{title:"Rename",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),t("span",{class:"dl-sub"},`${s.name} · ${Qe[i.kind]}`)])]);let ee=i.spark.reduce((B,F)=>B+F,0);dom.content(x,t("div",{class:"dl-dstats"},[t("div",{class:"dl-dstats-cell wide"},[t("span",{class:"dl-metric-label"},"Status"),nn(i,d,"Waiting for the first connection",s)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},"This month"),t("b",{},X(i.month[0]+i.month[1])),t("span",{class:"dl-sub dl-mono"},`↓ ${X(i.month[1])} ↑ ${X(i.month[0])}`)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},"Last 7 days"),t("b",{},X(ee)),lr(i.spark,120,22,c)])])),dom.content($,t("div",{class:"dl-kv2"},[mo("Tunnel address",i.address),i.hostname&&s.access!=="internet"?mo("Local address",i.hostname):"",i.endpoint&&!l?.points.some(B=>B.device===i.id&&B.ip===i.endpoint)?$n("Client IP",i.endpoint):"",$n("Total",t("span",{class:"dl-kv-act"},[`↓ ${X(i.total[1])} · ↑ ${X(i.total[0])}`,t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Mt("device",i.id,i.name,()=>setTimeout(H,300))},"Reset")])),$n("Added",`${ys(i.created)} · ${i.created_by==="portal"?"from the portal":"by you"}`),o.amnezia.client_pub_key?mo("Public key",o.amnezia.client_pub_key):$n("Public key","—")])),dom.content(g,[D([v(i.disabled?"play":"pause"),i.disabled?" Enable":" Disable"],async()=>{await G(()=>P.deviceUpdate(i.id,void 0,!i.disabled),i.disabled?"Device enabled":"Device disabled")&&await H()},"neutral",i.disabled?{}:{class:"cbi-button cbi-button-neutral dl-btn-warn"}),D([v("key")," New keys"],async()=>{if(!await se("Generate new keys?","The current configuration on this device stops working until it is imported again.","Generate",!0))return;await G(()=>P.deviceRotate(i.id),"New keys generated")&&(r.refresh(),de.close(),await Ur(s.id,i.id,r))}),t("span",{class:"dl-spacer"}),D([v("trash")," Remove"],async()=>{await se(`Remove ${i.name}?`,"The device is disconnected immediately and its configuration stops working.","Remove",!0)&&await G(()=>P.deviceDelete(i.id),"Device removed")&&(de.close(),r.refresh())},"negative")])},b=async()=>{let ee=await P.status(1).catch(()=>null),B=ee?.people.find(ne=>ne.id===s.id),F=B?.devices.find(ne=>ne.id===i.id);!ee||!B||!F||(s=B,i=F,l=ee.geo,d=ee.now,c=Ie(ee.series),w(),y?.update({geo:ee.geo,now:ee.now,person:s,device:i}))},H=async()=>{await b(),r.refresh()},f=()=>{let ee=t("input",{type:"text",class:"cbi-input-text",value:i.name,maxlength:48}),B=s.devices.filter(ne=>ne.id!==i.id).map(ne=>ne.name),F=ye("Name",ee,()=>_e(ee.value,B,"Shown in the portal and in the app."));oe(`Rename ${i.name}`,[F],[ie()," ",D("Save",async()=>{let ne=F.help();if(ne.bad){U(ne.text,"warning");return}await G(()=>P.deviceUpdate(i.id,ee.value,void 0),"Renamed")&&(ae(),await H())},"positive")]),setTimeout(()=>ee.select(),50)},g=t("div",{class:"dl-drawer-actions"}),M=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Connect")]),i.config_stale?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},"This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below.")]):"",p]),T=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Activity"),t("div",{class:"dl-dsec-actions"},[t("button",{type:"button",class:"dl-linkbtn",click:()=>Fe({people:[s]},m,"csv",i.id)},"Export"),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>et(`Clear ${i.name}'s activity`,`Removes events about ${i.name}.`,{device:i.id},()=>{R(!0),r.refresh()})},"Clear"),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"All activity")])]),h]),z=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},t("h4",{},"Details")),$]),W="";if(l?.enabled){k=new tt({openPerson:B=>location.href=ke(B),openDevice:(B,F)=>location.href=ke(B,F)},C,220);let ee=y=new kn(k,C,{geo:l,now:d??Date.now()/1e3,person:s,device:i,events:r.events?.()??null});W=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},"Locations"),Tt(C,B=>{C=B,ee.setRange(B)},!1)]),t("div",{class:"dl-dmap"},[k.el,ee.controls]),ee.el])}let q=!i.handshake||i.config_stale,Z=t("div",{class:"dl-stack gap16"},q?[x,M,z,W,T]:[x,z,W,T,M]);R();let I=()=>{b(),R()},V=bn(I),Q=window.setInterval(I,3e4),de=Oo(u,Z,g,()=>{clearInterval(Q),V(),y?.destroy(),k?.destroy()});w(),k&&y&&requestAnimationFrame(()=>y&&k?.mount(y.mapData()))}function Gr(n,e,r,o){let a=o.core??Be(null),i=()=>G(()=>P.deviceConfig(r.id)),s=[{label:"Show QR code",icon:v("qr"),run:async()=>{let l=await i();l&&oe(`${r.name} · QR code`,t("div",{class:"dl-qr-pane"},[an(a.qrText(l)),t("span",{class:"dl-sub"},no(l)?"Scan with AmneziaVPN or any WireGuard app on the device.":"Scan with AmneziaVPN or AmneziaWG on the device.")]),ie("Close"))}},{label:a.file.label,icon:v("download"),run:async()=>{let l=await i();if(!l)return;let d=a.file.make(l);Te(d.name,d.text,"application/octet-stream")}},a.appKey?{label:a.appKey.label,icon:v("copy"),run:async()=>{let l=await i();l&&me(await a.appKey.make(l),"Key copied")}}:null,null,{label:"Rename",icon:v("edit"),run:()=>Ge(e,r,o)},{label:"New keys",icon:v("key"),run:async()=>{await se("Generate new keys?","The current configuration on this device stops working until it is imported again.","Generate",!0)&&await G(()=>P.deviceRotate(r.id),"New keys generated")&&o.refresh()}},{label:r.disabled?"Enable":"Disable",icon:v(r.disabled?"play":"pause"),warn:!r.disabled,run:async()=>{await G(()=>P.deviceUpdate(r.id,void 0,!r.disabled),r.disabled?"Device enabled":"Device disabled")&&o.refresh()}},{label:"Delete",icon:v("trash"),danger:!0,run:async()=>{await se(`Remove ${r.name}?`,"The device is disconnected immediately and its configuration stops working.","Remove",!0)&&await G(()=>P.deviceDelete(r.id),"Device removed")&&o.refresh()}}];Ce(n,s)}function nt(n,e){let r=n.devices.map(c=>c.name),o=c=>{let p=Qe[c],u=1,x=p;for(;r.some($=>$.toLowerCase()===x.toLowerCase());)x=`${p} ${++u}`;return x},a="phone",i=t("input",{type:"text",class:"cbi-input-text",placeholder:o(a),maxlength:48}),s=ye("Name",i,()=>i.value.trim()?_e(i.value,r,"Shown in the portal and in the app."):{text:`Named after its type: ${o(a)}.`,bad:!1}),l=t("div",{class:"dl-kinds",role:"radiogroup","aria-label":"Type"},No.map(c=>t("button",{type:"button",role:"radio",class:c===a?"on":"","aria-checked":c===a?"true":"false","data-kind":c,click:()=>{a=c,l.querySelectorAll("button").forEach(p=>{let u=p.dataset.kind===c;p.classList.toggle("on",u),p.setAttribute("aria-checked",u?"true":"false")}),i.placeholder=o(c),s.refresh()}},[v(c),t("span",{},Qe[c])]))),d=n.devices.length>=n.device_limit;oe(`Add a device for ${n.name}`,[d?t("p",{class:"dl-hint"},`${n.name} already has ${n.devices.length} of ${n.device_limit} devices. As admin you can still add one.`):"",t("div",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},"Type"),l]),s],[ie()," ",D("Add device",async()=>{let c=s.help();if(c.bad){U(c.text,"warning");return}let p=i.value.trim()||o(a),u=await G(()=>P.deviceCreate(n.id,p,a));u&&(ae(),U(`${p} added`,"success",3e3),e.refresh(),await Ur(n.id,u.id,e))},"positive")]),setTimeout(()=>i.focus(),50)}var Ve=1080,Ft=1512,We=96,$s="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",Cs="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",Wt=n=>n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]);function Es(n,e,r){let o=new URL(r),a=o.pathname.slice(1),i=Math.min(92,Math.floor((Ve-2*We)/(.58*(4+n.name.length)))),s=Ve-2*We,l=392,d=40,c=rn(r,2).replace("`${m}`;return``+p(We+82,We+42,36,"#a3a3a3",Wt(e))+p(We,276,i,"#ffffff",`Hi, ${Wt(n.name)}`,'font-weight="600"')+p(We,340,40,"#8a8a8a",`Scan to connect to ${Wt(e)}`)+``+c+`${Wt(a)}`+p(Ve/2,l+s+156,34,"#737373",Wt(o.host),'text-anchor="middle"')+""}async function Ls(n){let e=new Image;e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,await e.decode();let r=document.createElement("canvas");return r.width=Ve,r.height=Ft,r.getContext("2d").drawImage(e,0,0,Ve,Ft),new Promise((o,a)=>r.toBlob(i=>i?o(i):a(new Error("Could not draw the card")),"image/png"))}async function Wr(n){let e=await G(()=>P.personLinks(n));return e?e.link?{link:e.link,links:e.links??[]}:(U("The personal portal is off. Turn it on in Settings.","warning"),null):null}async function Cn(n){let e=await Wr(n);e&&await me(e.link,"Personal link copied")}async function qt(n,e,r={}){let o=n.link,a=n.links;if(o===void 0){let m=await Wr(n.id);if(!m)return;o=m.link,a=m.links}if(!o){U("The personal portal is off. Turn it on in Settings.","warning");return}let i=o,s=await G(()=>Ls(Es(n,e,i)));if(!s)return;let l=new File([s],`${n.id}-invite.png`,{type:"image/png"}),d=URL.createObjectURL(s),c=navigator,p=!!c.canShare?.({files:[l]}),u=!p&&typeof c.share=="function"&&(c.canShare?.({url:i})??!0),x=()=>{URL.revokeObjectURL(d),ae()},$=async m=>{try{await c.share(m)}catch{}},h=p?D([v("link")," Share card"],()=>$({files:[l],title:`Invite ${n.name}`}),"positive"):u?D([v("link")," Share link"],()=>$({url:i,title:`Invite ${n.name}`,text:"Your personal VPN link"}),"positive"):D([v("download")," Download card"],()=>Te(l.name,s),"positive");oe(r.title??`Invite ${n.name}`,t("div",{class:"dl-invite"},[t("img",{src:d,alt:`Invite card for ${n.name}`}),t("div",{class:"dl-invite-side"},[t("p",{class:"dl-muted"},r.lead??`Send ${n.name} the card or the link. They open it, add their devices and connect — no account needed.`),t("button",{type:"button",class:"dl-invite-link",title:"Copy link",click:()=>me(i,"Personal link copied")},[t("span",{},i.replace(/^https:\/\//,"")),v("copy")]),...(a??[]).filter(m=>m!==i).map(m=>t("button",{type:"button",class:"dl-invite-link alt",title:"Copy this link",click:()=>me(m,"Link copied")},[t("span",{},m.replace(/^https?:\/\//,"")),t("span",{class:`dl-pill ${m.startsWith("http:")?"warn":""}`},m.startsWith("http:")?"HTTP":"Also"),v("copy")])),t("ol",{class:"dl-invite-steps"},[t("li",{},["Install ",t("b",{},"AmneziaVPN")," on the device"]),t("li",{},"Open the link or scan the code"),t("li",{},"Add the device and connect")]),t("div",{class:"dl-invite-actions"},[h,D([v("copy")," Copy link"],()=>me(i,"Personal link copied"))])])]),[t("button",{class:"cbi-button cbi-button-neutral",click:x},"Done")],"wide")}function Kt(n,e){let r=n.servers.find(d=>d.id===e)??n.servers[0],o=n.people.filter(d=>d.server===r.id),a=new Set(o.map(d=>d.id)),i=o.flatMap(d=>d.devices),s=d=>o.reduce((c,p)=>{let u=d(p);return[c[0]+u[0],c[1]+u[1]]},[0,0]),l=r.series?.[r.series.length-1];return{...n,servers:[r],people:o,series:r.series??n.series,events:n.events.filter(d=>d.person?a.has(d.person):!0),geo:{...n.geo,points:n.geo.points.filter(d=>a.has(d.person))},totals:{people:o.length,devices:i.length,online:i.filter(d=>d.online).length,active:o.filter(d=>d.state==="active").length,today:l?[l.rx,l.tx]:[0,0],month:s(d=>d.month)}}}var Fr=3,ho=class{constructor(){this.n=0;this.shown=0}next(){return++this.n}take(e){return e{let x=e.next(),$=null;try{$=await n.fetch(u),r>=Fr&&U("The router answers again.","success",3e3),r=0}catch{return++r===Fr&&U("The router is not answering: what you see may be out of date.","warning",8e3),null}return $==null||!e.take(x)?null:(n.apply($,p),$)},a=(p=!1)=>o(p,!1),i=()=>document.visibilityState==="visible",s=()=>i()&&(n.active?.()??!0)?o(!0,!1):Promise.resolve(null);poll.add(s,n.every);let l=n.live?bn(()=>void(i()&&(n.active?.()??!0)&&o(!0,!0))):null,d=()=>{poll.remove(s),l?.(),c()},c=$e(d);return{refresh:a,claim:()=>e.claim(),stop:d}}function Pt(n){let e=document.activeElement;return!!n&&!!e&&e!==document.body&&n.contains(e)}function Se(n,e,r=!1){return r&&Pt(n)?!1:(dom.content(n,e),!0)}function qr(n,e){let r=n,a=t("div",{class:"dl-choices"},[{v:"internet",ic:"globe",text:"Browse the internet through your router. No access to devices at home."},{v:"lan",ic:"home",text:"Reach devices at home (NAS, printer, cameras). Internet stays on their own connection."},{v:"both",ic:"shield",text:"Home devices and the internet, all through your router."}].map(i=>t("button",{type:"button",class:`dl-choice${i.v===r?" selected":""}`,"data-v":i.v,click:()=>{r=i.v,a.querySelectorAll(".dl-choice").forEach(s=>s.classList.toggle("selected",s.dataset.v===i.v)),e?.(i.v)}},[t("span",{class:"dl-choice-title"},[v(i.ic),dt[i.v]]),t("span",{class:"dl-choice-text"},i.text)])));return{el:a,get:()=>r}}function fo(n){try{return localStorage.getItem(n)}catch{return null}}function go(n,e){try{localStorage.setItem(n,e)}catch{}}function Ms(n){let e=n.devices.length,r=Math.max(1,n.device_limit,e),o=Math.min(160,r*22+(r-1)*3);return t("div",{class:"dl-slotbar",title:`${e} of ${n.device_limit} devices`},[t("span",{class:"dl-slotbar-segs",style:`width: ${o}px`},Array.from({length:r},(a,i)=>t("i",{class:i>=n.device_limit?"over":in.state==="server_off"?n.paused:!["active","quota","expired"].includes(n.state),vo=n=>n.state==="server_off"?n.paused:n.state!=="active",Vr=n=>vo(n)?n.state==="server_off"?"paused":n.state:null;function Ss(n,e){let r=Ye(n.expires,e);return n.state==="quota"||n.state==="expired"||Ze(n,r)||!!n.quota_limit&&n.quota_used>=n.quota_limit*.9}function Jr(n,e){return bt(n&&Vn(n,e)>=0?n:e,1)}var Yr=n=>n.people.map(e=>e.id).sort().join(" "),Zr=!1,mt=class{constructor(){this.list=t("div",{class:"dl-plist",role:"list"});this.filter=["all","online","attention","paused"].find(e=>e===(new URLSearchParams(location.search).get("filter")??fo("dl.people.filter")))??"all";this.sort=["seen","name","usage"].find(e=>e===fo("dl.people.sort"))??"seen";this.query="";this.noFooter=!0;this.serverId=null;this.el=null}async load(){return P.status(30)}scope(e){return this.serverId?Kt(e,this.serverId):e}embed(e,r){return this.serverId=r,this.render(e)}person(e){return this.st.people.find(r=>r.id===e)}get today(){return Ie(this.st.series)}deviceOpts(e){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:St(this.st.servers,e.server)}}take(e,r){let o=this.scope(e),a=Yr(o)!==Yr(this.st);this.st=o,a?this.rebuild():(this.paintCards(r),this.decorate(r))}async update(){await this.poller?.refresh()}async refresh(){this.poller?.claim();let e=await P.status(30).catch(()=>null);e&&(this.st=this.scope(e),this.rebuild())}rebuild(){let e=new Map;for(let o of Array.from(this.list.children))o.dataset.sid&&e.set(o.dataset.sid,o);let r=this.st.people.map(o=>{let a=e.get(o.id)??t("div",{class:"dl-card",role:"listitem","data-sid":o.id});return this.renderCard(a,o.id)});dom.content(this.list,r.length?r:t("div",{class:"dl-plist-none"},this.st.servers.length?"No people yet. Add someone and send them their personal link.":"Set up the server first, then add people.")),this.decorate()}paintCards(e=!1){for(let r of this.st.people){let o=this.card(r.id);o&&!(e&&Pt(o))&&this.renderCard(o,r.id)}}card(e){return this.list.querySelector(`[data-sid="${CSS.escape(e)}"]`)}render(e){let r=this.scope(e);this.st=r;let o=this,a=t("select",{class:"dl-select","aria-label":"Sort",change:d=>{o.sort=d.target.value,go("dl.people.sort",o.sort),o.decorate()}},[t("option",{value:"seen",selected:o.sort==="seen"?"selected":null},"Last seen"),t("option",{value:"name",selected:o.sort==="name"?"selected":null},"Name"),t("option",{value:"usage",selected:o.sort==="usage"?"selected":null},"Usage")]),i=t("input",{type:"search",class:"cbi-input-text dl-people-find",placeholder:"Find…","aria-label":"Find a person or device",hidden:r.people.length>8?null:"hidden",input:d=>{o.query=d.target.value.trim().toLowerCase(),o.decorate()}}),s=d=>{let c=d.target;d.key==="/"&&!i.hidden&&!["INPUT","TEXTAREA","SELECT"].includes(c?.tagName)&&!c?.isContentEditable&&(d.preventDefault(),i.focus())};document.addEventListener("keydown",s),$e(()=>document.removeEventListener("keydown",s));let l=t("div",{class:"dl-root"},[o.serverId?"":t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"People"),t("span",{class:"dl-muted dl-people-count"},this.countText())]),r.servers.length?D([v("plus")," Add person"],()=>o.openCreate(),"add"):""]),r.servers.length?"":t("div",{class:"alert-message warning"},["No server yet. ",t("a",{href:L.url("admin/network/dawnline/server")},"Run the setup wizard")," before adding people."]),t("div",{class:"dl-toolbar"},[t("div",{class:"dl-seg dl-people-tabs",role:"tablist"}),t("div",{class:"dl-toolbar-end"},[i,a,o.serverId?D([v("plus")," Add person"],()=>o.openCreate(),"add"):""])]),this.list]);return this.el=l,this.rebuild(),this.poller??(this.poller=ot({fetch:()=>P.status(30),every:30,live:!0,active:()=>!!o.el?.isConnected,apply:(d,c)=>o.take(d,c)})),!Zr&&new URLSearchParams(location.search).get("add")&&(Zr=!0,setTimeout(()=>o.openCreate(),100)),Promise.resolve(l)}countText(){let e=this.st.totals;return`${e.people} ${e.people===1?"person":"people"} · ${e.devices} device${e.devices===1?"":"s"} · ${e.online} online`}decorate(e=!1){let r=this.el?.querySelector(".dl-people-count");r&&(r.textContent=this.countText());let o=this.st.people,a=this.today,i=m=>Ss(m,a),s={all:o.length,online:o.filter(m=>m.online>0).length,attention:o.filter(i).length,paused:o.filter(m=>Kr(m)).length},l=this.el?.querySelector(".dl-people-tabs");if(l&&!(e&&Pt(l))){let m={all:"All",online:"Online",attention:"Needs attention",paused:"Paused"};dom.content(l,Object.keys(m).map(E=>t("button",{type:"button",role:"tab",class:E===this.filter?"on":"",click:()=>{this.filter=E,go("dl.people.filter",E),this.decorate()}},[m[E],t("b",{class:E==="attention"&&s[E]?"warn":""},String(s[E]))])))}let d=this.query,c=m=>[m.name,m.note??"",...m.devices.flatMap(E=>[E.name,E.address,E.hostname,E.endpoint])].join(" ").toLowerCase(),p=m=>!(this.filter==="online"&&!m.online||this.filter==="attention"&&!i(m)||this.filter==="paused"&&!Kr(m)||d&&!c(m).includes(d)),u=m=>Vr(m)==="paused"?2:vo(m)?1:0,x=[...o].sort((m,E)=>u(m)-u(E)||(this.sort==="name"?m.name.localeCompare(E.name):this.sort==="usage"?E.month[0]+E.month[1]-(m.month[0]+m.month[1]):E.online-m.online||E.last_seen-m.last_seen)),$=0;for(let m of x){let E=this.card(m.id);if(!E)continue;this.list.appendChild(E),E.classList.toggle("dl-off",vo(m));let R=p(m);E.classList.toggle("dl-filtered",!R),R&&$++}let h=this.el?.querySelector(".dl-people-none")??null;o.length&&!$?(h??(h=t("div",{class:"dl-empty dl-people-none"},t("p",{},"No one here right now."))),h.previousElementSibling!==this.list&&this.list.after(h)):h?.remove()}async quick(e,r,o){await G(()=>P.personUpdate(e.id,r),o)&&await this.update()}renderCard(e,r){let o=this.person(r);if(!o)return dom.content(e,t("em",{},"This person was just removed.")),e;let a=this.today,i=Ye(o.expires,a),s=Math.max(0,o.device_limit-o.devices.length),l=o.has_link??this.st.settings.portal_enabled,d=[],c=Vr(o);if(o.expires&&c!=="expired"){let h=Ze(o,i),m=i!=null&&i<0;d.push(t("span",{class:`dl-pill-ic${m?" bad":h?" warn":""}`,title:`Access ends ${Me(o.expires)}`},[v("calendar"),m?`ended ${Me(o.expires)}`:h?Xt(i):`until ${Me(o.expires)}`]))}o.hours&&c!=="hours"&&d.push(t("span",{class:"dl-pill-ic",title:"Allowed hours"},[v("clock"),o.hours.replace("-","–")]));let p=tn(o.devices).map(h=>t("button",{type:"button",class:`dl-chip${h.disabled?" disabled":""}${h.online?" live":""}`,title:`${Qe[h.kind]} · ${h.address}${h.online?` · online from ${h.endpoint}`:h.handshake?` · seen ${re(h.handshake,this.st.now)}`:""}`,click:m=>{m.preventDefault(),Ge(o,h,this.deviceOpts(o))}},[v(h.kind),t("span",{class:"dl-chip-name"},h.name),!h.handshake&&!h.disabled?t("span",{class:"dl-chip-tag"},"not set up"):""]));p.push(t("button",{type:"button",class:"dl-chip add",title:s>0?"Add device":"Over the limit: admins can still add",click:h=>{h.preventDefault(),nt(o,this.deviceOpts(o))}},[v("plus"),"Add device"]));let u=[];o.expires&&Ze(o,i)&&c!=="expired"&&u.push(t("button",{type:"button",class:"dl-fix",click:()=>this.quick(o,{expires:Jr(o.expires,a)},"Extended by 1 month")},"Extend 1 month"));let x=Le("more","More",h=>Ce(h.currentTarget,[{label:"Open",icon:v("open"),run:()=>{location.href=ke(o.id)}},l?{label:"Invite card",icon:v("qr"),run:()=>qt(o,this.st.servers.find(m=>m.id===o.server)?.name??"Home")}:null,s>0?{label:"Add device",icon:v("plus"),run:()=>nt(o,this.deviceOpts(o))}:null,null,{label:o.paused?"Resume":"Pause",icon:v(o.paused?"play":"pause"),warn:!o.paused,run:()=>this.togglePause(o)},{label:"Delete",icon:v("trash"),danger:!0,run:()=>this.remove(o.id)}].filter((m,E,R)=>m||E>0&&R[E-1])),"neutral","dl-icon-only"),$=t("div",{class:"dl-pcard-actions"},[l?Le("link","Copy link",()=>Cn(o.id),"neutral","dl-icon-only"):"",x]);return dom.content(e,t("div",{class:"dl-pcard"},[t("div",{class:"dl-pcard-main"},[t("div",{class:"dl-pcard-top"},[t("span",{class:`dl-avatar${o.online?" online":""}`},He(o.name)),t("div",{class:"dl-pcard-who"},[t("div",{class:"dl-card-head"},[t("a",{class:"dl-card-name",href:ke(o.id)},o.name),Bo(o),...d]),Ms(o)])]),t("div",{class:"dl-chips"},p),u.length?t("div",{class:"dl-fixes"},u):""]),this.usageSide(o,$),c?this.stopStrip(o,c):""])),e}stopStrip(e,r){let o=this.today,a=bt(`${o.slice(0,8)}01`,1),i=()=>this.quick(e,{bonus_gb:String((e.bonus_gb||0)+10)},"+10 GB this month"),s={paused:["pause","warn","Paused","Devices can’t connect until you resume",["play","Resume",()=>this.togglePause(e)]],quota:e.quota_period==="month"?["chart","bad","Data limit reached",`Paused until it resets on ${Me(a)}`,["plus","+10 GB this month",i]]:["chart","bad","Data limit reached","Paused until the limit is raised",["edit","Change limit",()=>location.href=ke(e.id)]],expired:["calendar","bad",`Access ended ${Me(e.expires)}`,"Devices can’t connect",["calendar","Extend 1 month",()=>this.quick(e,{expires:Jr(e.expires,o)},"Extended by 1 month")]],hours:["clock","warn","Outside allowed hours",`Access ${e.hours.replace("-","–")} (router time)`,null],no_server:["alert","warn","No server","Choose a server on their page",null]},[l,d,c,p,u]=s[r];return t("div",{class:`dl-pstrip ${d}`},[t("span",{class:`dl-need-ic ${d}`},v(l)),t("span",{class:"dl-pstrip-text"},[t("b",{},c),t("span",{class:"dl-faint"},p)]),u?D([v(u[0]),` ${u[1]}`],u[2]):""])}usageSide(e,r){let o=e.quota_used||e.month[0]+e.month[1],a=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,i=e.devices.reduce((p,u)=>p+(u.spark[u.spark.length-1]??0),0),s=e.rate?.[e.rate.length-1],l=e.online&&s&&this.st.now-s[0]<180,d=t("div",{class:`dl-usebar${a>=100?" bad":a>=90?" warn":""}`});if(e.quota_limit){let p=t("i",{class:"fill"});p.style.width=`${a}%`,d.appendChild(p),he(d,()=>[t("div",{class:"dl-tip-title"},`${a.toFixed(1)}% used`),t("div",{class:"dl-muted"},`${X(e.quota_used)} of ${X(e.quota_limit)} · ${X(Math.max(0,e.quota_limit-e.quota_used))} left`),t("div",{class:"dl-faint"},e.quota_period==="total"?"In total":`This month${e.bonus_gb?` · includes +${e.bonus_gb} GB extra`:""}`)])}else{let p=e.devices.map(u=>({d:u,v:u.month[0]+u.month[1]})).filter(u=>u.v>0).sort((u,x)=>x.v-u.v);p.forEach((u,x)=>{let $=t("i",{class:`c${Math.min(x,4)}`});$.style.flexGrow=String(u.v),d.appendChild($)}),p.length&&he(d,()=>[t("div",{class:"dl-tip-title"},"This month by device"),...p.map((u,x)=>t("div",{class:"dl-tip-row"},[t("span",{class:`dl-swatch c${Math.min(x,4)}`}),t("span",{},u.d.name),t("b",{},X(u.v))]))])}let c=e.quota_limit?`${X(Math.max(0,e.quota_limit-e.quota_used))} left`:"no limit";return t("div",{class:"dl-pside"},[t("div",{class:"dl-pside-top"},[l?t("span",{class:"dl-pside-state live"},"Online"):t("span",{class:"dl-pside-state"},e.online?"Online":e.last_seen?"Offline":"Never connected"),r]),t("div",{class:"dl-use-num"},[t("b",{class:o?"":"dl-faint"},X(o)),t("span",{class:"dl-faint"},e.quota_limit?`of ${X(e.quota_limit)}`:e.quota_period==="total"&&e.quota_gb?"in total":"this month")]),d,l?t("div",{class:"dl-use-live",title:"Right now"},[`↓ ${Oe(s[2])}`,t("span",{class:"dl-faint"},`↑ ${Oe(s[1])}`)]):t("div",{class:"dl-faint dl-pside-foot"},i?`today ${X(i)} · ${c}`:c)])}async togglePause(e){await G(()=>P.personPause(e.id,!e.paused),e.paused?`${e.name} resumed`:`${e.name} paused`)&&await this.refresh()}async remove(e){let r=this.person(e);await se(`Remove ${r?.name??e}?`,`All ${r?.devices.length??0} devices are disconnected immediately and the personal link stops working. Usage history is kept in backups.`,"Remove",!0)&&await G(()=>P.personDelete(e),"Person removed")&&await this.refresh()}openCreate(){let e=this.st;if(!e.servers.length){U("Set up the server first.","warning");return}let r=t("input",{type:"text",class:"cbi-input-text",placeholder:"e.g. Myata",maxlength:48}),o=(()=>{try{return JSON.parse(fo("dl.person.last")??"{}")}catch{return{}}})(),a=qr(o.access??"internet"),i=t("input",{type:"number",class:"cbi-input-text",min:1,max:32,value:e.settings.default_device_limit}),s=t("input",{type:"date",class:"cbi-input-text"}),l=t("input",{type:"number",class:"cbi-input-text",min:0,step:"any",placeholder:"Unlimited",value:o.quota??""}),d=(C,k)=>t("button",{type:"button",class:"cbi-button cbi-button-neutral",click:()=>{s.value=k?bt(Ie(e.series),k):"",s.dispatchEvent(new Event("change"))}},C),c=e.servers[0],p=!this.serverId&&e.servers.length>1?t("select",{class:"cbi-input-select"},e.servers.map(C=>t("option",{value:C.id},C.name))):null,u=(C,k,y)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},C),t("div",{class:"cbi-value-field"},[k,y?t("div",{class:"cbi-value-description"},y):""])]),x=Ie(e.series),$=ye("Name",r,()=>_e(r.value,[],"Shown in their portal and apps.")),h=ye("Devices",i,()=>cn(i.value)),m=ye("End date",s,()=>Xo(s.value,x,Ye,Me),t("div",{class:"dl-actions"},[s,d("1 month",1),d("3 months",3),d("1 year",12),d("None",0)])),E=ye("Monthly data (GB)",l,()=>pn(l.value));s.addEventListener("change",()=>m.refresh());let R=e.settings.portal_enabled;oe("Add person",[$,p?u("Server",p):"",t("div",{class:"cbi-value dl-block"},[t("label",{class:"cbi-value-title"},"Access"),t("div",{class:"cbi-value-field"},a.el)]),h,m,E],[ie()," ",D(R?"Create and copy link":"Create",async()=>{let C=ze([$,h,m,E]);if(C){U(C,"warning");return}let k=await G(()=>P.personCreate(r.value.trim(),"",p?.value??c.id,a.get(),i.value.trim(),s.value,l.value.trim(),"month"));k&&(go("dl.person.last",JSON.stringify({access:a.get(),quota:l.value.trim()})),k.link&&await me(k.link,"Personal link copied",!0),this.showCreated(k.id,r.value.trim(),k.link,e.servers.find(y=>y.id===(p?.value??c.id))?.name??c.name),await this.refresh())},"positive")]),setTimeout(()=>r.focus(),50)}showCreated(e,r,o,a){if(o){qt({id:e,name:r,link:o},a,{title:`${r} is ready`,lead:`Send ${r} the card or the link. They open it, add their devices and connect — no account needed.`});return}let i=this.person(e);oe(`${r} is ready`,[t("p",{},"Created. Turn on the personal portal in Settings to get a link, or add devices for them here.")],[t("button",{class:"cbi-button cbi-button-neutral",click:ae},"Done")," ",t("a",{class:"cbi-button cbi-button-neutral",href:`${L.url("admin/network/dawnline/settings")}?section=portal`},"Open Settings")," ",i?D("Add device",()=>{ae(),nt(i,this.deviceOpts(i))},"positive"):""])}};var En=["#3a83f7","#a78bfa","#f472b6","#f59e0b","#10b981","#22d3ee","#ef4444","#84cc16"],bo=n=>t("i",{class:"dl-circle-dot",style:`background:${En[n?.color??0]??En[0]}`}),rt=n=>n.access==="both"||n.access==="lan"&&!n.services?.length;function Qr(n,e,r){let o=le(n?.name??e.name??"",{placeholder:"NAS"}),a=le(n?.address??e.address??"",{placeholder:"192.168.1.10",class:"cbi-input-text dl-mono"}),i=le((n?.ports??e.ports??[]).join(", "),{placeholder:"All ports, or e.g. 445, 5000",class:"cbi-input-text dl-mono"}),s=ye("Name",o,()=>_e(o.value,[],"Shown to people who may reach it.")),l=ye("Address",a,()=>er(a.value)),d=ye("Ports",i,()=>tr(i.value));oe(n?`Edit ${n.name}`:"Add service",[s,l,d],[ie()," ",D("Save",async()=>{let c=ze([s,l,d]);if(c){U(c,"warning");return}let p=i.value.split(/[ ,]+/).filter(Boolean);await G(()=>P.serviceSet(n?.id??"",o.value,a.value,p),"Saved")&&(ae(),r())},"positive")])}var Ts={_smb:"SMB",_afpovertcp:"AFP",_http:"Web",_https:"Web",_ssh:"SSH",_sftp:"SFTP","_sftp-ssh":"SFTP",_ipp:"Printer",_ipps:"Printer",_printer:"Printer","_pdl-datastream":"Printer",_airplay:"AirPlay",_raop:"AirPlay",_rfb:"Screen sharing",_googlecast:"Cast",_hap:"HomeKit",_rdp:"Remote desktop",_ftp:"FTP"},_s=[["Web",["80","443"]],["SMB",["445"]],["SSH",["22"]]];function Ps(n){let e=new Map;for(let r of n.services){let o=Ts[r.type.split(".")[0]];!o||!r.port||(e.get(o)??e.set(o,new Set).get(o)).add(String(r.port))}return e.size?[...e].map(([r,o])=>[r,[...o].sort((a,i)=>+a-+i)]):_s}function Xr(n,e,r){let o=n,a=null,i=!1,s=null,l=new Set,d=t("div",{class:"dl-list"}),c=t("div",{class:"dl-stack gap8"},t("span",{class:"dl-sub"},"Looking for devices at home…")),p=()=>{let m=o.services;dom.content(d,m.length?m.map(E=>t("div",{class:"dl-row"},[v("home"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},E.name),t("span",{class:"dl-mono dl-faint"},`${E.address}${E.ports.length?` · ports ${E.ports.join(", ")}`:" · all ports"}`)]),D("Edit",()=>Qr(E,{},r)),D([v("trash")],async()=>{await se(`Remove ${E.name}?`,"People limited to this service lose access to it.","Remove",!0)&&await G(()=>P.serviceDelete(E.id),"Removed")&&await r()},"neutral",{title:"Remove","aria-label":`Remove ${E.name}`})])):[t("div",{class:"dl-row dl-muted"},"No services yet: pick ports of a device below.")])};async function u(m,E){if(!l.has(m.address)){l.add(m.address),$();try{let R=o.services.find(k=>k.address===m.address);(E===null?R&&await G(()=>P.serviceDelete(R.id),`${R.name} removed`):await G(()=>P.serviceSet(R?.id??"",R?.name??(m.name||m.address),m.address,E),R?`${R.name} updated`:`${m.name||m.address} added`))&&await r()}finally{l.delete(m.address),$()}}}function x(m){let E=o.services.find(w=>w.address===m.address),R=!!E&&!E.ports.length,C=new Set(E?.ports??[]),k=l.has(m.address),y=(w,b,H)=>qe(w,b,H,{disabled:k?"disabled":null,"aria-busy":k?"true":null});return t("div",{class:"dl-row"},[v(m.services.some(w=>w.type.startsWith("_ipp")||w.type.startsWith("_printer"))?"file":"computer"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},m.name||m.address),t("span",{class:"dl-mono dl-faint"},m.address)]),t("div",{class:"dl-chips-row dl-host-ports"},[y("All ports",R,()=>u(m,R?null:[])),...Ps(m).map(([w,b])=>{let H=!R&&b.every(f=>C.has(f));return y(`${w} ${b.join(", ")}`,H,()=>{let f=new Set(R?[]:C);for(let g of b)H?f.delete(g):f.add(g);u(m,f.size?[...f]:null)})})])])}function $(){if(i)return dom.content(c,t("span",{class:"dl-sub"},"Couldn't read the devices at home."));if(!a)return;let m=a;if(!m.hosts.length)return dom.content(c,t("span",{class:"dl-sub"},"No devices found in the home network right now."));let E=t("details",{class:"dl-params",open:s??!o.services.length?"":null},[t("summary",{},[v("chevron"),t("span",{},"Add from devices at home"),t("span",{class:"dl-pcount"},String(m.hosts.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},m.mdns?"Ports they announce over Bonjour. Pick what to open, or all ports.":"Devices that got an address from this router. Pick the ports to open, or all ports."),t("div",{class:"dl-list"},m.hosts.map(x))])]);E.addEventListener("toggle",()=>s=E.open),dom.content(c,E)}return P.homeHosts(e).then(m=>{a=m,$()}).catch(()=>{i=!0,$()}),p(),{el:t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-iflead"},[t("div",{class:"dl-iflead-row"},[t("b",{},"Home services"),D([v("plus")," Add service"],()=>Qr(null,{},r))]),t("span",{class:"dl-sub"},"Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers.")]),d,c]),update(m){o=m,p(),$()}}}function Ln(n,e,r,o){let a=new Set(n.circles.filter(m=>m.server===e).map(m=>m.color)),i=r?.color??En.findIndex((m,E)=>!a.has(E));i<0&&(i=0);let s=le(r?.name??"",{placeholder:"Family"}),l=n.people.filter(m=>m.server===e).sort((m,E)=>m.name.localeCompare(E.name)),d=new Set(l.filter(m=>r&&m.circle===r.id).map(m=>m.id)),c=t("div",{class:"dl-swatches",role:"radiogroup","aria-label":"Colour"}),p=()=>dom.content(c,En.map((m,E)=>t("button",{type:"button",role:"radio",class:`dl-swatch${E===i?" on":""}`,style:`--sw:${m}`,"aria-checked":E===i?"true":"false","aria-label":`Colour ${E+1}`,click:()=>{i=E,p()}})));p();let u=t("div",{class:"dl-chips-row"},l.map(m=>{let E=m.circle&&m.circle!==r?.id?n.circles.find(R=>R.id===m.circle):void 0;return t("button",{type:"button",class:`dl-chipbtn${d.has(m.id)?" on":""}`,title:rt(m)?E?`Now in ${E.name}`:"":`${m.name} has no home access: their devices aren't reachable anyway`,click:R=>{d.delete(m.id)||d.add(m.id),R.currentTarget.classList.toggle("on",d.has(m.id))}},[m.name,rt(m)?E?t("b",{},E.name):"":t("b",{},"internet")])})),x=(m,E)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},m),t("div",{class:"cbi-value-field"},E)]),$=n.circles.filter(m=>m.server===e&&m.id!==r?.id).map(m=>m.name),h=ye("Name",s,()=>Jo(s.value,$));oe(r?`Edit ${r.name}`:"New circle",[h,x("Colour",c),x("People",u),t("p",{class:"dl-sub"},"Devices of people in one circle reach each other. A person is in one circle at a time.")],[r?D("Delete",async()=>{await G(()=>P.circleDelete(r.id),`${r.name} deleted`)&&(ae(),o())},"negative"):"",t("span",{class:"dl-spacer"}),ie()," ",D("Save",async()=>{let m=h.help();if(m.bad){U(m.text,"warning");return}await G(()=>P.circleSet(r?.id??"",e,s.value,i,[...d]),"Saved")&&(ae(),o())},"positive")],"dl-circle-modal")}function ea(n,e,r){let o=n.circles.filter(a=>a.server===e);return t("div",{class:"dl-chips-row dl-circles"},[...o.map(a=>{let i=n.people.filter(s=>s.circle===a.id).map(s=>s.name);return t("button",{type:"button",class:"dl-chip",title:`Edit ${a.name}`,click:()=>Ln(n,e,a,r)},[bo(a),t("b",{},a.name),t("span",{class:"dl-faint"},i.length?i.join(", "):"nobody yet")])}),t("button",{type:"button",class:"dl-chip add",title:"New circle","aria-label":"New circle",click:()=>Ln(n,e,null,r)},v("plus"))])}function xo(n,e){let r=n.people.filter(p=>p.server===e.id),o=(p="")=>t("span",{class:"dl-yes"},[v("check"),p]),a=()=>t("span",{class:"dl-faint"},"—"),i=p=>{let u=new Set(p.map(x=>x.access==="lan"&&x.services?.length?"services":x.home_nets?.length?"some":"all"));return u.size||u.add("all"),o([...u].map(x=>({all:"all networks",some:"their networks",services:"services"})[x]).join(" / "))},s=()=>e.mesh==="off"?a():e.mesh==="circles"?o("circle"):o(),l=e.lan_like?"like home":"direct",d=(p,u,x)=>t("tr",{},[t("td",{},[t("b",{},p),t("div",{class:"dl-sub"},`${u.length} ${u.length===1?"person":"people"}`)]),...x.map($=>t("td",{},$))]),c=p=>r.filter(u=>u.access===p);return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Who reaches what"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"From the rules on this server")]),t("div",{class:"dl-reach-wrap"},t("table",{class:"dl-table dl-reach"},[t("tr",{},["","Internet","Home","This router","Each other"].map(p=>t("th",{},p))),d("Internet",c("internet"),[o(l),a(),t("span",{class:"dl-faint"},"DNS"),a()]),d("Home",c("lan"),[t("span",{class:"dl-faint"},"their own"),i(c("lan")),o(),s()]),d("Both",c("both"),[o(l),i(c("both")),o(),s()])])),t("p",{class:"dl-sub"},"Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing.")])])}function ta(n,e){let r=n.people.filter(c=>c.server===e.id).flatMap(c=>c.devices.map(p=>({id:p.id,label:`${c.name} · ${p.name}`}))).sort((c,p)=>c.label.localeCompare(p.label)),o="@addr",a=(c,p)=>{let u=t("select",{class:"cbi-input-select","aria-label":c},[...r.map(m=>t("option",{value:m.id,selected:m.id===p?"selected":null},m.label)),t("option",{value:o,selected:p===o?"selected":null},"Address")]),x=le("",{placeholder:c,class:"cbi-input-text dl-mono"}),$=t("div",{class:"dl-check-end"},[u,x]),h=()=>x.hidden=u.value!==o;return u.addEventListener("change",h),h(),{el:$,value:()=>u.value===o?x.value.trim():u.value}},i=a("10.0.1.11",r[0]?.id??o),s=a("10.0.1.20:445",o),l=t("div",{class:"dl-stack gap8"}),d=async()=>{let c=await G(()=>P.accessCheck(i.value(),s.value()));if(!c)return;let p=c.steps.findIndex(u=>!u.ok);dom.content(l,[t("div",{class:`dl-verdict ${c.ok?"ok":"bad"}`},[t("b",{},c.ok?"Allowed":"Blocked"),t("span",{class:"dl-sub"},c.ok?"Every step lets it through":`Stops at step ${p+1} of ${c.steps.length}`)]),t("ul",{class:"dl-checks"},c.steps.map(u=>t("li",{},[t("span",{class:`dl-check-icon ${u.ok?"ok":"error"}`},v(u.ok?"check":"x")),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},u.title),u.detail?t("div",{class:"dl-check-detail"},u.detail):""])])))])};return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Check access"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"Why something does or does not connect")]),t("div",{class:"dl-check-form"},[i.el,t("span",{class:"dl-faint"},"→"),s.el,D("Check",d)]),l])])}var Mn={app:"Dawnline",amneziawg:"AmneziaWG",packages:"System packages",pkgs:"System packages"};function at(n){return(n.startsWith("check")?n.slice(6)||"all":n).split(/[:@ ]/)[0]}function Sn(n){return at(n.action==="check"?`check:${n.component??""}`:n.component??"")}function na(n){return n=Math.max(0,Math.floor(n)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function oa(n,e){return!n?.from&&!n?.to?e:n.from&&n.to&&n.from!==n.to?`${n.from} → ${n.to}`:n.to??n.from??e}function ra(n,e){let r=n.check?.components??{},o=e==="all"?["app","amneziawg","packages"]:[e],a=[],i;for(let l of o){let d=r[l];if(d){if(d.error)return{tone:"warn",text:d.error};l==="packages"&&d.updates?a.push(`${d.updates} system package${d.updates===1?"":"s"}`):l!=="packages"&&d.update&&d.installed&&d.latest&&(a.push(`${Mn[l]} ${d.latest}`),e!=="all"&&(i=d.latest))}}if(a.length)return{tone:"acc",text:`Update available: ${a.join(", ")}`,update:i};let s=o.length===1?r[o[0]]:null;return s?.status==="dev"?{tone:"acc",text:`Installed version is newer than the release (${s.latest})`}:s?.note?{tone:"warn",text:s.note}:{tone:"ok",text:o.length>1?"Everything is up to date":"Latest version is installed"}}function aa(n,e,r,o){return e?n.id===e:r&&n.id===r?!1:n.state==="running"||o>0&&n.started>=o}var ia=n=>new Promise(e=>setTimeout(e,n));async function Vt(n,e,r){let o=r?Sn(r):at(n),a=r?r.action==="check":n.startsWith("check"),i=Date.now(),s=t("b",{},Mn[o]??(o==="all"?"All components":"Dawnline")),l=t("span",{class:"dl-pill dl-mono"},e.version??""),d=t("span",{class:"dl-pill info",hidden:!0}),c=t("span",{},"0:00"),p=t("pre",{class:"dl-log"},"Operation started. Waiting for log output…"),u=t("div",{}),x=t("div",{class:"dl-op-actions"}),$=[],h=f=>dom.content(x,f),m=(f=!1)=>ie("Close",f);oe(e.title,t("div",{class:"dl-op"},[t("div",{class:"dl-op-head"},[s,e.version?l:"",d,t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-op-timer"},[v("clock"),c])]),t("div",{class:"dl-op-loghead"},[t("b",{},"Operation log"),Le("copy","Copy log",()=>me($.join(` -`),"Log copied"))]),p,u]),[x],"wide"),h([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},a?"Checking…":"Working…")]);let E=r??null,R=r?.id,C,k=0,y=f=>{R!==f.id&&(R=f.id,e.onJob?.(f))};if(r)e.onJob?.(r);else try{let f=await P.updatesStatus().catch(()=>null);C=f?.job?.id,k=f?.now??0;let g=await P.updatesRun(n);g.job&&g.job.state==="running"&&g.job.id!==C&&(E=g.job,y(g.job))}catch(f){return $=[be(f)],p.textContent=$[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},be(f))])),h([m(!0)]),U(be(f),"error"),null}let w=null,b=0;for(;;){if(await ia(1e3),w=await P.updatesStatus().catch(()=>null),!w){if(++b>60)break;continue}b=0;let f=w.job;if(!f||!aa(f,R,C,k)){if(Date.now()-i>15e3)break;continue}if(y(f),E=f,f.log.length){$=f.log;let g=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=$.join(` -`),g&&(p.scrollTop=p.scrollHeight)}if(l.textContent=oa(f,e.version??""),!l.isConnected&&l.textContent&&s.after(l),c.textContent=na((f.finished??w.now)-f.started),f.state==="running"){d.hidden=!f.phase,d.textContent=f.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!E||E.state==="running")return d.className="dl-pill warn",d.textContent="No answer",dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},"The router stopped answering. The job may still finish: reopen Components in a minute.")])),h([m()]),e.onDone?.(w),E;if(E.state==="failed")return d.className="dl-pill bad",d.textContent="Failed",dom.content(u,t("div",{class:"dl-comp-status bad"},[v("x"),t("span",{},[t("b",{},E.error??"Operation failed"),a?"":". Nothing else was changed."])])),h([D("Copy log",()=>me($.join(` -`),"Log copied")),m(!0)]),U(`${Mn[o]??"Update"}: ${E.error??"failed"}`,"error"),e.onDone?.(w),E;if(d.className="dl-pill ok",d.textContent="Finished",a&&w){let f=ra(w,o);if(dom.content(u,t("div",{class:`dl-comp-status ${f.tone}`},[v(f.tone==="ok"?"check":f.tone==="warn"?"alert":"download"),t("span",{},f.text)])),U(f.text,f.tone==="warn"?"warning":"success"),e.onDone?.(w),f.update&&e.onUpdate){let g=w;h([m(),D(`Update to ${f.update}`,()=>e.onUpdate(g),"positive")])}else h([m()]),f.tone==="ok"&&setTimeout(()=>u.isConnected&&ae(),1200);return E}if(o==="app"&&E.to){let f=E.to,g=t("span",{},"Waiting for the router to restart its services…");dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},`Dawnline ${f} is installed. `),g])]));let M=()=>{ui.menu?.flushCache(),location.reload()};h([m(),D("Reload now",M,"positive")]),U(`Dawnline updated to ${f}`,"success",6e3);for(let T=1;T<=30;T++)if(g.textContent=`Waiting for the router to restart its services (${T} of 30)…`,await ia(1500),(await P.updatesStatus().catch(()=>null))?.version===f)return g.textContent="Services are back. Reloading…",setTimeout(M,800),E;return g.textContent="Services restarted. Reload the page to use the new version.",E}let H=o==="pkgs"?`Updated ${[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]].join(", ")||"system packages"}`:o==="amneziawg"?`AmneziaWG${E.to?` ${E.to}`:""} is installed`:"Operation completed";return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},H)])),h([m()]),U(H,"success"),e.onDone?.(w),E}var Ds={https:"HTTPS for the portal",acme:"ACME certificates",home:"the home-like link",awg:"AmneziaWG"};async function sa(n,e,r,o){return!await se(`Install ${e}?`,r,"Install")||(await Vt(n,{title:`Installing ${e}`}))?.state!=="done"?!1:(setTimeout(()=>o?.(),4e3),!0)}function Tn(n){return sa("amneziawg:auto","AmneziaWG","Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds.",n)}async function Jt(n,e,r){return n==="awg"?Tn(r):e.length?sa(`pkgs:${e.join(",")}`,Ds[n],`${e.join(", ")} from the OpenWrt feeds. Dawnline sets the rest up when they arrive.`,r):!0}async function la(n,e){if(n==="awg")return Tn(e);let r=await G(()=>P.updatesStatus());return r?Jt(n,r.needs?.[n]??[],e):!1}var As=[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn","VPN & tunnels"],["other","Other"]],Hs={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function da(n,e,r){let o=n.id,a=e,i=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},"Loading interfaces…")))),s,l=!0,d="",c=!0,p=!0,u="all",x=!1,$=Xr(a,o,r),h=new Set,m="",E=()=>JSON.stringify([p,l,l?"":d,c,[...h].sort()]),R=()=>s.detected.lan||s.saved.lan||"",C=()=>(l?s.detected.wan||s.saved.wan:d)||"",k=()=>new Map(s.devices.map(I=>[I.name,I])),y=()=>{let I=k();return[...c&&R()?[R()]:[],...[...h].filter(Q=>Q!==R())].filter(Q=>Q!==C()).map(Q=>I.get(Q)??{name:Q,nets:[],missing:!0})},w=(I,V)=>{s=I,V&&(l=I.config.auto_wan,d=I.config.wan_device||I.detected.wan||I.saved.wan||"",c=I.config.auto_lan,p=I.config.lan_like,u=I.config.mesh??(I.config.device_mesh?"all":"off"),h=new Set(I.config.lan_devices),m=E()),q()},b=async I=>{let V=await P.interfaces(o).catch(Q=>(U(Q.message,"error"),null));V&&w(V,I)};function H(I){let V=c&&I.name===R(),Q=!!I.own||!!I.master||I.name===C()||V;return V||h.has(I.name)||!Q&&(I.nets.length>0||!!I.missing)}function f(I){let V=c&&I.name===R(),Q=I.name===C(),de=!V&&h.has(I.name),B=!(!!I.own||!!I.master||Q||V)&&(I.nets.length>0||de||!!I.missing),F=(de||V)&&!I.zone&&!I.missing,ne=I.missing?"Not present right now":I.own?"This server":I.master?`Port of ${I.master}`:Q?`Internet${I.zone?` · zone ${I.zone}`:""}`:I.nets.length?I.nets.join(", "):"No IPv4 network",pe=t("button",{type:"button",class:`dl-if${de?" sel":""}${V?" auto":""}${!B&&!de&&!V?" off":""}${F?" warn":""}`,"aria-pressed":de||V?"true":"false","aria-disabled":B?null:"true",click:()=>{B&&(h.has(I.name)?h.delete(I.name):h.add(I.name),q())}},[t("span",{class:"dl-if-ic"},v(Hs[I.kind]??"link")),t("span",{class:"dl-if-main"},[t("span",{class:"dl-if-name"},I.name),t("span",{class:"dl-if-sub"},ne)]),V?t("span",{class:"dl-if-badge ok"},"Auto"):de?t("span",{class:"dl-if-check"},v("check")):""]);return he(pe,()=>[t("div",{class:"dl-tip-title"},I.name),t("div",{class:"dl-muted"},[I.logical?`Interface ${I.logical}`:"No netifd interface",I.zone?` · zone ${I.zone}`:" · no firewall zone"]),I.members.length?t("div",{class:"dl-muted"},`Ports: ${I.members.join(", ")}`):"",I.nets.length?t("div",{class:"dl-mono"},I.nets.join(", ")):"",F?t("div",{class:"dl-warn"},"Not in a firewall zone: the firewall rejects this traffic."):"",I.master?t("div",{class:"dl-muted"},`Choose ${I.master} to include it.`):""]),pe}function g(){let I=s.like_home;return!p||!s.config.lan_like||!n.enabled?"":!s.needs?.length&&I.active&&I.bridged?"ok":"warn"}function M(){let I=s.like_home;return p?s.needs?.length?[t("span",{class:"dl-warn"},`Needs ${s.needs.join(" and ")}.`)," Until they are installed, internet traffic goes straight to the WAN."]:s.config.lan_like?n.enabled?I.active&&I.bridged?["Internet traffic enters ",t("span",{class:"dl-mono"},I.dev??"")," as ",t("span",{class:"dl-mono"},I.address??""),", so whatever handles home traffic (proxies, filters, DNS) handles it too."]:[t("span",{class:"dl-warn"},`Not working: ${I.error??"the link is down"}`)," Internet traffic goes straight to the WAN for now."]:["Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too."]:["Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on."]:["Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router."]}let T={off:"Devices of different people never reach each other; a person's own devices don't either.",all:"Devices of people with home access reach each other, like home devices do. Internet-only people never.",circles:"Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never."};function z(I,V,Q,de,ee="",B){return t("div",{class:B?"dl-setrow head":"dl-setrow"},[t("div",{class:"dl-lh-main"},[t("span",{class:`dl-need-ic ${ee}`},v(I)),t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},V),t("span",{class:"dl-sub"},Q),B??""])]),t("div",{class:"dl-setrow-ctl"},de)])}let W=(I,V)=>{let Q=de=>t("span",{class:"dl-mono"},de);return I?t("span",{},[" Now: ",Q(I),...V&&V!==I?[", was ",Q(V)]:[],"."]):t("span",{},V?[" Not found now: using ",Q(V),"."]:[" Not found."])};function q(){let I=t("select",{class:"cbi-input-select","aria-label":"Internet interface",change:_=>{d=_.target.value,q()}},s.devices.filter(_=>!_.own&&!_.master&&_.zone&&!_.missing).map(_=>t("option",{value:_.name,selected:_.name===d?"selected":null},`${_.name} · zone ${_.zone}`))),Q=y().flatMap(_=>_.nets.map(j=>[j,_.name])),de=JSON.parse(E()),ee=JSON.parse(m),B=(..._)=>_.some(j=>JSON.stringify(de[j])!==JSON.stringify(ee[j])),F=B(0,1,2),ne=B(3,4),pe=_=>D("Save",async()=>{let j=await G(()=>P.serverInterfaces(o,l,l?"":d,c,[...h],p,u!=="off",u),"Access saved");j&&(w(j,!0),j.nets_changed&&j.lan_only&&U(`${j.lan_only} ${j.lan_only===1?"person has":"people have"} Home-only access: their devices need the configuration again to reach the new networks.`,"warning",1e4))},"positive",{disabled:!_}),A=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Internet"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"People with Internet or Both")]),z("home","Internet like a home device",M(),[p&&s.needs?.length?D("Install",()=>Jt("home",s.needs,()=>b(!1)),"positive"):"",ve(p,"Internet like a home device",_=>{p=_,q()})],g()),z("globe","Auto-detect WAN",["The interface with the default route: the server port opens there and Internet access leaves through it.",W(s.detected.wan,s.saved.wan)],[l?"":I,ve(l,"Auto-detect WAN",_=>{l=_,q()})])]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},p?["Internet like a home device",C()?[" · leaves through ",t("span",{class:"dl-mono"},C())]:""]:C()?["Internet straight to ",t("span",{class:"dl-mono"},C())]:"No WAN found"),pe(F)])]),N=we([["off","Off"],["all","Everyone"],["circles","Circles"]],u,{label:"Devices reach each other",cls:"sm",optimistic:!1,onChange:async _=>{let j={off:"Off",all:"Everyone",circles:"Circles"}[_];await G(()=>P.serverUpdate(o,{mesh:_}),`Devices reach each other: ${j}`)&&(u=_,s.config.mesh=_,q(),await r())}}),S=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Home network"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},"People with Home or Both"),D([v("reset")," Rescan"],()=>b(!1),"neutral",{title:"Read the interfaces again"})]),z("network","Networks","Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it.","","",Z()),z("link","Devices reach each other",T[u],N,"",u==="circles"?ea(a,o,r):void 0),$.el]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub dl-if-summary"},Q.length?["Home access reaches ",...Q.flatMap(([_,j],Y)=>[Y?", ":"",t("span",{class:"dl-mono"},_),` (${j})`])]:"No home network: Home access reaches nothing but this router."),pe(ne)])]),O=window.scrollY;i.style.minHeight=`${i.offsetHeight}px`,dom.content(i,[A,S]),i.style.minHeight="",window.scrollTo({top:O})}function Z(){let I=s.devices.filter(H),V=s.devices.filter(Q=>!H(Q));return t("div",{class:"dl-stack gap8 dl-netpick"},[I.length?t("div",{class:"dl-ifgrid"},I.map(f)):t("span",{class:"dl-warn"},"No home network: Home access reaches nothing but this router."),t("label",{class:"dl-boxrow"},[t("span",{class:"dl-stack"},[t("span",{},"Auto-detect LAN"),t("span",{class:"dl-sub"},["Adds the LAN this router uses.",W(s.detected.lan,s.saved.lan)])]),ve(c,"Auto-detect LAN",Q=>{c=Q,q()})]),V.length?t("details",{class:"dl-params",open:x?"":null,toggle:Q=>x=Q.currentTarget.open},[t("summary",{},[v("chevron"),t("span",{},"Other interfaces"),t("span",{class:"dl-pcount"},String(V.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},"The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network."),...As.map(([Q,de])=>{let ee=V.filter(B=>B.category===Q);return ee.length?t("div",{class:"dl-ifgroup"},[t("h4",{},de),t("div",{class:"dl-ifgrid"},ee.map(f))]):""})])]):""])}return b(!0),{el:i,update(I){a=I,$.update(I),s&&q()}}}var zs={connect:"ok",disconnect:"",roam:"",device_added:"ok",device_removed:"",person_added:"",person_removed:"",paused:"warn",resumed:"ok",expiring:"warn",expired_kept:"",portal_blocked:"bad",person_changed:"",devices_removed:"warn"},Ns={devices_removed:"trash",link_changed:"link",person_added:"plus",person_removed:"trash",person_changed:"edit",paused:"pause",resumed:"play",expiring:"calendar",expired_kept:"calendar"};function Rs(n,e){return e.device?n.people.flatMap(o=>o.devices).find(o=>o.id===e.device)?.kind??e.dkind??"other":Ns[e.type]??"activity"}function wo(n,e){let r=n.people.find(h=>h.id===e.person),o=r?.name??e.pname??e.person??"",a=r?.devices.find(h=>h.id===e.device)?.name??e.dname??"",i=h=>t("b",{},h),s=h=>t("span",{class:"dl-muted"},h),l=h=>t("span",{class:"dl-mono"},h),d=h=>e.hosts?.[h]?[t("span",{class:"dl-ev-host"},[t("b",{},e.hosts[h]),t("span",{class:"dl-faint"},` (${h})`)])]:[l(h)],c=h=>t("span",{class:"dl-ev-kind"},`${h} `),p=a?`${o} · ${a}`:o,u=sr(e),x=u||a||"a device",$=h=>[t("span",{class:"dl-you"},"You"),s(` ${h} `)];if(Ne(e)==="admin")switch(e.type){case"device_added":return[...$("added"),c("device"),i(x),s(" for "),i(o)];case"device_removed":return[...$("removed"),c("device"),i(x),s(" from "),i(o)];case"paused":return[...$("paused"),c("person"),i(o)];case"resumed":return[...$("resumed"),c("person"),i(o)];case"device_changed":{let h=u.startsWith("renamed from ");return[...$(h?"renamed":u),c("device"),i(a||"a device"),s(" of "),i(o),...h?[s(` · was ${u.slice(13)}`)]:[]]}case"device_keys":return[...$("issued new keys for"),c("device"),i(x),s(" of "),i(o),s(" · it needs its new configuration")];case"link_changed":return[...$("issued a new link for"),c("person"),i(o),s(" · the old link stopped working")]}switch(e.type){case"connect":return[c("Device"),i(p),s(" connected"),...e.detail?[s(" from "),...d(e.detail)]:[],...e.where?[s(` · ${e.where}`)]:[]];case"disconnect":return[c("Device"),i(p),s(" went offline")];case"roam":return[c("Device"),i(p),s(" changed network "),...(e.detail??"").split(" → ").flatMap((h,m)=>m?[s(" → "),...d(h)]:d(h))];case"device_added":return[c("Person"),i(o),s(" added "),c("device"),i(x),...Ne(e)==="portal"?[s(" on their portal")]:[]];case"device_removed":return[c("Person"),i(o),s(" removed "),c("device"),i(x),...Ne(e)==="portal"?[s(" on their portal")]:[]];case"device_keys":return[c("Person"),i(o),s(" issued new keys for "),c("device"),i(x),s(" on their portal")];case"person_added":return[...$("added"),c("person"),i(e.detail??o)];case"person_removed":return[...$("removed"),c("person"),i(e.detail??o)];case"person_changed":return[...$("changed"),c("person"),i(o),...u?[s(` · ${u.replace(/_/g," ")}`)]:[]];case"expiring":return[c("Person"),i(o),s(`’s access ends in ${e.detail??"a few days"}`)];case"expired_kept":return[c("Person"),i(o),s(`’s end date passed (${e.detail??""}) · access kept`)];case"paused":return[c("Person"),i(o),s(` paused — ${e.detail??""}`)];case"resumed":return[c("Person"),i(o),s(" resumed"),...e.detail&&e.detail!=="active"?[s(` — ${e.detail}`)]:[]];case"portal_blocked":return[t("b",{class:"dl-sys-src"},"Personal portal"),s(" blocked "),l(e.detail??""),s(" for 15 min after too many wrong codes")];case"devices_removed":return[c("Person"),i(o),s(" — all devices removed, end date reached")];default:return[s(`${e.type}${e.detail?`: ${e.detail}`:""}`)]}}var Is={portal_blocked:["globe","bad"]};function Bs(n,e){if(n.servers.length<2||!e.person)return"";let r=n.people.find(a=>a.id===e.person),o=r&&n.servers.find(a=>a.id===r.server);return o?t("span",{class:"dl-ev-srv",title:"Server"},o.name):""}function it(n,e,r={}){let o=Is[e.type],a=Ne(e);return t("div",{class:`dl-row${a==="admin"?" dl-ev-by-admin":o?` dl-ev-by-system ${o[1]}`:""}`},[a==="admin"?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},v("admin")):o?t("span",{class:"dl-ev-tile sys"},v(o[0])):t("span",{class:`dl-ev-tile ev ${zs[e.type]??""}`},v(Rs(n,e))),t("span",{class:"dl-row-main"},wo(n,e)),r.server===!1?"":Bs(n,e),t("span",{class:"dl-faint dl-nowrap",title:new Date(e.ts*1e3).toLocaleString()},r.time??re(e.ts,n.now))])}var Os={info:"",up:"ok",down:"warn",repair:"warn",error:"bad"},js={awg:"tunnel",dawnline:"sunrise",portal:"globe"};function _n(n,e,r,o){let a=n.by==="admin",i=t("div",{class:`dl-row dl-slog-row ${a?"dl-ev-by-admin":`dl-ev-by-system ${Os[n.level]??""}`}${n.detail?" has-detail":""}`},[a?t("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},v("admin")):t("span",{class:"dl-ev-tile sys",title:n.level},v(js[n.src]??"zap")),t("span",{class:"dl-row-main"},a?[t("span",{class:"dl-you"},"You"),t("span",{class:"dl-muted"},` ${n.msg} `),n.kind?t("span",{class:"dl-ev-kind"},`${n.kind} `):"",n.who?t("b",{},n.who):"",n.note?t("span",{class:"dl-muted"},` · ${n.note}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},n.detail):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},"Server "):"",t("b",{class:"dl-sys-src",title:Bt[n.src]??n.src},n.who??Bt[n.src]??n.src)," ",t("span",{class:"dl-muted"},n.msg),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},n.detail):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString()},o)]);return n.detail&&i.addEventListener("click",s=>{s.target.closest("pre")||r()}),i}function ca(n){let e=new Date(n*1e3),r=new Date,o=new Date;return o.setDate(r.getDate()-1),e.toDateString()===r.toDateString()?"Today":e.toDateString()===o.toDateString()?"Yesterday":e.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"})}var Dt=n=>wt(n).toLocaleDateString("en-GB",{day:"numeric",month:"short"});function Pn(n,e,r,o=!1){let a=n.slice(-15),i=a[a.length-1],s=i&&e-i[0]<180,l=s?i[2]:0,d=s?i[1]:0,[c,p]=r,u=200,x=40,$=Math.max(1,...a.map(k=>Math.max(k[1],k[2]))),h=k=>a.map((y,w)=>`${a.length>1?w/(a.length-1)*u:u},${x-2-y[k]/$*(x-6)}`),m=h(2),E=h(1),R=a.length>1&&!o?yt(``):t("div",{class:"dl-speed-wait"},[t("i"),o?"":t("span",{},"Collecting… 1 point a minute")]),C=(k,y,w,b)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:w},y),` ${k}`]),o?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Oe(b))]);return a.length>1&&!o&&he(R,()=>{let k=a[a.length-1];return[t("div",{class:"dl-tip-title"},new Date(k[0]*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Oe(k[2])} · ↑ ${Oe(k[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Speed now"),o?"":t("span",{class:"dl-sub"},"last 15 min")]),t("div",{class:"dl-speed-cols"},[C("Download","↓","dl-dn",l),C("Upload","↑","dl-up",d)]),R,t("div",{class:"dl-speed-today"},[t("span",{},["Today ",t("b",{},X(c+p))]),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${X(p)} `,t("span",{class:"dl-up"},"↑"),` ${X(c)}`])])])}function Dn(n,e){let r=n.slice(-30),o=r.map(d=>d.rx+d.tx),a=Math.max(1,...o),i=o.reduce((d,c)=>d+c,0),s=o.reduce((d,c,p)=>c>o[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},r.map((d,c)=>{let p=o[c],u=t("i",{class:c===r.length-1?"hi":"",style:`height:${Math.max(4,p/a*100)}%`});return he(u,()=>[t("div",{class:"dl-tip-title"},c===r.length-1?`Today · ${Dt(d.day)}`:Dt(d.day)),t("div",{},X(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${X(d.tx)} ↑ ${X(d.rx)}`)]),u}));return t("div",{class:"dl-bento-tile month"},[t("div",{class:"dl-bento-head"},[t("span",{},[t("span",{class:"dl-metric-label"},"Last 30 days"),t("b",{class:"dl-bento-total"},X(i))]),o[s]>0?t("span",{class:"dl-sub"},`peak ${X(o[s])} · ${Dt(r[s].day)}`):""]),r.length?l:t("p",{class:"dl-muted"},"No traffic yet."),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},r.length?Dt(r[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},"today")])])}function pa(n){let e=n.slice(-30),r=e.map(a=>a.rx+a.tx),o=Math.max(1,...r);return t("div",{class:"dl-dbars"},e.map((a,i)=>{let s=t("i",{class:`${r[i]?"":"zero"}${i===e.length-1?" hi":""}`});return s.style.height=`${Math.max(8,r[i]/o*100)}%`,he(s,()=>[t("div",{class:"dl-tip-title"},i===e.length-1?`Today · ${Dt(a.day)}`:Dt(a.day)),t("div",{},X(r[i]))]),s}))}var ua={apply:"Repair",sync:"Reload devices",restart:"Restart service",netrestart:"Restart network",updates:"Open Components"};async function An(n){return n==="netrestart"&&!await se("Restart the network?","Every interface restarts. Connections drop for a few seconds.","Restart network")?null:await G(()=>P.healthFix(n),"Done")??null}function yo(n,e,r,o="action"){let a=n.fix;return a?a.startsWith("install:")?D("Install",()=>la(a.slice(8),r),o):a==="updates"?t("a",{class:`cbi-button cbi-button-${o}`,href:L.url("admin/network/dawnline/updates")},ua.updates):D(ua[a]??"Fix",()=>e(a),o):""}function Us(n){return/^(awg|up_|peers_|fw_|reply_|port_|subnet_)/.test(n)?"shield":/^(portal|cert)/.test(n)?"link":/^(ep_|home_|resolver)/.test(n)?"globe":n==="clock"?"clock":n==="agent"?"activity":n==="flash"?"download":n==="nft"?"lock":n==="data"?"users":"alert"}function ma(n,e,r,o=3){let a=n.filter(s=>s.status==="error"||s.status==="warn").sort((s,l)=>s.status===l.status?0:s.status==="error"?-1:1);if(!a.length)return"";let i=a.length-o;return t("div",{class:"dl-list dl-notices"},[...a.slice(0,o).map(s=>Xe(Us(s.id),s.status==="error"?"bad":"warn",s.problem??s.title,s.detail,yo(s,e,r,s.status==="error"?"positive":"neutral"))),i>0?t("a",{class:"dl-row dl-notices-more",href:L.url("admin/network/dawnline/diagnostics")},[`${i} more in Diagnostics`,t("span",{class:"dl-spacer"}),"→"]):""])}function Gs(n){let e=[],r=(s,l)=>t("a",{href:s},l),o=Ie(n.series),a=!!n.awg_state&&!n.awg_state.ok;for(let s of n.servers)s.enabled&&s.blocked?e.push({tone:"bad",text:[`${s.name} ${s.blocked}. `,r(L.url("admin/network/dawnline/diagnostics"),"Open Diagnostics")]}):s.enabled&&!s.up&&!a&&e.push({tone:"bad",text:[`Tunnel ${s.ifname} is down. `,r(L.url("admin/network/dawnline/diagnostics"),"Open Diagnostics")]});for(let s of n.people)if(s.state==="quota")e.push({tone:"warn",text:[r(ke(s.id),s.name)," reached the data limit."]});else if(s.state==="expired")e.push({tone:"warn",text:[r(ke(s.id),s.name),"’s access has ended."]});else{let l=Ye(s.expires,o);Ze(s,l)?e.push({tone:"",text:[r(ke(s.id),s.name),`’s access ${Xt(l)}.`]}):l!=null&&l<0&&s.expire_action==="notify"&&e.push({tone:"",text:[r(ke(s.id),s.name),`’s end date passed (${Me(s.expires)}) · access kept.`]}),s.quota_limit&&s.quota_used>=s.quota_limit*.9&&e.push({tone:"",text:[r(ke(s.id),s.name)," has used 90% of the data limit."]})}let i=n.people.flatMap(s=>s.devices.filter(l=>l.config_stale).map(l=>[s,l]));i.length&&e.push({tone:"warn",text:i.length===1?[r(ke(i[0][0].id,i[0][1].id),`${i[0][0].name} · ${i[0][1].name}`)," needs its configuration again."]:[`${i.length} devices need their configuration again (networks or DNS changed).`]});for(let s of n.servers)n.wan&&Et(s.endpoint)&&s.endpoint!==n.wan&&e.push({tone:"warn",text:[`Public address changed: ${s.name} still gives devices ${s.endpoint}, the router is ${n.wan} now. `,t("button",{type:"button",class:"dl-fix",click:async l=>{let d=l.currentTarget;d.disabled=!0,await G(()=>P.serverUpdate(s.id,{endpoint:n.wan}),`${s.name} uses ${n.wan} now — devices need their configuration again`),d.disabled=!1}},"Use the new address")," A DDNS name would follow it by itself."]});return n.servers.some(s=>s.lan_like)&&n.like_home.error&&e.push({tone:"warn",text:[`Internet through the LAN is off: ${n.like_home.error} `,r(L.url("admin/network/dawnline/diagnostics"),"Details")]}),!n.settings.portal_enabled&&!n.people.length&&e.push({tone:"",text:["The personal portal is off. ",r(L.url("admin/network/dawnline/settings"),"Turn on")]}),e}var Hn=class{constructor(e,r){this.srvId=e;this.go=r;this.el=t("div",{class:"dl-srvov"});this.map=null;this.mapOn=null;this.range="online";this.parts={};this.healthAt=0}mount(e){this.st=Kt(e,this.srvId);for(let r of["health","bento","map","side","activity"])this.parts[r]=t("div",{});return dom.content(this.el,[this.parts.health,this.parts.bento,this.parts.map,t("div",{class:"dl-grid2"},[this.parts.activity,this.parts.side])]),this.paint(),this.loadHealth(),this.el}update(e,r=!1){this.st=Kt(e,this.srvId),this.paint(r),Date.now()-this.healthAt>6e4&&this.loadHealth()}async loadHealth(){this.healthAt=Date.now();let e=await P.health().catch(()=>null);if(!e)return;let r=()=>void this.loadHealth(),o=async a=>{await An(a)&&(r(),a==="netrestart"&&setTimeout(r,5e3))};Se(this.parts.health,ma(e.checks,a=>void o(a),r),!0)}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now}}paintMap(){let e=this.st.geo.enabled;if(e===this.mapOn&&(!e||this.map)){this.map?.update(this.mapData());return}this.mapOn=e,dom.content(this.parts.map,this.mapCard())}mapCard(){let e=this.st,r=t("div",{class:"dl-panel-head pad"},[t("div",{class:"dl-stack"},[t("h3",{},"Where people connect from"),t("span",{class:"dl-sub"},"City-level, from the client IP · locations cached on the router")]),t("span",{class:"dl-spacer"}),Tt(this.range,l=>{this.range=l,this.map?.setRange(l)})]);if(this.map?.destroy(),this.map=null,!e.geo.enabled)return t("div",{class:"dl-panel flush"},[r,t("div",{class:"dl-map-off"},["Locations are off. ",t("a",{href:L.url("admin/network/dawnline/settings")},"Turn them on in Settings"),"."])]);let o=this.map=new tt({openPerson:l=>location.href=ke(l),openDevice:(l,d)=>location.href=ke(l,d)},this.range),a=$e(()=>{a(),o.destroy(),this.map===o&&(this.map=null)}),i=t("div",{class:"dl-map-legend"},[t("span",{},[t("i",{class:"line live"}),"Live tunnel"]),t("span",{},[t("i",{class:"line"}),"Seen recently"])]),s=t("div",{class:"dl-map-wrap"},[o.el,i]);return requestAnimationFrame(()=>o.mount(this.mapData())),t("div",{class:"dl-panel flush"},[r,s])}paint(e=!1){let r=this.st,o=r.servers[0];this.paintMap(),Se(this.parts.bento,t("div",{class:"dl-bento"},[this.onlineTile(),this.speedTile(),Be(o).overviewTile(o),this.monthTile()]),e);let a=Gs(r);Se(this.parts.side,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Needs attention"),t("span",{class:"dl-spacer"}),t("a",{href:L.url("admin/network/dawnline/diagnostics")},"Health")]),a.length?a.slice(0,8).map(s=>t("div",{class:"dl-attn-item dl-row"},[t("span",{class:`dl-ev-dot ${s.tone}`}),t("span",{},s.text),s.action??""])):t("div",{class:"dl-row dl-muted"},[v("check"),"All good. Nothing needs you right now."])]),e);let i=[...r.events].reverse().slice(0,8);Se(this.parts.activity,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"View all")]),i.length?i.map(s=>it(r,s)):t("div",{class:"dl-row dl-muted"},"Nothing yet. Connections, new devices and pauses appear here.")]),e)}onlineTile(){let e=this.st,r=e.servers[0]?!e.servers[0].enabled:!1,o=12,a=R=>R.spark[R.spark.length-1]??0,i=R=>e.geo.points.find(C=>C.device===R.id&&C.city)?.city,s=R=>/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(R.endpoint??""),l=(R,C=!1)=>s(R)?C&&R.endpoint?`LAN · ${R.endpoint}`:"LAN":i(R)??"",d=R=>[...e.events].reverse().find(C=>C.type==="connect"&&C.device===R.id)?.ts??0,c=e.people.map(R=>({p:R,devs:R.devices.filter(C=>C.online).sort((C,k)=>a(k)-a(C))})).filter(R=>R.devs.length).sort((R,C)=>C.devs.reduce((k,y)=>k+a(y),0)-R.devs.reduce((k,y)=>k+a(y),0)),p=c.length<=2,u=({p:R,devs:C})=>{let k=C.map(d).filter(Boolean),y=k.length?Math.min(...k):0,w=(R.rate??[]).slice(-15),b=w[w.length-1],H=b&&e.now-b[0]<180?b:null,f=200,g=30,M=Math.max(1,...w.map(Z=>Math.max(Z[1],Z[2]))),T=Z=>w.map((I,V)=>`${w.length>1?V/(w.length-1)*f:f},${g-2-I[Z]/M*(g-6)}`),z=w.length>1?yt(``):"",W=!H||H[1]<64&&H[2]<64,q=R.access==="both"?["home","globe"]:R.access==="lan"?["home"]:["globe"];return[t("div",{class:"dl-hc"},[t("div",{class:"dl-hc-head"},[t("span",{class:"dl-onl-av sm"},He(R.name)),t("span",{class:"dl-stack"},[t("b",{},R.name),t("span",{class:"dl-hc-since"},y?`online for ${re(y,e.now).replace(" ago","")}`:"online")]),t("span",{class:"dl-hc-reach"},q.map(Z=>t("span",{class:`dl-ibadge ${Z==="home"?"lan":"inet"}`},v(Z))))]),t("div",{class:"dl-hc-speed"},[t("div",{class:"dl-hc-speed-row"},W?[t("span",{class:"dl-faint"},"Idle right now")]:[t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${Oe(H[2])}`]),t("span",{},[t("span",{class:"dl-up"},"↑"),` ${Oe(H[1])}`]),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint"},"15 min")]),z]),t("div",{class:"dl-hc-devs"},C.map(Z=>t("span",{class:"dl-hc-dev"},[v(Z.kind),Z.name,l(Z)?[" · ",l(Z,!0)]:""]))),t("div",{class:"dl-hc-foot"},[t("span",{class:"dl-faint"},`${X(C.reduce((Z,I)=>Z+a(I),0))} today · ${X(R.month[0]+R.month[1])} this month`)])])]},x=R=>{let{p:C,devs:k}=R,y=t("span",{class:"dl-onl-dev"},k.length>1?String(k.length):v(k[0].kind)),w=t("a",{class:`dl-onl-p${p?"":" sm"}`,href:ke(C.id),"aria-label":`${C.name}, online`},[t("span",{class:"dl-onl-av"},[He(C.name),y]),p?t("span",{class:"dl-onl-name"},C.name):"",p?t("span",{class:"dl-onl-meta"},[...k.slice(0,3).map(b=>v(b.kind)),k.length>3?`+${k.length-3}`:"",l(k[0])?t("span",{},[" · ",l(k[0])]):""]):""]);return he(w,()=>u(R)),w},$=t("b",{class:`dl-onl-count${c.length?"":" none"}`},String(c.length)),h=c.reduce((R,C)=>R+C.devs.length,0);c.length&&he($,()=>[`${c.length} ${c.length===1?"person":"people"} · ${h} device${h===1?"":"s"}`]);let m=c.length>o?c.slice(0,o-1):c,E=e.people.flatMap(R=>R.devices.map(C=>({p:R,d:C}))).filter(R=>R.d.handshake).sort((R,C)=>C.d.handshake-R.d.handshake)[0];return t("div",{class:"dl-bento-tile online"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},"Online"),$]),c.length?t("div",{class:`dl-onl-row${p?"":" grid"}`},[...m.map(x),c.length>o?t("a",{class:"dl-onl-p sm more",href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(this.srvId)}§ion=people&filter=online`,title:"Everyone online",click:R=>{this.go&&(R.preventDefault(),this.go("people","online"))}},[t("span",{class:"dl-onl-av"},`+${c.length-m.length}`)]):""]):t("div",{class:"dl-onl-empty"},[t("span",{},r?"The server is turned off":"Nobody is connected"),E?t("span",{class:"dl-sub"},`Last: ${E.p.name}, ${re(E.d.handshake,e.now)}`):t("span",{class:"dl-sub"},r?"Devices connect once it is on":"No device has connected yet")])])}speedTile(){let e=this.st.servers[0];return Pn(e?.rate??[],this.st.now,this.st.totals.today,e?!e.enabled:!1)}monthTile(){let e=[...this.st.people].map(r=>[r,r.month[0]+r.month[1]]).filter(([,r])=>r>0).sort((r,o)=>o[1]-r[1]).slice(0,2);return Dn(this.st.series,e.length?`Most: ${e.map(([r,o])=>`${r.name} ${X(o)}`).join(" · ")}`:"")}};var ha=[["overview","Overview"],["people","People"],["connection","Connection"],["access","Access"],["awg",""]],Ws={general:"connection",network:"connection",interfaces:"access",advanced:"awg",disguise:"awg",tunnel:"awg",core:"awg"},ko=(n,e)=>{let r=new URLSearchParams;n&&r.set("server",n),e&&e!=="overview"&&r.set("section",e);let o=r.toString();return`${L.url("admin/network/dawnline/server")}${o?`?${o}`:""}`},Yt=class{constructor(){this.noFooter=!0;this.root=t("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=t("div",{});this.headEl=t("div",{});this.secEl=t("div",{});this.bodyEl=t("div",{class:"dl-srvbody"})}async load(){let e=await P.status(31),r=e.servers.length?null:await P.setupDefaults();return[e,r]}render([e,r]){if(this.st=e,!e.servers.length&&r)return this.wizard(r);let o=new URLSearchParams(location.search),a=o.get("section")??"",i=Ws[a]??a;return ha.some(([s])=>s===i)&&(this.section=i),this.srvId=(e.servers.find(s=>s.id===o.get("server"))??e.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),this.poller?.stop(),this.poller=ot({fetch:()=>P.status(31),every:30,live:!0,active:()=>this.section==="overview"&&this.root.isConnected,apply:(s,l)=>{s.servers.length&&(this.st=s,this.paintHead(l),this.ov[this.current().id]?.update(s,l))}}),this.root}paintHead(e=!1){Se(this.headEl,this.head(this.current()),e),(!e||!Pt(this.tabsEl))&&this.paintTabs()}async refreshStatus(){let e=await P.status(31).catch(()=>null);return e?.servers.length?(this.st=e,this.paintHead(),e):null}current(){return this.st.servers.find(e=>e.id===this.srvId)??this.st.servers[0]}async refresh(){let e=await P.status(31).catch(()=>null);e&&(this.st=e,e.servers.length?this.paint():location.href=ko())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let e=this.current();dom.content(this.tabsEl,t("div",{class:"dl-srvtabs",role:"tablist","aria-label":"Servers"},[...this.st.servers.map(r=>t("button",{type:"button",role:"tab",class:`dl-srvtab${r.id===e.id?" on":""}`,"aria-selected":r.id===e.id?"true":"false",click:()=>{r.id!==this.srvId&&(this.srvId=r.id,this.paint())}},[t("i",{class:`dot ${r.enabled?r.up?"ok":"bad":"warn"}`}),t("b",{},r.name)])),t("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[v("plus"),"Add server"])]))}paintSections(){let e=Be(this.current());dom.content(this.secEl,t("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":"Server"},ha.map(([r,o])=>t("button",{type:"button",role:"tab","data-section":r,class:r===this.section?"on":"","aria-selected":r===this.section?"true":"false",click:()=>this.showSection(r)},r==="awg"?e.label:o))))}go(e,r){let o=this.pp[this.current().id];if(r&&o)o.filter=r,o.el&&o.decorate();else if(r){let a=this.pp[this.current().id]=new mt;a.filter=r}this.showSection(e),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let e=[...Object.values(this.ov).map(r=>r.el),...Object.values(this.pp).map(r=>r.el)];for(let r of e)r&&this.bodyEl.contains(r)&&r.remove()}showSection(e){this.section=e,this.secEl.querySelectorAll("[data-section]").forEach(s=>{let l=s.dataset.section===e;s.classList.toggle("on",l),s.setAttribute("aria-selected",l?"true":"false")});let r=this.st,o=this.current(),i={overview:()=>{let s=this.ov[o.id];return s?(s.update(r),s.el):(this.ov[o.id]=new Hn(o.id,(l,d)=>this.go(l,d))).mount(r)},people:()=>{var c,p;let s=this.pp[o.id];if(s?.el)return s.update(),s.el;let l=t("div",{},t("p",{class:"dl-muted"},"Loading people…"));return((c=this.pp)[p=o.id]??(c[p]=new mt)).embed(r,o.id).then(u=>{l.isConnected?dom.content(l,u):l.replaceChildren(u)}).catch(u=>{delete this.pp[o.id],dom.content(l,t("p",{class:"dl-muted"},`Couldn't show people: ${be(u)}`))}),l},connection:()=>this.connection(o),access:()=>this.access(o),awg:()=>this.awg(o)}[e]();this.detachKept(),dom.content(this.bodyEl,i)}head(e){let r=(i,s)=>t("span",{class:"dl-addrbar-seg"},[v(i),...s]),o=e.endpoint||"—",a=t("div",{class:"dl-actions"},[e.enabled?"":D([v("play")," Turn on"],()=>this.save(e,{enabled:"1"},"Server turned on"),"add")]);return t("div",{class:"dl-srvpagehead"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),t("span",{class:`dl-pill ${e.enabled?e.up?"ok":"bad":"warn"}`},e.enabled?e.up?"Running":e.blocked?"Can’t start":"Not running":"Turned off"),t("span",{class:"dl-spacer"}),a]),t("div",{class:"dl-addrbar"},[t("button",{type:"button",class:"dl-addrbar-seg main",title:"Copy address",click:()=>me(o,"Address copied")},[v("globe"),t("span",{class:"dl-mono"},o),v("copy")]),r(Be(e).id==="awg"?"amneziawg":"tunnel",[t("span",{class:"dl-mono"},`${Be(e).label} :${e.port}`)]),e.up?r("clock",[`up ${xt(e.uptime)}`]):""]),e.blocked?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},`${e.name} ${e.blocked}.`)]):""])}async save(e,r,o="Saved"){await G(()=>P.serverUpdate(e.id,r),o)&&await this.refresh()}connection(e){let r=le(e.name,{placeholder:"Home"}),o=le(e.endpoint,{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"}),a=le(e.dns.join(", "),{placeholder:"This router (recommended)",class:"cbi-input-text dl-mono"}),i=this.st.people.filter($=>$.server===e.id).length,s=D([v(e.enabled?"pause":"play"),e.enabled?" Turn off":" Turn on"],async()=>{e.enabled&&!await se(`Turn off ${e.name}?`,`The tunnel stops and ${i} ${i===1?"person is":"people are"} disconnected until you turn it back on. Nothing is deleted.`,"Turn off",!0)||await this.save(e,{enabled:e.enabled?"0":"1"},e.enabled?"Server turned off":"Server turned on")},e.enabled?"negative":"positive"),l=this.st.settings.portal_host,d=ge("Name",r,()=>_e(r.value,[],"Shown to people in their portal and apps.")),c=Xn(()=>({host:o.value,port:e.port,id:e.id}),($,h,m)=>P.endpointProbe($,h,m),()=>p.refresh(),{empty:l?`Empty = the portal’s address (${l}).`:"Empty = the portal’s address."}),p=ge("Public address",o,c.help);o.addEventListener("input",c.schedule),c.schedule();let u=e.reached?`Reached from the internet ${re(e.reached,this.st.now)}.`:"Never reached from the internet yet — test with a phone on mobile data.",x=ge("DNS for devices",a,()=>Yo(a.value,e.address));return t("div",{class:"dl-stack gap16"},[Nt("Connection",[t("p",{class:"dl-muted"},"The name people see, where devices find the router, and DNS. The port is on AmneziaWG."),fe("router","Server","What people see",[d]),fe("globe","Devices connect to","A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)",[p,t("div",{class:`dl-sub ${e.reached?"ok":"warn"}`},u)]),fe("file","For every device","Changing it marks devices “Update config” until they import again",[x])],[t("span"),D("Save",()=>{let $=ze([d,p,x]);if($){U($,"warning");return}return this.save(e,{name:r.value,endpoint:o.value,dns:a.value})},"positive")]),Nt("Danger zone",[t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},e.enabled?"Turn off this server":"This server is off"),t("span",{class:"dl-sub"},e.enabled?"Stops the tunnel and disconnects everyone on it. Settings and people are kept.":"Nobody can connect. Turn it on to bring the tunnel back.")]),t("div",{class:"dl-setrow-ctl"},s)]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},"Change the tunnel network"),t("span",{class:"dl-sub"},`Devices have ${Ct(e.subnet)}.x addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again.`)]),t("div",{class:"dl-setrow-ctl"},D([v("edit")," Change"],()=>this.changeSubnet(e),"negative"))]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},"Remove server"),t("span",{class:"dl-sub"},`Removes the tunnel, its firewall rules and ${i} ${i===1?"person":"people"} with all their devices. A backup is made first.`)]),t("div",{class:"dl-setrow-ctl"},D([v("trash")," Remove"],()=>this.remove(e),"negative"))])],[],"danger")])}access(e){let r=xo(this.st,e),o=da(e,this.st,async()=>{let a=await this.refreshStatus();if(!a)return;let i=a.servers.find(l=>l.id===e.id)??e;o.update(a);let s=xo(a,i);r.replaceWith(s),r=s});return t("div",{class:"dl-stack gap16"},[o.el,t("div",{class:"dl-health-cols"},[r,ta(this.st,e)])])}awg(e){let r={st:this.st,save:(o,a)=>this.save(e,o,a),refresh:()=>this.refresh()};return t("div",{class:"dl-stack gap16"},[Be(e).settingsCard(r,e)])}async addServer(){let e=await G(()=>P.setupDefaults());e&&dom.content(this.root,this.wizard(e,!0,()=>{dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint()}))}async changeSubnet(e){let r=await G(()=>P.serverPorts(e.id));if(!r)return;let o=r.networks??[],a=this.st.people.filter(l=>l.server===e.id).reduce((l,d)=>l+d.devices.length,0),i=le(Ct(e.subnet),{class:"cbi-input-text dl-mono dl-w-range"}),s=ge("Address range",i,()=>Qn(i.value,o,""));oe("Change the tunnel network",[s,t("p",{class:"dl-muted"},a?`${a} device${a===1?" gets a new address and stops":"s get new addresses and stop"} connecting until ${a===1?"it imports its":"they import their"} configuration again (from their personal link or from you).`:"No devices on this server yet: nothing else changes.")],[ie()," ",D("Change",async()=>{let l=s.help();if(l.bad){U(l.text,"warning");return}let d=ln(i.value);if(d===e.subnet){ae();return}await G(()=>P.serverUpdate(e.id,{subnet:d}),"Tunnel network changed")&&(ae(),a&&U("Devices are marked “Update config” until they import again.","info",6e3),await this.refresh())},"negative")]),setTimeout(()=>i.select(),50)}async remove(e){let r=this.st.people.filter(o=>o.server===e.id);oe(`Remove ${e.name}?`,[t("p",{},`This removes the tunnel, its firewall rules and ${r.length} ${r.length===1?"person":"people"} with all their devices. A backup is made first.`)],[ie()," ",D("Remove",async()=>{ae(),await G(()=>P.serverDelete(e.id),"Server removed")&&setTimeout(()=>{location.href=ko()},800)},"negative")])}wizard(e,r=!1,o){let a={id:e.id,name:e.name,endpoint:e.endpoint,port:e.port,range:Ct(e.subnet),preset:fn(e.awg),portal:!1,portal_port:e.portal_port||8443,lan_like:!0,lan_zone:e.lan_zone,wan_zone:e.wan_zone},i=0,s=!r&&a.portal_port===a.port,l=()=>/^\d{1,3}(\.\d{1,3}){3}$/.test(a.endpoint),d=()=>Rt(a.port,e.udp_taken??[],`Opened on the WAN firewall automatically.${a.port===4500?" 4500 is IPsec’s port: most networks let it through.":""}`),c={ddns:"From your DDNS name.",cert:"From your Let’s Encrypt certificate.",wan:"Your WAN address now — it may change; a DDNS name is better.",portal:"The portal’s address."},p=Xn(()=>({host:a.endpoint,port:a.port}),(M,T,z)=>P.endpointProbe(M,"",z),()=>u?.refresh(),{idle:()=>a.endpoint===e.endpoint&&e.endpoint_from?c[e.endpoint_from]??"":""}),u=null,x=e.wan_kind==="cgnat"||e.wan_kind==="private"?Xe("alert","warn",e.wan_kind==="cgnat"?"Your router has no public address (CGNAT)":`Your router is behind another router (WAN ${e.wan_ip})`,e.wan_kind==="cgnat"?"The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address.":"Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here.",""):"",$=e.awg_state?.tools&&e.awg_state.handler===!1?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},"Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started.")]):"",h=()=>Qn(a.range,e.networks??[],Ct(e.subnet)),m=()=>dn(a.portal_port,e.tcp_taken??[],l()),E=t("div",{class:"dl-wizard"}),R=(M,T={})=>{let z=le(String(a[M]),T);return z.addEventListener("input",()=>{M==="port"||M==="portal_port"?a[M]=z.value.trim()===""?0:Number(z.value):a[M]=z.value.trim(),M==="port"&&s&&(a.portal_port=a.port),M==="portal_port"&&(s=a.portal_port===a.port)}),z},C={id:"server",title:"Server",render:()=>t("div",{class:"dl-wizard-groups"},[t("p",{class:"dl-muted"},r?"One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page.":"Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes."),fe("router","Server","What people see",[ge("Name",R("name"),()=>_e(a.name,[],"Shown to people in their portal and apps."))]),fe("globe","Devices connect to","A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT",[(()=>{let M=R("endpoint",{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"});return u=ge("Public address",M,p.help),M.addEventListener("input",p.schedule),p.schedule(),u})()]),x,$]),check:()=>{let M=_e(a.name);if(M.bad)return`Name: ${M.text}`;let T=$t(a.endpoint,a.port);return T.bad?`Public address: ${T.text}`:null}},k={id:"awg",title:"AmneziaWG",render:()=>t("div",{class:"dl-wizard-groups"},[fe("globe","Listening","Where devices reach AmneziaWG from the internet",[ge("UDP port",R("port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),d)]),fe("network","Tunnel network","Addresses devices get inside the tunnel",[(()=>{let M=R("range",{class:"cbi-input-text dl-w-range dl-mono","aria-label":"First three numbers of the device addresses"});return ge("Device addresses",M,h,t("span",{class:"dl-suffixed"},[M,t("span",{class:"dl-mono"},".x")]))})()]),fe("shield","Disguise","So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard",[gn(e.awg,a.preset,M=>a.preset=M,void 0,e.awg_state?.tools!==!1)])]),check:()=>{let M=d();if(M.bad)return`UDP port: ${M.text}`;let T=h();return T.bad?`Device addresses: ${T.text}`:null}},y={id:"portal",title:"Portal",render:()=>{let M=R("portal_port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),T=ge("Listening port",M,m);T.hidden=!a.portal;let z=we([["off","Off"],["on","On"]],a.portal?"on":"off",{label:"Personal portal",onChange:W=>{a.portal=W==="on",T.hidden=!a.portal}});return t("div",{class:"dl-wizard-groups"},[fe("home","Internet like a home device","How devices reach the internet",[ce("Through the home network",ve(a.lan_like,"Internet like a home device",W=>a.lan_like=W),"Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access.")]),fe("link","Personal portal","A page where each person adds their own devices with their personal link",[ce("Portal",z,"Off: only you add devices, from LuCI. On: people manage their devices within the limits you set."),T])])},check:()=>{if(!a.portal)return null;let M=m();return M.bad?`Portal port: ${M.text}`:null}},w=()=>[C,k,r?null:y].filter(M=>M!=null),b=e.awg_state,H=b?.missing??[],f=H.length?t("div",{class:"dl-list dl-notices"},[Xe("shield","bad","AmneziaWG isn’t installed",`The tunnel needs ${H.join(" and ")}. Install the build made for this firmware, then create the server.`,D("Install",()=>Tn(()=>location.reload()),"positive"))]):b&&!b.loaded?t("div",{class:"dl-list dl-notices"},[Xe("shield","warn","AmneziaWG’s kernel module doesn’t load on this firmware","Try another build in Components, or update OpenWrt. The server can’t start until it loads.",t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/updates")},"Open Components"))]):"",g=()=>{let M=w();i>=M.length&&(i=M.length-1),dom.content(E,[t("h2",{},r?"Add a server":"Set up Dawnline"),f,t("div",{class:"dl-steps"},M.map((T,z)=>t("span",{class:`dl-step${z===i?" current":z0?D("Back",()=>{i--,g()}):o?D("Cancel",o):"",t("span",{class:"dl-spacer"}),i{let T=M[i].check?.();if(T){U(T,"warning");return}i++,g()},"positive"):D("Create server",async()=>{for(let z of M){let W=z.check?.();if(W){U(W,"warning");return}}let T=await G(()=>P.serverCreate(a.id,a.name,e.ifname,a.port,ln(a.range),a.endpoint,e.mtu,a.preset,a.lan_zone,a.wan_zone,a.lan_like,r?void 0:a.portal,r?void 0:a.portal_port),"Server created");T&&(T.network_restart&&U("Restarting the network so it knows AmneziaWG: back in a few seconds"),setTimeout(()=>{location.href=ko(T.id)},T.network_restart?1e4:1500))},"positive",{disabled:H.length>0,title:H.length?"Install AmneziaWG first":null})])])};return g(),E}};function st(n){let e={el:n(),refresh(){let r=n();e.el.replaceWith(r),e.el=r}};return e}function Re(n,e,r,o,a="",i=[]){return t("section",{class:`dl-setsec ${a}`,id:`dl-set-${n}`},[t("div",{class:"dl-setsec-body"},[i.length?t("div",{class:"dl-setsec-head"},[t("h3",{},e),t("span",{class:"dl-spacer"}),...i]):t("h3",{},e),...r]),o.length?t("div",{class:"dl-setsec-foot"},o):""])}function fa(n){let e=n.filter(a=>a.status!=="skip"),r=e.filter(a=>a.status==="error"||a.status==="warn"),o=e.some(a=>a.status==="error")?"error":r.length?"warn":"ok";return{bad:r,worst:o}}function ga(n){let e=n.d.settings,r=n.d.effective,o=n.d.cert,a=ve(r.portal_enabled,"Enable portal"),i=le(e.portal_port,{placeholder:"8443",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),s=le(e.portal_redirect,{placeholder:"Show “Not found”",class:"cbi-input-text dl-mono"}),l=le("",{placeholder:"vpn.example.com or an IP","aria-label":"Other address"}),d=B=>/^\d{1,3}(\.\d{1,3}){3}$/.test(B),c=[r.portal_host,...r.portal_alt??[]].filter((B,F,ne)=>B&&ne.indexOf(B)===F),p=!!n.portal,u=[],x=B=>{B&&!u.some(F=>F.host===B)&&u.push({host:B,kind:d(B)?"ip":"name",ips:[],here:!1,cloudflare:!1,cert:!1})},$=B=>{u=[...B,...u.filter(F=>!B.some(ne=>ne.host===F.host))],!c.length&&B[0]&&(c=[B[0].host])};n.portal&&$(n.portal.candidates),c.forEach(x);let h=B=>B.kind==="ip"?t("span",{class:"dl-addr-warn"},[v("alert"),"Plain HTTP: the link and VPN keys travel unencrypted"]):t("span",{class:"dl-sub"},B.cloudflare?"Behind Cloudflare · often stalls in Russia":B.ips.length?B.here?`Points at this router${B.cert?" · Let’s Encrypt certificate":" · no certificate yet"}`:`Points at ${B.ips.join(", ")}, not this router`:p?"Your address":"Checking where it points…"),m=t("div",{class:"dl-addr-opts",role:"group","aria-label":"Portal addresses"}),E=B=>{c.includes(B)?c.length>1&&(c=c.filter(F=>F!==B)):c=[...c,B],R(),y()},R=()=>dom.content(m,[...u.map(B=>{let F=c.includes(B.host),ne=c[0]===B.host;return t("div",{class:`dl-addr-opt${F?" on":""}`,role:"checkbox","aria-checked":F?"true":"false",tabindex:"0",click:()=>E(B.host),keydown:pe=>{(pe.key===" "||pe.key==="Enter")&&(pe.preventDefault(),E(B.host))}},[t("i",{class:"dl-addr-check"},F?v("check"):""),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono"},B.host),h(B)]),ne?t("span",{class:"dl-pill info"},"Main"):F?t("button",{type:"button",class:"dl-linkbtn",click:pe=>{pe.stopPropagation(),c=[B.host,...c.filter(A=>A!==B.host)],R(),y()}},"Make main"):B.cloudflare?t("span",{class:"dl-pill warn"},"Cloudflare"):B.kind==="ip"?t("span",{class:"dl-pill"},"IP"):B.here&&B.cert?t("span",{class:"dl-pill ok"},"Recommended"):""])}),t("div",{class:"dl-addr-opt other"},[t("i",{class:"dl-addr-check"},v("plus")),l,D("Add",()=>{let B=l.value.trim().toLowerCase();if(!B)return;let F=$t(B);if(F.bad){U(F.text,"warning");return}x(B),c.includes(B)||(c=[...c,B]),l.value="",R(),y()})])]);l.addEventListener("keydown",B=>{B.key==="Enter"&&(B.preventDefault(),l.nextElementSibling?.click())});let C=t("div",{class:"dl-links"}),k=()=>{},y=()=>{k();let B=Number(i.value)||r.portal_port;dom.content(C,c.map((F,ne)=>{let pe=d(F),A=pe?B+1:B,N=`${pe?"http":"https"}://${F}${A===(pe?80:443)?"":`:${A}`}/`;return t("div",{class:"dl-link-row"},[t("span",{class:`dl-link-ic ${pe?"warn":"ok"}`},v(pe?"alert":"lock")),t("span",{class:"dl-mono dl-link-url"},[N,t("b",{},"kamiro-telosu-bavine")]),ne===0?t("span",{class:"dl-pill info"},"Main"):pe?t("span",{class:"dl-pill warn"},"HTTP"):""])}))};R(),y(),i.addEventListener("input",()=>y());let w={portal:"Portal running",portal_dns:"Points here",portal_reply:"Answers reach visitors",portal_http:"Plain HTTP",cert:"Certificate"},b=n.d.needs??{https:[],acme:[],home:[]},H=B=>{if(!r.portal_enabled)return t("div",{hidden:!0});if(!B)return fe("check","Ready to share","The portal’s checks from Health",[t("p",{class:"dl-muted dl-loading"},"Running checks…")]);let F=B.filter(S=>S.status!=="skip");if(!F.length)return t("div",{hidden:!0});let{bad:ne,worst:pe}=fa(B),A=t("div",{class:"dl-ready-details",hidden:!0},F.map(S=>t("div",{class:`dl-ready-item ${S.status}`},[v(S.status==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("span",{},S.title),t("span",{class:"dl-sub"},S.detail)])]))),N=t("div",{class:"dl-stack gap8"},[t("div",{class:`dl-ready-sum ${pe}`},[v(pe==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("b",{},pe==="ok"?`All ${F.length} checks passed`:`${F.length-ne.length} of ${F.length} checks passed`),ne.length?t("span",{class:"dl-sub"},ne.map(S=>S.detail).join(" ")):t("span",{class:"dl-sub"},"Links will open for the people you send them to.")]),t("button",{type:"button",class:"dl-linkbtn",click:S=>{A.hidden=!A.hidden,S.currentTarget.textContent=A.hidden?"Details":"Hide"}},"Details")]),t("div",{class:"dl-chips-row"},F.map(S=>t("span",{class:`dl-check-chip ${S.status}`,title:S.detail},[v(S.status==="ok"?"check":"alert"),w[S.id]??S.title]))),A]);return fe("check","Ready to share","The portal’s checks from Health",[N])},f=B=>{if(!r.portal_enabled||!B&&!b.https.length)return t("span",{hidden:!0});if(b.https.length)return t("span",{class:"dl-pill bad"},"Can’t start");let{worst:F}=fa(B);return t("span",{class:`dl-pill ${F==="ok"?"ok":F==="error"?"bad":"warn"}`},F==="error"?"Needs attention":"Ready")},g=H(n.portal?.checks??null),M=f(n.portal?.checks??null);n.portalFill=B=>{p=!0,$(B.candidates),R(),y();let F=H(B.checks);g.replaceWith(F),g=F;let ne=f(B.checks);M.replaceWith(ne),M=ne};let T=o&&!o.self_signed&&o.expires?Ue(o.expires):"",z=ge("Listening port",i,()=>dn(i.value.trim()===""?r.portal_port:Number(i.value),n.d.tcp_taken??[],c.some(d)));k=z.refresh;let W=ge("Unknown links",s,()=>nr(s.value)),q=!!(e.portal_cert&&e.portal_key),Z=o?q?"Your files":o.self_signed?"Self-signed":"Let’s Encrypt":"Portal is off",I=()=>{let B=le(e.portal_cert,{placeholder:"/etc/ssl/…/fullchain.crt"}),F=le(e.portal_key,{placeholder:"/etc/ssl/…/key"});oe("Use your own certificate",[t("p",{class:"dl-muted"},"Paths on the router. Leave both empty to pick a certificate automatically."),ce("Certificate file",B),ce("Key file",F)],[ie()," ",D("Save",()=>{ae(),n.save({portal_cert:B.value.trim(),portal_key:F.value.trim()},"Certificate saved","portal")},"positive")])},V=(B,F,ne,pe,A,N)=>Xe(B,F,ne,pe,D(N,()=>Jt(A,b[A],()=>n.reload("portal")),"positive")),Q=b.https.length?V("lock","bad","HTTPS isn’t available on this router",`The portal needs ${b.https.join(" and ")}. It can’t start without them.`,"https","Install"):"",de=b.acme.length&&(!o||o.self_signed)?V("lock","","Free certificate from Let’s Encrypt",`ACME isn’t installed. With it the router gets a certificate${e.portal_host?` for ${e.portal_host}`:""} and browsers stop warning.`,"acme","Install ACME"):"",ee=[t("div",{class:"dl-row"},[v("lock"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},[Z,T?t("span",{class:"dl-faint"},` · until ${T}`):""]),t("span",{class:"dl-sub dl-ellipsis",title:o?.path??""},o?o.self_signed?"Made by the router: browsers warn until a certificate covers the address.":`${q?"Your files":"Found automatically"} · ${o.path}`:"Turn the portal on to see its certificate.")])]),t("div",{class:"dl-row"},[v("file"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},"Your own files"),t("span",{class:"dl-sub"},q?`${e.portal_cert} · ${e.portal_key}`:"Not set: the certificate is picked automatically.")]),q?D("Reset",()=>n.save({portal_cert:"",portal_key:""},"Automatic certificate","portal"),"negative"):"",D(q?"Change":"Use files",I)]),de];return Re("portal","Personal portal",[t("span",{class:"dl-muted"},"A page where each person adds and manages their devices with their personal link."),Q?t("div",{class:"dl-list"},[Q]):"",fe("network","Port","How the portal listens (80 and 443 stay free)",[z]),fe("edit","Appearance","What people see",[W]),fe("link","Addresses","Pick one or more; the first is the main link",[m,t("div",{class:"dl-stack gap8"},[C,t("span",{class:"dl-sub"},"Example code; each person gets their own three words.")])]),fe("lock","Certificate","Used for HTTPS links",ee),g],[t("span"),D("Save",()=>{let B=ze([z,W]);if(B){U(B,"warning");return}return n.save({portal_enabled:Pe(a)?"1":"0",portal_host:c[0]??"",portal_alt:c.slice(1),portal_port:i.value,portal_redirect:s.value.trim()},"Saved","portal")},"positive")],"",[M,a])}function va(n){let e=n.d.settings,r=n.d.effective,o=le(e.default_device_limit,{placeholder:"3",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),a=ve(r.hostnames,"Device hostnames"),i=le(e.domain,{placeholder:"lan",class:"cbi-input-text dl-w-port"}),s=le(e.home_dns_fallback==="none"?"":e.home_dns_fallback||r.home_dns_fallback||"",{placeholder:"None",inputmode:"decimal",class:"cbi-input-text dl-w-ip dl-mono"}),l=ge("Devices per person",o,()=>{if(!o.value.trim())return{text:"The default, 3. Pre-filled when you add someone.",bad:!1};let p=cn(o.value);return p.bad?p:{text:"Pre-filled when you add someone.",bad:!1}}),d=ge("Device hostnames",i,()=>or(i.value),t("div",{class:"dl-hostport"},[a,t("span",{class:"dl-faint dl-mono"},"phone.myata."),i])),c=ge("Fallback DNS",s,()=>{let p=rr(s.value);return p.bad?p:{text:`For Home-only devices using home names: ${p.text}`,bad:!1}});return Re("defaults","New people",[l,d,c],[t("span"),D("Save",()=>{let p=ze([l,d,c]);if(p){U(p,"warning");return}return n.save({default_device_limit:o.value,hostnames:Pe(a)?"1":"0",domain:i.value,home_dns_fallback:s.value},"Saved","defaults")},"positive")])}function ba(n){let e=n.d.effective,r=ve(e.geo_enabled,"Locations"),o=t("select",{class:"cbi-input-select"},[t("option",{value:"ipwho.is",selected:e.geo_provider!=="ipapi.co"?"selected":null},"ipwho.is (fallback: ipapi.co)"),t("option",{value:"ipapi.co",selected:e.geo_provider==="ipapi.co"?"selected":null},"ipapi.co (fallback: ipwho.is)")]);return Re("map","Map & locations",[t("div",{class:"dl-setrow head"},[t("span",{class:"dl-muted"},"Show where people connect from on the Overview and person pages, at city level."),r]),ce("Provider",o)],[t("span",{class:"dl-sub"},"The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map."),D("Save",()=>n.save({geo_enabled:Pe(r)?"1":"0",geo_provider:o.value},"Saved","map"),"positive")])}var Fs=[["app","Dawnline"],["amneziawg","AmneziaWG"],["packages","System packages"]];function xa(n){let e=n.d.effective.updates,r=ve(e.check,"Check automatically",h=>$(h,Pe(a))),o=we([["6h","Every 6 h"],["12h","Every 12 h"],["1d","Daily"],["7d","Weekly"]],e.interval,{label:"How often",cls:"sm"}),a=ve(e.auto,"Install automatically",h=>$(Pe(r),h)),i=le(e.time,{placeholder:"04:00",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono","aria-label":"Time"}),s=we([["scheduled","At a set time"],["immediate","As soon as found"]],e.mode,{label:"When",cls:"sm",onChange:h=>i.hidden=h!=="scheduled"});i.hidden=e.mode!=="scheduled";let l=new Set(e.targets),d=t("div",{class:"dl-chips-row"},Fs.map(([h,m])=>{let E=qe(m,l.has(h),()=>{l.delete(h)||l.add(h),hn(E,l.has(h))});return E})),c=ve(e.keep,"Keep the previous version"),p=ve(e.mirrors,"GitHub mirrors"),u=ce("How often",o),x=[ce("When",t("div",{class:"dl-hostport"},[s,i]),"A set time keeps tunnel restarts out of the evening; the run happens within an hour of it."),ce("Components",d,"AmneziaWG is off by default: a new kernel module restarts every tunnel.")],$=(h,m)=>{u.hidden=!h;for(let E of x)E.hidden=!m};return $(e.check,e.auto),Re("updates","Updates",[t("span",{class:"dl-muted"},"How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first."),ce("Check automatically",r,"Looks for new versions in the background; Components shows what it found and the service log names it."),u,ce("Install automatically",a,"Downloads and installs new versions of the components below."),...x,ce("Keep the previous version",c,"Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB."),ce("GitHub mirrors",p,"When GitHub is unreachable, download through mirrors. Checksums are still verified.")],[t("span",{class:"dl-sub"},"Run a check or an update by hand in Components."),D("Save",()=>{if(s.dataset.value==="scheduled"){let h=ar(i.value);if(h.bad){U(`Time: ${h.text}`,"warning");return}}return n.save({update_check:Pe(r)?"1":"0",update_interval:o.dataset.value,update_auto:Pe(a)?"1":"0",update_mode:s.dataset.value,update_time:i.value.trim(),update_targets:[...l],update_keep:Pe(c)?"1":"0",update_mirrors:Pe(p)?"1":"0"},"Saved","updates")},"positive")])}function wa(n){let e=n.d.logs,r=e.policy,o=we([["7","7 days"],["30","30 days"],["90","90 days"],["365","1 year"],["0","No limit"]],String(r.keep_days),{label:"Keep activity",cls:"sm"}),a=we([["500","500"],["2000","2,000"],["5000","5,000"],["20000","20,000"]],String(r.max),{label:"Maximum events",cls:"sm"}),i=we([["10min","Every 10 min"],["hourly","Hourly"],["off","Memory only"]],r.persist,{label:"Save to flash",cls:"sm"}),s=we([["31","1 month"],["62","2 months"],["180","6 months"],["365","1 year"],["730","2 years"]],String(r.usage_days),{label:"Daily traffic",cls:"sm"}),l=we([["12","1 year"],["24","2 years"],["60","5 years"],["120","10 years"]],String(r.usage_months),{label:"Monthly traffic",cls:"sm"}),d=new Set(r.categories),c=t("div",{class:"dl-chips-row"},Lt.map($=>{let h=qe([ut[$],t("b",{},String(e.by_category[$]??0))],d.has($),()=>{d.delete($)||d.add($),hn(h,d.has($))},{title:ir[$]});return h})),p=e.oldest?Ue(new Date(e.oldest*1e3)):"",u=($,h,m,E)=>t("div",{class:"dl-row"},[v($),t("span",{class:"dl-row-main dl-stack"},[t("b",{},h),t("span",{class:"dl-sub"},m)]),...E]),x=$=>D($.toUpperCase(),async()=>{let[h,m]=await Promise.all([P.status(1),P.events(2e4)]);Fe(h,m.events,$)},"neutral",{title:`Download the log as ${$.toUpperCase()}`});return Re("logs","Logs & history",[t("p",{class:"dl-muted"},mn(r)),ce("Keep activity",o,"Older events are removed automatically."),ce("Maximum size",a,"Newest events are kept when the log is full."),ce("Record",c,"Switched-off categories are not logged from now on."),ce("Save to flash",i,"The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot."),ce("Daily traffic",s,"Per-day history behind the charts."),ce("Monthly traffic",l,"Per-month totals; data limits use the current month."),t("h4",{class:"dl-setsub"},"Stored data"),t("div",{class:"dl-list"},[u("activity","Activity log",e.events?`${en(e.events,"event")} since ${p} · ${zt(e.log_ram)} in memory${r.persist==="off"?"":`, ${zt(e.log_flash)} on flash`}`:"Empty",[x("csv"),x("json"),D("Clear",()=>et("Clear activity","Removes events from the log on the router.",{},()=>n.reload("logs")),"negative")]),u("chart","Traffic history",e.usage_days?`${en(e.usage_days,"day")} since ${Ue(e.usage_since)} · ${zt(e.usage_flash)} on flash`:"Empty",[D("Reset",()=>Mt("all","","",()=>setTimeout(()=>n.reload("logs"),300)),"negative")]),u("pin","Location cache",`${en(n.d.geo_cached,"address","addresses")} · ${zt(e.geo_flash)} on flash`,[D("Clear",async()=>{await G(()=>P.geoClear(),"Location cache cleared")&&await n.reload("logs")},"negative")])])],[t("span",{class:"dl-sub"},"Clear one person or device from their own page."),D("Save",()=>n.save({log_keep_days:o.dataset.value,log_max:a.dataset.value,log_persist:i.dataset.value,usage_keep_days:s.dataset.value,usage_keep_months:l.dataset.value,log_category:[...d]},"Saved","logs"),"positive")])}var qs={manual:"Manual",auto:"Nightly","pre-restore":"Before restore","pre-import":"Before import","pre-delete":"Before removing a server","pre-update":"Before update"},ya=3;function $o(n){let e=new Date(n*1e3),r=e.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),o=Math.round((new Date(new Date().toDateString()).getTime()-new Date(e.toDateString()).getTime())/864e5);return`${o===0?"Today":o===1?"Yesterday":e.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}, ${r}`}async function Ks(n){let e=await G(()=>P.backupRead(n.name));if(!e)return;let r=atob(e.data),o=new Uint8Array(r.length);for(let i=0;iKs(n),"neutral","dl-icon-only"),Le("more","More",r=>Ce(r.currentTarget,[{label:"Restore",icon:v("reset"),run:async()=>{await se("Restore this backup?",`Everything returns to ${$o(n.created)}. The current state is backed up first.`,"Restore",!0)&&await G(()=>P.backupRestore(n.name),"Restored")&&e(!0)}},{label:"Delete",icon:v("trash"),danger:!0,run:async()=>{await se("Delete this backup?",`The backup from ${$o(n.created)} is removed from the router.`,"Delete",!0)&&await G(()=>P.backupDelete(n.name),"Backup deleted")&&e()}}]),"neutral","dl-icon-only")])])}function $a(n,e){let r=n.slice(0,ya).map(d=>ka(d,e)),o=n.slice(ya),a=n.length?t("div",{class:"dl-list"},[...r,o.length?t("details",{class:"dl-bk-older"},[t("summary",{},[v("chevron"),`${o.length} older backup${o.length===1?"":"s"}`]),...o.map(d=>ka(d,e))]):""]):t("div",{class:"dl-list"},[t("div",{class:"dl-row dl-muted"},"No backups yet.")]),i=D("Restore from file",async()=>{let d=await qn(".tar.gz,.tgz,application/gzip","base64");if(!d)return;await se("Restore from file?",`Replace the current Dawnline configuration with ${d.name}? The current state is backed up first.`,"Restore",!0)&&await G(()=>P.backupUpload(d.data),"Restored")&&e(!0)}),s=D("Export JSON",async()=>{let d=await G(()=>P.exportJson());d&&Te(`dawnline-export-${new Date().toISOString().slice(0,10)}.json`,JSON.stringify(d,null,2),"application/json")}),l=D("Import JSON",async()=>{let d=await qn(".json,application/json","text");if(!d)return;let c;try{c=JSON.parse(d.data)}catch{U("Not a JSON file.","error");return}await se("Import?","This replaces the whole Dawnline configuration on this router. The current state is backed up first.","Import",!0)&&await G(()=>P.importJson(c),"Imported")&&e(!0)});return t("section",{class:"dl-setsec",id:"dl-set-backups"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-setsec-head"},[t("div",{class:"dl-stack"},[t("h3",{},"Backups"),t("span",{class:"dl-sub"},"Nightly when something changed, and before every restore, import or update. The last 10 are kept.")]),t("span",{class:"dl-spacer"}),D([v("plus")," Back up now"],async()=>{await G(()=>P.backupCreate(),"Backup created")&&e()},"positive")]),a]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},"Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router."),t("span",{class:"dl-row-actions dl-bk-actions"},[i,s,l])])])}function Vs(){let n=le("",{placeholder:"remove"}),e=D("Remove Dawnline",async()=>{await G(()=>P.uninstall(n.value.trim()),"Dawnline removed")&&(ae(),setTimeout(()=>location.reload(),800))},"negative",{disabled:!0});n.addEventListener("input",()=>{e.disabled=n.value.trim()!=="remove"}),oe("Remove Dawnline?",[t("p",{},"Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “remove” to confirm."),n],[ie()," ",e])}function Ca(){return Re("danger","Remove Dawnline from this router",[t("p",{class:"dl-muted"},"Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup.")],[t("span"),D("Remove",()=>Vs(),"negative")],"danger")}var zn=class{constructor(){this.root=t("div",{class:"dl-settings-main"});this.backups=[];this.portal=null;this.portalSeq=0;this.cards={}}load(){return P.settingsGet()}render(e){this.d=e,this.cards={portal:st(()=>ga(this)),defaults:st(()=>va(this)),map:st(()=>ba(this)),updates:st(()=>xa(this)),logs:st(()=>wa(this)),backups:st(()=>$a(this.backups,a=>this.loadBackups(a))),danger:st(()=>Ca())};let r=["portal","defaults","map","updates","logs","backups","danger"];dom.content(this.root,r.map(a=>this.cards[a].el)),this.loadBackups().then(()=>{new URLSearchParams(location.search).get("section")==="backups"&&document.getElementById("dl-set-backups")?.scrollIntoView({block:"start"})}),this.loadPortal();let o=new URLSearchParams(location.search).get("section");return o&&o!=="backups"&&requestAnimationFrame(()=>document.getElementById(`dl-set-${o}`)?.scrollIntoView({block:"start"})),t("div",{},[t("div",{class:"dl-pagehead"},[t("h2",{class:"dl-h1"},"Settings")]),this.root])}async save(e,r,o){let a=await G(()=>P.settingsUpdate(e),r);a&&(this.d=a,this.cards[o].refresh(),o==="portal"&&this.loadPortal())}async loadPortal(){let e=++this.portalSeq,r=await P.portalInfo().catch(()=>null);e===this.portalSeq&&(this.portal=r??this.portal??{candidates:[],checks:[]},this.portalFill?.(this.portal))}async loadBackups(e=!1){e&&await this.reload();let r=await P.backupList().catch(()=>null);r&&(this.backups=r.backups,this.cards.backups?.refresh())}async reload(e){let r=await P.settingsGet().catch(()=>null);if(r){if(this.d=r,e)this.cards[e].refresh();else for(let o of Object.values(this.cards))o.refresh();(!e||e==="portal")&&this.loadPortal()}}};function Ea(n,e=!1){return n&&(e?/^https?:\/\//i:/^https:\/\//i).test(n)?n:null}function La(n){let e=[],r=l=>{let d=[],c=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\((https?:\/\/[^)\s]+)\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g,p=0;for(let u;u=c.exec(l);)u.index>p&&d.push(l.slice(p,u.index)),u[1]?d.push(t("code",{},u[1].slice(1,-1))):u[2]?d.push(t("b",{},u[2].slice(2,-2))):u[3]?d.push(t("a",{href:u[4],target:"_blank",rel:"noopener"},u[3].replace(/^\[|\]\(.*$/g,""))):u[5]&&d.push(t("a",{href:u[5],target:"_blank",rel:"noopener"},u[5].replace(/^https?:\/\/(github\.com\/)?/,""))),p=u.index+u[0].length;return p{a.length&&e.push(t("p",{},r(a.join(" ")))),a=[],o=null};for(let l of n.replace(/\r/g,"").split(` -`)){let d=l.trimEnd();if(i){/^```/.test(d.trim())?(e.push(t("pre",{},i.join(` -`))),i=null):i.push(l);continue}if(/^```/.test(d.trim())){s(),i=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(s(),e.push(t("h5",{},r(c[2])))):p?(a.length&&s(),o||(o=t("ul",{}),e.push(o)),o.appendChild(t("li",{},r(p[1])))):d.trim()?(o&&(o=null),a.push(d.trim())):s()}return i&&e.push(t("pre",{},i.join(` -`))),s(),e}function Ma(n){let e=[],r=!1;for(let o of n.replace(/\r/g,"").split(` -`)){let a=/^#{1,6}\s+(.*)$/.exec(o);if(a){if(r=/^install\b/i.test(a[1].trim()),/^what.s new$/i.test(a[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(o)&&(r=!1);r||e.push(o)}return e.join(` +var Ha=Object.create;var Go=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Oa=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ja=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ra(e))!Ba.call(n,r)&&r!==o&&Go(n,r,{get:()=>e[r],enumerable:!(s=za(e,r))||s.enumerable});return n};var Ua=(n,e,o)=>(o=n!=null?Ha(Ia(n)):{},ja(e||!n||!n.__esModule?Go(o,"default",{value:n,enumerable:!0}):o,n));var os=Oa((ts,ns)=>{"use strict";var es=(function(){var n=function(S,$){var b=236,C=17,w=S,z=o[$],y=null,f=0,x=null,T=[],I={},Y=function(R,O){f=w*4+17,y=(function(P){for(var U=new Array(P),D=0;D=7&&ne(R),x==null&&(x=V(w,z,T)),se(x,O)},J=function(R,O){for(var P=-1;P<=7;P+=1)if(!(R+P<=-1||f<=R+P))for(var U=-1;U<=7;U+=1)O+U<=-1||f<=O+U||(0<=P&&P<=6&&(U==0||U==6)||0<=U&&U<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=U&&U<=4?y[R+P][O+U]=!0:y[R+P][O+U]=!1)},te=function(){for(var R=0,O=0,P=0;P<8;P+=1){Y(!0,P);var U=r.getLostPoint(I);(P==0||R>U)&&(R=U,O=P)}return O},B=function(){for(var R=8;R>P&1)==1;y[Math.floor(P/3)][P%3+f-8-3]=U}for(var P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;y[P%3+f-8-3][Math.floor(P/3)]=U}},fe=function(R,O){for(var P=z<<3|O,U=r.getBCHTypeInfo(P),D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<6?y[D][8]=G:D<8?y[D+1][8]=G:y[f-15+D][8]=G}for(var D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<8?y[8][f-D-1]=G:D<9?y[8][15-D-1+1]=G:y[8][15-D-1]=G}y[f-8][8]=!R},se=function(R,O){for(var P=-1,U=f-1,D=7,G=0,ee=r.getMaskFunction(O),X=f-1;X>0;X-=2)for(X==6&&(X-=1);;){for(var be=0;be<2;be+=1)if(y[U][X-be]==null){var Le=!1;G>>D&1)==1);var re=ee(U,X-be);re&&(Le=!Le),y[U][X-be]=Le,D-=1,D==-1&&(G+=1,D=7)}if(U+=P,U<0||f<=U){U-=P,P=-P;break}}},j=function(R,O){for(var P=0,U=0,D=0,G=new Array(O.length),ee=new Array(O.length),X=0;X=0?jo.getAt(Uo):0}}for(var Wo=0,re=0;reX*8)throw"code length overflow. ("+D.getLengthInBits()+">"+X*8+")";for(D.getLengthInBits()+4<=X*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=X*8||(D.put(b,8),D.getLengthInBits()>=X*8));)D.put(C,8);return j(D,U)};I.addData=function(R,O){O=O||"Byte";var P=null;switch(O){case"Numeric":P=c(R);break;case"Alphanumeric":P=p(R);break;case"Byte":P=u(R);break;case"Kanji":P=k(R);break;default:throw"mode:"+O}T.push(P),x=null},I.isDark=function(R,O){if(R<0||f<=R||O<0||f<=O)throw R+","+O;return y[R][O]},I.getModuleCount=function(){return f},I.make=function(){if(w<1){for(var R=1;R<40;R++){for(var O=l.getRSBlocks(R,z),P=d(),U=0;U"u"?R*4:O;var P="";P+='";for(var D=0;D';P+=""}return P+="",P+="
",P},I.createSvgTag=function(R,O,P,U){var D={};typeof arguments[0]=="object"&&(D=arguments[0],R=D.cellSize,O=D.margin,P=D.alt,U=D.title),R=R||2,O=typeof O>"u"?R*4:O,P=typeof P=="string"?{text:P}:P||{},P.text=P.text||null,P.id=P.text?P.id||"qrcode-description":null,U=typeof U=="string"?{text:U}:U||{},U.text=U.text||null,U.id=U.text?U.id||"qrcode-title":null;var G=I.getModuleCount()*R+O*2,ee,X,be,Le,re="",Ie;for(Ie="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",re+=''+le(U.text)+"":"",re+=P.text?''+le(P.text)+"":"",re+='',re+='"u"?R*4:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O;return H(P,P,function(G,ee){if(U<=G&&G"u"?R*4:O;var U=I.getModuleCount()*R+O*2,D="";return D+="",D};var le=function(R){for(var O="",P=0;P":O+=">";break;case"&":O+="&";break;case'"':O+=""";break;default:O+=U;break}}return O},ve=function(R){var O=1;R=typeof R>"u"?O*2:R;var P=I.getModuleCount()*O+R*2,U=R,D=P-R,G,ee,X,be,Le,re={"██":"█","█ ":"▀"," █":"▄"," ":" "},Ie={"██":"▀","█ ":"▀"," █":" "," ":" "},Be="";for(G=0;G=D?Ie[Le]:re[Le];Be+=` +`}return P%2&&R>0?Be.substring(0,Be.length-P-1)+Array(P+1).join("▀"):Be.substring(0,Be.length-1)};return I.createASCII=function(R,O){if(R=R||1,R<2)return ve(O);R-=1,O=typeof O>"u"?R*2:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O,G,ee,X,be,Le=Array(R+1).join("██"),re=Array(R+1).join(" "),Ie="",Be="";for(G=0;G>>8),z.push(x&255)):z.push(C)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var S=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],$=1335,b=7973,C=21522,w={},z=function(y){for(var f=0;y!=0;)f+=1,y>>>=1;return f};return w.getBCHTypeInfo=function(y){for(var f=y<<10;z(f)-z($)>=0;)f^=$<=0;)f^=b<5&&(x+=3+Y-5)}for(var T=0;T=256;)w-=255;return S[w]},C})();function i(S,$){if(typeof S.length>"u")throw S.length+"/"+$;var b=(function(){for(var w=0;w"u")throw"bad rs block @ typeNumber:"+w+"/errorCorrectionLevel:"+z;for(var f=y.length/3,x=[],T=0;T>>7-C%8&1)==1},b.put=function(C,w){for(var z=0;z>>w-z-1&1)==1)},b.getLengthInBits=function(){return $},b.putBit=function(C){var w=Math.floor($/8);S.length<=w&&S.push(0),C&&(S[w]|=128>>>$%8),$+=1},b},c=function(S){var $=e.MODE_NUMBER,b=S,C={};C.getMode=function(){return $},C.getLength=function(y){return b.length},C.write=function(y){for(var f=b,x=0;x+2>>8&255)*192+(T&255),y.put(T,13),x+=2}if(x>>8)},$.writeBytes=function(b,C,w){C=C||0,w=w||b.length;for(var z=0;z0&&(b+=","),b+=S[C];return b+="]",b},$},g=function(){var S=0,$=0,b=0,C="",w={},z=function(f){C+=String.fromCharCode(y(f&63))},y=function(f){if(!(f<0)){if(f<26)return 65+f;if(f<52)return 97+(f-26);if(f<62)return 48+(f-52);if(f==62)return 43;if(f==63)return 47}throw"n:"+f};return w.writeByte=function(f){for(S=S<<8|f&255,$+=8,b+=1;$>=6;)z(S>>>$-6),$-=6},w.flush=function(){if($>0&&(z(S<<6-$),S=0,$=0),b%3!=0)for(var f=3-b%3,x=0;x=$.length){if(w==0)return-1;throw"unexpected end of file./"+w}var f=$.charAt(b);if(b+=1,f=="=")return w=0,-1;if(f.match(/^\s$/))continue;C=C<<6|y(f.charCodeAt(0)),w+=6}var x=C>>>w-8&255;return w-=8,x};var y=function(f){if(65<=f&&f<=90)return f-65;if(97<=f&&f<=122)return f-97+26;if(48<=f&&f<=57)return f-48+52;if(f==43)return 62;if(f==47)return 63;throw"c:"+f};return z},E=function(S,$){var b=S,C=$,w=new Array(S*$),z={};z.setPixel=function(T,I,Y){w[I*b+T]=Y},z.write=function(T){T.writeString("GIF87a"),T.writeShort(b),T.writeShort(C),T.writeByte(128),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(255),T.writeByte(255),T.writeByte(255),T.writeString(","),T.writeShort(0),T.writeShort(0),T.writeShort(b),T.writeShort(C),T.writeByte(0);var I=2,Y=f(I);T.writeByte(I);for(var J=0;Y.length-J>255;)T.writeByte(255),T.writeBytes(Y,J,255),J+=255;T.writeByte(Y.length-J),T.writeBytes(Y,J,Y.length-J),T.writeByte(0),T.writeString(";")};var y=function(T){var I=T,Y=0,J=0,te={};return te.write=function(B,Q){if(B>>>Q)throw"length over";for(;Y+Q>=8;)I.writeByte(255&(B<>>=8-Y,J=0,Y=0;J=B<0&&I.writeByte(J)},te},f=function(T){for(var I=1<>6,128|a&63):a<55296||a>=57344?s.push(224|a>>12,128|a>>6&63,128|a&63):(r++,a=65536+((a&1023)<<10|o.charCodeAt(r)&1023),s.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}return s}return e(n)}})();(function(n){typeof define=="function"&&define.amd?define([],n):typeof ts=="object"&&(ns.exports=n())})(function(){return es})});function Jn(n,e){return n==null||n===!1||n===""||(Array.isArray(n)?n.forEach(o=>Jn(o,e)):e.push(n instanceof Node?n:String(n))),e}function t(n,e,o){let s=window.E,r=e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Node);return!r&&o===void 0?s(n,{},Jn(e,[])):s(n,r?e:{},Jn(o,[]))}var qo={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function kt(n,e="dl-icon"){let o=qo[n]??qo.phone;return``}function v(n,e="dl-icon"){let o=document.createElement("span");return o.className="dl-icon-wrap",o.innerHTML=kt(n,e),o}function q(n,e="info",o=0){let s=document.querySelector(".dl-toasts");s||(s=t("div",{class:"dl-toasts dl-root",role:"status","aria-live":"polite"}),document.body.appendChild(s));let r=e==="error"?"x":e==="warning"?"alert":e==="success"?"check":null,a=()=>{i.classList.remove("show"),setTimeout(()=>i.remove(),200)},i=t("div",{class:`dl-toast ${e}`},[r?v(r):"",t("span",{},n),e==="error"?t("button",{type:"button","aria-label":_("Close"),click:a},v("x")):""]);s.appendChild(i),requestAnimationFrame(()=>i.classList.add("show")),setTimeout(a,o||(e==="error"?8e3:e==="warning"?5e3:2600))}function Ce(n){return n instanceof Error?n.message:String(n)}async function F(n,e){try{let o=await n();return e&&q(e,"success",3500),o}catch(o){q(Ce(o),"error",1e4);return}}function Fo(n){try{let e=n();e&&typeof e.then=="function"&&e.catch(o=>q(Ce(o),"error"))}catch(e){q(Ce(e),"error")}}function Zn(){return(typeof document>"u"?"":document.documentElement.lang)||"en"}function ie(){let n=Zn();return n==="en"?"en-GB":n}function m(n,...e){let o=0;return n.replace(/%([%sd])/g,(s,r)=>r==="%"?"%":String(e[o++]??""))}function K(n,e){return n.toLocaleString(ie(),e===void 0?void 0:{minimumFractionDigits:e,maximumFractionDigits:e})}function W(n,e,o){return m(N_(n,e,o),K(n))}function ae(n,...e){let o=0;return n.split(/(%[%sd])/).filter(Boolean).map(s=>s==="%%"?"%":s==="%s"||s==="%d"?e[o++]:s)}var Qn=n=>_(n);function Ko(n){if(n&&typeof n=="object"){if(typeof n.error=="string")throw new Error(n.error);typeof n.warning=="string"&&n.warning&&q(n.warning,"warning",12e3)}return n}function Z(n,e=[]){let o=rpc.declare({object:"luci.dawnline",method:n,params:[...e,"lang"]});return async(...s)=>Ko(await o(...e.map((r,a)=>s[a]),Zn()))}var Wa=Z("logs_clear",["person","device","category","older_days"]),Ga=(n={})=>Wa(n.person??"",n.device??"",n.category??"",n.older_days??""),qa=rpc.declare({object:"luci.dawnline",method:"person_update",params:["id","name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode","paused","services","circle","home_nets","server"]});async function Fa(n,e){let s=[n,...["name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode"].map(r=>e[r]),e.paused,e.services,e.circle,e.home_nets,e.server];return Ko(await qa(...s))}var Ka=Z("status",["days"]),N={rev:Z("rev"),personUpdate:Fa,settingsGet:Z("settings_get"),portalInfo:Z("portal_info"),settingsUpdate:Z("settings_update",["values"]),serviceSet:Z("service_set",["id","name","address","ports"]),serviceDelete:Z("service_delete",["id"]),geoClear:Z("geo_clear"),events:Z("events",["limit","person","since"]),logsClear:Ga,interfaces:Z("interfaces",["id"]),serverInterfaces:Z("server_interfaces",["id","auto_wan","wan_device","auto_lan","lan_devices","lan_like","device_mesh","mesh"]),circleSet:Z("circle_set",["id","server","name","color","members"]),circleDelete:Z("circle_delete",["id"]),accessCheck:Z("access_check",["from","to"]),homeHosts:Z("home_hosts",["id"]),usageClear:Z("usage_clear",["scope","id"]),uninstall:Z("uninstall",["confirm"]),status:Ka,setupDefaults:Z("setup_defaults"),serverCreate:Z("server_create",["id","name","ifname","port","subnet","endpoint","mtu","preset","lan_zone","wan_zone","lan_like","portal_enabled","portal_port"]),serverObfuscation:Z("server_obfuscation",["id","preset"]),serverUpdate:Z("server_update",["id","values"]),serverPorts:Z("server_ports",["id"]),endpointProbe:Z("endpoint_probe",["host","id","port"]),serverDelete:Z("server_delete",["id"]),personLinks:Z("person_links",["id"]),personCreate:Z("person_create",["name","slug","server","access","device_limit","expires","quota_gb","quota_period"]),personPause:Z("person_pause",["id","paused"]),personRegen:Z("person_regen",["id","remove"]),personDelete:Z("person_delete",["id"]),personUsage:Z("person_usage",["id","days"]),deviceCreate:Z("device_create",["person","name","kind"]),deviceConfig:Z("device_config",["id"]),deviceUpdate:Z("device_update",["id","name","disabled"]),deviceDelete:Z("device_delete",["id"]),deviceRotate:Z("device_rotate",["id"]),apply:Z("apply"),health:Z("health"),healthFix:Z("health_fix",["id"]),serviceLog:Z("service_log"),serviceLogClear:Z("service_log_clear",["older_days"]),backupList:Z("backup_list"),backupCreate:Z("backup_create"),backupRestore:Z("backup_restore",["name"]),backupDelete:Z("backup_delete",["name"]),backupRead:Z("backup_read",["name"]),backupUpload:Z("backup_upload",["data"]),exportJson:Z("export"),importJson:Z("import",["data"]),updatesStatus:Z("updates_status"),updatesRun:Z("updates_run",["what"]),updatesReleases:Z("updates_releases",["page"]),updatesNotes:Z("updates_notes",["component","tag","build"]),updatesChanges:Z("updates_changes",["from","to"])};function A(n,e,o="neutral",s={}){let{disabled:r,...a}=s,i=t("button",{class:`cbi-button cbi-button-${o}`,type:"button",...a,click:async l=>{if(l.preventDefault(),l.stopPropagation(),!i.disabled){i.disabled=!0,i.classList.add("spinning");try{await e(l)}catch(d){q(Ce(d),"error")}finally{i.disabled=!1,i.classList.remove("spinning")}}}},n);return i.disabled=!!r,i}function $e(n,e,o,s="neutral",r=""){return A([v(n),t("span",{class:"dl-btn-label"},e)],o,s,{title:e,class:`cbi-button cbi-button-${s} dl-icon-btn ${r}`.trim()})}function Te(n){return document.addEventListener("luci-navigate",n),()=>document.removeEventListener("luci-navigate",n)}var _t=null;function Xn(n=!1){let e=_t;_t=null,e?.(n)}function de(n,e,o,s=""){Xn();let r=t("div",{class:`dl-modal ${s}`},e),a=t("div",{class:"button-row"},o);r.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),i.stopPropagation(),ce();return}if(i.key!=="Enter"||i.shiftKey||i.ctrlKey||i.metaKey||i.altKey)return;let l=i.target;if(!l||["TEXTAREA","BUTTON","SELECT","A"].includes(l.tagName))return;let d=a.querySelector(".cbi-button-positive");!d||d.disabled||(i.preventDefault(),d.click())}),ui.showModal(n,[r,a])}function ce(){Xn(),ui.hideModal()}function ue(n=_("Cancel"),e=!1){return t("button",{class:`cbi-button ${e?"cbi-button-negative":"cbi-button-neutral"}`,type:"button",click:ce},n)}function me(n,e,o=_("Confirm"),s=!1){return new Promise(r=>{de(n,e,[ue()," ",t("button",{class:`cbi-button ${s?"cbi-button-negative":"cbi-button-positive"}`,type:"button",click:()=>{let a=_t;_t=null,ui.hideModal(),a?.(!0)}},o)]),_t=r})}Te(()=>{_t&&(Xn(),ui.hideModal())});async function xe(n,e=_("Copied to clipboard"),o=!1){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{let s=t("textarea",{style:"position:fixed;opacity:0"},n);document.body.appendChild(s),s.select();let r=document.execCommand("copy");if(s.remove(),!r)throw new Error(_("Copying is blocked here. Select the text and copy it by hand."))}return q(e,"success",2500),!0}catch(s){return o||q(Ce(s),"error"),!1}}function Ne(n,e,o="text/plain"){let s=globalThis,r=typeof e=="string"?new s.Blob([e],{type:o}):e,a=URL.createObjectURL(r),i=t("a",{href:a,download:n,style:"display:none"});document.body.appendChild(i),i.click(),setTimeout(()=>{URL.revokeObjectURL(a),i.remove()},1e3)}function eo(n,e){return new Promise(o=>{let s=t("input",{type:"file",accept:n,style:"display:none"});s.addEventListener("cancel",()=>{s.remove(),o(null)}),s.addEventListener("change",()=>{let r=s.files?.[0];if(s.remove(),!r)return o(null);let a=new FileReader;a.onload=()=>{let i=String(a.result??"");o({name:r.name,data:e==="base64"?i.replace(/^data:[^,]*,/,""):i})},a.onerror=()=>o(null),e==="base64"?a.readAsDataURL(r):a.readAsText(r)}),document.body.appendChild(s),s.click()})}function Se(n,e){let o=document.querySelector(".dl-dd");if(o&&(o.dlClose?o.dlClose():o.remove(),o.dlAnchor===n))return;let s=t("div",{class:"dl-dd dl-root",role:"menu"},e.map(u=>u?t("button",{type:"button",role:"menuitem",class:u.danger?"danger":u.warn?"warn":"",click:()=>{p(),Fo(u.run)}},[u.icon??"",t("span",{},u.label)]):t("hr")));document.body.appendChild(s);let r=n.getBoundingClientRect(),a=s.offsetWidth,i=s.offsetHeight;s.style.top=`${r.bottom+6+i>window.innerHeight-8&&r.top-6-i>8?r.top-6-i:r.bottom+6}px`,s.style.left=`${Math.max(8,Math.min(r.right-a,window.innerWidth-a-8))}px`;let l=u=>{!s.contains(u.target)&&!n.contains(u.target)&&p()},d=u=>{if(u.key==="Escape"||u.key==="Tab")return p();let k=[...s.querySelectorAll("button:not([disabled])")];if(!k.length||!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let M=k.indexOf(document.activeElement),g=u.key==="Home"?0:u.key==="End"?k.length-1:u.key==="ArrowDown"?(M+1)%k.length:(M-1+k.length)%k.length;k[g].focus({preventScroll:!0})},c=Te(p);s.dlAnchor=n,s.dlClose=p;function p(){s.remove(),c(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",d,!0),window.removeEventListener("scroll",p,!0)}setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",d,!0),window.addEventListener("scroll",p,!0)}),s.querySelector("button")?.focus({preventScroll:!0})}var gt=null,nt=null,to=0;function Ct(){gt&&(gt.style.display="none"),nt=null,clearInterval(to),to=0}function we(n,e){let o=s=>{gt??(gt=document.body.appendChild(t("div",{class:"dl-tip dl-tip-float dl-root"}))),gt.replaceChildren(...e().map(r=>typeof r=="string"?document.createTextNode(r):r)),gt.style.display="",gt.style.left=`${s.clientX}px`,gt.style.top=`${s.clientY-10}px`,nt=n,to||(to=window.setInterval(()=>{(!nt?.isConnected||!nt.getClientRects().length)&&Ct()},400))};n.addEventListener("mouseenter",o),n.addEventListener("mousemove",o),n.addEventListener("mouseleave",Ct),n.addEventListener("pointerup",s=>{s.pointerType!=="mouse"&&(nt===n?Ct():o(s))})}Te(Ct);window.addEventListener("scroll",()=>nt&&Ct(),{capture:!0,passive:!0});document.addEventListener("pointerdown",n=>{nt&&!nt.contains(n.target)&&Ct()},!0);function Ya(n,e,o){let s=0;for(;n>=o&&s=100||s===0?K(Math.round(n)):K(n,1)} ${e[s]}`}function oe(n){return Ya(!n||n<0?0:n,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function Fe(n){let e=n*8,o=[_("bit/s"),_("kbit/s"),_("Mbit/s"),_("Gbit/s")];if(e<1e3)return`${K(Math.round(e))} ${o[0]}`;let s=e<1e6?1:e<1e9?2:3,r=e/1e3**s;return`${K(r,s===3||r<10?1:0)} ${o[s]}`}function pe(n,e=Date.now()/1e3){if(!n)return _("never");let o=Math.max(0,Math.round(e-n));return o<60?_("just now"):o<3600?m(_("%s min ago"),Math.floor(o/60)):o<86400?m(_("%s h ago"),Math.floor(o/3600)):o<86400*30?m(_("%s d ago"),Math.floor(o/86400)):new Date(n*1e3).toLocaleDateString(ie(),{day:"numeric",month:"short",year:"numeric"})}function ot(n){if(!n||n<0)return"—";let e=Math.floor(n/86400),o=Math.floor(n%86400/3600),s=Math.floor(n%3600/60);return e?m(_("%sd %sh"),e,o):o?m(_("%sh %sm"),o,s):m(_("%sm"),s)}function Ut(n){let e=new Date(n*1e3),o=new Date,s=e.toDateString()===o.toDateString(),r=e.toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});return s?r:`${e.toLocaleDateString(ie(),{day:"numeric",month:"short"})} ${r}`}function Ke(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function Mt(n){let[e,o,s]=n.split("-").map(Number);return new Date(e,(o||1)-1,s||1,12)}function Oe(n){return(typeof n=="string"?/^\d{4}-\d{2}-\d{2}$/.test(n)?Mt(n):new Date(n):n).toLocaleDateString(ie(),{day:"numeric",month:"short",year:"numeric"})}function De(n){return n?Oe(n):""}function no(n,e){let o=s=>{let[r,a,i]=s.split("-").map(Number);return Date.UTC(r,a-1,i)};return Math.round((o(n)-o(e))/864e5)}function jt(n,e){let o=Mt(n);return o.setDate(o.getDate()+e),Ke(o)}function Lt(n,e){let[o,s,r]=n.split("-").map(Number),a=new Date(o,s-1+e,1,12),i=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(r,i)),Ke(a)}function Ge(n){return n?.length?n[n.length-1].day:Ke(new Date)}function Yo(n,e,o,s,r=30){let a=n||s;return e==="day"?jt(a,o):e==="week"?jt(a,7*o):e==="month"?Lt(a,o):e==="year"?Lt(a,12*o):jt(a,r*o)}function st(n,e=Date.now()){if(!n)return null;let o=typeof e=="number"?Ke(new Date(e)):e,s=no(n,o);return s>=0?s+1:s}function rt(n,e){return e!=null&&e>0&&n.expire_warn>0&&e<=n.expire_warn}function an(n){return n<=1?_("ends today"):n===2?_("ends tomorrow"):W(n,"ends in %s day","ends in %s days")}function Et(n){return n<1024?`${K(n)} ${_("B")}`:n<1048576?`${K(n/1024,n<10240?1:0)} ${_("KB")}`:`${K(n/1048576,1)} ${_("MB")}`}function vt(n){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[n]}var Vo=["computer","phone","tablet","router","other"];function at(n){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[n]}function Jo(n){return{active:_("Active"),paused:_("Paused"),expired:_("Expired"),quota:_("Data limit reached"),hours:_("Outside allowed hours"),no_server:_("No server"),server_off:_("Server is turned off")}[n]}function je(n){let e=n.trim().split(/\s+/).filter(Boolean);if(!e.length)return"?";let o=e[0][0]??"",s=e.length>1?e[e.length-1][0]??"":e[0][1]??"";return(o+s).toUpperCase()}function ln(n){let e=o=>o.disabled?3:o.online?0:o.handshake?1:2;return n.map((o,s)=>[o,s]).sort((o,s)=>e(o[0])-e(s[0])||o[1]-s[1]).map(([o])=>o)}function Pe(n,e,o){return t("span",{class:`dl-pill ${n}`,title:o??null},e)}function Va(n){return n.state==="active"?"ok":n.state==="quota"||n.state==="expired"?"bad":"warn"}function Ja(n){return n.state==="server_off"&&n.paused?"paused":n.state}function Zo(n){let e=Ja(n);return e==="active"||e==="server_off"?"":Pe(Va({...n,state:e}),Jo(e))}function Qo(n){let e=n.access==="both"?["lan","inet"]:n.access==="lan"?["lan"]:["inet"],o=t("span",{class:"dl-access","aria-label":vt(n.access)},e.map(s=>t("span",{class:`dl-ibadge ${s}`},v(s==="lan"?"home":"globe"))));return we(o,()=>[t("div",{class:"dl-tip-title"},vt(n.access)),n.access==="lan"&&n.services?.length?t("div",{class:"dl-muted"},W(n.services.length,"%s home service only","%s home services only")):""]),o}function Za(n){return{active:null,paused:_("Paused"),expired:_("Access ended"),quota:_("Data limit"),hours:_("Outside hours"),server_off:_("Server off"),no_server:_("No server")}[n]}function dn(n,e,o=_("Not set up yet"),s){let r=new Date(n.handshake*1e3).toLocaleString(ie()),a=n.handshake?`${m(_("Last seen %s"),pe(n.handshake,e))} · ${r}`:"";if(n.disabled)return t("span",{class:"dl-dstat",title:a},_("Disabled"));if(n.online)return t("span",{class:"dl-dstat ok"},_("Connected"));let i=s&&Za(s.state);return i?t("span",{class:"dl-dstat warn",title:a||_("Not connected yet")},i):n.handshake?t("span",{class:"dl-dstat",title:r},m(_("Last seen %s"),pe(n.handshake,e))):t("span",{class:"dl-dstat warn",title:_("Waiting for the first connection")},o)}var cn=null;function Xo(n,e,o,s){cn?.close();let r=t("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[t("div",{class:"dl-drawer-head"},[n,t("button",{type:"button",class:"dl-drawer-x","aria-label":_("Close"),click:()=>c()},v("x"))]),t("div",{class:"dl-drawer-body"},e),o?t("div",{class:"dl-drawer-foot"},o):""]),a=t("div",{class:"dl-drawer-overlay dl-root",click:u=>{u.target===a&&c()}},r),i=u=>{u.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&c()},l=!1,d=Te(()=>c());function c(){l||(l=!0,d(),document.removeEventListener("keydown",i),a.classList.remove("open"),setTimeout(()=>a.remove(),220),cn===p&&(cn=null),s())}let p={close:c,panel:r};return document.addEventListener("keydown",i),document.body.appendChild(a),requestAnimationFrame(()=>a.classList.add("open")),cn=p,p}function ge(n,e,o){return t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},n),o?t("span",{class:"dl-sub"},o):""]),t("div",{class:"dl-setrow-ctl"},e)])}function _e(n,e,o,s=e){let r=ge(n,s," "),a=r.querySelector(".dl-sub"),i=()=>{let l=o();a.textContent=l.text,a.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),r.refresh=i,r.help=o,i(),r}function Ee(n,e,o,s=e){let r=t("div",{class:"dl-sub"}),a=t("div",{class:"cbi-value dl-live"},[t("div",{class:"cbi-value-title"},[t("label",{},n),r]),t("div",{class:"cbi-value-field"},s)]),i=()=>{let l=o();r.textContent=l.text,r.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),e.addEventListener("change",i),a.refresh=i,a.help=o,i(),a}function Ue(n,e=[]){for(let o of n){let s=o.help?.();if(s?.bad)return s.text}for(let o of e){let s=o();if(s.bad)return s.text}return null}function Wt(n,e,o,s=""){return t("section",{class:`dl-setsec ${s}`},[t("div",{class:"dl-setsec-body"},[n?t("h3",{},n):"",...e]),o.length?t("div",{class:"dl-setsec-foot"},o):""])}function ke(n,e,o,s){return t("div",{class:"dl-group"},[t("div",{class:"dl-group-head"},[t("span",{class:"dl-group-ic"},v(n)),t("span",{class:"dl-stack"},[t("b",{},e),o?t("span",{class:"dl-sub"},o):""])]),t("div",{class:"dl-group-body"},s.filter(r=>r!==""))])}function it(n,e,o,s,r){return t("div",{class:`dl-row dl-need-row ${e}`},[e?t("span",{class:"dl-need-ic"},v(n)):v(n),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-sub"},s)]),r])}function bt(n,e){let o={ok:"success",warn:"warning",error:"error",info:"notice"}[n];return t("div",{class:`alert-message ${o}`},e)}function Tt(n,e=""){let o=t("div",{class:e});return o.innerHTML=n,o}var rs=Ua(os(),1),Qa=n=>``,ss="#0a0a0a",Xa="#f2f2f2",ei={night:[ss,Xa],day:["#ffffff",ss]},ti=n=>n.length>300,St=n=>+n.toFixed(2);function oo(n,e,o,s,r){return`M${St(n+r)} ${St(e)}h${St(o-2*r)}a${r} ${r} 0 0 1 ${r} ${r}v${St(s-2*r)}a${r} ${r} 0 0 1 -${r} ${r}h-${St(o-2*r)}a${r} ${r} 0 0 1 -${r} -${r}v-${St(s-2*r)}a${r} ${r} 0 0 1 ${r} -${r}z`}function pn(n,e=3,o=!0,s="plain"){let r=ti(n),a=s!=="plain",[i,l]=a?ei[s]:["#fff","#000"],d=(0,rs.default)(0,r?"L":"H");d.addData(n,"Byte"),d.make();let c=d.getModuleCount(),p=c+e*2,u=o&&!r?Math.round(c*.22):0;u&&(c-u)%2&&u++;let k=(c-u)/2,M=k+u,g=(b,C)=>u>0&&b>=k&&b=k&&Ca&&(C<7&&b<7||C<7&&b>=c-7||C>=c-7&&b<7),E="";if(a){let b=r?.48:.42;for(let C=0;C${Qa(a?i:"#fff")}`}let $=``;return a?`${$}${S}`:`${$}${S}`}function xt(){let n=document.documentElement.getAttribute("data-darkmode");return n!=null?n==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function un(n){let e=xt();return Tt(pn(n,3,!0,e?"night":"day"),`dl-qr${e?"":" light"}`)}function so(n){let e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/.exec(n.trim());if(!e)return null;let[o,s,r,a]=e.slice(1,5).map(Number),i=Number(e[5]);if([o,s,r,a].some(c=>c>255)||i<8||i>30)return null;let l=o*2**24+s*2**16+r*2**8+a,d=2**(32-i);return{net:l-l%d,size:d}}var ni=(n,e)=>n.netso(n));function $t(n){return n.split("/")[0].split(".").slice(0,3).join(".")}function mn(n){return`${n.trim()}.0/24`}function ao(n,e,o){let s=n.trim(),r=/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s)?so(mn(s)):null;if(!r)return{text:_("Three numbers, like 10.77.0."),bad:!0};if(!oi.some(i=>r.net>=i.net&&r.net+r.size<=i.net+i.size))return{text:_("Use a private range: 10.x.x, 172.16–31.x or 192.168.x."),bad:!0};let a=e.find(i=>{let l=so(i.cidr);return l!=null&&ni(r,l)});if(a){let i=a.cidr.endsWith("/24")?`${$t(a.cidr)}.x`:a.cidr,l=m(_("%s already uses %s."),a.name,i);return{text:o&&o!==s?`${l} ${m(_("Try %s."),o)}`:l,bad:!0}}return{text:m(_("Devices get %s – %s, the router %s."),`${s}.2`,`${s}.254`,`${s}.1`),bad:!1}}var is=(n,e)=>e.find(o=>o.from<=n&&n<=o.to)?.who??null,si=n=>Number.isInteger(n)&&n>=1&&n<=65535;function Gt(n,e,o){if(!si(n))return{text:_("Use a port from 1 to 65535."),bad:!0};let s=is(n,e);return s?{text:m(_("Used by %s. Choose another port."),s),bad:!0}:{text:o,bad:!1}}function hn(n,e,o){let s=o?m(_("HTTPS here, plain HTTP for links on IP addresses on %s."),n+1):_("HTTPS on this port, opened on WAN."),r=Gt(n,e,s);if(r.bad||!o)return r;if(n===65535)return{text:_("Links on IP addresses also need the next port: choose a lower one."),bad:!0};let a=is(n+1,e);return a?{text:m(_("Links on IP addresses also need %s, used by %s. Choose another port."),n+1,a),bad:!0}:r}var io=n=>Array.from(n).length,as=48,ri=/[<>"\\\u0000-\u001f\u007f]/,ls=(n,e)=>m(N_(n,"Up to %s character (%s now).","Up to %s characters (%s now)."),K(n),K(io(e)));function He(n,e=[],o=""){let s=n.trim();return s?io(n)>as?{text:ls(as,n),bad:!0}:ri.test(n)?{text:_('Names can’t contain < > " or \\.'),bad:!0}:e.some(r=>r.toLowerCase()===s.toLowerCase())?{text:m(_("“%s” already exists - pick another name."),s),bad:!0}:{text:o,bad:!1}:{text:_("Enter a name."),bad:!0}}function ds(n,e=[]){return io(n)>32?{text:ls(32,n),bad:!0}:He(n,e,_("Shown on the person cards."))}var ai=/^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ii=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Dt(n){let e=ii.exec(n);return!!e&&e.slice(1).every(o=>Number(o)<=255)}function ro(n){return/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(n)&&!/:::/.test(n)}function Pt(n,e,o=null){let s=n.trim();if(!s)return o!=null?{text:o,bad:!1}:{text:_("Enter a hostname or IP address."),bad:!0};if(/^[a-z]+:\/\//i.test(s))return{text:_("Leave out https:// - just the name."),bad:!0};if(/\/.*/.test(s))return{text:_("Just the name, without a path."),bad:!0};if(/^[^:\[]+:\d+$/.test(s))return{text:_("Just the name, without a port (the port is on AmneziaWG)."),bad:!0};if(/\s/.test(s))return{text:_("A hostname has no spaces."),bad:!0};if(s.length>253||!(ai.test(s)||Dt(s)||ro(s)))return{text:_("Use a hostname or an IP address."),bad:!0};let r=ro(s)?`[${s}]`:s;return{text:e?m(_("Devices connect to %s."),`${r}:${e}`):m(_("Links use %s."),r),bad:!1}}function cs(n,e){let o=n.split(/[ ,]+/).filter(Boolean);if(!o.length)return{text:m(_("This router (%s): queries go where your home network sends them, and home names work."),e),bad:!1};let s=o.find(a=>!Dt(a)&&!ro(a));if(s)return{text:m(_("“%s” is not an IP address. Separate several with commas."),s),bad:!0};let r=new Intl.ListFormat(ie(),{type:"conjunction"}).format(o);return{text:m(_("Devices use %s - home names and your LAN’s DNS filters no longer apply to them."),r),bad:!1}}function ps(n,e){let o=n.trim();if(!o)return{text:m(_("Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets."),e.computer,e.phone),bad:!1};if(!/^\d{1,4}$/.test(o)||Number(o)<1280||Number(o)>1500)return{text:_("MTU must be 1280–1500, or empty for automatic."),bad:!0};let s=Number(o);return{text:m(_("Computers and routers get %s, phones and tablets %s."),s,Math.min(s,1280)),bad:!1}}function us(n){let e=n.trim();return e?!/^\d{1,3}$/.test(e)||Number(e)>600?{text:_("Use 0–600 seconds."),bad:!0}:Number(e)===0?{text:_("Off: NAT may close the tunnel when idle, and “Connected” lags."),bad:!1}:{text:m(_("Devices send a packet every %s s to keep NAT open (a little battery on phones)."),e),bad:!1}:{text:_("Default: a packet every 25 s keeps NAT open and “Connected” accurate."),bad:!1}}function fn(n,e=0){let o=n.trim();if(!/^\d{1,2}$/.test(o)||Number(o)<1||Number(o)>32)return{text:_("Use 1–32."),bad:!0};let s=Number(o);return e>s?{text:e-s===1?m(N_(e,"Already has %s device: remove one first, or allow more.","Already has %s devices: remove one first, or allow more."),K(e)):m(N_(e,"Already has %s device: remove %s first, or allow more.","Already has %s devices: remove %s first, or allow more."),K(e),K(e-s)),bad:!0}:{text:W(s,"They can add %s device themselves.","They can add %s devices themselves."),bad:!1}}function gn(n,e=!0){let o=n.trim();if(!o)return{text:_("Optional. No data limit."),bad:!1};let s=Number(o);return!/^\d+(\.\d+)?$/.test(o)||s<0||s>1e5?{text:_("A number of GB, up to 100000."),bad:!0}:s===0?{text:_("Optional. No data limit."),bad:!1}:{text:m(e?_("Paused after %s GB this month, resumed on the 1st."):_("Paused after %s GB in total."),K(s)),bad:!1}}function ms(n,e,o,s){let r=n.trim();if(!r)return{text:_("Optional. No end date."),bad:!1};let a=o(r,e);return a==null?{text:_("Use a date."),bad:!0}:a<0?{text:_("That date has passed: access would end at once."),bad:!0}:{text:a===1?m(_("Access ends today (%s)."),s(r)):m(N_(a,"Access ends in %s day (%s).","Access ends in %s days (%s)."),K(a),s(r)),bad:!1}}function hs(n,e=null){let o=n.trim();return o?Dt(o)?e&&!e(o)?{text:m(_("%s is not in any home network of this server: nobody would reach it."),o),bad:!1}:{text:"",bad:!1}:{text:_("Use an IPv4 address, like 192.168.1.10."),bad:!0}:{text:_("The device’s address at home."),bad:!0}}function fs(n){let e=n.split(/[ ,]+/).filter(Boolean);if(!e.length)return{text:_("All ports."),bad:!1};let o=e.find(s=>!/^\d{1,5}$/.test(s)||Number(s)<1||Number(s)>65535);return o?{text:m(_("“%s” is not a port (1–65535)."),o),bad:!0}:{text:m(N_(e.length,"Port %s.","Ports %s."),e.join(", ")),bad:!1}}function gs(n){let e=n.trim();return e?/^https?:\/\//i.test(e)?e.length>300||!/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(e)?{text:_("Not a usable address (no spaces or quotes)."),bad:!0}:{text:_("Wrong links are sent there instead of a “Not found”."),bad:!1}:{text:_("Must start with http:// or https://."),bad:!0}:{text:_("Wrong links get a bare “Not found”."),bad:!1}}function vs(n,e="phone.myata"){let o=n.trim();return o?/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(o)?{text:m(_("Devices get names like %s."),`${e}.${o}`),bad:!1}:{text:/[A-Z]/.test(o)?_("Lowercase only."):_("Lowercase letters, digits, dashes and dots."),bad:!0}:{text:m(_("The default, lan: devices get names like %s."),`${e}.lan`),bad:!1}}function bs(n){let e=n.trim();return e?Dt(e)?{text:m(_("%s takes over when the tunnel is down."),e),bad:!1}:{text:_("Use an IPv4 address, or leave it empty."),bad:!0}:{text:_("None: without the tunnel those devices have no DNS."),bad:!1}}function xs(n){let e=n.trim();return/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e)?{text:m(_("Runs within an hour after %s (router time)."),e),bad:!1}:{text:_("Use HH:MM, 00:00–23:59."),bad:!0}}function lo(n,e,o,s={}){let r=0,a="",i=null;return{help:()=>{let{host:c,port:p}=n(),u=Pt(c,p,s.empty??null);return u.bad||!c.trim()?u:i&&i.host===c.trim()?{text:i.text,bad:i.bad}:{text:`${s.idle?.()||u.text} ${_("Checking where it points…")}`,bad:!1}},schedule:()=>{let{host:c}=n(),p=Pt(c,n().port,s.empty??null);p.bad||!c.trim()||c.trim()===i?.host||(clearTimeout(r),r=window.setTimeout(async()=>{let u=c.trim();a=u;try{let{id:k,port:M}=n(),g=await e(u,k,M);if(a!==u)return;i={host:u,text:g.text,bad:g.status==="error"}}catch{if(a!==u)return;i={host:u,text:p.text,bad:!1}}o()},700))}}}var co=["%d system package","%d system packages","%s (after %d repair)","%s (after %d repairs)","%s - %d repairs didn't help","%s - %s","%s - not repaired again (%d repairs didn't help)","%s has no IPv4 address.","%s is not a bridge, so Dawnline cannot join the LAN as a device.","%s needs a manual switch in Components","%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s · restored","Access rules","Activity","AmneziaWG is missing from the router","AmneziaWG is running again","AmneziaWG is running again · accepting connections on port %d","AmneziaWG isn't accepting connections on port %d","AmneziaWG isn't running","Backup","Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.","Choose another interface name in the server settings.","Components","Connections","DNS for Home-only devices","Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed.","Firewall","Install it in Dawnline → Components.","Internet like a home device","MTU is now automatic","Missing: %s.","No LAN detected.","No free address on %s.","No free link-local range for the internal link.","No free routing table.","People","Personal links","Personal portal","Router","Servers","Speed","System packages","The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.","Traffic","Watchdog","a new build needs a manual switch in Components","answers again","are loaded again","are missing","automatic update failed","background check failed: %s","can't reach Dawnline (luci.dawnline is missing in rpcd)","can't use the network interface %s: it exists and isn't Dawnline's","certificate expires %s","certificate expires within 7 days","certificate renewed · valid until %s","couldn't be repaired: %s","couldn't be updated - the previous rules stay, and changes to access wait until they load","couldn't load - no device is loaded into the tunnels until they do","couldn't load devices into the tunnel","couldn't start","couldn't start · %d failed attempts in %d min","failed - internet goes out directly for now","failed: %s",'has an invalid interface name "%s"',"installed the %s build","installed the %s build · %s","is kept down","is kept down: its disguise needs AmneziaWG %s (installed: %s)","is kept down: its disguise needs AmneziaWG %s (installed: none)","is off","is on · traffic enters %s as %s","is ready again","isn't answering on port %d","isn't installed: no tunnel can run - install it in Dawnline → Components","isn't installed: tunnels were left as they are","isn't known to the network service - restart the network or reboot","isn't running","isn't running on this router (fw4): tunnels and the portal are closed","kernel module isn't installed: no tunnel can run - install it in Dawnline → Components","kernel module isn't loaded","loading it","loading them again","moved to word codes","netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.","network changed - Dawnline set itself up again","nightly backup failed: %s","public address changed · %s → %s","reaches Dawnline again","reloading rpcd","restarted · version %s","restarting for the AmneziaWG update","restarting it","restoring them","rules for Dawnline are in place again","rules for Dawnline aren't loaded","rules for Dawnline were changed or removed","runs again","setting it up again","started","started with the router · version %s","started · accepting connections on port %s","started · version %s","stopped unexpectedly","stopped unexpectedly - started again","update failed","update to %s failed its check - rolled back to %s","updated automatically · %s","updated automatically · %s → %s","updated · %s","updated · %s → %s","updates available · %s","was broken - set up again (%s as %s)"];var li={connect:"connections",disconnect:"connections",roam:"connections",device_added:"people",device_removed:"people",devices_removed:"people",device_changed:"people",device_keys:"people",link_changed:"people",person_added:"people",person_removed:"people",person_changed:"people",paused:"people",resumed:"people",expiring:"people",expired_kept:"people",portal_blocked:"problems"},Nt=["connections","people","problems"];function Ye(n){return{connections:_("Connections"),people:_("People"),problems:_("Problems")}[n]}function ws(n){return{connections:_("Connects, disconnects and IP changes"),people:_("People and their devices added, changed, paused, removed"),problems:_("Blocked portal sign-ins (tunnels and services are in the service log)")}[n]}var qt=n=>li[n]??"problems";function Ft(n){return{awg:"AmneziaWG",dawnline:"Dawnline",portal:_("Portal")}[n]??n}var di=["person_added","person_removed","person_changed"];function Ve(n){return n.by?n.by:di.includes(n.type)||n.detail==="by admin"||n.detail?.endsWith(" (admin)")?"admin":n.detail?.endsWith(" (portal)")?"portal":null}function ys(n){return(n.detail??"").replace(/ \((admin|portal)\)$/,"").replace(/^by admin$/,"")}var vn=n=>n.sys?["error","repair","down"].includes(n.sys.level):qt(n.ev.type)==="problems";function bn(n){let e=n.keep_days>0?W(n.keep_days,"%s day","%s days"):_("no age limit"),o=n.persist==="off"?_("kept in memory only (lost on reboot)"):n.persist==="10min"?_("saved to flash every 10 minutes"):_("saved to flash hourly");return m(_("Kept for %s, %s, %s."),e,W(n.max,"up to %s event","up to %s events"),o)}function po(n){return{"paused by admin":_("paused by admin"),"end date reached":_("end date reached"),"data limit reached":_("data limit reached"),"outside allowed hours":_("outside allowed hours"),"no server":_("no server"),"server turned off":_("server turned off")}[n]??n}function ks(n){let e=/^(\d+) days?$/.exec(n);return e?Number(e[1]):null}function _s(n){let e={name:_("name"),access:_("access"),device_limit:_("device limit"),expires:_("end date"),expire_action:_("what happens at the end"),expire_warn:_("warning before the end"),quota_gb:_("data limit"),quota_period:_("data limit period"),bonus_gb:_("extra data"),hours:_("allowed hours"),dns_mode:_("DNS"),paused:_("pause"),services:_("home services"),circle:_("circle","setting"),home_nets:_("home networks"),server:_("server")};return n.split(", ").map(o=>{let s=/^moved to (.+)$/.exec(o)?.[1];return s?m(_("moved to %s"),s):e[o]??o.replace(/_/g," ")}).join(", ")}function Cs(n,e,o){let r={"cleared|the service log":_("You cleared the service log"),"cleared|the activity log":_("You cleared the activity log"),"exported|all settings":_("You exported all settings"),"imported|settings from a file":_("You imported settings from a file"),"restored|from a file":_("You restored a backup from a file"),"turned on|the personal portal":_("You turned on the personal portal"),"turned off|the personal portal":_("You turned off the personal portal"),"changed|the personal portal":_("You changed the personal portal"),"turned on|the watchdog":_("You turned on the watchdog"),"turned off|the watchdog":_("You turned off the watchdog"),"reset traffic history|for everyone":_("You reset traffic history for everyone")}[`${n}|${o??""}`];if(r)return{text:r,named:!1};let i={"created|server":_("You created server %s"),"changed|server":_("You changed server %s"),"removed|server":_("You removed server %s"),"turned on|server":_("You turned on server %s"),"turned off|server":_("You turned off server %s"),"added|circle":_("You added circle %s"),"changed|circle":_("You changed circle %s"),"removed|circle":_("You removed circle %s"),"restored|backup":_("You restored backup %s")}[`${n}|${e??""}`];return i?{text:i,named:!0}:n==="reset traffic history"&&/^for (.+)$/.exec(o??"")?.[1]?{text:_("You reset traffic history for %s"),named:!0}:null}var Ls=(n,e)=>n==="reset traffic history"?e.replace(/^for /,""):e;function Ms(n){let e=o=>{let s={"other addresses":_("other addresses"),certificate:_("certificate"),redirect:_("redirect"),"devices kept apart":_("devices kept apart"),"devices reach each other":_("devices reach each other"),"devices reach each other in circles":_("devices reach each other in circles"),"home network and internet path":_("home network and internet path"),"the file holds private keys":_("the file holds private keys"),"problems are only logged, nothing is repaired":_("problems are only logged, nothing is repaired"),name:_("name"),"public address":_("public address"),"AmneziaWG port":_("AmneziaWG port"),"tunnel network":_("tunnel network"),connections:Ye("connections"),people:Ye("people"),problems:Ye("problems")};if(s[o])return s[o];let r;return(r=/^port (\d+)$/.exec(o))?m(_("port %s"),r[1]):(r=/^address (.+)$/.exec(o))?m(_("address %s"),r[1]):(r=/^disguise: (.+)$/.exec(o))?m(_("disguise: %s"),r[1]):(r=/^(\d+) events?$/.exec(o))?W(Number(r[1]),"%s event","%s events"):(r=/^older than (\d+) days$/.exec(o))?W(Number(r[1]),"older than %s day","older than %s days"):(r=/^with (\d+) (person|people)$/.exec(o))?W(Number(r[1]),"with %s person","with %s people"):(r=/^(\d+) entr(y|ies)( older than (\d+) days)?$/.exec(o))?r[4]?`${W(Number(r[1]),"%s entry","%s entries")}, ${W(Number(r[4]),"older than %s day","older than %s days")}`:W(Number(r[1]),"%s entry","%s entries"):o};return n.split(" · ").map(o=>o.split(", ").map(e).join(", ")).join(" · ")}var ci=null,pi=new Set(co);function mi(){return ci??(ci=co.filter(n=>/%[sd]/.test(n)&&n.replace(/%[sd]/g,"").trim()).map(n=>({t:n,fixed:n.replace(/%[sd]/g,"").length,re:new RegExp(`^${n.split(/(%[sd])/).map(e=>e==="%s"?"(.+?)":e==="%d"?"(\\d+)":e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("")}$`)})).sort((n,e)=>e.fixed-n.fixed))}function At(n,e=0){let o=n.replace(/ — /g," - ");if(pi.has(o))return Qn(o);if(e>2)return n;for(let s of mi()){let r=s.re.exec(o);if(r)return m(Qn(s.t),...r.slice(1).map(a=>At(a,e+1)))}return o.includes(", ")?o.split(", ").map(s=>At(s,e+1)).join(", "):n}function Es(n,e=120,o=26,s=Ke(new Date)){let r=Math.max(1,...n),a=t("div",{class:"dl-spark"});return a.style.width=`${e}px`,a.style.height=`${o}px`,n.forEach((i,l)=>{let d=t("i");d.style.height=`${Math.max(6,i/r*100)}%`,i||d.classList.add("zero");let c=n.length-1-l;we(d,()=>[t("div",{class:"dl-tip-title"},c===0?_("Today"):c===1?_("Yesterday"):Mt(jt(s,-c)).toLocaleDateString(ie(),{weekday:"short",day:"numeric",month:"short"})),t("div",{class:"dl-muted"},oe(i))]),a.appendChild(d)}),a}function Ts(n){let e=n==null?"":String(n);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Ss(n,e,o){return[n.map(s=>Ts(o?.[s]??s)).join(","),...e.map(s=>n.map(r=>Ts(s[r])).join(","))].join(` +`)}function hi(n){let e=new Map(n.people.map(s=>[s.id,s.name])),o=new Map(n.people.flatMap(s=>s.devices.map(r=>[r.id,r.name])));return{people:e,devices:o}}function Qe(n,e,o,s="",r=[]){let a=hi(n),i=[...e.map(u=>({ts:u.ts,category:qt(u.type),type:u.type,person:u.person?a.people.get(u.person)??u.pname??u.person:"",device:u.device?a.devices.get(u.device)??u.dname??u.device:"",detail:u.detail??"",where:u.where??"",by:Ve(u)??""})),...r.map(u=>({ts:u.ts,category:"system",type:`${u.src}.${u.level}`,person:"",device:"",detail:`${u.who?`${u.who} `:""}${u.msg}${u.detail?` +${u.detail}`:""}`,where:Ft(u.src),by:""}))].sort((u,k)=>u.ts-k.ts).map(({ts:u,...k})=>({time:new Date(u*1e3).toISOString(),...k})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${s?`-${s}`:""}-${l}.${o}`;if(o==="json"){Ne(d,JSON.stringify(i,null,2),"application/json");return}let c=["time","category","type","person","device","detail","where","by"],p={time:_("Time"),category:_("Category"),type:_("Type"),person:_("Person"),device:_("Device"),detail:_("Detail"),where:_("Where"),by:_("By")};Ne(d,Ss(c,i,p),"text/csv")}var fi=["","7","30","90"],gi=n=>n?W(Number(n),"Older than %s day","Older than %s days"):_("Everything"),Ps=n=>n?W(n,"%s event removed","%s events removed"):_("Nothing matched");function lt(n,e,o,s,r,a=!1){let i=t("select",{class:"cbi-input-select"},[t("option",{value:""},_("All categories")),...Nt.map(d=>t("option",{value:d,selected:d===r?"selected":null},Ye(d))),a?t("option",{value:"system",selected:r==="system"?"selected":null},_("System")):""]),l=t("select",{class:"cbi-input-select"},fi.map(d=>t("option",{value:d},gi(d))));de(n,[t("p",{class:"dl-muted"},`${e} ${_("This cannot be undone; export first if you want a copy.")}`),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Category")),i]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Which events")),l])],[ue()," ",A(_("Clear"),async()=>{let d=0;if(i.value!=="system")try{d+=(await N.logsClear({...o,category:i.value,older_days:l.value})).removed}catch(c){q(Ce(c),"error",1e4);return}if(a&&(i.value==="system"||i.value===""))try{d+=(await N.serviceLogClear(l.value)).removed}catch(c){ce();let p=m(_("The service log was not cleared: %s"),Ce(c));q(i.value==="system"?p:`${m(_("Activity: %s."),Ps(d).toLowerCase())} ${p}`,"error",1e4),s();return}ce(),q(Ps(d),"success",3e3),s()},"negative")])}function Ht(n,e,o,s){let r=n==="device"?m(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."),o):n==="person"?m(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."),o):_("Clears traffic history for everyone. Data limits start again from zero.");de(n==="all"?_("Reset all traffic history?"):m(_("Reset traffic history for %s?"),o),[t("p",{class:"dl-muted"},r)],[ue()," ",A(_("Reset"),async()=>{await F(()=>N.usageClear(n,e),_("Traffic history reset"))&&(ce(),s())},"negative")])}function ye(n,e,o){let s=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let r=!s.classList.contains("on");uo(s,r),o?.(r)}},t("i"));return s}function uo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var ze=n=>n.classList.contains("on");function Me(n,e,o={}){n.some(([a])=>a===e)||(n=[...n,[e,e]]);let s=t("div",{class:`dl-seg${o.cls?` ${o.cls}`:""}`,role:"radiogroup","aria-label":o.label??null,"data-value":e}),r=()=>s.querySelectorAll(":scope > button").forEach(a=>{let i=a.dataset.v===s.dataset.value;a.classList.toggle("on",i),a.setAttribute("aria-checked",i?"true":"false")});for(let[a,i]of n)s.appendChild(t("button",{type:"button",role:"radio","data-v":a,click:()=>{a!==s.dataset.value&&(o.optimistic!==!1&&(s.dataset.value=a,r()),o.onChange?.(a))}},i));return r(),s}function Xe(n,e,o,s={}){return t("button",{type:"button",...s,class:`dl-chipbtn${e?" on":""}${s.class?` ${s.class}`:""}`,"aria-pressed":e?"true":"false",click:o},n)}function xn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function he(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var vi={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},bi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function xi(n){let e={};for(let[o,s]of Object.entries(bi))n[o]!=null&&n[o]!==""&&(e[s]=String(n[o]));return e}function wi(n,e){let o=n.amnezia,s=o.obfuscation??{},r=d=>s[d]!=null&&s[d]!==""?String(s[d]):vi[d],a=o.host.replace(/^\[(.*)\]$/,"$1"),i={H1:r("h1"),H2:r("h2"),H3:r("h3"),H4:r("h4"),I1:r("i1"),I2:r("i2"),I3:r("i3"),I4:r("i4"),I5:r("i5"),Jc:r("jc"),Jmin:r("jmin"),Jmax:r("jmax"),S1:r("s1"),S2:r("s2"),S3:r("s3"),S4:r("s4"),...xi(s),allowed_ips:o.allowed_ips,client_ip:o.client_ip,client_priv_key:o.client_priv_key,client_pub_key:o.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r +`),hostName:a,mtu:o.mtu,persistent_keep_alive:o.persistent_keep_alive,port:Number(o.port),psk_key:o.psk_key,server_pub_key:o.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(o.port),protocol_version:s.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return o.dns[0]&&(l.dns1=o.dns[0]),o.dns[1]&&(l.dns2=o.dns[1]),l}function yi(n){let e="";for(let o=0;o"u")return null;try{let o=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),s=new Uint8Array(await new e.Response(o).arrayBuffer()),r=new Uint8Array(4+s.length);return new DataView(r.buffer).setUint32(0,n.length,!1),r.set(s,4),r}catch{return null}}async function mo(n,e,o=!0){let s=new TextEncoder().encode(JSON.stringify(wi(n,e))),r=o?await ki(s):null;return`vpn://${yi(r??s)}`}function Ds(){return[{id:"off",title:_("Off"),ic:"zap",stealth:0,speed:4,text:_("Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block."),apps:_("Any WireGuard app"),short:_("Any WireGuard app")},{id:"balanced",title:_("Balanced"),ic:"shield",stealth:3,speed:4,needs:"v2",text:_("AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk."),apps:_("AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps"),short:_("AmneziaWG 2.0+ apps")},{id:"max",title:_("Maximum"),ic:"lock",stealth:4,speed:3,needs:"v3",text:_("AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS."),apps:_("Apps with AmneziaWG 3.1 (current AmneziaVPN)"),short:_("AmneziaWG 3.1 apps")}]}var Kt=n=>Ds().find(e=>e.id===n),wn=n=>n.v3?"max":n.v2?"balanced":"off",Yt=n=>n==="standard"?_("Standard (old)"):n==="strong"?_("Strong (old)"):null;function _i(n,e){return e?n==="v2"?_("Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)."):_("Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."):n==="v2"?_("Needs AmneziaWG on the router."):_("Needs AmneziaWG 3.1 on the router: install it first.")}function $s(n,e){return t("span",{class:"dl-dots",title:m(_("%s: %s of 4"),e,n)},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(o=>t("i",{class:odom.content(a,Ds().map(l=>{let d=!l.needs||n[l.needs],c=l.id===e;return t("button",{type:"button",role:"radio","aria-checked":c?"true":"false","aria-disabled":d?null:"true",class:`dl-method${c?" on":""}${d?"":" off"}`,click:()=>{!d||c||(e=l.id,i(),o(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===s?t("span",{class:"dl-pill ok"},_("Current")):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[$s(l.stealth,_("Stealth")),$s(l.speed,_("Speed"))]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},_i(l.needs,r))])])}));return i(),a}function As(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var Ns=[["jc","Jc"],["jmin","Jmin"],["jmax","Jmax"],["s1","S1"],["s2","S2"],["s3","S3"],["s4","S4"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["i1","I1"],["i2","I2"],["i3","I3"],["i4","I4"],["i5","I5"],["header_protection_key","HeaderProtectionKey"],["content_padding_addition","ContentPaddingAddition"],["rekey_after_time","RekeyAfterTime"],["rekey_timeout","RekeyTimeout"],["reject_after_time","RejectAfterTime"],["keepalive_timeout","KeepaliveTimeout"],["max_handshake_attempts","MaxHandshakeAttempts"],["random_trailers","RandomTrailers"],["disable_cookies","DisableCookies"]];function Ci(n){let e=c=>n[c]!=null&&n[c]!=="",o=Ns.filter(([c])=>e(c));if(!o.length)return null;let s=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),r=(c,p,u,k)=>{let M=Ns.filter(([g])=>k.includes(g)&&e(g));return M.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},M.map(([g,h])=>s(g,h)))]):""},a=Number(n.jc||0),i=(n.i1??"").includes("0x8580")?_("A first packet shaped like a DNS answer."):_("Extra packets sent before the handshake."),l=o.map(([c,p])=>`${p} = ${n[c]}`).join(` +`),d=t("div",{class:"dl-pgrid"},[r(_("Junk packets"),"zap",a?m(N_(a,"%s random packet of %s–%s bytes before each handshake.","%s random packets of %s–%s bytes before each handshake."),K(a),n.jmin,n.jmax):_("No junk packets."),["jc","jmin","jmax"]),r(_("Padding"),"archive",_("Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard."),["s1","s2","s3","s4"]),r(_("Packet types"),"key",_("The values that replace WireGuard’s recognisable message types."),["h1","h2","h3","h4"]),r(_("Signatures"),"globe",i,["i1","i2","i3","i4","i5"]),r(_("Protection"),"lock",_("AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets."),["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),r(_("Timing"),"clock",_("Handshake and key timers vary within these ranges instead of WireGuard’s fixed values."),["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Current parameters")),t("span",{class:"dl-pcount"},String(o.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),xe(l,_("Parameters copied"))}},_("Copy as config"))]),d])}function Hs(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let o=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!o)return document.createTextNode(n);let s=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},o[1])," ",s&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):o[2]])}function Li(n){let e=!1,o=t("pre",{class:"dl-conf"}),s=()=>dom.content(o,n.conf.split(` +`).flatMap((i,l)=>l?[` +`,Hs(i,e)]:[Hs(i,e)])),r=t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),e=!e,dom.content(r,[v(e?"x":"key"),e?_("Hide key"):_("Show key")]),s()}},[v("key"),_("Show key")]);s();let a=new Blob([n.conf]).size;return t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-filecard"},[t("span",{class:"dl-filecard-ic"},".conf"),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono dl-ellipsis"},n.filename),t("span",{class:"dl-sub"},`AmneziaWG · ${W(a,"%s byte","%s bytes")}`)]),A([v("download")," ",_("Download")],()=>Ne(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Configuration")),t("span",{class:"dl-spacer"}),r,t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),xe(n.conf,_("Configuration copied"))}},[v("copy"),_("Copy")])]),o])])}function ho(n){let e=n.amnezia.obfuscation??{},o={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([s,r])=>r==null||r===""||r===(o[s]??"0"))}async function Mi(n,e="file"){if(!n.has_private_key)return t("div",{class:"dl-hint"},_("This device generated its own keys in the browser, so its full configuration only exists on that device."));let o=await mo(n,n.server),s={qr:()=>t("div",{class:"dl-qr-pane"},[un(n.conf),t("span",{class:"dl-sub"},ho(n)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),key:()=>t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-linkbox"},[t("span",{class:"dl-mono"},o),A(_("Copy"),()=>xe(o,_("Key copied")))]),t("span",{class:"dl-sub"},m(_("AmneziaVPN → %s. Keep it private."),["+",_("Insert","AmneziaVPN app"),_("Continue","AmneziaVPN app")].join(" → ")))]),file:()=>Li(n)},r=t("div",{class:"dl-connect-body"}),a=t("div",{class:"dl-seg"}),i=l=>{a.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(r,s[l]())};for(let[l,d]of[["file",_("File")],["key",_("Key")],["qr",_("QR code")]])a.appendChild(t("button",{type:"button","data-id":l,click:()=>i(l)},d));return i(e),t("div",{class:"dl-stack gap12"},[a,r])}async function Ei(n,e,o,s){let r=Kt(o),i=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await me(s?_("Generate new disguise values?"):m(_("Switch to %s?"),r.title),[W(i,"%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).","%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)."),o==="max"?_("They need an app with AmneziaWG 3.1."):o==="balanced"?_("They need an app with AmneziaWG 2.0 or newer."):"",n.st.servers.length===1&&i?_("To keep the old disguise for some people, add a second server and move them there."):""].filter(Boolean).join(" "),s?_("Generate and apply"):_("Switch and apply"),!0)&&await F(()=>N.serverObfuscation(e.id,o),s?_("New values applied"):m(_("%s applied"),r.title))&&(q(_("Devices are marked “Update config” until they import again."),"info",6e3),await n.refresh())}function Ti(n,e){let o=n.st,s=he(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),r=he(e.mtu?String(e.mtu):"",{placeholder:_("Auto"),inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=he(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=Kt(e.preset)?e.preset:void 0,l=i??wn(o.awg),d=A("",()=>Ei(n,e,l,l===i),"neutral"),c=()=>dom.content(d,l===i?[v("reset")," ",_("Generate new values")]:[m(_("Switch to %s"),Kt(l).title)]);c();let p=o.awg_state?.tools!==!1,u=[],k=_e(_("UDP port"),s,()=>Gt(Number(s.value),u,[_("Opened on the WAN firewall automatically."),Number(s.value)===4500?_("4500 is IPsec’s port: most networks let it through."):""].filter(Boolean).join(" ")));N.serverPorts(e.id).then(h=>{u=h.udp_taken??[],k.refresh()}).catch(()=>{});let M=_e("MTU",r,()=>ps(r.value,e.mtus)),g=_e(_("Keep-alive"),a,()=>us(a.value));return Wt("",[As("AmneziaWG",e.ifname),ke("globe",_("Listening"),_("Where devices reach this core from the internet"),[k]),ke("file",_("In every device configuration"),_("Changing these marks devices “Update config” until they import again"),[M,g]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[Yt(e.preset)?bt("warn",ae(_("%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again."),t("b",{},Yt(e.preset)),t("b",{},_("Balanced")),t("b",{},_("Maximum")))):"",yn(o.awg,l,h=>{l=h,c()},i,p),p&&!o.awg.v3?bt("info",ae(_("This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1."),t("b",{},_("Maximum")))):"",Ci(e.obf??{})??"",t("div",{class:"dl-row-end"},[t("span",{class:"dl-sub"},_("Applies at once: every AmneziaWG device imports its configuration again.")),d])]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Tunnel")),t("span",{class:"dl-pcount"},"3")]),t("div",{class:"dl-params-body"},[ge(_("Interface"),t("span",{class:"dl-mono"},`${e.ifname} · ${m(_("router %s"),e.address)}`)),ge(_("Tunnel subnet"),t("span",{class:"dl-mono"},e.subnet),_("Device addresses come from it.")),ge(_("Server public key"),t("span",{class:"dl-keyrow"},[t("code",{class:"dl-mono"},e.public_key),A([v("copy")],()=>xe(e.public_key,_("Public key copied")),"neutral",{title:_("Copy"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]))])])],[t("span",{class:"dl-sub"},_("Port, MTU and keep-alive apply at once.")),A(_("Save"),()=>{let h=Ue([k,M,g]);if(h){q(h,"warning");return}return n.save({port:s.value,mtu:r.value,keepalive:a.value},_("AmneziaWG saved"))},"positive")])}function Si(n){let e=Kt(n.preset),o=n.obf??{},s=(i,l)=>t("span",{class:`dl-segs ${l}`},[0,1,2,3].map(d=>t("i",{class:d+o[i]).map(i=>`${i.toUpperCase()} ${o[i]}`);return a.length&&r.push(a.slice(0,2).join(" · ")+(a.length>2?` +${a.length-2}`:"")),["h1","h2","h3","h4"].some(i=>o[i]&&o[i]!==String(["h1","h2","h3","h4"].indexOf(i)+1))&&r.push(_("H1–H4 random")),o.i1&&r.push(/0x(8580|0100)0001/.test(o.i1)?_("DNS-like first packets"):_("Signature packets")),o.header_protection_key&&r.push(_("Encrypted headers")),r.length||r.push(e?.id==="off"?_("Plain WireGuard"):_("No values yet")),t("div",{class:"dl-bento-tile dl-disg"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Disguise")),t("a",{href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(n.id)}§ion=awg`},_("Change"))]),t("div",{class:"dl-disg-id"},[t("span",{class:`dl-disg-ic${e?.id==="off"?" off":""}`},v(e?.ic??"shield")),t("span",{class:"dl-stack"},[t("b",{},e?e.title:Yt(n.preset)??_("Custom","disguise")),t("span",{class:"dl-sub"},e?e.short:Yt(n.preset)?_("Switch to Balanced or Maximum"):_("Set by hand"))])]),e?t("div",{class:"dl-disg-meters"},[t("span",{},_("Stealth")),s(e.stealth,"acc"),t("span",{},_("Speed")),s(e.speed,"ok")]):"",t("div",{class:"dl-disg-chips"},r.map(i=>t("span",{},i)))])}var fo={id:"awg",label:"AmneziaWG",settingsCard:Ti,overviewTile:Si,connectBlock:Mi,qrText:n=>n.conf,appKey:{get label(){return _("Copy AmneziaVPN config")},make:n=>mo(n,n.server)},file:{get label(){return _("Download AmneziaWG config")},make:n=>({name:n.filename,text:n.conf})}};var Pi={awg:fo};function qe(n){return Pi[n?.core||"awg"]??fo}function zt(n,e){return qe(n.find(o=>o.id===e))}var $i=2,Vt=new Set,go=null,kn=null;async function zs(){if(document.visibilityState!=="visible"||!Vt.size)return;let n=await N.rev().catch(()=>null);if(!n)return;let e=go!=null&&n.rev!==go;go=n.rev,n.version&&(kn&&n.version!==kn?(q(m(_("Dawnline was updated to %s: reload the page."),n.version),"warning",15e3),kn=null):kn??(kn=n.version)),e&&Vt.forEach(o=>o())}function _n(n){return Vt.add(n),poll.add(zs,$i),()=>{Vt.delete(n),Vt.size||poll.remove(zs)}}function Bs(n,e,o,s,r=0){let a=[],i=null,l=p=>{i&&p>i.from&&a.push({...i,to:p}),i=null},d=n.filter(p=>p.device===e).sort((p,u)=>p.ts-u.ts);for(let p of d)if(p.type==="connect")l(p.ts),p.detail&&(i={ip:p.detail,from:p.ts,to:p.ts,live:!1});else if(p.type==="roam"){let u=p.detail?.split("→")[1]?.trim();l(p.ts),u&&(i={ip:u,from:p.ts,to:p.ts,live:!1})}else p.type==="disconnect"&&l(p.ts);let c=i;return c&&s?a.push({...c,to:Math.max(o,c.from),live:!0}):l(Math.min(o,r)),a}function et(n){return`${n.city||`${n.lat.toFixed(1)},${n.lon.toFixed(1)}`}|${n.cc}`}function Os(n,e,o,s){let r=new Map;for(let i of e)(i.device===o||!r.has(i.ip))&&r.set(i.ip,i);let a=[];for(let i of n){let l=r.get(i.ip);!l||i.to<=s||a.push({key:et(l),point:l,from:Math.max(i.from,s),to:i.to,live:i.live})}return a}function js(n){let e=new Map,o=0;for(let s of n)e.set(s.key,(e.get(s.key)??0)+(s.to-s.from)),o+=s.to-s.from;return new Map([...e].map(([s,r])=>[s,o?r/o:0]))}function Rs(n,e=2700){let o=[];for(let s of n){let r=o[o.length-1];if(r&&s.key!==r.key&&!s.live&&s.to-s.from{a&&(o.push({kind:"move",k:a,start:s,ms:e}),s+=e);let i=Math.min(1100,Math.max(350,(r.to-r.from)/3600*45));o.push({kind:"stay",k:a,start:s,ms:i}),s+=i}),{steps:o,total:s}}function qs(n,e,o){let s=e.findIndex(l=>o>=l.start&&oo>=i.from&&oi.kind==="stay"&&i.k===s),a=n[s];return r.start+r.ms*Math.min(.999,Math.max(0,(o-a.from)/Math.max(1,a.to-a.from)))}var Di=n=>n<=0?0:n>=1?1:n<.5?2*n*n:1-(-2*n+2)**2/2;function Ks(n){return-vo/2+(1+vo)*Di((n-Is)/(1-Is))}var Ys=n=>n+Ws>=1;function Vs(n){return["interpolate",["linear"],["abs",["-",["get","pos"],n]],0,1,Ws,1,vo/2,0]}function Js(n,e){let o=n==="24h"?86400:n==="7d"?604800:2592e3,s=e-o,r=[],a=(l,d)=>{let c=(l-s)/o;c>.02&&c<.98&&r.push([c,d])},i=new Date(s*1e3);if(n==="24h")for(i.setMinutes(0,0,0);i.getTime()/1e3<=e;)i.getHours()%6===0&&a(i.getTime()/1e3,`${String(i.getHours()).padStart(2,"0")}:00`),i.setHours(i.getHours()+1);else if(n==="7d")for(i.setHours(12,0,0,0);i.getTime()/1e3<=e;i.setDate(i.getDate()+1))a(i.getTime()/1e3,i.toLocaleDateString(ie(),{weekday:"short"}));else{let l=new Date(e*1e3);l.setHours(0,0,0,0);for(let d=0;d<5;d++){let c=new Date(l);c.setDate(l.getDate()-7*d),a(c.getTime()/1e3,c.toLocaleDateString(ie(),{day:"numeric",month:"short"}))}r.reverse()}return r}var Cn=n=>new Date(n*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});function Zs(n,e){let o=s=>new Date(s*1e3).toDateString();return o(n)===o(e)?_("Today"):o(n)===o(e-86400)?_("Yesterday"):new Date(n*1e3).toLocaleDateString(ie(),{weekday:"short",day:"numeric",month:"short"})}var xo="https://unpkg.com/maplibre-gl@6.14.0/dist",Qs={module:"sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk",css:"sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04"},Xs="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",er="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",Ai={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Jt=null;function Ni(n){if(n.appendChild(t("link",{rel:"stylesheet",href:`${xo}/maplibre-gl.css`,integrity:Qs.css,crossorigin:"anonymous"})),Jt)return Jt;let e=`${xo}/maplibre-gl.mjs`;return Jt=new Promise((s,r)=>{let a=t("link",{rel:"modulepreload",href:e,integrity:Qs.module,crossorigin:"anonymous"});a.addEventListener("load",()=>s()),a.addEventListener("error",()=>r(new Error("integrity"))),document.head.appendChild(a)}).then(()=>import(e)).then(s=>(s.getWorkerUrl()||s.setWorkerUrl(`${xo}/maplibre-gl-worker.mjs`),s),s=>{throw Jt=null,new Error(s?.message==="integrity"?_("The map library from the CDN is not the expected file: not loading it."):_("Could not load the map library (no internet access from this browser?)"))}),Jt}var Hi=10,tr=30,zi=62,Ri=4,nr=4.5,Ii=7,Ln="#3b82f6",wo="#8a8a8a";function or(n,e,o=.2,s=64){let[r,a]=n,[i,l]=e,d=i-r,c=d>180?i-360:d<-180?i+360:i,p=c-r,u=l-a,k=Math.hypot(p,u);if(k===0||o===0)return[n,[c,l]];let M=-u/k,g=p/k,h=k*o,E=(r+c)/2+M*h,H=(a+l)/2+g*h,S=[],$=Math.max(2,Math.floor(s));for(let b=0;b<=$;b+=1){let C=b/$,w=1-C;S.push([w*w*r+2*w*C*E+C*C*c,w*w*a+2*w*C*H+C*C*l])}return S}function yo(n,e){let o=new Map;for(let s of n.geo.points){if(n.person&&s.person!==n.person||n.device&&s.device!==n.device||(e==="online"?!s.online:n.now-s.ts>Ai[e]))continue;let r=n.device?et(s):n.person?`${s.device}|${s.city}|${s.cc}`:s.device,a=o.get(r);(!a||s.online&&!a.online||s.online===a.online&&s.ts>a.ts)&&o.set(r,s)}return[...o.values()]}function ko(n,e){let o=0;return yo(n,e).sort((s,r)=>Number(r.online)-Number(s.online)||r.ts-s.ts).map(s=>({...s,n:s.online?0:++o}))}var dt=class{constructor(e,o="online",s=380){this.cb=e;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.theme=null;this.resize=null;this.fitBlind=!1;this.data=null;this.fitted=!1;this.fitKey=null;this.people=[];this.slots=[];this.merged=[];this.piles=new Map;this.dock=null;this.dockKey="";this.dockQuiet=!1;this.piledKeys=new Set;this.foldedKeys=new Set;this.targetZoom=null;this.before=null;this.hiddenKey="";this.focused=null;this.dead=!1;this.places=new Map;this.replaying=null;this.bandDots=[];this.range=o,this.status=t("div",{class:"dl-map-status"}),this.card=t("div",{class:"dl-map-card","aria-live":"polite"}),this.el=t("div",{class:"dl-geomap",style:`height:${s}px`},[this.status,this.card])}async mount(e){this.data=e;try{this.gl=await Ni(this.el)}catch(s){this.status.textContent=s.message;return}if(this.dead)return;this.map=new this.gl.Map({container:this.el,style:xt()?Xs:er,center:[e.geo.home?.lon??20,e.geo.home?.lat??50],zoom:1,renderWorldCopies:!1,attributionControl:{compact:!0},minZoom:1}),this.map.on("style.load",()=>this.layers()),this.map.on("move",()=>this.declutter()),this.map.once("idle",()=>{let s=this.el.querySelector(".maplibregl-ctrl-attrib");s?.classList.remove("maplibregl-compact-show"),s?.removeAttribute("open")}),this.resize=new ResizeObserver(()=>{!this.map||!this.el.clientWidth||!this.el.clientHeight||(this.map.resize(),this.fitBlind&&(this.fitKey=null,this.draw()))}),this.resize.observe(this.el);let o=xt();this.theme=new MutationObserver(()=>{!this.map||xt()===o||(o=xt(),this.map.setStyle(o?Xs:er))}),this.theme.observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})}layers(){if(this.map){this.hiddenKey="",this.map.setProjection({type:"globe"}),this.map.addSource("dl-areas",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"dl-area",type:"circle",source:"dl-areas",paint:{"circle-radius":["interpolate",["exponential",2],["zoom"],2,6,6,26,9,140,12,900],"circle-color":["case",["get","online"],Ln,wo],"circle-opacity":["case",["get","online"],.12,.06],"circle-stroke-width":1,"circle-stroke-color":["case",["get","online"],Ln,wo],"circle-stroke-opacity":["case",["get","online"],.35,.15]}}),this.map.addSource("dl-band",{type:"geojson",data:{type:"FeatureCollection",features:this.bandDots}}),this.map.addLayer({id:"dl-band",type:"circle",source:"dl-band",paint:{"circle-radius":1.4,"circle-color":Ln,"circle-opacity":0}}),this.map.addSource("dl-arcs",{type:"geojson",data:{type:"FeatureCollection",features:[]}});for(let e of[!1,!0])this.map.addLayer({id:e?"dl-arc-live":"dl-arc-recent",type:"line",source:"dl-arcs",filter:["==",["get","online"],e],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":e?Ln:wo,"line-width":2,"line-opacity":.85,"line-dasharray":[2,2]}});this.draw()}}setRange(e){this.range=e,this.fitKey=null,this.draw()}update(e){this.data=e,this.draw()}destroy(){this.dead=!0,this.dropCard();for(let e of this.piles.values())e.marker.remove();this.piles.clear(),this.theme?.disconnect(),this.resize?.disconnect(),this.map?.remove(),this.map=null}groups(e){let o=new Map;for(let s of e){let r=`${s.person}|${et(s)}`,a=o.get(r);a||(a={key:r,person:s.person,lat:s.lat,lon:s.lon,city:s.city,country:s.country,cc:s.cc,asn:s.asn,org:s.org,online:!1,ts:0,points:[]},o.set(r,a)),a.points.push(s),a.online||(a.online=s.online),a.ts=Math.max(a.ts,s.ts)}return[...o.values()]}draw(){if(!this.map||!this.data||!this.map.getSource("dl-arcs"))return;let e=this.data,o=this.groups(yo(e,this.range)),s=e.person||e.device?null:e.geo.home;for(let d of this.markers)d.remove();this.markers=[];let r=e.person||e.device?null:Oi(o,s),a=o.map(d=>({g:d,at:r?.get(d.key)??[d.lon,d.lat]}));if(this.slots=[],this.map.getSource("dl-areas").setData({type:"FeatureCollection",features:a.map(({g:d})=>({type:"Feature",properties:{online:d.online,key:d.key},geometry:{type:"Point",coordinates:[d.lon,d.lat]}}))}),this.map.getSource("dl-arcs").setData({type:"FeatureCollection",features:s?a.map(({g:d,at:c})=>({type:"Feature",properties:{online:d.online,person:d.person,key:d.key},geometry:{type:"LineString",coordinates:or([s.lon,s.lat],c)}})):[]}),s){let d=t("span",{class:"dl-mk-host"});d.innerHTML=`${kt("server","dl-mk-host-ic")}`,this.dock=d.appendChild(t("span",{class:"dl-mk-dock"})),this.dockQuiet=this.dockKey!=="",this.dockKey="";let c=t("div",{class:"dl-mk-hub",title:`${_("Home router")}${s.city?` · ${s.city}`:""}${s.org?` · ${s.org}`:""}`},[d,t("span",{class:"dl-mk-label chip"},s.city||_("Home"))]);c.addEventListener("mouseenter",()=>this.showMerged(s.city)),c.addEventListener("mouseleave",()=>this.focus(this.focused)),c.addEventListener("click",()=>this.zoomToMerged()),this.add(c,[s.lon,s.lat],!0)}let i=new Map(e.device?ko(e,this.range).map(d=>[et(d),d.n]):[]);this.people=[],this.places.clear();for(let{g:d,at:c}of a){let p=d.points.length,u=e.people.find(h=>h.id===d.person);if(e.person){let h=e.device?this.deviceMarker(d,c,u,i.get(et(d))??0):this.placeMarker(d,c,u);this.add(h,c);continue}let k=d.points.map(h=>u?.devices.find(E=>E.id===h.device)?.kind??"other"),M=t("span",{class:"dl-mk-badge"});M.innerHTML=p<=2?k.map(h=>kt(h,"dl-mk-badge-ic")).join(""):String(p);let g=t("button",{type:"button",class:`dl-mk${d.online?" online":""}`,"aria-label":d.city?m(N_(p,"%s: %s device in %s","%s: %s devices in %s"),u?.name??_("Someone"),K(p),d.city):m(N_(p,"%s: %s device in an unknown city","%s: %s devices in an unknown city"),u?.name??_("Someone"),K(p))},[t("span",{class:"dl-mk-av"},[je(u?.name??"?"),M]),t("span",{class:"dl-mk-label below"},d.city||d.cc||"?")]);g.addEventListener("mouseenter",()=>this.focus(d.person)),g.addEventListener("mouseleave",()=>this.focus(null)),this.people.push({el:g,person:d.person}),g.addEventListener("click",h=>{h.stopPropagation(),this.openPopup(d,c,g)}),this.add(g,c,!1,u?.name??_("Someone"),`${d.city||d.cc||"?"} · ${d.online?_("now"):pe(d.ts,e.now)}`,d.key,d)}this.declutter();let l=a.map(d=>d.g.key).sort().join(";");if(l!==this.fitKey&&!this.popup){let d=this.fitted&&!this.fitBlind;if(this.fitBlind=!this.el.clientWidth||!this.el.clientHeight,this.fitKey=l,this.fitted=!0,s&&!a.length){let c={center:[s.lon,s.lat],zoom:12};d?this.glide(12,()=>this.map.flyTo({...c,duration:1200})):this.map.jumpTo(c)}else{let c=a.map(p=>p.at);s&&(c.length===0||this.range!=="online"||a.some(p=>p.g.online))&&c.push([s.lon,s.lat]),this.fit(c,d)}}this.status.textContent=a.length||s?"":_("No locations yet"),this.status.style.display=this.status.textContent?"":"none",this.focus(this.focused&&this.people.some(d=>d.person===this.focused)?this.focused:null)}add(e,o,s=!1,r,a,i,l){i&&this.foldedKeys.has(i)&&e.classList.add("merged"),i&&this.piledKeys.has(i)&&e.classList.add("piled"),e.dataset.key=i??"",e.classList.add("dl-mk-new"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("dl-mk-new")));let d=new this.gl.Marker({element:e}).setLngLat(o).addTo(this.map);this.markers.push(d),this.slots.push({marker:d,el:e,at:o,fixed:s,who:r,where:a,g:l})}declutter(){if(!this.map)return;let e=this.map.getZoom();this.el.classList.toggle("dl-lod-far",e=nr&&e{let l=this.map.project(i.at),d=i.el.querySelector(":scope > .dl-mk-host, :scope > .dl-mk-av, :scope > .dl-mk-tile");return{x:l.x,y:l.y,r:(d?.offsetWidth||24)/2+3,fixed:i.fixed}}),s=o.filter(i=>i.fixed);this.merged=[],this.foldedKeys.clear();let r=this.targetZoom==null?1:Math.min(1,2**(this.targetZoom-this.map.getZoom()));o.forEach((i,l)=>{if(i.fixed)return;let d=this.slots[l],c=d.el.classList.contains("merged")?12:6,p=s.find(u=>Math.hypot(u.x-i.x,u.y-i.y)*r{let c=this.slots[d];!c||c.fixed||(o[d].fixed&&([i,l]=[0,0]),c.marker.setOffset([i,l]),Ui(c.el,i,l))})}closePopup(e=!1){let o=this.popup;if(!o||o.card.classList.contains("leaving"))return;o.card.classList.add("leaving"),setTimeout(()=>{this.popup===o&&this.dropCard()},140);let s=this.before;if(this.before=null,!s)return;let r=()=>this.map?.flyTo({...s,duration:800});if(!e)return r();let a=!1,i=()=>{a||(a=!0,window.removeEventListener("pointerup",i,!0),window.removeEventListener("pointercancel",i,!0),setTimeout(r,0))};window.addEventListener("pointerup",i,!0),window.addEventListener("pointercancel",i,!0),setTimeout(i,1500)}dropCard(){this.popup?.off(),this.popup?.card.remove(),this.popup=null}showMerged(e){this.merged.length&&(dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},e?m(_("Near %s"),e):_("Near the server")),` · ${_("click to zoom in")}`]),...this.merged.map(o=>t("div",{class:"dl-map-card-row"},[t("span",{},o.who),t("span",{class:"dl-faint"},o.where)]))]),this.card.classList.add("on"))}paintDock(){let e=this.dock;if(!e)return;let o=this.merged.map(r=>`${r.key}:${r.online?1:0}`).join("|");if(o===this.dockKey)return;this.dockKey=o,e.parentElement?.classList.toggle("docked",this.merged.length>0);let s=this.slots.find(r=>r.fixed).at;this.merged.length&&rr(e,this.merged,this.faceActions(()=>[s]),this.dockQuiet),this.dockQuiet=!1}faceActions(e){return{click:(o,s)=>this.openFace(o,s,e()),hover:o=>this.focus(o?.g?.person??null)}}pileUp(e){let o=new Set;if(!this.data?.person&&!this.data?.device){let s=e.flatMap((l,d)=>!l.fixed&&this.slots[d].el.querySelector(":scope > .dl-mk-av")?[d]:[]),r=new Map(s.map(l=>[l,l])),a=l=>r.get(l)===l?l:a(r.get(l));for(let l of s)for(let d of s){if(d<=l)continue;let c=this.slots[l].el.classList.contains("piled")&&this.slots[d].el.classList.contains("piled");Math.hypot(e[l].x-e[d].x,e[l].y-e[d].y)this.slots[h]),c=d.map(sr),p=c.map(h=>h.key).sort().join(",");o.add(p);let u=[d.reduce((h,E)=>h+E.at[0],0)/d.length,d.reduce((h,E)=>h+E.at[1],0)/d.length],k=this.piles.get(p);if(!k){let h=t("span",{class:"dl-mk-pile-box"}),E=[...new Set(d.map($=>$.g?.city||$.g?.cc||"?"))],H=t("div",{class:"dl-mk-pile"},[h,t("span",{class:"dl-mk-label below"},E.length===1?E[0]:W(d.length,"%s person","%s people"))]);k={marker:new this.gl.Marker({element:H}).setLngLat(u).addTo(this.map),el:H,box:h,faces:c},H.addEventListener("mouseleave",()=>this.focus(this.focused));let S=k;H.addEventListener("click",$=>{$.stopPropagation(),this.zoomInTo(S.faces.map(b=>b.at),!1)}),this.piles.set(p,k)}k.faces=c;let M=k;rr(k.box,c,this.faceActions(()=>M.faces.map(h=>h.at)));for(let h of l)this.slots[h].el.classList.add("piled"),Object.assign(e[h],{r:0,fixed:!0});let g=this.map.project(u);e.push({x:g.x,y:g.y,r:(k.el.offsetWidth||60)/2+3,fixed:!0})}}this.piledKeys=new Set(this.slots.filter(s=>s.el.classList.contains("piled")).map(s=>s.el.dataset.key??"")),this.slots.forEach((s,r)=>{(!e[r].fixed||s.fixed||s.el.classList.contains("merged"))&&s.el.classList.remove("piled")});for(let[s,r]of this.piles)o.has(s)||(this.piles.delete(s),r.el.classList.add("out"),setTimeout(()=>r.marker.remove(),200))}zoomToMerged(){!this.map||!this.merged.length||this.zoomInTo([this.slots.find(e=>e.fixed).at,...this.merged.map(e=>e.at)],!1)}openFace(e,o,s){if(!e.g)return;if(s.every(a=>Mn(a,e.at)<1))return this.openPopup(e.g,e.at,o);let r=()=>{let a=this.slots.find(i=>i.el.dataset.key===e.key);a?.g&&!a.el.classList.contains("merged")&&!a.el.classList.contains("piled")&&this.openPopup(a.g,a.at,a.el)};this.zoomInTo(this.nearby(e.at),!0)?this.map.once("moveend",r):r()}nearby(e){return[e,...this.slots.filter(o=>!o.fixed&&o.at!==e&&Mn(o.at,e)<=tr).map(o=>o.at)]}zoomInTo(e,o){let s=new this.gl.LngLatBounds;for(let p of e)s.extend(p);let r=e.some(p=>e.some(u=>Mn(p,u)>tr)),a=this.map.cameraForBounds(s,{padding:50,maxZoom:r?12:Hi}),i=this.map.getZoom(),l=e.map(p=>this.map.project(p)),d=0;l.forEach((p,u)=>l.slice(u+1).forEach(k=>{let M=Math.hypot(p.x-k.x,p.y-k.y),g=i+Math.log2(zi/Math.max(M,1e-6));g<=12&&(d=Math.max(d,g))}));let c=Math.min(12,Math.max(a?.zoom??0,d));return c<=i+.05?!1:(o&&!this.before&&(this.before={center:this.map.getCenter().toArray(),zoom:i}),this.map.flyTo({center:a?.center??s.getCenter(),zoom:c,duration:800}),!0)}placeMarker(e,o,s){let r=this.data.now,a=[...e.points].sort((u,k)=>Number(k.online)-Number(u.online)||k.ts-u.ts)[0],i=s?.devices.find(u=>u.id===a.device)?.kind??"other",l=e.points.length,d=t("span",{class:"dl-mk-tile"});d.innerHTML=kt(i,"dl-mk-tile-ic")+(l>1?`${l}`:"");let c=e.online?_("now"):pe(e.ts,r),p=t("button",{type:"button",class:`dl-mk place${e.online?" online":""}`,style:e.online?null:`--dl-mk-fade:${Math.max(.4,1-.6*(r-e.ts)/(30*86400)).toFixed(2)}`,"aria-label":e.city?m(N_(l,"%s device in %s, %s","%s devices in %s, %s"),K(l),e.city,c):m(N_(l,"%s device in an unknown city, %s","%s devices in an unknown city, %s"),K(l),c)},[d,t("span",{class:"dl-mk-label below"},[e.city||e.cc||"?",t("span",{class:"dl-mk-when"},c)])]);return p.addEventListener("click",u=>{u.stopPropagation(),this.openPopup(e,o,p)}),p}deviceMarker(e,o,s,r){let a=s?.devices.find(p=>p.id===e.points[0].device)?.kind??"other",i=t("span",{class:"dl-mk-tile"}),l=t("span",{class:"dl-mk-label below"}),d=t("button",{type:"button",class:"dl-mk place step"},[i,l]);d.addEventListener("click",p=>{p.stopPropagation(),this.openPopup(e,o,d)});let c=et(e);return this.places.set(c,{el:d,tile:i,label:l,when:null,g:e,n:r,kind:a}),this.paintPlace(c,!1),d}paintPlace(e,o){let s=this.places.get(e);if(!s)return;let r=this.replaying,a=r?r.active===e:s.g.online,i=s.el.classList.contains("online"),l=s.g.city||s.g.cc||"?";s.el.classList.toggle("online",a),s.el.classList.toggle("faded",!!r&&!a),s.tile.classList.toggle("sm",!a),a||!s.n?s.tile.innerHTML=kt(s.kind,"dl-mk-tile-ic"):s.tile.textContent=String(s.n),s.when=null,a?(s.when=t("span",{class:`dl-mk-when${r?" inline":""}`},r?r.when:_("now")),s.label.replaceChildren(l,r?" · ":"",s.when)):s.label.replaceChildren(`${l} · ${s.g.online?_("now"):pe(s.g.ts,this.data.now)}`);let d=a?r?r.when:_("now"):s.g.online?_("now"):pe(s.g.ts,this.data.now);s.el.setAttribute("aria-label",`${s.n?`${s.n}: `:""}${s.g.city||_("an unknown city")}, ${d}`),o&&a&&!i&&(s.el.classList.remove("arrive"),s.el.offsetWidth,s.el.classList.add("arrive"),setTimeout(()=>s.el.classList.remove("arrive"),500))}replay(e,o=!0){let s=this.replaying;if(this.replaying=e,s&&e&&s.active===e.active){let r=e.active?this.places.get(e.active):null;r?.when&&(r.when.textContent=e.when);return}for(let r of this.places.keys())r!==e?.active&&this.paintPlace(r,o);e?.active&&this.paintPlace(e.active,o),this.declutter(),setTimeout(()=>this.declutter(),320)}hoverPlace(e){for(let[o,s]of this.places)s.el.classList.toggle("hl",o===e)}band(e,o){if(this.bandDots=[],this.map&&e&&o){let s=or(e,o),r=s.map(c=>this.map.project(c)),a=[0];for(let c=1;ca[d]?(p-a[d])/(a[d+1]-a[d]):0,k=[s[d][0]+(s[d+1][0]-s[d][0])*u,s[d][1]+(s[d+1][1]-s[d][1])*u];this.bandDots.push({type:"Feature",properties:{pos:c/l},geometry:{type:"Point",coordinates:k}})}}this.map?.getLayer("dl-band")&&(this.map.setPaintProperty("dl-band","circle-opacity",0),this.map.getSource("dl-band").setData({type:"FeatureCollection",features:this.bandDots}))}bandAt(e){this.map?.getLayer("dl-band")&&this.map.setPaintProperty("dl-band","circle-opacity",Vs(e))}focus(e){this.focused=e;for(let i of this.people)i.el.classList.toggle("dim",!!e&&i.person!==e),i.el.classList.toggle("hl",i.person===e);let o=e?["case",["==",["get","person"],e],.85,.15]:.85;for(let i of["dl-arc-live","dl-arc-recent"])this.map?.getLayer(i)&&this.map.setPaintProperty(i,"line-opacity",o);if(this.card.classList.toggle("on",!!e),!e||!this.data)return;let s=this.data,r=s.people.find(i=>i.id===e),a=yo(s,this.range).filter(i=>i.person===e).sort((i,l)=>Number(l.online)-Number(i.online)||l.ts-i.ts);dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},r?.name??e),` · ${W(a.length,"%s device","%s devices")}`]),...a.map(i=>t("div",{class:"dl-map-card-row"},[t("span",{},r?.devices.find(l=>l.id===i.device)?.name??_("Device")),t("span",{class:"dl-faint"},`${i.city||i.cc||"?"} · ${i.online?_("now"):pe(i.ts,s.now)}`)]))])}fit(e,o=!1){if(!e.length)return;let s=(p,u)=>{let k=Math.PI/180,M=(u[1]-p[1])*k,g=(u[0]-p[0])*k,h=Math.sin(M/2)**2+Math.cos(p[1]*k)*Math.cos(u[1]*k)*Math.sin(g/2)**2;return 12742*Math.asin(Math.sqrt(h))},r=[e.reduce((p,u)=>p+u[0],0)/e.length,e.reduce((p,u)=>p+u[1],0)/e.length],a=e;if(e.length>=5){let p=[...e].sort((u,k)=>s(r,u)-s(r,k));a=p.slice(0,Math.ceil(p.length*.9))}let i=new this.gl.LngLatBounds(a[0],a[0]);a.forEach(p=>i.extend(p));let l=this.el.clientHeight||380,d=!!this.data?.person,c={padding:{top:this.data?.device?Math.min(56,l/4):Math.min(60,l/5),bottom:d?Math.min(52,l/4):Math.min(40,l/8),left:48,right:48},maxZoom:this.data?.person?11:12};o?this.glide(this.map.cameraForBounds(i,c)?.zoom??null,()=>this.map.fitBounds(i,{...c,duration:1200})):this.map.fitBounds(i,{...c,duration:0})}glide(e,o){this.targetZoom=e,this.declutter(),this.map.once("moveend",()=>{this.targetZoom=null,this.declutter()}),o()}openPopup(e,o,s){let r=this.data,a=[e.city,e.cc||e.country].filter(Boolean).join(", "),i=[...new Set(e.points.map(b=>b.person))],l=i.length===1?r.people.find(b=>b.id===i[0])?.name:void 0,d=e.points.sort((b,C)=>Number(C.online)-Number(b.online)||C.ts-b.ts).map(b=>{let C=r.people.find(z=>z.id===b.person),w=C?.devices.find(z=>z.id===b.device);return t("button",{type:"button",class:"dl-pop-row",click:()=>this.cb.openDevice(b.person,b.device)},[t("span",{class:`dl-pop-dot${b.online?" on":""}`}),t("span",{class:"dl-pop-name"},[t("b",{},C?.name??b.person),` · ${w?.name??_("device")}`]),t("span",{class:"dl-faint dl-nowrap"},b.online?_("now"):pe(b.ts,r.now))])}),c=t("div",{class:"dl-pop"},[t("div",{class:"dl-pop-head"},[t("span",{class:"dl-pop-net"},v("globe")),t("div",{class:"dl-stack"},[t("strong",{},e.org||_("Unknown network")),t("span",{class:"dl-faint"},[e.asn?`AS${e.asn} · `:"",a?`${a} · ${_("approximate")}`:_("approximate location")])])]),t("div",{class:"dl-pop-list"},d),i.length===1?t("div",{class:"dl-pop-actions"},[t("button",{type:"button",class:"cbi-button cbi-button-positive important",click:()=>this.cb.openPerson(i[0])},l?m(_("Open %s"),l):_("Open person"))]):""]);this.zoomInTo(this.nearby(o),!0),this.dropCard();let p=t("div",{class:"dl-root dl-popcard",role:"dialog"},[t("span",{class:"dl-popcard-tip"}),c]);document.body.appendChild(p);let u=this.el,k=s?.querySelector(".dl-mk-av, .dl-mk-tile")??s??null,M=()=>{if(!k)return;let b=k.getBoundingClientRect(),C=u.getBoundingClientRect(),w=b.left+b.width/2,z=b.top+b.height/2;p.classList.toggle("away",wC.right||zC.bottom);let y=p.offsetWidth,f=p.offsetHeight,x=b.top-f-12>=8||b.top>window.innerHeight-b.bottom,T=Math.min(Math.max(8,w-y/2),window.innerWidth-y-8);p.classList.toggle("above",x),p.classList.toggle("below",!x),p.style.left=`${T}px`,p.style.top=`${x?b.top-f-12:b.bottom+12}px`,p.style.setProperty("--tip-x",`${w-T}px`)},g=b=>{b.target?.closest(".dl-popcard, .maplibregl-marker")||this.closePopup(!0)},h=b=>{b.key==="Escape"&&this.closePopup()},E=b=>{b.target instanceof Element&&b.target.closest(".dl-popcard")||this.closePopup()},H=()=>this.closePopup();this.map.on("move",M),window.addEventListener("scroll",E,{capture:!0,passive:!0}),window.addEventListener("resize",M),document.addEventListener("pointerdown",g,!0),document.addEventListener("keydown",h);let S=Te(H);window.addEventListener("pagehide",H),this.popup={card:p,off:()=>{this.map?.off("move",M),window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",M),document.removeEventListener("pointerdown",g,!0),document.removeEventListener("keydown",h),S(),window.removeEventListener("pagehide",H)}};let $=window.setInterval(()=>{if(this.popup?.card!==p)return clearInterval($);(!u.isConnected||!u.getClientRects().length)&&this.dropCard()},400);M()}};function Bi(n,e=6){let o=n.map(s=>({x:s.x,y:s.y}));for(let s=0;s<16;s++){let r=!1;for(let a=0;a[s.x-n[r].x,s.y-n[r].y])}function Oi(n,e){let o=new Map,s=e?[[e.lon,e.lat]]:[],r=a=>s.some(i=>Mn(a,i)<1.3);for(let a of[...n].sort((i,l)=>i.key>>12)/1048575),d=(i&4095)/4096*2*Math.PI,c=[a.lon,a.lat];for(let p=0;p<24;p++){let u=d+p*2.39996,k=Math.min(8,l+p*.25);if(c=[a.lon+k*Math.sin(u)/(111.32*Math.cos(a.lat*Math.PI/180)),a.lat+k*Math.cos(u)/111.32],!r(c))break}s.push(c),o.set(a.key,c)}return o}function ji(n){let e=2166136261;for(let o=0;o>>0}function sr(n){return{key:n.el.dataset.key??"",who:n.who??_("Someone"),where:n.where??"",online:!!n.g?.online,at:n.at,badge:n.el.querySelector(".dl-mk-badge")?.innerHTML??"",g:n.g}}function rr(n,e,o,s=!1){let r=e.length>3,a=()=>[...n.children].filter(g=>!g.classList.contains("out")),i=new Map(a().map(g=>[g,g.getBoundingClientRect().left])),l=n.getBoundingClientRect().width,d=new Map;n.querySelectorAll(".dl-mk-face:not(.out)").forEach(g=>d.set(g.dataset.key??"",g));let c=n.querySelector(".dl-mk-more:not(.out)"),p=g=>{Object.assign(g.style,{position:"absolute",left:`${g.offsetLeft}px`,top:`${g.offsetTop}px`,transform:""}),g.classList.add("out"),setTimeout(()=>g.remove(),200)},u=[];for(let g of e.slice(0,r?2:3)){let h=d.get(g.key);if(d.delete(g.key),!h){let S=t("button",{type:"button",class:`dl-mk-face${s?"":" in"}`,"data-key":g.key},[t("span",{class:"dl-mk-av"},je(g.who)),t("span",{class:"dl-mk-badge"})]);S.addEventListener("animationend",()=>S.classList.remove("in"),{once:!0}),h=S}let E=h,H=E.querySelector(".dl-mk-badge");H.innerHTML!==g.badge&&(H.innerHTML=g.badge),E.title=`${g.who} · ${g.where}`,E.setAttribute("aria-label",`${g.who}, ${g.where}`),E.classList.toggle("on",g.online),E.onclick=S=>{S.stopPropagation(),o.click(g,E)},E.onmouseenter=()=>o.hover(g),E.onmouseleave=()=>o.hover(null),u.push(E)}for(let g of d.values())p(g);if(r){if(!c){c=t("span",{class:`dl-mk-more${s?"":" in"}`});let g=c;g.addEventListener("animationend",()=>g.classList.remove("in"),{once:!0})}c.textContent=`+${e.length-2}`,u.push(c)}else c&&p(c);let k=null;for(let g of u)(k?k.nextElementSibling:n.firstElementChild)!==g&&(k?k.after(g):n.prepend(g)),k=g;for(let g of u){let h=i.get(g);if(h==null)continue;let E=h-g.getBoundingClientRect().left;Math.abs(E)<.5||(g.style.transition="none",g.style.transform=`translateX(${E}px)`,g.offsetWidth,g.style.transition="",g.style.transform="")}n.style.width="";let M=n.getBoundingClientRect().width;if(l&&Math.abs(M-l)>.5){n.style.width=`${l}px`,n.offsetWidth,n.style.width=`${M}px`;let g=()=>{n.style.width="",n.removeEventListener("transitionend",g)};n.addEventListener("transitionend",g),setTimeout(g,400)}}function Mn(n,e){let o=Math.PI/180,s=Math.sin((e[1]-n[1])*o/2)**2+Math.cos(n[1]*o)*Math.cos(e[1]*o)*Math.sin((e[0]-n[0])*o/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(s)))}function Ui(n,e,o){let s=n.querySelector(":scope > .dl-mk-ptr"),r=Math.hypot(e,o);if(r<1){s?.remove();return}s||(s=t("span",{class:"dl-mk-ptr"},[t("i",{class:"line"}),t("i",{class:"spot"})]),n.prepend(s));let a=s.firstElementChild,i=s.lastElementChild;a.style.width=`${r}px`,a.style.transform=`rotate(${Math.atan2(-o,-e)}rad)`,i.style.transform=`translate(${-e}px, ${-o}px)`}function Rt(n,e,o=!0){let s=[["online",_("Online now")],["24h",_("24h")],["7d",_("7 days")],["30d",_("30 days")]],r=t("div",{class:"dl-seg",role:"tablist"});for(let[a,i]of s)a==="online"&&!o||r.appendChild(t("button",{type:"button",role:"tab",class:a===n?"on":"","data-v":a,click:()=>{r.querySelectorAll("button").forEach(l=>l.classList.toggle("on",l.dataset.v===a)),e(a)}},i));return r}var ar={"24h":86400,"7d":7*86400,"30d":30*86400},_o=(n,e)=>`${(n/e*100).toFixed(3)}%`,En=class{constructor(e,o,s){this.map=e;this.range=o;this.el=t("div",{class:"dl-dplaces"});this.controls=t("div",{class:"dl-map-replay"});this.pending=null;this.rows=new Map;this.st=[];this.steps=[];this.total=0;this.ms=0;this.stepI=-1;this.on=!1;this.playing=!1;this.raf=0;this.last=0;this.endTimer=0;this.play=t("button",{type:"button",class:"dl-map-btn"});this.chip=t("span",{class:"dl-map-chip"});this.stop=t("button",{type:"button",class:"dl-map-btn",title:_("Back to now"),"aria-label":_("Back to now")},v("x"));this.reduced=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;this.data=s,this.play.addEventListener("click",()=>this.toggle()),this.stop.addEventListener("click",()=>this.end()),this.paint()}mapData(){let e=this.data;return{geo:e.geo,people:[e.person],now:e.now,person:e.person.id,device:e.device.id}}update(e){let o={...this.pending??this.data,...e};if(this.on){this.pending=o;return}this.data=o,this.map.update(this.mapData()),this.paint()}setRange(e){this.end(),this.range=e,this.map.setRange(e),this.paint()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.endTimer)}paint(){let e=this.data,o=ar[this.range],s=e.now-o,r=Os(Bs(e.events??[],e.device.id,e.now,e.device.online,e.device.handshake),e.geo.points,e.device.id,s),a=js(r);this.st=Us(r);let i=ko(this.mapData(),this.range),l=r.length>0;this.el.classList.toggle("strips",l),this.el.classList.toggle("can-replay",this.st.length>1),this.rows.clear(),dom.content(this.el,i.length?[...i.map(d=>{let c=et(d),p=a.get(c),u=l?t("div",{class:`dl-dplace-strip${d.online?" live":""}`},r.filter(M=>M.key===c).map(M=>t("i",{style:`left:${_o(M.from-s,o)};width:${_o(M.to-M.from,o)}`}))):"",k=t("div",{class:"dl-dplace-row"},[t("span",{class:`dl-dplace-n${d.online?" live":""}`},d.online?v(e.device.kind):String(d.n)),t("span",{class:"dl-row-main dl-stack"},[t("span",{},[d.city||d.cc||_("Unknown city"),d.org?t("span",{class:"dl-muted"},` · ${d.org}`):""]),t("span",{class:"dl-faint"},[t("span",{class:"dl-mono"},d.ip),p!=null?` · ${m(_("%s%% of the time"),p>0&&p<.005?"<1":Math.round(p*100))}`:""])]),t("span",{class:d.online?"dl-dplace-now":"dl-faint dl-nowrap"},d.online?_("now"):pe(d.ts,e.now)),u]);if(k.addEventListener("mouseenter",()=>this.map.hoverPlace(c)),k.addEventListener("mouseleave",()=>this.map.hoverPlace(null)),u){let M=g=>{let h=u.getBoundingClientRect();this.seek(s+o*Math.min(1,Math.max(0,(g.clientX-h.left)/h.width)))};u.addEventListener("pointerdown",g=>{u.setPointerCapture(g.pointerId),M(g)}),u.addEventListener("pointermove",g=>g.buttons&&M(g))}return this.rows.set(c,k),k}),l?t("div",{class:"dl-dplace-axis"},Js(this.range,e.now).map(([d,c])=>t("span",{style:`left:${(d*100).toFixed(2)}%`},c))):""]:t("div",{class:"dl-sub"},_("No locations in this period."))),this.paintControls()}paintControls(){dom.content(this.play,v(this.playing?"pause":"play")),this.play.title=this.playing?_("Pause","replay"):_("Replay this period"),this.play.setAttribute("aria-label",this.play.title),dom.content(this.controls,this.on?[this.play,this.chip,this.stop]:this.st.length>1?[this.play]:[])}begin(){this.on=!0,{steps:this.steps,total:this.total}=Gs(this.st,this.reduced?400:bo),this.ms=0,this.stepI=-1,this.map.replay({active:null,when:""},!0)}toggle(){if(this.playing){this.playing=!1,cancelAnimationFrame(this.raf),this.paintControls();return}clearTimeout(this.endTimer),(!this.on||this.ms>=this.total)&&this.begin(),this.playing=!0,this.last=performance.now(),this.paintControls(),this.raf=requestAnimationFrame(e=>this.frame(e))}frame(e){if(this.playing){if(this.ms=Math.min(this.total,this.ms+(e-this.last)),this.last=e,this.show(!0),this.msthis.frame(o));return}this.playing=!1,this.paintControls(),this.endTimer=window.setTimeout(()=>this.end(),1500)}}seek(e){this.st.length<2||(clearTimeout(this.endTimer),this.on||this.begin(),this.ms=Fs(this.st,this.steps,e),this.stepI=-1,this.show(!1),this.paintControls())}show(e){let o=qs(this.st,this.steps,this.ms),s=this.st[o.step.k];if(o.step.kind==="move"){let i=this.st[o.step.k-1];o.i!==this.stepI&&(this.map.replay({active:null,when:""},e),this.map.band([i.point.lon,i.point.lat],[s.point.lon,s.point.lat]));let l=Ks(o.q);this.reduced||this.map.bandAt(l),(this.reduced?o.q>=.5:Ys(l))&&this.map.replay({active:s.key,when:Cn(o.t)},e)}else o.i!==this.stepI&&this.map.band(),this.map.replay({active:s.key,when:Cn(o.t)},e);this.stepI=o.i;let r=this.data,a=r.now-ar[this.range];this.el.classList.add("replay"),this.el.style.setProperty("--at",_o(o.t-a,r.now-a));for(let[i,l]of this.rows)l.classList.toggle("cur",i===s.key);this.chip.textContent=`${Zs(o.t,r.now)}, ${Cn(o.t)} · ${s.point.city||s.point.cc||"?"}`}end(){if(cancelAnimationFrame(this.raf),clearTimeout(this.endTimer),!!this.on){this.on=!1,this.playing=!1,this.ms=0,this.stepI=-1,this.map.band(),this.map.replay(null,!1),this.el.classList.remove("replay");for(let e of this.rows.values())e.classList.remove("cur");this.pending?(this.data=this.pending,this.pending=null,this.map.update(this.mapData()),this.paint()):this.paintControls()}}};function It(n){return`${L.url("admin/network/dawnline/server")}?${n?`server=${encodeURIComponent(n)}&`:""}section=people`}function Re(n,e){return`${L.url("admin/network/dawnline/person")}?id=${encodeURIComponent(n)}${e?`&device=${encodeURIComponent(e)}`:""}`}function Wi(n){return n?new Date(n*1e3).toLocaleString(ie(),{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Co(n,e,o=!1){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("button",{type:"button",class:`dl-kvrow-v copy${o?" dl-mono":""}`,title:_("Copy"),click:()=>xe(e,m(_("%s copied"),n))},[t("span",{},e),v("copy")])])}function Tn(n,e){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("span",{class:"dl-kvrow-v"},e)])}var ir={connect:["ok","plug"],disconnect:["","plug"],roam:["","network"],device_added:["ok","plus"],device_removed:["","trash"],device_keys:["","reset"]};function Gi(n){let e=s=>t("span",{class:"dl-muted"},s),o=Ve(n)==="portal"?_("on the portal"):Ve(n)==="admin"?_("by you"):"";switch(n.type){case"connect":return[...n.detail?ae(_("Connected from %s"),e(n.detail)):[_("Connected")],n.where?e(` · ${n.where}`):""];case"disconnect":return[_("Went offline")];case"roam":return[_("Changed network"),e(` · ${n.detail??""}`)];case"device_added":return o?ae(_("Added %s"),e(o)):[_("Added")];case"device_removed":return o?ae(_("Removed %s"),e(o)):[_("Removed")];default:return o?ae(_("New keys %s"),e(o)):[_("New keys")]}}function qi(n,e,o){let s=n.filter(r=>r.device===e&&ir[r.type]).reverse().slice(0,12);return s.length?t("div",{class:"dl-dev-log"},s.map(r=>{let[a,i]=ir[r.type],l=new Date(r.ts*1e3);return t("div",{class:`dl-dev-log-row${Ve(r)==="admin"?" dl-ev-by-admin":""}`},[Ve(r)==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:`dl-ev-tile ev ${a}`},v(i)),t("span",{class:"dl-row-main"},Gi(r)),t("span",{class:"dl-faint dl-nowrap",title:l.toLocaleString(ie())},pe(r.ts,o))])})):t("div",{class:"dl-sub"},_("No activity yet."))}async function lr(n,e,o){let s=await N.status(1).catch(()=>null),r=s?.people.find(i=>i.id===n),a=r?.devices.find(i=>i.id===e);s&&r&&a&&Je(r,a,{...o,geo:s.geo,now:s.now,today:Ge(s.series),core:zt(s.servers,r.server)})}async function Je(n,e,o){let s=await F(()=>N.deviceConfig(e.id));if(!s)return;let r=o.core??qe(null),a=e,i=n,l=o.geo,d=o.now,c=o.today??Ke(new Date),p=await r.connectBlock(s,e.kind==="phone"||e.kind==="tablet"?"qr":"file"),u=t("div",{class:"dl-drawer-title"}),k=t("div",{}),M=t("div",{}),g=t("div",{},t("div",{class:"dl-sub"},_("Loading…"))),h=[],E=se=>{h=se.filter(j=>j.device===a.id),dom.content(g,qi(se,a.id,d)),b?.update({events:se})},H=async(se=!1)=>{let j=o.events?.();if(j&&!se)return E(j);let V=await N.events(2e3,n.id).catch(()=>null);V&&E(V.events)},S="30d",$=null,b=null,C=()=>{dom.content(u,[t("span",{class:`dl-dcard-ic${a.online?" on":""}`},v(a.kind)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h3",{},a.name),A([v("edit")],()=>y(),"neutral",{title:_("Rename"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),t("span",{class:"dl-sub"},`${i.name} · ${at(a.kind)}`)])]);let se=a.spark.reduce((j,V)=>j+V,0);dom.content(k,t("div",{class:"dl-dstats"},[t("div",{class:"dl-dstats-cell wide"},[t("span",{class:"dl-metric-label"},_("Status")),dn(a,d,_("Waiting for the first connection"),i)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("This month")),t("b",{},oe(a.month[0]+a.month[1])),t("span",{class:"dl-sub dl-mono"},`↓ ${oe(a.month[1])} ↑ ${oe(a.month[0])}`)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("Last 7 days")),t("b",{},oe(se)),Es(a.spark,120,22,c)])])),dom.content(M,t("div",{class:"dl-kv2"},[Co(_("Tunnel address"),a.address),a.hostname&&i.access!=="internet"?Co(_("Local address"),a.hostname):"",a.endpoint&&!l?.points.some(j=>j.device===a.id&&j.ip===a.endpoint)?Tn(_("Client IP"),a.endpoint):"",Tn(_("Total"),t("span",{class:"dl-kv-act"},[`↓ ${oe(a.total[1])} · ↑ ${oe(a.total[0])}`,t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("device",a.id,a.name,()=>setTimeout(z,300))},_("Reset"))])),Tn(_("Added"),`${Wi(a.created)} · ${a.created_by==="portal"?_("from the portal"):_("by you")}`),s.amnezia.client_pub_key?Co(_("Public key"),s.amnezia.client_pub_key):Tn(_("Public key"),"—")])),dom.content(f,[A([v(a.disabled?"play":"pause")," ",a.disabled?_("Enable"):_("Disable")],async()=>{await F(()=>N.deviceUpdate(a.id,void 0,!a.disabled),a.disabled?_("Device enabled"):_("Device disabled"))&&await z()},"neutral",a.disabled?{}:{class:"cbi-button cbi-button-neutral dl-btn-warn"}),A([v("key")," ",_("New keys")],async()=>{if(!await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0))return;await F(()=>N.deviceRotate(a.id),_("New keys generated"))&&(o.refresh(),fe.close(),await lr(i.id,a.id,o))}),t("span",{class:"dl-spacer"}),A([v("trash")," ",_("Remove")],async()=>{await me(m(_("Remove %s?"),a.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(a.id),_("Device removed"))&&(fe.close(),o.refresh())},"negative")])},w=async()=>{let se=await N.status(1).catch(()=>null),j=se?.people.find(le=>le.id===i.id),V=j?.devices.find(le=>le.id===a.id);!se||!j||!V||(i=j,a=V,l=se.geo,d=se.now,c=Ge(se.series),C(),b?.update({geo:se.geo,now:se.now,person:i,device:a}))},z=async()=>{await w(),o.refresh()},y=()=>{let se=t("input",{type:"text",class:"cbi-input-text",value:a.name,maxlength:48}),j=i.devices.filter(le=>le.id!==a.id).map(le=>le.name),V=Ee(_("Name"),se,()=>He(se.value,j,_("Shown in the portal and in the app.")));de(m(_("Rename %s"),a.name),[V],[ue()," ",A(_("Save"),async()=>{let le=V.help();if(le.bad){q(le.text,"warning");return}await F(()=>N.deviceUpdate(a.id,se.value,void 0),_("Renamed"))&&(ce(),await z())},"positive")]),setTimeout(()=>se.select(),50)},f=t("div",{class:"dl-drawer-actions"}),x=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Connect","section"))]),a.config_stale?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below."))]):"",p]),T=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Activity")),t("div",{class:"dl-dsec-actions"},[t("button",{type:"button",class:"dl-linkbtn",click:()=>Qe({people:[i]},h,"csv",a.id)},_("Export")),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>lt(m(_("Clear %s's activity"),a.name),m(_("Removes events about %s."),a.name),{device:a.id},()=>{H(!0),o.refresh()})},_("Clear")),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All activity"))])]),g]),I=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},t("h4",{},_("Details","section"))),M]),Y="";if(l?.enabled){$=new dt({openPerson:j=>location.href=Re(j),openDevice:(j,V)=>location.href=Re(j,V)},S,220);let se=b=new En($,S,{geo:l,now:d??Date.now()/1e3,person:i,device:a,events:o.events?.()??null});Y=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Locations")),Rt(S,j=>{S=j,se.setRange(j)},!1)]),t("div",{class:"dl-dmap"},[$.el,se.controls]),se.el])}let J=!a.handshake||a.config_stale,te=t("div",{class:"dl-stack gap16"},J?[k,x,I,Y,T]:[k,I,Y,T,x]);H();let B=()=>{w(),H()},Q=_n(B),ne=window.setInterval(B,3e4),fe=Xo(u,te,f,()=>{clearInterval(ne),Q(),b?.destroy(),$?.destroy()});C(),$&&b&&requestAnimationFrame(()=>b&&$?.mount(b.mapData()))}function dr(n,e,o,s){let r=s.core??qe(null),a=()=>F(()=>N.deviceConfig(o.id)),i=[{label:_("Show QR code"),icon:v("qr"),run:async()=>{let l=await a();l&&de(`${o.name} · ${_("QR code")}`,t("div",{class:"dl-qr-pane"},[un(r.qrText(l)),t("span",{class:"dl-sub"},ho(l)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),ue(_("Close")))}},{label:r.file.label,icon:v("download"),run:async()=>{let l=await a();if(!l)return;let d=r.file.make(l);Ne(d.name,d.text,"application/octet-stream")}},r.appKey?{label:r.appKey.label,icon:v("copy"),run:async()=>{let l=await a();l&&xe(await r.appKey.make(l),_("Key copied"))}}:null,null,{label:_("Rename"),icon:v("edit"),run:()=>Je(e,o,s)},{label:_("New keys"),icon:v("key"),run:async()=>{await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0)&&await F(()=>N.deviceRotate(o.id),_("New keys generated"))&&s.refresh()}},{label:o.disabled?_("Enable"):_("Disable"),icon:v(o.disabled?"play":"pause"),warn:!o.disabled,run:async()=>{await F(()=>N.deviceUpdate(o.id,void 0,!o.disabled),o.disabled?_("Device enabled"):_("Device disabled"))&&s.refresh()}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(m(_("Remove %s?"),o.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(o.id),_("Device removed"))&&s.refresh()}}];Se(n,i)}function ct(n,e){let o=n.devices.map(c=>c.name),s=c=>{let p=at(c),u=1,k=p;for(;o.some(M=>M.toLowerCase()===k.toLowerCase());)k=`${p} ${++u}`;return k},r="phone",a=t("input",{type:"text",class:"cbi-input-text",placeholder:s(r),maxlength:48}),i=Ee(_("Name"),a,()=>a.value.trim()?He(a.value,o,_("Shown in the portal and in the app.")):{text:m(_("Named after its type: %s."),s(r)),bad:!1}),l=t("div",{class:"dl-kinds",role:"radiogroup","aria-label":_("Type")},Vo.map(c=>t("button",{type:"button",role:"radio",class:c===r?"on":"","aria-checked":c===r?"true":"false","data-kind":c,click:()=>{r=c,l.querySelectorAll("button").forEach(p=>{let u=p.dataset.kind===c;p.classList.toggle("on",u),p.setAttribute("aria-checked",u?"true":"false")}),a.placeholder=s(c),i.refresh()}},[v(c),t("span",{},at(c))]))),d=n.devices.length>=n.device_limit;de(m(_("Add a device for %s"),n.name),[d?t("p",{class:"dl-hint"},m(N_(n.device_limit,"%s already has %s of %s device. As admin you can still add one.","%s already has %s of %s devices. As admin you can still add one."),n.name,K(n.devices.length),K(n.device_limit))):"",t("div",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Type")),l]),i],[ue()," ",A(_("Add device"),async()=>{let c=i.help();if(c.bad){q(c.text,"warning");return}let p=a.value.trim()||s(r),u=await F(()=>N.deviceCreate(n.id,p,r));u&&(ce(),q(m(_("%s added"),p),"success",3e3),e.refresh(),await lr(n.id,u.id,e))},"positive")]),setTimeout(()=>a.focus(),50)}var tt=1080,Qt=1512,Ze=96,Fi="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",Ki="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",Zt=n=>n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]);function Yi(n,e,o){let s=new URL(o),r=s.pathname.slice(1),a=m(_("Hi, %s"),n.name),i=Math.min(92,Math.floor((tt-2*Ze)/(.58*a.length))),l=tt-2*Ze,d=392,c=40,p=pn(o,2).replace("`${E}`;return``+u(Ze+82,Ze+42,36,"#a3a3a3",Zt(e))+u(Ze,276,i,"#ffffff",Zt(a),'font-weight="600"')+u(Ze,340,40,"#8a8a8a",Zt(m(_("Scan to connect to %s"),e)))+``+p+`${Zt(r)}`+u(tt/2,d+l+156,34,"#737373",Zt(s.host),'text-anchor="middle"')+""}async function Vi(n){let e=new Image;e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,await e.decode();let o=document.createElement("canvas");return o.width=tt,o.height=Qt,o.getContext("2d").drawImage(e,0,0,tt,Qt),new Promise((s,r)=>o.toBlob(a=>a?s(a):r(new Error(_("Could not draw the card"))),"image/png"))}async function cr(n){let e=await F(()=>N.personLinks(n));return e?e.link?{link:e.link,links:e.links??[]}:(q(_("The personal portal is off. Turn it on in Settings."),"warning"),null):null}async function Sn(n){let e=await cr(n);e&&await xe(e.link,_("Personal link copied"))}async function Xt(n,e,o={}){let s=n.link,r=n.links;if(s===void 0){let h=await cr(n.id);if(!h)return;s=h.link,r=h.links}if(!s){q(_("The personal portal is off. Turn it on in Settings."),"warning");return}let a=s,i=await F(()=>Vi(Yi(n,e,a)));if(!i)return;let l=new File([i],`${n.id}-invite.png`,{type:"image/png"}),d=URL.createObjectURL(i),c=navigator,p=!!c.canShare?.({files:[l]}),u=!p&&typeof c.share=="function"&&(c.canShare?.({url:a})??!0),k=()=>{URL.revokeObjectURL(d),ce()},M=async h=>{try{await c.share(h)}catch{}},g=p?A([v("link")," ",_("Share card")],()=>M({files:[l],title:m(_("Invite %s"),n.name)}),"positive"):u?A([v("link")," ",_("Share link")],()=>M({url:a,title:m(_("Invite %s"),n.name),text:_("Your personal VPN link")}),"positive"):A([v("download")," ",_("Download card")],()=>Ne(l.name,i),"positive");de(o.title??m(_("Invite %s"),n.name),t("div",{class:"dl-invite"},[t("img",{src:d,alt:m(_("Invite card for %s"),n.name)}),t("div",{class:"dl-invite-side"},[t("p",{class:"dl-muted"},o.lead??m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),n.name)),t("button",{type:"button",class:"dl-invite-link",title:_("Copy link"),click:()=>xe(a,_("Personal link copied"))},[t("span",{},a.replace(/^https:\/\//,"")),v("copy")]),...(r??[]).filter(h=>h!==a).map(h=>t("button",{type:"button",class:"dl-invite-link alt",title:_("Copy this link"),click:()=>xe(h,_("Link copied"))},[t("span",{},h.replace(/^https?:\/\//,"")),t("span",{class:`dl-pill ${h.startsWith("http:")?"warn":""}`},h.startsWith("http:")?"HTTP":_("Also")),v("copy")])),t("ol",{class:"dl-invite-steps"},[t("li",{},ae(_("Install %s on the device"),t("b",{},"AmneziaVPN"))),t("li",{},_("Open the link or scan the code")),t("li",{},_("Add the device and connect"))]),t("div",{class:"dl-invite-actions"},[g,A([v("copy")," ",_("Copy link")],()=>xe(a,_("Personal link copied")))])])]),[t("button",{class:"cbi-button cbi-button-neutral",click:k},_("Done"))],"wide")}function en(n,e){let o=n.servers.find(d=>d.id===e)??n.servers[0],s=n.people.filter(d=>d.server===o.id),r=new Set(s.map(d=>d.id)),a=s.flatMap(d=>d.devices),i=d=>s.reduce((c,p)=>{let u=d(p);return[c[0]+u[0],c[1]+u[1]]},[0,0]),l=o.series?.[o.series.length-1];return{...n,servers:[o],people:s,series:o.series??n.series,events:n.events.filter(d=>d.person?r.has(d.person):!0),geo:{...n.geo,points:n.geo.points.filter(d=>r.has(d.person))},totals:{people:s.length,devices:a.length,online:a.filter(d=>d.online).length,active:s.filter(d=>d.state==="active").length,today:l?[l.rx,l.tx]:[0,0],month:i(d=>d.month)}}}var pr=3,Lo=class{constructor(){this.n=0;this.shown=0}next(){return++this.n}take(e){return e{let k=e.next(),M=null;try{M=await n.fetch(u),o>=pr&&q(_("The router answers again."),"success",3e3),o=0}catch{return++o===pr&&q(_("The router is not answering: what you see may be out of date."),"warning",8e3),null}return M==null||!e.take(k)?null:(n.apply(M,p),M)},r=(p=!1)=>s(p,!1),a=()=>document.visibilityState==="visible",i=()=>a()&&(n.active?.()??!0)?s(!0,!1):Promise.resolve(null);poll.add(i,n.every);let l=n.live?_n(()=>void(a()&&(n.active?.()??!0)&&s(!0,!0))):null,d=()=>{poll.remove(i),l?.(),c()},c=Te(d);return{refresh:r,claim:()=>e.claim(),stop:d}}function Bt(n){let e=document.activeElement;return!!n&&!!e&&e!==document.body&&n.contains(e)}function Ae(n,e,o=!1){return o&&Bt(n)?!1:(dom.content(n,e),!0)}function ur(n,e){let o=n,s=[{v:"internet",ic:"globe",text:_("Browse the internet through your router. No access to devices at home.")},{v:"lan",ic:"home",text:_("Reach devices at home (NAS, printer, cameras). Internet stays on their own connection.")},{v:"both",ic:"shield",text:_("Home devices and the internet, all through your router.")}],r=t("div",{class:"dl-choices"},s.map(a=>t("button",{type:"button",class:`dl-choice${a.v===o?" selected":""}`,"data-v":a.v,click:()=>{o=a.v,r.querySelectorAll(".dl-choice").forEach(i=>i.classList.toggle("selected",i.dataset.v===a.v)),e?.(a.v)}},[t("span",{class:"dl-choice-title"},[v(a.ic),vt(a.v)]),t("span",{class:"dl-choice-text"},a.text)])));return{el:r,get:()=>o}}function Mo(n){try{return localStorage.getItem(n)}catch{return null}}function Eo(n,e){try{localStorage.setItem(n,e)}catch{}}function Ji(n){let e=n.devices.length,o=Math.max(1,n.device_limit,e),s=Math.min(160,o*22+(o-1)*3);return t("div",{class:"dl-slotbar",title:m(N_(n.device_limit,"%s of %s device","%s of %s devices"),e,n.device_limit)},[t("span",{class:"dl-slotbar-segs",style:`width: ${s}px`},Array.from({length:o},(r,a)=>t("i",{class:a>=n.device_limit?"over":an.state==="server_off"?n.paused:!["active","quota","expired"].includes(n.state),To=n=>n.state==="server_off"?n.paused:n.state!=="active",hr=n=>To(n)?n.state==="server_off"?"paused":n.state:null;function Zi(n,e){let o=st(n.expires,e);return n.state==="quota"||n.state==="expired"||rt(n,o)||!!n.quota_limit&&n.quota_used>=n.quota_limit*.9}function fr(n,e){return Lt(n&&no(n,e)>=0?n:e,1)}var gr=n=>n.people.map(e=>e.id).sort().join(" "),vr=!1,wt=class{constructor(){this.list=t("div",{class:"dl-plist",role:"list"});this.filter=["all","online","attention","paused"].find(e=>e===(new URLSearchParams(location.search).get("filter")??Mo("dl.people.filter")))??"all";this.sort=["seen","name","usage"].find(e=>e===Mo("dl.people.sort"))??"seen";this.query="";this.noFooter=!0;this.serverId=null;this.el=null}async load(){return N.status(30)}scope(e){return this.serverId?en(e,this.serverId):e}embed(e,o){return this.serverId=o,this.render(e)}person(e){return this.st.people.find(o=>o.id===e)}get today(){return Ge(this.st.series)}deviceOpts(e){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:zt(this.st.servers,e.server)}}take(e,o){let s=this.scope(e),r=gr(s)!==gr(this.st);this.st=s,r?this.rebuild():(this.paintCards(o),this.decorate(o))}async update(){await this.poller?.refresh()}async refresh(){this.poller?.claim();let e=await N.status(30).catch(()=>null);e&&(this.st=this.scope(e),this.rebuild())}rebuild(){let e=new Map;for(let s of Array.from(this.list.children))s.dataset.sid&&e.set(s.dataset.sid,s);let o=this.st.people.map(s=>{let r=e.get(s.id)??t("div",{class:"dl-card",role:"listitem","data-sid":s.id});return this.renderCard(r,s.id)});dom.content(this.list,o.length?o:t("div",{class:"dl-plist-none"},this.st.servers.length?_("No people yet. Add someone and send them their personal link."):_("Set up the server first, then add people."))),this.decorate()}paintCards(e=!1){for(let o of this.st.people){let s=this.card(o.id);s&&!(e&&Bt(s))&&this.renderCard(s,o.id)}}card(e){return this.list.querySelector(`[data-sid="${CSS.escape(e)}"]`)}render(e){let o=this.scope(e);this.st=o;let s=this,r=t("select",{class:"dl-select","aria-label":_("Sort"),change:d=>{s.sort=d.target.value,Eo("dl.people.sort",s.sort),s.decorate()}},[t("option",{value:"seen",selected:s.sort==="seen"?"selected":null},_("Last seen","sort")),t("option",{value:"name",selected:s.sort==="name"?"selected":null},_("Name","sort")),t("option",{value:"usage",selected:s.sort==="usage"?"selected":null},_("Usage","sort"))]),a=t("input",{type:"search",class:"cbi-input-text dl-people-find",placeholder:_("Find…"),"aria-label":_("Find a person or device"),hidden:o.people.length>8?null:"hidden",input:d=>{s.query=d.target.value.trim().toLowerCase(),s.decorate()}}),i=d=>{let c=d.target;d.key==="/"&&!a.hidden&&!["INPUT","TEXTAREA","SELECT"].includes(c?.tagName)&&!c?.isContentEditable&&(d.preventDefault(),a.focus())};document.addEventListener("keydown",i),Te(()=>document.removeEventListener("keydown",i));let l=t("div",{class:"dl-root"},[s.serverId?"":t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("People")),t("span",{class:"dl-muted dl-people-count"},this.countText())]),o.servers.length?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""]),o.servers.length?"":t("div",{class:"alert-message warning"},ae(_("No server yet. %s before adding people."),t("a",{href:L.url("admin/network/dawnline/server")},_("Run the setup wizard")))),t("div",{class:"dl-toolbar"},[t("div",{class:"dl-seg dl-people-tabs",role:"tablist"}),t("div",{class:"dl-toolbar-end"},[a,r,s.serverId?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""])]),this.list]);return this.el=l,this.rebuild(),this.poller??(this.poller=pt({fetch:()=>N.status(30),every:30,live:!0,active:()=>!!s.el?.isConnected,apply:(d,c)=>s.take(d,c)})),!vr&&new URLSearchParams(location.search).get("add")&&(vr=!0,setTimeout(()=>s.openCreate(),100)),Promise.resolve(l)}countText(){let e=this.st.totals;return[W(e.people,"%s person","%s people"),W(e.devices,"%s device","%s devices"),m(_("%s online"),K(e.online))].join(" · ")}decorate(e=!1){let o=this.el?.querySelector(".dl-people-count");o&&(o.textContent=this.countText());let s=this.st.people,r=this.today,a=h=>Zi(h,r),i={all:s.length,online:s.filter(h=>h.online>0).length,attention:s.filter(a).length,paused:s.filter(h=>mr(h)).length},l=this.el?.querySelector(".dl-people-tabs");if(l&&!(e&&Bt(l))){let h={all:_("All"),online:_("Online"),attention:_("Needs attention"),paused:_("Paused")};dom.content(l,Object.keys(h).map(E=>t("button",{type:"button",role:"tab",class:E===this.filter?"on":"",click:()=>{this.filter=E,Eo("dl.people.filter",E),this.decorate()}},[h[E],t("b",{class:E==="attention"&&i[E]?"warn":""},String(i[E]))])))}let d=this.query,c=h=>[h.name,h.note??"",...h.devices.flatMap(E=>[E.name,E.address,E.hostname,E.endpoint])].join(" ").toLowerCase(),p=h=>!(this.filter==="online"&&!h.online||this.filter==="attention"&&!a(h)||this.filter==="paused"&&!mr(h)||d&&!c(h).includes(d)),u=h=>hr(h)==="paused"?2:To(h)?1:0,k=[...s].sort((h,E)=>u(h)-u(E)||(this.sort==="name"?h.name.localeCompare(E.name):this.sort==="usage"?E.month[0]+E.month[1]-(h.month[0]+h.month[1]):E.online-h.online||E.last_seen-h.last_seen)),M=0;for(let h of k){let E=this.card(h.id);if(!E)continue;this.list.appendChild(E),E.classList.toggle("dl-off",To(h));let H=p(h);E.classList.toggle("dl-filtered",!H),H&&M++}let g=this.el?.querySelector(".dl-people-none")??null;s.length&&!M?(g??(g=t("div",{class:"dl-empty dl-people-none"},t("p",{},_("No one here right now.")))),g.previousElementSibling!==this.list&&this.list.after(g)):g?.remove()}async quick(e,o,s){await F(()=>N.personUpdate(e.id,o),s)&&await this.update()}renderCard(e,o){let s=this.person(o);if(!s)return dom.content(e,t("em",{},_("This person was just removed."))),e;let r=this.today,a=st(s.expires,r),i=Math.max(0,s.device_limit-s.devices.length),l=s.has_link??this.st.settings.portal_enabled,d=[],c=hr(s);if(s.expires&&c!=="expired"){let g=rt(s,a),h=a!=null&&a<0;d.push(t("span",{class:`dl-pill-ic${h?" bad":g?" warn":""}`,title:m(_("Access ends %s"),De(s.expires))},[v("calendar"),h?m(_("ended %s"),De(s.expires)):g?an(a):m(_("until %s"),De(s.expires))]))}s.hours&&c!=="hours"&&d.push(t("span",{class:"dl-pill-ic",title:_("Allowed hours")},[v("clock"),s.hours.replace("-","–")]));let p=ln(s.devices).map(g=>t("button",{type:"button",class:`dl-chip${g.disabled?" disabled":""}${g.online?" live":""}`,title:[at(g.kind),g.address,g.online?m(_("online from %s"),g.endpoint):g.handshake?m(_("seen %s"),pe(g.handshake,this.st.now)):""].filter(Boolean).join(" · "),click:h=>{h.preventDefault(),Je(s,g,this.deviceOpts(s))}},[v(g.kind),t("span",{class:"dl-chip-name"},g.name),!g.handshake&&!g.disabled?t("span",{class:"dl-chip-tag"},_("not set up")):""]));p.push(t("button",{type:"button",class:"dl-chip add",title:i>0?_("Add device"):_("Over the limit: admins can still add"),click:g=>{g.preventDefault(),ct(s,this.deviceOpts(s))}},[v("plus"),_("Add device")]));let u=[];s.expires&&rt(s,a)&&c!=="expired"&&u.push(t("button",{type:"button",class:"dl-fix",click:()=>this.quick(s,{expires:fr(s.expires,r)},_("Extended by 1 month"))},_("Extend 1 month")));let k=$e("more",_("More"),g=>Se(g.currentTarget,[{label:_("Open"),icon:v("open"),run:()=>{location.href=Re(s.id)}},l?{label:_("Invite card"),icon:v("qr"),run:()=>Xt(s,this.st.servers.find(h=>h.id===s.server)?.name??_("Home"))}:null,i>0?{label:_("Add device"),icon:v("plus"),run:()=>ct(s,this.deviceOpts(s))}:null,null,{label:s.paused?_("Resume"):_("Pause"),icon:v(s.paused?"play":"pause"),warn:!s.paused,run:()=>this.togglePause(s)},{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>this.remove(s.id)}].filter((h,E,H)=>h||E>0&&H[E-1])),"neutral","dl-icon-only"),M=t("div",{class:"dl-pcard-actions"},[l?$e("link",_("Copy link"),()=>Sn(s.id),"neutral","dl-icon-only"):"",k]);return dom.content(e,t("div",{class:"dl-pcard"},[t("div",{class:"dl-pcard-main"},[t("div",{class:"dl-pcard-top"},[t("span",{class:`dl-avatar${s.online?" online":""}`},je(s.name)),t("div",{class:"dl-pcard-who"},[t("div",{class:"dl-card-head"},[t("a",{class:"dl-card-name",href:Re(s.id)},s.name),Qo(s),...d]),Ji(s)])]),t("div",{class:"dl-chips"},p),u.length?t("div",{class:"dl-fixes"},u):""]),this.usageSide(s,M),c?this.stopStrip(s,c):""])),e}stopStrip(e,o){let s=this.today,r=Lt(`${s.slice(0,8)}01`,1),a=()=>this.quick(e,{bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month")),i={paused:["pause","warn",_("Paused"),_("Devices can’t connect until you resume"),["play",_("Resume"),()=>this.togglePause(e)]],quota:e.quota_period==="month"?["chart","bad",_("Data limit reached"),m(_("Paused until it resets on %s"),De(r)),["plus",_("+10 GB this month"),a]]:["chart","bad",_("Data limit reached"),_("Paused until the limit is raised"),["edit",_("Change limit"),()=>location.href=Re(e.id)]],expired:["calendar","bad",m(_("Access ended %s"),De(e.expires)),_("Devices can’t connect"),["calendar",_("Extend 1 month"),()=>this.quick(e,{expires:fr(e.expires,s)},_("Extended by 1 month"))]],hours:["clock","warn",_("Outside allowed hours"),m(_("Access %s (router time)"),e.hours.replace("-","–")),null],no_server:["alert","warn",_("No server"),_("Choose a server on their page"),null]},[l,d,c,p,u]=i[o];return t("div",{class:`dl-pstrip ${d}`},[t("span",{class:`dl-need-ic ${d}`},v(l)),t("span",{class:"dl-pstrip-text"},[t("b",{},c),t("span",{class:"dl-faint"},p)]),u?A([v(u[0]),` ${u[1]}`],u[2]):""])}usageSide(e,o){let s=e.quota_used||e.month[0]+e.month[1],r=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,a=e.devices.reduce((p,u)=>p+(u.spark[u.spark.length-1]??0),0),i=e.rate?.[e.rate.length-1],l=e.online&&i&&this.st.now-i[0]<180,d=t("div",{class:`dl-usebar${r>=100?" bad":r>=90?" warn":""}`});if(e.quota_limit){let p=t("i",{class:"fill"});p.style.width=`${r}%`,d.appendChild(p),we(d,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(r,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),oe(e.quota_used),oe(e.quota_limit))} · ${m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},e.quota_period==="total"?_("In total"):[_("This month"),e.bonus_gb?m(_("includes +%s GB extra"),K(e.bonus_gb)):""].filter(Boolean).join(" · "))])}else{let p=e.devices.map(u=>({d:u,v:u.month[0]+u.month[1]})).filter(u=>u.v>0).sort((u,k)=>k.v-u.v);p.forEach((u,k)=>{let M=t("i",{class:`c${Math.min(k,4)}`});M.style.flexGrow=String(u.v),d.appendChild(M)}),p.length&&we(d,()=>[t("div",{class:"dl-tip-title"},_("This month by device")),...p.map((u,k)=>t("div",{class:"dl-tip-row"},[t("span",{class:`dl-swatch c${Math.min(k,4)}`}),t("span",{},u.d.name),t("b",{},oe(u.v))]))])}let c=e.quota_limit?m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used))):_("no limit");return t("div",{class:"dl-pside"},[t("div",{class:"dl-pside-top"},[l?t("span",{class:"dl-pside-state live"},_("Online")):t("span",{class:"dl-pside-state"},e.online?_("Online"):e.last_seen?_("Offline"):_("Never connected")),o]),t("div",{class:"dl-use-num"},[t("b",{class:s?"":"dl-faint"},oe(s)),t("span",{class:"dl-faint"},e.quota_limit?m(_("of %s"),oe(e.quota_limit)):e.quota_period==="total"&&e.quota_gb?_("in total"):_("this month"))]),d,l?t("div",{class:"dl-use-live",title:_("Right now")},[`↓ ${Fe(i[2])}`,t("span",{class:"dl-faint"},`↑ ${Fe(i[1])}`)]):t("div",{class:"dl-faint dl-pside-foot"},a?`${m(_("today %s"),oe(a))} · ${c}`:c)])}async togglePause(e){await F(()=>N.personPause(e.id,!e.paused),m(e.paused?_("%s resumed"):_("%s paused"),e.name))&&await this.refresh()}async remove(e){let o=this.person(e);await me(m(_("Remove %s?"),o?.name??e),W(o?.devices.length??0,"%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups.","All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups."),_("Remove"),!0)&&await F(()=>N.personDelete(e),_("Person removed"))&&await this.refresh()}openCreate(){let e=this.st;if(!e.servers.length){q(_("Set up the server first."),"warning");return}let o=t("input",{type:"text",class:"cbi-input-text",placeholder:_("e.g. Myata"),maxlength:48}),s=(()=>{try{return JSON.parse(Mo("dl.person.last")??"{}")}catch{return{}}})(),r=ur(s.access??"internet"),a=t("input",{type:"number",class:"cbi-input-text",min:1,max:32,value:e.settings.default_device_limit}),i=t("input",{type:"date",class:"cbi-input-text"}),l=t("input",{type:"number",class:"cbi-input-text",min:0,step:"any",placeholder:_("Unlimited"),value:s.quota??""}),d=(S,$)=>t("button",{type:"button",class:"cbi-button cbi-button-neutral",click:()=>{i.value=$?Lt(Ge(e.series),$):"",i.dispatchEvent(new Event("change"))}},S),c=e.servers[0],p=!this.serverId&&e.servers.length>1?t("select",{class:"cbi-input-select"},e.servers.map(S=>t("option",{value:S.id},S.name))):null,u=(S,$,b)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},S),t("div",{class:"cbi-value-field"},[$,b?t("div",{class:"cbi-value-description"},b):""])]),k=Ge(e.series),M=Ee(_("Name","person"),o,()=>He(o.value,[],_("Shown in their portal and apps."))),g=Ee(_("Devices"),a,()=>fn(a.value)),h=Ee(_("End date"),i,()=>ms(i.value,k,st,De),t("div",{class:"dl-actions"},[i,d(_("1 month"),1),d(_("3 months"),3),d(_("1 year"),12),d(_("None","end date"),0)])),E=Ee(_("Monthly data (GB)"),l,()=>gn(l.value));i.addEventListener("change",()=>h.refresh());let H=e.settings.portal_enabled;de(_("Add person"),[M,p?u(_("Server"),p):"",t("div",{class:"cbi-value dl-block"},[t("label",{class:"cbi-value-title"},_("Access")),t("div",{class:"cbi-value-field"},r.el)]),g,h,E],[ue()," ",A(H?_("Create and copy link"):_("Create"),async()=>{let S=Ue([M,g,h,E]);if(S){q(S,"warning");return}let $=await F(()=>N.personCreate(o.value.trim(),"",p?.value??c.id,r.get(),a.value.trim(),i.value,l.value.trim(),"month"));$&&(Eo("dl.person.last",JSON.stringify({access:r.get(),quota:l.value.trim()})),$.link&&await xe($.link,_("Personal link copied"),!0),this.showCreated($.id,o.value.trim(),$.link,e.servers.find(b=>b.id===(p?.value??c.id))?.name??c.name),await this.refresh())},"positive")]),setTimeout(()=>o.focus(),50)}showCreated(e,o,s,r){if(s){Xt({id:e,name:o,link:s},r,{title:m(_("%s is ready"),o),lead:m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),o)});return}let a=this.person(e);de(m(_("%s is ready"),o),[t("p",{},_("Created. Turn on the personal portal in Settings to get a link, or add devices for them here."))],[t("button",{class:"cbi-button cbi-button-neutral",click:ce},_("Done"))," ",t("a",{class:"cbi-button cbi-button-neutral",href:`${L.url("admin/network/dawnline/settings")}?section=portal`},_("Open Settings"))," ",a?A(_("Add device"),()=>{ce(),ct(a,this.deviceOpts(a))},"positive"):""])}};var Pn=["#3a83f7","#a78bfa","#f472b6","#f59e0b","#10b981","#22d3ee","#ef4444","#84cc16"],So=n=>t("i",{class:"dl-circle-dot",style:`background:${Pn[n?.color??0]??Pn[0]}`}),ut=n=>n.access==="both"||n.access==="lan"&&!n.services?.length;function br(n,e,o){let s=he(n?.name??e.name??"",{placeholder:_("NAS")}),r=he(n?.address??e.address??"",{placeholder:"192.168.1.10",class:"cbi-input-text dl-mono"}),a=he((n?.ports??e.ports??[]).join(", "),{placeholder:_("All ports, or e.g. 445, 5000"),class:"cbi-input-text dl-mono"}),i=Ee(_("Name","circle or service"),s,()=>He(s.value,[],_("Shown to people who may reach it."))),l=Ee(_("Address"),r,()=>hs(r.value)),d=Ee(_("Ports"),a,()=>fs(a.value));de(n?m(_("Edit %s"),n.name):_("Add service"),[i,l,d],[ue()," ",A(_("Save"),async()=>{let c=Ue([i,l,d]);if(c){q(c,"warning");return}let p=a.value.split(/[ ,]+/).filter(Boolean);await F(()=>N.serviceSet(n?.id??"",s.value,r.value,p),_("Saved"))&&(ce(),o())},"positive")])}function Qi(){let n=_("Web"),e=_("Printer");return{_smb:"SMB",_afpovertcp:"AFP",_http:n,_https:n,_ssh:"SSH",_sftp:"SFTP","_sftp-ssh":"SFTP",_ipp:e,_ipps:e,_printer:e,"_pdl-datastream":e,_airplay:"AirPlay",_raop:"AirPlay",_rfb:_("Screen sharing"),_googlecast:"Cast",_hap:"HomeKit",_rdp:_("Remote desktop"),_ftp:"FTP"}}function Xi(n){let e=Qi(),o=new Map;for(let s of n.services){let r=e[s.type.split(".")[0]];!r||!s.port||(o.get(r)??o.set(r,new Set).get(r)).add(String(s.port))}return o.size?[...o].map(([s,r])=>[s,[...r].sort((a,i)=>+a-+i)]):[[_("Web"),["80","443"]],["SMB",["445"]],["SSH",["22"]]]}function xr(n,e,o){let s=n,r=null,a=!1,i=null,l=new Set,d=t("div",{class:"dl-list"}),c=t("div",{class:"dl-stack gap8"},t("span",{class:"dl-sub"},_("Looking for devices at home…"))),p=()=>{let h=s.services;dom.content(d,h.length?h.map(E=>t("div",{class:"dl-row"},[v("home"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},E.name),t("span",{class:"dl-mono dl-faint"},`${E.address} · ${E.ports.length?m(_("ports %s"),E.ports.join(", ")):_("all ports")}`)]),A(_("Edit"),()=>br(E,{},o)),A([v("trash")],async()=>{await me(m(_("Remove %s?"),E.name),_("People limited to this service lose access to it."),_("Remove"),!0)&&await F(()=>N.serviceDelete(E.id),_("Removed"))&&await o()},"neutral",{title:_("Remove"),"aria-label":m(_("Remove %s"),E.name)})])):[t("div",{class:"dl-row dl-muted"},_("No services yet: pick ports of a device below."))])};async function u(h,E){if(!l.has(h.address)){l.add(h.address),M();try{let H=s.services.find($=>$.address===h.address);(E===null?H&&await F(()=>N.serviceDelete(H.id),m(_("%s removed"),H.name)):await F(()=>N.serviceSet(H?.id??"",H?.name??(h.name||h.address),h.address,E),H?m(_("%s updated"),H.name):m(_("%s added"),h.name||h.address)))&&await o()}finally{l.delete(h.address),M()}}}function k(h){let E=s.services.find(C=>C.address===h.address),H=!!E&&!E.ports.length,S=new Set(E?.ports??[]),$=l.has(h.address),b=(C,w,z)=>Xe(C,w,z,{disabled:$?"disabled":null,"aria-busy":$?"true":null});return t("div",{class:"dl-row"},[v(h.services.some(C=>C.type.startsWith("_ipp")||C.type.startsWith("_printer"))?"file":"computer"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},h.name||h.address),t("span",{class:"dl-mono dl-faint"},h.address)]),t("div",{class:"dl-chips-row dl-host-ports"},[b(_("All ports"),H,()=>u(h,H?null:[])),...Xi(h).map(([C,w])=>{let z=!H&&w.every(y=>S.has(y));return b(`${C} ${w.join(", ")}`,z,()=>{let y=new Set(H?[]:S);for(let f of w)z?y.delete(f):y.add(f);u(h,y.size?[...y]:null)})})])])}function M(){if(a)return dom.content(c,t("span",{class:"dl-sub"},_("Couldn't read the devices at home.")));if(!r)return;let h=r;if(!h.hosts.length)return dom.content(c,t("span",{class:"dl-sub"},_("No devices found in the home network right now.")));let E=t("details",{class:"dl-params",open:i??!s.services.length?"":null},[t("summary",{},[v("chevron"),t("span",{},_("Add from devices at home")),t("span",{class:"dl-pcount"},String(h.hosts.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},h.mdns?_("Ports they announce over Bonjour. Pick what to open, or all ports."):_("Devices that got an address from this router. Pick the ports to open, or all ports.")),t("div",{class:"dl-list"},h.hosts.map(k))])]);E.addEventListener("toggle",()=>i=E.open),dom.content(c,E)}return N.homeHosts(e).then(h=>{r=h,M()}).catch(()=>{a=!0,M()}),p(),{el:t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-iflead"},[t("div",{class:"dl-iflead-row"},[t("b",{},_("Home services")),A([v("plus")," ",_("Add service")],()=>br(null,{},o))]),t("span",{class:"dl-sub"},_("Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers."))]),d,c]),update(h){s=h,p(),M()}}}function $n(n,e,o,s){let r=new Set(n.circles.filter(h=>h.server===e).map(h=>h.color)),a=o?.color??Pn.findIndex((h,E)=>!r.has(E));a<0&&(a=0);let i=he(o?.name??"",{placeholder:_("Family")}),l=n.people.filter(h=>h.server===e).sort((h,E)=>h.name.localeCompare(E.name)),d=new Set(l.filter(h=>o&&h.circle===o.id).map(h=>h.id)),c=t("div",{class:"dl-swatches",role:"radiogroup","aria-label":_("Colour")}),p=()=>dom.content(c,Pn.map((h,E)=>t("button",{type:"button",role:"radio",class:`dl-swatch${E===a?" on":""}`,style:`--sw:${h}`,"aria-checked":E===a?"true":"false","aria-label":m(_("Colour %s"),E+1),click:()=>{a=E,p()}})));p();let u=t("div",{class:"dl-chips-row"},l.map(h=>{let E=h.circle&&h.circle!==o?.id?n.circles.find(H=>H.id===h.circle):void 0;return t("button",{type:"button",class:`dl-chipbtn${d.has(h.id)?" on":""}`,title:ut(h)?E?m(_("Now in %s"),E.name):"":m(_("%s has no home access: their devices aren't reachable anyway"),h.name),click:H=>{d.delete(h.id)||d.add(h.id),H.currentTarget.classList.toggle("on",d.has(h.id))}},[h.name,ut(h)?E?t("b",{},E.name):"":t("b",{},_("internet"))])})),k=(h,E)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},h),t("div",{class:"cbi-value-field"},E)]),M=n.circles.filter(h=>h.server===e&&h.id!==o?.id).map(h=>h.name),g=Ee(_("Name","circle or service"),i,()=>ds(i.value,M));de(o?m(_("Edit %s"),o.name):_("New circle"),[g,k(_("Colour"),c),k(_("People"),u),t("p",{class:"dl-sub"},_("Devices of people in one circle reach each other. A person is in one circle at a time."))],[o?A(_("Delete"),async()=>{await F(()=>N.circleDelete(o.id),m(_("%s deleted"),o.name))&&(ce(),s())},"negative"):"",t("span",{class:"dl-spacer"}),ue()," ",A(_("Save"),async()=>{let h=g.help();if(h.bad){q(h.text,"warning");return}await F(()=>N.circleSet(o?.id??"",e,i.value,a,[...d]),_("Saved"))&&(ce(),s())},"positive")],"dl-circle-modal")}function wr(n,e,o){let s=n.circles.filter(r=>r.server===e);return t("div",{class:"dl-chips-row dl-circles"},[...s.map(r=>{let a=n.people.filter(i=>i.circle===r.id).map(i=>i.name);return t("button",{type:"button",class:"dl-chip",title:m(_("Edit %s"),r.name),click:()=>$n(n,e,r,o)},[So(r),t("b",{},r.name),t("span",{class:"dl-faint"},a.length?a.join(", "):_("nobody yet"))])}),t("button",{type:"button",class:"dl-chip add",title:_("New circle"),"aria-label":_("New circle"),click:()=>$n(n,e,null,o)},v("plus"))])}function Po(n,e){let o=n.people.filter(p=>p.server===e.id),s=(p="")=>t("span",{class:"dl-yes"},[v("check"),p]),r=()=>t("span",{class:"dl-faint"},"—"),a=p=>{let u=new Set(p.map(M=>M.access==="lan"&&M.services?.length?"services":M.home_nets?.length?"some":"all"));u.size||u.add("all");let k={all:_("all networks"),some:_("their networks"),services:_("services")};return s([...u].map(M=>k[M]).join(" / "))},i=()=>e.mesh==="off"?r():e.mesh==="circles"?s(_("circle")):s(),l=e.lan_like?_("like home"):_("direct"),d=(p,u,k)=>t("tr",{},[t("td",{},[t("b",{},p),t("div",{class:"dl-sub"},W(u.length,"%s person","%s people"))]),...k.map(M=>t("td",{},M))]),c=p=>o.filter(u=>u.access===p);return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Who reaches what")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("From the rules on this server"))]),t("div",{class:"dl-reach-wrap"},t("table",{class:"dl-table dl-reach"},[t("tr",{},["",_("Internet"),_("Home"),_("This router"),_("Each other")].map(p=>t("th",{},p))),d(_("Internet"),c("internet"),[s(l),r(),t("span",{class:"dl-faint"},"DNS"),r()]),d(_("Home"),c("lan"),[t("span",{class:"dl-faint"},_("their own")),a(c("lan")),s(),i()]),d(_("Both"),c("both"),[s(l),a(c("both")),s(),i()])])),t("p",{class:"dl-sub"},_("Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing."))])])}function yr(n,e){let o=n.people.filter(c=>c.server===e.id).flatMap(c=>c.devices.map(p=>({id:p.id,label:`${c.name} · ${p.name}`}))).sort((c,p)=>c.label.localeCompare(p.label)),s="@addr",r=(c,p)=>{let u=t("select",{class:"cbi-input-select","aria-label":c},[...o.map(h=>t("option",{value:h.id,selected:h.id===p?"selected":null},h.label)),t("option",{value:s,selected:p===s?"selected":null},_("Address"))]),k=he("",{placeholder:c,class:"cbi-input-text dl-mono"}),M=t("div",{class:"dl-check-end"},[u,k]),g=()=>k.hidden=u.value!==s;return u.addEventListener("change",g),g(),{el:M,value:()=>u.value===s?k.value.trim():u.value}},a=r("10.0.1.11",o[0]?.id??s),i=r("10.0.1.20:445",s),l=t("div",{class:"dl-stack gap8"}),d=async()=>{let c=await F(()=>N.accessCheck(a.value(),i.value()));if(!c)return;let p=c.steps.findIndex(u=>!u.ok);dom.content(l,[t("div",{class:`dl-verdict ${c.ok?"ok":"bad"}`},[t("b",{},c.ok?_("Allowed"):_("Blocked")),t("span",{class:"dl-sub"},c.ok?_("Every step lets it through"):m(_("Stops at step %s of %s"),p+1,c.steps.length))]),t("ul",{class:"dl-checks"},c.steps.map(u=>t("li",{},[t("span",{class:`dl-check-icon ${u.ok?"ok":"error"}`},v(u.ok?"check":"x")),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},u.title),u.detail?t("div",{class:"dl-check-detail"},u.detail):""])])))])};return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Check access")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("Why something does or does not connect"))]),t("div",{class:"dl-check-form"},[a.el,t("span",{class:"dl-faint"},"→"),i.el,A(_("Check"),d)]),l])])}function Dn(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="packages"||n==="pkgs"?_("System packages"):void 0}function mt(n){return(n.startsWith("check")?n.slice(6)||"all":n).split(/[:@ ]/)[0]}function An(n){return mt(n.action==="check"?`check:${n.component??""}`:n.component??"")}function kr(n){return n=Math.max(0,Math.floor(n)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function _r(n,e){return!n?.from&&!n?.to?e:n.from&&n.to&&n.from!==n.to?`${n.from} → ${n.to}`:n.to??n.from??e}function Cr(n,e){let o=n.check?.components??{},s=e==="all"?["app","amneziawg","packages"]:[e],r=[],a;for(let l of s){let d=o[l];if(d){if(d.error)return{tone:"warn",text:d.error};l==="packages"&&d.updates?r.push(W(d.updates,"%s system package","%s system packages")):l!=="packages"&&d.update&&d.installed&&d.latest&&(r.push(`${Dn(l)} ${d.latest}`),e!=="all"&&(a=d.latest))}}if(r.length)return{tone:"acc",text:m(_("Update available: %s"),r.join(", ")),update:a};let i=s.length===1?o[s[0]]:null;return i?.status==="dev"?{tone:"acc",text:m(_("Installed version is newer than the release (%s)"),i.latest)}:i?.note?{tone:"warn",text:i.note}:{tone:"ok",text:s.length>1?_("Everything is up to date"):_("Latest version is installed")}}function Lr(n,e,o,s){return e?n.id===e:o&&n.id===o?!1:n.state==="running"||s>0&&n.started>=s}var $o=n=>new Promise(e=>setTimeout(e,n));async function tn(n,e,o){let s=o?An(o):mt(n),r=o?o.action==="check":n.startsWith("check"),a=Date.now(),i=t("b",{},Dn(s)??(s==="all"?_("All components"):"Dawnline")),l=t("span",{class:"dl-pill dl-mono"},e.version??""),d=t("span",{class:"dl-pill info",hidden:!0}),c=t("span",{},"0:00"),p=t("pre",{class:"dl-log"},_("Operation started. Waiting for log output…")),u=t("div",{}),k=t("div",{class:"dl-op-actions"}),M=[],g=x=>dom.content(k,x),h=(x=!1)=>ue(_("Close"),x);de(e.title,t("div",{class:"dl-op"},[t("div",{class:"dl-op-head"},[i,e.version?l:"",d,t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-op-timer"},[v("clock"),c])]),t("div",{class:"dl-op-loghead"},[t("b",{},_("Operation log")),$e("copy",_("Copy log"),()=>xe(M.join(` +`),_("Log copied")))]),p,u]),[k],"wide"),g([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},r?_("Checking…"):_("Working…"))]);let E=o??null,H=o?.id,S,$=0,b=x=>{H!==x.id&&(H=x.id,e.onJob?.(x))};if(o)e.onJob?.(o);else try{let x=await N.updatesStatus().catch(()=>null);S=x?.job?.id,$=x?.now??0;let T=await N.updatesRun(n);T.job&&T.job.state==="running"&&T.job.id!==S&&(E=T.job,b(T.job))}catch(x){return M=[Ce(x)],p.textContent=M[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},Ce(x))])),g([h(!0)]),q(Ce(x),"error"),null}let C=null,w=0;for(;;){if(await $o(1e3),C=await N.updatesStatus().catch(()=>null),!C){if(++w>60)break;continue}w=0;let x=C.job;if(!x||!Lr(x,H,S,$)){if(Date.now()-a>15e3)break;continue}if(b(x),E=x,x.log.length){M=x.log;let T=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=M.join(` +`),T&&(p.scrollTop=p.scrollHeight)}if(l.textContent=_r(x,e.version??""),!l.isConnected&&l.textContent&&i.after(l),c.textContent=kr((x.finished??C.now)-x.started),x.state==="running"){d.hidden=!x.phase,d.textContent=x.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!E||E.state==="running")return d.className="dl-pill warn",d.textContent=_("No answer"),dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},_("The router stopped answering. The job may still finish: reopen Components in a minute."))])),g([h()]),e.onDone?.(C),E;if(E.state==="failed")return d.className="dl-pill bad",d.textContent=_("Failed"),dom.content(u,t("div",{class:"dl-comp-status bad"},[v("x"),t("span",{},[t("b",{},(E.error??_("Operation failed")).replace(/\.$/,"")),r?"":`. ${_("Nothing else was changed.")}`])])),g([A(_("Copy log"),()=>xe(M.join(` +`),_("Log copied"))),h(!0)]),q(`${Dn(s)??_("Update","noun")}: ${E.error??_("failed")}`,"error"),e.onDone?.(C),E;if(d.className="dl-pill ok",d.textContent=_("Finished"),r&&C){let x=Cr(C,s);if(dom.content(u,t("div",{class:`dl-comp-status ${x.tone}`},[v(x.tone==="ok"?"check":x.tone==="warn"?"alert":"download"),t("span",{},x.text)])),q(x.text,x.tone==="warn"?"warning":"success"),e.onDone?.(C),x.update&&e.onUpdate){let T=C;g([h(),A(m(_("Update to %s"),x.update),()=>e.onUpdate(T),"positive")])}else g([h()]),x.tone==="ok"&&setTimeout(()=>u.isConnected&&ce(),1200);return E}let z=/^app:(lang:|nolang$)/.exec(E.component??"");if(z){let x=()=>{ui.menu?.flushCache(),location.reload()};return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},z[1]==="nolang"?_("The translation is removed."):_("The translation is installed."))," ",_("Reloading the page…")])])),g([h(),A(_("Reload now"),x,"positive")]),await $o(4e3),u.isConnected&&x(),E}if(s==="app"&&E.to){let x=E.to,T=t("span",{},_("Waiting for the router to restart its services…"));dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},m(_("Dawnline %s is installed."),x))," ",T])]));let I=()=>{ui.menu?.flushCache(),location.reload()};g([h(),A(_("Reload now"),I,"positive")]),q(m(_("Dawnline updated to %s"),x),"success",6e3);for(let Y=1;Y<=30;Y++)if(T.textContent=m(_("Waiting for the router to restart its services (%s of 30)…"),Y),await $o(1500),(await N.updatesStatus().catch(()=>null))?.version===x)return T.textContent=_("Services are back. Reloading…"),setTimeout(I,800),E;return T.textContent=_("Services restarted. Reload the page to use the new version."),E}let y=[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]],f=s==="pkgs"?y.length?m(_("Updated %s"),y.join(", ")):_("Updated system packages"):s==="amneziawg"?E.to?m(_("AmneziaWG %s is installed"),E.to):_("AmneziaWG is installed"):_("Operation completed");return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},f)])),g([h()]),q(f,"success"),e.onDone?.(C),E}function el(n){return{https:[_("Install HTTPS for the portal?"),_("Installing HTTPS for the portal")],acme:[_("Install ACME certificates?"),_("Installing ACME certificates")],home:[_("Install the home-like link?"),_("Installing the home-like link")],awg:[_("Install AmneziaWG?"),_("Installing AmneziaWG")]}[n]}async function Mr(n,e,o,s){let[r,a]=el(e);return!await me(r,o,_("Install"))||(await tn(n,{title:a}))?.state!=="done"?!1:(setTimeout(()=>s?.(),4e3),!0)}function Nn(n){return Mr("amneziawg:auto","awg",_("Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds."),n)}async function nn(n,e,o){return n==="awg"?Nn(o):e.length?Mr(`pkgs:${e.join(",")}`,n,m(_("%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive."),e.join(", ")),o):!0}async function Er(n,e){if(n==="awg")return Nn(e);let o=await F(()=>N.updatesStatus());return o?nn(n,o.needs?.[n]??[],e):!1}var tl=()=>[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn",_("VPN & tunnels")],["other",_("Other")]],nl={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function Tr(n,e,o){let s=n.id,r=e,a=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},_("Loading interfaces…"))))),i,l=!0,d="",c=!0,p=!0,u="all",k=!1,M=xr(r,s,o),g=new Set,h="",E=()=>JSON.stringify([p,l,l?"":d,c,[...g].sort()]),H=()=>i.detected.lan||i.saved.lan||"",S=()=>(l?i.detected.wan||i.saved.wan:d)||"",$=()=>new Map(i.devices.map(B=>[B.name,B])),b=()=>{let B=$();return[...c&&H()?[H()]:[],...[...g].filter(ne=>ne!==H())].filter(ne=>ne!==S()).map(ne=>B.get(ne)??{name:ne,nets:[],missing:!0})},C=(B,Q)=>{i=B,Q&&(l=B.config.auto_wan,d=B.config.wan_device||B.detected.wan||B.saved.wan||"",c=B.config.auto_lan,p=B.config.lan_like,u=B.config.mesh??(B.config.device_mesh?"all":"off"),g=new Set(B.config.lan_devices),h=E()),J()},w=async B=>{let Q=await N.interfaces(s).catch(ne=>(q(ne.message,"error"),null));Q&&C(Q,B)};function z(B){let Q=c&&B.name===H(),ne=!!B.own||!!B.master||B.name===S()||Q;return Q||g.has(B.name)||!ne&&(B.nets.length>0||!!B.missing)}function y(B){let Q=c&&B.name===H(),ne=B.name===S(),fe=!Q&&g.has(B.name),j=!(!!B.own||!!B.master||ne||Q)&&(B.nets.length>0||fe||!!B.missing),V=(fe||Q)&&!B.zone&&!B.missing,le=B.missing?_("Not present right now"):B.own?_("This server"):B.master?m(_("Port of %s"),B.master):ne?`${_("Internet")}${B.zone?` · ${m(_("zone %s"),B.zone)}`:""}`:B.nets.length?B.nets.join(", "):_("No IPv4 network"),ve=t("button",{type:"button",class:`dl-if${fe?" sel":""}${Q?" auto":""}${!j&&!fe&&!Q?" off":""}${V?" warn":""}`,"aria-pressed":fe||Q?"true":"false","aria-disabled":j?null:"true",click:()=>{j&&(g.has(B.name)?g.delete(B.name):g.add(B.name),J())}},[t("span",{class:"dl-if-ic"},v(nl[B.kind]??"link")),t("span",{class:"dl-if-main"},[t("span",{class:"dl-if-name"},B.name),t("span",{class:"dl-if-sub"},le)]),Q?t("span",{class:"dl-if-badge ok"},_("Auto")):fe?t("span",{class:"dl-if-check"},v("check")):""]);return we(ve,()=>[t("div",{class:"dl-tip-title"},B.name),t("div",{class:"dl-muted"},[B.logical?m(_("Interface %s"),B.logical):_("No netifd interface")," · ",B.zone?m(_("zone %s"),B.zone):_("no firewall zone")]),B.members.length?t("div",{class:"dl-muted"},m(_("Ports: %s"),B.members.join(", "))):"",B.nets.length?t("div",{class:"dl-mono"},B.nets.join(", ")):"",V?t("div",{class:"dl-warn"},_("Not in a firewall zone: the firewall rejects this traffic.")):"",B.master?t("div",{class:"dl-muted"},m(_("Choose %s to include it."),B.master)):""]),ve}function f(){let B=i.like_home;return!p||!i.config.lan_like||!n.enabled?"":!i.needs?.length&&B.active&&B.bridged?"ok":"warn"}function x(){let B=i.like_home;return p?i.needs?.length?[t("span",{class:"dl-warn"},m(_("Needs %s."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(i.needs)))," ",_("Until they are installed, internet traffic goes straight to the WAN.")]:i.config.lan_like?n.enabled?B.active&&B.bridged?ae(_("Internet traffic enters %s as %s, so whatever handles home traffic (proxies, filters, DNS) handles it too."),t("span",{class:"dl-mono"},B.dev??""),t("span",{class:"dl-mono"},B.address??"")):[t("span",{class:"dl-warn"},m(_("Not working: %s"),B.error??_("the link is down")))," ",_("Internet traffic goes straight to the WAN for now.")]:[_("Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too.")]:[_("Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on.")]:[_("Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router.")]}let T=B=>({off:_("Devices of different people never reach each other; a person's own devices don't either."),all:_("Devices of people with home access reach each other, like home devices do. Internet-only people never."),circles:_("Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never.")})[B];function I(B,Q,ne,fe,se="",j){return t("div",{class:j?"dl-setrow head":"dl-setrow"},[t("div",{class:"dl-lh-main"},[t("span",{class:`dl-need-ic ${se}`},v(B)),t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},Q),t("span",{class:"dl-sub"},ne),j??""])]),t("div",{class:"dl-setrow-ctl"},fe)])}let Y=(B,Q)=>{let ne=fe=>t("span",{class:"dl-mono"},fe);return B?t("span",{},[" ",...Q&&Q!==B?ae(_("Now: %s, was %s."),ne(B),ne(Q)):ae(_("Now: %s."),ne(B))]):t("span",{},[" ",...Q?ae(_("Not found now: using %s."),ne(Q)):[_("Not found.")]])};function J(){let B=t("select",{class:"cbi-input-select","aria-label":_("Internet interface"),change:D=>{d=D.target.value,J()}},i.devices.filter(D=>!D.own&&!D.master&&D.zone&&!D.missing).map(D=>t("option",{value:D.name,selected:D.name===d?"selected":null},`${D.name} · ${m(_("zone %s"),D.zone)}`))),ne=b().flatMap(D=>D.nets.map(G=>[G,D.name])),fe=JSON.parse(E()),se=JSON.parse(h),j=(...D)=>D.some(G=>JSON.stringify(fe[G])!==JSON.stringify(se[G])),V=j(0,1,2),le=j(3,4),ve=D=>A(_("Save"),async()=>{let G=await F(()=>N.serverInterfaces(s,l,l?"":d,c,[...g],p,u!=="off",u),_("Access saved"));G&&(C(G,!0),G.nets_changed&&G.lan_only&&q(W(G.lan_only,"%s person has Home-only access: their devices need the configuration again to reach the new networks.","%s people have Home-only access: their devices need the configuration again to reach the new networks."),"warning",1e4))},"positive",{disabled:!D}),R=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Internet")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Internet or Both"))]),I("home",_("Internet like a home device"),x(),[p&&i.needs?.length?A(_("Install"),()=>nn("home",i.needs,()=>w(!1)),"positive"):"",ye(p,_("Internet like a home device"),D=>{p=D,J()})],f()),I("globe",_("Auto-detect WAN"),[_("The interface with the default route: the server port opens there and Internet access leaves through it."),Y(i.detected.wan,i.saved.wan)],[l?"":B,ye(l,_("Auto-detect WAN"),D=>{l=D,J()})])]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},p?[_("Internet like a home device"),S()?[" · ",...ae(_("leaves through %s"),t("span",{class:"dl-mono"},S()))]:""]:S()?ae(_("Internet straight to %s"),t("span",{class:"dl-mono"},S())):_("No WAN found")),ve(V)])]),O=Me([["off",_("Off")],["all",_("Everyone")],["circles",_("Circles")]],u,{label:_("Devices reach each other"),cls:"sm",optimistic:!1,onChange:async D=>{let G={off:_("Off"),all:_("Everyone"),circles:_("Circles")}[D];await F(()=>N.serverUpdate(s,{mesh:D}),m(_("Devices reach each other: %s"),G))&&(u=D,i.config.mesh=D,J(),await o())}}),P=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Home network")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Home or Both")),A([v("reset")," ",_("Rescan")],()=>w(!1),"neutral",{title:_("Read the interfaces again")})]),I("network",_("Networks"),_("Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it."),"","",te()),I("link",_("Devices reach each other"),T(u),O,"",u==="circles"?wr(r,s,o):void 0),M.el]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub dl-if-summary"},ne.length?ae(_("Home access reaches %s"),t("span",{},ne.flatMap(([D,G],ee)=>[ee?", ":"",t("span",{class:"dl-mono"},D),` (${G})`]))):_("No home network: Home access reaches nothing but this router.")),ve(le)])]),U=window.scrollY;a.style.minHeight=`${a.offsetHeight}px`,dom.content(a,[R,P]),a.style.minHeight="",window.scrollTo({top:U})}function te(){let B=i.devices.filter(z),Q=i.devices.filter(ne=>!z(ne));return t("div",{class:"dl-stack gap8 dl-netpick"},[B.length?t("div",{class:"dl-ifgrid"},B.map(y)):t("span",{class:"dl-warn"},_("No home network: Home access reaches nothing but this router.")),t("label",{class:"dl-boxrow"},[t("span",{class:"dl-stack"},[t("span",{},_("Auto-detect LAN")),t("span",{class:"dl-sub"},[_("Adds the LAN this router uses."),Y(i.detected.lan,i.saved.lan)])]),ye(c,_("Auto-detect LAN"),ne=>{c=ne,J()})]),Q.length?t("details",{class:"dl-params",open:k?"":null,toggle:ne=>k=ne.currentTarget.open},[t("summary",{},[v("chevron"),t("span",{},_("Other interfaces")),t("span",{class:"dl-pcount"},String(Q.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},_("The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network.")),...tl().map(([ne,fe])=>{let se=Q.filter(j=>j.category===ne);return se.length?t("div",{class:"dl-ifgroup"},[t("h4",{},fe),t("div",{class:"dl-ifgrid"},se.map(y))]):""})])]):""])}return w(!0),{el:a,update(B){r=B,M.update(B),i&&J()}}}var ol={connect:"ok",disconnect:"",roam:"",device_added:"ok",device_removed:"",person_added:"",person_removed:"",paused:"warn",resumed:"ok",expiring:"warn",expired_kept:"",portal_blocked:"bad",person_changed:"",devices_removed:"warn"},sl={devices_removed:"trash",link_changed:"link",person_added:"plus",person_removed:"trash",person_changed:"edit",paused:"pause",resumed:"play",expiring:"calendar",expired_kept:"calendar"};function rl(n,e){return e.device?n.people.flatMap(s=>s.devices).find(s=>s.id===e.device)?.kind??e.dkind??"other":sl[e.type]??"activity"}var al=n=>/^\d{4}-\d{2}-\d{2}$/.test(n)?Oe(n):n;function Do(n,e){let o=n.people.find(h=>h.id===e.person),s=o?.name??e.pname??e.person??"",r=o?.devices.find(h=>h.id===e.device)?.name??e.dname??"",a=h=>t("b",{},h),i=h=>t("span",{class:"dl-muted"},h),l=h=>t("span",{class:"dl-mono"},h),d=h=>e.hosts?.[h]?[t("span",{class:"dl-ev-host"},[t("b",{},e.hosts[h]),t("span",{class:"dl-faint"},` (${h})`)])]:[l(h)],c=(h,...E)=>ae(h,...E).map(H=>typeof H=="string"?i(H):H),p=(h,...E)=>{let H=_("You");return h.startsWith(`${H} `)?[t("span",{class:"dl-you"},H),...c(h.slice(H.length),...E)]:c(h,...E)},u=a(r?`${s} · ${r}`:s),k=ys(e),M=a(k||r||_("a device")),g=Ve(e);if(g==="admin")switch(e.type){case"device_added":return p(_("You added device %s for %s"),M,a(s));case"device_removed":return p(_("You removed device %s from %s"),M,a(s));case"paused":return p(_("You paused person %s"),a(s));case"resumed":return p(_("You resumed person %s"),a(s));case"device_changed":{let h=a(r||_("a device"));return k.startsWith("renamed from ")?[...p(_("You renamed device %s of %s"),h,a(s)),i(` · ${m(_("was %s"),k.slice(13))}`)]:k==="turned off"?p(_("You turned off device %s of %s"),h,a(s)):k==="turned on"?p(_("You turned on device %s of %s"),h,a(s)):[...p(_("You changed device %s of %s"),h,a(s)),...k?[i(` · ${k}`)]:[]]}case"device_keys":return[...p(_("You issued new keys for device %s of %s"),M,a(s)),i(` · ${_("it needs its new configuration")}`)];case"link_changed":return[...p(_("You issued a new link for person %s"),a(s)),i(` · ${_("the old link stopped working")}`)]}switch(e.type){case"connect":return[...e.detail?c(_("Device %s connected from %s"),u,t("span",{},d(e.detail))):c(_("Device %s connected"),u),...e.where?[i(` · ${e.where}`)]:[]];case"disconnect":return c(_("Device %s went offline"),u);case"roam":return c(_("Device %s changed network %s"),u,t("span",{},(e.detail??"").split(" → ").flatMap((h,E)=>E?[i(" → "),...d(h)]:d(h))));case"device_added":return c(g==="portal"?_("Person %s added device %s on their portal"):_("Person %s added device %s"),a(s),M);case"device_removed":return c(g==="portal"?_("Person %s removed device %s on their portal"):_("Person %s removed device %s"),a(s),M);case"device_keys":return c(_("Person %s issued new keys for device %s on their portal"),a(s),M);case"person_added":return p(_("You added person %s"),a(e.detail??s));case"person_removed":return p(_("You removed person %s"),a(e.detail??s));case"person_changed":return[...p(_("You changed person %s"),a(s)),...k?[i(` · ${_s(k)}`)]:[]];case"expiring":{let h=ks(e.detail??"");return h!=null?c(N_(h,"Person %s’s access ends in %s day","Person %s’s access ends in %s days"),a(s),i(K(h))):c(_("Person %s’s access ends in a few days"),a(s))}case"expired_kept":return c(_("Person %s’s end date passed (%s) · access kept"),a(s),i(al(e.detail??"")));case"paused":return e.detail?c(_("Person %s paused - %s"),a(s),i(po(e.detail))):c(_("Person %s paused"),a(s));case"resumed":return e.detail&&e.detail!=="active"?c(_("Person %s resumed - %s"),a(s),i(po(e.detail))):c(_("Person %s resumed"),a(s));case"portal_blocked":return c(_("%s blocked %s for 15 min after too many wrong codes"),t("b",{class:"dl-sys-src"},_("Personal portal")),e.detail==="all Cloudflare visitors"?i(_("all Cloudflare visitors")):l(e.detail??""));case"devices_removed":return c(_("Person %s - all devices removed, end date reached"),a(s));default:return[i(`${e.type}${e.detail?`: ${e.detail}`:""}`)]}}var il={portal_blocked:["globe","bad"]};function ll(n,e){if(n.servers.length<2||!e.person)return"";let o=n.people.find(r=>r.id===e.person),s=o&&n.servers.find(r=>r.id===o.server);return s?t("span",{class:"dl-ev-srv",title:_("Server")},s.name):""}function ht(n,e,o={}){let s=il[e.type],r=Ve(e);return t("div",{class:`dl-row${r==="admin"?" dl-ev-by-admin":s?` dl-ev-by-system ${s[1]}`:""}`},[r==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):s?t("span",{class:"dl-ev-tile sys"},v(s[0])):t("span",{class:`dl-ev-tile ev ${ol[e.type]??""}`},v(rl(n,e))),t("span",{class:"dl-row-main"},Do(n,e)),o.server===!1?"":ll(n,e),t("span",{class:"dl-faint dl-nowrap",title:new Date(e.ts*1e3).toLocaleString(ie())},o.time??pe(e.ts,n.now))])}var dl={info:"",up:"ok",down:"warn",repair:"warn",error:"bad"},cl={awg:"tunnel",dawnline:"sunrise",portal:"globe"};function pl(n){return{info:_("info"),up:_("up"),down:_("down"),repair:_("repair"),error:_("error")}[n]??n}function ul(n){let e=Cs(n.msg,n.kind,n.who),o=_("You");if(!e)return[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},` ${n.msg} `),n.kind?t("span",{class:"dl-ev-kind"},`${n.kind} `):"",n.who?t("b",{},n.who):""];let s=(e.named?ae(e.text,t("b",{},Ls(n.msg,n.who??""))):[e.text]).map(a=>typeof a=="string"?t("span",{class:"dl-muted"},a):a),r=s[0]?.textContent??"";return r.startsWith(`${o} `)?[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},r.slice(o.length)),...s.slice(1)]:s}var Sr=n=>n.split(` +`).map(e=>At(e)).join(` +`);function Hn(n,e,o,s){let r=n.by==="admin",a=At(n.msg),i=t("div",{class:`dl-row dl-slog-row ${r?"dl-ev-by-admin":`dl-ev-by-system ${dl[n.level]??""}`}${n.detail?" has-detail":""}`},[r?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:"dl-ev-tile sys",title:pl(n.level)},v(cl[n.src]??"zap")),t("span",{class:"dl-row-main"},r?[...ul(n),n.note?t("span",{class:"dl-muted"},` · ${Ms(n.note)}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},`${_("Server")} `):"",t("b",{class:"dl-sys-src",title:Ft(n.src)},n.who?n.src==="awg"?n.who:At(n.who):Ft(n.src)),/^[:,]/.test(a)?"":" ",t("span",{class:"dl-muted"},a),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString(ie())},s)]);return n.detail&&i.addEventListener("click",l=>{l.target.closest("pre")||o()}),i}function Pr(n){let e=new Date(n*1e3),o=new Date,s=new Date;if(s.setDate(o.getDate()-1),e.toDateString()===o.toDateString())return _("Today");if(e.toDateString()===s.toDateString())return _("Yesterday");let r=e.toLocaleDateString(ie(),{weekday:"long",day:"numeric",month:"long"});return r.charAt(0).toLocaleUpperCase(ie())+r.slice(1)}var Ot=n=>Mt(n).toLocaleDateString(ie(),{day:"numeric",month:"short"});function zn(n,e,o,s=!1){let r=n.slice(-15),a=r[r.length-1],i=a&&e-a[0]<180,l=i?a[2]:0,d=i?a[1]:0,[c,p]=o,u=200,k=40,M=Math.max(1,...r.map($=>Math.max($[1],$[2]))),g=$=>r.map((b,C)=>`${r.length>1?C/(r.length-1)*u:u},${k-2-b[$]/M*(k-6)}`),h=g(2),E=g(1),H=r.length>1&&!s?Tt(``):t("div",{class:"dl-speed-wait"},[t("i"),s?"":t("span",{},_("Collecting… 1 point a minute"))]),S=($,b,C,w)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:C},b),` ${$}`]),s?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Fe(w))]);return r.length>1&&!s&&we(H,()=>{let $=r[r.length-1];return[t("div",{class:"dl-tip-title"},new Date($[0]*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Fe($[2])} · ↑ ${Fe($[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Speed now")),s?"":t("span",{class:"dl-sub"},_("last 15 min"))]),t("div",{class:"dl-speed-cols"},[S(_("Download","speed"),"↓","dl-dn",l),S(_("Upload","speed"),"↑","dl-up",d)]),H,t("div",{class:"dl-speed-today"},[t("span",{},ae(_("Today %s"),t("b",{},oe(c+p)))),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${oe(p)} `,t("span",{class:"dl-up"},"↑"),` ${oe(c)}`])])])}function Rn(n,e){let o=n.slice(-30),s=o.map(d=>d.rx+d.tx),r=Math.max(1,...s),a=s.reduce((d,c)=>d+c,0),i=s.reduce((d,c,p)=>c>s[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},o.map((d,c)=>{let p=s[c],u=t("i",{class:c===o.length-1?"hi":"",style:`height:${Math.max(4,p/r*100)}%`});return we(u,()=>[t("div",{class:"dl-tip-title"},c===o.length-1?`${_("Today")} · ${Ot(d.day)}`:Ot(d.day)),t("div",{},oe(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${oe(d.tx)} ↑ ${oe(d.rx)}`)]),u}));return t("div",{class:"dl-bento-tile month"},[t("div",{class:"dl-bento-head"},[t("span",{},[t("span",{class:"dl-metric-label"},_("Last 30 days")),t("b",{class:"dl-bento-total"},oe(a))]),s[i]>0?t("span",{class:"dl-sub"},`${m(_("peak %s"),oe(s[i]))} · ${Ot(o[i].day)}`):""]),o.length?l:t("p",{class:"dl-muted"},_("No traffic yet.")),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},o.length?Ot(o[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},_("today"))])])}function $r(n){let e=n.slice(-30),o=e.map(r=>r.rx+r.tx),s=Math.max(1,...o);return t("div",{class:"dl-dbars"},e.map((r,a)=>{let i=t("i",{class:`${o[a]?"":"zero"}${a===e.length-1?" hi":""}`});return i.style.height=`${Math.max(8,o[a]/s*100)}%`,we(i,()=>[t("div",{class:"dl-tip-title"},a===e.length-1?`${_("Today")} · ${Ot(r.day)}`:Ot(r.day)),t("div",{},oe(o[a]))]),i}))}function Dr(n){return{apply:_("Repair"),sync:_("Reload devices"),restart:_("Restart service"),netrestart:_("Restart network"),updates:_("Open Components")}[n]??_("Fix")}async function In(n){return n==="netrestart"&&!await me(_("Restart the network?"),_("Every interface restarts. Connections drop for a few seconds."),_("Restart network"))?null:await F(()=>N.healthFix(n),_("Done"))??null}function Ao(n,e,o,s="action"){let r=n.fix;return r?r.startsWith("install:")?A(_("Install"),()=>Er(r.slice(8),o),s):r==="updates"?t("a",{class:`cbi-button cbi-button-${s}`,href:L.url("admin/network/dawnline/updates")},Dr(r)):A(Dr(r),()=>e(r),s):""}function ml(n){return/^(awg|up_|peers_|fw_|reply_|port_|subnet_)/.test(n)?"shield":/^(portal|cert)/.test(n)?"link":/^(ep_|home_|resolver)/.test(n)?"globe":n==="clock"?"clock":n==="agent"?"activity":n==="flash"?"download":n==="nft"?"lock":n==="data"?"users":"alert"}function Ar(n,e,o,s=3){let r=n.filter(i=>i.status==="error"||i.status==="warn").sort((i,l)=>i.status===l.status?0:i.status==="error"?-1:1);if(!r.length)return"";let a=r.length-s;return t("div",{class:"dl-list dl-notices"},[...r.slice(0,s).map(i=>it(ml(i.id),i.status==="error"?"bad":"warn",i.problem??i.title,i.detail,Ao(i,e,o,i.status==="error"?"positive":"neutral"))),a>0?t("a",{class:"dl-row dl-notices-more",href:L.url("admin/network/dawnline/diagnostics")},[m(_("%s more in Diagnostics"),K(a)),t("span",{class:"dl-spacer"}),"→"]):""])}function hl(n){let e=[],o=(l,d)=>t("a",{href:l},d),s=()=>o(L.url("admin/network/dawnline/diagnostics"),_("Open Diagnostics")),r=Ge(n.series),a=!!n.awg_state&&!n.awg_state.ok;for(let l of n.servers)l.enabled&&l.blocked?e.push({tone:"bad",text:[l.blocked," ",s()]}):l.enabled&&!l.up&&!a&&e.push({tone:"bad",text:[m(_("Tunnel %s is down."),l.ifname)," ",s()]});for(let l of n.people){let d=()=>o(Re(l.id),l.name);if(l.state==="quota")e.push({tone:"warn",text:ae(_("%s reached the data limit."),d())});else if(l.state==="expired")e.push({tone:"warn",text:ae(_("%s’s access has ended."),d())});else{let c=st(l.expires,r);rt(l,c)?e.push({tone:"",text:ae(_("%s’s access %s."),d(),an(c))}):c!=null&&c<0&&l.expire_action==="notify"&&e.push({tone:"",text:ae(_("%s’s end date passed (%s) · access kept."),d(),De(l.expires))}),l.quota_limit&&l.quota_used>=l.quota_limit*.9&&e.push({tone:"",text:ae(_("%s has used 90% of the data limit."),d())})}}let i=n.people.flatMap(l=>l.devices.filter(d=>d.config_stale).map(d=>[l,d]));i.length&&e.push({tone:"warn",text:i.length===1?ae(_("%s needs its configuration again."),o(Re(i[0][0].id,i[0][1].id),`${i[0][0].name} · ${i[0][1].name}`)):[W(i.length,"%s device needs its configuration again (networks or DNS changed).","%s devices need their configuration again (networks or DNS changed).")]});for(let l of n.servers)n.wan&&Dt(l.endpoint)&&l.endpoint!==n.wan&&e.push({tone:"warn",text:[m(_("Public address changed: %s still gives devices %s, the router is %s now."),l.name,l.endpoint,n.wan)," ",t("button",{type:"button",class:"dl-fix",click:async d=>{let c=d.currentTarget;c.disabled=!0,await F(()=>N.serverUpdate(l.id,{endpoint:n.wan}),m(_("%s uses %s now - devices need their configuration again"),l.name,n.wan)),c.disabled=!1}},_("Use the new address"))," ",_("A DDNS name would follow it by itself.")]});return n.servers.some(l=>l.lan_like)&&n.like_home.error&&e.push({tone:"warn",text:[m(_("Internet through the LAN is off: %s"),n.like_home.error)," ",o(L.url("admin/network/dawnline/diagnostics"),_("Details"))]}),!n.settings.portal_enabled&&!n.people.length&&e.push({tone:"",text:[_("The personal portal is off.")," ",o(L.url("admin/network/dawnline/settings"),_("Turn on"))]}),e}var Bn=class{constructor(e,o){this.srvId=e;this.go=o;this.el=t("div",{class:"dl-srvov"});this.map=null;this.mapOn=null;this.range="online";this.parts={};this.healthAt=0}mount(e){this.st=en(e,this.srvId);for(let o of["health","bento","map","side","activity"])this.parts[o]=t("div",{});return dom.content(this.el,[this.parts.health,this.parts.bento,this.parts.map,t("div",{class:"dl-grid2"},[this.parts.activity,this.parts.side])]),this.paint(),this.loadHealth(),this.el}update(e,o=!1){this.st=en(e,this.srvId),this.paint(o),Date.now()-this.healthAt>6e4&&this.loadHealth()}async loadHealth(){this.healthAt=Date.now();let e=await N.health().catch(()=>null);if(!e)return;let o=()=>void this.loadHealth(),s=async r=>{await In(r)&&(o(),r==="netrestart"&&setTimeout(o,5e3))};Ae(this.parts.health,Ar(e.checks,r=>void s(r),o),!0)}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now}}paintMap(){let e=this.st.geo.enabled;if(e===this.mapOn&&(!e||this.map)){this.map?.update(this.mapData());return}this.mapOn=e,dom.content(this.parts.map,this.mapCard())}mapCard(){let e=this.st,o=t("div",{class:"dl-panel-head pad"},[t("div",{class:"dl-stack"},[t("h3",{},_("Where people connect from")),t("span",{class:"dl-sub"},_("City-level, from the client IP · locations cached on the router"))]),t("span",{class:"dl-spacer"}),Rt(this.range,l=>{this.range=l,this.map?.setRange(l)})]);if(this.map?.destroy(),this.map=null,!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=this.map=new dt({openPerson:l=>location.href=Re(l),openDevice:(l,d)=>location.href=Re(l,d)},this.range),r=Te(()=>{r(),s.destroy(),this.map===s&&(this.map=null)}),a=t("div",{class:"dl-map-legend"},[t("span",{},[t("i",{class:"line live"}),_("Live tunnel")]),t("span",{},[t("i",{class:"line"}),_("Seen recently")])]),i=t("div",{class:"dl-map-wrap"},[s.el,a]);return requestAnimationFrame(()=>s.mount(this.mapData())),t("div",{class:"dl-panel flush"},[o,i])}paint(e=!1){let o=this.st,s=o.servers[0];this.paintMap(),Ae(this.parts.bento,t("div",{class:"dl-bento"},[this.onlineTile(),this.speedTile(),qe(s).overviewTile(s),this.monthTile()]),e);let r=hl(o);Ae(this.parts.side,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Needs attention")),t("span",{class:"dl-spacer"}),t("a",{href:L.url("admin/network/dawnline/diagnostics")},_("Health"))]),r.length?r.slice(0,8).map(i=>t("div",{class:"dl-attn-item dl-row"},[t("span",{class:`dl-ev-dot ${i.tone}`}),t("span",{},i.text),i.action??""])):t("div",{class:"dl-row dl-muted"},[v("check"),_("All good. Nothing needs you right now.")])]),e);let a=[...o.events].reverse().slice(0,8);Ae(this.parts.activity,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("View all"))]),a.length?a.map(i=>ht(o,i)):t("div",{class:"dl-row dl-muted"},_("Nothing yet. Connections, new devices and pauses appear here."))]),e)}onlineTile(){let e=this.st,o=e.servers[0]?!e.servers[0].enabled:!1,s=12,r=H=>H.spark[H.spark.length-1]??0,a=H=>e.geo.points.find(S=>S.device===H.id&&S.city)?.city,i=H=>/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(H.endpoint??""),l=(H,S=!1)=>i(H)?S&&H.endpoint?`LAN · ${H.endpoint}`:"LAN":a(H)??"",d=H=>[...e.events].reverse().find(S=>S.type==="connect"&&S.device===H.id)?.ts??0,c=e.people.map(H=>({p:H,devs:H.devices.filter(S=>S.online).sort((S,$)=>r($)-r(S))})).filter(H=>H.devs.length).sort((H,S)=>S.devs.reduce(($,b)=>$+r(b),0)-H.devs.reduce(($,b)=>$+r(b),0)),p=c.length<=2,u=({p:H,devs:S})=>{let $=S.map(d).filter(Boolean),b=$.length?Math.min(...$):0,C=(H.rate??[]).slice(-15),w=C[C.length-1],z=w&&e.now-w[0]<180?w:null,y=200,f=30,x=Math.max(1,...C.map(te=>Math.max(te[1],te[2]))),T=te=>C.map((B,Q)=>`${C.length>1?Q/(C.length-1)*y:y},${f-2-B[te]/x*(f-6)}`),I=C.length>1?Tt(``):"",Y=!z||z[1]<64&&z[2]<64,J=H.access==="both"?["home","globe"]:H.access==="lan"?["home"]:["globe"];return[t("div",{class:"dl-hc"},[t("div",{class:"dl-hc-head"},[t("span",{class:"dl-onl-av sm"},je(H.name)),t("span",{class:"dl-stack"},[t("b",{},H.name),t("span",{class:"dl-hc-since"},b?m(_("online for %s"),ot(Math.max(60,e.now-b))):_("online"))]),t("span",{class:"dl-hc-reach"},J.map(te=>t("span",{class:`dl-ibadge ${te==="home"?"lan":"inet"}`},v(te))))]),t("div",{class:"dl-hc-speed"},[t("div",{class:"dl-hc-speed-row"},Y?[t("span",{class:"dl-faint"},_("Idle right now"))]:[t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${Fe(z[2])}`]),t("span",{},[t("span",{class:"dl-up"},"↑"),` ${Fe(z[1])}`]),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint"},_("15 min"))]),I]),t("div",{class:"dl-hc-devs"},S.map(te=>t("span",{class:"dl-hc-dev"},[v(te.kind),te.name,l(te)?[" · ",l(te,!0)]:""]))),t("div",{class:"dl-hc-foot"},[t("span",{class:"dl-faint"},`${m(_("%s today"),oe(S.reduce((te,B)=>te+r(B),0)))} · ${m(_("%s this month"),oe(H.month[0]+H.month[1]))}`)])])]},k=H=>{let{p:S,devs:$}=H,b=t("span",{class:"dl-onl-dev"},$.length>1?String($.length):v($[0].kind)),C=t("a",{class:`dl-onl-p${p?"":" sm"}`,href:Re(S.id),"aria-label":m(_("%s, online"),S.name)},[t("span",{class:"dl-onl-av"},[je(S.name),b]),p?t("span",{class:"dl-onl-name"},S.name):"",p?t("span",{class:"dl-onl-meta"},[...$.slice(0,3).map(w=>v(w.kind)),$.length>3?`+${$.length-3}`:"",l($[0])?t("span",{},[" · ",l($[0])]):""]):""]);return we(C,()=>u(H)),C},M=t("b",{class:`dl-onl-count${c.length?"":" none"}`},String(c.length)),g=c.reduce((H,S)=>H+S.devs.length,0);c.length&&we(M,()=>[`${W(c.length,"%s person","%s people")} · ${W(g,"%s device","%s devices")}`]);let h=c.length>s?c.slice(0,s-1):c,E=e.people.flatMap(H=>H.devices.map(S=>({p:H,d:S}))).filter(H=>H.d.handshake).sort((H,S)=>S.d.handshake-H.d.handshake)[0];return t("div",{class:"dl-bento-tile online"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Online")),M]),c.length?t("div",{class:`dl-onl-row${p?"":" grid"}`},[...h.map(k),c.length>s?t("a",{class:"dl-onl-p sm more",href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(this.srvId)}§ion=people&filter=online`,title:_("Everyone online"),click:H=>{this.go&&(H.preventDefault(),this.go("people","online"))}},[t("span",{class:"dl-onl-av"},`+${c.length-h.length}`)]):""]):t("div",{class:"dl-onl-empty"},[t("span",{},o?_("The server is turned off"):_("Nobody is connected")),E?t("span",{class:"dl-sub"},m(_("Last: %s, %s"),E.p.name,pe(E.d.handshake,e.now))):t("span",{class:"dl-sub"},o?_("Devices connect once it is on"):_("No device has connected yet"))])])}speedTile(){let e=this.st.servers[0];return zn(e?.rate??[],this.st.now,this.st.totals.today,e?!e.enabled:!1)}monthTile(){let e=[...this.st.people].map(o=>[o,o.month[0]+o.month[1]]).filter(([,o])=>o>0).sort((o,s)=>s[1]-o[1]).slice(0,2);return Rn(this.st.series,e.length?m(_("Most: %s"),e.map(([o,s])=>`${o.name} ${oe(s)}`).join(" · ")):"")}};var Nr=["overview","people","connection","access","awg"],fl=n=>({overview:_("Overview"),people:_("People"),connection:_("Connection"),access:_("Access")})[n],gl={general:"connection",network:"connection",interfaces:"access",advanced:"awg",disguise:"awg",tunnel:"awg",core:"awg"},No=(n,e)=>{let o=new URLSearchParams;n&&o.set("server",n),e&&e!=="overview"&&o.set("section",e);let s=o.toString();return`${L.url("admin/network/dawnline/server")}${s?`?${s}`:""}`},on=class{constructor(){this.noFooter=!0;this.root=t("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=t("div",{});this.headEl=t("div",{});this.secEl=t("div",{});this.bodyEl=t("div",{class:"dl-srvbody"})}async load(){let e=await N.status(31),o=e.servers.length?null:await N.setupDefaults();return[e,o]}render([e,o]){if(this.st=e,!e.servers.length&&o)return this.wizard(o);let s=new URLSearchParams(location.search),r=s.get("section")??"",a=gl[r]??r;return Nr.includes(a)&&(this.section=a),this.srvId=(e.servers.find(i=>i.id===s.get("server"))??e.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),this.poller?.stop(),this.poller=pt({fetch:()=>N.status(31),every:30,live:!0,active:()=>this.section==="overview"&&this.root.isConnected,apply:(i,l)=>{i.servers.length&&(this.st=i,this.paintHead(l),this.ov[this.current().id]?.update(i,l))}}),this.root}paintHead(e=!1){Ae(this.headEl,this.head(this.current()),e),(!e||!Bt(this.tabsEl))&&this.paintTabs()}async refreshStatus(){let e=await N.status(31).catch(()=>null);return e?.servers.length?(this.st=e,this.paintHead(),e):null}current(){return this.st.servers.find(e=>e.id===this.srvId)??this.st.servers[0]}async refresh(){let e=await N.status(31).catch(()=>null);e&&(this.st=e,e.servers.length?this.paint():location.href=No())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let e=this.current();dom.content(this.tabsEl,t("div",{class:"dl-srvtabs",role:"tablist","aria-label":_("Servers")},[...this.st.servers.map(o=>t("button",{type:"button",role:"tab",class:`dl-srvtab${o.id===e.id?" on":""}`,"aria-selected":o.id===e.id?"true":"false",click:()=>{o.id!==this.srvId&&(this.srvId=o.id,this.paint())}},[t("i",{class:`dot ${o.enabled?o.up?"ok":"bad":"warn"}`}),t("b",{},o.name)])),t("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[v("plus"),_("Add server")])]))}paintSections(){let e=qe(this.current());dom.content(this.secEl,t("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":_("Server")},Nr.map(o=>t("button",{type:"button",role:"tab","data-section":o,class:o===this.section?"on":"","aria-selected":o===this.section?"true":"false",click:()=>this.showSection(o)},o==="awg"?e.label:fl(o)))))}go(e,o){let s=this.pp[this.current().id];if(o&&s)s.filter=o,s.el&&s.decorate();else if(o){let r=this.pp[this.current().id]=new wt;r.filter=o}this.showSection(e),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let e=[...Object.values(this.ov).map(o=>o.el),...Object.values(this.pp).map(o=>o.el)];for(let o of e)o&&this.bodyEl.contains(o)&&o.remove()}showSection(e){this.section=e,this.secEl.querySelectorAll("[data-section]").forEach(i=>{let l=i.dataset.section===e;i.classList.toggle("on",l),i.setAttribute("aria-selected",l?"true":"false")});let o=this.st,s=this.current(),a={overview:()=>{let i=this.ov[s.id];return i?(i.update(o),i.el):(this.ov[s.id]=new Bn(s.id,(l,d)=>this.go(l,d))).mount(o)},people:()=>{var c,p;let i=this.pp[s.id];if(i?.el)return i.update(),i.el;let l=t("div",{},t("p",{class:"dl-muted"},_("Loading people…")));return((c=this.pp)[p=s.id]??(c[p]=new wt)).embed(o,s.id).then(u=>{l.isConnected?dom.content(l,u):l.replaceChildren(u)}).catch(u=>{delete this.pp[s.id],dom.content(l,t("p",{class:"dl-muted"},m(_("Couldn't show people: %s"),Ce(u))))}),l},connection:()=>this.connection(s),access:()=>this.access(s),awg:()=>this.awg(s)}[e]();this.detachKept(),dom.content(this.bodyEl,a)}head(e){let o=(a,i)=>t("span",{class:"dl-addrbar-seg"},[v(a),...i]),s=e.endpoint||"—",r=t("div",{class:"dl-actions"},[e.enabled?"":A([v("play"),` ${_("Turn on")}`],()=>this.save(e,{enabled:"1"},_("Server turned on")),"add")]);return t("div",{class:"dl-srvpagehead"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),t("span",{class:`dl-pill ${e.enabled?e.up?"ok":"bad":"warn"}`},e.enabled?e.up?_("Running"):e.blocked?_("Can’t start"):_("Not running"):_("Turned off")),t("span",{class:"dl-spacer"}),r]),t("div",{class:"dl-addrbar"},[t("button",{type:"button",class:"dl-addrbar-seg main",title:_("Copy address"),click:()=>xe(s,_("Address copied"))},[v("globe"),t("span",{class:"dl-mono"},s),v("copy")]),o(qe(e).id==="awg"?"amneziawg":"tunnel",[t("span",{class:"dl-mono"},`${qe(e).label} :${e.port}`)]),e.up?o("clock",[m(_("up %s"),ot(e.uptime))]):""]),e.blocked?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},e.blocked)]):""])}async save(e,o,s=_("Saved")){await F(()=>N.serverUpdate(e.id,o),s)&&await this.refresh()}connection(e){let o=he(e.name,{placeholder:_("Home")}),s=he(e.endpoint,{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"}),r=he(e.dns.join(", "),{placeholder:_("This router (recommended)"),class:"cbi-input-text dl-mono"}),a=this.st.people.filter(M=>M.server===e.id).length,i=A([v(e.enabled?"pause":"play"),` ${e.enabled?_("Turn off"):_("Turn on")}`],async()=>{e.enabled&&!await me(m(_("Turn off %s?"),e.name),W(a,"The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted.","The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted."),_("Turn off"),!0)||await this.save(e,{enabled:e.enabled?"0":"1"},e.enabled?_("Server turned off"):_("Server turned on"))},e.enabled?"negative":"positive"),l=this.st.settings.portal_host,d=_e(_("Name"),o,()=>He(o.value,[],_("Shown to people in their portal and apps."))),c=lo(()=>({host:s.value,port:e.port,id:e.id}),(M,g,h)=>N.endpointProbe(M,g,h),()=>p.refresh(),{empty:l?m(_("Empty = the portal’s address (%s)."),l):_("Empty = the portal’s address.")}),p=_e(_("Public address"),s,c.help);s.addEventListener("input",c.schedule),c.schedule();let u=e.reached?m(_("Reached from the internet %s."),pe(e.reached,this.st.now)):_("Never reached from the internet yet - test with a phone on mobile data."),k=_e(_("DNS for devices"),r,()=>cs(r.value,e.address));return t("div",{class:"dl-stack gap16"},[Wt(_("Connection"),[t("p",{class:"dl-muted"},_("The name people see, where devices find the router, and DNS. The port is on AmneziaWG.")),ke("router",_("Server"),_("What people see"),[d]),ke("globe",_("Devices connect to"),_("A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)"),[p,t("div",{class:`dl-sub ${e.reached?"ok":"warn"}`},u)]),ke("file",_("For every device"),_("Changing it marks devices “Update config” until they import again"),[k])],[t("span"),A(_("Save"),()=>{let M=Ue([d,p,k]);if(M){q(M,"warning");return}return this.save(e,{name:o.value,endpoint:s.value,dns:r.value})},"positive")]),Wt(_("Danger zone"),[t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},e.enabled?_("Turn off this server"):_("This server is off")),t("span",{class:"dl-sub"},e.enabled?_("Stops the tunnel and disconnects everyone on it. Settings and people are kept."):_("Nobody can connect. Turn it on to bring the tunnel back."))]),t("div",{class:"dl-setrow-ctl"},i)]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Change the tunnel network")),t("span",{class:"dl-sub"},m(_("Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again."),`${$t(e.subnet)}.x`))]),t("div",{class:"dl-setrow-ctl"},A([v("edit"),` ${_("Change")}`],()=>this.changeSubnet(e),"negative"))]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Remove server")),t("span",{class:"dl-sub"},W(a,"Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))]),t("div",{class:"dl-setrow-ctl"},A([v("trash"),` ${_("Remove")}`],()=>this.remove(e),"negative"))])],[],"danger")])}access(e){let o=Po(this.st,e),s=Tr(e,this.st,async()=>{let r=await this.refreshStatus();if(!r)return;let a=r.servers.find(l=>l.id===e.id)??e;s.update(r);let i=Po(r,a);o.replaceWith(i),o=i});return t("div",{class:"dl-stack gap16"},[s.el,t("div",{class:"dl-health-cols"},[o,yr(this.st,e)])])}awg(e){let o={st:this.st,save:(s,r)=>this.save(e,s,r),refresh:()=>this.refresh()};return t("div",{class:"dl-stack gap16"},[qe(e).settingsCard(o,e)])}async addServer(){let e=await F(()=>N.setupDefaults());e&&dom.content(this.root,this.wizard(e,!0,()=>{dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint()}))}async changeSubnet(e){let o=await F(()=>N.serverPorts(e.id));if(!o)return;let s=o.networks??[],r=this.st.people.filter(l=>l.server===e.id).reduce((l,d)=>l+d.devices.length,0),a=he($t(e.subnet),{class:"cbi-input-text dl-mono dl-w-range"}),i=_e(_("Address range"),a,()=>ao(a.value,s,""));de(_("Change the tunnel network"),[i,t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you).","%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you)."):_("No devices on this server yet: nothing else changes."))],[ue()," ",A(_("Change"),async()=>{let l=i.help();if(l.bad){q(l.text,"warning");return}let d=mn(a.value);if(d===e.subnet){ce();return}await F(()=>N.serverUpdate(e.id,{subnet:d}),_("Tunnel network changed"))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3),await this.refresh())},"negative")]),setTimeout(()=>a.select(),50)}async remove(e){let o=this.st.people.filter(s=>s.server===e.id);de(m(_("Remove %s?"),e.name),[t("p",{},W(o.length,"This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))],[ue()," ",A(_("Remove"),async()=>{ce(),await F(()=>N.serverDelete(e.id),_("Server removed"))&&setTimeout(()=>{location.href=No()},800)},"negative")])}wizard(e,o=!1,s){let r={id:e.id,name:e.name,endpoint:e.endpoint,port:e.port,range:$t(e.subnet),preset:wn(e.awg),portal:!1,portal_port:e.portal_port||8443,lan_like:!0,lan_zone:e.lan_zone,wan_zone:e.wan_zone},a=0,i=!o&&r.portal_port===r.port,l=()=>/^\d{1,3}(\.\d{1,3}){3}$/.test(r.endpoint),d=()=>Gt(r.port,e.udp_taken??[],r.port===4500?`${_("Opened on the WAN firewall automatically.")} ${_("4500 is IPsec’s port: most networks let it through.")}`:_("Opened on the WAN firewall automatically.")),c={ddns:_("From your DDNS name."),cert:_("From your Let’s Encrypt certificate."),wan:_("Your WAN address now - it may change; a DDNS name is better."),portal:_("The portal’s address.")},p=lo(()=>({host:r.endpoint,port:r.port}),(x,T,I)=>N.endpointProbe(x,"",I),()=>u?.refresh(),{idle:()=>r.endpoint===e.endpoint&&e.endpoint_from?c[e.endpoint_from]??"":""}),u=null,k=e.wan_kind==="cgnat"||e.wan_kind==="private"?it("alert","warn",e.wan_kind==="cgnat"?_("Your router has no public address (CGNAT)"):m(_("Your router is behind another router (WAN %s)"),e.wan_ip),e.wan_kind==="cgnat"?_("The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address."):_("Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here."),""):"",M=e.awg_state?.tools&&e.awg_state.handler===!1?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started."))]):"",g=()=>ao(r.range,e.networks??[],$t(e.subnet)),h=()=>hn(r.portal_port,e.tcp_taken??[],l()),E=t("div",{class:"dl-wizard"}),H=(x,T={})=>{let I=he(String(r[x]),T);return I.addEventListener("input",()=>{x==="port"||x==="portal_port"?r[x]=I.value.trim()===""?0:Number(I.value):r[x]=I.value.trim(),x==="port"&&i&&(r.portal_port=r.port),x==="portal_port"&&(i=r.portal_port===r.port)}),I},S={id:"server",title:_("Server"),render:()=>t("div",{class:"dl-wizard-groups"},[t("p",{class:"dl-muted"},o?_("One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page."):_("Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.")),ke("router",_("Server"),_("What people see"),[_e(_("Name"),H("name"),()=>He(r.name,[],_("Shown to people in their portal and apps.")))]),ke("globe",_("Devices connect to"),_("A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT"),[(()=>{let x=H("endpoint",{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"});return u=_e(_("Public address"),x,p.help),x.addEventListener("input",p.schedule),p.schedule(),u})()]),k,M]),check:()=>{let x=He(r.name);if(x.bad)return m(_("Name: %s"),x.text);let T=Pt(r.endpoint,r.port);return T.bad?m(_("Public address: %s"),T.text):null}},$={id:"awg",title:"AmneziaWG",render:()=>t("div",{class:"dl-wizard-groups"},[ke("globe",_("Listening"),_("Where devices reach AmneziaWG from the internet"),[_e(_("UDP port"),H("port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),d)]),ke("network",_("Tunnel network"),_("Addresses devices get inside the tunnel"),[(()=>{let x=H("range",{class:"cbi-input-text dl-w-range dl-mono","aria-label":_("First three numbers of the device addresses")});return _e(_("Device addresses"),x,g,t("span",{class:"dl-suffixed"},[x,t("span",{class:"dl-mono"},".x")]))})()]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[yn(e.awg,r.preset,x=>r.preset=x,void 0,e.awg_state?.tools!==!1)])]),check:()=>{let x=d();if(x.bad)return m(_("UDP port: %s"),x.text);let T=g();return T.bad?m(_("Device addresses: %s"),T.text):null}},b={id:"portal",title:_("Portal"),render:()=>{let x=H("portal_port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),T=_e(_("Listening port"),x,h);T.hidden=!r.portal;let I=Me([["off",_("Off")],["on",_("On")]],r.portal?"on":"off",{label:_("Personal portal"),onChange:Y=>{r.portal=Y==="on",T.hidden=!r.portal}});return t("div",{class:"dl-wizard-groups"},[ke("home",_("Internet like a home device"),_("How devices reach the internet"),[ge(_("Through the home network"),ye(r.lan_like,_("Internet like a home device"),Y=>r.lan_like=Y),_("Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access."))]),ke("link",_("Personal portal"),_("A page where each person adds their own devices with their personal link"),[ge(_("Portal"),I,_("Off: only you add devices, from LuCI. On: people manage their devices within the limits you set.")),T])])},check:()=>{if(!r.portal)return null;let x=h();return x.bad?m(_("Portal port: %s"),x.text):null}},C=()=>[S,$,o?null:b].filter(x=>x!=null),w=e.awg_state,z=w?.missing??[],y=z.length?t("div",{class:"dl-list dl-notices"},[it("shield","bad",_("AmneziaWG isn’t installed"),m(_("The tunnel needs %s. Install the build made for this firmware, then create the server."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(z)),A(_("Install"),()=>Nn(()=>location.reload()),"positive"))]):w&&!w.loaded?t("div",{class:"dl-list dl-notices"},[it("shield","warn",_("AmneziaWG’s kernel module doesn’t load on this firmware"),_("Try another build in Components, or update OpenWrt. The server can’t start until it loads."),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/updates")},_("Open Components")))]):"",f=()=>{let x=C();a>=x.length&&(a=x.length-1),dom.content(E,[t("h2",{},o?_("Add a server"):_("Set up Dawnline")),y,t("div",{class:"dl-steps"},x.map((T,I)=>t("span",{class:`dl-step${I===a?" current":I0?A(_("Back"),()=>{a--,f()}):s?A(_("Cancel"),s):"",t("span",{class:"dl-spacer"}),a{let T=x[a].check?.();if(T){q(T,"warning");return}a++,f()},"positive"):A(_("Create server"),async()=>{for(let I of x){let Y=I.check?.();if(Y){q(Y,"warning");return}}let T=await F(()=>N.serverCreate(r.id,r.name,e.ifname,r.port,mn(r.range),r.endpoint,e.mtu,r.preset,r.lan_zone,r.wan_zone,r.lan_like,o?void 0:r.portal,o?void 0:r.portal_port),_("Server created"));T&&(T.network_restart&&q(_("Restarting the network so it knows AmneziaWG: back in a few seconds")),setTimeout(()=>{location.href=No(T.id)},T.network_restart?1e4:1500))},"positive",{disabled:z.length>0,title:z.length?_("Install AmneziaWG first"):null})])])};return f(),E}};function ft(n){let e={el:n(),refresh(){let o=n();e.el.replaceWith(o),e.el=o}};return e}function We(n,e,o,s,r="",a=[]){return t("section",{class:`dl-setsec ${r}`,id:`dl-set-${n}`},[t("div",{class:"dl-setsec-body"},[a.length?t("div",{class:"dl-setsec-head"},[t("h3",{},e),t("span",{class:"dl-spacer"}),...a]):t("h3",{},e),...o]),s.length?t("div",{class:"dl-setsec-foot"},s):""])}function Hr(n){let e=n.filter(r=>r.status!=="skip"),o=e.filter(r=>r.status==="error"||r.status==="warn"),s=e.some(r=>r.status==="error")?"error":o.length?"warn":"ok";return{bad:o,worst:s}}function zr(n){let e=n.d.settings,o=n.d.effective,s=n.d.cert,r=ye(o.portal_enabled,_("Enable portal")),a=he(e.portal_port,{placeholder:"8443",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),i=he(e.portal_redirect,{placeholder:_("Show “Not found”"),class:"cbi-input-text dl-mono"}),l=he("",{placeholder:_("vpn.example.com or an IP"),"aria-label":_("Other address")}),d=j=>/^\d{1,3}(\.\d{1,3}){3}$/.test(j),c=[o.portal_host,...o.portal_alt??[]].filter((j,V,le)=>j&&le.indexOf(j)===V),p=!!n.portal,u=[],k=j=>{j&&!u.some(V=>V.host===j)&&u.push({host:j,kind:d(j)?"ip":"name",ips:[],here:!1,cloudflare:!1,cert:!1})},M=j=>{u=[...j,...u.filter(V=>!j.some(le=>le.host===V.host))],!c.length&&j[0]&&(c=[j[0].host])};n.portal&&M(n.portal.candidates),c.forEach(k);let g=j=>j.kind==="ip"?t("span",{class:"dl-addr-warn"},[v("alert"),_("Plain HTTP: the link and VPN keys travel unencrypted")]):t("span",{class:"dl-sub"},j.cloudflare?_("Behind Cloudflare · often stalls in Russia"):j.ips.length?j.here?j.cert?_("Points at this router · Let’s Encrypt certificate"):_("Points at this router · no certificate yet"):m(_("Points at %s, not this router"),j.ips.join(", ")):p?_("Your address"):_("Checking where it points…")),h=t("div",{class:"dl-addr-opts",role:"group","aria-label":_("Portal addresses")}),E=j=>{c.includes(j)?c.length>1&&(c=c.filter(V=>V!==j)):c=[...c,j],H(),b()},H=()=>dom.content(h,[...u.map(j=>{let V=c.includes(j.host),le=c[0]===j.host;return t("div",{class:`dl-addr-opt${V?" on":""}`,role:"checkbox","aria-checked":V?"true":"false",tabindex:"0",click:()=>E(j.host),keydown:ve=>{(ve.key===" "||ve.key==="Enter")&&(ve.preventDefault(),E(j.host))}},[t("i",{class:"dl-addr-check"},V?v("check"):""),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono"},j.host),g(j)]),le?t("span",{class:"dl-pill info"},_("Main")):V?t("button",{type:"button",class:"dl-linkbtn",click:ve=>{ve.stopPropagation(),c=[j.host,...c.filter(R=>R!==j.host)],H(),b()}},_("Make main")):j.cloudflare?t("span",{class:"dl-pill warn"},"Cloudflare"):j.kind==="ip"?t("span",{class:"dl-pill"},"IP"):j.here&&j.cert?t("span",{class:"dl-pill ok"},_("Recommended")):""])}),t("div",{class:"dl-addr-opt other"},[t("i",{class:"dl-addr-check"},v("plus")),l,A(_("Add"),()=>{let j=l.value.trim().toLowerCase();if(!j)return;let V=Pt(j);if(V.bad){q(V.text,"warning");return}k(j),c.includes(j)||(c=[...c,j]),l.value="",H(),b()})])]);l.addEventListener("keydown",j=>{j.key==="Enter"&&(j.preventDefault(),l.nextElementSibling?.click())});let S=t("div",{class:"dl-links"}),$=()=>{},b=()=>{$();let j=Number(a.value)||o.portal_port;dom.content(S,c.map((V,le)=>{let ve=d(V),R=ve?j+1:j,O=`${ve?"http":"https"}://${V}${R===(ve?80:443)?"":`:${R}`}/`;return t("div",{class:"dl-link-row"},[t("span",{class:`dl-link-ic ${ve?"warn":"ok"}`},v(ve?"alert":"lock")),t("span",{class:"dl-mono dl-link-url"},[O,t("b",{},"kamiro-telosu-bavine")]),le===0?t("span",{class:"dl-pill info"},_("Main")):ve?t("span",{class:"dl-pill warn"},"HTTP"):""])}))};H(),b(),a.addEventListener("input",()=>b());let C={portal:_("Portal running"),portal_dns:_("Points here"),portal_reply:_("Answers reach visitors"),portal_http:_("Plain HTTP"),cert:_("Certificate")},w=n.d.needs??{https:[],acme:[],home:[]},z=j=>{if(!o.portal_enabled)return t("div",{hidden:!0});if(!j)return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);let V=j.filter(P=>P.status!=="skip");if(!V.length)return t("div",{hidden:!0});let{bad:le,worst:ve}=Hr(j),R=t("div",{class:"dl-ready-details",hidden:!0},V.map(P=>t("div",{class:`dl-ready-item ${P.status}`},[v(P.status==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("span",{},P.title),t("span",{class:"dl-sub"},P.detail)])]))),O=t("div",{class:"dl-stack gap8"},[t("div",{class:`dl-ready-sum ${ve}`},[v(ve==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("b",{},ve==="ok"?W(V.length,"All %s check passed","All %s checks passed"):m(N_(V.length,"%s of %s check passed","%s of %s checks passed"),K(V.length-le.length),K(V.length))),le.length?t("span",{class:"dl-sub"},le.map(P=>P.detail).join(" ")):t("span",{class:"dl-sub"},_("Links will open for the people you send them to."))]),t("button",{type:"button",class:"dl-linkbtn",click:P=>{R.hidden=!R.hidden,P.currentTarget.textContent=R.hidden?_("Details"):_("Hide")}},_("Details"))]),t("div",{class:"dl-chips-row"},V.map(P=>t("span",{class:`dl-check-chip ${P.status}`,title:P.detail},[v(P.status==="ok"?"check":"alert"),C[P.id]??P.title]))),R]);return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[O])},y=j=>{if(!o.portal_enabled||!j&&!w.https.length)return t("span",{hidden:!0});if(w.https.length)return t("span",{class:"dl-pill bad"},_("Can’t start"));let{worst:V}=Hr(j);return t("span",{class:`dl-pill ${V==="ok"?"ok":V==="error"?"bad":"warn"}`},V==="error"?_("Needs attention"):_("Ready"))},f=z(n.portal?.checks??null),x=y(n.portal?.checks??null);n.portalFill=j=>{p=!0,M(j.candidates),H(),b();let V=z(j.checks);f.replaceWith(V),f=V;let le=y(j.checks);x.replaceWith(le),x=le};let T=s&&!s.self_signed&&s.expires?Oe(s.expires):"",I=_e(_("Listening port"),a,()=>hn(a.value.trim()===""?o.portal_port:Number(a.value),n.d.tcp_taken??[],c.some(d)));$=I.refresh;let Y=_e(_("Unknown links"),i,()=>gs(i.value)),J=!!(e.portal_cert&&e.portal_key),te=s?J?_("Your files"):s.self_signed?_("Self-signed"):"Let’s Encrypt":_("Portal is off"),B=()=>{let j=he(e.portal_cert,{placeholder:"/etc/ssl/…/fullchain.crt"}),V=he(e.portal_key,{placeholder:"/etc/ssl/…/key"});de(_("Use your own certificate"),[t("p",{class:"dl-muted"},_("Paths on the router. Leave both empty to pick a certificate automatically.")),ge(_("Certificate file"),j),ge(_("Key file"),V)],[ue()," ",A(_("Save"),()=>{ce(),n.save({portal_cert:j.value.trim(),portal_key:V.value.trim()},_("Certificate saved"),"portal")},"positive")])},Q=(j,V,le,ve,R,O)=>it(j,V,le,ve,A(O,()=>nn(R,w[R],()=>n.reload("portal")),"positive")),ne=w.https.length?Q("lock","bad",_("HTTPS isn’t available on this router"),m(_("The portal needs %s. It can’t start without them."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(w.https)),"https",_("Install")):"",fe=w.acme.length&&(!s||s.self_signed)?Q("lock","",_("Free certificate from Let’s Encrypt"),e.portal_host?m(_("ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning."),e.portal_host):_("ACME isn’t installed. With it the router gets a certificate and browsers stop warning."),"acme",_("Install ACME")):"",se=[t("div",{class:"dl-row"},[v("lock"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},[te,T?t("span",{class:"dl-faint"},` · ${m(_("until %s"),T)}`):""]),t("span",{class:"dl-sub dl-ellipsis",title:s?.path??""},s?s.self_signed?_("Made by the router: browsers warn until a certificate covers the address."):`${J?_("Your files"):_("Found automatically")} · ${s.path}`:_("Turn the portal on to see its certificate."))])]),t("div",{class:"dl-row"},[v("file"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Your own files")),t("span",{class:"dl-sub"},J?`${e.portal_cert} · ${e.portal_key}`:_("Not set: the certificate is picked automatically."))]),J?A(_("Reset"),()=>n.save({portal_cert:"",portal_key:""},_("Automatic certificate"),"portal"),"negative"):"",A(J?_("Change"):_("Use files"),B)]),fe];return We("portal",_("Personal portal"),[t("span",{class:"dl-muted"},_("A page where each person adds and manages their devices with their personal link.")),ne?t("div",{class:"dl-list"},[ne]):"",ke("network",_("Port"),_("How the portal listens (80 and 443 stay free)"),[I]),ke("edit",_("Appearance"),_("What people see"),[Y]),ke("link",_("Addresses"),_("Pick one or more; the first is the main link"),[h,t("div",{class:"dl-stack gap8"},[S,t("span",{class:"dl-sub"},_("Example code; each person gets their own three words."))])]),ke("lock",_("Certificate"),_("Used for HTTPS links"),se),f],[t("span"),A(_("Save"),()=>{let j=Ue([I,Y]);if(j){q(j,"warning");return}return n.save({portal_enabled:ze(r)?"1":"0",portal_host:c[0]??"",portal_alt:c.slice(1),portal_port:a.value,portal_redirect:i.value.trim()},_("Saved"),"portal")},"positive")],"",[x,r])}function Rr(n){let e=n.d.settings,o=n.d.effective,s=he(e.default_device_limit,{placeholder:"3",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),r=ye(o.hostnames,_("Device hostnames")),a=he(e.domain,{placeholder:"lan",class:"cbi-input-text dl-w-port"}),i=he(e.home_dns_fallback==="none"?"":e.home_dns_fallback||o.home_dns_fallback||"",{placeholder:_("None"),inputmode:"decimal",class:"cbi-input-text dl-w-ip dl-mono"}),l=_e(_("Devices per person"),s,()=>{if(!s.value.trim())return{text:_("The default, 3. Pre-filled when you add someone."),bad:!1};let p=fn(s.value);return p.bad?p:{text:_("Pre-filled when you add someone."),bad:!1}}),d=_e(_("Device hostnames"),a,()=>vs(a.value),t("div",{class:"dl-hostport"},[r,t("span",{class:"dl-faint dl-mono"},"phone.myata."),a])),c=_e(_("Fallback DNS"),i,()=>{let p=bs(i.value);return p.bad?p:{text:m(_("For Home-only devices using home names: %s"),p.text),bad:!1}});return We("defaults",_("New people"),[l,d,c],[t("span"),A(_("Save"),()=>{let p=Ue([l,d,c]);if(p){q(p,"warning");return}return n.save({default_device_limit:s.value,hostnames:ze(r)?"1":"0",domain:a.value,home_dns_fallback:i.value},_("Saved"),"defaults")},"positive")])}function Ir(n){let e=n.d.effective,o=ye(e.geo_enabled,_("Locations")),s=t("select",{class:"cbi-input-select"},[t("option",{value:"ipwho.is",selected:e.geo_provider!=="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipwho.is","ipapi.co")),t("option",{value:"ipapi.co",selected:e.geo_provider==="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipapi.co","ipwho.is"))]);return We("map",_("Map & locations"),[t("div",{class:"dl-setrow head"},[t("span",{class:"dl-muted"},_("Show where people connect from on the Overview and person pages, at city level.")),o]),ge(_("Provider"),s)],[t("span",{class:"dl-sub"},_("The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map.")),A(_("Save"),()=>n.save({geo_enabled:ze(o)?"1":"0",geo_provider:s.value},_("Saved"),"map"),"positive")])}var vl=()=>[["app","Dawnline"],["amneziawg","AmneziaWG"],["packages",_("System packages")]];function Br(n){let e=n.d.effective.updates,o=ye(e.check,_("Check automatically"),g=>M(g,ze(r))),s=Me([["6h",_("Every 6 h")],["12h",_("Every 12 h")],["1d",_("Daily")],["7d",_("Weekly")]],e.interval,{label:_("How often"),cls:"sm"}),r=ye(e.auto,_("Install automatically"),g=>M(ze(o),g)),a=he(e.time,{placeholder:"04:00",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono","aria-label":_("Time")}),i=Me([["scheduled",_("At a set time")],["immediate",_("As soon as found")]],e.mode,{label:_("When"),cls:"sm",onChange:g=>a.hidden=g!=="scheduled"});a.hidden=e.mode!=="scheduled";let l=new Set(e.targets),d=t("div",{class:"dl-chips-row"},vl().map(([g,h])=>{let E=Xe(h,l.has(g),()=>{l.delete(g)||l.add(g),xn(E,l.has(g))});return E})),c=ye(e.keep,_("Keep the previous version")),p=ye(e.mirrors,_("GitHub mirrors")),u=ge(_("How often"),s),k=[ge(_("When"),t("div",{class:"dl-hostport"},[i,a]),_("A set time keeps tunnel restarts out of the evening; the run happens within an hour of it.")),ge(_("Components"),d,_("AmneziaWG is off by default: a new kernel module restarts every tunnel."))],M=(g,h)=>{u.hidden=!g;for(let E of k)E.hidden=!h};return M(e.check,e.auto),We("updates",_("Updates"),[t("span",{class:"dl-muted"},_("How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first.")),ge(_("Check automatically"),o,_("Looks for new versions in the background; Components shows what it found and the service log names it.")),u,ge(_("Install automatically"),r,_("Downloads and installs new versions of the components below.")),...k,ge(_("Keep the previous version"),c,_("Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB.")),ge(_("GitHub mirrors"),p,_("When GitHub is unreachable, download through mirrors. Checksums are still verified."))],[t("span",{class:"dl-sub"},_("Run a check or an update by hand in Components.")),A(_("Save"),()=>{if(i.dataset.value==="scheduled"){let g=xs(a.value);if(g.bad){q(m(_("Time: %s"),g.text),"warning");return}}return n.save({update_check:ze(o)?"1":"0",update_interval:s.dataset.value,update_auto:ze(r)?"1":"0",update_mode:i.dataset.value,update_time:a.value.trim(),update_targets:[...l],update_keep:ze(c)?"1":"0",update_mirrors:ze(p)?"1":"0"},_("Saved"),"updates")},"positive")])}function Or(n){let e=n.d.logs,o=e.policy,s=Me([["7",W(7,"%s day","%s days")],["30",W(30,"%s day","%s days")],["90",W(90,"%s day","%s days")],["365",W(1,"%s year","%s years")],["0",_("No limit","retention")]],String(o.keep_days),{label:_("Keep activity"),cls:"sm"}),r=Me([["500",K(500)],["2000",K(2e3)],["5000",K(5e3)],["20000",K(2e4)]],String(o.max),{label:_("Maximum events"),cls:"sm"}),a=Me([["10min",_("Every 10 min")],["hourly",_("Hourly")],["off",_("Memory only")]],o.persist,{label:_("Save to flash"),cls:"sm"}),i=Me([["31",W(1,"%s month","%s months")],["62",W(2,"%s month","%s months")],["180",W(6,"%s month","%s months")],["365",W(1,"%s year","%s years")],["730",W(2,"%s year","%s years")]],String(o.usage_days),{label:_("Daily traffic"),cls:"sm"}),l=Me([["12",W(1,"%s year","%s years")],["24",W(2,"%s year","%s years")],["60",W(5,"%s year","%s years")],["120",W(10,"%s year","%s years")]],String(o.usage_months),{label:_("Monthly traffic"),cls:"sm"}),d=new Set(o.categories),c=t("div",{class:"dl-chips-row"},Nt.map(M=>{let g=Xe([Ye(M),t("b",{},K(e.by_category[M]??0))],d.has(M),()=>{d.delete(M)||d.add(M),xn(g,d.has(M))},{title:ws(M)});return g})),p=e.oldest?Oe(new Date(e.oldest*1e3)):"",u=(M,g,h,E)=>t("div",{class:"dl-row"},[v(M),t("span",{class:"dl-row-main dl-stack"},[t("b",{},g),t("span",{class:"dl-sub"},h)]),...E]),k=M=>A(M.toUpperCase(),async()=>{let[g,h]=await Promise.all([N.status(1),N.events(2e4)]);Qe(g,h.events,M)},"neutral",{title:m(_("Download the log as %s"),M.toUpperCase())});return We("logs",_("Logs & history"),[t("p",{class:"dl-muted"},bn(o)),ge(_("Keep activity"),s,_("Older events are removed automatically.")),ge(_("Maximum size"),r,_("Newest events are kept when the log is full.")),ge(_("Record"),c,_("Switched-off categories are not logged from now on.")),ge(_("Save to flash"),a,_("The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot.")),ge(_("Daily traffic"),i,_("Per-day history behind the charts.")),ge(_("Monthly traffic"),l,_("Per-month totals; data limits use the current month.")),t("h4",{class:"dl-setsub"},_("Stored data")),t("div",{class:"dl-list"},[u("activity",_("Activity log"),e.events?`${m(_("%s since %s"),W(e.events,"%s event","%s events"),p)} · ${o.persist==="off"?m(_("%s in memory"),Et(e.log_ram)):m(_("%s in memory, %s on flash"),Et(e.log_ram),Et(e.log_flash))}`:_("Empty"),[k("csv"),k("json"),A(_("Clear"),()=>lt(_("Clear activity"),_("Removes events from the log on the router."),{},()=>n.reload("logs")),"negative")]),u("chart",_("Traffic history"),e.usage_days?`${m(_("%s since %s"),W(e.usage_days,"%s day","%s days"),Oe(e.usage_since))} · ${m(_("%s on flash"),Et(e.usage_flash))}`:_("Empty"),[A(_("Reset"),()=>Ht("all","","",()=>setTimeout(()=>n.reload("logs"),300)),"negative")]),u("pin",_("Location cache"),`${W(n.d.geo_cached,"%s address","%s addresses")} · ${m(_("%s on flash"),Et(e.geo_flash))}`,[A(_("Clear"),async()=>{await F(()=>N.geoClear(),_("Location cache cleared"))&&await n.reload("logs")},"negative")])])],[t("span",{class:"dl-sub"},_("Clear one person or device from their own page.")),A(_("Save"),()=>n.save({log_keep_days:s.dataset.value,log_max:r.dataset.value,log_persist:a.dataset.value,usage_keep_days:i.dataset.value,usage_keep_months:l.dataset.value,log_category:[...d]},_("Saved"),"logs"),"positive")])}function bl(n){return{manual:_("Manual"),auto:_("Nightly"),"pre-restore":_("Before restore"),"pre-import":_("Before import"),"pre-delete":_("Before removing a server"),"pre-update":_("Before update")}[n]??n}var jr=3;function Ho(n){let e=new Date(n*1e3),o=e.toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"}),s=Math.round((new Date(new Date().toDateString()).getTime()-new Date(e.toDateString()).getTime())/864e5);return s===0?m(_("Today, %s"),o):s===1?m(_("Yesterday, %s"),o):`${e.toLocaleDateString(ie(),{day:"numeric",month:"short"})}, ${o}`}async function xl(n){let e=await F(()=>N.backupRead(n.name));if(!e)return;let o=atob(e.data),s=new Uint8Array(o.length);for(let a=0;axl(n),"neutral","dl-icon-only"),$e("more",_("More"),o=>Se(o.currentTarget,[{label:_("Restore"),icon:v("reset"),run:async()=>{await me(_("Restore this backup?"),m(_("Everything returns to %s. The current state is backed up first."),Ho(n.created)),_("Restore"),!0)&&await F(()=>N.backupRestore(n.name),_("Restored"))&&e(!0)}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(_("Delete this backup?"),m(_("The backup from %s is removed from the router."),Ho(n.created)),_("Delete"),!0)&&await F(()=>N.backupDelete(n.name),_("Backup deleted"))&&e()}}]),"neutral","dl-icon-only")])])}function Wr(n,e){let o=n.slice(0,jr).map(d=>Ur(d,e)),s=n.slice(jr),r=n.length?t("div",{class:"dl-list"},[...o,s.length?t("details",{class:"dl-bk-older"},[t("summary",{},[v("chevron"),W(s.length,"%s older backup","%s older backups")]),...s.map(d=>Ur(d,e))]):""]):t("div",{class:"dl-list"},[t("div",{class:"dl-row dl-muted"},_("No backups yet."))]),a=A(_("Restore from file"),async()=>{let d=await eo(".tar.gz,.tgz,application/gzip","base64");if(!d)return;await me(_("Restore from file?"),m(_("Replace the current Dawnline configuration with %s? The current state is backed up first."),d.name),_("Restore"),!0)&&await F(()=>N.backupUpload(d.data),_("Restored"))&&e(!0)}),i=A(_("Export JSON"),async()=>{let d=await F(()=>N.exportJson());d&&Ne(`dawnline-export-${new Date().toISOString().slice(0,10)}.json`,JSON.stringify(d,null,2),"application/json")}),l=A(_("Import JSON"),async()=>{let d=await eo(".json,application/json","text");if(!d)return;let c;try{c=JSON.parse(d.data)}catch{q(_("Not a JSON file."),"error");return}await me(_("Import?"),_("This replaces the whole Dawnline configuration on this router. The current state is backed up first."),_("Import"),!0)&&await F(()=>N.importJson(c),_("Imported"))&&e(!0)});return t("section",{class:"dl-setsec",id:"dl-set-backups"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-setsec-head"},[t("div",{class:"dl-stack"},[t("h3",{},_("Backups")),t("span",{class:"dl-sub"},_("Nightly when something changed, and before every restore, import or update. The last 10 are kept."))]),t("span",{class:"dl-spacer"}),A([v("plus")," ",_("Back up now")],async()=>{await F(()=>N.backupCreate(),_("Backup created"))&&e()},"positive")]),r]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},_("Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router.")),t("span",{class:"dl-row-actions dl-bk-actions"},[a,i,l])])])}var zo="remove";function wl(){let n=he("",{placeholder:zo}),e=A(_("Remove Dawnline"),async()=>{await F(()=>N.uninstall(n.value.trim()),_("Dawnline removed"))&&(ce(),setTimeout(()=>location.reload(),800))},"negative",{disabled:!0});n.addEventListener("input",()=>{e.disabled=n.value.trim()!==zo}),de(_("Remove Dawnline?"),[t("p",{},m(_("Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm."),zo)),n],[ue()," ",e])}function Gr(){return We("danger",_("Remove Dawnline from this router"),[t("p",{class:"dl-muted"},_("Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup."))],[t("span"),A(_("Remove"),()=>wl(),"negative")],"danger")}var On=class{constructor(){this.root=t("div",{class:"dl-settings-main"});this.backups=[];this.portal=null;this.portalSeq=0;this.cards={}}load(){return N.settingsGet()}render(e){this.d=e,this.cards={portal:ft(()=>zr(this)),defaults:ft(()=>Rr(this)),map:ft(()=>Ir(this)),updates:ft(()=>Br(this)),logs:ft(()=>Or(this)),backups:ft(()=>Wr(this.backups,r=>this.loadBackups(r))),danger:ft(()=>Gr())};let o=["portal","defaults","map","updates","logs","backups","danger"];dom.content(this.root,o.map(r=>this.cards[r].el)),this.loadBackups().then(()=>{new URLSearchParams(location.search).get("section")==="backups"&&document.getElementById("dl-set-backups")?.scrollIntoView({block:"start"})}),this.loadPortal();let s=new URLSearchParams(location.search).get("section");return s&&s!=="backups"&&requestAnimationFrame(()=>document.getElementById(`dl-set-${s}`)?.scrollIntoView({block:"start"})),t("div",{},[t("div",{class:"dl-pagehead"},[t("h2",{class:"dl-h1"},_("Settings"))]),this.root])}async save(e,o,s){let r=await F(()=>N.settingsUpdate(e),o);r&&(this.d=r,this.cards[s].refresh(),s==="portal"&&this.loadPortal())}async loadPortal(){let e=++this.portalSeq,o=await N.portalInfo().catch(()=>null);e===this.portalSeq&&(this.portal=o??this.portal??{candidates:[],checks:[]},this.portalFill?.(this.portal))}async loadBackups(e=!1){e&&await this.reload();let o=await N.backupList().catch(()=>null);o&&(this.backups=o.backups,this.cards.backups?.refresh())}async reload(e){let o=await N.settingsGet().catch(()=>null);if(o){if(this.d=o,e)this.cards[e].refresh();else for(let s of Object.values(this.cards))s.refresh();(!e||e==="portal")&&this.loadPortal()}}};function qr(n,e=!1){return n&&(e?/^https?:\/\//i:/^https:\/\//i).test(n)?n:null}function Fr(n){let e=[],o=l=>{let d=[],c=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\((https?:\/\/[^)\s]+)\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g,p=0;for(let u;u=c.exec(l);)u.index>p&&d.push(l.slice(p,u.index)),u[1]?d.push(t("code",{},u[1].slice(1,-1))):u[2]?d.push(t("b",{},u[2].slice(2,-2))):u[3]?d.push(t("a",{href:u[4],target:"_blank",rel:"noopener"},u[3].replace(/^\[|\]\(.*$/g,""))):u[5]&&d.push(t("a",{href:u[5],target:"_blank",rel:"noopener"},u[5].replace(/^https?:\/\/(github\.com\/)?/,""))),p=u.index+u[0].length;return p{r.length&&e.push(t("p",{},o(r.join(" ")))),r=[],s=null};for(let l of n.replace(/\r/g,"").split(` +`)){let d=l.trimEnd();if(a){/^```/.test(d.trim())?(e.push(t("pre",{},a.join(` +`))),a=null):a.push(l);continue}if(/^```/.test(d.trim())){i(),a=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(i(),e.push(t("h5",{},o(c[2])))):p?(r.length&&i(),s||(s=t("ul",{}),e.push(s)),s.appendChild(t("li",{},o(p[1])))):d.trim()?(s&&(s=null),r.push(d.trim())):i()}return a&&e.push(t("pre",{},a.join(` +`))),i(),e}function Kr(n){let e=[],o=!1;for(let s of n.replace(/\r/g,"").split(` +`)){let r=/^#{1,6}\s+(.*)$/.exec(s);if(r){if(o=/^install\b/i.test(r[1].trim()),/^what.s new$/i.test(r[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(s)&&(o=!1);o||e.push(s)}return e.join(` `).replace(/\n{3,}/g,` -`).trim()}async function Zt(n,e,r,o){let a=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},"Loading release notes…")),i=t("div",{class:"dl-op-head"}),s="";oe(r,[i,a],[D([v("copy")," Copy"],()=>me(s,"Release notes copied"))," ",ie("Close")],"wide");try{let l=await P.updatesNotes(n,e,o??"");s=Ma(l.body||"");let d=Ea(l.url);dom.content(i,[l.published?t("span",{class:"dl-pill"},Ue(l.published)):"",l.prerelease?t("span",{class:"dl-pill warn"},"Pre-release"):"",t("span",{class:"dl-spacer"}),d?t("a",{href:d,target:"_blank",rel:"noopener",class:"dl-linkbtn"},["On GitHub ",v("open")]):""]),dom.content(a,s.trim()?La(s):t("p",{class:"dl-muted"},"This release has no notes."))}catch(l){dom.content(a,t("p",{class:"dl-muted"},be(l)))}}var Sa={"6h":"every 6 h","12h":"every 12 h","1d":"daily","7d":"weekly"},Co=n=>n?Ue(n):"";function Js(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function _a(n,e){let r=n.st,o=r.policy,a=r.kept?.app,i=e?.update&&e.tag?e.tag:r.version,s=x=>()=>Zt("app",x,`What’s new in Dawnline ${x.replace(/^v/,"")}`),l=e?.tag&&(e.update||e.status==="latest")?Ys(n,e.tag,e.update?r.version:""):null,d=e?.tag??i,c=o.check&&r.auto?.check?r.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[o.interval]??24)*3600:0,p=(x,$)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},x),t("span",{class:"dl-comp-side-v"},$)]),u=[{label:"What’s new",ic:"file",run:s(i)},{label:"Open on GitHub",ic:"globe",run:()=>window.open(`https://github.com/${r.repo}`,"_blank","noopener")},null,{label:`Reinstall ${r.version}`,ic:"reset",warn:!0,run:()=>n.op("app:reinstall","Reinstalling Dawnline",r.version)},a?{label:`Roll back to ${a.version}`,ic:"archive",warn:!0,run:async()=>{await se(`Roll back to Dawnline ${a.version}?`,`The copy kept on the router replaces ${r.version}. A backup of the settings is made first.`,"Roll back")&&n.op("app:rollback","Rolling back Dawnline",r.version)}}:null];return t("section",{class:"dl-panel flush dl-comp-hero"},[t("div",{class:"dl-comp-hero-main"},[t("div",{class:"dl-comp-hero-head"},[t("span",{class:"dl-group-ic"},v("sunrise")),t("b",{class:"dl-comp-name"},"Dawnline"),n.state("app",e,e?.latest??""),t("span",{class:"dl-spacer"}),n.round(()=>n.op("check:app","Checking Dawnline",r.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[r.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},`release ${e.latest}`):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?`released ${Co(e.published)}`:"":e?.status==="dev"?"ahead of the latest release":e?`latest release${e.published?` · released ${Co(e.published)}`:""}`:"not checked yet")])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(x=>t("li",{},x))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:s(d)},`+${l.total-l.items.length} more in What’s new`):""]):"",e?.error?t("p",{class:"dl-sub dl-comp-lead dl-upd-bad"},e.error):"",e?.update?t("div",{class:"dl-comp-btns"},[D("Update now",()=>n.op("app","Updating Dawnline",r.version),"positive",{disabled:n.busy}),D("What’s new",s(i))]):"",Zs(n)]),t("div",{class:"dl-comp-hero-side"},[p("Source",[v("globe"),t("a",{href:`https://github.com/${r.repo}`,target:"_blank",rel:"noopener"},r.repo)]),p("Auto-update",[o.auto?Ee("ok","On"):Ee("","Off"),t("span",{class:"dl-muted"},o.auto?o.mode==="immediate"?"as soon as found":`${Sa[o.interval]==="weekly"?"weekly":"daily"} at ${o.time}`:o.check?`checks ${Sa[o.interval]}`:"checks off")]),p("Last check",r.check?[re(r.check.time,r.now),c>r.now?t("span",{class:"dl-faint"},`· next in ${xt(c-r.now)}`):""]:["Never"]),p("Rollback",a?[t("span",{class:"dl-mono"},a.version),t("span",{class:"dl-faint"},"kept on flash")]:[t("span",{class:"dl-muted"},o.keep?"Kept after the next update":"Off")])])])}function Ys(n,e,r){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let o=a=>a.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(i,s)=>s??"").trim();return(async()=>{let i=((await P.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(` -`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);i.length||(i=(await P.updatesChanges(r,e).catch(()=>null))?.items??[]);let s={items:i.slice(0,3).map(l=>Js(o(l))),total:i.length};n.notes.set(e,s),s.items.length&&n.root.isConnected&&n.paint()})(),null}function Zs(n){let e=t("div",{class:"dl-params-body"}),r=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},"Versions"),t("span",{class:"dl-sub"},"install any release")]),e]);return r.addEventListener("toggle",()=>{n.versOpen=r.open,n.versOpen&&Nn(n,e)}),n.versOpen&&Nn(n,e),r}async function Nn(n,e){let r=le("",{placeholder:"Tag, e.g. 0.3.1",class:"cbi-input-text dl-mono","aria-label":"Release tag"}),o=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return U("Enter a release tag like 0.3.1","warning");Ta(n,p)};r.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),o(r.value))});let a=t("div",{class:"dl-comp-tag"},[r,D("Install",()=>o(r.value),"neutral",{disabled:n.busy})]),i=n.versPage,s=p=>{n.versPage=Math.max(1,n.versPage+p),Nn(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:i<=1?"disabled":null,click:()=>s(-1)},"← Newer"),t("span",{class:"dl-faint"},`Page ${i}`),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>s(1)},"Older →")]),d=n.versCache.get(i);if(!d){dom.content(e,[a,t("p",{class:"dl-muted dl-loading"},"Loading versions…")]);try{d=(await P.updatesReleases(i)).releases}catch(p){if(i!==n.versPage||!e.isConnected)return;dom.content(e,[a,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},`Failed to load versions: ${be(p)}`),D("Try again",()=>Nn(n,e))]),l(!1)]);return}if(n.versCache.set(i,d),i!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[a,t("p",{class:"dl-muted"},i>1?"No more versions.":"No versions found."),l(!1)]);let c=n.st.version;dom.content(e,[a,...d.map(p=>{let u=p.tag.replace(/^v/,"");return t("div",{class:"dl-comp-ver"},[t("span",{class:"dl-mono"},u),t("span",{class:"dl-sub"},Co(p.published)),p.prerelease?Ee("warn","Pre-release"):"",t("span",{class:"dl-comp-ic"},Le("file","What’s new",()=>Zt("app",p.tag,`What’s new in Dawnline ${u}`))),u===c?Ee("ok","Installed"):D("Install",()=>Ta(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Ta(n,e){let r=e.replace(/^v/,"");r.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await se(`Install Dawnline ${r}?`,`It is older than ${n.st.version}. A backup of the settings is made first; restore it from Settings if something looks wrong.`,"Install")||n.op(`app@${e}`,`Installing Dawnline ${r}`,n.st.version)}function Pa(n,e){let r=n.st,o=r.kept?.amneziawg,a=e?.sources??{},i=Object.keys(a),s=e?.current??null,l=s?a[s]:void 0,d=!!e?.ru,c=r.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];s&&p&&u.push({label:"Reinstall this build",warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${s}${d?":ru":""}`,"Reinstalling AmneziaWG",p)}),o&&u.push({label:`Roll back to ${o.version}`,ic:"archive",warn:!0,run:async()=>{await se(`Roll back AmneziaWG to ${o.version}?`,"The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds.","Roll back")&&n.op("amneziawg:rollback","Rolling back AmneziaWG",p??void 0)}});let x=[e?.release?{label:"What’s new",ic:"file",run:()=>Zt("amneziawg",e.release,`What’s new in the ${l?.label??"AmneziaWG"} build`,s??"slava")}:null,{label:"Open on GitHub",ic:"globe",run:()=>window.open(`https://github.com/${l?.repo??"Slava-Shchipunov/awg-openwrt"}`,"_blank","noopener")},...u.length?[null,...u]:[]].filter((f,g,M)=>f!==null||g>0&&M[g-1]!==null),$=r.tunnels??[],h=$.length?`Switching restarts ${$.length===1?"the tunnel":`${$.length} tunnels`} for a few seconds: ${$.join(", ")}. Devices keep their configurations.`:"Switching takes a few seconds. Devices keep their configurations.",m=$.length>1?`${$.slice(0,-1).join(", ")} and ${$[$.length-1]}`:$[0],E=$.length?`Switching restarts ${m} for a few seconds.`:"Switching takes a few seconds.",R=async f=>{let g=a[f];await se(p?`Switch to AmneziaWG ${g.gen}?`:`Install AmneziaWG ${g.gen}?`,`The ${g.label} build, ${g.version}. ${h}${g.gen==="3.1"?" Devices need AmneziaVPN 3.1 or newer.":""}`,p?"Switch":"Install")&&n.op(`amneziawg:${f}${d?":ru":""}`,p?`Switching to AmneziaWG ${g.gen}`:"Installing AmneziaWG",p??void 0)},C=f=>{let g=a[f],M=s===f&&!!p;return t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},g.gen?`AmneziaWG ${g.gen}`:"AmneziaWG"),t("span",{class:"dl-sub"},`${g.label} · ${g.gen==="3.1"?"AmneziaVPN 3.1+":"every app"}`)]),t("span",{class:"dl-mono dl-faint dl-comp-bver"},g.version??"none yet"),t("span",{class:"dl-comp-bact"},M?Ee("ok","Active"):g.version?D(p?"Switch":"Install",()=>R(f),p?"neutral":"positive",{disabled:n.busy}):Ee("","No build"))])},k=i.map(f=>a[f]?.newer?`${a[f].label} moves to ${a[f].newer.gen} with OpenWrt ${a[f].newer.tag.replace(/^v/,"")}.`:"").filter(Boolean),y=ve(d,"Russian translation",f=>{s&&n.op(`amneziawg:${s}${f?":ru":""}`,f?"Adding the Russian translation":"Removing the Russian translation",p??void 0)});y.disabled=!s||!p||n.busy;let w=n.awgOpen??!p,b=t("details",{class:"dl-params dl-comp-fold",open:w?"open":null},[t("summary",{},[v("chevron"),t("span",{},"Build and translation")]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[...i.length?i.map(C):[t("div",{class:"dl-row"},t("span",{class:"dl-sub"},"Check for updates to see the builds for this router."))],t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},"Russian translation"),t("span",{class:"dl-sub"},"LuCI pages for AmneziaWG")]),t("span",{class:"dl-comp-bact"},y)])]),p&&i.length||k.length?t("div",{class:`dl-comp-status ${p&&i.length?"warn":"acc"}`},[v(p&&i.length?"alert":"download"),t("span",{},[p&&i.length?t("b",{},E):"",...k.map(f=>` ${f}`)])]):""])]);b.addEventListener("toggle",()=>n.awgOpen=b.open);let H=[];return e?.update&&p&&s?H.push(D(`Update to ${e.latest}`,()=>n.op(`amneziawg:${s}${d?":ru":""}`,"Updating AmneziaWG",p),"neutral",{disabled:n.busy})):H.push((e||c.length)&&!p?Ee("warn","Not installed"):n.state("amneziawg",e,e?.latest??"")),H.push(n.round(()=>n.op("check:amneziawg","Checking AmneziaWG",p??void 0),x)),[n.row("shield","AmneziaWG",[p?`${p}${e?.release?` · ${e.release} build`:""}`:c.length?`missing ${c.join(", ")}`:e?"not installed":"version not checked"],H),t("div",{class:"dl-comp-foldwrap"},b)]}var Qs=[{title:"Home-like link",sub:"Policy routing and the veth pair",pkgs:["ip-full","kmod-veth"],feature:"home"},{title:"HTTPS for the portal",sub:"OpenSSL for uhttpd",pkgs:["libustream-openssl","openssl-util"],feature:"https"},{title:"Certificates (ACME)",sub:"Let’s Encrypt certificate for the portal",pkgs:["acme","acme-acmesh-dnsapi"],feature:"acme",optional:!0}],Eo={home:"network",https:"lock",acme:"file"};function Da(n,e){let r=n.st,o=e?.pkgs??{},a=Qs.filter(c=>c.feature==="home"?r.home:r.portal),i=async(c,p,u=c)=>{await se(`Update ${p}?`,`${u.join(", ")} from the OpenWrt feeds. Services that use them restart for a moment.`,"Update")&&n.op(`pkgs:${c.join(",")}`,`Updating ${p}`)},s=[{label:"Check system packages",ic:"refresh",run:()=>n.op("check:packages","Checking system packages")},{label:"Open the OpenWrt package list",ic:"globe",run:()=>window.open("https://openwrt.org/packages/start","_blank","noopener")}],l=0;return{rows:a.map(c=>{let p=c.pkgs.filter(m=>o[m]?.installed),u=[...new Set(p.flatMap(m=>[...o[m]?.latest?[m]:[],...o[m]?.with??[]]))],x=r.needs?.[c.feature]??c.pkgs.filter(m=>!o[m]?.installed),$=p.find(m=>o[m]?.latest),h=p.map(m=>`${m} ${o[m]?.installed??""}`).join(", ");return x.length?n.row(Eo[c.feature],c.title,[`${c.optional?"not installed":`missing ${x.join(", ")}`}`],[D("Install",()=>n.op(`pkgs:${x.join(",")}`,`Installing ${c.title}`),c.optional?"neutral":"positive",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(s))]):e&&u.length?(l++,n.row(Eo[c.feature],c.title,$?[`${o[$].installed} → ${o[$].latest}`,u.length>1?` · +${u.length-1}`:""]:[u.join(", ")],[D("Update",()=>i(p.filter(m=>o[m]?.latest||o[m]?.with?.length),c.title,u),"neutral",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(s))])):n.row(Eo[c.feature],c.title,[h||c.sub],[n.state("pkgs",e,""),t("span",{class:"dl-comp-ic"},n.more(s))])}),updates:l,total:a.length}}var Xs={app:"Dawnline",amneziawg:"AmneziaWG",pkgs:"System packages",all:"Components"};function Aa(n){let e=n.st,r=a=>{let i=at(a.component??"app"),s=Xs[i]??"Components",l=a.auto?"automatically":"by you",d="ok",c="check",p;if(a.kind==="found")d="accent",c="download",p=[t("b",{},(a.items??[]).join(", ")),` found by ${a.auto?"the automatic check":"a check"}`];else if(a.state==="failed")d="bad",c="x",p=[t("b",{},s),` ${a.kind==="install"?"update":"check"} failed${a.error?` · ${a.error}`:""}`];else{let u=a.from&&a.to&&a.from!==a.to?` ${a.from} → ${a.to}`:a.to?` ${a.to}`:"";p=[t("b",{},s),`${u} ${u?"":"updated "}${l}${a.took?` · ${xt(a.took)}`:""}`.replace(/\s+/g," ")]}return t("div",{class:"dl-row"},[t("span",{class:`dl-ev-tile ev ${d}`},v(c)),t("span",{class:"dl-row-main"},p),t("span",{class:"dl-faint dl-nowrap",title:new Date(a.ts*1e3).toLocaleString()},re(a.ts,e.now))])},o=e.history??[];return t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},"All in Log →")]),o.length?t("div",{},o.slice(0,8).map(r)):t("p",{class:"dl-sub dl-comp-empty"},"Updates, and checks that found something, show up here.")])}var Rn=class{constructor(){this.root=t("div",{class:"dl-upd"});this.following=null;this.versOpen=!1;this.versPage=1;this.versCache=new Map;this.notes=new Map;this.awgOpen=null}load(){return P.updatesStatus()}render(e){return this.st=e,this.paint(),e.job?.state==="running"&&this.follow(e.job),poll.add(async()=>{if(!this.root.isConnected)return;let r=await P.updatesStatus().catch(()=>null);if(!r)return;let o=this.st;this.st=r,r.job?.state==="running"&&this.following!=="starting"&&r.job.id!==this.following&&this.follow(r.job),(r.job?.id!==o.job?.id||r.job?.state!==o.job?.state||r.job?.phase!==o.job?.phase||r.check?.time!==o.check?.time)&&this.paint()},5),this.root}get busy(){return this.st.job?.state==="running"}async refresh(e){this.st=e??await P.updatesStatus().catch(()=>null)??this.st,this.paint()}async op(e,r,o){if(this.busy||this.following==="starting"){U("Another component action is already running","warning");return}this.following="starting",this.paint();let a=at(e),i=await Vt(e,{title:r,version:o,onJob:s=>this.following=s.id,onDone:s=>this.refresh(s),onUpdate:s=>{let l=s.check?.components??{};a==="amneziawg"&&l.amneziawg?.current?this.op(`amneziawg:${l.amneziawg.current}${l.amneziawg.ru?":ru":""}`,"Updating AmneziaWG",l.amneziawg.installed??void 0):this.op("app","Updating Dawnline",this.st.version)}});this.following==="starting"&&(this.following=i?.id??null),this.refresh()}async follow(e){this.following=e.id;let r=Sn(e),o={app:"Dawnline",amneziawg:"AmneziaWG",pkgs:"system packages",all:"components"}[r]??"components";await Vt(null,{title:`${e.action==="check"?"Checking":e.auto?"Automatic update:":"Updating"} ${o}`,onDone:a=>this.refresh(a)},e)}paint(){let e=this.st,r=e.check?.components??{},o=e.firmware,a=Da(this,r.packages),i=(e.needs?.awg??[]).length>0,l=(!i&&r.amneziawg?.update&&r.amneziawg.installed?1:0)+a.updates;dom.content(this.root,[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"Components"),t("span",{class:"dl-faint"},[o?.version?`OpenWrt ${o.version} · ${o.target}`:"",e.check?`checked ${re(e.check.time,e.now)}`:"not checked yet"].filter(Boolean).join(" · "))]),t("div",{class:"dl-row-actions"},[t("a",{class:"cbi-button cbi-button-neutral dl-icon-btn",href:`${L.url("admin/network/dawnline/settings")}?section=updates`},[v("edit")," Settings"]),D([v("refresh")," Check all"],()=>this.op("check","Checking all components"),"neutral",{disabled:this.busy})])]),_a(this,r.app),t("div",{class:"dl-comp-cols"},[t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Components"),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-comp-count"},i?l?`AmneziaWG not installed · ${l} update${l===1?"":"s"}`:"AmneziaWG not installed":!r.amneziawg&&!r.packages?"":l?`${l} of ${1+a.total} need${l===1?"s":""} an update`:"Everything is up to date")]),t("div",{},[...Pa(this,r.amneziawg),...a.rows])]),Aa(this)])])}state(e,r,o){let a=this.st.job;if(a?.state==="running"){let i=l=>l==="packages"?"pkgs":l,s=a.action==="check"?[i(a.component||"all")]:(a.component??"").split(" ").map(l=>i(at(l)));if(s.includes(e)||s.includes("all"))return t("button",{type:"button",class:"dl-pill info dl-comp-run",title:"Show progress",click:()=>this.follow(a)},[a.action==="check"?"Checking":"Updating","…"])}return r?r.error?Ee("warn","Check failed",r.error):r.update?Ee("info","Update available"):r.status==="dev"?Ee("info","Newer than release",`The latest release is ${o}`):Ee("ok","Up to date"):Ee("","Not checked")}more(e){let r=D([v("more")],()=>Ce(r,e.filter((o,a,i)=>o!==null||a>0&&ao?{label:o.label,icon:v(o.ic),warn:o.warn,run:o.run}:null)),"neutral",{title:"More","aria-label":"More"});return r}round(e,r,o=!1){let a=this.busy?" is-busy":"",i;return o?i=D([v("refresh")," Check"],e,"neutral",{class:`cbi-button cbi-button-neutral dl-comp-check${a}`,"aria-label":"Check for updates"}):(i=Le("refresh","Check for updates",e,"neutral",a.trim()),i.removeAttribute("title"),i.setAttribute("aria-label","Check for updates"),he(i,()=>["Check for updates"])),t("span",{class:"dl-comp-ic"},[i,this.more(r)])}row(e,r,o,a){return t("div",{class:"dl-row"},[t("span",{class:"dl-group-ic"},v(e)),t("span",{class:"dl-row-main dl-stack"},[t("b",{},r),t("span",{class:"dl-mono dl-faint dl-comp-sub"},o)]),...a])}};var Ha=(n,e)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},n),t("div",{class:"cbi-value-field"},e)]);function za(n){let e=n.st.servers.find(r=>r.id===n.p.server)?.name??"Home";qt(n.p,e)}async function Na(n){let e=n.p,r=e.code_set??0,o=e.devices.filter(l=>l.created_by==="portal"&&l.created>=r),a=o.map(l=>t("input",{type:"checkbox",id:`dl-rm-${l.id}`,checked:"checked","data-id":l.id})),i=[t("p",{},"The old link stops working right away.")];o.length&&i.push(t("p",{},"Devices added through the old link keep working until they are removed. Remove them too:"),t("div",{class:"dl-checklist"},o.map((l,d)=>t("label",{for:`dl-rm-${l.id}`},[a[d],` ${l.name}`]))));let s=async()=>{let l=a.filter(c=>c.checked).map(c=>c.dataset.id),d=await G(()=>P.personRegen(e.id,l),l.length?`New link created, ${l.length} device${l.length===1?"":"s"} removed`:"New link created");d&&(ae(),l.length&&await n.refresh(),d.link&&await me(d.link,"New link copied"))};oe("Create a new link?",i,[ie()," ",D("Create new link",s,"negative")])}function Lo(n){let e=t("textarea",{class:"cbi-input-textarea dl-note-input",rows:3,maxlength:500,placeholder:"Only you see this"},n.p.note??"");oe("Note",[e],[ie()," ",D("Save",async()=>{ae(),await n.patch({note:e.value.trim()},e.value.trim()?"Note saved":"Note removed")},"positive")]),setTimeout(()=>e.focus(),50)}function Ra(n){let e=n.p,r=t("select",{class:"cbi-input-select"},[t("option",{value:"pause",selected:e.expire_action==="pause"?"selected":null},"Pause access"),t("option",{value:"notify",selected:e.expire_action==="notify"?"selected":null},"Keep access"),t("option",{value:"remove",selected:e.expire_action==="remove"?"selected":null},"Remove their devices")]),o=t("select",{class:"cbi-input-select"},[0,1,3,7,14].map(a=>t("option",{value:a,selected:e.expire_warn===a?"selected":null},a?`${a} day${a===1?"":"s"} before`:"Don’t warn")));oe("When access ends",[Ha("Then",r),t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},"Warn"),t("div",{class:"cbi-value-field"},[o,t("div",{class:"cbi-value-description"},"Shown in their portal and on the Overview.")])])],[ie()," ",D("Save",async()=>{ae(),await n.patch({expire_action:r.value,expire_warn:o.value},"Saved")},"positive")])}function Ia(n){let e=t("input",{type:"text",class:"cbi-input-text",value:n.p.name,maxlength:48}),r=ye("Name",e,()=>_e(e.value,[],"Shown in their portal and apps."));oe("Rename",[r],[ie()," ",D("Save",async()=>{let o=r.help();if(o.bad){U(o.text,"warning");return}await n.patch({name:e.value.trim()},"Renamed")&&ae()},"positive")]),setTimeout(()=>e.select(),50)}function Ba(n){let e=n.p,r=n.st.servers.filter(i=>i.id!==e.server),o=t("select",{class:"cbi-input-select"},r.map(i=>t("option",{value:i.id},`${i.name} · ${i.endpoint||"no address"}:${i.port}`))),a=e.devices.length;oe(`Move ${e.name} to another server`,[Ha("Server",o),t("p",{class:"dl-muted"},a?`${a} device${a===1?" gets a new address and stops":"s get new addresses and stop"} connecting until ${a===1?"it imports its":"they import their"} configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.`:"They have no devices yet: nothing else changes.")],[ie()," ",D("Move",async()=>{await n.patch({server:o.value},`Moved to ${r.find(i=>i.id===o.value)?.name??"the server"}`)&&(ae(),a&&U("Devices are marked “Update config” until they import again.","info",6e3))},"positive")])}async function Oa(n){let e=n.p;await se(`Delete ${e.name}?`,`All ${e.devices.length} devices are disconnected immediately and the personal link stops working.`,"Delete",!0)&&await G(()=>P.personDelete(e.id),"Deleted")&&(location.href=_t(e.server))}function ja(n){let e=n.p,r=n.st,o=e.online?"online now":e.last_seen?`last seen ${re(e.last_seen,r.now)}`:"never connected",a=e.created?`Added ${Me(je(new Date(e.created*1e3)))}`:"",i=e.has_link??r.settings.portal_enabled,s=[{label:"Rename",icon:v("edit"),run:()=>Ia(n)},{label:e.note?"Edit note":"Add note",icon:v("file"),run:()=>Lo(n)},...r.servers.length>1?[{label:"Move to server…",icon:v("server"),run:()=>Ba(n)}]:[],...i?[null,{label:"Invite card",icon:v("qr"),run:()=>za(n)},{label:"New link",icon:v("key"),run:()=>Na(n)}]:[],null,...e.paused?[]:[{label:"Pause",icon:v("pause"),warn:!0,run:()=>n.patch({paused:!0},"Paused")}],{label:"Delete",icon:v("trash"),danger:!0,run:()=>Oa(n)}];return t("div",{class:"dl-person-head"},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-person-id"},[t("span",{class:`dl-avatar lg${e.online?" online":""}`},He(e.name)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),Io(e)]),t("span",{class:"dl-faint",title:a},`${e.devices.length} of ${e.device_limit} devices · ${o}`)])]),t("div",{class:"dl-pcard-actions"},[e.paused?D([v("play")," Resume"],()=>n.patch({paused:!1},"Resumed"),"add"):"",i?Le("link","Copy link",()=>Cn(e.id),"neutral","dl-icon-only"):"",Le("more","More",l=>Ce(l.currentTarget,s),"neutral","dl-icon-only")])]),e.note?t("button",{type:"button",class:"dl-pnote",title:"Edit note",click:()=>Lo(n)},[v("file"),t("span",{},e.note)]):""])}function Ua(n){let e=n.p,r=n.series[n.series.length-1];return t("div",{class:`dl-person-live${e.online?"":" solo"}`},[e.online?Pn(e.rate??[],n.st.now,r?[r.rx,r.tx]:[0,0]):"",Dn(n.series,`${X(e.month[0]+e.month[1])} this month`)])}async function el(n,e){let r=await G(()=>P.deviceConfig(e.id));r&&oe(`Set up ${e.name}`,[await n.core.connectBlock(r,"qr")],[ie("Close")])}async function tl(n,e){let r=await G(()=>P.deviceConfig(e.id));if(!r)return;if(!r.has_private_key){U("This device made its own keys in the browser; its configuration only exists there.","warning");return}let o=n.core.file.make(r);Te(o.name,o.text,"application/octet-stream")}function Ga(n){let e=n.p,r=n.st.now,o=d=>Ge(e,d,n.deviceOpts()),a=d=>c=>{c.target.closest("button:not(.dl-dcard-title), a")||o(d)},i=d=>D([v("more")],c=>Gr(c.currentTarget,e,d,n.deviceOpts()),"neutral",{title:"QR, file, key, rename, new keys, remove",class:"cbi-button cbi-button-neutral dl-icon-only"}),s=tn(e.devices).map(d=>{let c=t("div",{class:"dl-dcard-head"},[t("span",{class:"dl-dcard-ic"},v(d.kind)),t("button",{type:"button",class:"dl-dcard-title",click:()=>o(d)},[t("b",{},d.name),nn(d,r,void 0,e),d.config_stale?t("span",{class:"dl-pill warn dl-stale"},"Update config"):""]),i(d)]),p=t("div",{class:"dl-dcard-trend"},[t("div",{class:"dl-stack"},[t("b",{},X(d.month[0]+d.month[1])),t("span",{class:"dl-sub"},"this month")]),pa(n.devSeries[d.id]??[])]);return t("article",{class:`dl-dcard clickable${d.online?" online":""}${d.disabled?" off":""}`,click:a(d)},[c,d.handshake?p:d.disabled?t("div",{class:"dl-sub"},`${Qe[d.kind]} · created ${re(d.created,r)} ${d.created_by==="portal"?"in the portal":"by you"}.`):t("div",{class:"dl-chips-row"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>el(n,d)},[v("qr"),"Show QR"]),t("button",{type:"button",class:"dl-chipbtn",click:()=>tl(n,d)},[v("download"),"Config"])])])}),l=e.devices.length>=e.device_limit;return s.push(t("button",{type:"button",class:"dl-dslot add",click:()=>nt(e,n.deviceOpts())},[t("span",{class:"dl-dslot-ic"},v("plus")),t("span",{class:"dl-stack"},[t("b",{},"Add device"),t("span",{class:"dl-sub"},l?`Over the limit · ${e.devices.length} of ${e.device_limit}`:`${e.devices.length} of ${e.device_limit}`)])])),t("section",{class:"dl-devsec"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Devices"),t("span",{class:"dl-sub"},`${e.online} online`)]),t("div",{class:"dl-dgrid"},s)])}function Wa(n){let e=n.p,r=we([["device","Device’s own DNS"],["home","Home names"]],e.dns_mode,{label:"DNS",cls:"sm",optimistic:!1,onChange:a=>n.patch({dns_mode:a},a==="home"?"Home names on — devices need their configuration again":"Device DNS — devices need their configuration again")}),o=n.st.settings.home_dns_fallback;return t("div",{class:"dl-stack gap4 dl-dnspick"},[t("div",{class:"dl-row-actions"},[t("span",{class:"dl-sub"},"DNS"),r]),t("span",{class:"dl-sub"},e.dns_mode==="home"?["Names like ",t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`)," work. Internet names are resolved at home, so they depend on the tunnel",o?[" (",t("span",{class:"dl-mono"},o)," takes over when it is down)."]:" — with no fallback set, they stop when it is down."]:"Internet keeps working exactly as without the VPN. Reach home devices by IP address.")])}function Fa(n){let e=n.p,o=n.st.servers.find(i=>i.id===e.server)?.home??[];if(o.length<2)return"";let a=new Set(e.home_nets?.length?e.home_nets:o.map(i=>i.dev));return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},o.map(i=>qe(i.dev,a.has(i.dev),()=>{let s=new Set(a);if(s.delete(i.dev)||s.add(i.dev),!s.size)return U("Keep at least one network, or choose Internet only.","warning",5e3);let l=s.size===o.length?[]:[...s];n.patch({home_nets:l},l.length?`${e.name} reaches ${l.join(", ")}`:`${e.name} reaches every home network`)},{title:i.nets.join(", ")}))),t("span",{class:"dl-sub"},e.home_nets?.length?`Home networks ${e.name} reaches. Networks added to the server later stay out.`:`Home networks ${e.name} reaches: all of them. Untick one to keep ${e.name} out of it.`)])}function qa(n){let e=new Set(n.p.services??[]);return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},n.st.services.map(r=>qe(r.name,e.has(r.id),()=>{let o=new Set(e);o.delete(r.id)||o.add(r.id),n.patch({services:[...o]},o.size?"Home services updated":"Whole home network")},{title:`${r.address}${r.ports.length?` · ${r.ports.join(", ")}`:""}`}))),t("span",{class:"dl-sub"},e.size?"Only the selected services at home.":"Whole home network. Pick services to narrow it down.")])}function Ka(n){let e=n.p,r=n.st;if(r.servers.find(c=>c.id===e.server)?.mesh!=="circles"||!rt(e))return"";let a=r.circles.filter(c=>c.server===e.server),i=a.find(c=>c.id===e.circle),s=i?r.people.filter(c=>c.id!==e.id&&c.circle===i.id&&rt(c)).map(c=>c.name):[],l=t("button",{type:"button",class:"dl-chipbtn",click:()=>Ce(l,[...a.map(c=>({label:c.name,icon:bo(c),run:()=>c.id!==e.circle&&n.patch({circle:c.id},`${e.name} is in ${c.name}`)})),e.circle?{label:"No circle",icon:v("x"),run:()=>n.patch({circle:""},`${e.name} is in no circle`)}:null,{label:"New circle",icon:v("plus"),run:()=>Ln(r,e.server,null,()=>n.refresh())}])},"Change"),d=i?r.people.filter(c=>c.circle===i.id&&rt(c)):[e];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Devices see each other"),l]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},i?i.name:"No circle"),t("span",{class:"dl-avstack",title:d.map(c=>c.name).join(", ")},d.slice(0,5).map(c=>t("span",{class:"dl-avatar sm"},He(c.name))))]),t("span",{class:"dl-sub"},i?s.length?[e.name,...s].join(", "):`Nobody else in ${i.name} yet`:`Only ${e.name}'s own devices`)])}function Va(n){let e=n.p,r=n.st.now,o=t("div",{class:"dl-slots"});for(let s=0;s=e.device_limit,c=t("i",{class:d?"over":l?"used":""});he(c,()=>[t("div",{class:"dl-tip-title"},l?`${l.name}${d?" · over the limit":""}`:"Free slot"),t("div",{class:"dl-muted"},l?l.online?"Connected":l.handshake?`Last seen ${re(l.handshake,r)}`:"Not set up yet":"They can add a device here")]),o.appendChild(c)}let a=Math.max(1,e.devices.length),i=t("button",{type:"button","aria-label":"Allow fewer devices",disabled:e.device_limit<=a?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit-1)})},"−");return e.device_limit<=a&&e.devices.length>1&&he(i,()=>[t("div",{class:"dl-tip-title"},`${e.devices.length} devices in use`),t("div",{class:"dl-muted"},"Remove a device first to lower the limit")]),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},"Devices"),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[String(e.devices.length),t("span",{class:"dl-faint"},` / ${e.device_limit}`)]),t("div",{class:"dl-stepper"},[i,t("button",{type:"button","aria-label":"Allow more devices",disabled:e.device_limit>=32?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit+1)})},"+")])]),o])}var nl={internet:"Browse the internet through your router. No access to devices at home, and home cannot reach theirs.",lan:"Reach devices at home, and home reaches theirs. Internet stays on their own connection.",both:"Home devices and the internet, all through your router. Home reaches their devices too."},Ja=/^([01]\d|2[0-3]):[0-5]\d$/;function ol(n){let e=n.p,r=n.today,o=Ye(e.expires,r),a=t("input",{type:"date",class:"dl-date-hidden",value:e.expires,tabindex:"-1","aria-hidden":"true"});a.addEventListener("change",()=>a.value&&n.patch({expires:a.value},`Access until ${Me(a.value)}`));let i=(c,p)=>{let u=zo(e.expires&&(o??-1)>=0?e.expires:"",c,p,r);n.patch({expires:u},`Access until ${Me(u)}`)},s=[["week",1,"+1 week"],["month",1,"+1 month"],["month",3,"+3 months"],["year",1,"+1 year"]].map(([c,p,u])=>t("button",{type:"button",class:"dl-chipbtn",click:()=>i(c,p)},u)),l=t("span",{class:"dl-datechip"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>{a.focus({preventScroll:!0});try{a.showPicker()}catch{}}},[v("calendar"),e.expires?Me(e.expires):"Date"]),a]),d={pause:"pause access",notify:"keep access",remove:"remove their devices"}[e.expire_action];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Access ends"),e.expires?t("span",{class:o!=null&&o<0?"dl-bad":Ze(e,o)?"dl-warn":"dl-ok"},o!=null&&o<0?"ended":`${o} day${o===1?"":"s"} left`):t("span",{class:"dl-faint"},"no end date")]),t("div",{class:"dl-chips-row"},[...s,l,e.expires?t("button",{type:"button",class:"dl-chipbtn",click:()=>n.patch({expires:""},"No end date")},"No end"):""]),t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},`When it ends: ${d}${e.expire_warn?`, warn ${e.expire_warn} day${e.expire_warn===1?"":"s"} before`:""}`),t("a",{href:"#",click:c=>{c.preventDefault(),Ra(n)}},"Change")])])}function rl(n){let e=n.p,r=e.quota_used||e.month[0]+e.month[1],o=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,a=t("div",{class:`dl-meter${o>=100?" bad":o>=90?" warn":""}`},[t("i"),e.quota_limit?t("span",{class:"mark",title:"Alert at 90%"}):""]);a.firstChild.style.width=`${o}%`,e.quota_limit&&he(a,()=>[t("div",{class:"dl-tip-title"},`${o.toFixed(1)}% used`),t("div",{class:"dl-muted"},`${X(e.quota_used)} of ${X(e.quota_limit)} · ${X(Math.max(0,e.quota_limit-e.quota_used))} left`),t("div",{class:"dl-faint"},"Alert at 90%")]);let i=we([["month","Monthly"],["total","Total"]],e.quota_period,{label:"Data limit period",cls:"sm",optimistic:!1,onChange:l=>n.patch({quota_period:l})}),s=[10,50,100].map(l=>t("button",{type:"button",class:`dl-chipbtn${e.quota_gb===l?" on":""}`,click:()=>n.patch({quota_gb:String(l)},`Data limit ${l} GB`)},`${l} GB`));return s.push(t("button",{type:"button",class:`dl-chipbtn${e.quota_gb?"":" on"}`,click:()=>n.patch({quota_gb:""},"No data limit")},"Unlimited")),s.push(t("button",{type:"button",class:"dl-chipbtn",click:()=>{let l=t("input",{type:"number",class:"cbi-input-text dl-w-port",min:0,step:"any",value:e.quota_gb?String(e.quota_gb):""}),d=ye("Data limit (GB)",l,()=>pn(l.value,e.quota_period==="month"));oe("Data limit",[d],[ie()," ",D("Save",async()=>{let c=d.help();if(c.bad){U(c.text,"warning");return}let p=l.value.trim();await n.patch({quota_gb:p},p&&Number(p)>0?`Data limit ${p} GB`:"No data limit")&&ae()},"positive")]),setTimeout(()=>l.select(),50)}},"Custom")),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},"Data"),i]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[X(r),e.quota_limit?t("span",{class:"dl-faint"},` of ${X(e.quota_limit)}`):t("span",{class:"dl-faint"}," · no limit")]),e.quota_period==="month"?t("span",{class:"dl-sub"},"resets on the 1st"):""]),e.quota_limit?a:"",t("div",{class:"dl-chips-row"},s),e.quota_gb&&e.quota_period==="month"?t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.bonus_gb?`Includes +${e.bonus_gb} GB extra this month`:"Need a little more this month?"),t("a",{href:"#",click:l=>{l.preventDefault(),n.patch({bonus_gb:String((e.bonus_gb||0)+10)},"+10 GB this month")}},"+10 GB this month")]):"",t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},`${X(e.total[0]+e.total[1])} in total`),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Mt("person",e.id,e.name,()=>setTimeout(()=>n.refresh(),300))},"Reset usage")])])}function al(n){let e=n.p,r=!!e.hours,[o,a]=(e.hours||"07:00-23:00").split("-"),i=t("input",{type:"time",class:"cbi-input-text",value:o,"aria-label":"From"}),s=t("input",{type:"time",class:"cbi-input-text",value:a,"aria-label":"To"}),l=t("div",{class:"dl-tile2-row"},[i,t("span",{class:"dl-faint"},"to"),s]),d=()=>{let x=`${i.value}-${s.value}`;if(x!==e.hours){if(!Ja.test(i.value)||!Ja.test(s.value))return U("Enter both times, like 07:00 and 23:00.","warning");if(i.value===s.value)return U("The start and the end must differ.","warning");n.patch({hours:x},`Allowed ${i.value}–${s.value}`)}};l.addEventListener("focusout",x=>{l.contains(x.relatedTarget)||d()});for(let x of[i,s])x.addEventListener("keydown",$=>{$.key==="Enter"&&($.preventDefault(),d())});let c=t("button",{type:"button",role:"switch","aria-checked":r?"true":"false",class:`dl-switch${r?" on":""}`,"aria-label":"Limit hours",click:()=>{if(r)return n.patch({hours:""},"Any time");c.classList.add("on"),c.setAttribute("aria-checked","true"),p.textContent="Set the hours, then press Enter",u.appendChild(l),i.focus()}},t("i")),p=t("span",{},r?`${o} – ${a} (router time)`:"Any time"),u=t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-row"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-tile2-label"},"Allowed hours"),p]),c]),r?l:""]);return u}function Ya(n){let e=n.p,r=we(["internet","lan","both"].map(o=>[o,[v(o==="internet"?"globe":o==="lan"?"home":"shield"),o==="internet"?"Internet":o==="lan"?"Home":"Both"]]),e.access,{label:"Access",cls:"wide",optimistic:!1,onChange:o=>n.patch({access:o},`Access: ${dt[o]}`)});return t("section",{class:"dl-devsec","aria-label":"Access and limits"},[t("div",{class:"dl-panel-head"},[t("h3",{},"Access & limits")]),t("div",{class:"dl-panel"},[t("div",{class:"dl-stack gap8"},[t("span",{class:"dl-tile2-label"},"Can reach"),r,t("span",{class:"dl-sub"},nl[e.access]),e.access==="lan"&&n.st.services.length?qa(n):"",rt(e)?Fa(n):"",e.access==="lan"?Wa(n):""]),t("div",{class:"dl-tiles2"},[Va(n),Ka(n),ol(n),rl(n),al(n)])])])}function il(n){let e=n.st,r=t("div",{class:"dl-panel-head pad"},[t("h3",{},"Locations"),t("span",{class:"dl-spacer"}),e.geo.enabled?Tt("30d",a=>n.map?.setRange(a),!1):"",D("Hide",()=>{n.mapOpen=!1,n.map?.destroy(),n.map=null,n.paintPlaces()},"neutral")]);if(!e.geo.enabled)return t("div",{class:"dl-panel flush"},[r,t("div",{class:"dl-map-off"},["Locations are off. ",t("a",{href:L.url("admin/network/dawnline/settings")},"Turn them on in Settings"),"."])]);let o=new tt({openPerson:()=>{},openDevice:(a,i)=>{let s=n.p.devices.find(l=>l.id===i);s&&Ge(n.p,s,n.deviceOpts())}},"30d",280);return n.map=o,requestAnimationFrame(()=>o.mount(n.mapData())),t("div",{class:"dl-panel flush"},[r,o.el])}function Za(n){let e=n.st;if(!e.geo.enabled)return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},"Locations are off"),t("span",{class:"dl-sub"},"City-level, from the client IP")]),t("span",{class:"dl-spacer"}),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/settings")},"Turn on")]);if(n.mapOpen)return n.map&&n.parts.places.contains(n.map.el)?null:il(n);let r=e.now-30*86400,o=e.geo.points.filter(s=>s.person===n.p.id&&s.ts>=r).sort((s,l)=>l.ts-s.ts),a=[...new Set(o.map(s=>s.city||s.country).filter(Boolean))],i=o[0];return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},i?i.city||i.country:"No locations yet"),t("span",{class:"dl-sub"},i?`${a.length} place${a.length===1?"":"s"} in 30 days${i.org?` · ${i.org}`:""}`:"Shown after a device connects")]),t("span",{class:"dl-spacer"}),o.length?D("Show map",()=>{n.mapOpen=!0,n.paintPlaces()},"neutral"):""])}function Qa(n){let e=n.p,r=n.st,o=n.events.filter(l=>l.person===e.id),a=[],i=[...o].reverse();for(let l=0;l1){let u=p.querySelector(".dl-row-main");dom.content(u,[...wo(r,d).slice(0,3),t("span",{class:"dl-muted"},`${c} times`)]),u.title=i.slice(l,l+c).map(x=>x.detail??"").join(` -`)}a.push(p),l+=c-1}let s=D([v("more")],()=>Ce(s,[{label:"Export CSV",icon:v("download"),run:()=>Fe(r,o,"csv",e.id)},{label:"Export JSON",icon:v("download"),run:()=>Fe(r,o,"json",e.id)},null,{label:`Clear ${e.name}'s activity`,icon:v("trash"),danger:!0,run:()=>et(`Clear ${e.name}'s activity`,`Removes events about ${e.name} and their devices.`,{person:e.id},()=>n.refresh())}]),"neutral",{title:"Export or clear",class:"cbi-button cbi-button-neutral dl-icon-only"});return t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},"Activity"),t("span",{class:"dl-sub"},o.length>10?`latest 10 of ${o.length}`:""),t("span",{class:"dl-spacer"}),s]),a.length?a:t("div",{class:"dl-row dl-muted"},"Nothing yet.")])}var In=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.ticks=0;this.fullNext=!1}async fetch(e){let[r,o,a]=await Promise.all([P.status(30),e?P.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?P.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:r,ev:o?.events??null,use:a}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let r=this.st.people.find(s=>s.id===this.id);if(!r)return t("div",{class:"dl-empty"},[t("h3",{},"Person not found"),t("p",{},"They may have been removed."),t("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},"Back to Servers")]);this.p=r;for(let s of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[s]=t("div",{});this.parts.devices.className="dl-person-devices";let o=t("div",{},[this.parts.crumbs,this.parts.head,t("div",{class:"dl-grid-person"},[t("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),t("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let a=new URLSearchParams(location.search),i=a.get("device")&&r.devices.find(s=>s.id===a.get("device"));return i?setTimeout(()=>Ge(this.p,i,this.deviceOpts()),50):a.get("add")&&setTimeout(()=>nt(this.p,this.deviceOpts()),50),this.poller=ot({fetch:s=>{let l=s||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>o.isConnected,apply:(s,l)=>this.apply(s,l)}),o}take(e){this.st=e.st,e.ev&&(this.events=e.ev),e.use&&(this.series=e.use.person,this.devSeries=e.use.devices)}apply(e,r){this.take(e);let o=this.st.people.find(a=>a.id===this.id);if(!o){r||(location.href=_t(this.p?.server));return}this.p=o,this.paint(r),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,r){var i;this.poller?.claim();let o=await G(()=>P.personUpdate(this.p.id,e),r);if(!o)return!1;this.poller?.claim();let a=this.st.people.findIndex(s=>s.id===this.p.id);return(i=o.person).rate??(i.rate=this.p.rate),a>=0&&(this.st.people[a]=o.person),this.p=o.person,this.paint(),!0}get today(){return Ie(this.series.length?this.series:this.st.series)}get core(){return St(this.st.servers,this.p.server)}deviceOpts(){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:this.core,events:()=>this.events}}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}crumbs(){let e=this.p;return t("nav",{class:"dl-crumbs","aria-label":"Breadcrumb"},[t("a",{href:_t(e.server)},this.st.servers.find(r=>r.id===e.server)?.name??"Servers"),t("span",{},"/"),t("a",{href:_t(e.server)},"People"),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Se(this.parts.crumbs,this.crumbs(),e),Se(this.parts.head,ja(this),e),Se(this.parts.traffic,Ua(this),e),Se(this.parts.devices,Ga(this),e),Se(this.parts.limits,Ya(this),e),this.paintPlaces(e),Se(this.parts.activity,Qa(this),e)}paintPlaces(e=!1){let r=Za(this);r&&Se(this.parts.places,r,e&&!this.mapOpen)}};var sl={ok:"check",warn:"alert",error:"x",skip:"pause"},Bn=class{constructor(e,r,o,a){this.el=t("div",{});this.wdEl=t("div",{});this.checksEl=t("div",{class:"dl-panel"});this.recentEl=t("div",{class:"dl-panel flush dl-recent"});this.checks=null;this.summary=t("div",{});this.open=new Set;this.st=e,this.sl=r,this.events=o,this.toLog=a,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(r,o)}async run(e){let r=e?await An(e):await P.health().catch(()=>null);r&&(this.take(r),e==="netrestart"&&setTimeout(()=>this.el.isConnected&&void this.run(),5e3))}take(e){this.checks=e.checks,this.paintChecks(),this.paintLive(e,this.events)}paintChecks(){let e=this.checks;if(!e){dom.content(this.summary,""),dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},"Checks")]),t("p",{class:"dl-muted dl-loading"},"Running checks…")]);return}let r=e.filter(s=>s.status==="error").length,o=e.filter(s=>s.status==="warn").length;dom.content(this.summary,r?ct("error",`${r} problem${r>1?"s":""} need attention.`):o?ct("warn",`${o} warning${o>1?"s":""}.`):ct("ok","All checks passed."));let a=new Map;for(let s of this.sl.watchdog.repairs)a.set(s.id,Math.max(a.get(s.id)??0,s.ts));let i=()=>this.run();dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},"Checks"),t("span",{class:"dl-spacer"}),D("Run again",i)]),t("ul",{class:"dl-checks"},e.map(s=>t("li",{},[t("span",{class:`dl-check-icon ${s.status}`},v(sl[s.status])),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},s.title),t("div",{class:"dl-check-detail"},s.detail),a.has(s.id)?t("div",{class:"dl-check-repaired"},`Repaired by the watchdog at ${Ht(a.get(s.id))}`):""]),yo(s,l=>void this.run(l),i)])))])}paintLive(e,r){this.sl=e,this.events=r;let o=e.watchdog,a=o.beat!=null&&o.now-o.beat>180,i=o.repairs.filter(d=>o.now-d.ts<86400),s=i[i.length-1],l=ve(o.enabled,"Watchdog repairs",async d=>{await G(()=>P.settingsUpdate({watchdog:d?"1":"0"}),d?"Watchdog on":"Watchdog off")||eo(l,!d);let p=await P.serviceLog().catch(()=>null);p&&this.paintLive(p,this.events)});dom.content(this.wdEl,t("div",{class:"dl-panel dl-wd"},[t("div",{class:"dl-wd-head"},[t("span",{class:`dl-wd-tile${o.enabled?"":" off"}`},v("shield")),t("div",{class:"dl-stack"},[t("span",{class:"dl-wd-title"},"Watchdog"),t("span",{class:"dl-sub"},o.enabled?"Every minute it checks the tunnels and services and repairs what it can on its own.":"Off: problems are only written to the log. Nothing is repaired on its own.")]),t("span",{class:"dl-spacer"}),l]),t("div",{class:"dl-wd-foot"},[t("div",{class:"dl-wd-chips"},o.targets.map(d=>t("span",{class:`dl-check-chip${d.ok?"":" error"}`,title:d.ok?"OK":`Not working${d.tries?` · ${d.tries} repair${d.tries>1?"s":""}`:""}`},[v(d.ok?"check":"x"),d.name]))),t("span",{class:`dl-sub${a?" dl-warn-text":""}`},a?`The agent has not checked in for ${Math.round((o.now-o.beat)/60)} min; cron restarts it after 5.`:[o.last?`Looked ${re(o.last,o.now)}`:"Starts within a minute"," · ",i.length?`${i.length} repair${i.length>1?"s":""} today, last ${s.name} at ${Ht(s.ts)}`:"no repairs today"])])])),this.paintRecent()}paintRecent(){let e=(this.sl.watchdog.now||Date.now()/1e3)-604800,r=[...this.events.map(a=>({ts:a.ts,ev:a})),...this.sl.log.map(a=>({ts:a.ts,sys:a}))].filter(a=>a.ts>=e&&un(a)).sort((a,i)=>i.ts-a.ts),o=t("div",{class:"dl-panel-head pad"},[t("h3",{},"Recent problems"),t("span",{class:"dl-spacer"}),r.length?t("a",{href:"#",click:a=>(a.preventDefault(),this.toLog())},"All in Log →"):""]);if(!r.length){dom.content(this.recentEl,[o,t("div",{class:"dl-recent-empty"},[t("span",{class:"dl-check-icon ok"},v("check")),"No problems in the last 7 days."])]);return}dom.content(this.recentEl,[o,...r.slice(0,8).map(a=>{if(a.sys){let i=a.sys,s=`${i.ts}|${i.msg}`;return _n(i,this.open.has(s),()=>{this.open.delete(s)||this.open.add(s),this.paintRecent()},Ht(i.ts))}return it(this.st,a.ev,{time:Ht(a.ts)})})])}};var On=300,ll=["all","connections","people","system","problems"],jn=class{constructor(e,r,o){this.events=[];this.system=[];this.kind="all";this.shown=On;this.open=new Set;this.list=t("div",{});this.sub="";this.tabs=t("div",{class:"dl-seg",role:"tablist"});this.st=e,this.take(r),this.system=o,this.el=t("div",{},[t("div",{class:"dl-toolbar"},[this.tabs]),this.list]),this.paint()}actions(){let e=()=>this.kind==="all"?"":this.kind,r=i=>()=>{let s=this.filtered().reverse();Fe(this.st,s.filter(l=>l.ev).map(l=>l.ev),i,e(),s.filter(l=>l.sys).map(l=>l.sys))},o=D([v("download")," Export"],()=>Ce(o,[{label:"CSV (spreadsheet)",icon:v("download"),run:r("csv")},{label:"JSON",icon:v("download"),run:r("json")}])),a=D([v("trash")," Clear"],()=>et("Clear the log","Removes events from the log on the router.",{},()=>this.reload(),this.kind==="all"?void 0:this.kind,!0));return[o,a]}take(e){this.events=e.events,this.policy=e.policy;let r=Lt.filter(o=>!e.policy.categories.includes(o));this.sub=`${mn(e.policy)}${r.length?` Not recorded: ${r.map(o=>ut[o].toLowerCase()).join(", ")}.`:""}`}async reload(){let[e,r]=await Promise.all([P.events(2e4).catch(()=>null),P.serviceLog().catch(()=>null)]);e&&this.take(e),r&&(this.system=r.log),this.paint()}items(){return[...this.events.map(e=>({ts:e.ts,ev:e})),...this.system.map(e=>({ts:e.ts,sys:e}))].sort((e,r)=>r.ts-e.ts)}matches(e,r){return r==="all"?!0:r==="problems"?un(e):r==="system"?!!e.sys:!!e.ev&&It(e.ev.type)===r}filtered(){return this.items().filter(e=>this.matches(e,this.kind))}paintTabs(e){dom.content(this.tabs,ll.map(r=>t("button",{type:"button",role:"tab",class:r===this.kind?"on":"","aria-selected":r===this.kind?"true":"false",click:()=>this.show(r)},[r==="all"?"All":r==="system"?"System":ut[r],t("b",{},String(e.filter(o=>this.matches(o,r)).length))])))}show(e){this.kind=e,this.shown=On,this.paint()}paint(){this.paintTabs(this.items());let e=this.filtered();if(!e.length){dom.content(this.list,t("div",{class:"dl-empty"},[t("p",{},this.events.length||this.system.length?"No events match.":"The log is empty.")]));return}let r=[],o="",a=null;for(let i of e.slice(0,this.shown)){let s=ca(i.ts);s!==o&&(o=s,a=t("div",{class:"dl-panel flush"},t("div",{class:"dl-panel-head pad"},t("h3",{},s))),r.push(a));let l=new Date(i.ts*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});if(i.sys){let d=`${i.sys.ts}|${i.sys.msg}`;a.appendChild(_n(i.sys,this.open.has(d),()=>{this.open.delete(d)||this.open.add(d),this.paint()},l))}else a.appendChild(it(this.st,i.ev,{time:l}))}e.length>this.shown&&r.push(t("div",{class:"dl-more-row"},D(`Show ${Math.min(On,e.length-this.shown)} more of ${e.length-this.shown}`,()=>{this.shown+=On,this.paint()}))),dom.content(this.list,r)}};var dl=[["health","Health"],["log","Log"]],Mo=2e4,Un=class{constructor(){this.tab=new URLSearchParams(location.search).get("tab")==="log"?"log":"health";this.segEl=t("div",{class:"dl-seg dl-srvsections dl-diag-tabs",role:"tablist","aria-label":"Diagnostics"});this.subEl=t("span",{class:"dl-muted"});this.actionsEl=t("div",{class:"dl-row-actions"});this.bodyEl=t("div",{});this.eventsAt=0}load(){return this.eventsAt=Date.now(),Promise.all([P.status(1),P.events(Mo),P.serviceLog()])}render([e,r,o]){return this.log=new jn(e,r,o.log),this.health=new Bn(e,o,r.events,()=>{this.show("log"),this.log.show("problems")}),this.show(this.tab),ot({fetch:async()=>{let a=this.tab==="log",[i,s]=await Promise.all([P.serviceLog().catch(()=>null),a?P.events(Mo).catch(()=>null):Promise.resolve(null)]);return i||s?{n:i,e:s}:null},every:10,active:()=>this.bodyEl.isConnected,apply:({n:a,e:i})=>this.take(a,i)}),t("div",{},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},"Diagnostics"),this.subEl]),this.actionsEl]),this.segEl,this.bodyEl])}take(e,r){r&&(this.log.take(r),this.eventsAt=Date.now()),e&&(this.log.system=e.log),e&&this.health.paintLive(e,r?.events??this.health.events),this.tab==="log"&&this.log.paint()}show(e){this.tab=e,dom.content(this.segEl,dl.map(([r,o])=>t("button",{type:"button",role:"tab",class:r===e?"on":"","aria-selected":r===e?"true":"false",click:()=>r!==this.tab&&this.show(r)},o))),this.bodyEl.replaceChildren(e==="log"?this.log.el:this.health.el),this.subEl.textContent=e==="log"?this.log.sub:"Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own.",dom.content(this.actionsEl,e==="log"?this.log.actions():""),e==="log"?(this.log.paint(),Date.now()-this.eventsAt>1e4&&P.events(Mo).then(r=>this.take(null,r)).catch(()=>null)):this.health.checks||this.health.run()}};var Xa=":root{--dl-card: var(--panel-bg, var(--background-color-high, transparent));--dl-elevated: var(--elevated, var(--background-color-high, Canvas));--dl-line: var(--border, var(--border-color-medium, color-mix(in srgb, currentColor 14%, transparent)));--dl-soft: var(--muted, color-mix(in srgb, currentColor 5%, transparent));--dl-soft-hover: var(--soft-hover, color-mix(in srgb, currentColor 10%, transparent));--dl-fg: var(--foreground, var(--text-color-highest, inherit));--dl-fg-muted: var(--muted-foreground, color-mix(in srgb, currentColor 65%, transparent));--dl-fg-faint: var(--text-tertiary, color-mix(in srgb, currentColor 50%, transparent));--dl-accent: var(--accent, #3a83f7);--dl-ok: var(--success, #00a240);--dl-warn: var(--warning, #e25507);--dl-bad: var(--danger, #e02e2a);--dl-ok-wash: var(--success-a15, color-mix(in srgb, #00a240 15%, transparent));--dl-warn-wash: var(--warning-a15, color-mix(in srgb, #e25507 15%, transparent));--dl-bad-wash: var(--destructive-a15, color-mix(in srgb, #e02e2a 15%, transparent));--dl-info-wash: var(--info-a15, color-mix(in srgb, #3a83f7 15%, transparent));--dl-info: var(--info, #2c67c5);--dl-track: var(--foreground-a10, color-mix(in srgb, currentColor 10%, transparent));--dl-chart-1: var(--chart-blue, #3a83f7);--dl-chart-2: var(--chart-green, #00a240);--dl-ring: var(--ring, #3a83f7);--dl-primary: var(--primary, #0d0d0d);--dl-primary-fg: var(--primary-foreground, #fff);--dl-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--dl-shadow: var(--shadow-sm, none);--dl-radius: 16px}.dl-root,.dl-modal{cursor:default}:is(.dl-root,.dl-modal) :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,[contenteditable=true]){cursor:text}.dl-icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.dl-icon{width:16px;height:16px}.dl-icon-btn{display:inline-flex!important;align-items:center;gap:6px}.dl-muted{color:var(--dl-fg-muted)}.dl-faint,.dl-sep{color:var(--dl-fg-faint)}.dl-nowrap{white-space:nowrap}.dl-mono{font-family:var(--dl-mono);font-size:13px}.dl-spacer{flex:1}.dl-pill{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:999px;font-size:12px;line-height:20px;font-weight:500;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-pill.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-pill.accent{background:var(--dl-info-wash);color:var(--dl-info)}.dl-pill.off{opacity:.75}.dl-panel{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:16px;margin:0 0 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 12px}.dl-panel-head h3{margin:0!important;padding:0;font-size:16px;line-height:24px;font-weight:500;border:0;background:none}.dl-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:0 0 16px}.dl-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-tile-label{font-size:12px;line-height:16px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile-value{font-size:24px;line-height:32px;font-weight:500;margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}.dl-tile-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dl-grid2{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:0 16px}@media(max-width:960px){.dl-grid2{grid-template-columns:minmax(0,1fr)}}.dl-chart{display:block;width:100%;height:120px}.dl-bar-down{fill:var(--dl-chart-1)}.dl-bar-up{fill:var(--dl-chart-2);opacity:.8}.dl-legend{display:flex;gap:16px;font-size:12px;color:var(--dl-fg-muted);margin-top:8px}.dl-legend i{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:6px;vertical-align:0}.dl-legend .down{background:var(--dl-chart-1)}.dl-legend .up{background:var(--dl-chart-2)}.dl-events{list-style:none;margin:0;padding:0}.dl-events li{display:flex;gap:12px;align-items:baseline;padding:8px 0;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-events li:first-child{border-top:0;padding-top:0}.dl-ev-time{flex:0 0 88px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}.dl-ev-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);transform:translateY(-2px)}.dl-ev-dot.ok{background:var(--dl-ok)}.dl-ev-dot.warn{background:var(--dl-warn)}.dl-ev-dot.bad{background:var(--dl-bad)}.dl-ev-dot.accent{background:var(--dl-accent)}.dl-row>.dl-ev-dot,.dl-dev-log-row>.dl-ev-dot{margin:0 4px}.dl-ev-tile{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-2px -4px;border-radius:7px;background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent);align-self:center}.dl-ev-tile .dl-icon-wrap{display:inline-flex}.dl-ev-tile .dl-icon{width:14px;height:14px}.dl-row.dl-ev-by-admin{background:color-mix(in srgb,var(--dl-accent) 6%,transparent)}.dl-you{color:var(--dl-accent);font-weight:500}.dl-ev-kind{color:var(--dl-fg-faint)}.dl-slotbar{display:flex;align-items:center;gap:8px;margin:8px 0 0 44px}.dl-slotbar-segs{display:flex;gap:3px;flex:none;max-width:100%}.dl-slotbar-segs i{flex:1;min-width:2px;display:block;height:4px;border-radius:2px;background:var(--dl-soft-hover)}.dl-slotbar-segs i.used{background:var(--dl-fg-muted)}.dl-slotbar-text{font-size:12px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums}.dl-slotbar-segs i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-ev-srv{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-ev-by-system{--sys: var(--dl-fg-muted)}.dl-ev-by-system.ok{--sys: var(--dl-ok)}.dl-ev-by-system.warn{--sys: var(--dl-warn)}.dl-ev-by-system.bad{--sys: var(--dl-bad)}.dl-ev-tile.ev{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-ev-tile.ev.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-ev-tile.ev.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ev-tile.ev.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-ev-tile.ev.accent{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ev-tile.sys{background:color-mix(in srgb,var(--sys) 16%,transparent);color:var(--sys)}.dl-row.dl-ev-by-system{background:color-mix(in srgb,var(--sys) 6%,transparent)}.dl-sys-src{color:var(--sys)}.dl-ev-by-system:not(.ok):not(.warn):not(.bad) .dl-sys-src{color:var(--dl-fg)}.dl-ev-text{min-width:0;overflow-wrap:anywhere}.dl-server{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-server-name{font-size:16px;line-height:24px;font-weight:500}.dl-kv{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 24px;margin:12px 0 0;font-size:14px;line-height:20px}.dl-kv dt{color:var(--dl-fg-muted);font-weight:400;margin:0}.dl-kv dd{margin:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}";var ei='.dl-plist{display:block}.dl-plist>.dl-card{display:block;margin:0 0 12px;padding:16px;min-width:0;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);box-shadow:var(--dl-shadow)}.dl-plist>.dl-card.dl-filtered{display:none}.dl-plist>.dl-card.dl-off :is(.dl-card-name,.dl-avatar,.dl-access,.dl-slotbar,.dl-chips,.dl-pill-ic,.dl-use-num,.dl-pside-foot,.dl-pside-state){opacity:.45}.dl-plist>.dl-card.dl-off .dl-usebar i{background:var(--dl-fg-faint)}.dl-plist>.dl-card.dl-off .dl-chip-tag{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pcard:has(>.dl-pstrip){row-gap:14px}.dl-pstrip{grid-column:1 / -1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 -16px -16px;padding:10px 16px;border-top:1px solid var(--dl-line);border-radius:0 0 var(--dl-radius) var(--dl-radius);font-size:14px;line-height:20px}.dl-pstrip.warn{background:color-mix(in srgb,var(--dl-warn) 7%,transparent)}.dl-pstrip.bad{background:color-mix(in srgb,var(--dl-bad) 7%,transparent)}.dl-pstrip-text{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}.dl-pstrip-text b{font-weight:500}.dl-pstrip>.cbi-button{flex:none;height:32px!important}.dl-plist-none{color:var(--dl-fg-muted);text-align:center;padding:28px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-card-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px}.dl-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--dl-fg);background:var(--dl-soft);position:relative;margin-right:4px;letter-spacing:.02em}.dl-avatar.online:after{content:"";position:absolute;right:-1px;bottom:-1px;width:9px;height:9px;border-radius:50%;background:var(--dl-ok);box-shadow:0 0 0 2px var(--dl-card)}.dl-card-name{font-size:16px;line-height:24px;font-weight:500}.dl-card-slug{font-size:13px;color:var(--dl-fg-faint);font-family:var(--dl-mono)}.dl-quota{margin:8px 0 0 44px;max-width:320px;height:6px;border-radius:999px;background:var(--dl-track);overflow:hidden}.dl-quota>i{display:block;height:100%;background:var(--dl-accent);border-radius:999px}.dl-quota.warn>i{background:var(--dl-warn)}.dl-quota.bad>i{background:var(--dl-bad)}.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0 44px}.dl-chip{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;max-width:240px;height:28px;padding:0 12px 0 10px;border-radius:999px;font-size:13px;background:var(--dl-soft);color:var(--dl-fg);transition:background .15s}.dl-chip:hover{background:var(--dl-soft-hover)}.dl-chip:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-chip .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-chip.add{background:transparent;border:1px dashed color-mix(in srgb,var(--dl-fg) 28%,transparent);color:var(--dl-fg-muted)}.dl-chip.add:hover{background:var(--dl-soft);color:var(--dl-fg);border-color:color-mix(in srgb,var(--dl-fg) 45%,transparent)}.dl-chip.add:hover .dl-icon{color:var(--dl-fg)}.dl-chip.disabled .dl-chip-name{text-decoration:line-through;color:var(--dl-fg-faint)}.dl-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);opacity:.6}.dl-dot.online{background:var(--dl-ok);opacity:1;box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-empty{text-align:center;padding:40px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-empty .dl-icon-wrap{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);margin-bottom:12px}.dl-empty .dl-icon{width:20px;height:20px}.dl-empty h3{margin:0 0 4px!important;font-size:16px;font-weight:500}.dl-empty p{margin:0 0 16px;color:var(--dl-fg-muted);font-size:14px}.dl-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 16px}.dl-toolbar .dl-muted{font-size:13px}@media(max-width:640px){.dl-slotbar,.dl-chips,.dl-quota{margin-left:0}.dl-btn-label{display:none}}.cbi-value.dl-block{display:block!important}.cbi-value.dl-block>.cbi-value-title{display:block;width:auto;float:none;text-align:left;padding:0 0 8px}.cbi-value.dl-block>.cbi-value-field{display:block;width:100%;margin:0}.dl-people-find{width:160px;min-width:0}.dl-people-find[hidden]{display:none}';var ti="#modal_overlay{z-index:1100!important}.dl-dd{position:fixed;z-index:1200;min-width:200px;padding:4px;border-radius:12px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:0 12px 32px #0000004d;display:flex;flex-direction:column}.dl-dd button{all:unset;cursor:pointer;display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:8px;font-size:13px;color:var(--dl-fg)}.dl-dd button .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-dd button:hover,.dl-dd button:focus-visible{background:var(--dl-soft)}.dl-dd button.danger,.dl-dd button.danger .dl-icon{color:var(--dl-bad, #e5484d)}.dl-dd button.warn,.dl-dd button.warn .dl-icon{color:var(--dl-warn)}.dl-dd hr{border:0;border-top:1px solid var(--dl-line);margin:4px 0}.dl-chipbtn b{font-weight:500;font-size:11px;margin-left:6px;opacity:.6}.dl-setsub{margin:20px 0 8px!important;font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-row-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dl-more-row{display:flex;justify-content:center;padding:8px 0 16px}.dl-dsec-actions{display:flex;align-items:center;gap:12px}.dl-kv-act{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}.dl-linkbtn,.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;margin:-4px -6px;border-radius:8px;font-size:12px;font-weight:500;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap;transition:background .12s,color .12s}.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{color:var(--dl-accent)}.dl-linkbtn:hover,.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:var(--dl-soft);color:var(--dl-fg);text-decoration:none!important}.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-linkbtn:focus-visible,.dl-bento-head a:focus-visible,.dl-bento-foot a:focus-visible,.dl-panel-head a:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-linkbtn.danger:hover{color:var(--dl-bad);background:var(--dl-bad-wash)}.dl-ifcards{display:flex;flex-direction:column;gap:20px;margin:24px 0}.dl-ifcard .dl-setsec-body{gap:14px}.dl-iflead{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-iflead b{font-size:14px;font-weight:500}.dl-ifgroup h4{margin:0 0 8px!important;padding:0!important;font-size:11px!important;font-weight:500!important;letter-spacing:.06em;text-transform:uppercase;color:var(--dl-fg-muted);border:0!important;background:none!important}.dl-ifgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.dl-if{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 12px 8px 10px;min-width:0;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);transition:background .15s,border-color .15s}.dl-if:hover{background:var(--dl-soft)}.dl-if:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-if-ic{width:30px;height:30px;border-radius:8px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-if-ic .dl-icon{width:16px;height:16px}.dl-if-main{display:flex;flex-direction:column;min-width:0;flex:1}.dl-if-name{font-size:13.5px;font-weight:500;color:var(--dl-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if-sub{font:11px/16px var(--dl-mono);color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if.sel{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 9%,transparent)}.dl-if.sel .dl-if-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-if-check{color:var(--dl-accent);display:inline-flex}.dl-if-check .dl-icon{width:16px;height:16px}.dl-if.auto{border-color:color-mix(in srgb,var(--dl-ok) 55%,transparent);background:var(--dl-ok-wash);cursor:default}.dl-if.auto .dl-if-ic{background:color-mix(in srgb,var(--dl-ok) 18%,transparent);color:var(--dl-ok)}.dl-if-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;flex:0 0 auto}.dl-if-badge.ok{color:var(--dl-ok)}.dl-if.off{cursor:default;opacity:.5}.dl-if.off:hover{background:var(--dl-card)}.dl-if.warn{border-color:color-mix(in srgb,var(--dl-warn) 60%,transparent)}.dl-if-wanctl{gap:10px;align-items:center}.dl-if-wanctl select{max-width:240px}.dl-if-summary{min-width:0;line-height:18px}.dl-warn{color:var(--dl-warn)}.dl-w-ip{width:160px}.dl-dnspick{padding-top:8px;border-top:1px solid var(--dl-line)}.dl-dnspick .dl-row-actions{gap:10px}.dl-note{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;font-size:12.5px;line-height:18px;margin:0 0 10px;background:var(--dl-soft)}.dl-note.warn{background:var(--dl-warn-wash, color-mix(in srgb, var(--dl-warn) 14%, transparent))}.dl-note .dl-icon{width:15px;height:15px;flex:0 0 auto;margin-top:1px;color:var(--dl-warn)}.dl-stale{align-self:flex-start;margin-top:4px;font-size:10.5px}.dl-root .cbi-button.dl-btn-warn,.dl-btn-warn.cbi-button{background:var(--dl-warn-wash)!important;color:var(--dl-warn)!important;border-color:color-mix(in srgb,var(--dl-warn) 35%,transparent)!important}.dl-root .cbi-button.dl-btn-warn:hover,.dl-btn-warn.cbi-button:hover{background:color-mix(in srgb,var(--dl-warn) 24%,transparent)!important}.dl-btn-warn .dl-icon{color:var(--dl-warn)}.dl-srvtabs{display:flex;flex-wrap:wrap;gap:6px;padding:4px;margin:0 0 20px;border-radius:12px;background:var(--dl-soft);width:fit-content;max-width:100%}.dl-srvtab{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:9px;font-size:13px;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap}.dl-srvtab b{font-weight:500}.dl-srvtab i.dot{width:7px;height:7px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-srvtab i.dot.ok{background:var(--dl-ok);animation:dl-srv-pulse 2s ease-out infinite}.dl-srvtab i.dot.bad{background:var(--dl-bad)}.dl-srvtab i.dot.warn{background:var(--dl-warn)}@keyframes dl-srv-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--dl-ok) 55%,transparent)}70%,to{box-shadow:0 0 0 6px transparent}}@media(prefers-reduced-motion:reduce){.dl-srvtab i.dot.ok{animation:none}}.dl-srvtab:hover{color:var(--dl-fg);background:var(--dl-soft-hover)}.dl-srvtab.on{background:var(--dl-card);color:var(--dl-fg);box-shadow:0 1px 2px #0000002e,inset 0 0 0 1px var(--dl-line)}.dl-srvtab:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-srvtab.add{color:var(--dl-fg-muted)}.dl-srvtab.add .dl-icon{width:14px;height:14px}.dl-srvhead{display:flex;flex-direction:column;gap:14px;margin:0 0 20px}.dl-srvhead .dl-title-row{display:flex;align-items:center;gap:10px}.dl-srvhead .dl-h1{margin:0!important}.dl-metrics.compact .dl-metric{padding:14px 18px}.dl-metrics.compact .dl-metric-value{display:flex;align-items:center;gap:6px;font-size:18px;line-height:26px;min-width:0}.dl-metrics.compact .dl-metric-value>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-metrics.compact .dl-metric-value .dl-mono{font-size:15px}.dl-metrics.compact .cbi-button{flex:0 0 auto}.dl-srvsections{margin:0 0 16px}.dl-srvbody>.dl-setsec,.dl-srvbody>.dl-ifcards{margin:0}.dl-srvbody .dl-ifcards{margin:0}.dl-metric-ic{display:inline-flex;align-items:center;gap:8px;font-size:16px}.dl-metric-ic .dl-icon{width:18px;height:18px;color:var(--dl-accent)}.dl-keyrow{display:inline-flex;align-items:center;gap:8px;min-width:0}.dl-keyrow code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:none;padding:0}.dl-params{border:1px solid var(--dl-line);border-radius:12px;background:var(--dl-card)}.dl-params>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;color:var(--dl-fg);user-select:none}.dl-params>summary::-webkit-details-marker{display:none}.dl-params>summary>.dl-icon-wrap{display:inline-flex;color:var(--dl-fg-muted);transition:transform .15s}.dl-params>summary>.dl-icon-wrap .dl-icon{width:15px;height:15px}.dl-params[open]>summary>.dl-icon-wrap{transform:rotate(90deg)}.dl-params>summary:focus{outline:none}.dl-params>summary:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px;border-radius:12px}.dl-params>summary:hover{background:var(--dl-soft);border-radius:12px}.dl-pcount{font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;padding:4px 14px 14px}.dl-pgroup{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-pgroup-head{display:flex;align-items:center;gap:8px;font-size:13px}.dl-pgroup-head b{font-weight:500}.dl-pgroup-head .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-pgroup p{margin:0!important;font-size:12px;line-height:17px;color:var(--dl-fg-muted)}.dl-pvals{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.dl-pv{display:inline-flex;align-items:stretch;max-width:100%;border-radius:6px;overflow:hidden;font:500 11.5px/22px var(--dl-mono);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pv i{font-style:normal;padding:0 6px;background:var(--dl-card);color:var(--dl-fg-faint)}.dl-pv b{font-weight:500;padding:0 7px;color:var(--dl-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}";var ni=".dl-methods{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.dl-method{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;border:1px solid var(--dl-line);background:var(--dl-card);transition:border-color .15s,background .15s;min-width:0}.dl-method:hover{background:var(--dl-soft)}.dl-method:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-method.on{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 8%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-method.off{cursor:not-allowed;opacity:.55}.dl-method.off:hover{background:var(--dl-card)}.dl-method-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-method-head .dl-pill{flex:none}.dl-method-head b{font-weight:500;font-size:14.5px;flex:1}.dl-method-ic{width:32px;height:32px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);flex:0 0 auto}.dl-method-ic .dl-icon{width:17px;height:17px}.dl-method.on .dl-method-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-method p{margin:0!important;font-size:12.5px;line-height:18px;color:var(--dl-fg-muted);flex:1}.dl-method-meters{display:flex;gap:16px}.dl-dots{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-dots-row{display:inline-flex;gap:3px}.dl-dots-row i{width:6px;height:6px;border-radius:50%;background:var(--dl-line)}.dl-dots-row i.on{background:var(--dl-fg-muted)}.dl-method.on .dl-dots-row i.on{background:var(--dl-accent)}.dl-method-foot{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dl-fg-faint);padding-top:8px;border-top:1px solid var(--dl-line)}.dl-method-foot .dl-icon{width:13px;height:13px;flex:0 0 auto}.dl-method.off .dl-method-foot{color:var(--dl-warn)}.dl-ibadge{display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);flex:0 0 auto}.dl-ibadge .dl-icon{width:13px;height:13px}.dl-ibadge.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ibadge.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-access{display:inline-flex;gap:4px;flex:0 0 auto}.dl-ibadge.lan{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ibadge.inet{background:var(--dl-ok-wash);color:var(--dl-ok)}";var oi=".dl-addrbar{display:inline-flex;align-items:stretch;flex-wrap:nowrap;max-width:100%;margin-top:4px;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);overflow:hidden}.dl-addrbar-seg{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;padding:6px 12px;font-size:13px;color:var(--dl-fg-muted);border-left:1px solid var(--dl-line);white-space:nowrap;min-width:0}.dl-addrbar-seg:first-child{border-left:0}.dl-addrbar-seg .dl-icon{width:14px;height:14px;color:var(--dl-fg-faint);flex:0 0 auto}.dl-addrbar-seg .dl-mono{font-size:12.5px}.dl-addrbar-seg.main{cursor:pointer;color:var(--dl-fg)}.dl-addrbar-seg.main:hover{background:var(--dl-soft)}.dl-addrbar-seg.main:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-addrbar-seg.main>.dl-icon-wrap:last-child .dl-icon{opacity:.7}.dl-bento{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:10px;margin:0 0 20px}.dl-person-devices{margin-bottom:16px}.dl-person-head{display:flex;flex-direction:column;margin:0 0 20px}.dl-person-head>.dl-pagehead{margin-bottom:0;align-items:flex-start}.dl-pnote{all:unset;box-sizing:border-box;cursor:pointer;align-self:flex-start;display:inline-flex;align-items:flex-start;gap:6px;margin:10px 0 0 62px;max-width:60ch;padding:6px 12px 6px 10px;border-radius:10px;font-size:13px;line-height:18px;white-space:pre-line;background:var(--dl-soft);color:var(--dl-fg);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pnote:hover{background:var(--dl-soft-hover)}.dl-pnote .dl-icon{width:14px;height:14px;flex:none;margin-top:2px;color:var(--dl-fg-muted)}.dl-note-input{width:100%;box-sizing:border-box;min-height:80px;resize:vertical}.dl-dcard-trend{display:flex;align-items:flex-end;gap:12px;min-width:0}.dl-dcard-trend>.dl-stack{flex:none}.dl-dcard-trend b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dbars{flex:1;min-width:0;height:32px;display:flex;align-items:flex-end;gap:2px}.dl-dbars i{flex:1;min-width:0;border-radius:2px;background:var(--dl-chart-1);opacity:.55}.dl-dbars i.zero{background:var(--dl-track);opacity:1}.dl-dbars i.hi{opacity:1}.dl-dbars i:hover{opacity:1;filter:brightness(1.2)}.dl-datechip{position:relative;display:inline-flex}.dl-date-hidden{position:absolute!important;left:0;bottom:0;width:1px!important;min-width:0!important;height:1px!important;opacity:0;pointer-events:none;border:0!important;padding:0!important;margin:0!important}.dl-chipbtn .dl-icon{width:13px;height:13px}.dl-chipbtn:has(.dl-icon){display:inline-flex;align-items:center;gap:5px}.dl-places{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--dl-line);border-radius:var(--dl-radius);background:var(--dl-card);font-size:14px}.dl-places>.dl-icon{width:18px;height:18px;color:var(--dl-fg-muted);flex:none}.dl-person-live{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.dl-person-live .dl-bento-head{flex-wrap:nowrap;white-space:nowrap;min-width:0}.dl-person-live .dl-bento-head>*{min-width:0;overflow:hidden;text-overflow:ellipsis}.dl-person-live .dl-bento-head>:first-child{flex:none}.dl-person-live.solo{grid-template-columns:minmax(0,1fr)}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child{flex-wrap:wrap;row-gap:2px}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child>.dl-sub{flex-basis:100%}.dl-person-live>.dl-bento-tile,.dl-person-live>.dl-bento-tile.month{grid-column:auto;grid-row:auto}@media(max-width:760px){.dl-person-live{grid-template-columns:minmax(0,1fr)}}.dl-bento-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:var(--dl-shadow)}.dl-bento-tile.month{grid-column:1 / -1}.dl-onl-count{font-size:13px;line-height:22px;min-width:22px;padding:0 8px;border-radius:999px;background:var(--dl-soft);text-align:center;font-weight:500;font-variant-numeric:tabular-nums}.dl-onl-count.none{color:var(--dl-fg-faint)}.dl-onl-row{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;min-width:0}.dl-onl-p{display:flex;flex-direction:column;align-items:center;gap:5px;width:104px;min-width:0;padding:6px 2px;border-radius:12px;color:var(--dl-fg)!important;text-decoration:none!important}.dl-onl-p:hover{background:var(--dl-soft)}.dl-onl-av{position:relative;width:42px;height:42px;border-radius:50%;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;box-shadow:0 0 0 2px var(--dl-ok)}.dl-onl-p.more .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line);color:var(--dl-fg-muted)}.dl-onl-dev{position:absolute;right:-6.5px;bottom:-6.5px;width:20px;height:20px;border-radius:8.5px;border:1.5px solid transparent;background:var(--dl-card);display:inline-flex;align-items:center;justify-content:center;font-size:10px;color:var(--dl-fg-muted)}.dl-onl-dev .dl-icon-wrap{display:inline-flex}.dl-onl-dev .dl-icon{width:12px;height:12px}.dl-onl-name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-p .dl-sub{font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-row.grid{flex-wrap:wrap;align-content:center;gap:10px 8px;max-height:108px;overflow:hidden}.dl-onl-p.sm{width:auto;padding:4px}.dl-onl-p:hover .dl-onl-dev{background:linear-gradient(var(--dl-soft),var(--dl-soft)),var(--dl-card)}.dl-onl-p.sm:hover{background:none}.dl-onl-p.sm:hover .dl-onl-dev{background:var(--dl-card)}.dl-onl-p.sm .dl-onl-av{transition:box-shadow .15s ease}.dl-onl-p.sm:hover .dl-onl-av{box-shadow:0 0 0 2px var(--dl-ok),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm.more:hover .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm .dl-onl-av{width:36px;height:36px;font-size:11.5px}.dl-onl-meta{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--dl-fg-faint);max-width:100%;white-space:nowrap;overflow:hidden}.dl-onl-meta .dl-icon-wrap{display:inline-flex}.dl-onl-meta .dl-icon{width:12px;height:12px}.dl-onl-av.sm{width:34px;height:34px;font-size:11.5px}.dl-tip-float:has(.dl-hc){padding:0;white-space:normal;border-radius:16px}.dl-hc{width:280px;padding:14px;display:flex;flex-direction:column;gap:10px}.dl-hc-head{display:flex;align-items:center;gap:10px}.dl-hc-head .dl-stack{flex:1;min-width:0}.dl-hc-head b{font-size:14px;font-weight:500}.dl-hc-since{font-size:11.5px;color:var(--dl-ok)}.dl-hc-reach{display:inline-flex;gap:4px}.dl-hc-speed{border-radius:12px;background:var(--dl-soft);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.dl-hc-speed-row{display:flex;align-items:baseline;gap:12px;font-size:13px;font-variant-numeric:tabular-nums}.dl-hc-chart{display:block;width:100%;height:30px}.dl-hc-chart .area{fill:color-mix(in srgb,var(--dl-chart-1) 16%,transparent)}.dl-hc-chart .dn{fill:none;stroke:var(--dl-chart-1);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-hc-chart .up{fill:none;stroke:var(--dl-ok);stroke-width:1.2;vector-effect:non-scaling-stroke}.dl-hc-devs{display:flex;flex-wrap:wrap;gap:6px}.dl-hc-dev{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:999px;background:var(--dl-soft);font-size:11.5px}.dl-hc-dev .dl-icon-wrap{display:inline-flex}.dl-hc-dev .dl-icon{width:12px;height:12px;color:var(--dl-fg-muted)}.dl-hc-foot{display:flex;align-items:center;gap:8px;font-size:11.5px}.dl-disg-id{display:flex;align-items:center;gap:10px}.dl-disg-id b{font-size:16px;font-weight:500}.dl-disg-ic{width:36px;height:36px;border-radius:11px;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-disg-ic .dl-icon-wrap{display:inline-flex}.dl-disg-ic .dl-icon{width:18px;height:18px}.dl-disg-ic.off{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-disg-meters{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:var(--dl-fg-muted)}.dl-segs{display:inline-flex;gap:3px}.dl-segs i{width:18px;height:5px;border-radius:3px;background:var(--dl-track)}.dl-segs.acc i.on{background:var(--dl-accent)}.dl-segs.ok i.on{background:var(--dl-ok)}.dl-disg-chips{margin-top:auto;display:flex;flex-wrap:wrap;gap:5px}.dl-disg-chips span{font:11px/20px var(--dl-mono);padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-onl-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;text-align:center}.dl-bento-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.dl-bento-head.start{justify-content:flex-start}.dl-bento-big{font-family:inherit;font-size:28px;line-height:34px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-bento-big small{font-size:13px;font-weight:400;color:var(--dl-fg-faint);letter-spacing:0}.dl-avstack{display:inline-flex}.dl-avstack .dl-avatar{margin-left:-7px;box-shadow:0 0 0 2px var(--dl-card)}.dl-avstack .dl-avatar:first-child{margin-left:0}.dl-avatar.more{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-bento-list{display:flex;flex-direction:column;gap:2px}.dl-bento-row{display:flex;align-items:center;gap:10px;padding:8px;margin:0 -8px;border-radius:10px;color:var(--dl-fg)!important;text-decoration:none!important;min-width:0;transition:background .12s}.dl-bento-row:hover{background:var(--dl-soft)}.dl-bento-row:hover b{text-decoration:none}.dl-bento-row:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-bento-row-main{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.dl-bento-row-main b{font-weight:500;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row-main .dl-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row.off b{color:var(--dl-fg-muted);font-weight:400}.dl-bento-row-val{display:flex;flex-direction:column;align-items:flex-end;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-bento-row-val small{font-size:11px;color:var(--dl-fg-faint)}.dl-bento-sep{font-size:11px;color:var(--dl-fg-faint);padding:12px 0 4px}.dl-bento-devs{display:inline-flex;gap:3px;color:var(--dl-fg-faint)}.dl-bento-devs .dl-icon{width:13px;height:13px}.dl-bento-devs .on{color:var(--dl-ok)}.dl-bento-foot{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:10px;border-top:1px solid var(--dl-line);color:var(--dl-fg)!important;text-decoration:none!important}.dl-bento-foot.split,.dl-bento-foot.end{justify-content:space-between}.dl-bento-foot.end>a:only-child{margin-left:auto}.dl-bento-empty{display:flex;align-items:center;gap:10px;padding:14px 0;font-size:13.5px;color:var(--dl-fg-muted)}.dl-bento-empty .dl-icon{width:18px;height:18px}.dl-split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--dl-soft)}.dl-split i{display:block;height:100%}.dl-split i.dn{background:var(--dl-accent)}.dl-split i.up{background:var(--dl-ok)}.dl-dn{color:var(--dl-accent)}.dl-up{color:var(--dl-ok)}.dl-bento-method{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:500}.dl-bento-method .dl-icon{width:20px;height:20px;color:var(--dl-accent)}.dl-meter{display:inline-flex;gap:3px}.dl-meter i{width:16px;height:4px;border-radius:2px;background:var(--dl-line)}.dl-meter i.on{background:var(--dl-accent)}.dl-bento-total{font-size:16px;font-weight:500;margin-left:8px}.dl-bento-bars{display:flex;align-items:flex-end;gap:3px;height:54px}.dl-bento-bars i{flex:1;min-width:0;border-radius:3px 3px 0 0;background:var(--dl-soft-hover);transition:background .15s}.dl-bento-bars i.future{height:4px;background:var(--dl-soft)}.dl-bento-bars i:hover{background:var(--dl-fg-faint)}.dl-bento-bars i.hi{background:var(--dl-accent)}@media(max-width:700px){.dl-addrbar{flex-wrap:wrap}}@media(max-width:900px){.dl-bento{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.dl-bento-tile.online{grid-column:span 2}}@media(max-width:560px){.dl-bento{grid-template-columns:minmax(0,1fr)}.dl-bento-tile.online,.dl-bento-tile.month{grid-column:auto}}.dl-srvpagehead{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:0 0 20px}.dl-srvpagehead>.dl-title-row{display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}.dl-srvpagehead .dl-actions{margin:0;flex-wrap:wrap}.dl-toolbar-end{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap;min-width:0}@media(max-width:640px){.dl-toolbar-end{flex-wrap:wrap;width:100%}}.dl-notices{margin:0 0 16px}.dl-notices .dl-need-row .dl-sub{overflow-wrap:anywhere}.dl-notices-more{font-size:13px;color:var(--dl-fg-muted);text-decoration:none}.dl-notices-more:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-speed-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dl-speed-col{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-speed-val{font-size:20px;line-height:26px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-speed-today{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;font-variant-numeric:tabular-nums}.dl-speed-today b{font-weight:500;color:var(--dl-fg)}.dl-speed-chart{display:block;width:100%;height:44px}.dl-speed-chart .area{fill:color-mix(in srgb,var(--dl-accent) 16%,transparent)}.dl-speed-chart .line{fill:none;stroke:var(--dl-accent);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-speed-chart .line.up{stroke:var(--dl-ok);stroke-width:1.2;opacity:.85}.dl-speed-wait{height:44px;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-speed-wait i{display:block;height:1px;background:var(--dl-line);order:2}.dl-speed-val.off{color:var(--dl-fg-faint)}.dl-fld{display:flex;flex-direction:column;gap:8px;margin:0 0 16px}.dl-fld-label{font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-fld .cbi-input-text{width:100%;box-sizing:border-box}.dl-kinds{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.dl-kinds button{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:68px;border-radius:10px;border:1px solid var(--dl-line);color:var(--dl-fg-muted);font-size:12px;font-weight:500;text-align:center;min-width:0}.dl-kinds button .dl-icon{width:20px;height:20px}.dl-kinds button:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-kinds button:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-kinds button.on{border-color:var(--dl-accent);color:var(--dl-fg);background:color-mix(in srgb,var(--dl-accent) 10%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-kinds button.on .dl-icon{color:var(--dl-accent)}.dl-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}.dl-choice{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line);transition:background .15s,box-shadow .15s}.dl-choice:hover{background:var(--dl-soft)}.dl-choice:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-choice.selected{box-shadow:inset 0 0 0 2px var(--dl-accent);background:var(--accent-a10, color-mix(in srgb, var(--dl-accent) 8%, transparent))}.dl-choice-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg)}.dl-choice-text{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-attn-item>.cbi-button{margin-left:auto;flex:none;align-self:center}";var ri='.dl-steps{display:flex;align-items:center;gap:8px;margin:0 0 16px;flex-wrap:wrap}.dl-step{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg-faint)}.dl-step b{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:50%;background:var(--dl-soft);font-size:12px;font-weight:600}.dl-step.current{color:var(--dl-fg)}.dl-step.current b{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-step.done{color:var(--dl-fg-muted)}.dl-step.done b{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-step+.dl-step:before{content:"";width:24px;height:1px;background:var(--dl-line)}.dl-wizard .dl-panel>div{display:flex;flex-direction:column;gap:16px}.dl-wizard .dl-panel>div>p{margin:0!important;color:var(--dl-fg-muted)}.dl-wizard .dl-panel>div>.cbi-value{margin:0}.dl-wizard h4{font-size:14px;font-weight:500;margin:8px 0 -6px!important}.dl-wizard h4:first-child{margin-top:0!important}.dl-modal .cbi-tabmenu{margin-bottom:16px}.dl-modal .cbi-value.dl-live>.cbi-value-title{display:flex;flex-direction:column;gap:2px;text-align:left}.dl-modal .cbi-value.dl-live>.cbi-value-title>.dl-sub{white-space:normal}.dl-checklist{display:flex;flex-direction:column;gap:6px;margin:4px 0 8px}.dl-checklist label{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}.dl-checklist input{margin:0}.dl-invite{display:grid;grid-template-columns:250px minmax(0,1fr);gap:22px;align-items:start}.dl-invite img{display:block;width:100%;border-radius:18px;box-shadow:0 0 0 1px var(--dl-line)}.dl-invite-side{display:flex;flex-direction:column;gap:14px;min-width:0}.dl-invite-side>p{margin:0!important}.dl-invite-link{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-width:0;padding:11px 14px;border-radius:12px;background:var(--dl-soft);font:13px/18px var(--dl-mono);color:var(--dl-fg)}.dl-invite-link>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-invite-link>.dl-icon-wrap{flex:none;display:inline-flex}.dl-invite-link .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted);flex:none}.dl-invite-link:hover{background:var(--dl-soft-hover)}.dl-invite-link.alt{padding:8px 14px;font-size:12px;color:var(--dl-fg-muted)}.dl-invite-link>.dl-pill{flex:none}.dl-invite-steps{margin:0;padding-left:20px;list-style:decimal!important;font-size:13px;line-height:24px;color:var(--dl-fg-muted)}.dl-invite-steps b{color:var(--dl-fg);font-weight:500}.dl-invite-steps li{display:list-item!important;list-style:inherit!important;padding-left:4px}.dl-invite-actions{display:flex;gap:8px;flex-wrap:wrap}.modal:has(.dl-modal.wide){max-width:min(760px,94vw)!important;width:100%!important}@media(max-width:640px){.dl-invite{grid-template-columns:minmax(0,1fr)}.dl-invite img{max-width:260px;margin:0 auto}}.dl-toasts{position:fixed;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translate(-50%);z-index:100000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}.dl-toast{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;max-width:min(520px,92vw);padding:10px 16px;border-radius:999px;background:var(--dl-fg);color:var(--dl-card);font-size:13px;line-height:18px;box-shadow:0 10px 30px #0000004d;opacity:0;transform:translateY(12px);transition:opacity .18s,transform .18s}.dl-toast.show{opacity:1;transform:none}.dl-toast .dl-icon-wrap{display:inline-flex}.dl-toast .dl-icon{width:15px;height:15px}.dl-toast.success .dl-icon{color:var(--dl-ok)}.dl-toast.error{background:var(--dl-bad);color:#fff}.dl-toast.error .dl-icon{color:#fff}.dl-toast.warning{background:var(--dl-warn);color:#111}.dl-toast.warning .dl-icon{color:#111}.dl-toast button{all:unset;cursor:pointer;display:inline-flex;margin-left:4px;opacity:.8}.dl-toast button:hover{opacity:1}';var ai=".dl-setblock{display:flex;flex-direction:column;gap:8px;margin:0}.dl-addr-opts{display:flex;flex-direction:column;gap:6px}.dl-addr-opt{all:unset;box-sizing:border-box;cursor:pointer;display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 14px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line);min-width:0}.dl-addr-opt:hover{background:var(--dl-soft)}.dl-addr-opt.on{box-shadow:inset 0 0 0 1.5px var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 7%,transparent)}.dl-addr-opt .dl-mono{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-addr-opt .dl-stack{min-width:0}.dl-addr-opt input{width:100%}.dl-addr-opt.other{cursor:default}.dl-addr-opt.other:hover{background:none}.dl-addr-opt.other input{width:100%}.dl-addr-check{width:16px;height:16px;border-radius:5px;box-shadow:inset 0 0 0 1.5px var(--dl-fg-faint);display:inline-flex;align-items:center;justify-content:center}.dl-addr-check .dl-icon-wrap{display:inline-flex}.dl-addr-check .dl-icon{width:12px;height:12px}.dl-addr-opt.on .dl-addr-check{background:var(--dl-accent);box-shadow:none;color:#fff}.dl-addr-opt.other .dl-addr-check{box-shadow:none;color:var(--dl-fg-muted)}.dl-addr-warn{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:17px;color:var(--dl-warn)}.dl-addr-warn .dl-icon-wrap{display:inline-flex}.dl-addr-warn .dl-icon{width:13px;height:13px}.dl-pill.info{background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-links{border-radius:12px;background:var(--dl-soft);overflow:hidden}.dl-link-row{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 14px}.dl-link-row+.dl-link-row{border-top:1px solid var(--dl-line)}.dl-link-ic{display:inline-flex}.dl-link-ic .dl-icon{width:15px;height:15px}.dl-link-ic.ok .dl-icon{color:var(--dl-ok)}.dl-link-ic.warn .dl-icon{color:var(--dl-warn)}.dl-link-url{font-size:13px;color:var(--dl-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-link-url b{font-weight:500;color:var(--dl-accent)}@media(max-width:640px){.dl-link-url,.dl-addr-opt .dl-mono,.dl-filecard .dl-ellipsis,.dl-invite-link>span:first-child{white-space:normal;overflow-wrap:anywhere}}.dl-ready-sum{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px}.dl-ready-sum>.dl-icon-wrap{display:inline-flex}.dl-ready-sum>.dl-icon-wrap .dl-icon{width:18px;height:18px}.dl-ready-sum .dl-stack{flex:1;min-width:0}.dl-ready-sum b{font-weight:500;font-size:13px}.dl-ready-sum.ok{background:var(--dl-ok-wash)}.dl-ready-sum.ok b,.dl-ready-sum.ok .dl-icon{color:var(--dl-ok)}.dl-ready-sum.warn{background:var(--dl-warn-wash)}.dl-ready-sum.warn b,.dl-ready-sum.warn .dl-icon{color:var(--dl-warn)}.dl-ready-sum.error{background:var(--dl-bad-wash)}.dl-ready-sum.error b,.dl-ready-sum.error .dl-icon{color:var(--dl-bad)}.dl-check-chip{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;color:var(--dl-fg-muted)}.dl-check-chip .dl-icon-wrap{display:inline-flex}.dl-check-chip .dl-icon{width:13px;height:13px;color:var(--dl-ok)}.dl-check-chip.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-chip.warn .dl-icon{color:var(--dl-warn)}.dl-check-chip.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-ready-details{display:flex;flex-direction:column;gap:8px;padding:4px 2px}.dl-ready-details[hidden]{display:none}.dl-ready-item{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:18px;min-width:0}.dl-ready-item .dl-icon-wrap{display:inline-flex;margin-top:1px}.dl-ready-item .dl-icon{width:15px;height:15px}.dl-ready-item.ok .dl-icon{color:var(--dl-ok)}.dl-ready-item.warn .dl-icon{color:var(--dl-warn)}.dl-ready-item.error .dl-icon{color:var(--dl-bad)}.dl-params-body{display:flex;flex-direction:column;gap:14px;padding:6px 14px 14px}.dl-params-body>.dl-setrow{margin:0;padding:0}.dl-pgrid.flush{padding:0;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:640px){.dl-pgrid.flush{grid-template-columns:minmax(0,1fr)}}.dl-qr-pane{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.dl-qr{width:min(280px,72vw);aspect-ratio:1;background:#0a0a0a;border-radius:18px;overflow:hidden}.dl-qr.light{background:#fff;box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-qr svg{display:block;width:100%;height:100%}.dl-filecard{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--dl-soft);min-width:0}.dl-filecard>.dl-stack{flex:1;min-width:0}.dl-filecard-ic{width:40px;height:46px;border-radius:8px;flex:none;display:inline-flex;align-items:center;justify-content:center;font:10px var(--dl-mono);color:var(--dl-fg-muted);background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-params>.dl-conf{margin:0;border-top:1px solid var(--dl-line);border-radius:0 0 12px 12px;background:none}.dl-conf-sec{color:var(--dl-accent)}.dl-conf-k{color:var(--dl-fg-faint)}.dl-conf-mask{padding:0 6px;border-radius:4px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-params>summary .dl-chipbtn{height:26px;font-size:12px}.dl-conf{white-space:pre-wrap;word-break:break-all;max-height:22em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:0;padding:12px;border-radius:12px;background:var(--dl-soft)}.dl-key{width:100%;box-sizing:border-box;font-family:var(--dl-mono);font-size:12px;word-break:break-all;min-height:7em}.dl-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0 0}.dl-link-box{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.dl-link-box input{flex:1 1 18em;min-width:0;font-family:var(--dl-mono);font-size:12px}.dl-hint{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin:8px 0}.dl-divider{border:0;border-top:1px solid var(--dl-line);margin:16px 0}";var ii=".dl-checks{list-style:none;margin:0;padding:0}.dl-checks li{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--dl-line)}.dl-checks li:first-child{border-top:0;padding-top:0}.dl-checks li:last-child{padding-bottom:0}.dl-check-icon{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.dl-check-icon .dl-icon{width:14px;height:14px}.dl-check-icon.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-check-icon.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-icon.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-icon.skip{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-check-body{flex:1;min-width:0}.dl-check-title{font-size:14px;line-height:20px;font-weight:500}.dl-check-detail{font-size:12px;line-height:16px;color:var(--dl-fg-muted);overflow-wrap:anywhere}.dl-check-repaired{margin-top:2px;font-size:12px;line-height:16px;color:var(--dl-warn)}.dl-wd{margin:0 0 16px;display:flex;flex-direction:column;gap:14px}.dl-wd-head{display:flex;align-items:center;gap:12px;min-width:0}.dl-wd-head>.dl-stack{min-width:0}.dl-wd-title{font-size:16px;line-height:24px;font-weight:500}.dl-wd-tile{flex:none;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-wd-tile.off{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-wd-tile .dl-icon{width:18px;height:18px}.dl-wd-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-wd-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto;min-width:0}.dl-wd-chips .dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-warn-text{color:var(--dl-warn)!important}.dl-health-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:16px;align-items:start}.dl-health-cols>.dl-panel{margin:0;min-width:0}.dl-recent{display:flex;flex-direction:column}.dl-recent .dl-panel-head a{font-size:13px}.dl-recent-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 16px;color:var(--dl-fg-muted);font-size:13px;border-top:1px solid var(--dl-line)}.dl-loading{margin:0;font-size:13px}.dl-diag-tabs{margin:0 0 16px}.dl-row.dl-slog-row{align-items:baseline}.dl-slog-row .dl-ev-tile{align-self:flex-start;margin-top:-1px}.dl-slog-row.has-detail{cursor:pointer}.dl-row.dl-slog-row.has-detail:hover{background:color-mix(in srgb,var(--sys) 11%,transparent)}.dl-slog-more{display:inline-flex;vertical-align:-2px;margin-left:6px;color:var(--dl-fg-faint);transform:rotate(90deg);transition:transform .15s}.dl-slog-more .dl-icon{width:14px;height:14px}.dl-slog-more.open{transform:rotate(-90deg)}.dl-slog-detail{margin:8px 0 2px;padding:8px 10px;border-radius:8px;background:var(--dl-soft);font-family:var(--dl-mono);font-size:12px;line-height:17px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dl-fg-muted);cursor:text}.dl-table{width:100%;border-collapse:collapse;font-size:14px;line-height:20px}.dl-table th{text-align:left;font-weight:500;color:var(--dl-fg-faint);padding:0 8px 8px;border-bottom:1px solid var(--dl-line)}.dl-table td{padding:10px 8px;border-bottom:1px solid var(--dl-line);vertical-align:middle}.dl-table th:first-child,.dl-table td:first-child{padding-left:0}.dl-table th:last-child,.dl-table td:last-child{padding-right:0}.dl-table tr:last-child td{border-bottom:0}.dl-table .dl-right{text-align:right;white-space:nowrap}.dl-log{max-height:18em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:8px 0 0;padding:12px;white-space:pre-wrap;border-radius:12px;background:var(--dl-soft)}";var si=".dl-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}.dl-h1{margin:0!important;padding:0!important;font-size:24px!important;line-height:32px!important;font-weight:500!important;border:0!important}.dl-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.dl-stack{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-stack.gap4{gap:4px}.dl-stack.gap8{gap:8px}.dl-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-ok{color:var(--dl-ok)}.dl-warn{color:var(--dl-warn)}.dl-bad{color:var(--dl-bad)}.dl-icon-only{width:auto!important;min-width:0!important;aspect-ratio:1 / 1;padding:0!important;justify-content:center;display:inline-flex!important;align-items:center;border-radius:999px!important}.dl-panel.flush{padding:0;overflow:hidden}.dl-panel-head.pad{padding:16px 16px 12px;margin:0}.dl-col{display:flex;flex-direction:column;gap:16px;min-width:0}.dl-col>.dl-panel,.dl-col>section.dl-panel{margin:0}.dl-crumbs{display:flex;gap:8px;align-items:center;font-size:14px;margin:0 0 16px;color:var(--dl-fg-faint)}.dl-crumbs a{color:var(--dl-fg-faint)}.dl-crumbs a:hover{color:var(--dl-fg)}.dl-crumbs span:last-child{color:var(--dl-fg)}.dl-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);margin:0 0 16px;box-shadow:var(--dl-shadow)}.dl-metric{display:flex;flex-direction:column;gap:4px;padding:16px 20px;min-width:0}.dl-metric+.dl-metric{border-left:1px solid var(--dl-line)}.dl-metric-label{font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-metric-value{font-size:28px;line-height:36px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-metric-value .dl-faint{font-size:16px}.dl-metric-sub{font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.dl-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dl-metric:nth-child(3){border-left:0}.dl-metric:nth-child(n+3){border-top:1px solid var(--dl-line)}}.dl-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--dl-soft);flex-wrap:wrap}.dl-seg button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500;color:var(--dl-fg-muted);white-space:nowrap}.dl-seg button:hover{color:var(--dl-fg)}.dl-seg button.on{background:var(--dl-soft-hover);color:var(--dl-fg)}.dl-seg.dl-srvsections{flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}.dl-seg.dl-srvsections::-webkit-scrollbar{display:none}.dl-seg.dl-srvsections button{flex:none;white-space:nowrap}.dl-seg button:focus-visible{outline:2px solid var(--dl-ring)}.dl-seg button b{font-weight:500;font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft)}.dl-seg button b.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-seg.sm button{padding:2px 9px;font-size:11px}.dl-seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-radius:12px;padding:4px}.dl-seg.wide button{flex-direction:column;justify-content:center;padding:8px 6px;border-radius:9px;gap:3px}.dl-seg.wide button.on{background:var(--dl-primary);color:var(--dl-primary-fg)}";var li=`.dl-geomap{position:relative;border-top:1px solid var(--dl-line);background:transparent}.dl-map-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);font-size:13px;z-index:1;pointer-events:none}.dl-map-wrap{position:relative}.dl-map-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:12px;align-items:center;padding:6px 12px;border-radius:999px;font-size:12px;background:color-mix(in srgb,var(--dl-card) 88%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);z-index:2}.dl-map-legend span{display:inline-flex;align-items:center;gap:6px;color:var(--dl-fg-muted)}.dl-map-legend i.line{width:14px;height:0;border-top:2px dashed #8a8a8a}.dl-map-legend i.line.live{border-top-color:#3b82f6}.dl-map-off{padding:32px 16px;text-align:center;color:var(--dl-fg-muted);border-top:1px solid var(--dl-line)}.dl-mk{all:unset;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;transition:opacity .2s}.dl-mk-hub{position:relative;display:flex;align-items:center;justify-content:center}.dl-mk-host{box-sizing:border-box;width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059}.dl-mk-host-tile{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:var(--dl-fg);color:var(--background, var(--dl-elevated))}.dl-mk-host-ic{width:14px;height:14px}.dl-mk-av{position:relative;box-sizing:border-box;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:500;line-height:1;border:2px solid #8a8a8a;background:var(--dl-elevated);color:var(--dl-fg-muted);transition:box-shadow .2s}.dl-mk.online .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-badge{position:absolute;left:16px;bottom:-6px;height:16px;min-width:16px;padding:0 3px;border-radius:8px;border:2px solid var(--dl-elevated);background:#6b6b6b;color:#fff;display:flex;align-items:center;justify-content:center;gap:1px;font-size:9px;font-weight:600;white-space:nowrap;box-sizing:content-box}.dl-mk.online .dl-mk-badge{background:#3b82f6}.dl-mk-badge-ic{width:10px;height:10px;stroke-width:2.2}.dl-mk-badge:has(>svg:only-child){width:16px;min-width:0;padding:0}.dl-mk-tile{position:relative;width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk.place.online .dl-mk-tile{background:#3b82f6;color:#fff;box-shadow:0 2px 8px #3b82f659}.dl-mk-tile-ic{width:14px;height:14px}.dl-mk-tile-n{position:absolute;right:-5px;top:-5px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dl-fg);color:var(--dl-elevated);font-size:9px;font-weight:600;line-height:14px;text-align:center}.dl-mk-when{display:block;text-align:center;color:var(--dl-fg-faint);font-weight:400}.dl-mk.place.online .dl-mk-when{color:#3b82f6}.dl-mk-tile.sm{width:18px;height:18px;border-radius:5px;font-size:9px;font-weight:600}.dl-dmap{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-dmap .dl-geomap{border-top:0}.dl-dplaces{display:flex;flex-direction:column;margin-top:4px}.dl-dplace-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid var(--dl-line);font-size:13px}.dl-dplace-row:first-child{border-top:0}.dl-dplace-n{flex:0 0 auto;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-dplace-n.live{background:#3b82f6;color:#fff}.dl-dplace-n .dl-icon{width:12px;height:12px}.dl-dplace-now{color:#3b82f6}.dl-dplaces.strips .dl-dplace-row{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr) auto;column-gap:10px;row-gap:9px;margin:0 -10px;padding:11px 10px;border-top:0;border-radius:10px;transition:background .15s}.dl-dplaces.strips .dl-dplace-row+.dl-dplace-row:before{content:"";position:absolute;left:10px;right:10px;top:0;height:1px;background:var(--dl-line)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur){background:var(--dl-soft)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur):before,.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur)+.dl-dplace-row:before{opacity:0}.dl-dplace-strip{grid-column:2 / 4;position:relative;height:6px;border-radius:3px;background:var(--dl-track)}.dl-dplaces.can-replay .dl-dplace-strip{cursor:ew-resize;touch-action:none}.dl-dplace-strip i{position:absolute;top:0;bottom:0;min-width:2px;border-radius:2px;background:#8a8a8a}.dl-dplace-strip.live i{background:#3b82f6}.dl-dplaces.replay .dl-dplace-strip:after{content:"";position:absolute;left:var(--at);top:-4px;bottom:-4px;width:2px;margin-left:-1px;border-radius:1px;background:var(--dl-fg);box-shadow:0 0 0 2px var(--dialog-bg, var(--dl-elevated));pointer-events:none}.dl-dplace-axis{position:relative;height:16px;margin:4px 0 0 30px;font-size:11px;line-height:16px;color:var(--dl-fg-faint)}.dl-dplace-axis span{position:absolute;top:0;transform:translate(-50%);white-space:nowrap}.dl-dmap{position:relative}.dl-map-replay{position:absolute;left:10px;top:10px;z-index:3;display:flex;align-items:center;gap:6px}.dl-map-btn{all:unset;box-sizing:border-box;cursor:pointer;width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg)}.dl-map-btn:hover{background:color-mix(in srgb,var(--dl-fg) 8%,var(--dl-elevated))}.dl-map-btn:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-btn .dl-icon{width:13px;height:13px}.dl-map-chip{display:inline-flex;align-items:center;height:28px;box-sizing:border-box;padding:0 10px;border-radius:8px;font-size:11.5px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg);font-variant-numeric:tabular-nums}.dl-mk.step .dl-mk-tile{transition:width .3s cubic-bezier(.2,.8,.2,1),height .3s cubic-bezier(.2,.8,.2,1),border-radius .3s,background-color .3s,color .3s,box-shadow .3s,transform .24s}.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic{width:11px;height:11px}.dl-mk.step.faded>*{opacity:.5}.dl-mk.step:is(.online,.hl){z-index:2}.dl-mk.step.hl .dl-mk-tile{box-shadow:0 0 0 3px color-mix(in srgb,#3b82f6 55%,transparent)}.dl-mk.step.arrive .dl-mk-tile{animation:dl-mk-arrive .45s cubic-bezier(.2,.8,.2,1)}@keyframes dl-mk-arrive{0%{transform:scale(.8)}55%{transform:scale(1.12)}to{transform:scale(1)}}.dl-mk-when.inline{display:inline}.dl-mk>*{transition:opacity .15s;opacity:var(--dl-mk-fade, 1)}.dl-mk.merged,.dl-mk.piled{pointer-events:none}.dl-mk.dl-mk-new>*{transition:none}.dl-mk.merged>*,.dl-mk.piled>*{opacity:0}.dl-mk-hub{cursor:default}.dl-mk-host{position:relative}.dl-mk-host{transition:border-radius .22s ease,border-right-color .22s ease}.dl-mk-host.docked{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}.dl-mk-dock{position:absolute;left:100%;top:-1px;height:40px;box-sizing:border-box;display:flex;align-items:center;gap:6px;padding:0 10px 0 2px;border:1px solid var(--dl-line);border-left:0;border-radius:0 11px 11px 0;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;pointer-events:none;opacity:0;clip-path:inset(-24px 100% -24px 0);transition:clip-path .28s cubic-bezier(.2,.8,.2,1),opacity .2s ease}.dl-mk-host.docked .dl-mk-dock{pointer-events:auto;opacity:1;clip-path:inset(-24px -24px -24px 0)}.dl-mk-new .dl-mk-host,.dl-mk-new .dl-mk-dock{transition:none}.dl-mk-pile{position:relative;display:flex;justify-content:center}.dl-mk-pile-box{box-sizing:border-box;height:40px;display:flex;align-items:center;gap:6px;padding:0 10px 0 6px;border-radius:20px;cursor:zoom-in;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;animation:dl-plate-in .26s cubic-bezier(.2,.8,.2,1) both;transition:opacity .18s ease,transform .18s ease}.dl-mk-pile.out{pointer-events:none}.dl-mk-pile.out>*{opacity:0;transform:scale(.85);transition:opacity .18s ease,transform .18s ease}@keyframes dl-plate-in{0%{opacity:0;transform:scale(.85)}}.dl-mk-face{all:unset;position:relative;display:flex;cursor:pointer;transition:transform .18s ease,opacity .18s ease}.dl-mk-face>.dl-mk-badge{position:relative;left:auto;bottom:-8px;margin-left:-12px;align-self:center}.dl-mk-face.on .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-face.on .dl-mk-badge{background:#3b82f6}.dl-mk-face:hover .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-face.in{animation:dl-dock-in .24s cubic-bezier(.2,.8,.2,1) both}.dl-mk-face.out{transform:scale(.4);opacity:0;pointer-events:none}@keyframes dl-dock-in{0%{transform:scale(.4);opacity:0}}.dl-mk-more{font-size:11px;font-weight:600;color:var(--dl-fg-muted)}.dl-mk-av,.dl-mk-tile{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1)}.dl-mk.merged .dl-mk-av,.dl-mk.merged .dl-mk-tile,.dl-mk.piled .dl-mk-av{transform:scale(.5)}.dl-mk-host,.dl-mk-dock,.dl-mk-pile-box{transition-property:border-radius,border-right-color,clip-path,opacity,height,width,padding,gap}.dl-mk-dock,.dl-mk-pile-box{transition-duration:.22s;transition-timing-function:cubic-bezier(.2,.8,.2,1)}.dl-mk-pile-box{position:relative}.dl-mk-more{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease}.dl-mk-more.in{animation:dl-dock-in .24s ease both}.dl-mk-more.out{transform:scale(.4);opacity:0}.dl-mk-face .dl-mk-av{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1),width .2s ease,height .2s ease,font-size .2s ease}.dl-mk-face{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,margin .2s ease}.dl-mk-face>.dl-mk-badge{max-width:48px;overflow:hidden;transition:opacity .2s ease,transform .2s ease,max-width .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease,height .22s ease,min-width .22s ease,width .22s ease,bottom .22s ease}.dl-lod-far .dl-mk-host{width:32px;height:32px;border-radius:9px}.dl-lod-far .dl-mk-host.docked{border-radius:9px 0 0 9px}.dl-lod-far .dl-mk-host-tile{width:20px;height:20px;border-radius:6px}.dl-lod-far .dl-mk-host-ic{width:11px;height:11px}.dl-lod-far .dl-mk-dock{height:32px;gap:0;padding:0 4px 0 0;border-radius:0 9px 9px 0}.dl-lod-far .dl-mk-pile-box{height:32px;gap:0;padding:0 4px;border-radius:16px}.dl-lod-far .dl-mk-face+.dl-mk-face{margin-left:-6px}.dl-lod-far .dl-mk-face .dl-mk-av{width:22px;height:22px;font-size:8px;box-shadow:0 0 0 2px var(--dl-elevated)}.dl-lod-far .dl-mk-face>.dl-mk-badge{max-width:0;min-width:0;padding:0;margin-left:0;border-width:0;opacity:0;transform:scale(.5);pointer-events:none}.dl-lod-far .dl-mk-more{margin-left:4px;font-size:10px}.dl-mk-label{transition:opacity .2s ease}.dl-lod-far .dl-mk:not(.step) .dl-mk-label{opacity:0}.dl-lod-mid .dl-mk-host{width:36px;height:36px}.dl-lod-mid .dl-mk-dock,.dl-lod-mid .dl-mk-pile-box{height:36px}.dl-lod-mid .dl-mk-face .dl-mk-av{width:24px;height:24px;font-size:9px}.dl-lod-mid .dl-mk-face>.dl-mk-badge{height:12px;min-width:12px;margin-left:-10px;bottom:-7px}.dl-lod-mid .dl-mk-face>.dl-mk-badge:has(>svg:only-child){width:12px}.dl-lod-mid .dl-mk-face>.dl-mk-badge .dl-mk-badge-ic{width:8px;height:8px}@media(prefers-reduced-motion:reduce){.dl-mk-dock,.dl-mk-pile-box,.dl-mk-face,.dl-mk-av,.dl-mk-tile,.dl-mk.step .dl-mk-tile,.dl-mk-host,.dl-mk-face>.dl-mk-badge{transition:none;animation:none}}.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host{cursor:zoom-in}.dl-mk-ptr{position:absolute;left:50%;top:50%;width:0;height:0;z-index:-1;pointer-events:none}.dl-mk-ptr .line{position:absolute;left:0;top:-.5px;height:1px;background:var(--dl-fg-faint);transform-origin:0 50%}.dl-mk-ptr .spot{position:absolute;left:-3.5px;top:-3.5px;width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid #fff;background:#8a8a8a}.dl-mk.online .dl-mk-ptr .spot,.dl-mk.place.online .dl-mk-ptr .spot{background:#3b82f6}.dl-mk.dim>*{opacity:.18}.dl-mk.hl .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-label{position:absolute;left:50%;bottom:100%;margin-bottom:4px;transform:translate(-50%);white-space:nowrap;pointer-events:none;font-size:10px;line-height:14px;font-weight:500;color:var(--dl-fg)}.dl-mk-label.below{bottom:auto;top:100%;margin:4px 0 0}.dl-mk-label.chip{padding:2px 6px;border-radius:4px;font-size:11px;line-height:16px;font-weight:600;background:color-mix(in srgb,var(--background, var(--dl-card)) 80%,transparent);backdrop-filter:blur(8px)}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{margin:0 10px 10px 0;min-height:28px;padding:0;border-radius:8px;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg-muted);box-shadow:none;font-size:11px;line-height:26px}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show){width:28px;height:28px;box-sizing:border-box}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show{padding:0 32px 0 10px}.dl-geomap .maplibregl-ctrl-attrib a{color:var(--dl-fg-muted)}.dl-geomap .maplibregl-ctrl-attrib-button{top:0;right:0;width:26px;height:26px;margin:0;border-radius:8px;background:none}.dl-geomap .maplibregl-ctrl-attrib-button:after{content:"";position:absolute;inset:5px;background:var(--dl-fg);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat}.dl-geomap .maplibregl-ctrl-attrib-button:focus{outline:none;box-shadow:none}.dl-geomap .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-card{position:absolute;right:12px;top:12px;z-index:3;min-width:200px;max-width:260px;padding:10px 12px;border-radius:10px;font-size:12px;line-height:20px;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));opacity:0;transition:opacity .2s;pointer-events:none}.dl-map-card.on{opacity:1}.dl-map-card-head b{font-weight:500}.dl-map-card-row{display:flex;justify-content:space-between;gap:12px;white-space:nowrap}.dl-popcard{position:fixed;z-index:2100;width:max-content;max-width:300px;padding:12px;border-radius:12px;box-sizing:border-box;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4))}.dl-popcard.away{visibility:hidden}.dl-popcard.leaving{pointer-events:none}.dl-popcard-tip{position:absolute;left:var(--tip-x, 50%);width:10px;height:10px;margin-left:-6px;box-sizing:border-box;background:var(--dl-elevated);border:solid var(--dl-line);transform:rotate(45deg)}.dl-popcard.above .dl-popcard-tip{bottom:-6px;border-width:0 1px 1px 0}.dl-popcard.below .dl-popcard-tip{top:-6px;border-width:1px 0 0 1px}.dl-popcard.above{transform-origin:var(--tip-x, 50%) 100%}.dl-popcard.below{transform-origin:var(--tip-x, 50%) 0}@media(prefers-reduced-motion:no-preference){.dl-popcard{animation:dl-pop-in .16s ease-out}.dl-popcard.leaving{animation:dl-pop-out .14s ease-in forwards}}@keyframes dl-pop-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}@keyframes dl-pop-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.94)}}.dl-pop{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;min-width:210px}.dl-pop-head{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:2px}.dl-pop-net{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-pop-list{display:flex;flex-direction:column;margin:6px 0 0;max-height:116px;overflow-y:auto}.dl-pop-row{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px}.dl-pop-row:hover{background:var(--dl-soft)}.dl-pop-row:focus{outline:none}.dl-pop-row:focus-visible{outline:2px solid var(--dl-ring)}.dl-pop-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-pop-name b{font-weight:500}.dl-pop-dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-pop-dot.on{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-pop-actions{display:flex;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--dl-line)}.dl-pop-actions .cbi-button{flex:1;height:28px!important;font-size:12px!important;justify-content:center}.dl-chartbox{position:relative}.dl-bars{display:flex;align-items:flex-end;gap:4px;border-bottom:1px solid var(--dl-line)}.dl-bar{flex:1;height:100%;display:flex;flex-direction:column-reverse;gap:1px;cursor:default;min-width:3px}.dl-bar i{display:block;border-radius:3px 3px 0 0}.dl-bar i.down{background:var(--dl-chart-1)}.dl-bar i.up{background:var(--dl-chart-2);opacity:.75;border-radius:3px 3px 0 0}.dl-bar:hover i{filter:brightness(1.25)}.dl-bar.empty{background:linear-gradient(to top,var(--dl-line) 2px,transparent 2px)}.dl-tip{position:absolute;top:-8px;transform:translate(-50%,-100%);padding:8px 10px;border-radius:10px;font-size:12px;line-height:18px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));pointer-events:none;z-index:3}.dl-tip-title{font-weight:500}.dl-tip-float{position:fixed;z-index:2000;color:var(--dl-fg)}.dl-spark i:hover{opacity:1;filter:brightness(1.25)}.dl-meter,.dl-slots{cursor:default}.dl-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--dl-fg-faint);margin-top:6px}.dl-legend i.down{background:var(--dl-chart-1)}.dl-legend i.up{background:var(--dl-chart-2)}.dl-spark{display:flex;align-items:flex-end;gap:2px;flex:0 0 auto}.dl-spark i{flex:1;display:block;border-radius:2px 2px 0 0;background:var(--dl-chart-1);opacity:.85}.dl-spark i.zero{opacity:.22}`;var di=`.dl-row{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-row.link{color:inherit;text-decoration:none}.dl-row.link:hover{background:var(--dl-soft)}.dl-row-main{flex:1;min-width:0;overflow-wrap:anywhere}.dl-row-main b{font-weight:500}.dl-attn{display:flex;flex-direction:column;gap:10px;padding:16px;border-top:1px solid var(--dl-line)}.dl-attn-item{display:flex;gap:10px;align-items:baseline;font-size:13px;color:var(--dl-fg-muted)}.dl-avatar.sm{width:26px;height:26px;font-size:10px;margin:0}.dl-avatar.lg{width:48px;height:48px;font-size:15px;margin:0}.dl-avatar.lg.online:after{width:12px;height:12px}.dl-list{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-list>.dl-row:first-child{border-top:0}.dl-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-row-main.dl-stack{min-width:0}.dl-person-id{display:flex;align-items:center;gap:14px;min-width:0}.dl-grid-person{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:16px;align-items:start}@media(max-width:1000px){.dl-grid-person{grid-template-columns:minmax(0,1fr)}}.dl-devsec{display:flex;flex-direction:column;gap:12px}.dl-devsec .dl-panel-head{margin:0}.dl-dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dl-dcard>.dl-dcard-head+*{margin-top:auto}@media(max-width:700px){.dl-dgrid{grid-template-columns:minmax(0,1fr)}}.dl-dgrid>.dl-dslot.add:only-child{grid-column:1 / -1}.dl-dcard{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:12px;min-width:0;box-shadow:var(--dl-shadow)}.dl-dcard.online{border-color:color-mix(in srgb,var(--dl-ok) 35%,transparent)}.dl-dcard.off{opacity:.7}.dl-dcard-head{display:flex;align-items:center;gap:12px}.dl-dcard-ic{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dcard-ic .dl-icon{width:20px;height:20px}.dl-dcard.online .dl-dcard-ic{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-dcard-title{all:unset;cursor:pointer;flex:1;min-width:0;display:flex;flex-direction:column}.dl-dcard-title b{font-weight:500;font-size:15px}.dl-dstat{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;min-width:0}.dl-dstat i.dot{flex:none}.dl-dstat.ok{color:var(--dl-ok)}.dl-dstat.warn{color:var(--dl-warn)}.dl-dstat i.dot,.dl-savebar i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint)}.dl-dstat i.dot.ok{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-dstat i.dot.warn{background:var(--dl-warn)}.dl-dcard-use{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.dl-dcard-foot{padding-top:10px;border-top:1px solid var(--dl-line);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-dslot.add{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;min-height:0;border:1px dashed color-mix(in srgb,currentColor 18%,transparent);border-radius:14px;text-align:center;color:var(--dl-fg-muted);transition:background .15s,border-color .15s,color .15s}.dl-dslot.add .dl-stack{align-items:center}.dl-dslot.add:hover{border-color:color-mix(in srgb,currentColor 35%,transparent);color:var(--dl-fg)}.dl-dslot.add:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-dslot.add b{font-weight:500}.dl-dslot.add:hover{background:var(--dl-soft)}.dl-dslot-ic{width:36px;height:36px;border-radius:999px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dslot.add:hover .dl-dslot-ic{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-tiles2{display:grid;gap:10px;margin-top:16px}.dl-tile2{border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;min-width:0}.dl-tile2-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile2-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.dl-tile2-value{font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums}.dl-tile2-value .dl-faint{font-size:14px;font-weight:400}.dl-tile2-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-stepper{display:inline-flex;align-items:stretch;height:32px;border:1px solid var(--input, var(--dl-line));border-radius:8px;overflow:hidden}.dl-stepper button{all:unset;cursor:pointer;width:32px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;color:var(--dl-fg)}.dl-stepper button:hover{background:var(--dl-soft)}.dl-stepper button[disabled]{opacity:.35;cursor:not-allowed}.dl-stepper+.dl-stepper{margin-left:4px}.dl-step-select{border:0!important;border-left:1px solid var(--input, var(--dl-line))!important;border-right:1px solid var(--input, var(--dl-line))!important;border-radius:0!important;background:transparent!important;color:inherit;font:500 13px inherit;padding:0 10px!important;height:100%!important;min-width:0!important}.dl-slots{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}.dl-slots i{height:4px;border-radius:999px;background:var(--dl-track);display:block}.dl-slots i.used{background:var(--dl-fg)}.dl-slots i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-date{display:flex;align-items:center;gap:8px;flex:1 1 150px;min-width:0;box-sizing:border-box;height:34px;padding:0 10px;border:1px solid var(--input, var(--dl-line));border-radius:8px;color:var(--dl-fg-faint)}.dl-date input{border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important;height:32px!important;color:var(--dl-fg);flex:1;min-width:0!important;width:100%!important}.dl-meter{position:relative;height:6px;border-radius:999px;background:var(--dl-track)}.dl-meter>i{display:block;height:100%;border-radius:999px;background:var(--dl-accent)}.dl-meter.warn>i{background:var(--dl-warn)}.dl-meter.bad>i{background:var(--dl-bad)}.dl-meter .mark{position:absolute;left:90%;top:-3px;width:1px;height:12px;background:var(--dl-warn)}.dl-meter.sm{height:4px}.dl-chips-row{display:flex;flex-wrap:wrap;gap:4px}.dl-chipbtn{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-chipbtn:hover{background:var(--dl-soft-hover)}.dl-chipbtn.on{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-switch{all:unset;cursor:pointer;position:relative;width:32px;height:20px;border-radius:999px;background:var(--switch-off, var(--dl-track));flex:0 0 auto;transition:background .15s}.dl-switch i{position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 2px #0000004d}.dl-switch.on{background:var(--dl-accent)}.dl-switch.on i{left:14px}.dl-switch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-linkbox{display:flex;align-items:center;gap:8px;height:36px;padding:0 4px 0 12px;border:1px solid var(--input, var(--dl-line));border-radius:8px;background:var(--input-bg, transparent)}.dl-linkbox .dl-mono{flex:1;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dl-fg-muted)}.dl-linkbox .cbi-button{height:28px!important}.dl-pcard{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:stretch;min-width:0}.dl-pcard-main{min-width:0}.dl-pcard-top{display:flex;align-items:center;gap:12px;min-width:0}.dl-pcard-top .dl-avatar{margin-right:0}.dl-pcard-who{flex:1;min-width:0}.dl-pcard-who .dl-slotbar{margin:3px 0 0}.dl-pside{display:flex;flex-direction:column;justify-content:space-between;gap:8px;padding-left:20px;border-left:1px solid var(--dl-line);min-width:0}.dl-pside-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.dl-pside-state{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dl-fg-muted)}.dl-pside-state.live{color:var(--dl-ok)}.dl-pside-foot{font-size:12px}.dl-pside .dl-use-num b{font-size:20px}.dl-none{display:none!important}.dl-pcard-actions{display:flex;gap:6px;flex:0 0 auto}.dl-pcard-actions .cbi-button{height:32px!important}.dl-icon-only .dl-btn-label{display:none}.dl-pill-ic{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill-ic .dl-icon{width:12px;height:12px}.dl-pill-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-use-num{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.dl-use-num b{font-size:15px;font-weight:500}.dl-use-live{display:flex;align-items:center;gap:8px;font-size:12px;font-variant-numeric:tabular-nums}.dl-usebar{display:flex;gap:2px;height:6px;border-radius:999px;overflow:hidden;background:var(--dl-track)}.dl-usebar i{display:block;height:100%;min-width:3px;flex:0 1 0}.dl-usebar i.fill{flex:none;min-width:0;border-radius:999px;background:var(--dl-accent)}.dl-usebar.warn i.fill{background:var(--dl-warn)}.dl-usebar.bad i.fill{background:var(--dl-bad)}.dl-usebar .c0,.dl-swatch.c0{background:var(--dl-chart-1)}.dl-usebar .c1,.dl-swatch.c1{background:#8b7cf6}.dl-usebar .c2,.dl-swatch.c2{background:#2fb889}.dl-usebar .c3,.dl-swatch.c3{background:#d9a03f}.dl-usebar .c4,.dl-swatch.c4{background:var(--dl-fg-faint)}.dl-tip-row{display:flex;align-items:center;gap:8px;min-width:160px}.dl-tip-row b{margin-left:auto;font-weight:500}.dl-swatch{width:8px;height:8px;border-radius:2px;flex:none}.dl-card-name{color:var(--dl-fg)!important;text-decoration:none}.dl-card-name:hover{text-decoration:underline}.dl-chip-tag{font-size:11px;line-height:18px;padding:0 6px;border-radius:999px;background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-chip.live{background:var(--dl-ok-wash);color:color-mix(in srgb,var(--dl-ok) 35%,var(--dl-fg))}.dl-chip.live:hover{background:color-mix(in srgb,var(--dl-ok) 22%,transparent)}.dl-chip.live .dl-icon{color:var(--dl-ok)}.dl-fixes{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 0 44px}.dl-fix{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-info-wash);color:var(--dl-info);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-fix:hover{filter:brightness(1.15)}@media(max-width:760px){.dl-pcard{grid-template-columns:1fr}.dl-pside{padding:12px 0 0;border-left:0;border-top:1px solid var(--dl-line)}.dl-fixes{margin-left:0}}.dl-select{height:34px!important;border-radius:999px!important;min-width:136px!important;width:auto!important;padding:0 34px 0 14px!important;appearance:none!important;-webkit-appearance:none!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 12px center!important;background-size:14px!important}.dl-savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160%);opacity:0;transition:transform .25s cubic-bezier(.2,.8,.2,1),opacity .2s;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:999px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, 0 16px 32px -8px rgba(0,0,0,.5));z-index:60;pointer-events:none}.dl-savebar.show{transform:translate(-50%);opacity:1;pointer-events:auto}.dl-savebar-text{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500}`;var ci=".dl-toast strong{display:block;font-weight:500}.dl-toast div{opacity:.8;font-size:13px}.dl-drawer-overlay{position:fixed;inset:0;z-index:900;display:flex;justify-content:flex-end;background:transparent;transition:background .2s}.dl-drawer-overlay.open{background:var(--scrim, rgba(0,0,0,.45))}.dl-drawer{width:min(520px,100%);height:100%;display:flex;flex-direction:column;background:var(--dialog-bg, var(--dl-elevated));color:var(--dl-fg);border-left:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, -16px 0 32px -8px rgba(0,0,0,.5));transform:translate(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1)}.dl-drawer-overlay.open .dl-drawer{transform:none}.dl-drawer-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--dl-line)}.dl-drawer-title{flex:1;min-width:0;display:flex;align-items:center;gap:12px}.dl-drawer-title h3{margin:0!important;padding:0!important;border:0!important;font-size:18px!important;line-height:26px;font-weight:500!important}.dl-drawer-x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted)}.dl-drawer-x:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-drawer-body{flex:1;overflow:auto;padding:20px}.dl-drawer-foot{padding:12px 20px;border-top:1px solid var(--dl-line)}.dl-drawer-actions{display:flex;align-items:center;gap:8px}.dl-dcard-ic.on{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-icon-only.sm{width:28px;height:28px!important}.dl-stack.gap12{gap:12px}.dl-stack.gap16{gap:16px}.dl-dstats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--dl-line);border-radius:14px;overflow:hidden}.dl-dstats-cell{display:flex;flex-direction:column;gap:4px;padding:12px 14px;min-width:0}.dl-dstats-cell.wide{grid-column:span 2;border-bottom:1px solid var(--dl-line)}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:1px solid var(--dl-line)}.dl-dstats-cell b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dstats-cell .dl-dstat{font-size:14px}.dl-dsec{border:1px solid var(--dl-line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.dl-dsec-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-dsec-head h4{margin:0!important;padding:0!important;font-size:14px!important;font-weight:500!important;border:0!important}.dl-dstat i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);display:inline-block}.dl-connect-body{min-height:60px}.dl-connect-body .dl-qr{width:min(240px,70vw)}.dl-kv2{display:flex;flex-direction:column}.dl-kvrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 0;border-top:1px solid var(--dl-line);font-size:13px;min-width:0}.dl-kvrow:first-child{border-top:0;padding-top:0}.dl-kvrow-k{color:var(--dl-fg-muted);flex:0 0 auto}.dl-kvrow-v{min-width:0;text-align:right;overflow-wrap:anywhere}.dl-kvrow-v.copy{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--dl-fg)}.dl-kvrow-v.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-kvrow-v.copy .dl-icon{width:13px;height:13px;color:var(--dl-fg-faint)}.dl-kvrow-v.copy:hover .dl-icon{color:var(--dl-fg)}@media(max-width:560px){.dl-drawer{width:100%}.dl-dstats{grid-template-columns:minmax(0,1fr)}.dl-dstats-cell.wide{grid-column:auto}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:0;border-top:1px solid var(--dl-line)}}.dl-dev-log{display:flex;flex-direction:column}.dl-dev-log-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--dl-line);font-size:13px;line-height:20px;min-width:0}.dl-dev-log-row:first-child{border-top:0;padding-top:0}.dl-dev-log-row .dl-row-main{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";var pi=".dl-settings-main{min-width:0;display:flex;flex-direction:column;gap:20px}.dl-setsec{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);overflow:hidden;scroll-margin-top:88px;box-shadow:var(--dl-shadow)}.dl-setsec-body{padding:20px;display:flex;flex-direction:column;gap:14px}.dl-setsec-body h3{margin:0!important;padding:0!important;font-size:18px!important;line-height:26px;font-weight:500!important;border:0!important}.dl-setsec-body p{margin:0}.dl-setsec-head{display:flex;align-items:center;gap:10px}.dl-group{border:1px solid var(--dl-line);border-radius:14px;padding:2px 16px}.dl-group-head{display:flex;align-items:center;gap:12px;padding:14px 0 10px}.dl-group-head b{font-size:15px;font-weight:500}.dl-group-ic{width:32px;height:32px;border-radius:10px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-group-ic .dl-icon-wrap{display:inline-flex}.dl-group-ic .dl-icon{width:16px;height:16px}.dl-group-body>*{padding:12px 0;margin:0!important}.dl-group-body>*+*:not(.alert-message):not(.dl-params){border-top:1px solid var(--dl-line)}.dl-group-body>.alert-message,.dl-group-body>.dl-params{margin:12px 0!important}.dl-group-body>.alert-message{padding:10px 14px}.dl-group-body>.dl-params{padding:0}.dl-group-body>.alert-message+*,.dl-group-body>.dl-params+*{border-top:0}.dl-group-body>.dl-row{border-left:0;border-right:0;border-bottom:0;padding-left:0;padding-right:0;background:none}.dl-group-body>.dl-row:first-child{border-top:0}.dl-setsec-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 20px;border-top:1px solid var(--dl-line);background:var(--dl-soft)}.dl-setsec.danger{border-color:color-mix(in srgb,var(--dl-bad) 40%,transparent)}.dl-setsec.danger .dl-setsec-foot{background:color-mix(in srgb,var(--dl-bad) 6%,transparent)}.dl-setrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:center;gap:8px 24px}.dl-setrow.head{display:flex;justify-content:space-between;gap:16px}.dl-setrow-label{font-size:14px;font-weight:500}.dl-setrow-ctl{display:flex;justify-content:flex-end;min-width:0}.dl-setrow-ctl .dl-chips-row{justify-content:flex-end}.dl-setrow-ctl>input{width:100%}.dl-hostport{display:flex;align-items:center;gap:8px;flex:1;min-width:0;justify-content:flex-end}.dl-hostport input{flex:1;min-width:0}.dl-root input.dl-w-port,.dl-hostport input.dl-w-port{flex:0 0 90px;width:90px}.dl-root input.dl-w-range{flex:0 0 130px;width:130px}.dl-setrow .dl-sub.bad{color:var(--dl-bad)}.dl-suffixed{display:inline-flex;align-items:center;gap:6px}.dl-suffixed>span{color:var(--dl-fg-muted)}.dl-more summary{cursor:pointer;color:var(--dl-fg-muted);font-size:13px;margin-bottom:10px}.dl-more .dl-setrow+.dl-setrow{margin-top:10px}@media(max-width:760px){.dl-setrow:not(.head){grid-template-columns:minmax(0,1fr)}.dl-setrow-ctl,.dl-setrow-ctl .dl-chips-row{justify-content:flex-start}}.dl-need-ic{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-need-ic .dl-icon-wrap{display:inline-flex}.dl-need-ic .dl-icon{width:15px;height:15px}.dl-need-row.bad .dl-need-ic,.dl-need-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-need-row.warn .dl-need-ic,.dl-need-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-need-ic.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-lh-main{display:flex;align-items:flex-start;gap:12px;min-width:0}.dl-lh-main>.dl-need-ic{margin-top:1px}.dl-sub .dl-mono{font-size:.92em}.dl-need-row>.cbi-button{flex:none}.dl-bk-row .dl-group-ic{width:30px;height:30px}.dl-bk-older>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:11px 16px;border-top:1px solid var(--dl-line);font-size:13px;color:var(--dl-fg-muted);user-select:none}.dl-bk-older>summary::-webkit-details-marker{display:none}.dl-bk-older>summary:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-bk-older>summary .dl-icon-wrap{display:inline-flex;transition:transform .15s}.dl-bk-older>summary .dl-icon{width:14px;height:14px}.dl-bk-older[open]>summary .dl-icon-wrap{transform:rotate(90deg)}#dl-set-backups .dl-setsec-head h3+.dl-sub{margin-top:2px}#dl-set-backups .dl-setsec-foot>.dl-sub{flex:1 1 260px}.dl-bk-actions{flex:0 1 auto;justify-content:flex-end}@media(max-width:640px){#dl-set-backups .dl-setsec-foot>.dl-sub{flex-basis:100%}.dl-bk-actions{justify-content:flex-start}}.dl-upd{display:flex;flex-direction:column;gap:16px}.dl-upd>.dl-pagehead{margin:0 0 4px}.dl-upd-bad{color:var(--dl-bad)}";var mi=".dl-comp-hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.dl-comp-hero-main{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}.dl-comp-hero-side{padding:20px;border-left:1px solid var(--dl-line);display:flex;flex-direction:column;gap:14px;min-width:0}.dl-comp-name{font-size:16px;font-weight:500}.dl-comp-hero-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.dl-comp-hero-head .dl-spacer{flex:1}.dl-comp-big{font-family:var(--dl-mono);font-size:26px;line-height:34px;letter-spacing:-.02em;display:flex;align-items:baseline;gap:10px}.dl-comp-big small{font-size:14px;color:var(--dl-accent)}.dl-comp-big small.dl-faint{color:var(--dl-fg-faint)}.dl-comp-verrow{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;min-width:0}.dl-comp-verrow .dl-spacer{flex:1}.dl-comp-meta{font-size:13px}.dl-comp-bullets{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;color:var(--dl-fg-muted);font-size:13px}.dl-comp-bullets li{list-style:disc}.dl-comp-lead{margin:0}.dl-comp-more{align-self:flex-start;font-size:12px;color:var(--dl-fg-faint);margin-left:18px;padding:0!important}.dl-comp-more:hover{color:var(--dl-accent);background:none!important;text-decoration:underline;text-underline-offset:2px}.dl-comp-hero-main>.dl-comp-vers{margin-top:auto}.dl-comp-btns{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;flex:none}.dl-comp-side-v{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0;flex-wrap:wrap}.dl-comp-side-v .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-comp-side-v a{color:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-side-v a:hover{color:var(--dl-accent)}.dl-comp-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:16px;align-items:start}.dl-comp-cols>.dl-panel>div>.dl-row:first-child{border-top:1px solid var(--dl-line)}.dl-comp-count{font-size:13px}.dl-comp-sub{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-ic{display:inline-flex;gap:4px;flex:none}.dl-comp-ic .cbi-button{width:30px;height:30px;padding:0!important;justify-content:center;border-radius:999px!important}.dl-comp-ic .dl-btn-label{display:none}.dl-comp-ic .dl-icon{width:14px;height:14px}.dl-comp-ic .is-busy{pointer-events:none;opacity:.5}.dl-comp-ic .cbi-button.dl-comp-check{width:auto;padding:0 12px 0 10px!important;gap:6px;display:inline-flex;align-items:center;font-size:13px}.dl-row>.dl-pill,.dl-row>.cbi-button,.dl-row>.dl-comp-ic{flex:none}button.dl-pill.dl-comp-run{all:unset;display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:12px;cursor:pointer;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-comp-foldwrap{padding:0 16px 14px 60px}.dl-comp-fold .dl-params-body{gap:12px}.dl-comp-fold .dl-list>.dl-row{padding:10px 14px}.dl-comp-bver{font-size:12px;width:130px;text-align:right;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-bact{width:84px;flex:none;display:flex;justify-content:flex-end}.dl-comp-warn{display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:18px;color:var(--dl-fg-muted)}.dl-comp-warn .dl-icon-wrap{display:inline-flex;flex:none;margin-top:2px}.dl-comp-warn .dl-icon{width:14px;height:14px;color:var(--dl-warn)}.dl-comp-empty{margin:0;padding:4px 16px 16px}@media(max-width:760px){.dl-comp-hero,.dl-comp-cols{grid-template-columns:minmax(0,1fr)}.dl-comp-hero-side{border-left:0;border-top:1px solid var(--dl-line)}.dl-comp-foldwrap{padding-left:16px}.dl-comp-bver{display:none}}.dl-comp-status{display:flex;align-items:center;gap:8px;font-size:13px;padding:9px 12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-comp-status>.dl-icon-wrap{display:inline-flex;flex:none}.dl-comp-status .dl-icon{width:15px;height:15px}.dl-comp-status.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-comp-status.acc{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-comp-status.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-comp-status.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-comp-status b{font-weight:600}.dl-comp-vers .dl-params-body{gap:0;padding:4px 14px 12px}.dl-comp-tag{display:flex;gap:6px;padding:6px 0 10px}.dl-comp-tag input{flex:1;min-width:0}.dl-comp-ver{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--dl-line);font-size:13px}.dl-comp-ver .dl-mono{min-width:52px}.dl-comp-ver .dl-sub{flex:1}.dl-comp-ver .cbi-button:not(.dl-icon-btn){height:26px!important;font-size:12px!important}.dl-comp-pager{display:flex;align-items:center;justify-content:space-between;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-comp-pager .dl-linkbtn[disabled]{opacity:.4;cursor:default}.dl-comp-vers .dl-loading,.dl-comp-vers .dl-params-body>p{padding:6px 0 10px}.dl-op-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}.dl-op-head .dl-spacer{flex:1}.dl-op-timer{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}.dl-op-timer .dl-icon,.dl-op-head .dl-linkbtn .dl-icon{width:14px;height:14px}.dl-op-loghead{display:flex;align-items:center;justify-content:space-between}.dl-op-loghead b{font-weight:500;font-size:13px}.dl-op .dl-log{max-height:16em;min-height:12em;margin-top:8px}.dl-op .dl-comp-status{margin:14px 0 0}.dl-op-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;width:100%}.dl-notes{max-height:55vh;overflow:auto;border-radius:12px;background:var(--dl-soft);padding:14px 16px;font-size:13px;line-height:20px;overflow-wrap:anywhere}.dl-notes h5{margin:10px 0 6px;font-size:14px;font-weight:500}.dl-notes h5:first-child{margin-top:0}.dl-notes p{margin:0 0 8px}.dl-notes ul{margin:0 0 10px;padding-left:18px}.dl-notes li{list-style:disc}.dl-notes code{font-family:var(--dl-mono);font-size:12px;padding:1px 5px;border-radius:6px;background:var(--dl-soft-hover)}.dl-notes pre{font-family:var(--dl-mono);font-size:12px;padding:10px;border-radius:8px;background:var(--dl-soft-hover);white-space:pre-wrap;margin:0 0 10px}.dl-notes a{color:var(--dl-accent)}";var hi=".dl-chip.static{cursor:default}.dl-chip.static:hover{background:var(--dl-soft)}.dl-chip.static .dl-chip-name{font-weight:500}.dl-setrow.head .dl-chips-row{margin-top:8px}.dl-setrow.head>.dl-lh-main,.dl-setrow.head>.dl-lh-main>.dl-stack{flex:1 1 auto;min-width:0}.dl-setrow.head>.dl-setrow-ctl:empty{display:none}.dl-setrow.head:has(>.dl-lh-main){align-items:flex-start}.dl-setrow.head>.dl-setrow-ctl{align-items:center;min-height:30px}.dl-netpick{margin-top:10px}.dl-boxrow{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:10px 14px;border:1px solid var(--dl-line);border-radius:12px;font-size:13px;cursor:pointer}.dl-boxrow>.dl-switch{flex:none}.dl-ifpick{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--dl-line);border-radius:14px}.dl-iflead-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-host-ports{justify-content:flex-end}@media(max-width:760px){.dl-host-ports{justify-content:flex-start}}.dl-circle-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}.dl-circles .dl-chip b{font-weight:500}.dl-circle-name{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:500}.dl-w400{font-weight:400}.dl-swatches{display:flex;flex-wrap:wrap;gap:8px}.dl-swatch{all:unset;cursor:pointer;width:22px;height:22px;border-radius:50%;background:var(--sw);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dl-fg) 12%,transparent)}.dl-swatch.on{box-shadow:0 0 0 2px var(--dl-card),0 0 0 4px var(--sw)}.dl-swatch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:3px}.dl-circle-modal .dl-chipbtn b{margin-left:6px;font-weight:500;font-size:11px;opacity:.6}.dl-reach td:first-child b{font-weight:500}.dl-ev-host{white-space:nowrap}.dl-ev-host b{font-weight:500;color:var(--dl-fg)}.dl-reach{font-size:13px}.dl-reach th,.dl-reach td{white-space:nowrap;padding-left:6px;padding-right:6px}.dl-reach-wrap{overflow-x:auto}.dl-yes{display:inline-flex;align-items:center;gap:4px;color:var(--dl-ok)}.dl-yes .dl-icon-wrap{display:inline-flex}.dl-yes .dl-icon{width:14px;height:14px}.dl-check-form{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto;align-items:start;gap:8px}.dl-check-form>.dl-faint{line-height:36px}.dl-check-end{display:flex;flex-direction:column;gap:6px;min-width:0}.dl-check-end>*{width:100%!important;min-width:0}@media(max-width:560px){.dl-check-form{grid-template-columns:minmax(0,1fr)}.dl-check-form>.dl-faint{display:none}}.dl-verdict{display:flex;align-items:baseline;gap:10px;padding:10px 12px;border-radius:12px}.dl-verdict b{font-weight:500}.dl-verdict.ok{background:var(--dl-ok-wash)}.dl-verdict.ok b{color:var(--dl-ok)}.dl-verdict.bad{background:var(--dl-bad-wash)}.dl-verdict.bad b{color:var(--dl-bad)}.dl-corehead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 4px}.dl-corehead h3{margin:0!important}.dl-row-end{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dl-dcard.clickable{cursor:pointer}.dl-dcard.clickable:hover{border-color:color-mix(in srgb,var(--dl-fg) 22%,transparent)}";var El=[Xa,ei,ti,ni,oi,ri,ai,ii,si,li,di,ci,pi,mi,hi].join(` -`);function fi(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=El,n}function ht(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async o=>{let a=await e.render(o),i=document.createElement("div");return i.className="dl-root",i.append(fi(),a),i},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var C1=ht(Yt),E1=ht(mt),L1=ht(Yt),M1=ht(zn),S1=ht(In),T1=ht(Un),_1=ht(Rn);function gi(n){return()=>({load:()=>(ui.menu?.flushCache(),location.replace(`${L.url("admin/network/dawnline/diagnostics")}${n?`?tab=${n}`:""}`),new Promise(()=>{})),render:()=>document.createElement("div"),handleSave:null,handleSaveApply:null,handleReset:null})}var P1=gi(""),D1=gi("log");return baseclass.extend({ activity: D1, diagnostics: T1, health: P1, overview: C1, people: E1, person: S1, server: L1, settings: M1, updates: _1 }); +`).trim()}async function sn(n,e,o,s){let r=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},_("Loading release notes…"))),a=t("div",{class:"dl-op-head"}),i="";de(o,[a,r],[A([v("copy")," ",_("Copy")],()=>xe(i,_("Release notes copied")))," ",ue(_("Close"))],"wide");try{let l=await N.updatesNotes(n,e,s??"");i=Kr(l.body||"");let d=qr(l.url);dom.content(a,[l.published?t("span",{class:"dl-pill"},Oe(l.published)):"",l.prerelease?t("span",{class:"dl-pill warn"},_("Pre-release")):"",t("span",{class:"dl-spacer"}),d?t("a",{href:d,target:"_blank",rel:"noopener",class:"dl-linkbtn"},[_("On GitHub")," ",v("open")]):""]),dom.content(r,i.trim()?Fr(i):t("p",{class:"dl-muted"},_("This release has no notes.")))}catch(l){dom.content(r,t("p",{class:"dl-muted"},Ce(l)))}}function yl(n){let e={"6h":_("checks every 6 h"),"12h":_("checks every 12 h"),"1d":_("checks daily"),"7d":_("checks weekly")};return e[n]??e["1d"]}var Ro=n=>n?Oe(n):"";function kl(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Vr(n,e){let o=n.st,s=o.policy,r=o.kept?.app,a=e?.update&&e.tag?e.tag:o.version,i=k=>()=>sn("app",k,m(_("What’s new in Dawnline %s"),k.replace(/^v/,""))),l=e?.tag&&(e.update||e.status==="latest")?_l(n,e.tag,e.update?o.version:""):null,d=e?.tag??a,c=s.check&&o.auto?.check?o.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[s.interval]??24)*3600:0,p=(k,M)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},k),t("span",{class:"dl-comp-side-v"},M)]),u=[{label:_("What’s new"),ic:"file",run:i(a)},{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${o.repo}`,"_blank","noopener")},null,{label:m(_("Reinstall %s"),o.version),ic:"reset",warn:!0,run:()=>n.op("app:reinstall",_("Reinstalling Dawnline"),o.version)},r?{label:m(_("Roll back to %s"),r.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back to Dawnline %s?"),r.version),m(_("The copy kept on the router replaces %s. A backup of the settings is made first."),o.version),_("Roll back"))&&n.op("app:rollback",_("Rolling back Dawnline"),o.version)}}:null];return t("section",{class:"dl-panel flush dl-comp-hero"},[t("div",{class:"dl-comp-hero-main"},[t("div",{class:"dl-comp-hero-head"},[t("span",{class:"dl-group-ic"},v("sunrise")),t("b",{class:"dl-comp-name"},"Dawnline"),n.state("app",e,e?.latest??""),t("span",{class:"dl-spacer"}),n.round(()=>n.op("check:app",_("Checking Dawnline"),o.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[o.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},m(_("release %s"),e.latest)):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?m(_("released %s"),Ro(e.published)):"":e?.status==="dev"?_("ahead of the latest release"):e?[_("latest release"),e.published?m(_("released %s"),Ro(e.published)):""].filter(Boolean).join(" · "):_("not checked yet"))])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(k=>t("li",{},k))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:i(d)},W(l.total-l.items.length,"+%s more in What’s new","+%s more in What’s new")):""]):"",e?.error?t("p",{class:"dl-sub dl-comp-lead dl-upd-bad"},e.error):"",e?.update?t("div",{class:"dl-comp-btns"},[A(_("Update now"),()=>n.op("app",_("Updating Dawnline"),o.version),"positive",{disabled:n.busy}),A(_("What’s new"),i(a))]):"",Ll(n),Cl(n)]),t("div",{class:"dl-comp-hero-side"},[p(_("Source"),[v("globe"),t("a",{href:`https://github.com/${o.repo}`,target:"_blank",rel:"noopener"},o.repo)]),p(_("Auto-update"),[s.auto?Pe("ok",_("On")):Pe("",_("Off")),t("span",{class:"dl-muted"},s.auto?s.mode==="immediate"?_("as soon as found"):m(s.interval==="7d"?_("weekly at %s"):_("daily at %s"),s.time):s.check?yl(s.interval):_("checks off"))]),p(_("Last check"),o.check?[pe(o.check.time,o.now),c>o.now?t("span",{class:"dl-faint"},`· ${m(_("next in %s"),ot(c-o.now))}`):""]:[_("Never")]),p(_("Rollback"),r?[t("span",{class:"dl-mono"},r.version),t("span",{class:"dl-faint"},_("kept on flash"))]:[t("span",{class:"dl-muted"},s.keep?_("Kept after the next update"):_("Off"))])])])}function _l(n,e,o){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let s=r=>r.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(a,i)=>i??"").trim();return(async()=>{let a=((await N.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(` +`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);a.length||(a=(await N.updatesChanges(o,e).catch(()=>null))?.items??[]);let i={items:a.slice(0,3).map(l=>kl(s(l))),total:a.length};n.notes.set(e,i),i.items.length&&n.root.isConnected&&n.paint()})(),null}function jn(n){return n==="ru"?_("Russian translation"):n}function Cl(n){let e=(n.st.translations??[]).includes("ru"),o=ye(e,jn("ru"),r=>{n.op(r?"app:lang:ru":"app:nolang",r?_("Adding the Russian translation"):_("Removing the Russian translation"),n.st.version)});o.disabled=n.busy;let s=t("details",{class:"dl-params dl-comp-fold",open:n.langOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Translation")),t("span",{class:"dl-sub"},e?_("Russian"):_("English only"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},jn("ru")),t("span",{class:"dl-sub"},_("LuCI pages for Dawnline"))]),t("span",{class:"dl-comp-bact"},o)])])])]);return s.addEventListener("toggle",()=>n.langOpen=s.open),s}function Ll(n){let e=t("div",{class:"dl-params-body"}),o=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Versions")),t("span",{class:"dl-sub"},_("install any release"))]),e]);return o.addEventListener("toggle",()=>{n.versOpen=o.open,n.versOpen&&Un(n,e)}),n.versOpen&&Un(n,e),o}async function Un(n,e){let o=he("",{placeholder:_("Tag, e.g. 0.3.1"),class:"cbi-input-text dl-mono","aria-label":_("Release tag")}),s=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return q(_("Enter a release tag like 0.3.1"),"warning");Yr(n,p)};o.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),s(o.value))});let r=t("div",{class:"dl-comp-tag"},[o,A(_("Install"),()=>s(o.value),"neutral",{disabled:n.busy})]),a=n.versPage,i=p=>{n.versPage=Math.max(1,n.versPage+p),Un(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:a<=1?"disabled":null,click:()=>i(-1)},_("← Newer")),t("span",{class:"dl-faint"},m(_("Page %s"),a)),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>i(1)},_("Older →"))]),d=n.versCache.get(a);if(!d){dom.content(e,[r,t("p",{class:"dl-muted dl-loading"},_("Loading versions…"))]);try{d=(await N.updatesReleases(a)).releases}catch(p){if(a!==n.versPage||!e.isConnected)return;dom.content(e,[r,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},m(_("Failed to load versions: %s"),Ce(p))),A(_("Try again"),()=>Un(n,e))]),l(!1)]);return}if(n.versCache.set(a,d),a!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[r,t("p",{class:"dl-muted"},a>1?_("No more versions."):_("No versions found.")),l(!1)]);let c=n.st.version;dom.content(e,[r,...d.map(p=>{let u=p.tag.replace(/^v/,"");return t("div",{class:"dl-comp-ver"},[t("span",{class:"dl-mono"},u),t("span",{class:"dl-sub"},Ro(p.published)),p.prerelease?Pe("warn",_("Pre-release")):"",t("span",{class:"dl-comp-ic"},$e("file",_("What’s new"),()=>sn("app",p.tag,m(_("What’s new in Dawnline %s"),u)))),u===c?Pe("ok",_("Installed")):A(_("Install"),()=>Yr(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Yr(n,e){let o=e.replace(/^v/,"");o.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await me(m(_("Install Dawnline %s?"),o),m(_("It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong."),n.st.version),_("Install"))||n.op(`app@${e}`,m(_("Installing Dawnline %s"),o),n.st.version)}function Jr(n,e){let o=n.st,s=o.kept?.amneziawg,r=e?.sources??{},a=Object.keys(r),i=e?.current??null,l=i?r[i]:void 0,d=!!e?.ru,c=o.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];i&&p&&u.push({label:_("Reinstall this build"),warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Reinstalling AmneziaWG"),p)}),s&&u.push({label:m(_("Roll back to %s"),s.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back AmneziaWG to %s?"),s.version),_("The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds."),_("Roll back"))&&n.op("amneziawg:rollback",_("Rolling back AmneziaWG"),p??void 0)}});let k=[e?.release?{label:_("What’s new"),ic:"file",run:()=>sn("amneziawg",e.release,m(_("What’s new in the %s build"),l?.label??"AmneziaWG"),i??"slava")}:null,{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${l?.repo??"Slava-Shchipunov/awg-openwrt"}`,"_blank","noopener")},...u.length?[null,...u]:[]].filter((y,f,x)=>y!==null||f>0&&x[f-1]!==null),M=o.tunnels??[],g=M.length?M.length===1?m(_("Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations."),M[0]):m(N_(M.length,"Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.","Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations."),K(M.length),M.join(", ")):_("Switching takes a few seconds. Devices keep their configurations."),h=M.length>1?m(_("%s and %s"),M.slice(0,-1).join(", "),M[M.length-1]):M[0],E=M.length?m(_("Switching restarts %s for a few seconds."),h):_("Switching takes a few seconds."),H=async y=>{let f=r[y];await me(p?m(_("Switch to AmneziaWG %s?"),f.gen):m(_("Install AmneziaWG %s?"),f.gen),[m(_("The %s build, %s."),f.label,f.version),g,f.gen==="3.1"?_("Devices need AmneziaVPN 3.1 or newer."):""].filter(Boolean).join(" "),p?_("Switch"):_("Install"))&&n.op(`amneziawg:${y}${d?":ru":""}`,p?m(_("Switching to AmneziaWG %s"),f.gen):_("Installing AmneziaWG"),p??void 0)},S=y=>{let f=r[y],x=i===y&&!!p;return t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},f.gen?`AmneziaWG ${f.gen}`:"AmneziaWG"),t("span",{class:"dl-sub"},`${f.label} · ${f.gen==="3.1"?"AmneziaVPN 3.1+":_("every app")}`)]),t("span",{class:"dl-mono dl-faint dl-comp-bver"},f.version??_("none yet")),t("span",{class:"dl-comp-bact"},x?Pe("ok",_("Active","build")):f.version?A(p?_("Switch"):_("Install"),()=>H(y),p?"neutral":"positive",{disabled:n.busy}):Pe("",_("No build")))])},$=a.map(y=>r[y]?.newer?m(_("%s moves to %s with OpenWrt %s."),r[y].label,r[y].newer.gen,r[y].newer.tag.replace(/^v/,"")):"").filter(Boolean),b=ye(d,_("Russian translation"),y=>{i&&n.op(`amneziawg:${i}${y?":ru":""}`,y?_("Adding the Russian translation"):_("Removing the Russian translation"),p??void 0)});b.disabled=!i||!p||n.busy;let C=n.awgOpen??!p,w=t("details",{class:"dl-params dl-comp-fold",open:C?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Build and translation"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[...a.length?a.map(S):[t("div",{class:"dl-row"},t("span",{class:"dl-sub"},_("Check for updates to see the builds for this router.")))],t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Russian translation")),t("span",{class:"dl-sub"},_("LuCI pages for AmneziaWG"))]),t("span",{class:"dl-comp-bact"},b)])]),p&&a.length||$.length?t("div",{class:`dl-comp-status ${p&&a.length?"warn":"acc"}`},[v(p&&a.length?"alert":"download"),t("span",{},[p&&a.length?t("b",{},E):"",...$.map(y=>` ${y}`)])]):""])]);w.addEventListener("toggle",()=>n.awgOpen=w.open);let z=[];return e?.update&&p&&i?z.push(A(m(_("Update to %s"),e.latest),()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Updating AmneziaWG"),p),"neutral",{disabled:n.busy})):z.push((e||c.length)&&!p?Pe("warn",_("Not installed")):n.state("amneziawg",e,e?.latest??"")),z.push(n.round(()=>n.op("check:amneziawg",_("Checking AmneziaWG"),p??void 0),k)),[n.row("shield","AmneziaWG",[p?`${p}${e?.release?` · ${m(_("%s build"),e.release)}`:""}`:c.length?m(_("missing %s"),c.join(", ")):e?_("not installed"):_("version not checked")],z),t("div",{class:"dl-comp-foldwrap"},w)]}function Ml(){return[{title:_("Home-like link"),sub:_("Policy routing and the veth pair"),pkgs:["ip-full","kmod-veth"],feature:"home"},{title:_("HTTPS for the portal"),sub:_("OpenSSL for uhttpd"),pkgs:["libustream-openssl","openssl-util"],feature:"https"},{title:_("Certificates (ACME)"),sub:_("Let’s Encrypt certificate for the portal"),pkgs:["acme","acme-acmesh-dnsapi"],feature:"acme",optional:!0}]}var Io={home:"network",https:"lock",acme:"file"};function Zr(n,e){let o=n.st,s=e?.pkgs??{},r=Ml().filter(c=>c.feature==="home"?o.home:o.portal),a=async(c,p,u=c)=>{await me(m(_("Update %s?"),p),m(_("%s from the OpenWrt feeds. Services that use them restart for a moment."),u.join(", ")),_("Update"))&&n.op(`pkgs:${c.join(",")}`,m(_("Updating %s"),p))},i=[{label:_("Check system packages"),ic:"refresh",run:()=>n.op("check:packages",_("Checking system packages"))},{label:_("Open the OpenWrt package list"),ic:"globe",run:()=>window.open("https://openwrt.org/packages/start","_blank","noopener")}],l=0;return{rows:r.map(c=>{let p=c.pkgs.filter(h=>s[h]?.installed),u=[...new Set(p.flatMap(h=>[...s[h]?.latest?[h]:[],...s[h]?.with??[]]))],k=o.needs?.[c.feature]??c.pkgs.filter(h=>!s[h]?.installed),M=p.find(h=>s[h]?.latest),g=p.map(h=>`${h} ${s[h]?.installed??""}`).join(", ");return k.length?n.row(Io[c.feature],c.title,[c.optional?_("not installed"):m(_("missing %s"),k.join(", "))],[A(_("Install"),()=>n.op(`pkgs:${k.join(",")}`,m(_("Installing %s"),c.title)),c.optional?"neutral":"positive",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))]):e&&u.length?(l++,n.row(Io[c.feature],c.title,M?[`${s[M].installed} → ${s[M].latest}`,u.length>1?` · +${u.length-1}`:""]:[u.join(", ")],[A(_("Update"),()=>a(p.filter(h=>s[h]?.latest||s[h]?.with?.length),c.title,u),"neutral",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))])):n.row(Io[c.feature],c.title,[g||c.sub],[n.state("pkgs",e,""),t("span",{class:"dl-comp-ic"},n.more(i))])}),updates:l,total:r.length}}function El(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="pkgs"?_("System packages"):_("Components")}function Tl(n){let e=/^(\d+) system packages?$/.exec(n)?.[1];return e?W(Number(e),"%s system package","%s system packages"):n}function Qr(n){let e=n.st,o=r=>{let a=mt(r.component??"app"),i=t("b",{},El(a)),l="ok",d="check",c;if(r.kind==="found")l="accent",d="download",c=ae(r.auto?_("%s found by the automatic check"):_("%s found by a check"),t("b",{},(r.items??[]).map(Tl).join(", ")));else if(r.state==="failed")l="bad",d="x",c=[...ae(r.kind==="install"?_("%s update failed"):_("%s check failed"),i),r.error?` · ${r.error}`:""];else if(/^app:(lang:|nolang$)/.test(r.component??"")){let p=/^app:lang:(.+)$/.exec(r.component??"")?.[1];c=p?ae(_("%s added by you"),t("b",{},jn(p))):[_("Translation removed by you")]}else{let p=r.from&&r.to&&r.from!==r.to?`${r.from} → ${r.to}`:r.to??"";c=[...p?ae(r.auto?_("%s %s automatically"):_("%s %s by you"),i,p):ae(r.auto?_("%s updated automatically"):_("%s updated by you"),i),r.took?` · ${ot(r.took)}`:""]}return t("div",{class:"dl-row"},[t("span",{class:`dl-ev-tile ev ${l}`},v(d)),t("span",{class:"dl-row-main"},c),t("span",{class:"dl-faint dl-nowrap",title:new Date(r.ts*1e3).toLocaleString(ie())},pe(r.ts,e.now))])},s=e.history??[];return t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All in Log →"))]),s.length?t("div",{},s.slice(0,8).map(o)):t("p",{class:"dl-sub dl-comp-empty"},_("Updates, and checks that found something, show up here."))])}var Wn=class{constructor(){this.root=t("div",{class:"dl-upd"});this.following=null;this.versOpen=!1;this.versPage=1;this.versCache=new Map;this.notes=new Map;this.awgOpen=null;this.langOpen=!1}load(){return N.updatesStatus()}render(e){return this.st=e,this.paint(),e.job?.state==="running"&&this.follow(e.job),poll.add(async()=>{if(!this.root.isConnected)return;let o=await N.updatesStatus().catch(()=>null);if(!o)return;let s=this.st;this.st=o,o.job?.state==="running"&&this.following!=="starting"&&o.job.id!==this.following&&this.follow(o.job),(o.job?.id!==s.job?.id||o.job?.state!==s.job?.state||o.job?.phase!==s.job?.phase||o.check?.time!==s.check?.time)&&this.paint()},5),this.root}get busy(){return this.st.job?.state==="running"}async refresh(e){this.st=e??await N.updatesStatus().catch(()=>null)??this.st,this.paint()}async op(e,o,s){if(this.busy||this.following==="starting"){q(_("Another component action is already running"),"warning");return}this.following="starting",this.paint();let r=mt(e),a=await tn(e,{title:o,version:s,onJob:i=>this.following=i.id,onDone:i=>this.refresh(i),onUpdate:i=>{let l=i.check?.components??{};r==="amneziawg"&&l.amneziawg?.current?this.op(`amneziawg:${l.amneziawg.current}${l.amneziawg.ru?":ru":""}`,_("Updating AmneziaWG"),l.amneziawg.installed??void 0):this.op("app",_("Updating Dawnline"),this.st.version)}});this.following==="starting"&&(this.following=a?.id??null),this.refresh()}async follow(e){this.following=e.id;let o={app:[_("Checking Dawnline"),_("Automatic update: Dawnline"),_("Updating Dawnline")],amneziawg:[_("Checking AmneziaWG"),_("Automatic update: AmneziaWG"),_("Updating AmneziaWG")],pkgs:[_("Checking system packages"),_("Automatic update: system packages"),_("Updating system packages")],all:[_("Checking components"),_("Automatic update: components"),_("Updating components")]};await tn(null,{title:(o[An(e)]??o.all)[e.action==="check"?0:e.auto?1:2],onDone:s=>this.refresh(s)},e)}paint(){let e=this.st,o=e.check?.components??{},s=e.firmware,r=Zr(this,o.packages),a=(e.needs?.awg??[]).length>0,l=(!a&&o.amneziawg?.update&&o.amneziawg.installed?1:0)+r.updates;dom.content(this.root,[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Components")),t("span",{class:"dl-faint"},[s?.version?`OpenWrt ${s.version} · ${s.target}`:"",e.check?m(_("checked %s"),pe(e.check.time,e.now)):_("not checked yet")].filter(Boolean).join(" · "))]),t("div",{class:"dl-row-actions"},[t("a",{class:"cbi-button cbi-button-neutral dl-icon-btn",href:`${L.url("admin/network/dawnline/settings")}?section=updates`},[v("edit")," ",_("Settings")]),A([v("refresh")," ",_("Check all")],()=>this.op("check",_("Checking all components")),"neutral",{disabled:this.busy})])]),Vr(this,o.app),t("div",{class:"dl-comp-cols"},[t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Components")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-comp-count"},a?l?`${_("AmneziaWG not installed")} · ${W(l,"%s update","%s updates")}`:_("AmneziaWG not installed"):!o.amneziawg&&!o.packages?"":l?m(N_(l,"%s of %s needs an update","%s of %s need an update"),K(l),K(1+r.total)):_("Everything is up to date"))]),t("div",{},[...Jr(this,o.amneziawg),...r.rows])]),Qr(this)])])}state(e,o,s){let r=this.st.job;if(r?.state==="running"){let a=l=>l==="packages"?"pkgs":l,i=r.action==="check"?[a(r.component||"all")]:(r.component??"").split(" ").map(l=>a(mt(l)));if(i.includes(e)||i.includes("all"))return t("button",{type:"button",class:"dl-pill info dl-comp-run",title:_("Show progress"),click:()=>this.follow(r)},[r.action==="check"?_("Checking…"):_("Updating…")])}return o?o.error?Pe("warn",_("Check failed"),o.error):o.update?Pe("info",_("Update available")):o.status==="dev"?Pe("info",_("Newer than release"),m(_("The latest release is %s"),s)):Pe("ok",_("Up to date")):Pe("",_("Not checked"))}more(e){let o=A([v("more")],()=>Se(o,e.filter((s,r,a)=>s!==null||r>0&&rs?{label:s.label,icon:v(s.ic),warn:s.warn,run:s.run}:null)),"neutral",{title:_("More"),"aria-label":_("More")});return o}round(e,o,s=!1){let r=this.busy?" is-busy":"",a;return s?a=A([v("refresh")," ",_("Check")],e,"neutral",{class:`cbi-button cbi-button-neutral dl-comp-check${r}`,"aria-label":_("Check for updates")}):(a=$e("refresh",_("Check for updates"),e,"neutral",r.trim()),a.removeAttribute("title"),a.setAttribute("aria-label",_("Check for updates")),we(a,()=>[_("Check for updates")])),t("span",{class:"dl-comp-ic"},[a,this.more(o)])}row(e,o,s,r){return t("div",{class:"dl-row"},[t("span",{class:"dl-group-ic"},v(e)),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-mono dl-faint dl-comp-sub"},s)]),...r])}};var Xr=(n,e)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},n),t("div",{class:"cbi-value-field"},e)]);function ea(n){let e=n.st.servers.find(o=>o.id===n.p.server)?.name??_("Home");Xt(n.p,e)}async function ta(n){let e=n.p,o=e.code_set??0,s=e.devices.filter(l=>l.created_by==="portal"&&l.created>=o),r=s.map(l=>t("input",{type:"checkbox",id:`dl-rm-${l.id}`,checked:"checked","data-id":l.id})),a=[t("p",{},_("The old link stops working right away."))];s.length&&a.push(t("p",{},_("Devices added through the old link keep working until they are removed. Remove them too:")),t("div",{class:"dl-checklist"},s.map((l,d)=>t("label",{for:`dl-rm-${l.id}`},[r[d],` ${l.name}`]))));let i=async()=>{let l=r.filter(c=>c.checked).map(c=>c.dataset.id),d=await F(()=>N.personRegen(e.id,l),l.length?W(l.length,"New link created, %s device removed","New link created, %s devices removed"):_("New link created"));d&&(ce(),l.length&&await n.refresh(),d.link&&await xe(d.link,_("New link copied")))};de(_("Create a new link?"),a,[ue()," ",A(_("Create new link"),i,"negative")])}function Bo(n){let e=t("textarea",{class:"cbi-input-textarea dl-note-input",rows:3,maxlength:500,placeholder:_("Only you see this")},n.p.note??"");de(_("Note"),[e],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({note:e.value.trim()},e.value.trim()?_("Note saved"):_("Note removed"))},"positive")]),setTimeout(()=>e.focus(),50)}function na(n){let e=n.p,o=t("select",{class:"cbi-input-select"},[t("option",{value:"pause",selected:e.expire_action==="pause"?"selected":null},_("Pause access")),t("option",{value:"notify",selected:e.expire_action==="notify"?"selected":null},_("Keep access")),t("option",{value:"remove",selected:e.expire_action==="remove"?"selected":null},_("Remove their devices"))]),s=t("select",{class:"cbi-input-select"},[0,1,3,7,14].map(r=>t("option",{value:r,selected:e.expire_warn===r?"selected":null},r?W(r,"%s day before","%s days before"):_("Don’t warn"))));de(_("When access ends"),[Xr(_("Then"),o),t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},_("Warn")),t("div",{class:"cbi-value-field"},[s,t("div",{class:"cbi-value-description"},_("Shown in their portal and on the Overview."))])])],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({expire_action:o.value,expire_warn:s.value},_("Saved"))},"positive")])}function oa(n){let e=t("input",{type:"text",class:"cbi-input-text",value:n.p.name,maxlength:48}),o=Ee(_("Name","person"),e,()=>He(e.value,[],_("Shown in their portal and apps.")));de(_("Rename"),[o],[ue()," ",A(_("Save"),async()=>{let s=o.help();if(s.bad){q(s.text,"warning");return}await n.patch({name:e.value.trim()},_("Renamed"))&&ce()},"positive")]),setTimeout(()=>e.select(),50)}function sa(n){let e=n.p,o=n.st.servers.filter(a=>a.id!==e.server),s=t("select",{class:"cbi-input-select"},o.map(a=>t("option",{value:a.id},`${a.name} · ${a.endpoint||_("no address")}:${a.port}`))),r=e.devices.length;de(m(_("Move %s to another server"),e.name),[Xr(_("Server"),s),t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.","%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind."):_("They have no devices yet: nothing else changes."))],[ue()," ",A(_("Move"),async()=>{await n.patch({server:s.value},m(_("Moved to %s"),o.find(a=>a.id===s.value)?.name??_("the server")))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3))},"positive")])}async function ra(n){let e=n.p;await me(m(_("Delete %s?"),e.name),W(e.devices.length,"%s device is disconnected immediately and the personal link stops working.","All %s devices are disconnected immediately and the personal link stops working."),_("Delete"),!0)&&await F(()=>N.personDelete(e.id),_("Deleted"))&&(location.href=It(e.server))}function aa(n){let e=n.p,o=n.st,s=e.online?_("online now"):e.last_seen?m(_("last seen %s"),pe(e.last_seen,o.now)):_("never connected"),r=e.created?m(_("Added %s","date"),De(Ke(new Date(e.created*1e3)))):"",a=e.has_link??o.settings.portal_enabled,i=[{label:_("Rename"),icon:v("edit"),run:()=>oa(n)},{label:e.note?_("Edit note"):_("Add note"),icon:v("file"),run:()=>Bo(n)},...o.servers.length>1?[{label:_("Move to server…"),icon:v("server"),run:()=>sa(n)}]:[],...a?[null,{label:_("Invite card"),icon:v("qr"),run:()=>ea(n)},{label:_("New link"),icon:v("key"),run:()=>ta(n)}]:[],null,...e.paused?[]:[{label:_("Pause"),icon:v("pause"),warn:!0,run:()=>n.patch({paused:!0},_("Paused"))}],{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>ra(n)}];return t("div",{class:"dl-person-head"},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-person-id"},[t("span",{class:`dl-avatar lg${e.online?" online":""}`},je(e.name)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),Zo(e)]),t("span",{class:"dl-faint",title:r},`${m(N_(e.device_limit,"%s of %s device","%s of %s devices"),e.devices.length,e.device_limit)} · ${s}`)])]),t("div",{class:"dl-pcard-actions"},[e.paused?A([v("play"),` ${_("Resume")}`],()=>n.patch({paused:!1},_("Resumed")),"add"):"",a?$e("link",_("Copy link"),()=>Sn(e.id),"neutral","dl-icon-only"):"",$e("more",_("More"),l=>Se(l.currentTarget,i),"neutral","dl-icon-only")])]),e.note?t("button",{type:"button",class:"dl-pnote",title:_("Edit note"),click:()=>Bo(n)},[v("file"),t("span",{},e.note)]):""])}function ia(n){let e=n.p,o=n.series[n.series.length-1];return t("div",{class:`dl-person-live${e.online?"":" solo"}`},[e.online?zn(e.rate??[],n.st.now,o?[o.rx,o.tx]:[0,0]):"",Rn(n.series,m(_("%s this month"),oe(e.month[0]+e.month[1])))])}async function Sl(n,e){let o=await F(()=>N.deviceConfig(e.id));o&&de(m(_("Set up %s"),e.name),[await n.core.connectBlock(o,"qr")],[ue(_("Close"))])}async function Pl(n,e){let o=await F(()=>N.deviceConfig(e.id));if(!o)return;if(!o.has_private_key){q(_("This device made its own keys in the browser; its configuration only exists there."),"warning");return}let s=n.core.file.make(o);Ne(s.name,s.text,"application/octet-stream")}function la(n){let e=n.p,o=n.st.now,s=d=>Je(e,d,n.deviceOpts()),r=d=>c=>{c.target.closest("button:not(.dl-dcard-title), a")||s(d)},a=d=>A([v("more")],c=>dr(c.currentTarget,e,d,n.deviceOpts()),"neutral",{title:_("QR, file, key, rename, new keys, remove"),class:"cbi-button cbi-button-neutral dl-icon-only"}),i=ln(e.devices).map(d=>{let c=t("div",{class:"dl-dcard-head"},[t("span",{class:"dl-dcard-ic"},v(d.kind)),t("button",{type:"button",class:"dl-dcard-title",click:()=>s(d)},[t("b",{},d.name),dn(d,o,void 0,e),d.config_stale?t("span",{class:"dl-pill warn dl-stale"},_("Update config")):""]),a(d)]),p=t("div",{class:"dl-dcard-trend"},[t("div",{class:"dl-stack"},[t("b",{},oe(d.month[0]+d.month[1])),t("span",{class:"dl-sub"},_("this month"))]),$r(n.devSeries[d.id]??[])]);return t("article",{class:`dl-dcard clickable${d.online?" online":""}${d.disabled?" off":""}`,click:r(d)},[c,d.handshake?p:d.disabled?t("div",{class:"dl-sub"},`${at(d.kind)} · ${m(d.created_by==="portal"?_("created %s in the portal."):_("created %s by you."),pe(d.created,o))}`):t("div",{class:"dl-chips-row"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>Sl(n,d)},[v("qr"),_("Show QR")]),t("button",{type:"button",class:"dl-chipbtn",click:()=>Pl(n,d)},[v("download"),_("Config")])])])}),l=e.devices.length>=e.device_limit;return i.push(t("button",{type:"button",class:"dl-dslot add",click:()=>ct(e,n.deviceOpts())},[t("span",{class:"dl-dslot-ic"},v("plus")),t("span",{class:"dl-stack"},[t("b",{},_("Add device")),t("span",{class:"dl-sub"},l?`${_("Over the limit")} · ${m(_("%s of %s"),e.devices.length,e.device_limit)}`:m(_("%s of %s"),e.devices.length,e.device_limit))])])),t("section",{class:"dl-devsec"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Devices")),t("span",{class:"dl-sub"},m(_("%s online"),K(e.online)))]),t("div",{class:"dl-dgrid"},i)])}function da(n){let e=n.p,o=Me([["device",_("Device’s own DNS")],["home",_("Home names")]],e.dns_mode,{label:"DNS",cls:"sm",optimistic:!1,onChange:r=>n.patch({dns_mode:r},r==="home"?_("Home names on - devices need their configuration again"):_("Device DNS - devices need their configuration again"))}),s=n.st.settings.home_dns_fallback;return t("div",{class:"dl-stack gap4 dl-dnspick"},[t("div",{class:"dl-row-actions"},[t("span",{class:"dl-sub"},"DNS"),o]),t("span",{class:"dl-sub"},e.dns_mode==="home"?s?ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down)."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`),t("span",{class:"dl-mono"},s)):ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`)):_("Internet keeps working exactly as without the VPN. Reach home devices by IP address."))])}function ca(n){let e=n.p,s=n.st.servers.find(a=>a.id===e.server)?.home??[];if(s.length<2)return"";let r=new Set(e.home_nets?.length?e.home_nets:s.map(a=>a.dev));return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},s.map(a=>Xe(a.dev,r.has(a.dev),()=>{let i=new Set(r);if(i.delete(a.dev)||i.add(a.dev),!i.size)return q(_("Keep at least one network, or choose Internet only."),"warning",5e3);let l=i.size===s.length?[]:[...i];n.patch({home_nets:l},l.length?m(_("%s reaches %s"),e.name,l.join(", ")):m(_("%s reaches every home network"),e.name))},{title:a.nets.join(", ")}))),t("span",{class:"dl-sub"},e.home_nets?.length?m(_("Home networks %s reaches. Networks added to the server later stay out."),e.name):m(_("Home networks %s reaches: all of them. Untick one to keep %s out of it."),e.name,e.name))])}function pa(n){let e=new Set(n.p.services??[]);return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},n.st.services.map(o=>Xe(o.name,e.has(o.id),()=>{let s=new Set(e);s.delete(o.id)||s.add(o.id),n.patch({services:[...s]},s.size?_("Home services updated"):_("Whole home network"))},{title:`${o.address}${o.ports.length?` · ${o.ports.join(", ")}`:""}`}))),t("span",{class:"dl-sub"},e.size?_("Only the selected services at home."):_("Whole home network. Pick services to narrow it down."))])}function ua(n){let e=n.p,o=n.st;if(o.servers.find(c=>c.id===e.server)?.mesh!=="circles"||!ut(e))return"";let r=o.circles.filter(c=>c.server===e.server),a=r.find(c=>c.id===e.circle),i=a?o.people.filter(c=>c.id!==e.id&&c.circle===a.id&&ut(c)).map(c=>c.name):[],l=t("button",{type:"button",class:"dl-chipbtn",click:()=>Se(l,[...r.map(c=>({label:c.name,icon:So(c),run:()=>c.id!==e.circle&&n.patch({circle:c.id},m(_("%s is in %s"),e.name,c.name))})),e.circle?{label:_("No circle"),icon:v("x"),run:()=>n.patch({circle:""},m(_("%s is in no circle"),e.name))}:null,{label:_("New circle"),icon:v("plus"),run:()=>$n(o,e.server,null,()=>n.refresh())}])},_("Change")),d=a?o.people.filter(c=>c.circle===a.id&&ut(c)):[e];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Devices see each other")),l]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},a?a.name:_("No circle")),t("span",{class:"dl-avstack",title:d.map(c=>c.name).join(", ")},d.slice(0,5).map(c=>t("span",{class:"dl-avatar sm"},je(c.name))))]),t("span",{class:"dl-sub"},a?i.length?[e.name,...i].join(", "):m(_("Nobody else in %s yet"),a.name):m(_("Only %s's own devices"),e.name))])}function ma(n){let e=n.p,o=n.st.now,s=t("div",{class:"dl-slots"});for(let i=0;i=e.device_limit,c=t("i",{class:d?"over":l?"used":""});we(c,()=>[t("div",{class:"dl-tip-title"},l?`${l.name}${d?` · ${_("over the limit")}`:""}`:_("Free slot")),t("div",{class:"dl-muted"},l?l.online?_("Connected"):l.handshake?m(_("Last seen %s"),pe(l.handshake,o)):_("Not set up yet"):_("They can add a device here"))]),s.appendChild(c)}let r=Math.max(1,e.devices.length),a=t("button",{type:"button","aria-label":_("Allow fewer devices"),disabled:e.device_limit<=r?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit-1)})},"−");return e.device_limit<=r&&e.devices.length>1&&we(a,()=>[t("div",{class:"dl-tip-title"},W(e.devices.length,"%s device in use","%s devices in use")),t("div",{class:"dl-muted"},_("Remove a device first to lower the limit"))]),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},_("Devices")),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[String(e.devices.length),t("span",{class:"dl-faint"},` / ${e.device_limit}`)]),t("div",{class:"dl-stepper"},[a,t("button",{type:"button","aria-label":_("Allow more devices"),disabled:e.device_limit>=32?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit+1)})},"+")])]),s])}function $l(n){return{internet:_("Browse the internet through your router. No access to devices at home, and home cannot reach theirs."),lan:_("Reach devices at home, and home reaches theirs. Internet stays on their own connection."),both:_("Home devices and the internet, all through your router. Home reaches their devices too.")}[n]}var ha=/^([01]\d|2[0-3]):[0-5]\d$/;function Dl(n){let e=n.p,o=n.today,s=st(e.expires,o),r=t("input",{type:"date",class:"dl-date-hidden",value:e.expires,tabindex:"-1","aria-hidden":"true"});r.addEventListener("change",()=>r.value&&n.patch({expires:r.value},m(_("Access until %s"),De(r.value))));let a=(c,p)=>{let u=Yo(e.expires&&(s??-1)>=0?e.expires:"",c,p,o);n.patch({expires:u},m(_("Access until %s"),De(u)))},i=[["week",1,_("+1 week")],["month",1,_("+1 month")],["month",3,_("+3 months")],["year",1,_("+1 year")]].map(([c,p,u])=>t("button",{type:"button",class:"dl-chipbtn",click:()=>a(c,p)},u)),l=t("span",{class:"dl-datechip"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>{r.focus({preventScroll:!0});try{r.showPicker()}catch{}}},[v("calendar"),e.expires?De(e.expires):_("Date")]),r]),d={pause:_("pause access"),notify:_("keep access"),remove:_("remove their devices")}[e.expire_action];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Access ends")),e.expires?t("span",{class:s!=null&&s<0?"dl-bad":rt(e,s)?"dl-warn":"dl-ok"},s!=null&&s<0?_("ended"):W(s??0,"%s day left","%s days left")):t("span",{class:"dl-faint"},_("no end date"))]),t("div",{class:"dl-chips-row"},[...i,l,e.expires?t("button",{type:"button",class:"dl-chipbtn",click:()=>n.patch({expires:""},_("No end date"))},_("No end")):""]),t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.expire_warn?m(N_(e.expire_warn,"When it ends: %s, warn %s day before","When it ends: %s, warn %s days before"),d,K(e.expire_warn)):m(_("When it ends: %s"),d)),t("a",{href:"#",click:c=>{c.preventDefault(),na(n)}},_("Change"))])])}function Al(n){let e=n.p,o=e.quota_used||e.month[0]+e.month[1],s=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,r=t("div",{class:`dl-meter${s>=100?" bad":s>=90?" warn":""}`},[t("i"),e.quota_limit?t("span",{class:"mark",title:_("Alert at 90%")}):""]);r.firstChild.style.width=`${s}%`,e.quota_limit&&we(r,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(s,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),oe(e.quota_used),oe(e.quota_limit))} · ${m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},_("Alert at 90%"))]);let a=Me([["month",_("Monthly")],["total",_("Total")]],e.quota_period,{label:_("Data limit period"),cls:"sm",optimistic:!1,onChange:l=>n.patch({quota_period:l})}),i=[10,50,100].map(l=>t("button",{type:"button",class:`dl-chipbtn${e.quota_gb===l?" on":""}`,click:()=>n.patch({quota_gb:String(l)},m(_("Data limit %s GB"),K(l)))},`${K(l)} ${_("GB")}`));return i.push(t("button",{type:"button",class:`dl-chipbtn${e.quota_gb?"":" on"}`,click:()=>n.patch({quota_gb:""},_("No data limit"))},_("Unlimited"))),i.push(t("button",{type:"button",class:"dl-chipbtn",click:()=>{let l=t("input",{type:"number",class:"cbi-input-text dl-w-port",min:0,step:"any",value:e.quota_gb?String(e.quota_gb):""}),d=Ee(_("Data limit (GB)"),l,()=>gn(l.value,e.quota_period==="month"));de(_("Data limit"),[d],[ue()," ",A(_("Save"),async()=>{let c=d.help();if(c.bad){q(c.text,"warning");return}let p=l.value.trim();await n.patch({quota_gb:p},p&&Number(p)>0?m(_("Data limit %s GB"),K(Number(p))):_("No data limit"))&&ce()},"positive")]),setTimeout(()=>l.select(),50)}},_("Custom"))),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Data")),a]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[oe(o),e.quota_limit?t("span",{class:"dl-faint"},` ${m(_("of %s"),oe(e.quota_limit))}`):t("span",{class:"dl-faint"},` · ${_("no limit")}`)]),e.quota_period==="month"?t("span",{class:"dl-sub"},_("resets on the 1st")):""]),e.quota_limit?r:"",t("div",{class:"dl-chips-row"},i),e.quota_gb&&e.quota_period==="month"?t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.bonus_gb?m(_("Includes +%s GB extra this month"),K(e.bonus_gb)):_("Need a little more this month?")),t("a",{href:"#",click:l=>{l.preventDefault(),n.patch({bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month"))}},_("+10 GB this month"))]):"",t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},m(_("%s in total"),oe(e.total[0]+e.total[1]))),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("person",e.id,e.name,()=>setTimeout(()=>n.refresh(),300))},_("Reset usage"))])])}function Nl(n){let e=n.p,o=!!e.hours,[s,r]=(e.hours||"07:00-23:00").split("-"),a=t("input",{type:"time",class:"cbi-input-text",value:s,"aria-label":_("From")}),i=t("input",{type:"time",class:"cbi-input-text",value:r,"aria-label":_("To")}),l=t("div",{class:"dl-tile2-row"},[a,t("span",{class:"dl-faint"},_("to","time range")),i]),d=()=>{let k=`${a.value}-${i.value}`;if(k!==e.hours){if(!ha.test(a.value)||!ha.test(i.value))return q(_("Enter both times, like 07:00 and 23:00."),"warning");if(a.value===i.value)return q(_("The start and the end must differ."),"warning");n.patch({hours:k},m(_("Allowed %s–%s"),a.value,i.value))}};l.addEventListener("focusout",k=>{l.contains(k.relatedTarget)||d()});for(let k of[a,i])k.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),d())});let c=t("button",{type:"button",role:"switch","aria-checked":o?"true":"false",class:`dl-switch${o?" on":""}`,"aria-label":_("Limit hours"),click:()=>{if(o)return n.patch({hours:""},_("Any time"));c.classList.add("on"),c.setAttribute("aria-checked","true"),p.textContent=_("Set the hours, then press Enter"),u.appendChild(l),a.focus()}},t("i")),p=t("span",{},o?m(_("%s – %s (router time)"),s,r):_("Any time")),u=t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-row"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-tile2-label"},_("Allowed hours")),p]),c]),o?l:""]);return u}function fa(n){let e=n.p,o=Me(["internet","lan","both"].map(s=>[s,[v(s==="internet"?"globe":s==="lan"?"home":"shield"),s==="internet"?_("Internet"):s==="lan"?_("Home"):_("Both")]]),e.access,{label:_("Access"),cls:"wide",optimistic:!1,onChange:s=>n.patch({access:s},m(_("Access: %s"),vt(s)))});return t("section",{class:"dl-devsec","aria-label":_("Access and limits")},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Access & limits"))]),t("div",{class:"dl-panel"},[t("div",{class:"dl-stack gap8"},[t("span",{class:"dl-tile2-label"},_("Can reach")),o,t("span",{class:"dl-sub"},$l(e.access)),e.access==="lan"&&n.st.services.length?pa(n):"",ut(e)?ca(n):"",e.access==="lan"?da(n):""]),t("div",{class:"dl-tiles2"},[ma(n),ua(n),Dl(n),Al(n),Nl(n)])])])}function Hl(n){let e=n.st,o=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Locations")),t("span",{class:"dl-spacer"}),e.geo.enabled?Rt("30d",r=>n.map?.setRange(r),!1):"",A(_("Hide"),()=>{n.mapOpen=!1,n.map?.destroy(),n.map=null,n.paintPlaces()},"neutral")]);if(!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=new dt({openPerson:()=>{},openDevice:(r,a)=>{let i=n.p.devices.find(l=>l.id===a);i&&Je(n.p,i,n.deviceOpts())}},"30d",280);return n.map=s,requestAnimationFrame(()=>s.mount(n.mapData())),t("div",{class:"dl-panel flush"},[o,s.el])}function ga(n){let e=n.st;if(!e.geo.enabled)return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},_("Locations are off")),t("span",{class:"dl-sub"},_("City-level, from the client IP"))]),t("span",{class:"dl-spacer"}),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/settings")},_("Turn on"))]);if(n.mapOpen)return n.map&&n.parts.places.contains(n.map.el)?null:Hl(n);let o=e.now-30*86400,s=e.geo.points.filter(i=>i.person===n.p.id&&i.ts>=o).sort((i,l)=>l.ts-i.ts),r=[...new Set(s.map(i=>i.city||i.country).filter(Boolean))],a=s[0];return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},a?a.city||a.country:_("No locations yet")),t("span",{class:"dl-sub"},a?[W(r.length,"%s place in 30 days","%s places in 30 days"),a.org].filter(Boolean).join(" · "):_("Shown after a device connects"))]),t("span",{class:"dl-spacer"}),s.length?A(_("Show map"),()=>{n.mapOpen=!0,n.paintPlaces()},"neutral"):""])}function va(n){let e=n.p,o=n.st,s=n.events.filter(l=>l.person===e.id),r=[],a=[...s].reverse();for(let l=0;l1){let u=p.querySelector(".dl-row-main");dom.content(u,[...Do(o,d).slice(0,3),t("span",{class:"dl-muted"},W(c,"%s time","%s times"))]),u.title=a.slice(l,l+c).map(k=>k.detail??"").join(` +`)}r.push(p),l+=c-1}let i=A([v("more")],()=>Se(i,[{label:_("Export CSV"),icon:v("download"),run:()=>Qe(o,s,"csv",e.id)},{label:_("Export JSON"),icon:v("download"),run:()=>Qe(o,s,"json",e.id)},null,{label:m(_("Clear %s's activity"),e.name),icon:v("trash"),danger:!0,run:()=>lt(m(_("Clear %s's activity"),e.name),m(_("Removes events about %s and their devices."),e.name),{person:e.id},()=>n.refresh())}]),"neutral",{title:_("Export or clear"),class:"cbi-button cbi-button-neutral dl-icon-only"});return t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-sub"},s.length>10?m(_("latest 10 of %s"),K(s.length)):""),t("span",{class:"dl-spacer"}),i]),r.length?r:t("div",{class:"dl-row dl-muted"},_("Nothing yet."))])}var Gn=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.ticks=0;this.fullNext=!1}async fetch(e){let[o,s,r]=await Promise.all([N.status(30),e?N.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?N.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:o,ev:s?.events??null,use:r}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let o=this.st.people.find(i=>i.id===this.id);if(!o)return t("div",{class:"dl-empty"},[t("h3",{},_("Person not found")),t("p",{},_("They may have been removed.")),t("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},_("Back to Servers"))]);this.p=o;for(let i of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[i]=t("div",{});this.parts.devices.className="dl-person-devices";let s=t("div",{},[this.parts.crumbs,this.parts.head,t("div",{class:"dl-grid-person"},[t("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),t("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let r=new URLSearchParams(location.search),a=r.get("device")&&o.devices.find(i=>i.id===r.get("device"));return a?setTimeout(()=>Je(this.p,a,this.deviceOpts()),50):r.get("add")&&setTimeout(()=>ct(this.p,this.deviceOpts()),50),this.poller=pt({fetch:i=>{let l=i||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>s.isConnected,apply:(i,l)=>this.apply(i,l)}),s}take(e){this.st=e.st,e.ev&&(this.events=e.ev),e.use&&(this.series=e.use.person,this.devSeries=e.use.devices)}apply(e,o){this.take(e);let s=this.st.people.find(r=>r.id===this.id);if(!s){o||(location.href=It(this.p?.server));return}this.p=s,this.paint(o),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,o){var a;this.poller?.claim();let s=await F(()=>N.personUpdate(this.p.id,e),o);if(!s)return!1;this.poller?.claim();let r=this.st.people.findIndex(i=>i.id===this.p.id);return(a=s.person).rate??(a.rate=this.p.rate),r>=0&&(this.st.people[r]=s.person),this.p=s.person,this.paint(),!0}get today(){return Ge(this.series.length?this.series:this.st.series)}get core(){return zt(this.st.servers,this.p.server)}deviceOpts(){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:this.core,events:()=>this.events}}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}crumbs(){let e=this.p;return t("nav",{class:"dl-crumbs","aria-label":_("Breadcrumb")},[t("a",{href:It(e.server)},this.st.servers.find(o=>o.id===e.server)?.name??_("Servers")),t("span",{},"/"),t("a",{href:It(e.server)},_("People")),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Ae(this.parts.crumbs,this.crumbs(),e),Ae(this.parts.head,aa(this),e),Ae(this.parts.traffic,ia(this),e),Ae(this.parts.devices,la(this),e),Ae(this.parts.limits,fa(this),e),this.paintPlaces(e),Ae(this.parts.activity,va(this),e)}paintPlaces(e=!1){let o=ga(this);o&&Ae(this.parts.places,o,e&&!this.mapOpen)}};var zl={ok:"check",warn:"alert",error:"x",skip:"pause"},qn=class{constructor(e,o,s,r){this.el=t("div",{});this.wdEl=t("div",{});this.checksEl=t("div",{class:"dl-panel"});this.recentEl=t("div",{class:"dl-panel flush dl-recent"});this.checks=null;this.summary=t("div",{});this.open=new Set;this.st=e,this.sl=o,this.events=s,this.toLog=r,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(o,s)}async run(e){let o=e?await In(e):await N.health().catch(()=>null);o&&(this.take(o),e==="netrestart"&&setTimeout(()=>this.el.isConnected&&void this.run(),5e3))}take(e){this.checks=e.checks,this.paintChecks(),this.paintLive(e,this.events)}paintChecks(){let e=this.checks;if(!e){dom.content(this.summary,""),dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks"))]),t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);return}let o=e.filter(i=>i.status==="error").length,s=e.filter(i=>i.status==="warn").length;dom.content(this.summary,o?bt("error",W(o,"%s problem needs attention.","%s problems need attention.")):s?bt("warn",W(s,"%s warning.","%s warnings.")):bt("ok",_("All checks passed.")));let r=new Map;for(let i of this.sl.watchdog.repairs)r.set(i.id,Math.max(r.get(i.id)??0,i.ts));let a=()=>this.run();dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks")),t("span",{class:"dl-spacer"}),A(_("Run again"),a)]),t("ul",{class:"dl-checks"},e.map(i=>t("li",{},[t("span",{class:`dl-check-icon ${i.status}`},v(zl[i.status])),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},i.title),t("div",{class:"dl-check-detail"},i.detail),r.has(i.id)?t("div",{class:"dl-check-repaired"},m(_("Repaired by the watchdog at %s"),Ut(r.get(i.id)))):""]),Ao(i,l=>void this.run(l),a)])))])}paintLive(e,o){this.sl=e,this.events=o;let s=e.watchdog,r=s.beat!=null&&s.now-s.beat>180,a=s.repairs.filter(d=>s.now-d.ts<86400),i=a[a.length-1],l=ye(s.enabled,_("Watchdog repairs"),async d=>{await F(()=>N.settingsUpdate({watchdog:d?"1":"0"}),d?_("Watchdog on"):_("Watchdog off"))||uo(l,!d);let p=await N.serviceLog().catch(()=>null);p&&this.paintLive(p,this.events)});dom.content(this.wdEl,t("div",{class:"dl-panel dl-wd"},[t("div",{class:"dl-wd-head"},[t("span",{class:`dl-wd-tile${s.enabled?"":" off"}`},v("shield")),t("div",{class:"dl-stack"},[t("span",{class:"dl-wd-title"},_("Watchdog")),t("span",{class:"dl-sub"},s.enabled?_("Every minute it checks the tunnels and services and repairs what it can on its own."):_("Off: problems are only written to the log. Nothing is repaired on its own."))]),t("span",{class:"dl-spacer"}),l]),t("div",{class:"dl-wd-foot"},[t("div",{class:"dl-wd-chips"},s.targets.map(d=>t("span",{class:`dl-check-chip${d.ok?"":" error"}`,title:d.ok?_("OK"):d.tries?`${_("Not working")} · ${W(d.tries,"%s repair","%s repairs")}`:_("Not working")},[v(d.ok?"check":"x"),d.name]))),t("span",{class:`dl-sub${r?" dl-warn-text":""}`},r?m(_("The agent has not checked in for %s min; cron restarts it after 5."),K(Math.round((s.now-s.beat)/60))):[s.last?m(_("Looked %s"),pe(s.last,s.now)):_("Starts within a minute")," · ",a.length?m(N_(a.length,"%s repair today, last %s at %s","%s repairs today, last %s at %s"),K(a.length),i.name,Ut(i.ts)):_("no repairs today")])])])),this.paintRecent()}paintRecent(){let e=(this.sl.watchdog.now||Date.now()/1e3)-604800,o=[...this.events.map(r=>({ts:r.ts,ev:r})),...this.sl.log.map(r=>({ts:r.ts,sys:r}))].filter(r=>r.ts>=e&&vn(r)).sort((r,a)=>a.ts-r.ts),s=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Recent problems")),t("span",{class:"dl-spacer"}),o.length?t("a",{href:"#",click:r=>(r.preventDefault(),this.toLog())},`${_("All in Log")} →`):""]);if(!o.length){dom.content(this.recentEl,[s,t("div",{class:"dl-recent-empty"},[t("span",{class:"dl-check-icon ok"},v("check")),_("No problems in the last 7 days.")])]);return}dom.content(this.recentEl,[s,...o.slice(0,8).map(r=>{if(r.sys){let a=r.sys,i=`${a.ts}|${a.msg}`;return Hn(a,this.open.has(i),()=>{this.open.delete(i)||this.open.add(i),this.paintRecent()},Ut(a.ts))}return ht(this.st,r.ev,{time:Ut(r.ts)})})])}};var Fn=300,Rl=["all","connections","people","system","problems"],Kn=class{constructor(e,o,s){this.events=[];this.system=[];this.kind="all";this.shown=Fn;this.open=new Set;this.list=t("div",{});this.sub="";this.tabs=t("div",{class:"dl-seg",role:"tablist"});this.st=e,this.take(o),this.system=s,this.el=t("div",{},[t("div",{class:"dl-toolbar"},[this.tabs]),this.list]),this.paint()}actions(){let e=()=>this.kind==="all"?"":this.kind,o=a=>()=>{let i=this.filtered().reverse();Qe(this.st,i.filter(l=>l.ev).map(l=>l.ev),a,e(),i.filter(l=>l.sys).map(l=>l.sys))},s=A([v("download"),` ${_("Export")}`],()=>Se(s,[{label:_("CSV (spreadsheet)"),icon:v("download"),run:o("csv")},{label:"JSON",icon:v("download"),run:o("json")}])),r=A([v("trash"),` ${_("Clear")}`],()=>lt(_("Clear the log"),_("Removes events from the log on the router."),{},()=>this.reload(),this.kind==="all"?void 0:this.kind,!0));return[s,r]}take(e){this.events=e.events,this.policy=e.policy;let o=Nt.filter(r=>!e.policy.categories.includes(r)),s=bn(e.policy);this.sub=o.length?`${s} ${m(_("Not recorded: %s."),o.map(r=>Ye(r).toLowerCase()).join(", "))}`:s}async reload(){let[e,o]=await Promise.all([N.events(2e4).catch(()=>null),N.serviceLog().catch(()=>null)]);e&&this.take(e),o&&(this.system=o.log),this.paint()}items(){return[...this.events.map(e=>({ts:e.ts,ev:e})),...this.system.map(e=>({ts:e.ts,sys:e}))].sort((e,o)=>o.ts-e.ts)}matches(e,o){return o==="all"?!0:o==="problems"?vn(e):o==="system"?!!e.sys:!!e.ev&&qt(e.ev.type)===o}filtered(){return this.items().filter(e=>this.matches(e,this.kind))}paintTabs(e){dom.content(this.tabs,Rl.map(o=>t("button",{type:"button",role:"tab",class:o===this.kind?"on":"","aria-selected":o===this.kind?"true":"false",click:()=>this.show(o)},[o==="all"?_("All"):o==="system"?_("System"):Ye(o),t("b",{},String(e.filter(s=>this.matches(s,o)).length))])))}show(e){this.kind=e,this.shown=Fn,this.paint()}paint(){this.paintTabs(this.items());let e=this.filtered();if(!e.length){dom.content(this.list,t("div",{class:"dl-empty"},[t("p",{},this.events.length||this.system.length?_("No events match."):_("The log is empty."))]));return}let o=[],s="",r=null;for(let a of e.slice(0,this.shown)){let i=Pr(a.ts);i!==s&&(s=i,r=t("div",{class:"dl-panel flush"},t("div",{class:"dl-panel-head pad"},t("h3",{},i))),o.push(r));let l=new Date(a.ts*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});if(a.sys){let d=`${a.sys.ts}|${a.sys.msg}`;r.appendChild(Hn(a.sys,this.open.has(d),()=>{this.open.delete(d)||this.open.add(d),this.paint()},l))}else r.appendChild(ht(this.st,a.ev,{time:l}))}e.length>this.shown&&o.push(t("div",{class:"dl-more-row"},A(m(_("Show %s more of %s"),K(Math.min(Fn,e.length-this.shown)),K(e.length-this.shown)),()=>{this.shown+=Fn,this.paint()}))),dom.content(this.list,o)}};var Il=["health","log"],Bl=n=>n==="log"?_("Log"):_("Health"),Oo=2e4,Yn=class{constructor(){this.tab=new URLSearchParams(location.search).get("tab")==="log"?"log":"health";this.segEl=t("div",{class:"dl-seg dl-srvsections dl-diag-tabs",role:"tablist","aria-label":_("Diagnostics")});this.subEl=t("span",{class:"dl-muted"});this.actionsEl=t("div",{class:"dl-row-actions"});this.bodyEl=t("div",{});this.eventsAt=0}load(){return this.eventsAt=Date.now(),Promise.all([N.status(1),N.events(Oo),N.serviceLog()])}render([e,o,s]){return this.log=new Kn(e,o,s.log),this.health=new qn(e,s,o.events,()=>{this.show("log"),this.log.show("problems")}),this.show(this.tab),pt({fetch:async()=>{let r=this.tab==="log",[a,i]=await Promise.all([N.serviceLog().catch(()=>null),r?N.events(Oo).catch(()=>null):Promise.resolve(null)]);return a||i?{n:a,e:i}:null},every:10,active:()=>this.bodyEl.isConnected,apply:({n:r,e:a})=>this.take(r,a)}),t("div",{},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Diagnostics")),this.subEl]),this.actionsEl]),this.segEl,this.bodyEl])}take(e,o){o&&(this.log.take(o),this.eventsAt=Date.now()),e&&(this.log.system=e.log),e&&this.health.paintLive(e,o?.events??this.health.events),this.tab==="log"&&this.log.paint()}show(e){this.tab=e,dom.content(this.segEl,Il.map(o=>t("button",{type:"button",role:"tab",class:o===e?"on":"","aria-selected":o===e?"true":"false",click:()=>o!==this.tab&&this.show(o)},Bl(o)))),this.bodyEl.replaceChildren(e==="log"?this.log.el:this.health.el),this.subEl.textContent=e==="log"?this.log.sub:_("Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own."),dom.content(this.actionsEl,e==="log"?this.log.actions():""),e==="log"?(this.log.paint(),Date.now()-this.eventsAt>1e4&&N.events(Oo).then(o=>this.take(null,o)).catch(()=>null)):this.health.checks||this.health.run()}};var ba=":root{--dl-card: var(--panel-bg, var(--background-color-high, transparent));--dl-elevated: var(--elevated, var(--background-color-high, Canvas));--dl-line: var(--border, var(--border-color-medium, color-mix(in srgb, currentColor 14%, transparent)));--dl-soft: var(--muted, color-mix(in srgb, currentColor 5%, transparent));--dl-soft-hover: var(--soft-hover, color-mix(in srgb, currentColor 10%, transparent));--dl-fg: var(--foreground, var(--text-color-highest, inherit));--dl-fg-muted: var(--muted-foreground, color-mix(in srgb, currentColor 65%, transparent));--dl-fg-faint: var(--text-tertiary, color-mix(in srgb, currentColor 50%, transparent));--dl-accent: var(--accent, #3a83f7);--dl-ok: var(--success, #00a240);--dl-warn: var(--warning, #e25507);--dl-bad: var(--danger, #e02e2a);--dl-ok-wash: var(--success-a15, color-mix(in srgb, #00a240 15%, transparent));--dl-warn-wash: var(--warning-a15, color-mix(in srgb, #e25507 15%, transparent));--dl-bad-wash: var(--destructive-a15, color-mix(in srgb, #e02e2a 15%, transparent));--dl-info-wash: var(--info-a15, color-mix(in srgb, #3a83f7 15%, transparent));--dl-info: var(--info, #2c67c5);--dl-track: var(--foreground-a10, color-mix(in srgb, currentColor 10%, transparent));--dl-chart-1: var(--chart-blue, #3a83f7);--dl-chart-2: var(--chart-green, #00a240);--dl-ring: var(--ring, #3a83f7);--dl-primary: var(--primary, #0d0d0d);--dl-primary-fg: var(--primary-foreground, #fff);--dl-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--dl-shadow: var(--shadow-sm, none);--dl-radius: 16px}.dl-root,.dl-modal{cursor:default}:is(.dl-root,.dl-modal) :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,[contenteditable=true]){cursor:text}.dl-icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.dl-icon{width:16px;height:16px}.dl-icon-btn{display:inline-flex!important;align-items:center;gap:6px}.dl-muted{color:var(--dl-fg-muted)}.dl-faint,.dl-sep{color:var(--dl-fg-faint)}.dl-nowrap{white-space:nowrap}.dl-mono{font-family:var(--dl-mono);font-size:13px}.dl-spacer{flex:1}.dl-pill{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:999px;font-size:12px;line-height:20px;font-weight:500;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-pill.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-pill.accent{background:var(--dl-info-wash);color:var(--dl-info)}.dl-pill.off{opacity:.75}.dl-panel{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:16px;margin:0 0 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 12px}.dl-panel-head h3{margin:0!important;padding:0;font-size:16px;line-height:24px;font-weight:500;border:0;background:none}.dl-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:0 0 16px}.dl-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-tile-label{font-size:12px;line-height:16px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile-value{font-size:24px;line-height:32px;font-weight:500;margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}.dl-tile-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dl-grid2{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:0 16px}@media(max-width:960px){.dl-grid2{grid-template-columns:minmax(0,1fr)}}.dl-chart{display:block;width:100%;height:120px}.dl-bar-down{fill:var(--dl-chart-1)}.dl-bar-up{fill:var(--dl-chart-2);opacity:.8}.dl-legend{display:flex;gap:16px;font-size:12px;color:var(--dl-fg-muted);margin-top:8px}.dl-legend i{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:6px;vertical-align:0}.dl-legend .down{background:var(--dl-chart-1)}.dl-legend .up{background:var(--dl-chart-2)}.dl-events{list-style:none;margin:0;padding:0}.dl-events li{display:flex;gap:12px;align-items:baseline;padding:8px 0;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-events li:first-child{border-top:0;padding-top:0}.dl-ev-time{flex:0 0 88px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}.dl-ev-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);transform:translateY(-2px)}.dl-ev-dot.ok{background:var(--dl-ok)}.dl-ev-dot.warn{background:var(--dl-warn)}.dl-ev-dot.bad{background:var(--dl-bad)}.dl-ev-dot.accent{background:var(--dl-accent)}.dl-row>.dl-ev-dot,.dl-dev-log-row>.dl-ev-dot{margin:0 4px}.dl-ev-tile{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-2px -4px;border-radius:7px;background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent);align-self:center}.dl-ev-tile .dl-icon-wrap{display:inline-flex}.dl-ev-tile .dl-icon{width:14px;height:14px}.dl-row.dl-ev-by-admin{background:color-mix(in srgb,var(--dl-accent) 6%,transparent)}.dl-you{color:var(--dl-accent);font-weight:500}.dl-ev-kind{color:var(--dl-fg-faint)}.dl-slotbar{display:flex;align-items:center;gap:8px;margin:8px 0 0 44px}.dl-slotbar-segs{display:flex;gap:3px;flex:none;max-width:100%}.dl-slotbar-segs i{flex:1;min-width:2px;display:block;height:4px;border-radius:2px;background:var(--dl-soft-hover)}.dl-slotbar-segs i.used{background:var(--dl-fg-muted)}.dl-slotbar-text{font-size:12px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums}.dl-slotbar-segs i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-ev-srv{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-ev-by-system{--sys: var(--dl-fg-muted)}.dl-ev-by-system.ok{--sys: var(--dl-ok)}.dl-ev-by-system.warn{--sys: var(--dl-warn)}.dl-ev-by-system.bad{--sys: var(--dl-bad)}.dl-ev-tile.ev{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-ev-tile.ev.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-ev-tile.ev.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ev-tile.ev.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-ev-tile.ev.accent{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ev-tile.sys{background:color-mix(in srgb,var(--sys) 16%,transparent);color:var(--sys)}.dl-row.dl-ev-by-system{background:color-mix(in srgb,var(--sys) 6%,transparent)}.dl-sys-src{color:var(--sys)}.dl-ev-by-system:not(.ok):not(.warn):not(.bad) .dl-sys-src{color:var(--dl-fg)}.dl-ev-text{min-width:0;overflow-wrap:anywhere}.dl-server{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-server-name{font-size:16px;line-height:24px;font-weight:500}.dl-kv{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 24px;margin:12px 0 0;font-size:14px;line-height:20px}.dl-kv dt{color:var(--dl-fg-muted);font-weight:400;margin:0}.dl-kv dd{margin:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}";var xa='.dl-plist{display:block}.dl-plist>.dl-card{display:block;margin:0 0 12px;padding:16px;min-width:0;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);box-shadow:var(--dl-shadow)}.dl-plist>.dl-card.dl-filtered{display:none}.dl-plist>.dl-card.dl-off :is(.dl-card-name,.dl-avatar,.dl-access,.dl-slotbar,.dl-chips,.dl-pill-ic,.dl-use-num,.dl-pside-foot,.dl-pside-state){opacity:.45}.dl-plist>.dl-card.dl-off .dl-usebar i{background:var(--dl-fg-faint)}.dl-plist>.dl-card.dl-off .dl-chip-tag{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pcard:has(>.dl-pstrip){row-gap:14px}.dl-pstrip{grid-column:1 / -1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 -16px -16px;padding:10px 16px;border-top:1px solid var(--dl-line);border-radius:0 0 var(--dl-radius) var(--dl-radius);font-size:14px;line-height:20px}.dl-pstrip.warn{background:color-mix(in srgb,var(--dl-warn) 7%,transparent)}.dl-pstrip.bad{background:color-mix(in srgb,var(--dl-bad) 7%,transparent)}.dl-pstrip-text{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}.dl-pstrip-text b{font-weight:500}.dl-pstrip>.cbi-button{flex:none;height:32px!important}.dl-plist-none{color:var(--dl-fg-muted);text-align:center;padding:28px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-card-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px}.dl-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--dl-fg);background:var(--dl-soft);position:relative;margin-right:4px;letter-spacing:.02em}.dl-avatar.online:after{content:"";position:absolute;right:-1px;bottom:-1px;width:9px;height:9px;border-radius:50%;background:var(--dl-ok);box-shadow:0 0 0 2px var(--dl-card)}.dl-card-name{font-size:16px;line-height:24px;font-weight:500}.dl-card-slug{font-size:13px;color:var(--dl-fg-faint);font-family:var(--dl-mono)}.dl-quota{margin:8px 0 0 44px;max-width:320px;height:6px;border-radius:999px;background:var(--dl-track);overflow:hidden}.dl-quota>i{display:block;height:100%;background:var(--dl-accent);border-radius:999px}.dl-quota.warn>i{background:var(--dl-warn)}.dl-quota.bad>i{background:var(--dl-bad)}.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0 44px}.dl-chip{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;max-width:240px;height:28px;padding:0 12px 0 10px;border-radius:999px;font-size:13px;background:var(--dl-soft);color:var(--dl-fg);transition:background .15s}.dl-chip:hover{background:var(--dl-soft-hover)}.dl-chip:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-chip .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-chip.add{background:transparent;border:1px dashed color-mix(in srgb,var(--dl-fg) 28%,transparent);color:var(--dl-fg-muted)}.dl-chip.add:hover{background:var(--dl-soft);color:var(--dl-fg);border-color:color-mix(in srgb,var(--dl-fg) 45%,transparent)}.dl-chip.add:hover .dl-icon{color:var(--dl-fg)}.dl-chip.disabled .dl-chip-name{text-decoration:line-through;color:var(--dl-fg-faint)}.dl-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);opacity:.6}.dl-dot.online{background:var(--dl-ok);opacity:1;box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-empty{text-align:center;padding:40px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-empty .dl-icon-wrap{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);margin-bottom:12px}.dl-empty .dl-icon{width:20px;height:20px}.dl-empty h3{margin:0 0 4px!important;font-size:16px;font-weight:500}.dl-empty p{margin:0 0 16px;color:var(--dl-fg-muted);font-size:14px}.dl-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 16px}.dl-toolbar .dl-muted{font-size:13px}@media(max-width:640px){.dl-slotbar,.dl-chips,.dl-quota{margin-left:0}.dl-btn-label{display:none}}.cbi-value.dl-block{display:block!important}.cbi-value.dl-block>.cbi-value-title{display:block;width:auto;float:none;text-align:left;padding:0 0 8px}.cbi-value.dl-block>.cbi-value-field{display:block;width:100%;margin:0}.dl-people-find{width:160px;min-width:0}.dl-people-find[hidden]{display:none}';var wa="#modal_overlay{z-index:1100!important}.dl-dd{position:fixed;z-index:1200;min-width:200px;padding:4px;border-radius:12px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:0 12px 32px #0000004d;display:flex;flex-direction:column}.dl-dd button{all:unset;cursor:pointer;display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:8px;font-size:13px;color:var(--dl-fg)}.dl-dd button .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-dd button:hover,.dl-dd button:focus-visible{background:var(--dl-soft)}.dl-dd button.danger,.dl-dd button.danger .dl-icon{color:var(--dl-bad, #e5484d)}.dl-dd button.warn,.dl-dd button.warn .dl-icon{color:var(--dl-warn)}.dl-dd hr{border:0;border-top:1px solid var(--dl-line);margin:4px 0}.dl-chipbtn b{font-weight:500;font-size:11px;margin-left:6px;opacity:.6}.dl-setsub{margin:20px 0 8px!important;font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-row-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dl-more-row{display:flex;justify-content:center;padding:8px 0 16px}.dl-dsec-actions{display:flex;align-items:center;gap:12px}.dl-kv-act{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}.dl-linkbtn,.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;margin:-4px -6px;border-radius:8px;font-size:12px;font-weight:500;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap;transition:background .12s,color .12s}.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{color:var(--dl-accent)}.dl-linkbtn:hover,.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:var(--dl-soft);color:var(--dl-fg);text-decoration:none!important}.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-linkbtn:focus-visible,.dl-bento-head a:focus-visible,.dl-bento-foot a:focus-visible,.dl-panel-head a:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-linkbtn.danger:hover{color:var(--dl-bad);background:var(--dl-bad-wash)}.dl-ifcards{display:flex;flex-direction:column;gap:20px;margin:24px 0}.dl-ifcard .dl-setsec-body{gap:14px}.dl-iflead{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-iflead b{font-size:14px;font-weight:500}.dl-ifgroup h4{margin:0 0 8px!important;padding:0!important;font-size:11px!important;font-weight:500!important;letter-spacing:.06em;text-transform:uppercase;color:var(--dl-fg-muted);border:0!important;background:none!important}.dl-ifgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.dl-if{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 12px 8px 10px;min-width:0;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);transition:background .15s,border-color .15s}.dl-if:hover{background:var(--dl-soft)}.dl-if:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-if-ic{width:30px;height:30px;border-radius:8px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-if-ic .dl-icon{width:16px;height:16px}.dl-if-main{display:flex;flex-direction:column;min-width:0;flex:1}.dl-if-name{font-size:13.5px;font-weight:500;color:var(--dl-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if-sub{font:11px/16px var(--dl-mono);color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if.sel{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 9%,transparent)}.dl-if.sel .dl-if-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-if-check{color:var(--dl-accent);display:inline-flex}.dl-if-check .dl-icon{width:16px;height:16px}.dl-if.auto{border-color:color-mix(in srgb,var(--dl-ok) 55%,transparent);background:var(--dl-ok-wash);cursor:default}.dl-if.auto .dl-if-ic{background:color-mix(in srgb,var(--dl-ok) 18%,transparent);color:var(--dl-ok)}.dl-if-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;flex:0 0 auto}.dl-if-badge.ok{color:var(--dl-ok)}.dl-if.off{cursor:default;opacity:.5}.dl-if.off:hover{background:var(--dl-card)}.dl-if.warn{border-color:color-mix(in srgb,var(--dl-warn) 60%,transparent)}.dl-if-wanctl{gap:10px;align-items:center}.dl-if-wanctl select{max-width:240px}.dl-if-summary{min-width:0;line-height:18px}.dl-warn{color:var(--dl-warn)}.dl-w-ip{width:160px}.dl-dnspick{padding-top:8px;border-top:1px solid var(--dl-line)}.dl-dnspick .dl-row-actions{gap:10px}.dl-note{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;font-size:12.5px;line-height:18px;margin:0 0 10px;background:var(--dl-soft)}.dl-note.warn{background:var(--dl-warn-wash, color-mix(in srgb, var(--dl-warn) 14%, transparent))}.dl-note .dl-icon{width:15px;height:15px;flex:0 0 auto;margin-top:1px;color:var(--dl-warn)}.dl-stale{align-self:flex-start;margin-top:4px;font-size:10.5px}.dl-root .cbi-button.dl-btn-warn,.dl-btn-warn.cbi-button{background:var(--dl-warn-wash)!important;color:var(--dl-warn)!important;border-color:color-mix(in srgb,var(--dl-warn) 35%,transparent)!important}.dl-root .cbi-button.dl-btn-warn:hover,.dl-btn-warn.cbi-button:hover{background:color-mix(in srgb,var(--dl-warn) 24%,transparent)!important}.dl-btn-warn .dl-icon{color:var(--dl-warn)}.dl-srvtabs{display:flex;flex-wrap:wrap;gap:6px;padding:4px;margin:0 0 20px;border-radius:12px;background:var(--dl-soft);width:fit-content;max-width:100%}.dl-srvtab{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:9px;font-size:13px;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap}.dl-srvtab b{font-weight:500}.dl-srvtab i.dot{width:7px;height:7px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-srvtab i.dot.ok{background:var(--dl-ok);animation:dl-srv-pulse 2s ease-out infinite}.dl-srvtab i.dot.bad{background:var(--dl-bad)}.dl-srvtab i.dot.warn{background:var(--dl-warn)}@keyframes dl-srv-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--dl-ok) 55%,transparent)}70%,to{box-shadow:0 0 0 6px transparent}}@media(prefers-reduced-motion:reduce){.dl-srvtab i.dot.ok{animation:none}}.dl-srvtab:hover{color:var(--dl-fg);background:var(--dl-soft-hover)}.dl-srvtab.on{background:var(--dl-card);color:var(--dl-fg);box-shadow:0 1px 2px #0000002e,inset 0 0 0 1px var(--dl-line)}.dl-srvtab:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-srvtab.add{color:var(--dl-fg-muted)}.dl-srvtab.add .dl-icon{width:14px;height:14px}.dl-srvhead{display:flex;flex-direction:column;gap:14px;margin:0 0 20px}.dl-srvhead .dl-title-row{display:flex;align-items:center;gap:10px}.dl-srvhead .dl-h1{margin:0!important}.dl-metrics.compact .dl-metric{padding:14px 18px}.dl-metrics.compact .dl-metric-value{display:flex;align-items:center;gap:6px;font-size:18px;line-height:26px;min-width:0}.dl-metrics.compact .dl-metric-value>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-metrics.compact .dl-metric-value .dl-mono{font-size:15px}.dl-metrics.compact .cbi-button{flex:0 0 auto}.dl-srvsections{margin:0 0 16px}.dl-srvbody>.dl-setsec,.dl-srvbody>.dl-ifcards{margin:0}.dl-srvbody .dl-ifcards{margin:0}.dl-metric-ic{display:inline-flex;align-items:center;gap:8px;font-size:16px}.dl-metric-ic .dl-icon{width:18px;height:18px;color:var(--dl-accent)}.dl-keyrow{display:inline-flex;align-items:center;gap:8px;min-width:0}.dl-keyrow code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:none;padding:0}.dl-params{border:1px solid var(--dl-line);border-radius:12px;background:var(--dl-card)}.dl-params>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;color:var(--dl-fg);user-select:none}.dl-params>summary::-webkit-details-marker{display:none}.dl-params>summary>.dl-icon-wrap{display:inline-flex;color:var(--dl-fg-muted);transition:transform .15s}.dl-params>summary>.dl-icon-wrap .dl-icon{width:15px;height:15px}.dl-params[open]>summary>.dl-icon-wrap{transform:rotate(90deg)}.dl-params>summary:focus{outline:none}.dl-params>summary:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px;border-radius:12px}.dl-params>summary:hover{background:var(--dl-soft);border-radius:12px}.dl-pcount{font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;padding:4px 14px 14px}.dl-pgroup{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-pgroup-head{display:flex;align-items:center;gap:8px;font-size:13px}.dl-pgroup-head b{font-weight:500}.dl-pgroup-head .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-pgroup p{margin:0!important;font-size:12px;line-height:17px;color:var(--dl-fg-muted)}.dl-pvals{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.dl-pv{display:inline-flex;align-items:stretch;max-width:100%;border-radius:6px;overflow:hidden;font:500 11.5px/22px var(--dl-mono);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pv i{font-style:normal;padding:0 6px;background:var(--dl-card);color:var(--dl-fg-faint)}.dl-pv b{font-weight:500;padding:0 7px;color:var(--dl-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}";var ya=".dl-methods{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.dl-method{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;border:1px solid var(--dl-line);background:var(--dl-card);transition:border-color .15s,background .15s;min-width:0}.dl-method:hover{background:var(--dl-soft)}.dl-method:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-method.on{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 8%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-method.off{cursor:not-allowed;opacity:.55}.dl-method.off:hover{background:var(--dl-card)}.dl-method-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-method-head .dl-pill{flex:none}.dl-method-head b{font-weight:500;font-size:14.5px;flex:1}.dl-method-ic{width:32px;height:32px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);flex:0 0 auto}.dl-method-ic .dl-icon{width:17px;height:17px}.dl-method.on .dl-method-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-method p{margin:0!important;font-size:12.5px;line-height:18px;color:var(--dl-fg-muted);flex:1}.dl-method-meters{display:flex;gap:16px}.dl-dots{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-dots-row{display:inline-flex;gap:3px}.dl-dots-row i{width:6px;height:6px;border-radius:50%;background:var(--dl-line)}.dl-dots-row i.on{background:var(--dl-fg-muted)}.dl-method.on .dl-dots-row i.on{background:var(--dl-accent)}.dl-method-foot{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dl-fg-faint);padding-top:8px;border-top:1px solid var(--dl-line)}.dl-method-foot .dl-icon{width:13px;height:13px;flex:0 0 auto}.dl-method.off .dl-method-foot{color:var(--dl-warn)}.dl-ibadge{display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);flex:0 0 auto}.dl-ibadge .dl-icon{width:13px;height:13px}.dl-ibadge.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ibadge.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-access{display:inline-flex;gap:4px;flex:0 0 auto}.dl-ibadge.lan{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ibadge.inet{background:var(--dl-ok-wash);color:var(--dl-ok)}";var ka=".dl-addrbar{display:inline-flex;align-items:stretch;flex-wrap:nowrap;max-width:100%;margin-top:4px;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);overflow:hidden}.dl-addrbar-seg{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;padding:6px 12px;font-size:13px;color:var(--dl-fg-muted);border-left:1px solid var(--dl-line);white-space:nowrap;min-width:0}.dl-addrbar-seg:first-child{border-left:0}.dl-addrbar-seg .dl-icon{width:14px;height:14px;color:var(--dl-fg-faint);flex:0 0 auto}.dl-addrbar-seg .dl-mono{font-size:12.5px}.dl-addrbar-seg.main{cursor:pointer;color:var(--dl-fg)}.dl-addrbar-seg.main:hover{background:var(--dl-soft)}.dl-addrbar-seg.main:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-addrbar-seg.main>.dl-icon-wrap:last-child .dl-icon{opacity:.7}.dl-bento{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:10px;margin:0 0 20px}.dl-person-devices{margin-bottom:16px}.dl-person-head{display:flex;flex-direction:column;margin:0 0 20px}.dl-person-head>.dl-pagehead{margin-bottom:0;align-items:flex-start}.dl-pnote{all:unset;box-sizing:border-box;cursor:pointer;align-self:flex-start;display:inline-flex;align-items:flex-start;gap:6px;margin:10px 0 0 62px;max-width:60ch;padding:6px 12px 6px 10px;border-radius:10px;font-size:13px;line-height:18px;white-space:pre-line;background:var(--dl-soft);color:var(--dl-fg);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pnote:hover{background:var(--dl-soft-hover)}.dl-pnote .dl-icon{width:14px;height:14px;flex:none;margin-top:2px;color:var(--dl-fg-muted)}.dl-note-input{width:100%;box-sizing:border-box;min-height:80px;resize:vertical}.dl-dcard-trend{display:flex;align-items:flex-end;gap:12px;min-width:0}.dl-dcard-trend>.dl-stack{flex:none}.dl-dcard-trend b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dbars{flex:1;min-width:0;height:32px;display:flex;align-items:flex-end;gap:2px}.dl-dbars i{flex:1;min-width:0;border-radius:2px;background:var(--dl-chart-1);opacity:.55}.dl-dbars i.zero{background:var(--dl-track);opacity:1}.dl-dbars i.hi{opacity:1}.dl-dbars i:hover{opacity:1;filter:brightness(1.2)}.dl-datechip{position:relative;display:inline-flex}.dl-date-hidden{position:absolute!important;left:0;bottom:0;width:1px!important;min-width:0!important;height:1px!important;opacity:0;pointer-events:none;border:0!important;padding:0!important;margin:0!important}.dl-chipbtn .dl-icon{width:13px;height:13px}.dl-chipbtn:has(.dl-icon){display:inline-flex;align-items:center;gap:5px}.dl-places{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--dl-line);border-radius:var(--dl-radius);background:var(--dl-card);font-size:14px}.dl-places>.dl-icon{width:18px;height:18px;color:var(--dl-fg-muted);flex:none}.dl-person-live{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.dl-person-live .dl-bento-head{flex-wrap:nowrap;white-space:nowrap;min-width:0}.dl-person-live .dl-bento-head>*{min-width:0;overflow:hidden;text-overflow:ellipsis}.dl-person-live .dl-bento-head>:first-child{flex:none}.dl-person-live.solo{grid-template-columns:minmax(0,1fr)}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child{flex-wrap:wrap;row-gap:2px}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child>.dl-sub{flex-basis:100%}.dl-person-live>.dl-bento-tile,.dl-person-live>.dl-bento-tile.month{grid-column:auto;grid-row:auto}@media(max-width:760px){.dl-person-live{grid-template-columns:minmax(0,1fr)}}.dl-bento-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:var(--dl-shadow)}.dl-bento-tile.month{grid-column:1 / -1}.dl-onl-count{font-size:13px;line-height:22px;min-width:22px;padding:0 8px;border-radius:999px;background:var(--dl-soft);text-align:center;font-weight:500;font-variant-numeric:tabular-nums}.dl-onl-count.none{color:var(--dl-fg-faint)}.dl-onl-row{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;min-width:0}.dl-onl-p{display:flex;flex-direction:column;align-items:center;gap:5px;width:104px;min-width:0;padding:6px 2px;border-radius:12px;color:var(--dl-fg)!important;text-decoration:none!important}.dl-onl-p:hover{background:var(--dl-soft)}.dl-onl-av{position:relative;width:42px;height:42px;border-radius:50%;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;box-shadow:0 0 0 2px var(--dl-ok)}.dl-onl-p.more .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line);color:var(--dl-fg-muted)}.dl-onl-dev{position:absolute;right:-6.5px;bottom:-6.5px;width:20px;height:20px;border-radius:8.5px;border:1.5px solid transparent;background:var(--dl-card);display:inline-flex;align-items:center;justify-content:center;font-size:10px;color:var(--dl-fg-muted)}.dl-onl-dev .dl-icon-wrap{display:inline-flex}.dl-onl-dev .dl-icon{width:12px;height:12px}.dl-onl-name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-p .dl-sub{font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-row.grid{flex-wrap:wrap;align-content:center;gap:10px 8px;max-height:108px;overflow:hidden}.dl-onl-p.sm{width:auto;padding:4px}.dl-onl-p:hover .dl-onl-dev{background:linear-gradient(var(--dl-soft),var(--dl-soft)),var(--dl-card)}.dl-onl-p.sm:hover{background:none}.dl-onl-p.sm:hover .dl-onl-dev{background:var(--dl-card)}.dl-onl-p.sm .dl-onl-av{transition:box-shadow .15s ease}.dl-onl-p.sm:hover .dl-onl-av{box-shadow:0 0 0 2px var(--dl-ok),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm.more:hover .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm .dl-onl-av{width:36px;height:36px;font-size:11.5px}.dl-onl-meta{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--dl-fg-faint);max-width:100%;white-space:nowrap;overflow:hidden}.dl-onl-meta .dl-icon-wrap{display:inline-flex}.dl-onl-meta .dl-icon{width:12px;height:12px}.dl-onl-av.sm{width:34px;height:34px;font-size:11.5px}.dl-tip-float:has(.dl-hc){padding:0;white-space:normal;border-radius:16px}.dl-hc{width:280px;padding:14px;display:flex;flex-direction:column;gap:10px}.dl-hc-head{display:flex;align-items:center;gap:10px}.dl-hc-head .dl-stack{flex:1;min-width:0}.dl-hc-head b{font-size:14px;font-weight:500}.dl-hc-since{font-size:11.5px;color:var(--dl-ok)}.dl-hc-reach{display:inline-flex;gap:4px}.dl-hc-speed{border-radius:12px;background:var(--dl-soft);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.dl-hc-speed-row{display:flex;align-items:baseline;gap:12px;font-size:13px;font-variant-numeric:tabular-nums}.dl-hc-chart{display:block;width:100%;height:30px}.dl-hc-chart .area{fill:color-mix(in srgb,var(--dl-chart-1) 16%,transparent)}.dl-hc-chart .dn{fill:none;stroke:var(--dl-chart-1);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-hc-chart .up{fill:none;stroke:var(--dl-ok);stroke-width:1.2;vector-effect:non-scaling-stroke}.dl-hc-devs{display:flex;flex-wrap:wrap;gap:6px}.dl-hc-dev{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:999px;background:var(--dl-soft);font-size:11.5px}.dl-hc-dev .dl-icon-wrap{display:inline-flex}.dl-hc-dev .dl-icon{width:12px;height:12px;color:var(--dl-fg-muted)}.dl-hc-foot{display:flex;align-items:center;gap:8px;font-size:11.5px}.dl-disg-id{display:flex;align-items:center;gap:10px}.dl-disg-id b{font-size:16px;font-weight:500}.dl-disg-ic{width:36px;height:36px;border-radius:11px;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-disg-ic .dl-icon-wrap{display:inline-flex}.dl-disg-ic .dl-icon{width:18px;height:18px}.dl-disg-ic.off{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-disg-meters{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:var(--dl-fg-muted)}.dl-segs{display:inline-flex;gap:3px}.dl-segs i{width:18px;height:5px;border-radius:3px;background:var(--dl-track)}.dl-segs.acc i.on{background:var(--dl-accent)}.dl-segs.ok i.on{background:var(--dl-ok)}.dl-disg-chips{margin-top:auto;display:flex;flex-wrap:wrap;gap:5px}.dl-disg-chips span{font:11px/20px var(--dl-mono);padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-onl-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;text-align:center}.dl-bento-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.dl-bento-head.start{justify-content:flex-start}.dl-bento-big{font-family:inherit;font-size:28px;line-height:34px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-bento-big small{font-size:13px;font-weight:400;color:var(--dl-fg-faint);letter-spacing:0}.dl-avstack{display:inline-flex}.dl-avstack .dl-avatar{margin-left:-7px;box-shadow:0 0 0 2px var(--dl-card)}.dl-avstack .dl-avatar:first-child{margin-left:0}.dl-avatar.more{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-bento-list{display:flex;flex-direction:column;gap:2px}.dl-bento-row{display:flex;align-items:center;gap:10px;padding:8px;margin:0 -8px;border-radius:10px;color:var(--dl-fg)!important;text-decoration:none!important;min-width:0;transition:background .12s}.dl-bento-row:hover{background:var(--dl-soft)}.dl-bento-row:hover b{text-decoration:none}.dl-bento-row:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-bento-row-main{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.dl-bento-row-main b{font-weight:500;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row-main .dl-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row.off b{color:var(--dl-fg-muted);font-weight:400}.dl-bento-row-val{display:flex;flex-direction:column;align-items:flex-end;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-bento-row-val small{font-size:11px;color:var(--dl-fg-faint)}.dl-bento-sep{font-size:11px;color:var(--dl-fg-faint);padding:12px 0 4px}.dl-bento-devs{display:inline-flex;gap:3px;color:var(--dl-fg-faint)}.dl-bento-devs .dl-icon{width:13px;height:13px}.dl-bento-devs .on{color:var(--dl-ok)}.dl-bento-foot{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:10px;border-top:1px solid var(--dl-line);color:var(--dl-fg)!important;text-decoration:none!important}.dl-bento-foot.split,.dl-bento-foot.end{justify-content:space-between}.dl-bento-foot.end>a:only-child{margin-left:auto}.dl-bento-empty{display:flex;align-items:center;gap:10px;padding:14px 0;font-size:13.5px;color:var(--dl-fg-muted)}.dl-bento-empty .dl-icon{width:18px;height:18px}.dl-split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--dl-soft)}.dl-split i{display:block;height:100%}.dl-split i.dn{background:var(--dl-accent)}.dl-split i.up{background:var(--dl-ok)}.dl-dn{color:var(--dl-accent)}.dl-up{color:var(--dl-ok)}.dl-bento-method{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:500}.dl-bento-method .dl-icon{width:20px;height:20px;color:var(--dl-accent)}.dl-meter{display:inline-flex;gap:3px}.dl-meter i{width:16px;height:4px;border-radius:2px;background:var(--dl-line)}.dl-meter i.on{background:var(--dl-accent)}.dl-bento-total{font-size:16px;font-weight:500;margin-left:8px}.dl-bento-bars{display:flex;align-items:flex-end;gap:3px;height:54px}.dl-bento-bars i{flex:1;min-width:0;border-radius:3px 3px 0 0;background:var(--dl-soft-hover);transition:background .15s}.dl-bento-bars i.future{height:4px;background:var(--dl-soft)}.dl-bento-bars i:hover{background:var(--dl-fg-faint)}.dl-bento-bars i.hi{background:var(--dl-accent)}@media(max-width:700px){.dl-addrbar{flex-wrap:wrap}}@media(max-width:900px){.dl-bento{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.dl-bento-tile.online{grid-column:span 2}}@media(max-width:560px){.dl-bento{grid-template-columns:minmax(0,1fr)}.dl-bento-tile.online,.dl-bento-tile.month{grid-column:auto}}.dl-srvpagehead{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:0 0 20px}.dl-srvpagehead>.dl-title-row{display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}.dl-srvpagehead .dl-actions{margin:0;flex-wrap:wrap}.dl-toolbar-end{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap;min-width:0}@media(max-width:640px){.dl-toolbar-end{flex-wrap:wrap;width:100%}}.dl-notices{margin:0 0 16px}.dl-notices .dl-need-row .dl-sub{overflow-wrap:anywhere}.dl-notices-more{font-size:13px;color:var(--dl-fg-muted);text-decoration:none}.dl-notices-more:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-speed-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dl-speed-col{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-speed-val{font-size:20px;line-height:26px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-speed-today{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;font-variant-numeric:tabular-nums}.dl-speed-today b{font-weight:500;color:var(--dl-fg)}.dl-speed-chart{display:block;width:100%;height:44px}.dl-speed-chart .area{fill:color-mix(in srgb,var(--dl-accent) 16%,transparent)}.dl-speed-chart .line{fill:none;stroke:var(--dl-accent);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-speed-chart .line.up{stroke:var(--dl-ok);stroke-width:1.2;opacity:.85}.dl-speed-wait{height:44px;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-speed-wait i{display:block;height:1px;background:var(--dl-line);order:2}.dl-speed-val.off{color:var(--dl-fg-faint)}.dl-fld{display:flex;flex-direction:column;gap:8px;margin:0 0 16px}.dl-fld-label{font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-fld .cbi-input-text{width:100%;box-sizing:border-box}.dl-kinds{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.dl-kinds button{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:68px;border-radius:10px;border:1px solid var(--dl-line);color:var(--dl-fg-muted);font-size:12px;font-weight:500;text-align:center;min-width:0}.dl-kinds button .dl-icon{width:20px;height:20px}.dl-kinds button:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-kinds button:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-kinds button.on{border-color:var(--dl-accent);color:var(--dl-fg);background:color-mix(in srgb,var(--dl-accent) 10%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-kinds button.on .dl-icon{color:var(--dl-accent)}.dl-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}.dl-choice{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line);transition:background .15s,box-shadow .15s}.dl-choice:hover{background:var(--dl-soft)}.dl-choice:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-choice.selected{box-shadow:inset 0 0 0 2px var(--dl-accent);background:var(--accent-a10, color-mix(in srgb, var(--dl-accent) 8%, transparent))}.dl-choice-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg)}.dl-choice-text{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-attn-item>.cbi-button{margin-left:auto;flex:none;align-self:center}";var _a='.dl-steps{display:flex;align-items:center;gap:8px;margin:0 0 16px;flex-wrap:wrap}.dl-step{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg-faint)}.dl-step b{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:50%;background:var(--dl-soft);font-size:12px;font-weight:600}.dl-step.current{color:var(--dl-fg)}.dl-step.current b{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-step.done{color:var(--dl-fg-muted)}.dl-step.done b{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-step+.dl-step:before{content:"";width:24px;height:1px;background:var(--dl-line)}.dl-wizard .dl-panel>div{display:flex;flex-direction:column;gap:16px}.dl-wizard .dl-panel>div>p{margin:0!important;color:var(--dl-fg-muted)}.dl-wizard .dl-panel>div>.cbi-value{margin:0}.dl-wizard h4{font-size:14px;font-weight:500;margin:8px 0 -6px!important}.dl-wizard h4:first-child{margin-top:0!important}.dl-modal .cbi-tabmenu{margin-bottom:16px}.dl-modal .cbi-value.dl-live>.cbi-value-title{display:flex;flex-direction:column;gap:2px;text-align:left}.dl-modal .cbi-value.dl-live>.cbi-value-title>.dl-sub{white-space:normal}.dl-checklist{display:flex;flex-direction:column;gap:6px;margin:4px 0 8px}.dl-checklist label{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}.dl-checklist input{margin:0}.dl-invite{display:grid;grid-template-columns:250px minmax(0,1fr);gap:22px;align-items:start}.dl-invite img{display:block;width:100%;border-radius:18px;box-shadow:0 0 0 1px var(--dl-line)}.dl-invite-side{display:flex;flex-direction:column;gap:14px;min-width:0}.dl-invite-side>p{margin:0!important}.dl-invite-link{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-width:0;padding:11px 14px;border-radius:12px;background:var(--dl-soft);font:13px/18px var(--dl-mono);color:var(--dl-fg)}.dl-invite-link>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-invite-link>.dl-icon-wrap{flex:none;display:inline-flex}.dl-invite-link .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted);flex:none}.dl-invite-link:hover{background:var(--dl-soft-hover)}.dl-invite-link.alt{padding:8px 14px;font-size:12px;color:var(--dl-fg-muted)}.dl-invite-link>.dl-pill{flex:none}.dl-invite-steps{margin:0;padding-left:20px;list-style:decimal!important;font-size:13px;line-height:24px;color:var(--dl-fg-muted)}.dl-invite-steps b{color:var(--dl-fg);font-weight:500}.dl-invite-steps li{display:list-item!important;list-style:inherit!important;padding-left:4px}.dl-invite-actions{display:flex;gap:8px;flex-wrap:wrap}.modal:has(.dl-modal.wide){max-width:min(760px,94vw)!important;width:100%!important}@media(max-width:640px){.dl-invite{grid-template-columns:minmax(0,1fr)}.dl-invite img{max-width:260px;margin:0 auto}}.dl-toasts{position:fixed;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translate(-50%);z-index:100000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}.dl-toast{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;max-width:min(520px,92vw);padding:10px 16px;border-radius:999px;background:var(--dl-fg);color:var(--dl-card);font-size:13px;line-height:18px;box-shadow:0 10px 30px #0000004d;opacity:0;transform:translateY(12px);transition:opacity .18s,transform .18s}.dl-toast.show{opacity:1;transform:none}.dl-toast .dl-icon-wrap{display:inline-flex}.dl-toast .dl-icon{width:15px;height:15px}.dl-toast.success .dl-icon{color:var(--dl-ok)}.dl-toast.error{background:var(--dl-bad);color:#fff}.dl-toast.error .dl-icon{color:#fff}.dl-toast.warning{background:var(--dl-warn);color:#111}.dl-toast.warning .dl-icon{color:#111}.dl-toast button{all:unset;cursor:pointer;display:inline-flex;margin-left:4px;opacity:.8}.dl-toast button:hover{opacity:1}';var Ca=".dl-setblock{display:flex;flex-direction:column;gap:8px;margin:0}.dl-addr-opts{display:flex;flex-direction:column;gap:6px}.dl-addr-opt{all:unset;box-sizing:border-box;cursor:pointer;display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 14px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line);min-width:0}.dl-addr-opt:hover{background:var(--dl-soft)}.dl-addr-opt.on{box-shadow:inset 0 0 0 1.5px var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 7%,transparent)}.dl-addr-opt .dl-mono{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-addr-opt .dl-stack{min-width:0}.dl-addr-opt input{width:100%}.dl-addr-opt.other{cursor:default}.dl-addr-opt.other:hover{background:none}.dl-addr-opt.other input{width:100%}.dl-addr-check{width:16px;height:16px;border-radius:5px;box-shadow:inset 0 0 0 1.5px var(--dl-fg-faint);display:inline-flex;align-items:center;justify-content:center}.dl-addr-check .dl-icon-wrap{display:inline-flex}.dl-addr-check .dl-icon{width:12px;height:12px}.dl-addr-opt.on .dl-addr-check{background:var(--dl-accent);box-shadow:none;color:#fff}.dl-addr-opt.other .dl-addr-check{box-shadow:none;color:var(--dl-fg-muted)}.dl-addr-warn{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:17px;color:var(--dl-warn)}.dl-addr-warn .dl-icon-wrap{display:inline-flex}.dl-addr-warn .dl-icon{width:13px;height:13px}.dl-pill.info{background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-links{border-radius:12px;background:var(--dl-soft);overflow:hidden}.dl-link-row{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 14px}.dl-link-row+.dl-link-row{border-top:1px solid var(--dl-line)}.dl-link-ic{display:inline-flex}.dl-link-ic .dl-icon{width:15px;height:15px}.dl-link-ic.ok .dl-icon{color:var(--dl-ok)}.dl-link-ic.warn .dl-icon{color:var(--dl-warn)}.dl-link-url{font-size:13px;color:var(--dl-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-link-url b{font-weight:500;color:var(--dl-accent)}@media(max-width:640px){.dl-link-url,.dl-addr-opt .dl-mono,.dl-filecard .dl-ellipsis,.dl-invite-link>span:first-child{white-space:normal;overflow-wrap:anywhere}}.dl-ready-sum{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px}.dl-ready-sum>.dl-icon-wrap{display:inline-flex}.dl-ready-sum>.dl-icon-wrap .dl-icon{width:18px;height:18px}.dl-ready-sum .dl-stack{flex:1;min-width:0}.dl-ready-sum b{font-weight:500;font-size:13px}.dl-ready-sum.ok{background:var(--dl-ok-wash)}.dl-ready-sum.ok b,.dl-ready-sum.ok .dl-icon{color:var(--dl-ok)}.dl-ready-sum.warn{background:var(--dl-warn-wash)}.dl-ready-sum.warn b,.dl-ready-sum.warn .dl-icon{color:var(--dl-warn)}.dl-ready-sum.error{background:var(--dl-bad-wash)}.dl-ready-sum.error b,.dl-ready-sum.error .dl-icon{color:var(--dl-bad)}.dl-check-chip{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;color:var(--dl-fg-muted)}.dl-check-chip .dl-icon-wrap{display:inline-flex}.dl-check-chip .dl-icon{width:13px;height:13px;color:var(--dl-ok)}.dl-check-chip.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-chip.warn .dl-icon{color:var(--dl-warn)}.dl-check-chip.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-ready-details{display:flex;flex-direction:column;gap:8px;padding:4px 2px}.dl-ready-details[hidden]{display:none}.dl-ready-item{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:18px;min-width:0}.dl-ready-item .dl-icon-wrap{display:inline-flex;margin-top:1px}.dl-ready-item .dl-icon{width:15px;height:15px}.dl-ready-item.ok .dl-icon{color:var(--dl-ok)}.dl-ready-item.warn .dl-icon{color:var(--dl-warn)}.dl-ready-item.error .dl-icon{color:var(--dl-bad)}.dl-params-body{display:flex;flex-direction:column;gap:14px;padding:6px 14px 14px}.dl-params-body>.dl-setrow{margin:0;padding:0}.dl-pgrid.flush{padding:0;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:640px){.dl-pgrid.flush{grid-template-columns:minmax(0,1fr)}}.dl-qr-pane{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.dl-qr{width:min(280px,72vw);aspect-ratio:1;background:#0a0a0a;border-radius:18px;overflow:hidden}.dl-qr.light{background:#fff;box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-qr svg{display:block;width:100%;height:100%}.dl-filecard{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--dl-soft);min-width:0}.dl-filecard>.dl-stack{flex:1;min-width:0}.dl-filecard-ic{width:40px;height:46px;border-radius:8px;flex:none;display:inline-flex;align-items:center;justify-content:center;font:10px var(--dl-mono);color:var(--dl-fg-muted);background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-params>.dl-conf{margin:0;border-top:1px solid var(--dl-line);border-radius:0 0 12px 12px;background:none}.dl-conf-sec{color:var(--dl-accent)}.dl-conf-k{color:var(--dl-fg-faint)}.dl-conf-mask{padding:0 6px;border-radius:4px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-params>summary .dl-chipbtn{height:26px;font-size:12px}.dl-conf{white-space:pre-wrap;word-break:break-all;max-height:22em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:0;padding:12px;border-radius:12px;background:var(--dl-soft)}.dl-key{width:100%;box-sizing:border-box;font-family:var(--dl-mono);font-size:12px;word-break:break-all;min-height:7em}.dl-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0 0}.dl-link-box{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.dl-link-box input{flex:1 1 18em;min-width:0;font-family:var(--dl-mono);font-size:12px}.dl-hint{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin:8px 0}.dl-divider{border:0;border-top:1px solid var(--dl-line);margin:16px 0}";var La=".dl-checks{list-style:none;margin:0;padding:0}.dl-checks li{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--dl-line)}.dl-checks li:first-child{border-top:0;padding-top:0}.dl-checks li:last-child{padding-bottom:0}.dl-check-icon{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.dl-check-icon .dl-icon{width:14px;height:14px}.dl-check-icon.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-check-icon.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-icon.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-icon.skip{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-check-body{flex:1;min-width:0}.dl-check-title{font-size:14px;line-height:20px;font-weight:500}.dl-check-detail{font-size:12px;line-height:16px;color:var(--dl-fg-muted);overflow-wrap:anywhere}.dl-check-repaired{margin-top:2px;font-size:12px;line-height:16px;color:var(--dl-warn)}.dl-wd{margin:0 0 16px;display:flex;flex-direction:column;gap:14px}.dl-wd-head{display:flex;align-items:center;gap:12px;min-width:0}.dl-wd-head>.dl-stack{min-width:0}.dl-wd-title{font-size:16px;line-height:24px;font-weight:500}.dl-wd-tile{flex:none;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-wd-tile.off{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-wd-tile .dl-icon{width:18px;height:18px}.dl-wd-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-wd-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto;min-width:0}.dl-wd-chips .dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-warn-text{color:var(--dl-warn)!important}.dl-health-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:16px;align-items:start}.dl-health-cols>.dl-panel{margin:0;min-width:0}.dl-recent{display:flex;flex-direction:column}.dl-recent .dl-panel-head a{font-size:13px}.dl-recent-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 16px;color:var(--dl-fg-muted);font-size:13px;border-top:1px solid var(--dl-line)}.dl-loading{margin:0;font-size:13px}.dl-diag-tabs{margin:0 0 16px}.dl-row.dl-slog-row{align-items:baseline}.dl-slog-row .dl-ev-tile{align-self:flex-start;margin-top:-1px}.dl-slog-row.has-detail{cursor:pointer}.dl-row.dl-slog-row.has-detail:hover{background:color-mix(in srgb,var(--sys) 11%,transparent)}.dl-slog-more{display:inline-flex;vertical-align:-2px;margin-left:6px;color:var(--dl-fg-faint);transform:rotate(90deg);transition:transform .15s}.dl-slog-more .dl-icon{width:14px;height:14px}.dl-slog-more.open{transform:rotate(-90deg)}.dl-slog-detail{margin:8px 0 2px;padding:8px 10px;border-radius:8px;background:var(--dl-soft);font-family:var(--dl-mono);font-size:12px;line-height:17px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dl-fg-muted);cursor:text}.dl-table{width:100%;border-collapse:collapse;font-size:14px;line-height:20px}.dl-table th{text-align:left;font-weight:500;color:var(--dl-fg-faint);padding:0 8px 8px;border-bottom:1px solid var(--dl-line)}.dl-table td{padding:10px 8px;border-bottom:1px solid var(--dl-line);vertical-align:middle}.dl-table th:first-child,.dl-table td:first-child{padding-left:0}.dl-table th:last-child,.dl-table td:last-child{padding-right:0}.dl-table tr:last-child td{border-bottom:0}.dl-table .dl-right{text-align:right;white-space:nowrap}.dl-log{max-height:18em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:8px 0 0;padding:12px;white-space:pre-wrap;border-radius:12px;background:var(--dl-soft)}";var Ma=".dl-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}.dl-h1{margin:0!important;padding:0!important;font-size:24px!important;line-height:32px!important;font-weight:500!important;border:0!important}.dl-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.dl-stack{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-stack.gap4{gap:4px}.dl-stack.gap8{gap:8px}.dl-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-ok{color:var(--dl-ok)}.dl-warn{color:var(--dl-warn)}.dl-bad{color:var(--dl-bad)}.dl-icon-only{width:auto!important;min-width:0!important;aspect-ratio:1 / 1;padding:0!important;justify-content:center;display:inline-flex!important;align-items:center;border-radius:999px!important}.dl-panel.flush{padding:0;overflow:hidden}.dl-panel-head.pad{padding:16px 16px 12px;margin:0}.dl-col{display:flex;flex-direction:column;gap:16px;min-width:0}.dl-col>.dl-panel,.dl-col>section.dl-panel{margin:0}.dl-crumbs{display:flex;gap:8px;align-items:center;font-size:14px;margin:0 0 16px;color:var(--dl-fg-faint)}.dl-crumbs a{color:var(--dl-fg-faint)}.dl-crumbs a:hover{color:var(--dl-fg)}.dl-crumbs span:last-child{color:var(--dl-fg)}.dl-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);margin:0 0 16px;box-shadow:var(--dl-shadow)}.dl-metric{display:flex;flex-direction:column;gap:4px;padding:16px 20px;min-width:0}.dl-metric+.dl-metric{border-left:1px solid var(--dl-line)}.dl-metric-label{font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-metric-value{font-size:28px;line-height:36px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-metric-value .dl-faint{font-size:16px}.dl-metric-sub{font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.dl-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dl-metric:nth-child(3){border-left:0}.dl-metric:nth-child(n+3){border-top:1px solid var(--dl-line)}}.dl-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--dl-soft);flex-wrap:wrap}.dl-seg button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500;color:var(--dl-fg-muted);white-space:nowrap}.dl-seg button:hover{color:var(--dl-fg)}.dl-seg button.on{background:var(--dl-soft-hover);color:var(--dl-fg)}.dl-seg.dl-srvsections{flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}.dl-seg.dl-srvsections::-webkit-scrollbar{display:none}.dl-seg.dl-srvsections button{flex:none;white-space:nowrap}.dl-seg button:focus-visible{outline:2px solid var(--dl-ring)}.dl-seg button b{font-weight:500;font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft)}.dl-seg button b.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-seg.sm button{padding:2px 9px;font-size:11px}.dl-seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-radius:12px;padding:4px}.dl-seg.wide button{flex-direction:column;justify-content:center;padding:8px 6px;border-radius:9px;gap:3px}.dl-seg.wide button.on{background:var(--dl-primary);color:var(--dl-primary-fg)}";var Ea=`.dl-geomap{position:relative;border-top:1px solid var(--dl-line);background:transparent}.dl-map-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);font-size:13px;z-index:1;pointer-events:none}.dl-map-wrap{position:relative}.dl-map-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:12px;align-items:center;padding:6px 12px;border-radius:999px;font-size:12px;background:color-mix(in srgb,var(--dl-card) 88%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);z-index:2}.dl-map-legend span{display:inline-flex;align-items:center;gap:6px;color:var(--dl-fg-muted)}.dl-map-legend i.line{width:14px;height:0;border-top:2px dashed #8a8a8a}.dl-map-legend i.line.live{border-top-color:#3b82f6}.dl-map-off{padding:32px 16px;text-align:center;color:var(--dl-fg-muted);border-top:1px solid var(--dl-line)}.dl-mk{all:unset;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;transition:opacity .2s}.dl-mk-hub{position:relative;display:flex;align-items:center;justify-content:center}.dl-mk-host{box-sizing:border-box;width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059}.dl-mk-host-tile{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:var(--dl-fg);color:var(--background, var(--dl-elevated))}.dl-mk-host-ic{width:14px;height:14px}.dl-mk-av{position:relative;box-sizing:border-box;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:500;line-height:1;border:2px solid #8a8a8a;background:var(--dl-elevated);color:var(--dl-fg-muted);transition:box-shadow .2s}.dl-mk.online .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-badge{position:absolute;left:16px;bottom:-6px;height:16px;min-width:16px;padding:0 3px;border-radius:8px;border:2px solid var(--dl-elevated);background:#6b6b6b;color:#fff;display:flex;align-items:center;justify-content:center;gap:1px;font-size:9px;font-weight:600;white-space:nowrap;box-sizing:content-box}.dl-mk.online .dl-mk-badge{background:#3b82f6}.dl-mk-badge-ic{width:10px;height:10px;stroke-width:2.2}.dl-mk-badge:has(>svg:only-child){width:16px;min-width:0;padding:0}.dl-mk-tile{position:relative;width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk.place.online .dl-mk-tile{background:#3b82f6;color:#fff;box-shadow:0 2px 8px #3b82f659}.dl-mk-tile-ic{width:14px;height:14px}.dl-mk-tile-n{position:absolute;right:-5px;top:-5px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dl-fg);color:var(--dl-elevated);font-size:9px;font-weight:600;line-height:14px;text-align:center}.dl-mk-when{display:block;text-align:center;color:var(--dl-fg-faint);font-weight:400}.dl-mk.place.online .dl-mk-when{color:#3b82f6}.dl-mk-tile.sm{width:18px;height:18px;border-radius:5px;font-size:9px;font-weight:600}.dl-dmap{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-dmap .dl-geomap{border-top:0}.dl-dplaces{display:flex;flex-direction:column;margin-top:4px}.dl-dplace-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid var(--dl-line);font-size:13px}.dl-dplace-row:first-child{border-top:0}.dl-dplace-n{flex:0 0 auto;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-dplace-n.live{background:#3b82f6;color:#fff}.dl-dplace-n .dl-icon{width:12px;height:12px}.dl-dplace-now{color:#3b82f6}.dl-dplaces.strips .dl-dplace-row{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr) auto;column-gap:10px;row-gap:9px;margin:0 -10px;padding:11px 10px;border-top:0;border-radius:10px;transition:background .15s}.dl-dplaces.strips .dl-dplace-row+.dl-dplace-row:before{content:"";position:absolute;left:10px;right:10px;top:0;height:1px;background:var(--dl-line)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur){background:var(--dl-soft)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur):before,.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur)+.dl-dplace-row:before{opacity:0}.dl-dplace-strip{grid-column:2 / 4;position:relative;height:6px;border-radius:3px;background:var(--dl-track)}.dl-dplaces.can-replay .dl-dplace-strip{cursor:ew-resize;touch-action:none}.dl-dplace-strip i{position:absolute;top:0;bottom:0;min-width:2px;border-radius:2px;background:#8a8a8a}.dl-dplace-strip.live i{background:#3b82f6}.dl-dplaces.replay .dl-dplace-strip:after{content:"";position:absolute;left:var(--at);top:-4px;bottom:-4px;width:2px;margin-left:-1px;border-radius:1px;background:var(--dl-fg);box-shadow:0 0 0 2px var(--dialog-bg, var(--dl-elevated));pointer-events:none}.dl-dplace-axis{position:relative;height:16px;margin:4px 0 0 30px;font-size:11px;line-height:16px;color:var(--dl-fg-faint)}.dl-dplace-axis span{position:absolute;top:0;transform:translate(-50%);white-space:nowrap}.dl-dmap{position:relative}.dl-map-replay{position:absolute;left:10px;top:10px;z-index:3;display:flex;align-items:center;gap:6px}.dl-map-btn{all:unset;box-sizing:border-box;cursor:pointer;width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg)}.dl-map-btn:hover{background:color-mix(in srgb,var(--dl-fg) 8%,var(--dl-elevated))}.dl-map-btn:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-btn .dl-icon{width:13px;height:13px}.dl-map-chip{display:inline-flex;align-items:center;height:28px;box-sizing:border-box;padding:0 10px;border-radius:8px;font-size:11.5px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg);font-variant-numeric:tabular-nums}.dl-mk.step .dl-mk-tile{transition:width .3s cubic-bezier(.2,.8,.2,1),height .3s cubic-bezier(.2,.8,.2,1),border-radius .3s,background-color .3s,color .3s,box-shadow .3s,transform .24s}.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic{width:11px;height:11px}.dl-mk.step.faded>*{opacity:.5}.dl-mk.step:is(.online,.hl){z-index:2}.dl-mk.step.hl .dl-mk-tile{box-shadow:0 0 0 3px color-mix(in srgb,#3b82f6 55%,transparent)}.dl-mk.step.arrive .dl-mk-tile{animation:dl-mk-arrive .45s cubic-bezier(.2,.8,.2,1)}@keyframes dl-mk-arrive{0%{transform:scale(.8)}55%{transform:scale(1.12)}to{transform:scale(1)}}.dl-mk-when.inline{display:inline}.dl-mk>*{transition:opacity .15s;opacity:var(--dl-mk-fade, 1)}.dl-mk.merged,.dl-mk.piled{pointer-events:none}.dl-mk.dl-mk-new>*{transition:none}.dl-mk.merged>*,.dl-mk.piled>*{opacity:0}.dl-mk-hub{cursor:default}.dl-mk-host{position:relative}.dl-mk-host{transition:border-radius .22s ease,border-right-color .22s ease}.dl-mk-host.docked{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}.dl-mk-dock{position:absolute;left:100%;top:-1px;height:40px;box-sizing:border-box;display:flex;align-items:center;gap:6px;padding:0 10px 0 2px;border:1px solid var(--dl-line);border-left:0;border-radius:0 11px 11px 0;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;pointer-events:none;opacity:0;clip-path:inset(-24px 100% -24px 0);transition:clip-path .28s cubic-bezier(.2,.8,.2,1),opacity .2s ease}.dl-mk-host.docked .dl-mk-dock{pointer-events:auto;opacity:1;clip-path:inset(-24px -24px -24px 0)}.dl-mk-new .dl-mk-host,.dl-mk-new .dl-mk-dock{transition:none}.dl-mk-pile{position:relative;display:flex;justify-content:center}.dl-mk-pile-box{box-sizing:border-box;height:40px;display:flex;align-items:center;gap:6px;padding:0 10px 0 6px;border-radius:20px;cursor:zoom-in;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;animation:dl-plate-in .26s cubic-bezier(.2,.8,.2,1) both;transition:opacity .18s ease,transform .18s ease}.dl-mk-pile.out{pointer-events:none}.dl-mk-pile.out>*{opacity:0;transform:scale(.85);transition:opacity .18s ease,transform .18s ease}@keyframes dl-plate-in{0%{opacity:0;transform:scale(.85)}}.dl-mk-face{all:unset;position:relative;display:flex;cursor:pointer;transition:transform .18s ease,opacity .18s ease}.dl-mk-face>.dl-mk-badge{position:relative;left:auto;bottom:-8px;margin-left:-12px;align-self:center}.dl-mk-face.on .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-face.on .dl-mk-badge{background:#3b82f6}.dl-mk-face:hover .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-face.in{animation:dl-dock-in .24s cubic-bezier(.2,.8,.2,1) both}.dl-mk-face.out{transform:scale(.4);opacity:0;pointer-events:none}@keyframes dl-dock-in{0%{transform:scale(.4);opacity:0}}.dl-mk-more{font-size:11px;font-weight:600;color:var(--dl-fg-muted)}.dl-mk-av,.dl-mk-tile{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1)}.dl-mk.merged .dl-mk-av,.dl-mk.merged .dl-mk-tile,.dl-mk.piled .dl-mk-av{transform:scale(.5)}.dl-mk-host,.dl-mk-dock,.dl-mk-pile-box{transition-property:border-radius,border-right-color,clip-path,opacity,height,width,padding,gap}.dl-mk-dock,.dl-mk-pile-box{transition-duration:.22s;transition-timing-function:cubic-bezier(.2,.8,.2,1)}.dl-mk-pile-box{position:relative}.dl-mk-more{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease}.dl-mk-more.in{animation:dl-dock-in .24s ease both}.dl-mk-more.out{transform:scale(.4);opacity:0}.dl-mk-face .dl-mk-av{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1),width .2s ease,height .2s ease,font-size .2s ease}.dl-mk-face{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,margin .2s ease}.dl-mk-face>.dl-mk-badge{max-width:48px;overflow:hidden;transition:opacity .2s ease,transform .2s ease,max-width .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease,height .22s ease,min-width .22s ease,width .22s ease,bottom .22s ease}.dl-lod-far .dl-mk-host{width:32px;height:32px;border-radius:9px}.dl-lod-far .dl-mk-host.docked{border-radius:9px 0 0 9px}.dl-lod-far .dl-mk-host-tile{width:20px;height:20px;border-radius:6px}.dl-lod-far .dl-mk-host-ic{width:11px;height:11px}.dl-lod-far .dl-mk-dock{height:32px;gap:0;padding:0 4px 0 0;border-radius:0 9px 9px 0}.dl-lod-far .dl-mk-pile-box{height:32px;gap:0;padding:0 4px;border-radius:16px}.dl-lod-far .dl-mk-face+.dl-mk-face{margin-left:-6px}.dl-lod-far .dl-mk-face .dl-mk-av{width:22px;height:22px;font-size:8px;box-shadow:0 0 0 2px var(--dl-elevated)}.dl-lod-far .dl-mk-face>.dl-mk-badge{max-width:0;min-width:0;padding:0;margin-left:0;border-width:0;opacity:0;transform:scale(.5);pointer-events:none}.dl-lod-far .dl-mk-more{margin-left:4px;font-size:10px}.dl-mk-label{transition:opacity .2s ease}.dl-lod-far .dl-mk:not(.step) .dl-mk-label{opacity:0}.dl-lod-mid .dl-mk-host{width:36px;height:36px}.dl-lod-mid .dl-mk-dock,.dl-lod-mid .dl-mk-pile-box{height:36px}.dl-lod-mid .dl-mk-face .dl-mk-av{width:24px;height:24px;font-size:9px}.dl-lod-mid .dl-mk-face>.dl-mk-badge{height:12px;min-width:12px;margin-left:-10px;bottom:-7px}.dl-lod-mid .dl-mk-face>.dl-mk-badge:has(>svg:only-child){width:12px}.dl-lod-mid .dl-mk-face>.dl-mk-badge .dl-mk-badge-ic{width:8px;height:8px}@media(prefers-reduced-motion:reduce){.dl-mk-dock,.dl-mk-pile-box,.dl-mk-face,.dl-mk-av,.dl-mk-tile,.dl-mk.step .dl-mk-tile,.dl-mk-host,.dl-mk-face>.dl-mk-badge{transition:none;animation:none}}.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host{cursor:zoom-in}.dl-mk-ptr{position:absolute;left:50%;top:50%;width:0;height:0;z-index:-1;pointer-events:none}.dl-mk-ptr .line{position:absolute;left:0;top:-.5px;height:1px;background:var(--dl-fg-faint);transform-origin:0 50%}.dl-mk-ptr .spot{position:absolute;left:-3.5px;top:-3.5px;width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid #fff;background:#8a8a8a}.dl-mk.online .dl-mk-ptr .spot,.dl-mk.place.online .dl-mk-ptr .spot{background:#3b82f6}.dl-mk.dim>*{opacity:.18}.dl-mk.hl .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-label{position:absolute;left:50%;bottom:100%;margin-bottom:4px;transform:translate(-50%);white-space:nowrap;pointer-events:none;font-size:10px;line-height:14px;font-weight:500;color:var(--dl-fg)}.dl-mk-label.below{bottom:auto;top:100%;margin:4px 0 0}.dl-mk-label.chip{padding:2px 6px;border-radius:4px;font-size:11px;line-height:16px;font-weight:600;background:color-mix(in srgb,var(--background, var(--dl-card)) 80%,transparent);backdrop-filter:blur(8px)}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{margin:0 10px 10px 0;min-height:28px;padding:0;border-radius:8px;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg-muted);box-shadow:none;font-size:11px;line-height:26px}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show){width:28px;height:28px;box-sizing:border-box}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show{padding:0 32px 0 10px}.dl-geomap .maplibregl-ctrl-attrib a{color:var(--dl-fg-muted)}.dl-geomap .maplibregl-ctrl-attrib-button{top:0;right:0;width:26px;height:26px;margin:0;border-radius:8px;background:none}.dl-geomap .maplibregl-ctrl-attrib-button:after{content:"";position:absolute;inset:5px;background:var(--dl-fg);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat}.dl-geomap .maplibregl-ctrl-attrib-button:focus{outline:none;box-shadow:none}.dl-geomap .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-card{position:absolute;right:12px;top:12px;z-index:3;min-width:200px;max-width:260px;padding:10px 12px;border-radius:10px;font-size:12px;line-height:20px;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));opacity:0;transition:opacity .2s;pointer-events:none}.dl-map-card.on{opacity:1}.dl-map-card-head b{font-weight:500}.dl-map-card-row{display:flex;justify-content:space-between;gap:12px;white-space:nowrap}.dl-popcard{position:fixed;z-index:2100;width:max-content;max-width:300px;padding:12px;border-radius:12px;box-sizing:border-box;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4))}.dl-popcard.away{visibility:hidden}.dl-popcard.leaving{pointer-events:none}.dl-popcard-tip{position:absolute;left:var(--tip-x, 50%);width:10px;height:10px;margin-left:-6px;box-sizing:border-box;background:var(--dl-elevated);border:solid var(--dl-line);transform:rotate(45deg)}.dl-popcard.above .dl-popcard-tip{bottom:-6px;border-width:0 1px 1px 0}.dl-popcard.below .dl-popcard-tip{top:-6px;border-width:1px 0 0 1px}.dl-popcard.above{transform-origin:var(--tip-x, 50%) 100%}.dl-popcard.below{transform-origin:var(--tip-x, 50%) 0}@media(prefers-reduced-motion:no-preference){.dl-popcard{animation:dl-pop-in .16s ease-out}.dl-popcard.leaving{animation:dl-pop-out .14s ease-in forwards}}@keyframes dl-pop-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}@keyframes dl-pop-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.94)}}.dl-pop{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;min-width:210px}.dl-pop-head{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:2px}.dl-pop-net{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-pop-list{display:flex;flex-direction:column;margin:6px 0 0;max-height:116px;overflow-y:auto}.dl-pop-row{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px}.dl-pop-row:hover{background:var(--dl-soft)}.dl-pop-row:focus{outline:none}.dl-pop-row:focus-visible{outline:2px solid var(--dl-ring)}.dl-pop-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-pop-name b{font-weight:500}.dl-pop-dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-pop-dot.on{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-pop-actions{display:flex;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--dl-line)}.dl-pop-actions .cbi-button{flex:1;height:28px!important;font-size:12px!important;justify-content:center}.dl-chartbox{position:relative}.dl-bars{display:flex;align-items:flex-end;gap:4px;border-bottom:1px solid var(--dl-line)}.dl-bar{flex:1;height:100%;display:flex;flex-direction:column-reverse;gap:1px;cursor:default;min-width:3px}.dl-bar i{display:block;border-radius:3px 3px 0 0}.dl-bar i.down{background:var(--dl-chart-1)}.dl-bar i.up{background:var(--dl-chart-2);opacity:.75;border-radius:3px 3px 0 0}.dl-bar:hover i{filter:brightness(1.25)}.dl-bar.empty{background:linear-gradient(to top,var(--dl-line) 2px,transparent 2px)}.dl-tip{position:absolute;top:-8px;transform:translate(-50%,-100%);padding:8px 10px;border-radius:10px;font-size:12px;line-height:18px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));pointer-events:none;z-index:3}.dl-tip-title{font-weight:500}.dl-tip-float{position:fixed;z-index:2000;color:var(--dl-fg)}.dl-spark i:hover{opacity:1;filter:brightness(1.25)}.dl-meter,.dl-slots{cursor:default}.dl-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--dl-fg-faint);margin-top:6px}.dl-legend i.down{background:var(--dl-chart-1)}.dl-legend i.up{background:var(--dl-chart-2)}.dl-spark{display:flex;align-items:flex-end;gap:2px;flex:0 0 auto}.dl-spark i{flex:1;display:block;border-radius:2px 2px 0 0;background:var(--dl-chart-1);opacity:.85}.dl-spark i.zero{opacity:.22}`;var Ta=`.dl-row{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-row.link{color:inherit;text-decoration:none}.dl-row.link:hover{background:var(--dl-soft)}.dl-row-main{flex:1;min-width:0;overflow-wrap:anywhere}.dl-row-main b{font-weight:500}.dl-attn{display:flex;flex-direction:column;gap:10px;padding:16px;border-top:1px solid var(--dl-line)}.dl-attn-item{display:flex;gap:10px;align-items:baseline;font-size:13px;color:var(--dl-fg-muted)}.dl-avatar.sm{width:26px;height:26px;font-size:10px;margin:0}.dl-avatar.lg{width:48px;height:48px;font-size:15px;margin:0}.dl-avatar.lg.online:after{width:12px;height:12px}.dl-list{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-list>.dl-row:first-child{border-top:0}.dl-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-row-main.dl-stack{min-width:0}.dl-person-id{display:flex;align-items:center;gap:14px;min-width:0}.dl-grid-person{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:16px;align-items:start}@media(max-width:1000px){.dl-grid-person{grid-template-columns:minmax(0,1fr)}}.dl-devsec{display:flex;flex-direction:column;gap:12px}.dl-devsec .dl-panel-head{margin:0}.dl-dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dl-dcard>.dl-dcard-head+*{margin-top:auto}@media(max-width:700px){.dl-dgrid{grid-template-columns:minmax(0,1fr)}}.dl-dgrid>.dl-dslot.add:only-child{grid-column:1 / -1}.dl-dcard{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:12px;min-width:0;box-shadow:var(--dl-shadow)}.dl-dcard.online{border-color:color-mix(in srgb,var(--dl-ok) 35%,transparent)}.dl-dcard.off{opacity:.7}.dl-dcard-head{display:flex;align-items:center;gap:12px}.dl-dcard-ic{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dcard-ic .dl-icon{width:20px;height:20px}.dl-dcard.online .dl-dcard-ic{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-dcard-title{all:unset;cursor:pointer;flex:1;min-width:0;display:flex;flex-direction:column}.dl-dcard-title b{font-weight:500;font-size:15px}.dl-dstat{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;min-width:0}.dl-dstat i.dot{flex:none}.dl-dstat.ok{color:var(--dl-ok)}.dl-dstat.warn{color:var(--dl-warn)}.dl-dstat i.dot,.dl-savebar i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint)}.dl-dstat i.dot.ok{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-dstat i.dot.warn{background:var(--dl-warn)}.dl-dcard-use{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.dl-dcard-foot{padding-top:10px;border-top:1px solid var(--dl-line);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-dslot.add{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;min-height:0;border:1px dashed color-mix(in srgb,currentColor 18%,transparent);border-radius:14px;text-align:center;color:var(--dl-fg-muted);transition:background .15s,border-color .15s,color .15s}.dl-dslot.add .dl-stack{align-items:center}.dl-dslot.add:hover{border-color:color-mix(in srgb,currentColor 35%,transparent);color:var(--dl-fg)}.dl-dslot.add:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-dslot.add b{font-weight:500}.dl-dslot.add:hover{background:var(--dl-soft)}.dl-dslot-ic{width:36px;height:36px;border-radius:999px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dslot.add:hover .dl-dslot-ic{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-tiles2{display:grid;gap:10px;margin-top:16px}.dl-tile2{border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;min-width:0}.dl-tile2-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile2-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.dl-tile2-value{font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums}.dl-tile2-value .dl-faint{font-size:14px;font-weight:400}.dl-tile2-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-stepper{display:inline-flex;align-items:stretch;height:32px;border:1px solid var(--input, var(--dl-line));border-radius:8px;overflow:hidden}.dl-stepper button{all:unset;cursor:pointer;width:32px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;color:var(--dl-fg)}.dl-stepper button:hover{background:var(--dl-soft)}.dl-stepper button[disabled]{opacity:.35;cursor:not-allowed}.dl-stepper+.dl-stepper{margin-left:4px}.dl-step-select{border:0!important;border-left:1px solid var(--input, var(--dl-line))!important;border-right:1px solid var(--input, var(--dl-line))!important;border-radius:0!important;background:transparent!important;color:inherit;font:500 13px inherit;padding:0 10px!important;height:100%!important;min-width:0!important}.dl-slots{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}.dl-slots i{height:4px;border-radius:999px;background:var(--dl-track);display:block}.dl-slots i.used{background:var(--dl-fg)}.dl-slots i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-date{display:flex;align-items:center;gap:8px;flex:1 1 150px;min-width:0;box-sizing:border-box;height:34px;padding:0 10px;border:1px solid var(--input, var(--dl-line));border-radius:8px;color:var(--dl-fg-faint)}.dl-date input{border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important;height:32px!important;color:var(--dl-fg);flex:1;min-width:0!important;width:100%!important}.dl-meter{position:relative;height:6px;border-radius:999px;background:var(--dl-track)}.dl-meter>i{display:block;height:100%;border-radius:999px;background:var(--dl-accent)}.dl-meter.warn>i{background:var(--dl-warn)}.dl-meter.bad>i{background:var(--dl-bad)}.dl-meter .mark{position:absolute;left:90%;top:-3px;width:1px;height:12px;background:var(--dl-warn)}.dl-meter.sm{height:4px}.dl-chips-row{display:flex;flex-wrap:wrap;gap:4px}.dl-chipbtn{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-chipbtn:hover{background:var(--dl-soft-hover)}.dl-chipbtn.on{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-switch{all:unset;cursor:pointer;position:relative;width:32px;height:20px;border-radius:999px;background:var(--switch-off, var(--dl-track));flex:0 0 auto;transition:background .15s}.dl-switch i{position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 2px #0000004d}.dl-switch.on{background:var(--dl-accent)}.dl-switch.on i{left:14px}.dl-switch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-linkbox{display:flex;align-items:center;gap:8px;height:36px;padding:0 4px 0 12px;border:1px solid var(--input, var(--dl-line));border-radius:8px;background:var(--input-bg, transparent)}.dl-linkbox .dl-mono{flex:1;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dl-fg-muted)}.dl-linkbox .cbi-button{height:28px!important}.dl-pcard{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:stretch;min-width:0}.dl-pcard-main{min-width:0}.dl-pcard-top{display:flex;align-items:center;gap:12px;min-width:0}.dl-pcard-top .dl-avatar{margin-right:0}.dl-pcard-who{flex:1;min-width:0}.dl-pcard-who .dl-slotbar{margin:3px 0 0}.dl-pside{display:flex;flex-direction:column;justify-content:space-between;gap:8px;padding-left:20px;border-left:1px solid var(--dl-line);min-width:0}.dl-pside-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.dl-pside-state{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dl-fg-muted)}.dl-pside-state.live{color:var(--dl-ok)}.dl-pside-foot{font-size:12px}.dl-pside .dl-use-num b{font-size:20px}.dl-none{display:none!important}.dl-pcard-actions{display:flex;gap:6px;flex:0 0 auto}.dl-pcard-actions .cbi-button{height:32px!important}.dl-icon-only .dl-btn-label{display:none}.dl-pill-ic{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill-ic .dl-icon{width:12px;height:12px}.dl-pill-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-use-num{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.dl-use-num b{font-size:15px;font-weight:500}.dl-use-live{display:flex;align-items:center;gap:8px;font-size:12px;font-variant-numeric:tabular-nums}.dl-usebar{display:flex;gap:2px;height:6px;border-radius:999px;overflow:hidden;background:var(--dl-track)}.dl-usebar i{display:block;height:100%;min-width:3px;flex:0 1 0}.dl-usebar i.fill{flex:none;min-width:0;border-radius:999px;background:var(--dl-accent)}.dl-usebar.warn i.fill{background:var(--dl-warn)}.dl-usebar.bad i.fill{background:var(--dl-bad)}.dl-usebar .c0,.dl-swatch.c0{background:var(--dl-chart-1)}.dl-usebar .c1,.dl-swatch.c1{background:#8b7cf6}.dl-usebar .c2,.dl-swatch.c2{background:#2fb889}.dl-usebar .c3,.dl-swatch.c3{background:#d9a03f}.dl-usebar .c4,.dl-swatch.c4{background:var(--dl-fg-faint)}.dl-tip-row{display:flex;align-items:center;gap:8px;min-width:160px}.dl-tip-row b{margin-left:auto;font-weight:500}.dl-swatch{width:8px;height:8px;border-radius:2px;flex:none}.dl-card-name{color:var(--dl-fg)!important;text-decoration:none}.dl-card-name:hover{text-decoration:underline}.dl-chip-tag{font-size:11px;line-height:18px;padding:0 6px;border-radius:999px;background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-chip.live{background:var(--dl-ok-wash);color:color-mix(in srgb,var(--dl-ok) 35%,var(--dl-fg))}.dl-chip.live:hover{background:color-mix(in srgb,var(--dl-ok) 22%,transparent)}.dl-chip.live .dl-icon{color:var(--dl-ok)}.dl-fixes{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 0 44px}.dl-fix{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-info-wash);color:var(--dl-info);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-fix:hover{filter:brightness(1.15)}@media(max-width:760px){.dl-pcard{grid-template-columns:1fr}.dl-pside{padding:12px 0 0;border-left:0;border-top:1px solid var(--dl-line)}.dl-fixes{margin-left:0}}.dl-select{height:34px!important;border-radius:999px!important;min-width:136px!important;width:auto!important;padding:0 34px 0 14px!important;appearance:none!important;-webkit-appearance:none!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 12px center!important;background-size:14px!important}.dl-savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160%);opacity:0;transition:transform .25s cubic-bezier(.2,.8,.2,1),opacity .2s;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:999px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, 0 16px 32px -8px rgba(0,0,0,.5));z-index:60;pointer-events:none}.dl-savebar.show{transform:translate(-50%);opacity:1;pointer-events:auto}.dl-savebar-text{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500}`;var Sa=".dl-toast strong{display:block;font-weight:500}.dl-toast div{opacity:.8;font-size:13px}.dl-drawer-overlay{position:fixed;inset:0;z-index:900;display:flex;justify-content:flex-end;background:transparent;transition:background .2s}.dl-drawer-overlay.open{background:var(--scrim, rgba(0,0,0,.45))}.dl-drawer{width:min(520px,100%);height:100%;display:flex;flex-direction:column;background:var(--dialog-bg, var(--dl-elevated));color:var(--dl-fg);border-left:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, -16px 0 32px -8px rgba(0,0,0,.5));transform:translate(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1)}.dl-drawer-overlay.open .dl-drawer{transform:none}.dl-drawer-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--dl-line)}.dl-drawer-title{flex:1;min-width:0;display:flex;align-items:center;gap:12px}.dl-drawer-title h3{margin:0!important;padding:0!important;border:0!important;font-size:18px!important;line-height:26px;font-weight:500!important}.dl-drawer-x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted)}.dl-drawer-x:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-drawer-body{flex:1;overflow:auto;padding:20px}.dl-drawer-foot{padding:12px 20px;border-top:1px solid var(--dl-line)}.dl-drawer-actions{display:flex;align-items:center;gap:8px}.dl-dcard-ic.on{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-icon-only.sm{width:28px;height:28px!important}.dl-stack.gap12{gap:12px}.dl-stack.gap16{gap:16px}.dl-dstats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--dl-line);border-radius:14px;overflow:hidden}.dl-dstats-cell{display:flex;flex-direction:column;gap:4px;padding:12px 14px;min-width:0}.dl-dstats-cell.wide{grid-column:span 2;border-bottom:1px solid var(--dl-line)}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:1px solid var(--dl-line)}.dl-dstats-cell b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dstats-cell .dl-dstat{font-size:14px}.dl-dsec{border:1px solid var(--dl-line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.dl-dsec-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-dsec-head h4{margin:0!important;padding:0!important;font-size:14px!important;font-weight:500!important;border:0!important}.dl-dstat i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);display:inline-block}.dl-connect-body{min-height:60px}.dl-connect-body .dl-qr{width:min(240px,70vw)}.dl-kv2{display:flex;flex-direction:column}.dl-kvrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 0;border-top:1px solid var(--dl-line);font-size:13px;min-width:0}.dl-kvrow:first-child{border-top:0;padding-top:0}.dl-kvrow-k{color:var(--dl-fg-muted);flex:0 0 auto}.dl-kvrow-v{min-width:0;text-align:right;overflow-wrap:anywhere}.dl-kvrow-v.copy{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--dl-fg)}.dl-kvrow-v.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-kvrow-v.copy .dl-icon{width:13px;height:13px;color:var(--dl-fg-faint)}.dl-kvrow-v.copy:hover .dl-icon{color:var(--dl-fg)}@media(max-width:560px){.dl-drawer{width:100%}.dl-dstats{grid-template-columns:minmax(0,1fr)}.dl-dstats-cell.wide{grid-column:auto}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:0;border-top:1px solid var(--dl-line)}}.dl-dev-log{display:flex;flex-direction:column}.dl-dev-log-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--dl-line);font-size:13px;line-height:20px;min-width:0}.dl-dev-log-row:first-child{border-top:0;padding-top:0}.dl-dev-log-row .dl-row-main{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";var Pa=".dl-settings-main{min-width:0;display:flex;flex-direction:column;gap:20px}.dl-setsec{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);overflow:hidden;scroll-margin-top:88px;box-shadow:var(--dl-shadow)}.dl-setsec-body{padding:20px;display:flex;flex-direction:column;gap:14px}.dl-setsec-body h3{margin:0!important;padding:0!important;font-size:18px!important;line-height:26px;font-weight:500!important;border:0!important}.dl-setsec-body p{margin:0}.dl-setsec-head{display:flex;align-items:center;gap:10px}.dl-group{border:1px solid var(--dl-line);border-radius:14px;padding:2px 16px}.dl-group-head{display:flex;align-items:center;gap:12px;padding:14px 0 10px}.dl-group-head b{font-size:15px;font-weight:500}.dl-group-ic{width:32px;height:32px;border-radius:10px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-group-ic .dl-icon-wrap{display:inline-flex}.dl-group-ic .dl-icon{width:16px;height:16px}.dl-group-body>*{padding:12px 0;margin:0!important}.dl-group-body>*+*:not(.alert-message):not(.dl-params){border-top:1px solid var(--dl-line)}.dl-group-body>.alert-message,.dl-group-body>.dl-params{margin:12px 0!important}.dl-group-body>.alert-message{padding:10px 14px}.dl-group-body>.dl-params{padding:0}.dl-group-body>.alert-message+*,.dl-group-body>.dl-params+*{border-top:0}.dl-group-body>.dl-row{border-left:0;border-right:0;border-bottom:0;padding-left:0;padding-right:0;background:none}.dl-group-body>.dl-row:first-child{border-top:0}.dl-setsec-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 20px;border-top:1px solid var(--dl-line);background:var(--dl-soft)}.dl-setsec.danger{border-color:color-mix(in srgb,var(--dl-bad) 40%,transparent)}.dl-setsec.danger .dl-setsec-foot{background:color-mix(in srgb,var(--dl-bad) 6%,transparent)}.dl-setrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:center;gap:8px 24px}.dl-setrow.head{display:flex;justify-content:space-between;gap:16px}.dl-setrow-label{font-size:14px;font-weight:500}.dl-setrow-ctl{display:flex;justify-content:flex-end;min-width:0}.dl-setrow-ctl .dl-chips-row{justify-content:flex-end}.dl-setrow-ctl>input{width:100%}.dl-hostport{display:flex;align-items:center;gap:8px;flex:1;min-width:0;justify-content:flex-end}.dl-hostport input{flex:1;min-width:0}.dl-root input.dl-w-port,.dl-hostport input.dl-w-port{flex:0 0 90px;width:90px}.dl-root input.dl-w-range{flex:0 0 130px;width:130px}.dl-setrow .dl-sub.bad{color:var(--dl-bad)}.dl-suffixed{display:inline-flex;align-items:center;gap:6px}.dl-suffixed>span{color:var(--dl-fg-muted)}.dl-more summary{cursor:pointer;color:var(--dl-fg-muted);font-size:13px;margin-bottom:10px}.dl-more .dl-setrow+.dl-setrow{margin-top:10px}@media(max-width:760px){.dl-setrow:not(.head){grid-template-columns:minmax(0,1fr)}.dl-setrow-ctl,.dl-setrow-ctl .dl-chips-row{justify-content:flex-start}}.dl-need-ic{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-need-ic .dl-icon-wrap{display:inline-flex}.dl-need-ic .dl-icon{width:15px;height:15px}.dl-need-row.bad .dl-need-ic,.dl-need-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-need-row.warn .dl-need-ic,.dl-need-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-need-ic.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-lh-main{display:flex;align-items:flex-start;gap:12px;min-width:0}.dl-lh-main>.dl-need-ic{margin-top:1px}.dl-sub .dl-mono{font-size:.92em}.dl-need-row>.cbi-button{flex:none}.dl-bk-row .dl-group-ic{width:30px;height:30px}.dl-bk-older>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:11px 16px;border-top:1px solid var(--dl-line);font-size:13px;color:var(--dl-fg-muted);user-select:none}.dl-bk-older>summary::-webkit-details-marker{display:none}.dl-bk-older>summary:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-bk-older>summary .dl-icon-wrap{display:inline-flex;transition:transform .15s}.dl-bk-older>summary .dl-icon{width:14px;height:14px}.dl-bk-older[open]>summary .dl-icon-wrap{transform:rotate(90deg)}#dl-set-backups .dl-setsec-head h3+.dl-sub{margin-top:2px}#dl-set-backups .dl-setsec-foot>.dl-sub{flex:1 1 260px}.dl-bk-actions{flex:0 1 auto;justify-content:flex-end}@media(max-width:640px){#dl-set-backups .dl-setsec-foot>.dl-sub{flex-basis:100%}.dl-bk-actions{justify-content:flex-start}}.dl-upd{display:flex;flex-direction:column;gap:16px}.dl-upd>.dl-pagehead{margin:0 0 4px}.dl-upd-bad{color:var(--dl-bad)}";var $a=".dl-comp-hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.dl-comp-hero-main{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}.dl-comp-hero-side{padding:20px;border-left:1px solid var(--dl-line);display:flex;flex-direction:column;gap:14px;min-width:0}.dl-comp-name{font-size:16px;font-weight:500}.dl-comp-hero-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.dl-comp-hero-head .dl-spacer{flex:1}.dl-comp-big{font-family:var(--dl-mono);font-size:26px;line-height:34px;letter-spacing:-.02em;display:flex;align-items:baseline;gap:10px}.dl-comp-big small{font-size:14px;color:var(--dl-accent)}.dl-comp-big small.dl-faint{color:var(--dl-fg-faint)}.dl-comp-verrow{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;min-width:0}.dl-comp-verrow .dl-spacer{flex:1}.dl-comp-meta{font-size:13px}.dl-comp-bullets{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;color:var(--dl-fg-muted);font-size:13px}.dl-comp-bullets li{list-style:disc}.dl-comp-lead{margin:0}.dl-comp-more{align-self:flex-start;font-size:12px;color:var(--dl-fg-faint);margin-left:18px;padding:0!important}.dl-comp-more:hover{color:var(--dl-accent);background:none!important;text-decoration:underline;text-underline-offset:2px}.dl-comp-hero-main>.dl-comp-vers{margin-top:auto}.dl-comp-btns{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;flex:none}.dl-comp-side-v{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0;flex-wrap:wrap}.dl-comp-side-v .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-comp-side-v a{color:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-side-v a:hover{color:var(--dl-accent)}.dl-comp-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:16px;align-items:start}.dl-comp-cols>.dl-panel>div>.dl-row:first-child{border-top:1px solid var(--dl-line)}.dl-comp-count{font-size:13px}.dl-comp-sub{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-ic{display:inline-flex;gap:4px;flex:none}.dl-comp-ic .cbi-button{width:30px;height:30px;padding:0!important;justify-content:center;border-radius:999px!important}.dl-comp-ic .dl-btn-label{display:none}.dl-comp-ic .dl-icon{width:14px;height:14px}.dl-comp-ic .is-busy{pointer-events:none;opacity:.5}.dl-comp-ic .cbi-button.dl-comp-check{width:auto;padding:0 12px 0 10px!important;gap:6px;display:inline-flex;align-items:center;font-size:13px}.dl-row>.dl-pill,.dl-row>.cbi-button,.dl-row>.dl-comp-ic{flex:none}button.dl-pill.dl-comp-run{all:unset;display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:12px;cursor:pointer;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-comp-foldwrap{padding:0 16px 14px 60px}.dl-comp-fold .dl-params-body{gap:12px}.dl-comp-fold .dl-list>.dl-row{padding:10px 14px}.dl-comp-bver{font-size:12px;width:130px;text-align:right;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-bact{width:84px;flex:none;display:flex;justify-content:flex-end}.dl-comp-warn{display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:18px;color:var(--dl-fg-muted)}.dl-comp-warn .dl-icon-wrap{display:inline-flex;flex:none;margin-top:2px}.dl-comp-warn .dl-icon{width:14px;height:14px;color:var(--dl-warn)}.dl-comp-empty{margin:0;padding:4px 16px 16px}@media(max-width:760px){.dl-comp-hero,.dl-comp-cols{grid-template-columns:minmax(0,1fr)}.dl-comp-hero-side{border-left:0;border-top:1px solid var(--dl-line)}.dl-comp-foldwrap{padding-left:16px}.dl-comp-bver{display:none}}.dl-comp-status{display:flex;align-items:center;gap:8px;font-size:13px;padding:9px 12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-comp-status>.dl-icon-wrap{display:inline-flex;flex:none}.dl-comp-status .dl-icon{width:15px;height:15px}.dl-comp-status.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-comp-status.acc{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-comp-status.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-comp-status.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-comp-status b{font-weight:600}.dl-comp-vers .dl-params-body{gap:0;padding:4px 14px 12px}.dl-comp-tag{display:flex;gap:6px;padding:6px 0 10px}.dl-comp-tag input{flex:1;min-width:0}.dl-comp-ver{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--dl-line);font-size:13px}.dl-comp-ver .dl-mono{min-width:52px}.dl-comp-ver .dl-sub{flex:1}.dl-comp-ver .cbi-button:not(.dl-icon-btn){height:26px!important;font-size:12px!important}.dl-comp-pager{display:flex;align-items:center;justify-content:space-between;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-comp-pager .dl-linkbtn[disabled]{opacity:.4;cursor:default}.dl-comp-vers .dl-loading,.dl-comp-vers .dl-params-body>p{padding:6px 0 10px}.dl-op-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}.dl-op-head .dl-spacer{flex:1}.dl-op-timer{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}.dl-op-timer .dl-icon,.dl-op-head .dl-linkbtn .dl-icon{width:14px;height:14px}.dl-op-loghead{display:flex;align-items:center;justify-content:space-between}.dl-op-loghead b{font-weight:500;font-size:13px}.dl-op .dl-log{max-height:16em;min-height:12em;margin-top:8px}.dl-op .dl-comp-status{margin:14px 0 0}.dl-op-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;width:100%}.dl-notes{max-height:55vh;overflow:auto;border-radius:12px;background:var(--dl-soft);padding:14px 16px;font-size:13px;line-height:20px;overflow-wrap:anywhere}.dl-notes h5{margin:10px 0 6px;font-size:14px;font-weight:500}.dl-notes h5:first-child{margin-top:0}.dl-notes p{margin:0 0 8px}.dl-notes ul{margin:0 0 10px;padding-left:18px}.dl-notes li{list-style:disc}.dl-notes code{font-family:var(--dl-mono);font-size:12px;padding:1px 5px;border-radius:6px;background:var(--dl-soft-hover)}.dl-notes pre{font-family:var(--dl-mono);font-size:12px;padding:10px;border-radius:8px;background:var(--dl-soft-hover);white-space:pre-wrap;margin:0 0 10px}.dl-notes a{color:var(--dl-accent)}";var Da=".dl-chip.static{cursor:default}.dl-chip.static:hover{background:var(--dl-soft)}.dl-chip.static .dl-chip-name{font-weight:500}.dl-setrow.head .dl-chips-row{margin-top:8px}.dl-setrow.head>.dl-lh-main,.dl-setrow.head>.dl-lh-main>.dl-stack{flex:1 1 auto;min-width:0}.dl-setrow.head>.dl-setrow-ctl:empty{display:none}.dl-setrow.head:has(>.dl-lh-main){align-items:flex-start}.dl-setrow.head>.dl-setrow-ctl{align-items:center;min-height:30px}.dl-netpick{margin-top:10px}.dl-boxrow{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:10px 14px;border:1px solid var(--dl-line);border-radius:12px;font-size:13px;cursor:pointer}.dl-boxrow>.dl-switch{flex:none}.dl-ifpick{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--dl-line);border-radius:14px}.dl-iflead-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-host-ports{justify-content:flex-end}@media(max-width:760px){.dl-host-ports{justify-content:flex-start}}.dl-circle-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}.dl-circles .dl-chip b{font-weight:500}.dl-circle-name{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:500}.dl-w400{font-weight:400}.dl-swatches{display:flex;flex-wrap:wrap;gap:8px}.dl-swatch{all:unset;cursor:pointer;width:22px;height:22px;border-radius:50%;background:var(--sw);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dl-fg) 12%,transparent)}.dl-swatch.on{box-shadow:0 0 0 2px var(--dl-card),0 0 0 4px var(--sw)}.dl-swatch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:3px}.dl-circle-modal .dl-chipbtn b{margin-left:6px;font-weight:500;font-size:11px;opacity:.6}.dl-reach td:first-child b{font-weight:500}.dl-ev-host{white-space:nowrap}.dl-ev-host b{font-weight:500;color:var(--dl-fg)}.dl-reach{font-size:13px}.dl-reach th,.dl-reach td{white-space:nowrap;padding-left:6px;padding-right:6px}.dl-reach-wrap{overflow-x:auto}.dl-yes{display:inline-flex;align-items:center;gap:4px;color:var(--dl-ok)}.dl-yes .dl-icon-wrap{display:inline-flex}.dl-yes .dl-icon{width:14px;height:14px}.dl-check-form{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto;align-items:start;gap:8px}.dl-check-form>.dl-faint{line-height:36px}.dl-check-end{display:flex;flex-direction:column;gap:6px;min-width:0}.dl-check-end>*{width:100%!important;min-width:0}@media(max-width:560px){.dl-check-form{grid-template-columns:minmax(0,1fr)}.dl-check-form>.dl-faint{display:none}}.dl-verdict{display:flex;align-items:baseline;gap:10px;padding:10px 12px;border-radius:12px}.dl-verdict b{font-weight:500}.dl-verdict.ok{background:var(--dl-ok-wash)}.dl-verdict.ok b{color:var(--dl-ok)}.dl-verdict.bad{background:var(--dl-bad-wash)}.dl-verdict.bad b{color:var(--dl-bad)}.dl-corehead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 4px}.dl-corehead h3{margin:0!important}.dl-row-end{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dl-dcard.clickable{cursor:pointer}.dl-dcard.clickable:hover{border-color:color-mix(in srgb,var(--dl-fg) 22%,transparent)}";var td=[ba,xa,wa,ya,ka,_a,Ca,La,Ma,Ea,Ta,Sa,Pa,$a,Da].join(` +`);function Aa(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=td,n}function yt(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async s=>{let r=await e.render(s),a=document.createElement("div");return a.className="dl-root",a.append(Aa(),r),a},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var Jb=yt(on),Zb=yt(wt),Qb=yt(on),Xb=yt(On),e0=yt(Gn),t0=yt(Yn),n0=yt(Wn);function Na(n){return()=>({load:()=>(ui.menu?.flushCache(),location.replace(`${L.url("admin/network/dawnline/diagnostics")}${n?`?tab=${n}`:""}`),new Promise(()=>{})),render:()=>document.createElement("div"),handleSave:null,handleSaveApply:null,handleReset:null})}var o0=Na(""),s0=Na("log");return baseclass.extend({ activity: s0, diagnostics: t0, health: o0, overview: Jb, people: Zb, person: e0, server: Qb, settings: Xb, updates: n0 }); diff --git a/package/luci-app-dawnline/po/ru/dawnline.po b/package/luci-app-dawnline/po/ru/dawnline.po new file mode 100644 index 0000000..0ddbf56 --- /dev/null +++ b/package/luci-app-dawnline/po/ru/dawnline.po @@ -0,0 +1,8142 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Language-Team: Russian\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" already exists." +msgstr "Устройство «%s» уже есть." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "\"%s\" is already taken." +msgstr "Идентификатор «%s» уже занят." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "\"%s\" is not a device or an IPv4 address." +msgstr "«%s» не является ни устройством, ни IPv4-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "\"Devices reach each other\" is off on %s" +msgstr "«Связь между устройствами» выключена на сервере %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "%d MB free on the overlay" +msgstr "Свободно в разделе overlay: %d МБ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d MB free on the overlay." +msgstr "Свободно в разделе overlay: %d МБ." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d device is loaded in the tunnel." +msgid_plural "%d devices are loaded in the tunnel." +msgstr[0] "В туннель загружено %d устройство." +msgstr[1] "В туннель загружено %d устройства." +msgstr[2] "В туннель загружено %d устройств." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d of %d device missing, %d loaded that should not be." +msgid_plural "%d of %d devices missing, %d loaded that should not be." +msgstr[0] "Не загружено %d из %d устройства, лишних загружено: %d." +msgstr[1] "Не загружено %d из %d устройств, лишних загружено: %d." +msgstr[2] "Не загружено %d из %d устройств, лишних загружено: %d." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d of %d device missing." +msgid_plural "%d of %d devices missing." +msgstr[0] "Не загружено %d из %d устройства." +msgstr[1] "Не загружено %d из %d устройств." +msgstr[2] "Не загружено %d из %d устройств." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "%d package update in the feeds: %s" +msgid_plural "%d package updates in the feeds: %s" +msgstr[0] "В репозиториях %d обновление пакетов: %s" +msgstr[1] "В репозиториях %d обновления пакетов: %s" +msgstr[2] "В репозиториях %d обновлений пакетов: %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%d system package" +msgstr "%d системный пакет" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%d system packages" +msgstr "системных пакетов: %d" + +#: web/src/admin/pages/components/activity.ts +msgid "%s %s automatically" +msgstr "%s %s - автоматически" + +#: web/src/admin/pages/components/activity.ts +msgid "%s %s by you" +msgstr "%s %s - вручную" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s (after %d repair)" +msgstr "%s (после %d исправления)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s (after %d repairs)" +msgstr "%s (исправлений: %d)" + +#: web/src/admin/pages/settings/map.ts +msgid "%s (fallback: %s)" +msgstr "%s (запасной: %s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - %d repairs didn't help" +msgstr "%s - исправления не помогли (%d)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - %s" +msgstr "%s - %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - not repaired again (%d repairs didn't help)" +msgstr "%s - больше не исправляется (исправления не помогли: %d)" + +#: web/src/admin/cores/awg.ts +msgid "%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you)." +msgid_plural "%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)." +msgstr[0] "%s устройство AmneziaWG перестанет подключаться, пока заново не импортирует конфигурацию (по личной ссылке или от вас)." +msgstr[1] "%s устройства AmneziaWG перестанут подключаться, пока заново не импортируют конфигурацию (по личной ссылке или от вас)." +msgstr[2] "%s устройств AmneziaWG перестанут подключаться, пока заново не импортируют конфигурацию (по личной ссылке или от вас)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s MB free: settings may stop saving. Remove old backups (Settings → Backups) or shorten the history." +msgstr "Свободно %s МБ: настройки могут перестать сохраняться. Удалите старые резервные копии («Настройки» → «Резервные копии») или сократите историю." + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +msgid "%s added" +msgstr "Добавлено: %s" + +#: web/src/admin/pages/components/activity.ts +msgid "%s added by you" +msgstr "Вы добавили: %s" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s address" +msgid_plural "%s addresses" +msgstr[0] "%s адрес" +msgstr[1] "%s адреса" +msgstr[2] "%s адресов" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "%s already exists." +msgstr "Имя «%s» уже занято." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s already has %d device. Remove one first to lower the limit to %d." +msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d." +msgstr[0] "%s: уже %d устройство. Чтобы снизить лимит до %d, сначала удалите одно из них." +msgstr[1] "%s: уже %d устройства. Чтобы снизить лимит до %d, сначала удалите одно из них." +msgstr[2] "%s: уже %d устройств. Чтобы снизить лимит до %d, сначала удалите одно из них." + +#: web/src/admin/device.ts +msgid "%s already has %s of %s device. As admin you can still add one." +msgid_plural "%s already has %s of %s devices. As admin you can still add one." +msgstr[0] "%s: уже %s из %s устройства. Как администратор вы всё равно можете добавить ещё одно." +msgstr[1] "%s: уже %s из %s устройств. Как администратор вы всё равно можете добавить ещё одно." +msgstr[2] "%s: уже %s из %s устройств. Как администратор вы всё равно можете добавить ещё одно." + +#: web/src/admin/netcheck.ts +msgid "%s already uses %s." +msgstr "%s уже использует %s." + +#: web/src/admin/pages/components/awg.ts +msgid "%s and %s" +msgstr "%s и %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s and %s are not in one circle" +msgstr "%s и %s не в одном круге" + +#: web/src/admin/cores/awg.ts +msgid "%s applied" +msgstr "Маскировка «%s» применена" + +#: web/src/admin/events/render.ts +msgid "%s blocked %s for 15 min after too many wrong codes" +msgstr "%s заблокировал %s на 15 мин: слишком много неверных кодов" + +#: web/src/admin/pages/components/awg.ts +msgid "%s build" +msgstr "сборка %s" + +#: web/src/admin/cores/awg.ts +msgid "%s byte" +msgid_plural "%s bytes" +msgstr[0] "%s байт" +msgstr[1] "%s байта" +msgstr[2] "%s байт" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: %s" +msgstr "%s недоступно: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: it is outside their allowed hours" +msgstr "%s недоступно: сейчас вне часов доступа владельца" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: it is turned off" +msgstr "%s недоступно: устройство выключено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: their access has ended" +msgstr "%s недоступно: доступ владельца закончился" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: their server is turned off" +msgstr "%s недоступно: сервер владельца выключен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they are paused" +msgstr "%s недоступно: владелец на паузе" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they have no server" +msgstr "%s недоступно: у владельца нет сервера" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they used up their data" +msgstr "%s недоступно: владелец исчерпал лимит трафика" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: %s" +msgstr "%s не может подключиться: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: it is outside their allowed hours" +msgstr "%s не может подключиться: сейчас вне часов доступа" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: their access has ended" +msgstr "%s не может подключиться: доступ закончился" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: their server is turned off" +msgstr "%s не может подключиться: сервер выключен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they are paused" +msgstr "%s не может подключиться: на паузе" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they have no server" +msgstr "%s не может подключиться: нет сервера" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they used up their data" +msgstr "%s не может подключиться: лимит трафика исчерпан" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s can't use the network interface %s: it exists and isn't Dawnline's." +msgstr "Сервер %s не может использовать сетевой интерфейс %s: он уже существует и создан не Dawnline." + +#: web/src/admin/pages/components/activity.ts +msgid "%s check failed" +msgstr "%s: ошибка проверки" + +#: web/src/admin/device.ts +msgid "%s copied" +msgstr "Скопировано: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s covers %s and is valid for more than 14 days." +msgstr "%s покрывает %s и действует ещё больше 14 дней." + +#: web/src/shared/format.ts +msgid "%s d ago" +msgstr "%s дн. назад" + +#: web/src/admin/events/model.ts +#: web/src/admin/pages/settings/logs.ts +msgid "%s day" +msgid_plural "%s days" +msgstr[0] "%s день" +msgstr[1] "%s дня" +msgstr[2] "%s дней" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s day before" +msgid_plural "%s days before" +msgstr[0] "За %s день" +msgstr[1] "За %s дня" +msgstr[2] "За %s дней" + +#: web/src/admin/pages/person/limits.ts +msgid "%s day left" +msgid_plural "%s days left" +msgstr[0] "остался %s день" +msgstr[1] "осталось %s дня" +msgstr[2] "осталось %s дней" + +#: web/src/admin/access.ts +msgid "%s deleted" +msgstr "Удалено: %s" + +#: web/src/admin/map.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "%s device" +msgid_plural "%s devices" +msgstr[0] "%s устройство" +msgstr[1] "%s устройства" +msgstr[2] "%s устройств" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind." +msgid_plural "%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind." +msgstr[0] "%s устройство получит новый адрес и не сможет подключаться, пока снова не импортирует конфигурацию (по личной ссылке или от вас). Круги и домашние сети старого сервера не переносятся." +msgstr[1] "%s устройства получат новые адреса и не смогут подключаться, пока снова не импортируют конфигурацию (по личной ссылке или от вас). Круги и домашние сети старого сервера не переносятся." +msgstr[2] "%s устройств получат новые адреса и не смогут подключаться, пока снова не импортируют конфигурацию (по личной ссылке или от вас). Круги и домашние сети старого сервера не переносятся." + +#: web/src/admin/pages/server.ts +msgid "%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you)." +msgid_plural "%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you)." +msgstr[0] "%s устройство получит новый адрес и не сможет подключиться, пока снова не импортирует конфигурацию (по личной ссылке или от вас)." +msgstr[1] "%s устройства получат новые адреса и не смогут подключиться, пока снова не импортируют конфигурацию (по личной ссылке или от вас)." +msgstr[2] "%s устройств получат новые адреса и не смогут подключиться, пока снова не импортируют конфигурацию (по личной ссылке или от вас)." + +#: web/src/admin/map.ts +msgid "%s device in %s, %s" +msgid_plural "%s devices in %s, %s" +msgstr[0] "%s устройство: %s, %s" +msgstr[1] "%s устройства: %s, %s" +msgstr[2] "%s устройств: %s, %s" + +#: web/src/admin/map.ts +msgid "%s device in an unknown city, %s" +msgid_plural "%s devices in an unknown city, %s" +msgstr[0] "%s устройство: город неизвестен, %s" +msgstr[1] "%s устройства: город неизвестен, %s" +msgstr[2] "%s устройств: город неизвестен, %s" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s device in use" +msgid_plural "%s devices in use" +msgstr[0] "Используется %s устройство" +msgstr[1] "Используются %s устройства" +msgstr[2] "Используется %s устройств" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s device is disconnected immediately and the personal link stops working." +msgid_plural "All %s devices are disconnected immediately and the personal link stops working." +msgstr[0] "%s устройство сразу отключится, а личная ссылка перестанет работать." +msgstr[1] "Все %s устройства сразу отключатся, а личная ссылка перестанет работать." +msgstr[2] "Все %s устройств сразу отключатся, а личная ссылка перестанет работать." + +#: web/src/admin/pages/people.ts +msgid "%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups." +msgid_plural "All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups." +msgstr[0] "%s устройство сразу отключится, а личная ссылка перестанет работать. История трафика останется в резервных копиях." +msgstr[1] "Все %s устройства сразу отключатся, а личная ссылка перестанет работать. История трафика останется в резервных копиях." +msgstr[2] "Все %s устройств сразу отключатся, а личная ссылка перестанет работать. История трафика останется в резервных копиях." + +#: web/src/admin/pages/overview.ts +msgid "%s device needs its configuration again (networks or DNS changed)." +msgid_plural "%s devices need their configuration again (networks or DNS changed)." +msgstr[0] "%s устройству нужна новая конфигурация (изменились сети или DNS)." +msgstr[1] "%s устройствам нужна новая конфигурация (изменились сети или DNS)." +msgstr[2] "%s устройствам нужна новая конфигурация (изменились сети или DNS)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not cover %s (it has %s): browsers will warn." +msgstr "%s не покрывает %s (в нём: %s): браузеры будут предупреждать." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not exist." +msgstr "Интерфейса %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not overlap other networks." +msgstr "%s не пересекается с другими сетями." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not resolve." +msgstr "%s не разрешается в IP-адрес." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s doesn't reach %s" +msgstr "%s: сеть %s недоступна" + +#: web/src/admin/events/model.ts +msgid "%s entry" +msgid_plural "%s entries" +msgstr[0] "%s запись" +msgstr[1] "%s записи" +msgstr[2] "%s записей" + +#: web/src/admin/events/model.ts +#: web/src/admin/pages/settings/logs.ts +msgid "%s event" +msgid_plural "%s events" +msgstr[0] "%s событие" +msgstr[1] "%s события" +msgstr[2] "%s событий" + +#: web/src/admin/logs.ts +msgid "%s event removed" +msgid_plural "%s events removed" +msgstr[0] "Удалено %s событие" +msgstr[1] "Удалено %s события" +msgstr[2] "Удалено %s событий" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s expires within 14 days." +msgstr "%s истекает в ближайшие 14 дней." + +#: web/src/admin/pages/components/activity.ts +msgid "%s found by a check" +msgstr "Проверка нашла: %s" + +#: web/src/admin/pages/components/activity.ts +msgid "%s found by the automatic check" +msgstr "Автоматическая проверка нашла: %s" + +#: web/src/admin/pkgs.ts +msgid "%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive." +msgstr "Пакеты %s из репозиториев OpenWrt. Остальное Dawnline настроит после их установки." + +#: web/src/admin/pages/components/packages.ts +msgid "%s from the OpenWrt feeds. Services that use them restart for a moment." +msgstr "Пакеты %s из репозиториев OpenWrt. Службы, которые их используют, ненадолго перезапустятся." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s goes through Cloudflare; in Russia such connections often stall after ~16 KB." +msgstr "%s идёт через Cloudflare; в России такие соединения часто зависают после ~16 КБ." + +#: web/src/shared/format.ts +msgid "%s h ago" +msgstr "%s ч назад" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home and Internet" +msgstr "%s: доступ «Дом и интернет»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only" +msgstr "%s: доступ «Только дом»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only: only DNS and the portal on the router." +msgstr "%s: доступ «Только дом», на роутере доступны только DNS и портал." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only: their device's own internet reaches it, not the tunnel." +msgstr "%s: доступ «Только дом», этот адрес доступен через собственный интернет устройства, а не через туннель." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only" +msgstr "%s: доступ «Только интернет»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only." +msgstr "%s: доступ «Только интернет»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only: only DNS and the portal on the router." +msgstr "%s: доступ «Только интернет», на роутере доступны только DNS и портал." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s has an invalid interface name \"%s\"." +msgstr "У сервера %s недопустимое имя интерфейса «%s»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has never connected" +msgstr "%s ещё ни разу не подключалось" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "%s has no IPv4 address." +msgstr "У %s нет IPv4-адреса." + +#: web/src/admin/access.ts +msgid "%s has no home access: their devices aren't reachable anyway" +msgstr "%s: нет доступа к домашней сети - устройства всё равно недоступны" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s has no room for every device on %s." +msgstr "В подсети %s не хватит адресов для всех устройств сервера %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has no server" +msgstr "У устройства %s нет сервера" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has only some home services" +msgstr "%s: доступны только некоторые домашние сервисы" + +#: web/src/admin/pages/overview.ts +msgid "%s has used 90% of the data limit." +msgstr "%s: израсходовано 90% лимита трафика." + +#: web/src/admin/ui/badges.ts +msgid "%s home service only" +msgid_plural "%s home services only" +msgstr[0] "Только %s домашний сервис" +msgstr[1] "Только %s домашних сервиса" +msgstr[2] "Только %s домашних сервисов" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s in memory" +msgstr "%s в памяти" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s in memory, %s on flash" +msgstr "%s в памяти, %s во флеш-памяти" + +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "%s in total" +msgstr "%s всего" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is %s, one of %s's home services" +msgstr "%s: это %s, один из домашних сервисов человека %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "%s is 0 or 1." +msgstr "Значение %s: 0 или 1." + +#: web/src/admin/cores/awg.ts +msgid "%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again." +msgstr "Маскировка «%s» - это только мусорные пакеты AmneziaWG 1.0, которые сети научились распознавать; её больше не предлагают. Перейдите на «%s» или «%s»: устройства заново импортируют конфигурацию." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is active" +msgstr "%s: доступ активен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is at home (%s)" +msgstr "%s в домашней сети (%s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is connected" +msgstr "%s подключено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is down." +msgstr "%s не работает." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is down: %s." +msgstr "%s не работает: %s." + +#: web/src/admin/pages/person/pickers.ts +msgid "%s is in %s" +msgstr "%s теперь в круге «%s»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is in %s, which %s doesn't reach" +msgstr "%s в сети %s, недоступной для %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is in home network %s" +msgstr "%s в домашней сети %s" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s is in no circle" +msgstr "%s теперь без круга" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down." +msgstr "Сервер %s остановлен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: %s)." +msgstr "Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (установлен %s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: none)." +msgstr "Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (не установлен)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is missing." +msgid_plural "%s are missing." +msgstr[0] "Не установлено: %s." +msgstr[1] "Не установлено: %s." +msgstr[2] "Не установлено: %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "%s is not a bridge, so Dawnline cannot join the LAN as a device." +msgstr "%s - не мост, поэтому Dawnline не может подключиться к LAN как устройство." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "%s is not a package Dawnline manages" +msgstr "%s - не пакет, которым управляет Dawnline" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is not an IP address." +msgstr "%s не является IP-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is not in a firewall zone, so the server port cannot be opened on it." +msgstr "%s не входит ни в одну зону межсетевого экрана, поэтому открыть на нём порт сервера нельзя." + +#: web/src/admin/netcheck.ts +msgid "%s is not in any home network of this server: nobody would reach it." +msgstr "%s не входит ни в одну домашнюю сеть этого сервера: до него никто не достучится." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is not one of %s's home services" +msgstr "%s не входит в домашние сервисы человека %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is not one of Dawnline's tunnels." +msgstr "%s - не туннель Dawnline." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is on another server" +msgstr "%s на другом сервере" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is on the internet" +msgstr "%s в интернете" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is part of %s; choose %s instead." +msgstr "%s входит в %s, выберите %s." + +#: web/src/admin/pages/people.ts +msgid "%s is ready" +msgstr "%s: всё готово" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is the WAN." +msgstr "%s и есть WAN." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router" +msgstr "%s: адрес этого роутера" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router on a network %s doesn't reach" +msgstr "%s: адрес этого роутера в сети, недоступной для %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router: DNS is open to everyone" +msgstr "%s: адрес этого роутера, DNS открыт для всех" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router: the personal portal is open to everyone" +msgstr "%s: адрес этого роутера, портал открыт для всех" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is turned off" +msgstr "Устройство %s выключено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is up, listening on UDP %d." +msgstr "%s работает, слушает UDP %d." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s isn't connected right now" +msgstr "%s сейчас не подключено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s isn't in %s's home network" +msgstr "%s не входит в домашнюю сеть сервера %s" + +#: web/src/admin/cores/awg.ts +msgid "%s junk" +msgid_plural "%s junk" +msgstr[0] "%s пакет мусора" +msgstr[1] "%s пакета мусора" +msgstr[2] "%s пакетов мусора" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s left" +msgstr "осталось %s" + +#: web/src/shared/format.ts +msgid "%s min ago" +msgstr "%s мин назад" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s month" +msgid_plural "%s months" +msgstr[0] "%s месяц" +msgstr[1] "%s месяца" +msgstr[2] "%s месяцев" + +#: web/src/admin/widgets/health.ts +msgid "%s more in Diagnostics" +msgstr "Ещё %s в диагностике" + +#: web/src/admin/pages/components/awg.ts +msgid "%s moves to %s with OpenWrt %s." +msgstr "Сборка %s перейдёт на AmneziaWG %s с OpenWrt %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s must be a number or range" +msgstr "%s: нужно число или диапазон" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%s needs a manual switch in Components" +msgstr ": %s нужно включить вручную в «Компонентах»" + +#: web/src/admin/pages/overview.ts +msgid "%s needs its configuration again." +msgstr "%s: нужна новая конфигурация." + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s of %s" +msgstr "%s из %s" + +#: web/src/shared/format.ts +msgid "%s of %s GB" +msgstr "%s из %s ГБ" + +#: web/src/shared/format.ts +msgid "%s of %s GB this month" +msgstr "%s из %s ГБ в этом месяце" + +#: web/src/admin/pages/settings/portal.ts +msgid "%s of %s check passed" +msgid_plural "%s of %s checks passed" +msgstr[0] "Пройдено %s из %s проверки" +msgstr[1] "Пройдено %s из %s проверок" +msgstr[2] "Пройдено %s из %s проверок" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "%s of %s device" +msgid_plural "%s of %s devices" +msgstr[0] "%s из %s устройства" +msgstr[1] "%s из %s устройств" +msgstr[2] "%s из %s устройств" + +#: web/src/admin/pages/components/index.ts +msgid "%s of %s needs an update" +msgid_plural "%s of %s need an update" +msgstr[0] "%s из %s требует обновления" +msgstr[1] "%s из %s требуют обновления" +msgstr[2] "%s из %s требуют обновления" + +#: web/src/admin/pages/settings/backups.ts +msgid "%s older backup" +msgid_plural "%s older backups" +msgstr[0] "%s старая копия" +msgstr[1] "%s старые копии" +msgstr[2] "%s старых копий" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s on flash" +msgstr "%s во флеш-памяти" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s on this router" +msgstr "%s на этом роутере" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "%s online" +msgstr "%s в сети" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s overlaps %s." +msgstr "%s пересекается с %s." + +#: web/src/admin/pages/people.ts +msgid "%s paused" +msgstr "%s: доступ приостановлен" + +#: web/src/admin/access.ts +#: web/src/admin/map.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "%s person" +msgid_plural "%s people" +msgstr[0] "%s человек" +msgstr[1] "%s человека" +msgstr[2] "%s человек" + +#: web/src/admin/interfaces.ts +msgid "%s person has Home-only access: their devices need the configuration again to reach the new networks." +msgid_plural "%s people have Home-only access: their devices need the configuration again to reach the new networks." +msgstr[0] "У %s человека доступ только к домашней сети: чтобы видеть новые сети, устройствам нужно заново получить конфигурацию." +msgstr[1] "У %s человек доступ только к домашней сети: чтобы видеть новые сети, устройствам нужно заново получить конфигурацию." +msgstr[2] "У %s человек доступ только к домашней сети: чтобы видеть новые сети, устройствам нужно заново получить конфигурацию." + +#: web/src/admin/pages/person/activity.ts +msgid "%s place in 30 days" +msgid_plural "%s places in 30 days" +msgstr[0] "%s место за 30 дней" +msgstr[1] "%s места за 30 дней" +msgstr[2] "%s мест за 30 дней" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at %s, not this router (%s)." +msgstr "%s указывает на %s, а не на этот роутер (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at %s, not this router (WAN %s). Check your DNS / DDNS." +msgstr "%s указывает на %s, а не на этот роутер (WAN %s). Проверьте DNS / DDNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at this router (%s)." +msgstr "%s указывает на этот роутер (%s)." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s problem needs attention." +msgid_plural "%s problems need attention." +msgstr[0] "%s проблема требует внимания." +msgstr[1] "%s проблемы требуют внимания." +msgstr[2] "%s проблем требуют внимания." + +#: web/src/admin/cores/awg.ts +msgid "%s random packet of %s–%s bytes before each handshake." +msgid_plural "%s random packets of %s–%s bytes before each handshake." +msgstr[0] "%s случайный пакет размером %s–%s байт перед каждым рукопожатием." +msgstr[1] "%s случайных пакета размером %s–%s байт перед каждым рукопожатием." +msgstr[2] "%s случайных пакетов размером %s–%s байт перед каждым рукопожатием." + +#: web/src/admin/pages/overview.ts +msgid "%s reached the data limit." +msgstr "%s: достигнут лимит трафика." + +#: web/src/admin/pages/person/pickers.ts +msgid "%s reaches %s" +msgstr "%s: доступ к %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s reaches %s." +msgstr "%s: доступны сети %s." + +#: web/src/admin/pages/person/pickers.ts +msgid "%s reaches every home network" +msgstr "%s: доступ ко всем домашним сетям" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s reaches no home network." +msgstr "%s: нет доступа ни к одной домашней сети." + +#: web/src/admin/access.ts +msgid "%s removed" +msgstr "Удалено: %s" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s repair" +msgid_plural "%s repairs" +msgstr[0] "%s попытка исправления" +msgstr[1] "%s попытки исправления" +msgstr[2] "%s попыток исправления" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s repair today, last %s at %s" +msgid_plural "%s repairs today, last %s at %s" +msgstr[0] "%s исправление сегодня, последнее - %s в %s" +msgstr[1] "%s исправления сегодня, последнее - %s в %s" +msgstr[2] "%s исправлений сегодня, последнее - %s в %s" + +#: web/src/admin/pages/people.ts +msgid "%s resumed" +msgstr "%s: доступ возобновлён" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s since %s" +msgstr "%s с %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations." +msgstr "%s по-прежнему выдают устройствам старый адрес: укажите публичный адрес в настройках сервера (имя DDNS продолжит работать), после этого устройствам понадобятся новые конфигурации." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations." +msgstr "%s по-прежнему выдаёт устройствам старый адрес: укажите публичный адрес в настройках сервера (имя DDNS продолжит работать), после этого устройствам понадобятся новые конфигурации." + +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/updater/jobs.ts +msgid "%s system package" +msgid_plural "%s system packages" +msgstr[0] "%s системный пакет" +msgstr[1] "%s системных пакета" +msgstr[2] "%s системных пакетов" + +#: web/src/admin/netcheck.ts +msgid "%s takes over when the tunnel is down." +msgstr "Когда туннель не работает, используется %s." + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/header.ts +#: web/src/shared/format.ts +msgid "%s this month" +msgstr "%s в этом месяце" + +#: web/src/admin/pages/person/activity.ts +msgid "%s time" +msgid_plural "%s times" +msgstr[0] "%s раз" +msgstr[1] "%s раза" +msgstr[2] "%s раз" + +#: web/src/admin/pages/overview.ts +msgid "%s today" +msgstr "%s сегодня" + +#: web/src/admin/pages/components/index.ts +msgid "%s update" +msgid_plural "%s updates" +msgstr[0] "%s обновление" +msgstr[1] "%s обновления" +msgstr[2] "%s обновлений" + +#: web/src/admin/pages/components/activity.ts +msgid "%s update failed" +msgstr "%s: ошибка обновления" + +#: web/src/admin/access.ts +msgid "%s updated" +msgstr "Обновлено: %s" + +#: web/src/admin/pages/components/activity.ts +msgid "%s updated automatically" +msgstr "%s: обновлено автоматически" + +#: web/src/admin/pages/components/activity.ts +msgid "%s updated by you" +msgstr "%s: обновлено вручную" + +#: web/src/admin/pages/overview.ts +msgid "%s uses %s now - devices need their configuration again" +msgstr "%s теперь использует %s - устройствам нужна новая конфигурация" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s warning." +msgid_plural "%s warnings." +msgstr[0] "%s предупреждение." +msgstr[1] "%s предупреждения." +msgstr[2] "%s предупреждений." + +#: web/src/admin/pages/settings/logs.ts +msgid "%s year" +msgid_plural "%s years" +msgstr[0] "%s год" +msgstr[1] "%s года" +msgstr[2] "%s лет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s · restored" +msgstr "%s · восстановлено" + +#: web/src/admin/pages/person/limits.ts +msgid "%s – %s (router time)" +msgstr "%s – %s (время роутера)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s (Cloudflare). %s reaches the router only if this name is DNS-only there, or use the router's IP." +msgstr "%s → %s (Cloudflare). %s дойдёт до роутера, только если для этого имени там включён режим «DNS only»; или используйте IP роутера." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s (this router)." +msgstr "%s → %s (этот роутер)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s: IPv6 only, so only devices with IPv6 connect (the router's IPv4 %s has no name)." +msgstr "%s → %s: только IPv6, поэтому подключатся лишь устройства с IPv6 (у IPv4-адреса роутера %s нет имени)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s: IPv6 only, so only devices with IPv6 connect." +msgstr "%s → %s: только IPv6, поэтому подключатся лишь устройства с IPv6." + +#: web/src/admin/places/render.ts +msgid "%s%% of the time" +msgstr "%s%% времени" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s%% used" +msgstr "Использовано %s%%" + +#: web/src/admin/pages/overview.ts +msgid "%s, online" +msgstr "%s, в сети" + +#: web/src/admin/map.ts +msgid "%s: %s device in %s" +msgid_plural "%s: %s devices in %s" +msgstr[0] "%s: %s устройство, %s" +msgstr[1] "%s: %s устройства, %s" +msgstr[2] "%s: %s устройств, %s" + +#: web/src/admin/map.ts +msgid "%s: %s device in an unknown city" +msgid_plural "%s: %s devices in an unknown city" +msgstr[0] "%s: %s устройство, город неизвестен" +msgstr[1] "%s: %s устройства, город неизвестен" +msgstr[2] "%s: %s устройств, город неизвестен" + +#: web/src/admin/disguise.ts +msgid "%s: %s of 4" +msgstr "%s: %s из 4" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s: the device's own network handles it." +msgstr "%s: этот трафик идёт через собственную сеть устройства." + +#: web/src/shared/format.ts +msgid "%sd %sh" +msgstr "%s д %s ч" + +#: web/src/shared/format.ts +msgid "%sh %sm" +msgstr "%s ч %s мин" + +#: web/src/shared/format.ts +msgid "%sm" +msgstr "%s мин" + +#: web/src/admin/pages/overview.ts +msgid "%s’s access %s." +msgstr "%s: доступ %s." + +#: web/src/admin/pages/overview.ts +msgid "%s’s access has ended." +msgstr "%s: доступ закончился." + +#: web/src/admin/pages/overview.ts +msgid "%s’s end date passed (%s) · access kept." +msgstr "%s: дата окончания прошла (%s) · доступ сохранён." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "(%d more)" +msgstr "(ещё %d)" + +#: web/src/admin/pages/components/hero.ts +msgid "+%s more in What’s new" +msgid_plural "+%s more in What’s new" +msgstr[0] "Ещё %s пункт в «Что нового»" +msgstr[1] "Ещё %s пункта в «Что нового»" +msgstr[2] "Ещё %s пунктов в «Что нового»" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 month" +msgstr "+1 месяц" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 week" +msgstr "+1 неделя" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 year" +msgstr "+1 год" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "+10 GB this month" +msgstr "+10 ГБ в этом месяце" + +#: web/src/admin/pages/person/limits.ts +msgid "+3 months" +msgstr "+3 месяца" + +#: web/src/admin/pages/people.ts +msgid "1 month" +msgstr "1 месяц" + +#: web/src/admin/pages/people.ts +msgid "1 year" +msgstr "1 год" + +#: web/src/admin/pages/overview.ts +msgid "15 min" +msgstr "15 мин" + +#: web/src/admin/map.ts +msgid "24h" +msgstr "24 ч" + +#: web/src/admin/pages/people.ts +msgid "3 months" +msgstr "3 месяца" + +#: web/src/admin/map.ts +msgid "30 days" +msgstr "30 дней" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "4500 is IPsec’s port: most networks let it through." +msgstr "4500 - порт IPsec: большинство сетей его пропускают." + +#: web/src/admin/map.ts +msgid "7 days" +msgstr "7 дней" + +#: web/src/admin/pages/server.ts +msgid "A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)" +msgstr "С именем DDNS ссылки работают и после смены IP; не через Cloudflare (нужно имя в режиме «DNS only» или IP)" + +#: web/src/admin/pages/overview.ts +msgid "A DDNS name would follow it by itself." +msgstr "С DDNS-именем адрес обновлялся бы сам." + +#: web/src/admin/cores/awg.ts +msgid "A first packet shaped like a DNS answer." +msgstr "Первый пакет выглядит как ответ DNS." + +#: web/src/admin/netcheck.ts +msgid "A hostname has no spaces." +msgstr "В имени хоста не бывает пробелов." + +#: web/src/admin/pages/server.ts +msgid "A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT" +msgstr "Имя хоста или IP-адрес роутера в интернете; не через Cloudflare (нужно имя в режиме «DNS only» или IP). Подходит и IPv6 - это выход из CGNAT" + +#: web/src/admin/netcheck.ts +msgid "A number of GB, up to 100000." +msgstr "Число ГБ, не больше 100 000." + +#: web/src/admin/pages/settings/portal.ts +msgid "A page where each person adds and manages their devices with their personal link." +msgstr "Страница, где каждый по своей личной ссылке добавляет свои устройства и управляет ими." + +#: web/src/admin/pages/server.ts +msgid "A page where each person adds their own devices with their personal link" +msgstr "Страница, где каждый человек сам добавляет свои устройства по личной ссылке" + +#: web/src/admin/pages/settings/updates.ts +msgid "A set time keeps tunnel restarts out of the evening; the run happens within an hour of it." +msgstr "С заданным временем туннели не перезапускаются по вечерам; обновление начнётся в течение часа от него." + +#: web/src/admin/pages/settings/portal.ts +msgid "ACME isn’t installed. With it the router gets a certificate and browsers stop warning." +msgstr "ACME не установлен. С ним роутер получит сертификат, и браузеры перестанут предупреждать." + +#: web/src/admin/pages/settings/portal.ts +msgid "ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning." +msgstr "ACME не установлен. С ним роутер получит сертификат для %s, и браузеры перестанут предупреждать." + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +msgid "Access" +msgstr "Доступ" + +#: web/src/admin/pages/people.ts +msgid "Access %s (router time)" +msgstr "Доступ %s (время роутера)" + +#: web/src/admin/pages/person/limits.ts +msgid "Access & limits" +msgstr "Доступ и лимиты" + +#: web/src/admin/pages/person/limits.ts +msgid "Access and limits" +msgstr "Доступ и лимиты" + +#: web/src/admin/ui/badges.ts +msgid "Access ended" +msgstr "Доступ закончился" + +#: web/src/admin/pages/people.ts +msgid "Access ended %s" +msgstr "Доступ закончился %s" + +#: web/src/admin/pages/person/limits.ts +msgid "Access ends" +msgstr "Срок доступа" + +#: web/src/admin/pages/people.ts +msgid "Access ends %s" +msgstr "Окончание доступа: %s" + +#: web/src/admin/netcheck.ts +msgid "Access ends in %s day (%s)." +msgid_plural "Access ends in %s days (%s)." +msgstr[0] "Доступ закончится через %s день (%s)." +msgstr[1] "Доступ закончится через %s дня (%s)." +msgstr[2] "Доступ закончится через %s дней (%s)." + +#: web/src/admin/netcheck.ts +msgid "Access ends today (%s)." +msgstr "Доступ закончится сегодня (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Access must be lan, internet or both." +msgstr "Доступ должен быть lan, internet или both." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Access rules" +msgstr "Правила доступа" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Access rules aren’t loaded" +msgstr "Правила доступа не загружены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Access rules couldn't be updated (%s): the previous rules stay, so this change isn't in effect yet." +msgstr "Не удалось обновить правила доступа (%s): действуют прежние правила, поэтому изменение пока не вступило в силу." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Access rules couldn't load (%s): no device is loaded into the tunnels until they do." +msgstr "Не удалось загрузить правила доступа (%s): пока они не загрузятся, ни одно устройство не будет загружено в туннели." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Access rules loaded" +msgstr "Правила доступа загружены" + +#: web/src/admin/interfaces.ts +msgid "Access saved" +msgstr "Доступ сохранён" + +#: web/src/admin/pages/person/limits.ts +msgid "Access until %s" +msgstr "Доступ до %s" + +#: web/src/admin/pages/person/limits.ts +msgid "Access: %s" +msgstr "Доступ: %s" + +#: web/src/shared/format.ts +msgid "Active" +msgstr "Активен" + +#: web/src/admin/pages/components/awg.ts +msgctxt "build" +msgid "Active" +msgstr "Используется" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/device.ts +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Activity" +msgstr "События" + +#: web/src/admin/pages/settings/logs.ts +msgid "Activity log" +msgstr "Журнал событий" + +#: web/src/admin/logs.ts +msgid "Activity: %s." +msgstr "События: %s." + +#: web/src/admin/pages/settings/portal.ts +msgid "Add" +msgstr "Добавить" + +#: web/src/admin/device.ts +msgid "Add a device for %s" +msgstr "Новое устройство: %s" + +#: web/src/admin/pages/server.ts +msgid "Add a server" +msgstr "Добавить сервер" + +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "Add device" +msgstr "Добавить устройство" + +#: web/src/admin/access.ts +msgid "Add from devices at home" +msgstr "Добавить из домашних устройств" + +#: web/src/admin/pages/person/header.ts +msgid "Add note" +msgstr "Добавить заметку" + +#: web/src/admin/pages/people.ts +msgid "Add person" +msgstr "Добавить человека" + +#: web/src/admin/pages/server.ts +msgid "Add server" +msgstr "Добавить сервер" + +#: web/src/admin/access.ts +msgid "Add service" +msgstr "Добавить сервис" + +#: web/src/admin/invite.ts +msgid "Add the device and connect" +msgstr "Добавьте устройство и подключитесь" + +#: web/src/admin/device.ts +msgid "Added" +msgstr "Добавлено" + +#: web/src/admin/device.ts +msgid "Added %s" +msgstr "Добавлено %s" + +#: web/src/admin/pages/person/header.ts +msgctxt "date" +msgid "Added %s" +msgstr "Дата добавления: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link." +msgstr "Сейчас добавить устройство нельзя: VPN-сервер не готов. Обратитесь к тому, кто прислал вам эту ссылку." + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Adding the Russian translation" +msgstr "Добавление русского перевода" + +#: web/src/admin/access.ts +msgid "Address" +msgstr "Адрес" + +#: web/src/admin/pages/server.ts +msgid "Address copied" +msgstr "Адрес скопирован" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Address must be an IPv4 address." +msgstr "Адрес должен быть IPv4-адресом." + +#: web/src/admin/pages/server.ts +msgid "Address range" +msgstr "Диапазон адресов" + +#: web/src/admin/pages/settings/portal.ts +msgid "Addresses" +msgstr "Адреса" + +#: web/src/admin/pages/server.ts +msgid "Addresses devices get inside the tunnel" +msgstr "Адреса, которые устройства получают внутри туннеля" + +#: web/src/admin/interfaces.ts +msgid "Adds the LAN this router uses." +msgstr "Добавляет LAN, которую использует этот роутер." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Agent" +msgstr "Агент" + +#: web/src/admin/pages/person/limits.ts +msgid "Alert at 90%" +msgstr "Предупреждение при 90%" + +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/people.ts +msgid "All" +msgstr "Все" + +#: web/src/admin/pages/settings/portal.ts +msgid "All %s check passed" +msgid_plural "All %s checks passed" +msgstr[0] "%s проверка пройдена" +msgstr[1] "Все %s проверки пройдены" +msgstr[2] "Все %s проверок пройдены" + +#: web/src/admin/device.ts +msgid "All activity" +msgstr "Все события" + +#: web/src/admin/logs.ts +msgid "All categories" +msgstr "Все категории" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "All checks passed." +msgstr "Все проверки пройдены." + +#: web/src/admin/updater/operation.ts +msgid "All components" +msgstr "Все компоненты" + +#: web/src/admin/pages/overview.ts +msgid "All good. Nothing needs you right now." +msgstr "Всё в порядке. Сейчас ничего не требует вашего внимания." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "All in Log" +msgstr "Все в журнале" + +#: web/src/admin/pages/components/activity.ts +msgid "All in Log →" +msgstr "Всё в журнале →" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +#: web/src/admin/access.ts +msgid "All ports" +msgstr "Все порты" + +#: web/src/admin/access.ts +msgid "All ports, or e.g. 445, 5000" +msgstr "Все порты или, например, 445, 5000" + +#: web/src/admin/netcheck.ts +msgid "All ports." +msgstr "Все порты." + +#: web/src/admin/pages/person/pickers.ts +msgid "Allow fewer devices" +msgstr "Уменьшить лимит устройств" + +#: web/src/admin/pages/person/pickers.ts +msgid "Allow more devices" +msgstr "Увеличить лимит устройств" + +#: web/src/admin/access.ts +msgid "Allowed" +msgstr "Разрешено" + +#: web/src/admin/pages/person/limits.ts +msgid "Allowed %s–%s" +msgstr "Доступ %s–%s" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "Allowed hours" +msgstr "Часы доступа" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Allowed: %s" +msgstr "Разрешены: %s" + +#: web/src/admin/netcheck.ts +msgid "Already has %s device: remove %s first, or allow more." +msgid_plural "Already has %s devices: remove %s first, or allow more." +msgstr[0] "Уже %s устройство: сначала удалите %s или разрешите больше." +msgstr[1] "Уже %s устройства: сначала удалите %s или разрешите больше." +msgstr[2] "Уже %s устройств: сначала удалите %s или разрешите больше." + +#: web/src/admin/netcheck.ts +msgid "Already has %s device: remove one first, or allow more." +msgid_plural "Already has %s devices: remove one first, or allow more." +msgstr[0] "Уже %s устройство: сначала удалите одно или разрешите больше." +msgstr[1] "Уже %s устройства: сначала удалите одно или разрешите больше." +msgstr[2] "Уже %s устройств: сначала удалите одно или разрешите больше." + +#: web/src/admin/invite.ts +msgid "Also" +msgstr "Ещё" + +#: web/src/admin/disguise.ts +msgid "AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps" +msgstr "AmneziaVPN 4.8.12 и новее, приложения с AmneziaWG 2.0+" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaVPN → %s. Keep it private." +msgstr "AmneziaVPN → %s. Никому его не показывайте." + +#: web/src/admin/updater/operation.ts +msgid "AmneziaWG %s is installed" +msgstr "AmneziaWG %s установлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG %s: no source publishes this build for this firmware any more" +msgstr "AmneziaWG %s: ни один источник больше не публикует эту сборку для этой прошивки" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 2.0+ apps" +msgstr "Приложения с AmneziaWG 2.0+" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk." +msgstr "AmneziaWG 2.0: мусорные пакеты, пакеты с дополнением и первый пакет, похожий на DNS. Для сетей, которые научились распознавать мусор в духе 1.0." + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 3.1 apps" +msgstr "Приложения с AmneziaWG 3.1" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets." +msgstr "AmneziaWG 3.1: зашифрованные заголовки, случайные хвосты и дополнительное заполнение пакетов данных." + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS." +msgstr "AmneziaWG 3.1: зашифрованные заголовки пакетов, случайные хвосты и размеры, плавающие тайминги и первый пакет, похожий на DNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG answers may not reach devices" +msgstr "Ответы AmneziaWG могут не доходить до устройств" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG answers reach devices" +msgstr "Ответы AmneziaWG доходят до устройств" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG devices loaded" +msgstr "Устройства загружены в AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG firewall" +msgstr "Межсетевой экран для AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG firewall rules are missing" +msgstr "Нет правил межсетевого экрана для AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG installed" +msgstr "AmneziaWG установлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG is down" +msgstr "AmneziaWG не работает" + +#: web/src/admin/updater/operation.ts +msgid "AmneziaWG is installed" +msgstr "AmneziaWG установлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is installed, but its kernel module doesn't load on this firmware" +msgstr "AmneziaWG установлен, но его модуль ядра не загружается на этой прошивке" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is missing from the router" +msgstr ": AmneziaWG нет на роутере" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is not installed" +msgstr "AmneziaWG не установлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components." +msgstr "AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components, then choose Balanced." +msgstr "AmneziaWG не установлен: установите его в Dawnline → Компоненты, затем выберите «Сбалансированную»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components, then choose Maximum." +msgstr "AmneziaWG не установлен: установите его в Dawnline → Компоненты, затем выберите «Максимальную»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components." +msgstr "AmneziaWG не установлен: установите его в Dawnline → Компоненты." + +#: web/src/admin/pages/settings/updates.ts +msgid "AmneziaWG is off by default: a new kernel module restarts every tunnel." +msgstr "AmneziaWG по умолчанию выключен: новый модуль ядра перезапускает все туннели." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is running again" +msgstr ": AmneziaWG снова работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is running again · accepting connections on port %d" +msgstr ": AmneziaWG снова работает · принимает подключения на порту %d" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is up to date (%s)" +msgstr "Установлена актуальная версия AmneziaWG (%s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG isn't accepting connections on port %d" +msgstr ": AmneziaWG не принимает подключения на порту %d" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG isn't running" +msgstr ": AmneziaWG не работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/pages/server.ts +msgid "AmneziaWG isn’t installed" +msgstr "AmneziaWG не установлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG needs a build for the new firmware" +msgstr "Для новой прошивки нужна сборка AmneziaWG" + +#: web/src/admin/pages/components/index.ts +msgid "AmneziaWG not installed" +msgstr "AmneziaWG не установлен" + +#: web/src/admin/events/model.ts +msgid "AmneziaWG port" +msgstr "порт AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG port is free" +msgstr "Порт AmneziaWG свободен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG port is taken" +msgstr "Порт AmneziaWG занят" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG running" +msgstr "AmneziaWG работает" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaWG saved" +msgstr "Настройки AmneziaWG сохранены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG subnet is unique" +msgstr "Подсеть AmneziaWG уникальна" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG subnet overlaps another network" +msgstr "Подсеть AmneziaWG пересекается с другой сетью" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG update is available: %s → %s" +msgstr "Доступно обновление AmneziaWG: %s → %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "AmneziaWG's kernel module doesn't load on this firmware: reinstall a build for this kernel in Components." +msgstr "Модуль ядра AmneziaWG не загружается на этой прошивке: переустановите сборку для этого ядра в «Компонентах»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG’s kernel module doesn’t load" +msgstr "Модуль ядра AmneziaWG не загружается" + +#: web/src/admin/pages/server.ts +msgid "AmneziaWG’s kernel module doesn’t load on this firmware" +msgstr "Модуль ядра AmneziaWG не загружается на этой прошивке" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc +msgid "An update is running: wait for it to finish, then remove Dawnline." +msgstr "Идёт обновление: дождитесь его окончания, затем удалите Dawnline." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +#: web/src/admin/pages/components/index.ts +msgid "Another component action is already running" +msgstr "Уже выполняется другое действие с компонентами" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s are swallowed by a proxy on the router (%s): clients get no reply." +msgstr "Ответы с порта %s перехватывает прокси на роутере (%s): клиенты не получают ответа." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s go straight out." +msgstr "Ответы с порта %s уходят напрямую." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s go straight out. A proxy on the router diverts its own traffic (%s); these answers skip it." +msgstr "Ответы с порта %s уходят напрямую. Прокси на роутере перенаправляет свой трафик (%s), но эти ответы его минуют." + +#: web/src/admin/pages/settings/portal.ts +msgid "Answers reach visitors" +msgstr "Ответы доходят до посетителей" + +#: web/src/admin/disguise.ts +msgid "Any WireGuard app" +msgstr "Любое приложение WireGuard" + +#: web/src/admin/pages/person/limits.ts +msgid "Any time" +msgstr "В любое время" + +#: web/src/admin/pages/settings/portal.ts +msgid "Appearance" +msgstr "Внешний вид" + +#: web/src/admin/cores/awg.ts +msgid "Applies at once: every AmneziaWG device imports its configuration again." +msgstr "Применяется сразу: каждое устройство AmneziaWG заново импортирует конфигурацию." + +#: web/src/admin/disguise.ts +msgid "Apps with AmneziaWG 3.1 (current AmneziaVPN)" +msgstr "Приложения с AmneziaWG 3.1 (актуальный AmneziaVPN)" + +#: web/src/admin/pages/settings/updates.ts +msgid "As soon as found" +msgstr "Сразу" + +#: web/src/admin/pages/settings/updates.ts +msgid "At a set time" +msgstr "В заданное время" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/interfaces.ts +msgid "Auto" +msgstr "Авто" + +#: web/src/admin/interfaces.ts +msgid "Auto-detect LAN" +msgstr "Определять LAN автоматически" + +#: web/src/admin/interfaces.ts +msgid "Auto-detect WAN" +msgstr "Определять WAN автоматически" + +#: web/src/admin/pages/components/hero.ts +msgid "Auto-update" +msgstr "Автообновление" + +#: web/src/admin/netcheck.ts +msgid "Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets." +msgstr "Автоматически по типу устройства и маскировке: %s для компьютеров и роутеров, %s для телефонов и планшетов." + +#: web/src/admin/pages/settings/portal.ts +msgid "Automatic certificate" +msgstr "Сертификат выбирается автоматически" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Automatic update: %s" +msgstr "Автообновление: %s" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: AmneziaWG" +msgstr "Автообновление: AmneziaWG" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: Dawnline" +msgstr "Автообновление: Dawnline" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: components" +msgstr "Автообновление компонентов" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: system packages" +msgstr "Автообновление системных пакетов" + +#: web/src/admin/cores/awg.ts +#: web/src/shared/format.ts +msgid "B" +msgstr "Б" + +#: web/src/admin/pages/server.ts +msgid "Back" +msgstr "Назад" + +#: web/src/admin/pages/person/index.ts +msgid "Back to Servers" +msgstr "Назад к серверам" + +#: web/src/admin/places/render.ts +msgid "Back to now" +msgstr "Вернуться к текущему моменту" + +#: web/src/admin/pages/settings/backups.ts +msgid "Back up now" +msgstr "Создать копию" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Background agent isn’t running" +msgstr "Фоновый агент не запущен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Background agent running" +msgstr "Фоновый агент работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Backing up configuration" +msgstr "Создание резервной копии настроек" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Backup" +msgstr "Резервное копирование" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backup created" +msgstr "Резервная копия создана" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backup deleted" +msgstr "Резервная копия удалена" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup does not contain /etc/config/dawnline." +msgstr "В резервной копии нет /etc/config/dawnline." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup failed: %s" +msgstr "Не удалось создать резервную копию: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup failed: the archive could not be written (is the flash full?)" +msgstr "Не удалось создать резервную копию: архив не записан (не заполнена ли флеш-память?)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup is too large." +msgstr "Резервная копия слишком большая." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup not found." +msgstr "Резервная копия не найдена." + +#: web/src/admin/pages/settings/backups.ts +msgid "Backups" +msgstr "Резервные копии" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router." +msgstr "В резервных копиях есть приватные ключи: храните скачанные файлы надёжно. JSON переносит на другой роутер всё, кроме истории трафика." + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Balanced" +msgstr "Сбалансированная" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Balanced needs AmneziaWG 2.0 or newer on the router: install a current build in Dawnline → Components." +msgstr "Для «Сбалансированной» нужен AmneziaWG 2.0 или новее на роутере: установите актуальную сборку в Dawnline → Компоненты." + +#: web/src/admin/pages/settings/backups.ts +msgid "Before import" +msgstr "Перед импортом" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before removing a server" +msgstr "Перед удалением сервера" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before restore" +msgstr "Перед восстановлением" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before update" +msgstr "Перед обновлением" + +#: web/src/admin/pages/settings/portal.ts +msgid "Behind Cloudflare · often stalls in Russia" +msgstr "За Cloudflare · в России часто зависает" + +#: web/src/admin/access.ts +msgid "Blocked" +msgstr "Заблокировано" + +#: web/src/admin/events/model.ts +msgid "Blocked portal sign-ins (tunnels and services are in the service log)" +msgstr "Заблокированные входы на портал (туннели и службы - в журнале служб)" + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/limits.ts +msgid "Both" +msgstr "Дом и интернет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Both are %s's devices" +msgstr "Оба устройства принадлежат человеку %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Both are in %s" +msgstr "Оба в круге «%s»" + +#: web/src/admin/pages/person/index.ts +msgid "Breadcrumb" +msgstr "Навигационная цепочка" + +#: web/src/admin/pages/person/limits.ts +msgid "Browse the internet through your router. No access to devices at home, and home cannot reach theirs." +msgstr "Интернет через ваш роутер. Домашние устройства недоступны, и из дома к устройствам человека тоже не подключиться." + +#: web/src/admin/widgets/access-picker.ts +msgid "Browse the internet through your router. No access to devices at home." +msgstr "Интернет через ваш роутер. Домашние устройства недоступны." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings." +msgstr "После этого браузеры перестанут открывать портал. Обновите его через ACME или выберите другой сертификат в «Настройках»." + +#: web/src/admin/pages/components/awg.ts +msgid "Build and translation" +msgstr "Сборка и перевод" + +#: web/src/admin/logs.ts +msgid "By" +msgstr "Кто" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "CSV (spreadsheet)" +msgstr "CSV (таблица)" + +#: web/src/admin/pages/person/limits.ts +msgid "Can reach" +msgstr "Доступно" + +#: web/src/admin/pages/server.ts +#: web/src/admin/ui/modal.ts +msgid "Cancel" +msgstr "Отмена" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Cannot detect the firmware target" +msgstr "Не удаётся определить платформу прошивки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Cannot reach github.com/%s" +msgstr "Нет связи с github.com/%s" + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Can’t start" +msgstr "Не запускается" + +#: web/src/admin/logs.ts +msgid "Category" +msgstr "Категория" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate" +msgstr "Сертификат" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate file" +msgstr "Файл сертификата" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate saved" +msgstr "Сертификат сохранён" + +#: web/src/admin/pages/components/packages.ts +msgid "Certificates (ACME)" +msgstr "Сертификаты (ACME)" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Change" +msgstr "Изменить" + +#: web/src/admin/pages/people.ts +msgid "Change limit" +msgstr "Изменить лимит" + +#: web/src/admin/pages/server.ts +msgid "Change the tunnel network" +msgstr "Сменить сеть туннеля" + +#: web/src/admin/device.ts +msgid "Changed network" +msgstr "Сменило сеть" + +#: web/src/admin/pages/server.ts +msgid "Changing it marks devices “Update config” until they import again" +msgstr "После изменения устройства помечаются «Обновить конфигурацию», пока не импортируют её заново" + +#: web/src/admin/cores/awg.ts +msgid "Changing these marks devices “Update config” until they import again" +msgstr "После изменения устройства помечаются «Обновить конфигурацию», пока не импортируют её заново" + +#: web/src/admin/access.ts +#: web/src/admin/pages/components/index.ts +msgid "Check" +msgstr "Проверить" + +#: web/src/admin/access.ts +msgid "Check access" +msgstr "Проверка доступа" + +#: web/src/admin/pages/components/index.ts +msgid "Check all" +msgstr "Проверить все" + +#: web/src/admin/pages/settings/updates.ts +msgid "Check automatically" +msgstr "Проверять автоматически" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Check every 6h, 12h, 1d or 7d." +msgstr "Проверять можно раз в 6 ч, 12 ч, 1 день или 7 дней." + +#: web/src/admin/pages/components/index.ts +msgid "Check failed" +msgstr "Ошибка проверки" + +#: web/src/admin/pages/components/index.ts +msgid "Check for updates" +msgstr "Проверить обновления" + +#: web/src/admin/pages/components/awg.ts +msgid "Check for updates to see the builds for this router." +msgstr "Проверьте обновления, чтобы увидеть сборки для этого роутера." + +#: web/src/admin/pages/components/packages.ts +msgid "Check system packages" +msgstr "Проверить системные пакеты" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/index.ts +msgid "Checking AmneziaWG" +msgstr "Проверка AmneziaWG" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "Checking Dawnline" +msgstr "Проверка Dawnline" + +#: web/src/admin/pages/components/index.ts +msgid "Checking all components" +msgstr "Проверка всех компонентов" + +#: web/src/admin/pages/components/index.ts +msgid "Checking components" +msgstr "Проверка компонентов" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/components/packages.ts +msgid "Checking system packages" +msgstr "Проверка системных пакетов" + +#: web/src/admin/netcheck.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Checking where it points…" +msgstr "Проверяем, куда он указывает…" + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/updater/operation.ts +msgid "Checking…" +msgstr "Проверка…" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Checks" +msgstr "Проверки" + +#: web/src/admin/interfaces.ts +msgid "Choose %s to include it." +msgstr "Выберите %s, чтобы включить его." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Choose a device on at least one side." +msgstr "Выберите устройство хотя бы с одной стороны." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Choose a free port between 1 and 65535 (not 22, 53, 80 or 443)." +msgstr "Выберите свободный порт от 1 до 65535 (кроме 22, 53, 80 и 443)." + +#: web/src/admin/pages/people.ts +msgid "Choose a server on their page" +msgstr "Выберите сервер на странице человека" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Choose another interface name in the server settings." +msgstr "Выберите другое имя интерфейса в настройках сервера." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Choose the interface that leads to the internet." +msgstr "Выберите интерфейс, через который роутер выходит в интернет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Circle %s: server %s does not exist." +msgstr "Круг %s: сервера %s нет." + +#: web/src/admin/interfaces.ts +msgid "Circles" +msgstr "Круги" + +#: web/src/admin/pages/person/activity.ts +msgid "City-level, from the client IP" +msgstr "С точностью до города, по IP-адресу клиента" + +#: web/src/admin/pages/overview.ts +msgid "City-level, from the client IP · locations cached on the router" +msgstr "С точностью до города, по IP клиента · местоположения кешируются на роутере" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/settings/logs.ts +msgid "Clear" +msgstr "Очистить" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/activity.ts +msgid "Clear %s's activity" +msgstr "Очистить события: %s" + +#: web/src/admin/pages/settings/logs.ts +msgid "Clear activity" +msgstr "Очистить события" + +#: web/src/admin/pages/settings/logs.ts +msgid "Clear one person or device from their own page." +msgstr "Данные одного человека или устройства очищаются на его странице." + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Clear the log" +msgstr "Очистить журнал" + +#: web/src/admin/logs.ts +msgid "Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed." +msgstr "Очищает историю трафика устройства %s по дням и месяцам. Итоги и лимит трафика его владельца не меняются." + +#: web/src/admin/logs.ts +msgid "Clears %s's traffic history and that of their devices. Their data limit starts again from zero." +msgstr "Очищает историю трафика человека %s и всех его устройств. Лимит трафика начнёт считаться с нуля." + +#: web/src/admin/logs.ts +msgid "Clears traffic history for everyone. Data limits start again from zero." +msgstr "Очищает историю трафика у всех. Лимиты трафика начнут считаться с нуля." + +#: web/src/admin/device.ts +msgid "Client IP" +msgstr "IP клиента" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Clock is set" +msgstr "Часы настроены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Clock isn’t set" +msgstr "Часы не настроены" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/ui/drawer.ts +#: web/src/admin/ui/toast.ts +#: web/src/admin/updater/notes.ts +#: web/src/admin/updater/operation.ts +msgid "Close" +msgstr "Закрыть" + +#: web/src/admin/widgets/tiles.ts +msgid "Collecting… 1 point a minute" +msgstr "Сбор данных… 1 точка в минуту" + +#: web/src/admin/access.ts +msgid "Colour" +msgstr "Цвет" + +#: web/src/admin/access.ts +msgid "Colour %s" +msgstr "Цвет %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Components" +msgstr "Компоненты" + +#: web/src/admin/netcheck.ts +msgid "Computers and routers get %s, phones and tablets %s." +msgstr "Компьютеры и роутеры получат %s, телефоны и планшеты - %s." + +#: web/src/admin/pages/person/devices.ts +msgid "Config" +msgstr "Конфигурация" + +#: web/src/admin/cores/awg.ts +msgid "Configuration" +msgstr "Конфигурация" + +#: web/src/admin/cores/awg.ts +msgid "Configuration copied" +msgstr "Конфигурация скопирована" + +#: web/src/admin/ui/modal.ts +msgid "Confirm" +msgstr "Подтвердить" + +#: web/src/admin/device.ts +msgctxt "section" +msgid "Connect" +msgstr "Подключение" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Connected" +msgstr "Подключено" + +#: web/src/admin/device.ts +msgid "Connected from %s" +msgstr "Подключено с %s" + +#: web/src/admin/pages/server.ts +msgid "Connection" +msgstr "Подключение" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/events/model.ts +msgid "Connections" +msgstr "Подключения" + +#: web/src/admin/events/model.ts +msgid "Connects, disconnects and IP changes" +msgstr "Подключения, отключения и смена IP" + +#: web/src/admin/cores/awg.ts +msgctxt "AmneziaVPN app" +msgid "Continue" +msgstr "Продолжить" + +#: web/src/admin/ui/files.ts +msgid "Copied to clipboard" +msgstr "Скопировано в буфер обмена" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/admin/updater/notes.ts +msgid "Copy" +msgstr "Скопировать" + +#: web/src/admin/cores/awg.ts +msgid "Copy AmneziaVPN config" +msgstr "Скопировать конфигурацию AmneziaVPN" + +#: web/src/admin/pages/server.ts +msgid "Copy address" +msgstr "Скопировать адрес" + +#: web/src/admin/cores/awg.ts +msgid "Copy as config" +msgstr "Скопировать как конфиг" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Copy link" +msgstr "Скопировать ссылку" + +#: web/src/admin/updater/operation.ts +msgid "Copy log" +msgstr "Скопировать журнал" + +#: web/src/admin/invite.ts +msgid "Copy this link" +msgstr "Скопировать эту ссылку" + +#: web/src/admin/ui/files.ts +msgid "Copying is blocked here. Select the text and copy it by hand." +msgstr "Копирование здесь заблокировано. Выделите текст и скопируйте его вручную." + +#: web/src/admin/invite.ts +msgid "Could not draw the card" +msgstr "Не удалось нарисовать карточку" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Could not find a free id, try again." +msgstr "Не удалось подобрать свободный идентификатор, попробуйте ещё раз." + +#: web/src/admin/map.ts +msgid "Could not load the map library (no internet access from this browser?)" +msgstr "Не удалось загрузить библиотеку карты (нет доступа в интернет из этого браузера?)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Couldn't load devices into %s: %s." +msgstr "Сервер %s не принял устройства: %s." + +#: web/src/admin/access.ts +msgid "Couldn't read the devices at home." +msgstr "Не удалось получить список домашних устройств." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc +msgid "Couldn't save /etc/config/dawnline: %s. Is the flash full?" +msgstr "Не удалось сохранить /etc/config/dawnline: %s. Возможно, заполнена флеш-память?" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc +msgid "Couldn't save /etc/config/dawnline: the write failed. Is the flash full?" +msgstr "Не удалось сохранить /etc/config/dawnline: ошибка записи. Возможно, заполнена флеш-память?" + +#: web/src/admin/pages/server.ts +msgid "Couldn't show people: %s" +msgstr "Не удалось показать людей: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Couldn't write %s. Is the flash full?" +msgstr "Не удалось записать %s. Не заполнена ли флеш-память?" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Counts traffic and enforces end dates and quotas." +msgstr "Считает трафик и следит за датами окончания и лимитами трафика." + +#: web/src/admin/pages/people.ts +msgid "Create" +msgstr "Создать" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Create a new link?" +msgstr "Создать новую ссылку?" + +#: web/src/admin/pages/people.ts +msgid "Create and copy link" +msgstr "Создать и скопировать ссылку" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Create new link" +msgstr "Создать ссылку" + +#: web/src/admin/pages/server.ts +msgid "Create server" +msgstr "Создать сервер" + +#: web/src/admin/pages/people.ts +msgid "Created. Turn on the personal portal in Settings to get a link, or add devices for them here." +msgstr "Человек добавлен. Включите личный портал в настройках, чтобы получить ссылку, или добавьте устройства здесь." + +#: web/src/admin/pages/server.ts +msgid "Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started." +msgstr "При создании сервера сеть перезапустится на несколько секунд: AmneziaWG установили уже после её запуска." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Cross-site request refused." +msgstr "Запрос с другого сайта отклонён." + +#: web/src/admin/disguise.ts +msgid "Current" +msgstr "Текущая" + +#: web/src/admin/cores/awg.ts +msgid "Current parameters" +msgstr "Текущие параметры" + +#: web/src/admin/pages/person/limits.ts +msgid "Custom" +msgstr "Свой" + +#: web/src/admin/cores/awg.ts +msgctxt "disguise" +msgid "Custom" +msgstr "Своя" + +#: web/src/admin/events/model.ts +msgid "DNS" +msgstr "DNS" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "DNS for Home-only devices" +msgstr "DNS для домашнего доступа" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "DNS for Home-only devices isn’t working" +msgstr "DNS для домашнего доступа не работает" + +#: web/src/admin/pages/server.ts +msgid "DNS for devices" +msgstr "DNS для устройств" + +#: web/src/admin/cores/awg.ts +msgid "DNS-like first packets" +msgstr "Первые пакеты как DNS" + +#: web/src/admin/pages/settings/updates.ts +msgid "Daily" +msgstr "Раз в день" + +#: web/src/admin/pages/settings/logs.ts +msgid "Daily traffic" +msgstr "Трафик по дням" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Daily traffic history must be 7-1830 days." +msgstr "История трафика по дням: от 7 до 1830 дней." + +#: web/src/admin/pages/server.ts +msgid "Danger zone" +msgstr "Опасная зона" + +#: web/src/admin/pages/person/limits.ts +msgid "Data" +msgstr "Трафик" + +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/ui/badges.ts +msgid "Data limit" +msgstr "Лимит трафика" + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit %s GB" +msgstr "Лимит трафика: %s ГБ" + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit (GB)" +msgstr "Лимит трафика (ГБ)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Data limit must be a positive number of GB." +msgstr "Лимит трафика должен быть положительным числом ГБ." + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit period" +msgstr "Период лимита трафика" + +#: web/src/admin/pages/people.ts +#: web/src/shared/format.ts +msgid "Data limit reached" +msgstr "Лимит трафика исчерпан" + +#: web/src/admin/pages/person/limits.ts +msgid "Date" +msgstr "Дата" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +msgid "Dawnline" +msgstr "Dawnline" + +#: web/src/admin/updater/operation.ts +msgid "Dawnline %s is installed." +msgstr "Dawnline %s установлен." + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed." +msgstr "Dawnline его не останавливал: перезапустилась сеть роутера, его остановили вручную или он завершился с ошибкой." + +#: web/src/admin/pkgs.ts +msgid "Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds." +msgstr "Dawnline установит сборку AmneziaWG для этой прошивки и загрузит её. Если для этого понадобится перезапустить сетевую службу, соединения прервутся на несколько секунд." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Dawnline is up to date (%s)" +msgstr "Установлена актуальная версия Dawnline (%s)" + +#: web/src/admin/pages/settings/danger.ts +msgid "Dawnline removed" +msgstr "Dawnline удалён" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Dawnline update is available: %s → %s" +msgstr "Доступно обновление Dawnline: %s → %s" + +#: web/src/admin/updater/operation.ts +msgid "Dawnline updated to %s" +msgstr "Dawnline обновлён до %s" + +#: web/src/admin/state/live.ts +msgid "Dawnline was updated to %s: reload the page." +msgstr "Dawnline обновлён до версии %s: перезагрузите страницу." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Default device limit must be 1-32." +msgstr "Лимит устройств по умолчанию: от 1 до 32." + +#: web/src/admin/netcheck.ts +msgid "Default: a packet every 25 s keeps NAT open and “Connected” accurate." +msgstr "По умолчанию: пакет каждые 25 с держит NAT открытым, а статус «Подключено» - точным." + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Delete" +msgstr "Удалить" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Delete %s?" +msgstr "Удалить «%s»?" + +#: web/src/admin/pages/settings/backups.ts +msgid "Delete this backup?" +msgstr "Удалить эту резервную копию?" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Deleted" +msgstr "Удалено" + +#: web/src/admin/pages/settings/danger.ts +msgid "Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup." +msgstr "Удаляет туннель, правила межсетевого экрана, таблицу доступа и имена хостов, созданные Dawnline, и останавливает службу. Люди и ключи сохраняются в резервной копии." + +#: web/src/admin/logs.ts +msgid "Detail" +msgstr "Подробности" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Details" +msgstr "Подробнее" + +#: web/src/admin/device.ts +msgctxt "section" +msgid "Details" +msgstr "Сведения" + +#: web/src/admin/logs.ts +#: web/src/admin/map.ts +msgid "Device" +msgstr "Устройство" + +#: web/src/admin/events/render.ts +msgid "Device %s changed network %s" +msgstr "Устройство %s сменило сеть %s" + +#: web/src/admin/events/render.ts +msgid "Device %s connected" +msgstr "Устройство %s подключилось" + +#: web/src/admin/events/render.ts +msgid "Device %s connected from %s" +msgstr "Устройство %s подключилось с %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is also used by device %s of %s." +msgstr "Устройство %s (%s): адрес %s уже занят устройством %s (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is not a plain IPv4 address." +msgstr "Устройство %s (%s): адрес %s не является обычным IPv4-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is outside %s's tunnel %s." +msgstr "Устройство %s (%s): адрес %s вне туннеля сервера %s (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is the router's own address on %s." +msgstr "Устройство %s (%s): адрес %s принадлежит самому роутеру на сервере %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address (none) is not a plain IPv4 address." +msgstr "Устройство %s (%s): нет IPv4-адреса." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the preshared key is not a key." +msgstr "Устройство %s (%s): общий ключ (PSK) некорректен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the private key is not a key." +msgstr "Устройство %s (%s): приватный ключ некорректен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the public key is not a key." +msgstr "Устройство %s (%s): публичный ключ некорректен." + +#: web/src/admin/events/render.ts +msgid "Device %s went offline" +msgstr "Устройство %s отключилось" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s: person %s does not exist." +msgstr "Устройство %s: человека %s нет." + +#: web/src/admin/pages/person/pickers.ts +msgid "Device DNS - devices need their configuration again" +msgstr "DNS устройства - устройствам нужна новая конфигурация" + +#: web/src/admin/pages/server.ts +msgid "Device addresses" +msgstr "Адреса устройств" + +#: web/src/admin/cores/awg.ts +msgid "Device addresses come from it." +msgstr "Из неё выдаются адреса устройств." + +#: web/src/admin/pages/server.ts +msgid "Device addresses: %s" +msgstr "Адреса устройств: %s" + +#: web/src/admin/device.ts +msgid "Device disabled" +msgstr "Устройство отключено" + +#: web/src/admin/device.ts +msgid "Device enabled" +msgstr "Устройство включено" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Device hostnames" +msgstr "Имена устройств" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit must be between 1 and 32." +msgstr "Лимит устройств: от 1 до 32." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit reached (%d)." +msgstr "Достигнут лимит устройств (%d)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Device not found." +msgstr "Устройство не найдено." + +#: web/src/admin/device.ts +msgid "Device removed" +msgstr "Устройство удалено" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/pages/person/pickers.ts +msgid "Devices" +msgstr "Устройства" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Devices added through the old link keep working until they are removed. Remove them too:" +msgstr "Устройства, добавленные по старой ссылке, продолжат работать, пока их не удалят. Удалить и их:" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +msgid "Devices are marked “Update config” until they import again." +msgstr "Устройства помечены «Обновить конфигурацию», пока не импортируют её заново." + +#: web/src/admin/pages/people.ts +msgid "Devices can’t connect" +msgstr "Устройства не могут подключиться" + +#: web/src/admin/pages/people.ts +msgid "Devices can’t connect until you resume" +msgstr "Устройства не подключатся, пока вы не возобновите доступ" + +#: web/src/admin/pages/overview.ts +msgid "Devices connect once it is on" +msgstr "Устройства подключатся после включения сервера" + +#: web/src/admin/pages/server.ts +msgid "Devices connect to" +msgstr "Куда подключаются устройства" + +#: web/src/admin/netcheck.ts +msgid "Devices connect to %s." +msgstr "Устройства подключаются к %s." + +#: web/src/admin/netcheck.ts +msgid "Devices get %s – %s, the router %s." +msgstr "Устройства получат адреса %s – %s, роутер - %s." + +#: web/src/admin/netcheck.ts +msgid "Devices get names like %s." +msgstr "Устройства получат имена вида %s." + +#: web/src/admin/pages/server.ts +msgid "Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again." +msgstr "Сейчас у устройств адреса %s. Смените диапазон, если он пересекается с сетью, к которой вы подключаетесь; затем каждому устройству снова понадобится конфигурация." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices in one circle reach each other." +msgstr "Устройства одного круга видят друг друга." + +#: web/src/admin/pages/components/awg.ts +msgid "Devices need AmneziaVPN 3.1 or newer." +msgstr "На устройствах нужен AmneziaVPN 3.1 или новее." + +#: web/src/admin/interfaces.ts +msgid "Devices of different people never reach each other; a person's own devices don't either." +msgstr "Устройства разных людей никогда не видят друг друга; устройства одного человека - тоже." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices of different servers never reach each other." +msgstr "Устройства разных серверов никогда не видят друг друга." + +#: web/src/admin/access.ts +msgid "Devices of people in one circle reach each other. A person is in one circle at a time." +msgstr "Устройства людей из одного круга видят друг друга. Человек может быть только в одном круге." + +#: web/src/admin/interfaces.ts +msgid "Devices of people with home access reach each other, like home devices do. Internet-only people never." +msgstr "Устройства людей с доступом к домашней сети видят друг друга, как домашние устройства. Люди только с интернетом - никогда." + +#: web/src/admin/pages/settings/defaults.ts +msgid "Devices per person" +msgstr "Устройств на человека" + +#: web/src/admin/interfaces.ts +msgid "Devices reach each other" +msgstr "Связь между устройствами" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices reach each other on this server" +msgstr "На этом сервере устройства видят друг друга" + +#: web/src/admin/interfaces.ts +msgid "Devices reach each other: %s" +msgstr "Связь между устройствами: %s" + +#: web/src/admin/pages/person/pickers.ts +msgid "Devices see each other" +msgstr "Устройства видят друг друга" + +#: web/src/admin/netcheck.ts +msgid "Devices send a packet every %s s to keep NAT open (a little battery on phones)." +msgstr "Устройства отправляют пакет каждые %s с, чтобы NAT не закрылся (на телефонах это немного расходует батарею)." + +#: web/src/admin/access.ts +msgid "Devices that got an address from this router. Pick the ports to open, or all ports." +msgstr "Устройства, получившие адрес от этого роутера. Выберите, какие порты открыть, или все порты." + +#: web/src/admin/netcheck.ts +msgid "Devices use %s - home names and your LAN’s DNS filters no longer apply to them." +msgstr "Устройства используют %s - домашние имена и DNS-фильтры вашей LAN на них больше не действуют." + +#: web/src/admin/pages/person/pickers.ts +msgid "Device’s own DNS" +msgstr "DNS устройства" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/diagnostics/index.ts +msgid "Diagnostics" +msgstr "Диагностика" + +#: web/src/admin/device.ts +msgid "Disable" +msgstr "Отключить" + +#: web/src/admin/ui/badges.ts +msgid "Disabled" +msgstr "Отключено" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Disguise" +msgstr "Маскировка" + +#: web/src/admin/disguise.ts +msgid "Disguise method" +msgstr "Способ маскировки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Domain may use lowercase letters, digits, dashes and dots." +msgstr "В домене можно использовать строчные латинские буквы, цифры, дефисы и точки." + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/widgets/health.ts +msgid "Done" +msgstr "Готово" + +#: web/src/admin/device.ts +#: web/src/admin/events/render.ts +msgid "Done by you in LuCI" +msgstr "Сделано вами в LuCI" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Don’t warn" +msgstr "Не предупреждать" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Download" +msgstr "Скачать" + +#: web/src/admin/widgets/tiles.ts +msgctxt "speed" +msgid "Download" +msgstr "Приём" + +#: web/src/admin/cores/awg.ts +msgid "Download AmneziaWG config" +msgstr "Скачать конфигурацию AmneziaWG" + +#: web/src/admin/invite.ts +msgid "Download card" +msgstr "Скачать карточку" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Download failed: %s" +msgstr "Не удалось скачать: %s" + +#: web/src/admin/pages/settings/logs.ts +msgid "Download the log as %s" +msgstr "Скачать журнал в %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Downloading %s" +msgstr "Скачивание %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Downloading %s from %s" +msgstr "Скачивание %s из %s" + +#: web/src/admin/pages/settings/updates.ts +msgid "Downloads and installs new versions of the components below." +msgstr "Скачивает и устанавливает новые версии выбранных ниже компонентов." + +#: web/src/admin/access.ts +msgid "Each other" +msgstr "Друг с другом" + +#: web/src/admin/access.ts +msgid "Edit" +msgstr "Изменить" + +#: web/src/admin/access.ts +msgid "Edit %s" +msgstr "Изменить «%s»" + +#: web/src/admin/pages/person/header.ts +msgid "Edit note" +msgstr "Изменить заметку" + +#: web/src/admin/pages/settings/logs.ts +msgid "Empty" +msgstr "Пусто" + +#: web/src/admin/pages/server.ts +msgid "Empty = the portal’s address (%s)." +msgstr "Пусто - адрес портала (%s)." + +#: web/src/admin/pages/server.ts +msgid "Empty = the portal’s address." +msgstr "Пусто - адрес портала." + +#: web/src/admin/device.ts +msgid "Enable" +msgstr "Включить" + +#: web/src/admin/pages/settings/portal.ts +msgid "Enable portal" +msgstr "Включить портал" + +#: web/src/admin/cores/awg.ts +msgid "Encrypted headers" +msgstr "Зашифрованные заголовки" + +#: web/src/admin/pages/people.ts +msgid "End date" +msgstr "Дата окончания" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "End date must be YYYY-MM-DD." +msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "End dates and quotas use the router clock." +msgstr "Даты окончания и лимиты трафика считаются по часам роутера." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Endpoint must be a hostname or IP address." +msgstr "Адрес сервера должен быть именем хоста или IP-адресом." + +#: web/src/admin/pages/components/hero.ts +msgid "English only" +msgstr "Только английский" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Enter a circle name: up to 32 characters, without < > \" or \\." +msgstr "Введите название круга: до 32 символов, без < > \" и обратной косой черты." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Enter a device name (up to 48 characters)." +msgstr "Введите название устройства (до 48 символов)." + +#: web/src/admin/netcheck.ts +msgid "Enter a hostname or IP address." +msgstr "Введите имя хоста или IP-адрес." + +#: web/src/admin/netcheck.ts +msgid "Enter a name." +msgstr "Введите имя." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc +msgid "Enter a name: up to 48 characters, without < > \" or \\." +msgstr "Введите имя: до 48 символов, без < > \" и обратной косой черты." + +#: web/src/admin/pages/components/hero.ts +msgid "Enter a release tag like 0.3.1" +msgstr "Введите тег релиза, например 0.3.1" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Enter a time as HH:MM, 00:00 to 23:59." +msgstr "Введите время в формате ЧЧ:ММ, от 00:00 до 23:59." + +#: web/src/admin/pages/person/limits.ts +msgid "Enter both times, like 07:00 and 23:00." +msgstr "Укажите оба времени, например 07:00 и 23:00." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Error: %s" +msgstr "Ошибка: %s" + +#: web/src/admin/pages/settings/logs.ts +msgid "Every 10 min" +msgstr "Каждые 10 мин" + +#: web/src/admin/pages/settings/updates.ts +msgid "Every 12 h" +msgstr "Каждые 12 ч" + +#: web/src/admin/pages/settings/updates.ts +msgid "Every 6 h" +msgstr "Каждые 6 ч" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Every device has a key and an address of its own inside its server." +msgstr "У каждого устройства свой ключ и свой адрес на его сервере." + +#: web/src/admin/widgets/health.ts +msgid "Every interface restarts. Connections drop for a few seconds." +msgstr "Все интерфейсы перезапустятся. Соединения прервутся на несколько секунд." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Every minute it checks the tunnels and services and repairs what it can on its own." +msgstr "Каждую минуту проверяет туннели и службы и само исправляет, что может." + +#: web/src/admin/access.ts +msgid "Every step lets it through" +msgstr "Проходит все шаги" + +#: web/src/admin/interfaces.ts +msgid "Everyone" +msgstr "Все" + +#: web/src/admin/pages/settings/danger.ts +msgid "Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm." +msgstr "Все будут отключены, а туннель, правила межсетевого экрана и портал - удалены. Сначала будет сделана резервная копия. Чтобы подтвердить, введите «%s»." + +#: web/src/admin/pages/overview.ts +msgid "Everyone online" +msgstr "Все в сети" + +#: web/src/admin/interfaces.ts +msgid "Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it." +msgstr "Все, у кого есть доступ к домашней сети, видят эти сети, если на их странице какая-то не исключена; их устройства тоже доступны отсюда. Нажмите на сеть, чтобы добавить или убрать её." + +#: web/src/admin/logs.ts +msgid "Everything" +msgstr "Все" + +#: web/src/admin/pages/diagnostics/index.ts +msgid "Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own." +msgstr "Всё, от чего зависит Dawnline, проверяется в реальном времени. Автовосстановление само исправляет, что может." + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/updater/jobs.ts +msgid "Everything is up to date" +msgstr "Всё актуально" + +#: web/src/admin/pages/settings/backups.ts +msgid "Everything returns to %s. The current state is backed up first." +msgstr "Всё вернётся к состоянию этой копии (%s). Текущее состояние сначала сохранится в резервную копию." + +#: web/src/admin/pages/settings/portal.ts +msgid "Example code; each person gets their own three words." +msgstr "Код для примера: у каждого человека свои три слова." + +#: web/src/shared/format.ts +msgid "Expired" +msgstr "Срок истёк" + +#: web/src/admin/device.ts +#: web/src/admin/pages/diagnostics/log.ts +msgid "Export" +msgstr "Экспорт" + +#: web/src/admin/pages/person/activity.ts +msgid "Export CSV" +msgstr "Экспорт CSV" + +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Export JSON" +msgstr "Экспорт JSON" + +#: web/src/admin/pages/person/activity.ts +msgid "Export or clear" +msgstr "Экспорт или очистка" + +#: web/src/admin/pages/people.ts +msgid "Extend 1 month" +msgstr "Продлить на месяц" + +#: web/src/admin/pages/people.ts +msgid "Extended by 1 month" +msgstr "Продлено на месяц" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Extra data must be a positive number of GB." +msgstr "Дополнительный трафик должен быть положительным числом ГБ." + +#: web/src/admin/cores/awg.ts +msgid "Extra packets sent before the handshake." +msgstr "Дополнительные пакеты перед рукопожатием." + +#: web/src/admin/updater/operation.ts +msgid "Failed" +msgstr "Ошибка" + +#: web/src/admin/pages/components/hero.ts +msgid "Failed to load versions: %s" +msgstr "Не удалось загрузить версии: %s" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Fallback DNS" +msgstr "Запасной DNS" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Fallback DNS must be an IPv4 address (or empty for none)." +msgstr "Резервный DNS должен быть IPv4-адресом (или оставьте поле пустым, если он не нужен)." + +#: web/src/admin/access.ts +msgid "Family" +msgstr "Семья" + +#: web/src/admin/cores/awg.ts +msgid "File" +msgstr "Файл" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "File %s does not exist." +msgstr "Файл %s не существует." + +#: web/src/admin/pages/people.ts +msgid "Find a person or device" +msgstr "Найти человека или устройство" + +#: web/src/admin/pages/people.ts +msgid "Find…" +msgstr "Найти…" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/updater/operation.ts +msgid "Finished" +msgstr "Готово" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Firewall" +msgstr "Межсетевой экран" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Firewall zone or WAN rule is missing." +msgstr "Нет зоны межсетевого экрана или правила WAN." + +#: web/src/admin/pages/server.ts +msgid "First three numbers of the device addresses" +msgstr "Первые три числа адресов устройств" + +#: web/src/admin/widgets/health.ts +msgid "Fix" +msgstr "Исправить" + +#: web/src/admin/pages/settings/defaults.ts +msgid "For Home-only devices using home names: %s" +msgstr "Для устройств только с домашней сетью и домашними именами: %s" + +#: web/src/admin/pages/server.ts +msgid "For every device" +msgstr "Для всех устройств" + +#: web/src/admin/pages/server.ts +msgid "Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here." +msgstr "Пробросьте UDP-порт с вышестоящего роутера на этот и укажите здесь имя DDNS или публичный адрес того роутера." + +#: web/src/admin/pages/settings/portal.ts +msgid "Found automatically" +msgstr "Найден автоматически" + +#: web/src/admin/pages/settings/portal.ts +msgid "Free certificate from Let’s Encrypt" +msgstr "Бесплатный сертификат от Let’s Encrypt" + +#: web/src/admin/pages/person/pickers.ts +msgid "Free slot" +msgstr "Свободное место" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Free space on the router" +msgstr "Свободное место на роутере" + +#: web/src/admin/pages/person/limits.ts +msgid "From" +msgstr "С" + +#: web/src/admin/access.ts +msgid "From the rules on this server" +msgstr "По правилам этого сервера" + +#: web/src/admin/pages/server.ts +msgid "From your DDNS name." +msgstr "Из вашего имени DDNS." + +#: web/src/admin/pages/server.ts +msgid "From your Let’s Encrypt certificate." +msgstr "Из вашего сертификата Let’s Encrypt." + +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "GB" +msgstr "ГБ" + +#: web/src/shared/format.ts +msgid "Gbit/s" +msgstr "Гбит/с" + +#: web/src/admin/device.ts +msgid "Generate" +msgstr "Создать" + +#: web/src/admin/cores/awg.ts +msgid "Generate and apply" +msgstr "Создать и применить" + +#: web/src/admin/cores/awg.ts +msgid "Generate new disguise values?" +msgstr "Создать новые значения маскировки?" + +#: web/src/admin/device.ts +msgid "Generate new keys?" +msgstr "Создать новые ключи?" + +#: web/src/admin/cores/awg.ts +msgid "Generate new values" +msgstr "Создать новые значения" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub API rate limit reached: try again in an hour." +msgstr "Достигнут лимит запросов к API GitHub: попробуйте через час." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub did not answer, trying mirrors" +msgstr "GitHub не ответил, пробуем зеркала" + +#: web/src/admin/pages/settings/updates.ts +msgid "GitHub mirrors" +msgstr "Зеркала GitHub" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub: %s" +msgstr "GitHub: %s" + +#: web/src/admin/cores/awg.ts +msgid "H1–H4 random" +msgstr "H1–H4 случайные" + +#: web/src/admin/pages/components/packages.ts +msgid "HTTPS for the portal" +msgstr "HTTPS для портала" + +#: web/src/admin/netcheck.ts +msgid "HTTPS here, plain HTTP for links on IP addresses on %s." +msgstr "Здесь HTTPS, а на %s - обычный HTTP для ссылок с IP-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "HTTPS isn't available on this router: install %s." +msgstr "HTTPS на этом роутере недоступен: установите %s." + +#: web/src/admin/pages/settings/portal.ts +msgid "HTTPS isn’t available on this router" +msgstr "HTTPS на этом роутере недоступен" + +#: web/src/admin/netcheck.ts +msgid "HTTPS on this port, opened on WAN." +msgstr "HTTPS на этом порту, открыт на WAN." + +#: web/src/admin/cores/awg.ts +msgid "Handshake and key timers vary within these ranges instead of WireGuard’s fixed values." +msgstr "Таймеры рукопожатия и ключей меняются в этих пределах вместо фиксированных значений WireGuard." + +#: web/src/admin/pages/diagnostics/index.ts +#: web/src/admin/pages/overview.ts +msgid "Health" +msgstr "Состояние" + +#: web/src/admin/invite.ts +msgid "Hi, %s" +msgstr "Привет, %s" + +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Hide" +msgstr "Скрыть" + +#: web/src/admin/cores/awg.ts +msgid "Hide key" +msgstr "Скрыть ключ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +#: web/src/admin/access.ts +#: web/src/admin/map.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +msgid "Home" +msgstr "Дом" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home access includes the router." +msgstr "Доступ к домашней сети включает и роутер." + +#: web/src/admin/interfaces.ts +msgid "Home access reaches %s" +msgstr "Домашний доступ: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home access reaches every home network." +msgstr "Доступ к домашней сети открывает все домашние сети." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home and Internet" +msgstr "Дом и интернет" + +#: web/src/admin/widgets/access-picker.ts +msgid "Home devices and the internet, all through your router." +msgstr "Домашние устройства и интернет - всё через ваш роутер." + +#: web/src/admin/pages/person/limits.ts +msgid "Home devices and the internet, all through your router. Home reaches their devices too." +msgstr "Домашние устройства и интернет - всё через ваш роутер. Из дома устройства человека тоже доступны." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home devices reach only people with home access." +msgstr "Домашние устройства могут связаться только с людьми, у которых есть доступ к домашней сети." + +#: web/src/admin/access.ts +msgid "Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing." +msgstr "Домашние устройства видят устройства людей с доступом к домашней сети - в тех сетях, которые доступны этим людям. Люди на паузе, с закончившимся доступом или исчерпанным лимитом не видят ничего." + +#: web/src/admin/pages/person/pickers.ts +msgid "Home names" +msgstr "Домашние имена" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home names on - devices need their configuration again" +msgstr "Домашние имена включены - устройствам нужна новая конфигурация" + +#: web/src/admin/interfaces.ts +#: web/src/shared/format.ts +msgid "Home network" +msgstr "Домашняя сеть" + +#: web/src/shared/format.ts +msgid "Home network + Internet" +msgstr "Домашняя сеть и интернет" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home networks %s reaches. Networks added to the server later stay out." +msgstr "%s: доступны отмеченные домашние сети. Сети, добавленные на сервер позже, останутся недоступны." + +#: web/src/admin/pages/person/pickers.ts +msgid "Home networks %s reaches: all of them. Untick one to keep %s out of it." +msgstr "%s: доступны все домашние сети. Снимите отметку с сети, чтобы закрыть её для человека %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home only" +msgstr "Только дом" + +#: web/src/admin/map.ts +msgid "Home router" +msgstr "Домашний роутер" + +#: web/src/admin/access.ts +msgid "Home services" +msgstr "Домашние сервисы" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home services updated" +msgstr "Домашние сервисы обновлены" + +#: web/src/admin/pages/components/packages.ts +msgid "Home-like link" +msgstr "Домашний маршрут" + +#: web/src/admin/access.ts +msgid "Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers." +msgstr "Людей с доступом только к домашней сети можно ограничить этими сервисами вместо целых сетей (выбирается на странице человека). Общие для всех серверов." + +#: web/src/admin/pages/settings/logs.ts +msgid "Hourly" +msgstr "Раз в час" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Hours must look like 07:00-23:00." +msgstr "Часы доступа указываются так: 07:00-23:00." + +#: web/src/admin/pages/settings/updates.ts +msgid "How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first." +msgstr "Как Dawnline поддерживает компоненты в актуальном состоянии. Перед каждым обновлением Dawnline делает резервную копию настроек." + +#: web/src/admin/pages/server.ts +msgid "How devices reach the internet" +msgstr "Как устройства выходят в интернет" + +#: web/src/admin/pages/settings/updates.ts +msgid "How often" +msgstr "Как часто" + +#: web/src/admin/pages/settings/portal.ts +msgid "How the portal listens (80 and 443 stay free)" +msgstr "Как портал принимает подключения (80 и 443 остаются свободны)" + +#: web/src/admin/pages/overview.ts +msgid "Idle right now" +msgstr "Сейчас без трафика" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import" +msgstr "Импортировать" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import JSON" +msgstr "Импорт JSON" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import?" +msgstr "Импортировать?" + +#: web/src/admin/pages/settings/backups.ts +msgid "Imported" +msgstr "Импортировано" + +#: web/src/admin/cores/awg.ts +msgid "In every device configuration" +msgstr "В конфигурации каждого устройства" + +#: web/src/admin/pages/people.ts +msgid "In total" +msgstr "Всего" + +#: web/src/admin/pages/person/limits.ts +msgid "Includes +%s GB extra this month" +msgstr "В этом месяце +%s ГБ дополнительно" + +#: web/src/admin/cores/awg.ts +msgctxt "AmneziaVPN app" +msgid "Insert" +msgstr "Вставить" + +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/packages.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pkgs.ts +#: web/src/admin/widgets/health.ts +msgid "Install" +msgstr "Установить" + +#: web/src/admin/invite.ts +msgid "Install %s on the device" +msgstr "Установите %s на устройство" + +#: web/src/admin/pages/settings/portal.ts +msgid "Install ACME" +msgstr "Установить ACME" + +#: web/src/admin/pkgs.ts +msgid "Install ACME certificates?" +msgstr "Установить сертификаты ACME?" + +#: web/src/admin/pages/components/awg.ts +msgid "Install AmneziaWG %s?" +msgstr "Установить AmneziaWG %s?" + +#: web/src/admin/pages/server.ts +msgid "Install AmneziaWG first" +msgstr "Сначала установите AmneziaWG" + +#: web/src/admin/pkgs.ts +msgid "Install AmneziaWG?" +msgstr "Установить AmneziaWG?" + +#: web/src/admin/pages/components/hero.ts +msgid "Install Dawnline %s?" +msgstr "Установить Dawnline %s?" + +#: web/src/admin/pkgs.ts +msgid "Install HTTPS for the portal?" +msgstr "Установить HTTPS для портала?" + +#: web/src/admin/pages/settings/updates.ts +msgid "Install automatically" +msgstr "Устанавливать автоматически" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc +msgid "Install it in Dawnline → Components." +msgstr "Установите его в Dawnline → Компоненты." + +#: web/src/admin/pkgs.ts +msgid "Install the home-like link?" +msgstr "Установить домашний маршрут?" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Install updates immediately or scheduled." +msgstr "Обновления устанавливаются сразу или по расписанию." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Installation failed" +msgstr "Установка не удалась" + +#: web/src/admin/pages/components/hero.ts +msgid "Installed" +msgstr "Установлена" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installed Dawnline %s is newer than the release %s" +msgstr "Установленная версия Dawnline %s новее релиза %s" + +#: web/src/admin/updater/jobs.ts +msgid "Installed version is newer than the release (%s)" +msgstr "Установленная версия новее релиза (%s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +#: web/src/admin/pages/components/packages.ts +msgid "Installing %s" +msgstr "Установка: %s" + +#: web/src/admin/pkgs.ts +msgid "Installing ACME certificates" +msgstr "Установка сертификатов ACME" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pkgs.ts +msgid "Installing AmneziaWG" +msgstr "Установка AmneziaWG" + +#: web/src/admin/pages/components/hero.ts +msgid "Installing Dawnline %s" +msgstr "Установка Dawnline %s" + +#: web/src/admin/pkgs.ts +msgid "Installing HTTPS for the portal" +msgstr "Установка HTTPS для портала" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installing package" +msgstr "Установка пакета" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Installing the %s build" +msgstr "Установка сборки %s" + +#: web/src/admin/pkgs.ts +msgid "Installing the home-like link" +msgstr "Установка домашнего маршрута" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installing the translation" +msgstr "Установка перевода" + +#: web/src/admin/cores/awg.ts +msgid "Interface" +msgstr "Интерфейс" + +#: web/src/admin/interfaces.ts +msgid "Interface %s" +msgstr "Интерфейс %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Interface name: 1-12 lowercase letters, digits or _." +msgstr "Имя интерфейса: 1–12 строчных латинских букв, цифр или _." + +#: web/src/admin/access.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "Internet" +msgstr "Интернет" + +#: web/src/admin/interfaces.ts +msgid "Internet interface" +msgstr "Интерфейс интернета" + +#: web/src/admin/pages/person/pickers.ts +msgid "Internet keeps working exactly as without the VPN. Reach home devices by IP address." +msgstr "Интернет работает так же, как без VPN. К домашним устройствам обращайтесь по IP-адресу." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/server.ts +msgid "Internet like a home device" +msgstr "Интернет как у домашних устройств" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet like a home device isn’t working" +msgstr "Интернет как у домашних устройств не работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet like a home device not bypassed" +msgstr "Интернет как у домашних устройств: без обхода" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Internet only" +msgstr "Только интернет" + +#: web/src/admin/interfaces.ts +msgid "Internet straight to %s" +msgstr "Интернет напрямую через %s" + +#: web/src/admin/pages/overview.ts +msgid "Internet through the LAN is off: %s" +msgstr "Интернет через LAN выключен: %s" + +#: web/src/admin/interfaces.ts +msgid "Internet traffic enters %s as %s, so whatever handles home traffic (proxies, filters, DNS) handles it too." +msgstr "Интернет-трафик входит в %s с адресом %s, поэтому всё, что обрабатывает домашний трафик (прокси, фильтры, DNS), обрабатывает и его." + +#: web/src/admin/interfaces.ts +msgid "Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too." +msgstr "Интернет-трафик входит в роутер из вашей LAN, поэтому всё, что обрабатывает домашний трафик (прокси, фильтры, DNS), обрабатывает и его." + +#: web/src/admin/interfaces.ts +msgid "Internet traffic goes straight to the WAN for now." +msgstr "Пока интернет-трафик идёт прямо в WAN." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet traffic leaves through WAN directly." +msgstr "Интернет-трафик уходит напрямую через WAN." + +#: web/src/admin/interfaces.ts +msgid "Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on." +msgstr "Интернет-трафик будет входить в роутер из вашей LAN и обрабатываться как трафик любого домашнего устройства. Сохраните, чтобы включить." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Invalid JSON." +msgstr "Некорректный JSON." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid backup name." +msgstr "Недопустимое имя резервной копии." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid option %s." +msgstr "Недопустимый параметр %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Invalid port %s." +msgstr "Недопустимый порт %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Invalid public key." +msgstr "Недопустимый публичный ключ." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid section %s." +msgstr "Недопустимая секция %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Invalid service id." +msgstr "Недопустимый идентификатор сервиса." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Invalid value for %s." +msgstr "Недопустимое значение для %s." + +#: web/src/admin/invite.ts +msgid "Invite %s" +msgstr "Приглашение: %s" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Invite card" +msgstr "Карточка приглашения" + +#: web/src/admin/invite.ts +msgid "Invite card for %s" +msgstr "Карточка приглашения: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It is in the tunnel network %s." +msgstr "Он входит в сеть туннеля %s." + +#: web/src/admin/pages/components/hero.ts +msgid "It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong." +msgstr "Эта версия старше %s. Сначала будет создана резервная копия настроек - если что-то пойдёт не так, восстановите её в «Настройках»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves like a home device would." +msgstr "Трафик выходит так же, как у домашнего устройства." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves through %s." +msgstr "Трафик выходит через %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves through the WAN." +msgstr "Трафик выходит через WAN." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Its configuration doesn't send it to the router" +msgstr "Конфигурация устройства не направляет этот трафик на роутер" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Its configuration sends it to the router" +msgstr "Конфигурация устройства направляет этот трафик на роутер" + +#: web/src/admin/cores/awg.ts +msgid "Junk packets" +msgstr "Мусорные пакеты" + +#: web/src/admin/netcheck.ts +msgid "Just the name, without a path." +msgstr "Только имя, без пути." + +#: web/src/admin/netcheck.ts +msgid "Just the name, without a port (the port is on AmneziaWG)." +msgstr "Только имя, без порта (порт задаётся на вкладке AmneziaWG)." + +#: web/src/shared/format.ts +msgid "KB" +msgstr "КБ" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Keep access" +msgstr "Сохранить доступ" + +#: web/src/admin/pages/settings/logs.ts +msgid "Keep activity" +msgstr "Хранить события" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Keep activity for 0 (no age limit) to 9999 days." +msgstr "Хранить события можно от 0 (без ограничения по сроку) до 9999 дней." + +#: web/src/admin/pages/person/pickers.ts +msgid "Keep at least one network, or choose Internet only." +msgstr "Оставьте хотя бы одну сеть или выберите доступ «Интернет»." + +#: web/src/admin/pages/settings/updates.ts +msgid "Keep the previous version" +msgstr "Хранить прошлую версию" + +#: web/src/admin/cores/awg.ts +msgid "Keep-alive" +msgstr "Keep-alive" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Keep-alive must be 0-600 seconds." +msgstr "Keep-alive: от 0 до 600 секунд." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Keeping AmneziaWG %s for rollback" +msgstr "Сохранение AmneziaWG %s для отката" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Keeping Dawnline %s for rollback" +msgstr "Сохранение Dawnline %s для отката" + +#: web/src/admin/pages/components/hero.ts +msgid "Kept after the next update" +msgstr "Сохранится после следующего обновления" + +#: web/src/admin/events/model.ts +msgid "Kept for %s, %s, %s." +msgstr "Хранятся %s, %s, %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Kernel module, awg tool and the netifd protocol are present." +msgstr "Модуль ядра, утилита awg и протокол netifd на месте." + +#: web/src/admin/cores/awg.ts +msgid "Key" +msgstr "Ключ" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Key copied" +msgstr "Ключ скопирован" + +#: web/src/admin/pages/settings/portal.ts +msgid "Key file" +msgstr "Файл ключа" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed (is amneziawg-tools installed?)." +msgstr "Не удалось создать ключ (установлен ли amneziawg-tools?)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Key generation failed (no random data)." +msgstr "Не удалось создать ключ (нет случайных данных)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed." +msgstr "Не удалось создать ключ." + +#: web/src/admin/widgets/tiles.ts +msgid "Last 30 days" +msgstr "За 30 дней" + +#: web/src/admin/device.ts +msgid "Last 7 days" +msgstr "За 7 дней" + +#: web/src/admin/pages/components/hero.ts +msgid "Last check" +msgstr "Последняя проверка" + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Last seen" +msgstr "По активности" + +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Last seen %s" +msgstr "В сети %s" + +#: web/src/admin/pages/overview.ts +msgid "Last: %s, %s" +msgstr "Последнее подключение: %s, %s" + +#: web/src/admin/updater/jobs.ts +msgid "Latest version is installed" +msgstr "Установлена последняя версия" + +#: web/src/admin/netcheck.ts +msgid "Leave out https:// - just the name." +msgstr "Без https:// - только имя." + +#: web/src/admin/pages/components/packages.ts +msgid "Let’s Encrypt certificate for the portal" +msgstr "Сертификат Let’s Encrypt для портала" + +#: web/src/admin/pages/person/limits.ts +msgid "Limit hours" +msgstr "Ограничить часы" + +#: web/src/admin/invite.ts +msgid "Link copied" +msgstr "Ссылка скопирована" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Links on %s use plain HTTP: the link and the VPN keys in configurations travel unencrypted." +msgstr "Ссылки на %s используют обычный HTTP: ссылка и ключи VPN в конфигурациях передаются без шифрования." + +#: web/src/admin/netcheck.ts +msgid "Links on IP addresses also need %s, used by %s. Choose another port." +msgstr "Ссылкам с IP-адресом нужен и порт %s, но он занят: %s. Выберите другой порт." + +#: web/src/admin/netcheck.ts +msgid "Links on IP addresses also need the next port: choose a lower one." +msgstr "Ссылкам с IP-адресом нужен и следующий порт: выберите порт поменьше." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Links on IP addresses use plain HTTP on the next port (%d), which the portal cannot take. Choose another portal port." +msgstr "Ссылки с IP-адресом используют обычный HTTP на следующем порту (%d), а его портал занять не может. Выберите другой порт портала." + +#: web/src/admin/netcheck.ts +msgid "Links use %s." +msgstr "В ссылках будет %s." + +#: web/src/admin/pages/settings/portal.ts +msgid "Links will open for the people you send them to." +msgstr "Ссылки откроются у тех, кому вы их отправите." + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Listening" +msgstr "Приём подключений" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Listening on TCP %d." +msgstr "Слушает TCP %d." + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Listening port" +msgstr "Порт прослушивания" + +#: web/src/admin/pages/overview.ts +msgid "Live tunnel" +msgstr "Активный туннель" + +#: web/src/admin/interfaces.ts +msgid "Loading interfaces…" +msgstr "Загрузка интерфейсов…" + +#: web/src/admin/pages/server.ts +msgid "Loading people…" +msgstr "Загружаем людей…" + +#: web/src/admin/updater/notes.ts +msgid "Loading release notes…" +msgstr "Загрузка описания релиза…" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Loading the kernel module" +msgstr "Загрузка модуля ядра" + +#: web/src/admin/pages/components/hero.ts +msgid "Loading versions…" +msgstr "Загрузка версий…" + +#: web/src/admin/device.ts +msgid "Loading…" +msgstr "Загрузка…" + +#: web/src/admin/device.ts +msgid "Local address" +msgstr "Локальный адрес" + +#: web/src/admin/pages/settings/logs.ts +msgid "Location cache" +msgstr "Кэш местоположений" + +#: web/src/admin/pages/settings/logs.ts +msgid "Location cache cleared" +msgstr "Кэш местоположений очищен" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/map.ts +msgid "Locations" +msgstr "Места" + +#: web/src/admin/pages/person/activity.ts +msgid "Locations are off" +msgstr "Определение мест выключено" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Locations are off. %s." +msgstr "Определение мест выключено. %s." + +#: web/src/admin/pages/diagnostics/index.ts +msgid "Log" +msgstr "Журнал" + +#: web/src/admin/updater/operation.ts +msgid "Log copied" +msgstr "Журнал скопирован" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Log size must be 100-20000 events." +msgstr "Размер журнала: от 100 до 20 000 событий." + +#: web/src/admin/pages/settings/logs.ts +msgid "Logs & history" +msgstr "Журналы и история" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Looked %s" +msgstr "Проверено %s" + +#: web/src/admin/access.ts +msgid "Looking for devices at home…" +msgstr "Ищем устройства в домашней сети…" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Looking for the %s build for OpenWrt %s" +msgstr "Поиск сборки %s для OpenWrt %s" + +#: web/src/admin/pages/settings/updates.ts +msgid "Looks for new versions in the background; Components shows what it found and the service log names it." +msgstr "Ищет новые версии в фоне; найденное видно в «Компонентах» и в журнале службы." + +#: web/src/admin/netcheck.ts +msgid "Lowercase letters, digits, dashes and dots." +msgstr "Строчные латинские буквы, цифры, дефисы и точки." + +#: web/src/admin/netcheck.ts +msgid "Lowercase only." +msgstr "Только строчные буквы." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "LuCI link" +msgstr "Связь с LuCI" + +#: web/src/admin/pages/components/awg.ts +msgid "LuCI pages for AmneziaWG" +msgstr "Страницы LuCI для AmneziaWG" + +#: web/src/admin/pages/components/hero.ts +msgid "LuCI pages for Dawnline" +msgstr "Страницы LuCI для Dawnline" + +#: web/src/shared/format.ts +msgid "MB" +msgstr "МБ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "MTU is now automatic" +msgstr ": MTU теперь выбирается автоматически" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "MTU must be 1280-1500." +msgstr "MTU: от 1280 до 1500." + +#: web/src/admin/netcheck.ts +msgid "MTU must be 1280–1500, or empty for automatic." +msgstr "MTU - от 1280 до 1500 или пусто для автоматического выбора." + +#: web/src/admin/pages/settings/portal.ts +msgid "Made by the router: browsers warn until a certificate covers the address." +msgstr "Создан роутером: браузеры будут предупреждать, пока у адреса нет настоящего сертификата." + +#: web/src/admin/pages/settings/portal.ts +msgid "Main" +msgstr "Основной" + +#: web/src/admin/pages/settings/portal.ts +msgid "Make main" +msgstr "Сделать основным" + +#: web/src/admin/pages/settings/backups.ts +msgid "Manual" +msgstr "Вручную" + +#: web/src/admin/pages/settings/map.ts +msgid "Map & locations" +msgstr "Карта и местоположения" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Maximum" +msgstr "Максимальная" + +#: web/src/admin/pages/settings/logs.ts +msgid "Maximum events" +msgstr "Максимум событий" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Maximum needs AmneziaWG 3.1 on the router (kmod-amneziawg, amneziawg-tools 3.1): install a 3.1 build in Dawnline → Components." +msgstr "Для «Максимальной» нужен AmneziaWG 3.1 на роутере (kmod-amneziawg, amneziawg-tools 3.1): установите сборку 3.1 в Dawnline → Компоненты." + +#: web/src/admin/pages/settings/logs.ts +msgid "Maximum size" +msgstr "Максимальный размер" + +#: web/src/shared/format.ts +msgid "Mbit/s" +msgstr "Мбит/с" + +#: web/src/admin/pages/settings/logs.ts +msgid "Memory only" +msgstr "Только в памяти" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Method not allowed." +msgstr "Метод не поддерживается." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Missing: %s." +msgstr "Не хватает: %s." + +#: web/src/admin/pages/person/limits.ts +msgid "Monthly" +msgstr "В месяц" + +#: web/src/admin/pages/people.ts +msgid "Monthly data (GB)" +msgstr "Трафик в месяц (ГБ)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Monthly data must be a positive number of GB." +msgstr "Месячный лимит трафика должен быть положительным числом ГБ." + +#: web/src/admin/pages/settings/logs.ts +msgid "Monthly traffic" +msgstr "Трафик по месяцам" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Monthly traffic history must be 1-120 months." +msgstr "История трафика по месяцам: от 1 до 120 месяцев." + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/pages/settings/backups.ts +msgid "More" +msgstr "Ещё" + +#: web/src/admin/pages/overview.ts +msgid "Most: %s" +msgstr "Больше всех: %s" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Move" +msgstr "Перенести" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Move %s to another server" +msgstr "Перенос на другой сервер: %s" + +#: web/src/admin/pages/person/header.ts +msgid "Move to server…" +msgstr "Перенести на сервер…" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Moved to %s" +msgstr "Перенесено на %s" + +#: web/src/admin/netcheck.ts +msgid "Must start with http:// or https://." +msgstr "Адрес должен начинаться с http:// или https://." + +#: web/src/admin/access.ts +msgid "NAS" +msgstr "NAS" + +#: web/src/admin/device.ts +#: web/src/admin/pages/server.ts +msgid "Name" +msgstr "Имя" + +#: web/src/admin/access.ts +msgctxt "circle or service" +msgid "Name" +msgstr "Название" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +msgctxt "person" +msgid "Name" +msgstr "Имя" + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Name" +msgstr "По имени" + +#: web/src/admin/pages/server.ts +msgid "Name: %s" +msgstr "Имя: %s" + +#: web/src/admin/device.ts +msgid "Named after its type: %s." +msgstr "Имя по типу: %s." + +#: web/src/admin/netcheck.ts +msgid "Names can’t contain < > \" or \\." +msgstr "В имени не может быть символов < > \" и обратной косой черты." + +#: web/src/admin/pages/person/pickers.ts +msgid "Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down)." +msgstr "Работают имена вроде %s. Интернет-имена разрешаются дома, поэтому зависят от туннеля (когда он недоступен, их разрешает %s)." + +#: web/src/admin/pages/person/pickers.ts +msgid "Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down." +msgstr "Работают имена вроде %s. Интернет-имена разрешаются дома, поэтому зависят от туннеля - без резервного DNS они перестают работать, когда туннель недоступен." + +#: web/src/admin/map.ts +msgid "Near %s" +msgstr "Рядом: %s" + +#: web/src/admin/map.ts +msgid "Near the server" +msgstr "Рядом с сервером" + +#: web/src/admin/pages/person/limits.ts +msgid "Need a little more this month?" +msgstr "Нужно чуть больше в этом месяце?" + +#: web/src/admin/interfaces.ts +msgid "Needs %s." +msgstr "Требуется: %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Needs %s. Internet traffic leaves through WAN directly until then." +msgstr "Нужно установить %s. До тех пор интернет-трафик уходит напрямую через WAN." + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)." +msgstr "Нужен AmneziaWG 2.0 или новее на роутере (kmod-amneziawg и amneziawg-tools с июля 2025 года)." + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)." +msgstr "Нужен AmneziaWG 3.1 на роутере (kmod-amneziawg и amneziawg-tools 3.1)." + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 3.1 on the router: install it first." +msgstr "Нужен AmneziaWG 3.1 на роутере: сначала установите его." + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG on the router." +msgstr "Нужен AmneziaWG на роутере." + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Needs attention" +msgstr "Требует внимания" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Network interface %s already exists." +msgstr "Сетевой интерфейс %s уже существует." + +#: web/src/admin/interfaces.ts +msgid "Networks" +msgstr "Сети" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Networks a person does not reach cannot reach them either." +msgstr "Из сетей, недоступных человеку, к нему тоже нельзя подключиться." + +#: web/src/admin/pages/components/hero.ts +msgid "Never" +msgstr "Никогда" + +#: web/src/admin/pages/people.ts +msgid "Never connected" +msgstr "Подключений не было" + +#: web/src/admin/pages/server.ts +msgid "Never reached from the internet yet - test with a phone on mobile data." +msgstr "Из интернета ещё никто не подключался - проверьте с телефона через мобильный интернет." + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/pickers.ts +msgid "New circle" +msgstr "Новый круг" + +#: web/src/admin/device.ts +msgid "New keys" +msgstr "Новые ключи" + +#: web/src/admin/device.ts +msgid "New keys %s" +msgstr "Ключи обновлены %s" + +#: web/src/admin/device.ts +msgid "New keys generated" +msgstr "Новые ключи созданы" + +#: web/src/admin/pages/person/header.ts +msgid "New link" +msgstr "Новая ссылка" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link copied" +msgstr "Новая ссылка скопирована" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link created" +msgstr "Новая ссылка создана" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link created, %s device removed" +msgid_plural "New link created, %s devices removed" +msgstr[0] "Новая ссылка создана, %s устройство удалено" +msgstr[1] "Новая ссылка создана, %s устройства удалены" +msgstr[2] "Новая ссылка создана, %s устройств удалено" + +#: web/src/admin/pages/settings/defaults.ts +msgid "New people" +msgstr "Новые люди" + +#: web/src/admin/cores/awg.ts +msgid "New values applied" +msgstr "Новые значения применены" + +#: web/src/admin/pages/components/index.ts +msgid "Newer than release" +msgstr "Новее релиза" + +#: web/src/admin/pages/settings/logs.ts +msgid "Newest events are kept when the log is full." +msgstr "Когда журнал заполнен, сохраняются самые новые события." + +#: web/src/admin/pages/server.ts +msgid "Next" +msgstr "Далее" + +#: web/src/admin/pages/settings/backups.ts +msgid "Nightly" +msgstr "Ночная" + +#: web/src/admin/pages/settings/backups.ts +msgid "Nightly when something changed, and before every restore, import or update. The last 10 are kept." +msgstr "Каждую ночь, если что-то изменилось, а также перед каждым восстановлением, импортом и обновлением. Хранятся последние 10." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No %s build for OpenWrt %s in %s, or it could not be verified" +msgstr "Нет сборки %s для OpenWrt %s в %s, или её не удалось проверить" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No AmneziaWG build for OpenWrt %s (%s) yet" +msgstr "Для OpenWrt %s (%s) пока нет сборки AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No AmneziaWG build for OpenWrt %s yet" +msgstr "Для OpenWrt %s пока нет сборки AmneziaWG" + +#: web/src/admin/interfaces.ts +msgid "No IPv4 network" +msgstr "Нет сети IPv4" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No LAN detected." +msgstr "LAN не обнаружена." + +#: web/src/admin/interfaces.ts +msgid "No WAN found" +msgstr "WAN не найден" + +#: web/src/admin/device.ts +msgid "No activity yet." +msgstr "Событий пока нет." + +#: web/src/admin/updater/operation.ts +msgid "No answer" +msgstr "Нет ответа" + +#: web/src/admin/pages/settings/backups.ts +msgid "No backups yet." +msgstr "Резервных копий пока нет." + +#: web/src/admin/pages/components/awg.ts +msgid "No build" +msgstr "Нет сборки" + +#: web/src/admin/pages/person/pickers.ts +msgid "No circle" +msgstr "Без круга" + +#: web/src/admin/pages/person/limits.ts +msgid "No data limit" +msgstr "Без лимита трафика" + +#: web/src/admin/pages/overview.ts +msgid "No device has connected yet" +msgstr "Ещё ни одно устройство не подключалось" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "No device uses %s" +msgstr "Адрес %s не занят ни одним устройством" + +#: web/src/admin/access.ts +msgid "No devices found in the home network right now." +msgstr "Сейчас в домашней сети не найдено устройств." + +#: web/src/admin/pages/server.ts +msgid "No devices on this server yet: nothing else changes." +msgstr "На этом сервере пока нет устройств: больше ничего не изменится." + +#: web/src/admin/pages/person/limits.ts +msgid "No end" +msgstr "Бессрочно" + +#: web/src/admin/pages/person/limits.ts +msgid "No end date" +msgstr "Бессрочно" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "No events match." +msgstr "Подходящих событий нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free address left on %s." +msgstr "На сервере %s не осталось свободных адресов." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free address on %s." +msgstr "В сети %s нет свободного адреса." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free addresses left in the server subnet." +msgstr "В подсети сервера не осталось свободных адресов." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free link-local range for the internal link." +msgstr "Для внутреннего канала нет свободного диапазона link-local." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free routing table." +msgstr "Нет свободной таблицы маршрутизации." + +#: web/src/admin/interfaces.ts +msgid "No home network: Home access reaches nothing but this router." +msgstr "Нет домашней сети: с домашним доступом виден только этот роутер." + +#: web/src/admin/cores/awg.ts +msgid "No junk packets." +msgstr "Мусорных пакетов нет." + +#: web/src/admin/pages/settings/logs.ts +msgctxt "retention" +msgid "No limit" +msgstr "Без ограничений" + +#: web/src/admin/places/render.ts +msgid "No locations in this period." +msgstr "За этот период мест нет." + +#: web/src/admin/map.ts +#: web/src/admin/pages/person/activity.ts +msgid "No locations yet" +msgstr "Мест пока нет" + +#: web/src/admin/pages/components/hero.ts +msgid "No more versions." +msgstr "Больше версий нет." + +#: web/src/admin/interfaces.ts +msgid "No netifd interface" +msgstr "Нет интерфейса netifd" + +#: web/src/admin/pages/people.ts +msgid "No one here right now." +msgstr "Сейчас здесь никого нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No other policy routing ahead of the tunnel rules." +msgstr "Другой маршрутизации по политикам перед правилами туннеля нет." + +#: web/src/admin/pages/people.ts +msgid "No people yet. Add someone and send them their personal link." +msgstr "Пока никого нет. Добавьте человека и отправьте ему личную ссылку." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No previous AmneziaWG build is kept on the router" +msgstr "На роутере нет сохранённой предыдущей сборки AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "No previous Dawnline version is kept on the router" +msgstr "На роутере нет сохранённой предыдущей версии Dawnline" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "No problems in the last 7 days." +msgstr "За последние 7 дней проблем не было." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No public address: devices will not know where to connect." +msgstr "Нет публичного адреса: устройства не узнают, куда подключаться." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "No release %s in %s." +msgstr "Нет релиза %s в %s." + +#: web/src/admin/pages/people.ts +#: web/src/admin/ui/badges.ts +#: web/src/shared/format.ts +msgid "No server" +msgstr "Нет сервера" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No server yet" +msgstr "Сервера пока нет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "No server yet." +msgstr "Сервера пока нет." + +#: web/src/admin/pages/people.ts +msgid "No server yet. %s before adding people." +msgstr "Сервера ещё нет. %s, прежде чем добавлять людей." + +#: web/src/admin/access.ts +msgid "No services yet: pick ports of a device below." +msgstr "Сервисов пока нет: выберите порты устройства ниже." + +#: web/src/admin/widgets/tiles.ts +msgid "No traffic yet." +msgstr "Трафика пока нет." + +#: web/src/admin/cores/awg.ts +msgid "No values yet" +msgstr "Значений пока нет" + +#: web/src/admin/pages/components/hero.ts +msgid "No versions found." +msgstr "Версии не найдены." + +#: web/src/admin/pages/server.ts +msgid "Nobody can connect. Turn it on to bring the tunnel back." +msgstr "Никто не может подключиться. Включите сервер, чтобы вернуть туннель." + +#: web/src/admin/pages/person/pickers.ts +msgid "Nobody else in %s yet" +msgstr "В круге «%s» пока больше никого" + +#: web/src/admin/pages/overview.ts +msgid "Nobody is connected" +msgstr "Никто не подключён" + +#: web/src/admin/pages/settings/defaults.ts +msgid "None" +msgstr "Нет" + +#: web/src/admin/pages/people.ts +msgctxt "end date" +msgid "None" +msgstr "Бессрочно" + +#: web/src/admin/netcheck.ts +msgid "None: without the tunnel those devices have no DNS." +msgstr "Нет: без туннеля у этих устройств не будет DNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Not a Dawnline export." +msgstr "Файл не является экспортом Dawnline." + +#: web/src/admin/pages/settings/backups.ts +msgid "Not a JSON file." +msgstr "Это не файл JSON." + +#: web/src/admin/netcheck.ts +msgid "Not a usable address (no spaces or quotes)." +msgstr "Неподходящий адрес (без пробелов и кавычек)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Not a valid backup archive." +msgstr "Файл не является корректным архивом резервной копии." + +#: web/src/admin/pages/components/index.ts +msgid "Not checked" +msgstr "Не проверено" + +#: web/src/admin/ui/badges.ts +msgid "Not connected yet" +msgstr "Ещё не подключалось" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "Not enough free space on the router: %d MB free, about %d MB needed. Remove old backups or packages first" +msgstr "Недостаточно места на роутере: свободно %d МБ, нужно около %d МБ. Сначала удалите старые резервные копии или пакеты" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Not every device is loaded into AmneziaWG" +msgstr "Не все устройства загружены в AmneziaWG" + +#: web/src/admin/interfaces.ts +msgid "Not found now: using %s." +msgstr "Сейчас не найден: используется %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +#: web/src/admin/interfaces.ts +msgid "Not found." +msgstr "Не найден." + +#: web/src/admin/interfaces.ts +msgid "Not in a firewall zone: the firewall rejects this traffic." +msgstr "Не в зоне межсетевого экрана: он отклоняет этот трафик." + +#: web/src/admin/pages/components/awg.ts +msgid "Not installed" +msgstr "Не установлено" + +#: web/src/admin/interfaces.ts +msgid "Not present right now" +msgstr "Сейчас отсутствует" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Not recorded: %s." +msgstr "Не записываются: %s." + +#: web/src/admin/pages/server.ts +msgid "Not running" +msgstr "Не работает" + +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Not set up yet" +msgstr "Ещё не настроено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Not set up." +msgstr "Не настроено." + +#: web/src/admin/pages/settings/portal.ts +msgid "Not set: the certificate is picked automatically." +msgstr "Не заданы: сертификат выбирается автоматически." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Not working" +msgstr "Не работает" + +#: web/src/admin/interfaces.ts +msgid "Not working: %s" +msgstr "Не работает: %s" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note" +msgstr "Заметка" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note removed" +msgstr "Заметка удалена" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note saved" +msgstr "Заметка сохранена" + +#: web/src/admin/updater/operation.ts +msgid "Nothing else was changed." +msgstr "Больше ничего не изменилось." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Nothing listens on TCP %d." +msgstr "TCP %d никто не слушает." + +#: web/src/admin/logs.ts +msgid "Nothing matched" +msgstr "Ничего не найдено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Nothing to install" +msgstr "Нечего устанавливать" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc +msgid "Nothing to save." +msgstr "Нечего сохранять." + +#: web/src/admin/pages/person/activity.ts +msgid "Nothing yet." +msgstr "Пока ничего нет." + +#: web/src/admin/pages/overview.ts +msgid "Nothing yet. Connections, new devices and pauses appear here." +msgstr "Пока ничего. Здесь появятся подключения, новые устройства и паузы." + +#: web/src/admin/access.ts +msgid "Now in %s" +msgstr "Сейчас в круге «%s»" + +#: web/src/admin/interfaces.ts +msgid "Now: %s, was %s." +msgstr "Сейчас: %s, было %s." + +#: web/src/admin/interfaces.ts +msgid "Now: %s." +msgstr "Сейчас: %s." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "OK" +msgstr "Работает" + +#: web/src/admin/disguise.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/server.ts +msgid "Off" +msgstr "Выкл." + +#: web/src/admin/netcheck.ts +msgid "Off: NAT may close the tunnel when idle, and “Connected” lags." +msgstr "Выкл.: NAT может закрыть туннель при простое, а статус «Подключено» будет запаздывать." + +#: web/src/admin/interfaces.ts +msgid "Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router." +msgstr "Выкл.: интернет-трафик идёт прямо в WAN, минуя всё, что обрабатывает домашний трафик на этом роутере." + +#: web/src/admin/pages/server.ts +msgid "Off: only you add devices, from LuCI. On: people manage their devices within the limits you set." +msgstr "Выкл.: устройства добавляете только вы, в LuCI. Вкл.: люди сами управляют своими устройствами в заданных вами пределах." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Off: problems are only written to the log. Nothing is repaired on its own." +msgstr "Выключено: проблемы только записываются в журнал. Само ничего не исправляется." + +#: web/src/admin/pages/people.ts +msgid "Offline" +msgstr "Не в сети" + +#: web/src/admin/pages/settings/logs.ts +msgid "Older events are removed automatically." +msgstr "Более старые события удаляются автоматически." + +#: web/src/admin/logs.ts +msgid "Older than %s day" +msgid_plural "Older than %s days" +msgstr[0] "Старше %s дня" +msgstr[1] "Старше %s дней" +msgstr[2] "Старше %s дней" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Older than must be a number of days." +msgstr "Возраст нужно указать числом дней." + +#: web/src/admin/pages/components/hero.ts +msgid "Older →" +msgstr "Старше →" + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/server.ts +msgid "On" +msgstr "Вкл." + +#: web/src/admin/updater/notes.ts +msgid "On GitHub" +msgstr "На GitHub" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "On one of the networks %s reaches." +msgstr "В одной из сетей, доступных для %s." + +#: web/src/admin/pages/server.ts +msgid "One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page." +msgstr "Ещё один сервер: другой порт или маскировка для сетей, где первый не проходит, или свои правила доступа к домашней сети. Людей переносят между серверами на их странице." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "One of the networks %s reaches." +msgstr "Одна из сетей, доступных для %s." + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "Online" +msgstr "В сети" + +#: web/src/admin/map.ts +msgid "Online now" +msgstr "В сети" + +#: web/src/admin/pages/person/pickers.ts +msgid "Only %s's own devices" +msgstr "%s: только свои устройства" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only devices of people with home access can be reached." +msgstr "Доступны только устройства людей с доступом к домашней сети." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only home devices reach people's devices." +msgstr "Связаться с устройствами людей могут только домашние устройства." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only people with home access reach other devices." +msgstr "Связаться с другими устройствами могут только люди с доступом к домашней сети." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Only the admin can turn devices off." +msgstr "Отключать устройства может только администратор." + +#: web/src/admin/pages/person/pickers.ts +msgid "Only the selected services at home." +msgstr "Только выбранные домашние сервисы." + +#: web/src/admin/pages/person/dialogs.ts +msgid "Only you see this" +msgstr "Видно только вам" + +#: web/src/admin/pages/people.ts +msgid "Open" +msgstr "Открыть" + +#: web/src/admin/map.ts +msgid "Open %s" +msgstr "Открыть «%s»" + +#: web/src/admin/pages/server.ts +#: web/src/admin/widgets/health.ts +msgid "Open Components" +msgstr "Открыть компоненты" + +#: web/src/admin/pages/overview.ts +msgid "Open Diagnostics" +msgstr "Открыть диагностику" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Open Diagnostics → Health." +msgstr "Откройте «Диагностика» → «Состояние»." + +#: web/src/admin/pages/people.ts +msgid "Open Settings" +msgstr "Открыть настройки" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Open on GitHub" +msgstr "Открыть на GitHub" + +#: web/src/admin/map.ts +msgid "Open person" +msgstr "Открыть страницу человека" + +#: web/src/admin/pages/components/packages.ts +msgid "Open the OpenWrt package list" +msgstr "Открыть список пакетов OpenWrt" + +#: web/src/admin/invite.ts +msgid "Open the link or scan the code" +msgstr "Откройте ссылку или отсканируйте код" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Open this link over HTTPS to get the connection settings." +msgstr "Чтобы получить настройки подключения, откройте эту ссылку по HTTPS." + +#: web/src/admin/pages/components/packages.ts +msgid "OpenSSL for uhttpd" +msgstr "OpenSSL для uhttpd" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Opened on the WAN firewall automatically." +msgstr "Порт открывается в межсетевом экране WAN автоматически." + +#: web/src/admin/updater/operation.ts +msgid "Operation completed" +msgstr "Операция завершена" + +#: web/src/admin/updater/operation.ts +msgid "Operation failed" +msgstr "Операция не удалась" + +#: web/src/admin/updater/operation.ts +msgid "Operation log" +msgstr "Журнал операции" + +#: web/src/admin/updater/operation.ts +msgid "Operation started. Waiting for log output…" +msgstr "Операция запущена. Ожидание записей журнала…" + +#: web/src/admin/netcheck.ts +msgid "Optional. No data limit." +msgstr "Необязательно. Без лимита трафика." + +#: web/src/admin/netcheck.ts +msgid "Optional. No end date." +msgstr "Необязательно. Без даты окончания." + +#: web/src/admin/interfaces.ts +#: web/src/shared/format.ts +msgid "Other" +msgstr "Другое" + +#: web/src/admin/pages/settings/portal.ts +msgid "Other address" +msgstr "Другой адрес" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Other addresses must be hostnames or IP addresses." +msgstr "Другие адреса должны быть именами хостов или IP-адресами." + +#: web/src/admin/interfaces.ts +msgid "Other interfaces" +msgstr "Другие интерфейсы" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Other policy routing bypasses the home-device path" +msgstr "Другая маршрутизация по политикам обходит путь домашних устройств" + +#: web/src/admin/pages/people.ts +#: web/src/shared/format.ts +msgid "Outside allowed hours" +msgstr "Вне часов доступа" + +#: web/src/admin/ui/badges.ts +msgid "Outside hours" +msgstr "Вне расписания" + +#: web/src/admin/pages/person/devices.ts +msgid "Over the limit" +msgstr "Сверх лимита" + +#: web/src/admin/pages/people.ts +msgid "Over the limit: admins can still add" +msgstr "Сверх лимита: администратор всё равно может добавить" + +#: web/src/admin/pages/server.ts +msgid "Overview" +msgstr "Обзор" + +#: web/src/shared/format.ts +msgid "PC" +msgstr "Компьютер" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Package installation failed" +msgstr "Установка пакетов не удалась" + +#: web/src/admin/cores/awg.ts +msgid "Packet types" +msgstr "Типы пакетов" + +#: web/src/admin/cores/awg.ts +msgid "Padding" +msgstr "Дополнение" + +#: web/src/admin/pages/components/hero.ts +msgid "Page %s" +msgstr "Страница %s" + +#: web/src/admin/cores/awg.ts +msgid "Parameters copied" +msgstr "Параметры скопированы" + +#: web/src/admin/pages/settings/portal.ts +msgid "Paths on the router. Leave both empty to pick a certificate automatically." +msgstr "Пути на роутере. Оставьте оба поля пустыми, чтобы сертификат выбирался автоматически." + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Pause" +msgstr "Приостановить" + +#: web/src/admin/places/render.ts +msgctxt "replay" +msgid "Pause" +msgstr "Пауза" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Pause access" +msgstr "Приостановить доступ" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/ui/badges.ts +#: web/src/shared/format.ts +msgid "Paused" +msgstr "На паузе" + +#: web/src/admin/netcheck.ts +msgid "Paused after %s GB in total." +msgstr "Приостановится после %s ГБ за всё время." + +#: web/src/admin/netcheck.ts +msgid "Paused after %s GB this month, resumed on the 1st." +msgstr "Приостановится после %s ГБ за месяц и возобновится 1-го числа." + +#: web/src/admin/pages/people.ts +msgid "Paused until it resets on %s" +msgstr "На паузе до сброса лимита %s" + +#: web/src/admin/pages/people.ts +msgid "Paused until the limit is raised" +msgstr "На паузе, пока лимит не увеличат" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/access.ts +#: web/src/admin/events/model.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/index.ts +#: web/src/admin/pages/server.ts +msgid "People" +msgstr "Люди" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "People and devices are inconsistent" +msgstr "Данные людей и устройств не согласованы" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "People and devices consistent" +msgstr "Данные людей и устройств согласованы" + +#: web/src/admin/events/model.ts +msgid "People and their devices added, changed, paused, removed" +msgstr "Люди и их устройства: добавление, изменение, пауза, удаление" + +#: web/src/admin/access.ts +msgid "People limited to this service lose access to it." +msgstr "Люди, у которых доступ только к этому сервису, потеряют его." + +#: web/src/admin/interfaces.ts +msgid "People with Home or Both" +msgstr "Для людей с доступом к домашней сети" + +#: web/src/admin/interfaces.ts +msgid "People with Internet or Both" +msgstr "Для людей с доступом в интернет" + +#: web/src/admin/pages/settings/logs.ts +msgid "Per-day history behind the charts." +msgstr "Дневная история для графиков." + +#: web/src/admin/pages/settings/logs.ts +msgid "Per-month totals; data limits use the current month." +msgstr "Итоги по месяцам; лимиты трафика считаются по текущему месяцу." + +#: web/src/admin/logs.ts +msgid "Person" +msgstr "Человек" + +#: web/src/admin/events/render.ts +msgid "Person %s - all devices removed, end date reached" +msgstr "%s: все устройства удалены - наступила дата окончания" + +#: web/src/admin/events/render.ts +msgid "Person %s added device %s" +msgstr "%s: добавлено устройство %s" + +#: web/src/admin/events/render.ts +msgid "Person %s added device %s on their portal" +msgstr "%s: добавлено устройство %s через портал" + +#: web/src/admin/events/render.ts +msgid "Person %s issued new keys for device %s on their portal" +msgstr "%s: выпущены новые ключи для устройства %s через портал" + +#: web/src/admin/events/render.ts +msgid "Person %s paused" +msgstr "%s: доступ приостановлен" + +#: web/src/admin/events/render.ts +msgid "Person %s paused - %s" +msgstr "%s: доступ приостановлен - %s" + +#: web/src/admin/events/render.ts +msgid "Person %s removed device %s" +msgstr "%s: удалено устройство %s" + +#: web/src/admin/events/render.ts +msgid "Person %s removed device %s on their portal" +msgstr "%s: удалено устройство %s через портал" + +#: web/src/admin/events/render.ts +msgid "Person %s resumed" +msgstr "%s: доступ возобновлён" + +#: web/src/admin/events/render.ts +msgid "Person %s resumed - %s" +msgstr "%s: доступ возобновлён - %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: circle %s does not exist." +msgstr "Человек %s: круга %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: has the same personal link as %s." +msgstr "Человек %s: личная ссылка совпадает со ссылкой человека %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: home service %s does not exist." +msgstr "Человек %s: домашнего сервиса %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: server %s does not exist." +msgstr "Человек %s: сервера %s нет." + +#: web/src/admin/events/render.ts +msgid "Person %s’s access ends in %s day" +msgid_plural "Person %s’s access ends in %s days" +msgstr[0] "%s: доступ закончится через %s день" +msgstr[1] "%s: доступ закончится через %s дня" +msgstr[2] "%s: доступ закончится через %s дней" + +#: web/src/admin/events/render.ts +msgid "Person %s’s access ends in a few days" +msgstr "%s: доступ закончится через несколько дней" + +#: web/src/admin/events/render.ts +msgid "Person %s’s end date passed (%s) · access kept" +msgstr "%s: дата окончания прошла (%s) · доступ сохранён" + +#: web/src/admin/pages/person/index.ts +msgid "Person not found" +msgstr "Человек не найден" + +#: web/src/admin/pages/people.ts +msgid "Person removed" +msgstr "Человек удалён" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +msgid "Personal link copied" +msgstr "Личная ссылка скопирована" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "Personal links" +msgstr "Личные ссылки" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +#: web/src/admin/events/render.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Personal portal" +msgstr "Личный портал" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Personal portal isn’t working" +msgstr "Личный портал не работает" + +#: web/src/shared/format.ts +msgid "Phone" +msgstr "Телефон" + +#: web/src/admin/pages/settings/portal.ts +msgid "Pick one or more; the first is the main link" +msgstr "Выберите один или несколько; первый - для основной ссылки" + +#: web/src/admin/pages/settings/portal.ts +msgid "Plain HTTP" +msgstr "Обычный HTTP" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain HTTP links" +msgstr "Ссылки по обычному HTTP" + +#: web/src/admin/pages/settings/portal.ts +msgid "Plain HTTP: the link and VPN keys travel unencrypted" +msgstr "Обычный HTTP: ссылка и ключи VPN передаются без шифрования" + +#: web/src/admin/cores/awg.ts +msgid "Plain WireGuard" +msgstr "Обычный WireGuard" + +#: web/src/admin/disguise.ts +msgid "Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block." +msgstr "Обычный трафик, совместимый с WireGuard. Самый быстрый, но его легко распознать и заблокировать." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain resolver on port %d." +msgstr "Простой резолвер на порту %d." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain resolver running next to the LAN (%s)." +msgstr "Простой резолвер работает рядом с LAN (%s)." + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at %s, not this router" +msgstr "Указывает на %s, а не на этот роутер" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at this router · Let’s Encrypt certificate" +msgstr "Указывает на этот роутер · сертификат Let’s Encrypt" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at this router · no certificate yet" +msgstr "Указывает на этот роутер · сертификата пока нет" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points here" +msgstr "Указывает сюда" + +#: web/src/admin/pages/components/packages.ts +msgid "Policy routing and the veth pair" +msgstr "Маршрутизация по политикам и пара veth" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Policy routing on the router (%s) sends marked traffic straight out, past the home-device path: tunnel traffic it matches skips your LAN's proxies and filters." +msgstr "Маршрутизация по политикам на роутере (%s) отправляет помеченный трафик напрямую, в обход пути домашних устройств: трафик туннеля, который под неё попадает, минует прокси и фильтры вашей LAN." + +#: web/src/admin/pages/settings/portal.ts +msgid "Port" +msgstr "Порт" + +#: web/src/admin/netcheck.ts +msgid "Port %s." +msgid_plural "Ports %s." +msgstr[0] "Порт %s." +msgstr[1] "Порты %s." +msgstr[2] "Порты %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Port must be 1-65535." +msgstr "Порт: от 1 до 65535." + +#: web/src/admin/interfaces.ts +msgid "Port of %s" +msgstr "Порт %s" + +#: web/src/admin/cores/awg.ts +msgid "Port, MTU and keep-alive apply at once." +msgstr "Порт, MTU и keep-alive применяются сразу." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +#: web/src/admin/events/model.ts +#: web/src/admin/pages/server.ts +msgid "Portal" +msgstr "Портал" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address" +msgstr "Адрес портала" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address doesn’t point here" +msgstr "Адрес портала ведёт не сюда" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address isn’t set" +msgstr "Адрес портала не задан" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address points here" +msgstr "Адрес портала ведёт сюда" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal addresses" +msgstr "Адреса портала" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal answers may not reach visitors" +msgstr "Ответы портала могут не доходить до посетителей" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal answers reach visitors" +msgstr "Ответы портала доходят до посетителей" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal certificate" +msgstr "Сертификат портала" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal certificate needs attention" +msgstr "Сертификат портала требует внимания" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal is off" +msgstr "Портал выключен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal links use plain HTTP" +msgstr "Ссылки на портал идут по обычному HTTP" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Portal port must be 1-65535." +msgstr "Порт портала: от 1 до 65535." + +#: web/src/admin/pages/server.ts +msgid "Portal port: %s" +msgstr "Порт портала: %s" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal running" +msgstr "Портал работает" + +#: web/src/admin/access.ts +msgid "Ports" +msgstr "Порты" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Ports %s" +msgstr "Порты %s" + +#: web/src/admin/access.ts +msgid "Ports they announce over Bonjour. Pick what to open, or all ports." +msgstr "Порты, которые устройства объявляют через Bonjour. Выберите, что открыть, или все порты." + +#: web/src/admin/interfaces.ts +msgid "Ports: %s" +msgstr "Порты: %s" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Pre-filled when you add someone." +msgstr "Подставляется при добавлении человека." + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/updater/notes.ts +msgid "Pre-release" +msgstr "Пререлиз" + +#: web/src/admin/access.ts +msgid "Printer" +msgstr "Принтер" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Private addresses outside the home network are blocked." +msgstr "Частные адреса вне домашней сети заблокированы." + +#: web/src/admin/events/model.ts +msgid "Problems" +msgstr "Проблемы" + +#: web/src/admin/cores/awg.ts +msgid "Protection" +msgstr "Защита" + +#: web/src/admin/pages/settings/map.ts +msgid "Provider" +msgstr "Сервис" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/pages/server.ts +msgid "Public address" +msgstr "Публичный адрес" + +#: web/src/admin/pages/overview.ts +msgid "Public address changed: %s still gives devices %s, the router is %s now." +msgstr "Публичный адрес изменился: сервер %s всё ещё выдаёт устройствам %s, а у роутера теперь %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Public address must be a hostname or IP address." +msgstr "Публичный адрес должен быть именем хоста или IP-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Public address needs attention" +msgstr "Публичный адрес требует внимания" + +#: web/src/admin/pages/server.ts +msgid "Public address: %s" +msgstr "Публичный адрес: %s" + +#: web/src/admin/device.ts +msgid "Public key" +msgstr "Публичный ключ" + +#: web/src/admin/cores/awg.ts +msgid "Public key copied" +msgstr "Публичный ключ скопирован" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/shared/qr.ts +msgid "QR code" +msgstr "QR-код" + +#: web/src/admin/pages/person/devices.ts +msgid "QR, file, key, rename, new keys, remove" +msgstr "QR-код, файл, ключ, переименование, новые ключи, удаление" + +#: web/src/admin/cores/awg.ts +msgid "Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard." +msgstr "Случайные байты перед пакетами рукопожатия, cookie и данных, чтобы их размеры не совпадали с WireGuard." + +#: web/src/admin/widgets/access-picker.ts +msgid "Reach devices at home (NAS, printer, cameras). Internet stays on their own connection." +msgstr "Доступ к домашним устройствам (NAS, принтер, камеры). Интернет - через собственное подключение." + +#: web/src/admin/pages/person/limits.ts +msgid "Reach devices at home, and home reaches theirs. Internet stays on their own connection." +msgstr "Доступ к домашним устройствам, а из дома - к устройствам человека. Интернет - через собственное подключение." + +#: web/src/admin/pages/server.ts +msgid "Reached from the internet %s." +msgstr "Последнее подключение из интернета: %s." + +#: web/src/admin/interfaces.ts +msgid "Read the interfaces again" +msgstr "Заново прочитать интерфейсы" + +#: web/src/admin/pages/settings/portal.ts +msgid "Ready" +msgstr "Готово" + +#: web/src/admin/pages/settings/portal.ts +msgid "Ready to share" +msgstr "Можно делиться ссылками" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Recent problems" +msgstr "Недавние проблемы" + +#: web/src/admin/pages/settings/portal.ts +msgid "Recommended" +msgstr "Рекомендуется" + +#: web/src/admin/pages/settings/logs.ts +msgid "Record" +msgstr "Записывать" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Redirect must be a full http:// or https:// address." +msgstr "Перенаправление должно вести на полный адрес http:// или https://." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Refreshing package lists" +msgstr "Обновление списков пакетов" + +#: web/src/admin/pages/components/hero.ts +msgid "Reinstall %s" +msgstr "Переустановить %s" + +#: web/src/admin/pages/components/awg.ts +msgid "Reinstall this build" +msgstr "Переустановить эту сборку" + +#: web/src/admin/pages/components/awg.ts +msgid "Reinstalling AmneziaWG" +msgstr "Переустановка AmneziaWG" + +#: web/src/admin/pages/components/hero.ts +msgid "Reinstalling Dawnline" +msgstr "Переустановка Dawnline" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s has no %s: it stays as it is" +msgstr "В релизе %s нет %s: остаётся как есть" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s has no translation into %s: install a release that has one" +msgstr "В релизе %s нет перевода на язык %s: установите релиз, в котором он есть" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s publishes no checksum for %s: not installing an unverified package" +msgstr "Релиз %s не публикует контрольную сумму для %s: непроверенный пакет устанавливаться не будет" + +#: web/src/admin/updater/notes.ts +msgid "Release notes copied" +msgstr "Описание релиза скопировано" + +#: web/src/admin/pages/components/hero.ts +msgid "Release tag" +msgstr "Тег релиза" + +#: web/src/admin/widgets/health.ts +msgid "Reload devices" +msgstr "Обновить устройства" + +#: web/src/admin/updater/operation.ts +msgid "Reload now" +msgstr "Обновить страницу" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Reloading the kernel module (%d tunnel restarts)" +msgid_plural "Reloading the kernel module (%d tunnels restart)" +msgstr[0] "Перезагрузка модуля ядра (перезапускается %d туннель)" +msgstr[1] "Перезагрузка модуля ядра (перезапускаются %d туннеля)" +msgstr[2] "Перезагрузка модуля ядра (перезапускаются %d туннелей)" + +#: web/src/admin/updater/operation.ts +msgid "Reloading the page…" +msgstr "Перезагружаем страницу…" + +#: web/src/admin/access.ts +msgid "Remote desktop" +msgstr "Удалённый рабочий стол" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/danger.ts +msgid "Remove" +msgstr "Удалить" + +#: web/src/admin/access.ts +msgid "Remove %s" +msgstr "Удалить «%s»" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/server.ts +msgid "Remove %s?" +msgstr "Удалить «%s»?" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline" +msgstr "Удалить Dawnline" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline from this router" +msgstr "Удалить Dawnline с этого роутера" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline?" +msgstr "Удалить Dawnline?" + +#: web/src/admin/pages/person/pickers.ts +msgid "Remove a device first to lower the limit" +msgstr "Чтобы уменьшить лимит, сначала удалите устройство" + +#: web/src/admin/pages/server.ts +msgid "Remove server" +msgstr "Удалить сервер" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Remove their devices" +msgstr "Удалить устройства" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +msgid "Removed" +msgstr "Удалено" + +#: web/src/admin/device.ts +msgid "Removed %s" +msgstr "Удалено %s" + +#: web/src/admin/pages/person/activity.ts +msgid "Removes events about %s and their devices." +msgstr "Удаляет события о человеке %s и его устройствах." + +#: web/src/admin/device.ts +msgid "Removes events about %s." +msgstr "Будут удалены события устройства «%s»." + +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/settings/logs.ts +msgid "Removes events from the log on the router." +msgstr "Удаляет события из журнала на роутере." + +#: web/src/admin/pages/server.ts +msgid "Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first." +msgid_plural "Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first." +msgstr[0] "Удаляет туннель, его правила межсетевого экрана и %s человека со всеми устройствами. Сначала создаётся резервная копия." +msgstr[1] "Удаляет туннель, его правила межсетевого экрана и %s человек со всеми устройствами. Сначала создаётся резервная копия." +msgstr[2] "Удаляет туннель, его правила межсетевого экрана и %s человек со всеми устройствами. Сначала создаётся резервная копия." + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Removing the Russian translation" +msgstr "Удаление русского перевода" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Removing the translation" +msgstr "Удаление перевода" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/header.ts +msgid "Rename" +msgstr "Переименовать" + +#: web/src/admin/device.ts +msgid "Rename %s" +msgstr "Переименовать «%s»" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/dialogs.ts +msgid "Renamed" +msgstr "Переименовано" + +#: web/src/admin/widgets/health.ts +msgid "Repair" +msgstr "Исправить" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Repaired by the watchdog at %s" +msgstr "Исправлено автовосстановлением в %s" + +#: web/src/admin/pages/settings/backups.ts +msgid "Replace the current Dawnline configuration with %s? The current state is backed up first." +msgstr "Заменить текущую конфигурацию Dawnline на %s? Сначала текущее состояние сохранится в резервную копию." + +#: web/src/admin/places/render.ts +msgid "Replay this period" +msgstr "Воспроизвести период" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Request too large." +msgstr "Слишком большой запрос." + +#: web/src/admin/interfaces.ts +msgid "Rescan" +msgstr "Обновить" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Reset" +msgstr "Сбросить" + +#: web/src/admin/logs.ts +msgid "Reset all traffic history?" +msgstr "Сбросить всю историю трафика?" + +#: web/src/admin/logs.ts +msgid "Reset traffic history for %s?" +msgstr "Сбросить историю трафика: %s?" + +#: web/src/admin/pages/person/limits.ts +msgid "Reset usage" +msgstr "Сбросить трафик" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Resolver" +msgstr "Резолвер" + +#: web/src/admin/widgets/health.ts +msgid "Restart network" +msgstr "Перезапустить сеть" + +#: web/src/admin/widgets/health.ts +msgid "Restart service" +msgstr "Перезапустить службу" + +#: web/src/admin/widgets/health.ts +msgid "Restart the network?" +msgstr "Перезапустить сеть?" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Restarting the network so it knows AmneziaWG (connections drop for a few seconds)" +msgstr "Перезапуск сети, чтобы она узнала об AmneziaWG (соединения прервутся на несколько секунд)" + +#: web/src/admin/pages/server.ts +msgid "Restarting the network so it knows AmneziaWG: back in a few seconds" +msgstr "Перезапускаем сеть, чтобы она узнала об AmneziaWG: через несколько секунд всё вернётся" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Restarting with the new settings." +msgstr "Перезапускается с новыми настройками." + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore" +msgstr "Восстановить" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore from file" +msgstr "Восстановить из файла" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore from file?" +msgstr "Восстановить из файла?" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore this backup?" +msgstr "Восстановить эту копию?" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restored" +msgstr "Восстановлено" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Resume" +msgstr "Возобновить" + +#: web/src/admin/pages/person/header.ts +msgid "Resumed" +msgstr "Доступ возобновлён" + +#: web/src/admin/pages/people.ts +msgid "Right now" +msgstr "Прямо сейчас" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Roll back" +msgstr "Откатить" + +#: web/src/admin/pages/components/awg.ts +msgid "Roll back AmneziaWG to %s?" +msgstr "Откатить AmneziaWG до %s?" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Roll back to %s" +msgstr "Откатить до %s" + +#: web/src/admin/pages/components/hero.ts +msgid "Roll back to Dawnline %s?" +msgstr "Откатить Dawnline до %s?" + +#: web/src/admin/pages/components/hero.ts +msgid "Rollback" +msgstr "Откат" + +#: web/src/admin/pages/components/awg.ts +msgid "Rolling back AmneziaWG" +msgstr "Откат AmneziaWG" + +#: web/src/admin/pages/components/hero.ts +msgid "Rolling back Dawnline" +msgstr "Откат Dawnline" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Rolling back to %s" +msgstr "Откат на версию %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/shared/format.ts +msgid "Router" +msgstr "Роутер" + +#: web/src/admin/pages/settings/updates.ts +msgid "Run a check or an update by hand in Components." +msgstr "Проверить или обновить вручную можно в «Компонентах»." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Run again" +msgstr "Повторить" + +#: web/src/admin/pages/people.ts +msgid "Run the setup wizard" +msgstr "Запустите мастер настройки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Run the setup wizard on the Server tab." +msgstr "Запустите мастер настройки на вкладке «Сервер»." + +#: web/src/admin/pages/server.ts +msgid "Running" +msgstr "Работает" + +#: web/src/admin/pages/diagnostics/health.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Running checks…" +msgstr "Идут проверки…" + +#: web/src/admin/netcheck.ts +msgid "Runs within an hour after %s (router time)." +msgstr "Запускается в течение часа после %s (по времени роутера)." + +#: web/src/admin/pages/components/hero.ts +msgid "Russian" +msgstr "Русский" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Russian translation" +msgstr "Русский перевод" + +#: web/src/admin/access.ts +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/defaults.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/map.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Save" +msgstr "Сохранить" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Save the log every 10min, hourly or off." +msgstr "Сохранение журнала: каждые 10 минут, каждый час или выключено." + +#: web/src/admin/pages/settings/logs.ts +msgid "Save to flash" +msgstr "Запись во флеш-память" + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/defaults.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/map.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Saved" +msgstr "Сохранено" + +#: web/src/admin/pages/settings/updates.ts +msgid "Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB." +msgstr "Хранит заменённый пакет Dawnline или AmneziaWG во флеш-памяти, чтобы откат работал без интернета. Меньше 1 МБ." + +#: web/src/admin/invite.ts +msgid "Scan to connect to %s" +msgstr "Сканируйте для подключения к %s" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Scan with AmneziaVPN or AmneziaWG on the device." +msgstr "Отсканируйте в AmneziaVPN или AmneziaWG на устройстве." + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Scan with AmneziaVPN or any WireGuard app on the device." +msgstr "Отсканируйте в AmneziaVPN или любом приложении WireGuard на устройстве." + +#: web/src/admin/access.ts +msgid "Screen sharing" +msgstr "Общий экран" + +#: web/src/admin/pages/overview.ts +msgid "Seen recently" +msgstr "Недавно в сети" + +#: web/src/admin/pages/settings/portal.ts +msgid "Self-signed" +msgstr "Самоподписанный" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +msgid "Send %s the card or the link. They open it, add their devices and connect - no account needed." +msgstr "Отправьте карточку или ссылку: %s откроет её, добавит свои устройства и подключится - аккаунт не нужен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/events/render.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +msgid "Server" +msgstr "Сервер" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server %d" +msgstr "Сервер %d" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: %s" +msgstr "Сервер %s: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: %s is one of the router's own network interfaces." +msgstr "Сервер %s: %s - один из собственных сетевых интерфейсов роутера." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: UDP %s is also used by %s." +msgstr "Сервер %s: порт UDP %s уже занят сервером %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: interface %s is also used by %s." +msgstr "Сервер %s: интерфейс %s уже занят сервером %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server ID may use lowercase letters, digits and underscores." +msgstr "В ID сервера можно использовать строчные латинские буквы, цифры и подчёркивания." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Server configured" +msgstr "Сервер настроен" + +#: web/src/admin/pages/server.ts +msgid "Server created" +msgstr "Сервер создан" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Server is disabled." +msgstr "Сервер выключен." + +#: web/src/shared/format.ts +msgid "Server is turned off" +msgstr "Сервер выключен" + +#: web/src/admin/ui/badges.ts +msgid "Server off" +msgstr "Сервер выключен" + +#: web/src/admin/cores/awg.ts +msgid "Server public key" +msgstr "Публичный ключ сервера" + +#: web/src/admin/pages/server.ts +msgid "Server removed" +msgstr "Сервер удалён" + +#: web/src/admin/pages/server.ts +msgid "Server turned off" +msgstr "Сервер выключен" + +#: web/src/admin/pages/server.ts +msgid "Server turned on" +msgstr "Сервер включён" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Server → Access → Home network." +msgstr "Сервер → Доступ → Домашняя сеть." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server: Enter a name: up to 48 characters, without < > \" or \\." +msgstr "Сервер: введите имя до 48 символов, без < > \" и обратной косой черты." + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +#: web/src/admin/pages/person/index.ts +#: web/src/admin/pages/server.ts +msgid "Servers" +msgstr "Серверы" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Service: Enter a name: up to 48 characters, without < > \" or \\." +msgstr "Сервис: введите имя до 48 символов, без < > \" и обратной косой черты." + +#: web/src/admin/updater/operation.ts +msgid "Services are back. Reloading…" +msgstr "Службы снова работают. Перезагрузка страницы…" + +#: web/src/admin/updater/operation.ts +msgid "Services restarted. Reload the page to use the new version." +msgstr "Службы перезапущены. Обновите страницу, чтобы перейти на новую версию." + +#: web/src/admin/cores/awg.ts +msgid "Set by hand" +msgstr "Задана вручную" + +#: web/src/admin/pages/person/limits.ts +msgid "Set the hours, then press Enter" +msgstr "Укажите часы и нажмите Enter" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Set the public hostname in Settings so links can be generated." +msgstr "Укажите публичное имя хоста в «Настройках», чтобы создавать ссылки." + +#: web/src/admin/pages/person/devices.ts +msgid "Set up %s" +msgstr "Настроить %s" + +#: web/src/admin/pages/server.ts +msgid "Set up Dawnline" +msgstr "Настройка Dawnline" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Set up a server first." +msgstr "Сначала настройте сервер." + +#: web/src/admin/pages/people.ts +msgid "Set up the server first, then add people." +msgstr "Сначала настройте сервер, затем добавляйте людей." + +#: web/src/admin/pages/people.ts +msgid "Set up the server first." +msgstr "Сначала настройте сервер." + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/settings/index.ts +msgid "Settings" +msgstr "Настройки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "Setup failed: %s" +msgstr "Не удалось настроить: %s" + +#: web/src/admin/invite.ts +msgid "Share card" +msgstr "Поделиться карточкой" + +#: web/src/admin/invite.ts +msgid "Share link" +msgstr "Поделиться ссылкой" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Show %s more of %s" +msgstr "Показать ещё %s из %s" + +#: web/src/admin/pages/person/devices.ts +msgid "Show QR" +msgstr "Показать QR-код" + +#: web/src/admin/device.ts +msgid "Show QR code" +msgstr "Показать QR-код" + +#: web/src/admin/cores/awg.ts +msgid "Show key" +msgstr "Показать ключ" + +#: web/src/admin/pages/person/activity.ts +msgid "Show map" +msgstr "Показать карту" + +#: web/src/admin/pages/components/index.ts +msgid "Show progress" +msgstr "Показать ход выполнения" + +#: web/src/admin/pages/settings/map.ts +msgid "Show where people connect from on the Overview and person pages, at city level." +msgstr "Показывать в «Обзоре» и на страницах людей, откуда они подключаются, - с точностью до города." + +#: web/src/admin/pages/settings/portal.ts +msgid "Show “Not found”" +msgstr "Показывать «Не найдено»" + +#: web/src/admin/pages/person/activity.ts +msgid "Shown after a device connects" +msgstr "Появятся после подключения устройства" + +#: web/src/admin/device.ts +msgid "Shown in the portal and in the app." +msgstr "Видно на портале и в приложении." + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +msgid "Shown in their portal and apps." +msgstr "Показывается на портале и в приложениях." + +#: web/src/admin/pages/person/dialogs.ts +msgid "Shown in their portal and on the Overview." +msgstr "Показывается на портале и на странице «Обзор»." + +#: web/src/admin/netcheck.ts +msgid "Shown on the person cards." +msgstr "Показывается на карточках людей." + +#: web/src/admin/pages/server.ts +msgid "Shown to people in their portal and apps." +msgstr "Видно людям в портале и приложениях." + +#: web/src/admin/access.ts +msgid "Shown to people who may reach it." +msgstr "Видно тем, у кого есть к нему доступ." + +#: web/src/admin/cores/awg.ts +msgid "Signature packets" +msgstr "Пакеты-сигнатуры" + +#: web/src/admin/cores/awg.ts +msgid "Signatures" +msgstr "Сигнатуры" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard" +msgstr "Чтобы сети, блокирующие VPN, не распознали туннель. «Выкл.» - обычный WireGuard" + +#: web/src/admin/map.ts +msgid "Someone" +msgstr "Кто-то" + +#: web/src/admin/pages/people.ts +msgid "Sort" +msgstr "Сортировка" + +#: web/src/admin/pages/components/hero.ts +msgid "Source" +msgstr "Источник" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Speed" +msgstr "Скорость" + +#: web/src/admin/widgets/tiles.ts +msgid "Speed now" +msgstr "Скорость сейчас" + +#: web/src/admin/disguise.ts +msgid "Standard (old)" +msgstr "Стандартная (старая)" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Starts within a minute" +msgstr "Запустится в течение минуты" + +#: web/src/admin/device.ts +msgid "Status" +msgstr "Статус" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Stealth" +msgstr "Скрытность" + +#: web/src/admin/access.ts +msgid "Stops at step %s of %s" +msgstr "Останавливается на шаге %s из %s" + +#: web/src/admin/pages/server.ts +msgid "Stops the tunnel and disconnects everyone on it. Settings and people are kept." +msgstr "Останавливает туннель и отключает всех, кто через него подключён. Настройки и люди сохраняются." + +#: web/src/admin/pages/settings/logs.ts +msgid "Stored data" +msgstr "Хранимые данные" + +#: web/src/admin/disguise.ts +msgid "Strong (old)" +msgstr "Усиленная (старая)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Subnet must look like 10.77.0.0/24." +msgstr "Подсеть указывается так: 10.77.0.0/24." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Subnet overlaps %s." +msgstr "Подсеть пересекается с %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Such devices are left out of the tunnels: fix or remove them." +msgstr "Такие устройства не загружаются в туннели: исправьте или удалите их." + +#: web/src/admin/pages/components/awg.ts +msgid "Switch" +msgstr "Переключить" + +#: web/src/admin/cores/awg.ts +msgid "Switch and apply" +msgstr "Переключить и применить" + +#: web/src/admin/cores/awg.ts +msgid "Switch to %s" +msgstr "Применить «%s»" + +#: web/src/admin/cores/awg.ts +msgid "Switch to %s?" +msgstr "Перейти на маскировку «%s»?" + +#: web/src/admin/pages/components/awg.ts +msgid "Switch to AmneziaWG %s?" +msgstr "Переключиться на AmneziaWG %s?" + +#: web/src/admin/cores/awg.ts +msgid "Switch to Balanced or Maximum" +msgstr "Перейдите на «Сбалансированную» или «Максимальную»" + +#: web/src/admin/pages/settings/logs.ts +msgid "Switched-off categories are not logged from now on." +msgstr "Выключенные категории больше не записываются." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts %s for a few seconds." +msgstr "Переключение перезапустит %s на несколько секунд." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations." +msgid_plural "Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations." +msgstr[0] "Переключение перезапустит %s туннель на несколько секунд: %s. Конфигурации устройств сохранятся." +msgstr[1] "Переключение перезапустит %s туннеля на несколько секунд: %s. Конфигурации устройств сохранятся." +msgstr[2] "Переключение перезапустит %s туннелей на несколько секунд: %s. Конфигурации устройств сохранятся." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations." +msgstr "Переключение перезапустит туннель на несколько секунд: %s. Конфигурации устройств сохранятся." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching takes a few seconds." +msgstr "Переключение займёт несколько секунд." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching takes a few seconds. Devices keep their configurations." +msgstr "Переключение займёт несколько секунд. Конфигурации устройств сохранятся." + +#: web/src/admin/pages/components/awg.ts +msgid "Switching to AmneziaWG %s" +msgstr "Переход на AmneziaWG %s" + +#: web/src/admin/logs.ts +#: web/src/admin/pages/diagnostics/log.ts +msgid "System" +msgstr "Система" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/settings/updates.ts +#: web/src/admin/updater/jobs.ts +msgid "System packages" +msgstr "Системные пакеты" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "System packages are up to date" +msgstr "Системные пакеты актуальны" + +#: web/src/shared/format.ts +msgid "TB" +msgstr "ТБ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "TCP %d is already used by %s. Choose another port in Settings." +msgstr "TCP %d уже использует %s. Выберите другой порт в «Настройках»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is already used by %s. Choose another portal port." +msgstr "TCP %d уже занят: %s. Выберите другой порт портала." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is already used by %s. Links on IP addresses use plain HTTP on the port after the portal's. Choose another portal port." +msgstr "TCP %d уже занят: %s. Ссылки с IP-адресом используют обычный HTTP на порту, следующем за портом портала. Выберите другой порт портала." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is sent on by port forward “%s”. Choose another portal port." +msgstr "TCP %d перенаправляется пробросом порта «%s». Выберите другой порт портала." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Table inet dawnline enforces who may reach LAN and the internet." +msgstr "Таблица inet dawnline определяет, кому доступны LAN и интернет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Table inet dawnline is missing: no device is loaded into the tunnels until it is back." +msgstr "Таблицы inet dawnline нет: пока она не вернётся, ни одно устройство не загружается в туннели." + +#: web/src/shared/format.ts +msgid "Tablet" +msgstr "Планшет" + +#: web/src/admin/pages/components/hero.ts +msgid "Tag, e.g. 0.3.1" +msgstr "Тег, например 0.3.1" + +#: web/src/admin/netcheck.ts +msgid "That date has passed: access would end at once." +msgstr "Эта дата уже прошла: доступ закончится сразу." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "That id is taken." +msgstr "Этот идентификатор уже занят." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "That is the same device" +msgstr "Это то же самое устройство" + +#: web/src/admin/pages/components/awg.ts +msgid "The %s build, %s." +msgstr "Сборка %s, версия %s." + +#: web/src/admin/pages/server.ts +msgid "The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address." +msgstr "Провайдер делит один адрес между многими абонентами: устройства смогут подключиться, только если он выдаст вам публичный адрес или IPv6. Спросите у провайдера или используйте имя DDNS, которое указывает на IPv6-адрес." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The WAN address %s is CGNAT (shared by the ISP): %s cannot be forwarded to this router from outside unless the ISP gives a public address or IPv6." +msgstr "Адрес WAN %s - CGNAT (общий у провайдера): %s нельзя пробросить на этот роутер снаружи, пока провайдер не даст публичный адрес или IPv6." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The WAN address %s is private: this router is behind another one. Forward %s on it, or devices cannot connect." +msgstr "Адрес WAN %s - частный: этот роутер стоит за другим. Пробросьте на нём %s, иначе устройства не подключатся." + +#: web/src/admin/interfaces.ts +msgid "The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network." +msgstr "WAN, этот сервер, порты и Wi-Fi моста (они входят в него) и интерфейсы без сети IPv4." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "The admin has turned this device off." +msgstr "Администратор отключил это устройство." + +#: web/src/admin/pages/diagnostics/health.ts +msgid "The agent has not checked in for %s min; cron restarts it after 5." +msgstr "Агент не выходил на связь %s мин; cron перезапускает его через 5 мин." + +#: web/src/admin/pages/settings/backups.ts +msgid "The backup from %s is removed from the router." +msgstr "Резервная копия (%s) будет удалена с роутера." + +#: web/src/admin/pages/components/awg.ts +msgid "The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds." +msgstr "Снова установится сборка, сохранённая на роутере. Все туннели AmneziaWG перезапустятся на несколько секунд." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "The configuration in this file cannot be read." +msgstr "Не удаётся прочитать конфигурацию из этого файла." + +#: web/src/admin/pages/components/hero.ts +msgid "The copy kept on the router replaces %s. A backup of the settings is made first." +msgstr "Копия, сохранённая на роутере, заменит %s. Перед этим будет создана резервная копия настроек." + +#: web/src/admin/device.ts +msgid "The current configuration on this device stops working until it is imported again." +msgstr "Текущая конфигурация на устройстве перестанет работать, пока вы не импортируете её заново." + +#: web/src/admin/pages/settings/defaults.ts +msgid "The default, 3. Pre-filled when you add someone." +msgstr "По умолчанию - 3. Подставляется при добавлении человека." + +#: web/src/admin/netcheck.ts +msgid "The default, lan: devices get names like %s." +msgstr "По умолчанию lan: устройства получат имена вида %s." + +#: web/src/admin/device.ts +msgid "The device is disconnected immediately and its configuration stops working." +msgstr "Устройство сразу отключится, а его конфигурация перестанет работать." + +#: web/src/admin/netcheck.ts +msgid "The device’s address at home." +msgstr "Адрес устройства в домашней сети." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "The firewall lets it through" +msgstr "Межсетевой экран пропускает трафик" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The firmware changed (kernel %s → %s): the AmneziaWG build installed for it is gone. Install the build for this firmware." +msgstr "Прошивка сменилась (ядро %s → %s): сборки AmneziaWG, установленной для прежней, больше нет. Установите сборку для этой прошивки." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The id may use lowercase letters, digits and underscores." +msgstr "В идентификаторе можно использовать строчные латинские буквы, цифры и подчёркивания." + +#: web/src/admin/interfaces.ts +msgid "The interface with the default route: the server port opens there and Internet access leaves through it." +msgstr "Интерфейс с маршрутом по умолчанию: на нём открывается порт сервера, и через него выходит доступ в интернет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The kept AmneziaWG build was made for another firmware: it would not load on this one" +msgstr "Сохранённая сборка AmneziaWG сделана для другой прошивки: на этой она не загрузится" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The kernel module doesn't load. Reinstall a build for this kernel in Components." +msgstr "Модуль ядра не загружается. Переустановите сборку для этого ядра в «Компонентах»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The kernel module doesn't load: %s Reinstall a build for this kernel in Components." +msgstr "Модуль ядра не загружается: %s Переустановите сборку для этого ядра в «Компонентах»." + +#: web/src/admin/pages/components/index.ts +msgid "The latest release is %s" +msgstr "Последний релиз - %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The link is up but not attached to %s." +msgstr "Домашний маршрут поднят, но не подключён к %s." + +#: web/src/admin/pages/diagnostics/log.ts +msgid "The log is empty." +msgstr "Журнал пуст." + +#: web/src/admin/pages/settings/logs.ts +msgid "The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot." +msgstr "Журнал хранится в памяти и копируется во флеш-память. «Только в памяти» бережёт флеш-память, но при перезагрузке журнал теряется." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The main address is an IP: its links use plain HTTP." +msgstr "Основной адрес - IP: ссылки на нём используют обычный HTTP." + +#: web/src/admin/map.ts +msgid "The map library from the CDN is not the expected file: not loading it." +msgstr "Библиотека карты из CDN не совпадает с ожидаемым файлом - она не будет загружена." + +#: web/src/admin/pages/server.ts +msgid "The name people see, where devices find the router, and DNS. The port is on AmneziaWG." +msgstr "Имя, которое видят люди, адрес, по которому устройства находят роутер, и DNS. Порт - на вкладке AmneziaWG." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The network doesn’t know AmneziaWG yet" +msgstr "Сеть ещё не знает об AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The new AmneziaWG kernel module doesn't load on this firmware: the tunnels stay down until it does (see the log above)" +msgstr "Новый модуль ядра AmneziaWG не загружается на этой прошивке: туннели не работают, пока он не загрузится (см. журнал выше)" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why." +msgstr "Новая версия не ответила в LuCI, или её агент не запустился. Попробуйте ещё раз в «Компонентах» или установите её через install.sh, чтобы увидеть причину." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The old AmneziaWG kernel module is still loaded (another AmneziaWG interface may use it): reboot the router to finish the update" +msgstr "Старый модуль ядра AmneziaWG всё ещё загружен (возможно, его использует другой интерфейс AmneziaWG): перезагрузите роутер, чтобы завершить обновление" + +#: web/src/admin/pages/person/dialogs.ts +msgid "The old link stops working right away." +msgstr "Старая ссылка сразу перестанет работать." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The person has no server." +msgstr "У человека нет сервера." + +#: web/src/admin/pages/overview.ts +msgid "The personal portal is off." +msgstr "Личный портал выключен." + +#: web/src/admin/invite.ts +msgid "The personal portal is off. Turn it on in Settings." +msgstr "Личный портал выключен. Включите его в настройках." + +#: web/src/admin/pages/settings/portal.ts +msgid "The portal needs %s. It can’t start without them." +msgstr "Для портала нужно: %s. Без этого он не запустится." + +#: web/src/admin/pages/server.ts +msgid "The portal’s address." +msgstr "Адрес портала." + +#: web/src/admin/pages/settings/portal.ts +msgid "The portal’s checks from Health" +msgstr "Проверки портала из раздела «Состояние»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The resolver is not running; Home-only devices cannot resolve names." +msgstr "Резолвер не запущен; устройства с домашним доступом не могут разрешать имена." + +#: web/src/admin/state/poller.ts +msgid "The router answers again." +msgstr "Роутер снова отвечает." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The router clock looks wrong; end dates will misbehave. Check NTP." +msgstr "Часы роутера, похоже, идут неверно; даты окончания будут срабатывать неправильно. Проверьте NTP." + +#: web/src/admin/state/poller.ts +msgid "The router is not answering: what you see may be out of date." +msgstr "Роутер не отвечает: данные на экране могут быть устаревшими." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The router is running out of flash" +msgstr "На роутере заканчивается флеш-память" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "The router reaches it only while its VPN is on." +msgstr "Роутер может связаться с устройством, только пока на нём включён VPN." + +#: web/src/admin/pages/settings/map.ts +msgid "The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map." +msgstr "Роутер один раз отправляет сервису каждый новый IP клиента и запоминает город. Фрагменты карты загружаются в ваш браузер с CARTO; люди карту не видят." + +#: web/src/admin/updater/operation.ts +msgid "The router stopped answering. The job may still finish: reopen Components in a minute." +msgstr "Роутер перестал отвечать. Задача ещё может завершиться: откройте «Компоненты» снова через минуту." + +#: web/src/admin/pages/overview.ts +msgid "The server is turned off" +msgstr "Сервер выключен" + +#: web/src/admin/logs.ts +msgid "The service log was not cleared: %s" +msgstr "Журнал служб не очищен: %s" + +#: web/src/admin/pages/person/limits.ts +msgid "The start and the end must differ." +msgstr "Начало и конец должны различаться." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "The translation could not be removed" +msgstr "Не удалось удалить перевод" + +#: web/src/admin/updater/operation.ts +msgid "The translation is installed." +msgstr "Перевод установлен." + +#: web/src/admin/updater/operation.ts +msgid "The translation is removed." +msgstr "Перевод удалён." + +#: web/src/admin/pages/server.ts +msgid "The tunnel needs %s. Install the build made for this firmware, then create the server." +msgstr "Для туннеля нужно: %s. Установите сборку для этой прошивки, затем создайте сервер." + +#: web/src/admin/pages/server.ts +msgid "The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted." +msgid_plural "The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted." +msgstr[0] "Туннель остановится и отключит %s человека до повторного включения сервера. Ничего не удаляется." +msgstr[1] "Туннель остановится и отключит %s человек до повторного включения сервера. Ничего не удаляется." +msgstr[2] "Туннель остановится и отключит %s человек до повторного включения сервера. Ничего не удаляется." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc +msgid "The update stopped unexpectedly." +msgstr "Обновление неожиданно прервалось." + +#: web/src/admin/cores/awg.ts +msgid "The values that replace WireGuard’s recognisable message types." +msgstr "Значения, которые заменяют узнаваемые типы сообщений WireGuard." + +#: web/src/admin/pages/person/dialogs.ts +msgid "Then" +msgstr "Действие" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "There is no session the router could reach." +msgstr "Нет сессии, через которую роутер мог бы связаться с устройством." + +#: web/src/admin/netcheck.ts +msgid "They can add %s device themselves." +msgid_plural "They can add %s devices themselves." +msgstr[0] "Сможет добавить %s устройство самостоятельно." +msgstr[1] "Сможет добавить %s устройства самостоятельно." +msgstr[2] "Сможет добавить %s устройств самостоятельно." + +#: web/src/admin/pages/person/pickers.ts +msgid "They can add a device here" +msgstr "Здесь можно добавить устройство" + +#: web/src/admin/pages/person/dialogs.ts +msgid "They have no devices yet: nothing else changes." +msgstr "Устройств пока нет - больше ничего не изменится." + +#: web/src/admin/pages/person/index.ts +msgid "They may have been removed." +msgstr "Возможно, этого человека удалили." + +#: web/src/admin/cores/awg.ts +msgid "They need an app with AmneziaWG 2.0 or newer." +msgstr "Понадобится приложение с AmneziaWG 2.0 или новее." + +#: web/src/admin/cores/awg.ts +msgid "They need an app with AmneziaWG 3.1." +msgstr "Понадобится приложение с AmneziaWG 3.1." + +#: web/src/admin/logs.ts +msgid "This cannot be undone; export first if you want a copy." +msgstr "Это нельзя отменить; если нужна копия, сначала сделайте экспорт." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "This configuration can't be used: %s" +msgstr "Эту конфигурацию нельзя использовать: %s" + +#: web/src/admin/cores/awg.ts +msgid "This device generated its own keys in the browser, so its full configuration only exists on that device." +msgstr "Это устройство создало ключи в браузере, поэтому полная конфигурация есть только на нём." + +#: web/src/admin/device.ts +msgid "This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below." +msgstr "На устройстве устаревшая конфигурация: после настройки изменились сети или DNS. Импортируйте её заново с помощью QR-кода, ключа или файла ниже." + +#: web/src/admin/pages/person/devices.ts +msgid "This device made its own keys in the browser; its configuration only exists there." +msgstr "Это устройство создало ключи в браузере, поэтому его конфигурация есть только там." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "This is a SNAPSHOT firmware: the AmneziaWG projects publish builds for releases only" +msgstr "Это прошивка SNAPSHOT: проекты AmneziaWG публикуют сборки только для релизов" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "This key is already in use." +msgstr "Этот ключ уже используется." + +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +msgid "This month" +msgstr "В этом месяце" + +#: web/src/admin/pages/people.ts +msgid "This month by device" +msgstr "Этот месяц по устройствам" + +#: web/src/admin/pages/people.ts +msgid "This person was just removed." +msgstr "Этого человека только что удалили." + +#: web/src/admin/updater/notes.ts +msgid "This release has no notes." +msgstr "У этого релиза нет описания." + +#: web/src/admin/pages/server.ts +msgid "This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first." +msgid_plural "This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first." +msgstr[0] "Будут удалены туннель, его правила межсетевого экрана и %s человек со всеми устройствами. Сначала создаётся резервная копия." +msgstr[1] "Будут удалены туннель, его правила межсетевого экрана и %s человека со всеми устройствами. Сначала создаётся резервная копия." +msgstr[2] "Будут удалены туннель, его правила межсетевого экрана и %s человек со всеми устройствами. Сначала создаётся резервная копия." + +#: web/src/admin/pages/settings/backups.ts +msgid "This replaces the whole Dawnline configuration on this router. The current state is backed up first." +msgstr "Вся конфигурация Dawnline на этом роутере будет заменена. Сначала текущее состояние сохранится в резервную копию." + +#: web/src/admin/access.ts +msgid "This router" +msgstr "Этот роутер" + +#: web/src/admin/netcheck.ts +msgid "This router (%s): queries go where your home network sends them, and home names work." +msgstr "Этот роутер (%s): запросы идут туда же, куда и из домашней сети, и домашние имена работают." + +#: web/src/admin/pages/server.ts +msgid "This router (recommended)" +msgstr "Этот роутер (рекомендуется)" + +#: web/src/admin/cores/awg.ts +msgid "This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1." +msgstr "На этом роутере старая версия AmneziaWG. Маскировка «%s» станет доступна с kmod-amneziawg и amneziawg-tools 3.1." + +#: web/src/admin/interfaces.ts +msgid "This server" +msgstr "Этот сервер" + +#: web/src/admin/pages/server.ts +msgid "This server is off" +msgstr "Этот сервер выключен" + +#: web/src/admin/netcheck.ts +msgid "Three numbers, like 10.77.0." +msgstr "Три числа, например 10.77.0." + +#: web/src/admin/pages/server.ts +msgid "Through the home network" +msgstr "Через домашнюю сеть" + +#: web/src/admin/logs.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Time" +msgstr "Время" + +#: web/src/admin/pages/settings/updates.ts +msgid "Time: %s" +msgstr "Время: %s" + +#: web/src/admin/cores/awg.ts +msgid "Timing" +msgstr "Тайминги" + +#: web/src/admin/pages/person/limits.ts +msgid "To" +msgstr "До" + +#: web/src/admin/cores/awg.ts +msgid "To keep the old disguise for some people, add a second server and move them there." +msgstr "Чтобы оставить старую маскировку части людей, добавьте второй сервер и перенесите их туда." + +#: web/src/admin/events/render.ts +#: web/src/admin/places/model.ts +#: web/src/admin/widgets/spark.ts +#: web/src/admin/widgets/tiles.ts +msgid "Today" +msgstr "Сегодня" + +#: web/src/admin/widgets/tiles.ts +msgid "Today %s" +msgstr "Сегодня %s" + +#: web/src/admin/pages/settings/backups.ts +msgid "Today, %s" +msgstr "Сегодня, %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Too many changes in a short time. Try again in a few minutes." +msgstr "Слишком много изменений за короткое время. Попробуйте ещё раз через несколько минут." + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/limits.ts +msgid "Total" +msgstr "Всего" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Traffic" +msgstr "Трафик" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Traffic enters %s as %s, so it is handled like any device on your LAN." +msgstr "Трафик входит в %s как %s, поэтому обрабатывается как любое устройство вашей LAN." + +#: web/src/admin/pages/settings/logs.ts +msgid "Traffic history" +msgstr "История трафика" + +#: web/src/admin/logs.ts +msgid "Traffic history reset" +msgstr "История трафика сброшена" + +#: web/src/admin/pages/components/hero.ts +msgid "Translation" +msgstr "Перевод" + +#: web/src/admin/pages/components/activity.ts +msgid "Translation removed by you" +msgstr "Вы удалили перевод" + +#: web/src/admin/netcheck.ts +msgid "Try %s." +msgstr "Попробуйте %s." + +#: web/src/admin/pages/components/hero.ts +msgid "Try again" +msgstr "Повторить" + +#: web/src/admin/pages/server.ts +msgid "Try another build in Components, or update OpenWrt. The server can’t start until it loads." +msgstr "Попробуйте другую сборку в разделе «Компоненты» или обновите OpenWrt. Пока модуль не загрузится, сервер не запустится." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "Trying mirror %s" +msgstr "Пробуем зеркало %s" + +#: web/src/admin/cores/awg.ts +msgid "Tunnel" +msgstr "Туннель" + +#: web/src/admin/pages/overview.ts +msgid "Tunnel %s is down." +msgstr "Туннель %s не работает." + +#: web/src/admin/device.ts +msgid "Tunnel address" +msgstr "Адрес в туннеле" + +#: web/src/admin/pages/server.ts +msgid "Tunnel network" +msgstr "Сеть туннеля" + +#: web/src/admin/pages/server.ts +msgid "Tunnel network changed" +msgstr "Сеть туннеля изменена" + +#: web/src/admin/cores/awg.ts +msgid "Tunnel subnet" +msgstr "Подсеть туннеля" + +#: web/src/admin/pages/server.ts +msgid "Turn off" +msgstr "Выключить" + +#: web/src/admin/pages/server.ts +msgid "Turn off %s?" +msgstr "Выключить %s?" + +#: web/src/admin/pages/server.ts +msgid "Turn off this server" +msgstr "Выключить этот сервер" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/server.ts +msgid "Turn on" +msgstr "Включить" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Turn the device on again on its page." +msgstr "Включите устройство на его странице." + +#: web/src/admin/pages/settings/portal.ts +msgid "Turn the portal on to see its certificate." +msgstr "Включите портал, чтобы увидеть его сертификат." + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Turn them on in Settings" +msgstr "Включите его в настройках" + +#: web/src/admin/pages/server.ts +msgid "Turned off" +msgstr "Выключен" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +msgid "Type" +msgstr "Тип" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc +msgid "Type \"remove\" to confirm." +msgstr "Введите «remove», чтобы подтвердить." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "UDP %d is also used by %s." +msgstr "UDP %d также использует %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "UDP %d is used by %s. Choose another port." +msgstr "UDP %d занят: %s. Выберите другой порт." + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "UDP port" +msgstr "UDP-порт" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "UDP port must be 1-65535." +msgstr "UDP-порт: от 1 до 65535." + +#: web/src/admin/pages/server.ts +msgid "UDP port: %s" +msgstr "UDP-порт: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Unexpected entry in backup: %s" +msgstr "Неожиданная запись в резервной копии: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Unexpected file in backup: %s" +msgstr "Неожиданный файл в резервной копии: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Unknown AmneziaWG build %s" +msgstr "Неизвестная сборка AmneziaWG: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown DNS choice." +msgstr "Неизвестный вариант DNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Unknown action." +msgstr "Неизвестное действие." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown category." +msgstr "Неизвестная категория." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Unknown choice for devices reaching each other." +msgstr "Неизвестный вариант связи между устройствами." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Unknown circle." +msgstr "Неизвестный круг." + +#: web/src/admin/places/render.ts +msgid "Unknown city" +msgstr "Неизвестный город" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Unknown component %s" +msgstr "Неизвестный компонент: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown device." +msgstr "Неизвестное устройство." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Unknown disguise method." +msgstr "Неизвестный режим маскировки." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown end action." +msgstr "Неизвестное действие по окончании доступа." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Unknown fix." +msgstr "Неизвестное исправление." + +#: web/src/admin/pages/settings/portal.ts +msgid "Unknown links" +msgstr "Неизвестные ссылки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Unknown location service." +msgstr "Неизвестный сервис геолокации." + +#: web/src/admin/map.ts +msgid "Unknown network" +msgstr "Неизвестная сеть" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown page." +msgstr "Неизвестная страница." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown person." +msgstr "Неизвестный человек." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown release." +msgstr "Неизвестный релиз." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown scope." +msgstr "Неизвестная область сброса." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Unknown server." +msgstr "Неизвестный сервер." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown service %s." +msgstr "Неизвестный сервис %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Unknown service." +msgstr "Неизвестный сервис." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Unknown setting %s." +msgstr "Неизвестная настройка %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown update target." +msgstr "Неизвестная цель обновления." + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "Unlimited" +msgstr "Без лимита" + +#: web/src/admin/interfaces.ts +msgid "Until they are installed, internet traffic goes straight to the WAN." +msgstr "Пока они не установлены, интернет-трафик идёт прямо в WAN." + +#: web/src/admin/netcheck.ts +msgid "Up to %s character (%s now)." +msgid_plural "Up to %s characters (%s now)." +msgstr[0] "Максимум %s символ (сейчас %s)." +msgstr[1] "Максимум %s символа (сейчас %s)." +msgstr[2] "Максимум %s символов (сейчас %s)." + +#: web/src/admin/pages/components/index.ts +msgid "Up to date" +msgstr "Актуально" + +#: web/src/admin/pages/components/packages.ts +msgid "Update" +msgstr "Обновить" + +#: web/src/admin/updater/operation.ts +msgctxt "noun" +msgid "Update" +msgstr "Обновление" + +#: web/src/admin/pages/components/packages.ts +msgid "Update %s?" +msgstr "Обновить «%s»?" + +#: web/src/admin/pages/components/index.ts +msgid "Update available" +msgstr "Есть обновление" + +#: web/src/admin/updater/jobs.ts +msgid "Update available: %s" +msgstr "Доступно обновление: %s" + +#: web/src/admin/pages/person/devices.ts +msgid "Update config" +msgstr "Обновить конфигурацию" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Update failed" +msgstr "Обновление не удалось" + +#: web/src/admin/pages/components/hero.ts +msgid "Update now" +msgstr "Обновить сейчас" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/updater/operation.ts +msgid "Update to %s" +msgstr "Обновить до %s" + +#: web/src/admin/updater/operation.ts +msgid "Updated %s" +msgstr "Обновлено: %s" + +#: web/src/admin/updater/operation.ts +msgid "Updated system packages" +msgstr "Системные пакеты обновлены" + +#: web/src/admin/pages/settings/updates.ts +msgid "Updates" +msgstr "Обновления" + +#: web/src/admin/pages/components/activity.ts +msgid "Updates, and checks that found something, show up here." +msgstr "Здесь появятся обновления и проверки, которые что-то нашли." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +#: web/src/admin/pages/components/packages.ts +msgid "Updating %s" +msgstr "Обновление: %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/index.ts +msgid "Updating AmneziaWG" +msgstr "Обновление AmneziaWG" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "Updating Dawnline" +msgstr "Обновление Dawnline" + +#: web/src/admin/pages/components/index.ts +msgid "Updating components" +msgstr "Обновление компонентов" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/index.ts +msgid "Updating system packages" +msgstr "Обновление системных пакетов" + +#: web/src/admin/pages/components/index.ts +msgid "Updating…" +msgstr "Обновление…" + +#: web/src/admin/widgets/tiles.ts +msgctxt "speed" +msgid "Upload" +msgstr "Передача" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Upload is empty or too large." +msgstr "Загруженный файл пуст или слишком большой." + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Usage" +msgstr "По трафику" + +#: web/src/admin/netcheck.ts +msgid "Use 0–600 seconds." +msgstr "Укажите от 0 до 600 секунд." + +#: web/src/admin/netcheck.ts +msgid "Use 1–32." +msgstr "Укажите от 1 до 32." + +#: web/src/admin/netcheck.ts +msgid "Use HH:MM, 00:00–23:59." +msgstr "Формат ЧЧ:ММ, 00:00–23:59." + +#: web/src/admin/netcheck.ts +msgid "Use a date." +msgstr "Укажите дату." + +#: web/src/admin/netcheck.ts +msgid "Use a hostname or an IP address." +msgstr "Укажите имя хоста или IP-адрес." + +#: web/src/admin/netcheck.ts +msgid "Use a port from 1 to 65535." +msgstr "Укажите порт от 1 до 65535." + +#: web/src/admin/netcheck.ts +msgid "Use a private range: 10.x.x, 172.16–31.x or 192.168.x." +msgstr "Нужен частный диапазон: 10.x.x, 172.16–31.x или 192.168.x." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x." +msgstr "Нужен частный диапазон: 10.x.x.x, 172.16–31.x.x или 192.168.x.x." + +#: web/src/admin/netcheck.ts +msgid "Use an IPv4 address, like 192.168.1.10." +msgstr "Укажите IPv4-адрес, например 192.168.1.10." + +#: web/src/admin/netcheck.ts +msgid "Use an IPv4 address, or leave it empty." +msgstr "Укажите IPv4-адрес или оставьте поле пустым." + +#: web/src/admin/pages/settings/portal.ts +msgid "Use files" +msgstr "Указать файлы" + +#: web/src/admin/pages/overview.ts +msgid "Use the new address" +msgstr "Использовать новый адрес" + +#: web/src/admin/pages/settings/portal.ts +msgid "Use your own certificate" +msgstr "Использовать свой сертификат" + +#: web/src/admin/netcheck.ts +msgid "Used by %s. Choose another port." +msgstr "Порт занят: %s. Выберите другой." + +#: web/src/admin/pages/settings/portal.ts +msgid "Used for HTTPS links" +msgstr "Для ссылок HTTPS" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Using a self-signed certificate: browsers will show a warning." +msgstr "Используется самоподписанный сертификат: браузеры покажут предупреждение." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Using a self-signed certificate: browsers will show a warning. ACME can get a free Let’s Encrypt one." +msgstr "Используется самоподписанный сертификат: браузеры покажут предупреждение. Через ACME можно получить бесплатный сертификат Let’s Encrypt." + +#: web/src/admin/interfaces.ts +msgid "VPN & tunnels" +msgstr "VPN и туннели" + +#: web/src/admin/pages/components/hero.ts +msgid "Versions" +msgstr "Версии" + +#: web/src/admin/pages/overview.ts +msgid "View all" +msgstr "Показать все" + +#: web/src/admin/device.ts +#: web/src/admin/ui/badges.ts +msgid "Waiting for the first connection" +msgstr "Ждём первого подключения" + +#: web/src/admin/updater/operation.ts +msgid "Waiting for the router to restart its services (%s of 30)…" +msgstr "Ожидание перезапуска служб роутера (%s из 30)…" + +#: web/src/admin/updater/operation.ts +msgid "Waiting for the router to restart its services…" +msgstr "Ожидание перезапуска служб роутера…" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Warn" +msgstr "Предупредить" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Warning must be 0-60 days." +msgstr "Предупреждать можно за 0–60 дней." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "Warning: %s sent a file that does not match GitHub's sha256, discarded" +msgstr "Внимание: файл от %s не совпадает с sha256 из GitHub и удалён" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Warning: could not keep %s: %s" +msgstr "Внимание: не удалось сохранить %s: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Warning: the installed build is no longer published, nothing to keep for rollback" +msgstr "Внимание: установленная сборка больше не публикуется, сохранить для отката нечего" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog" +msgstr "Автовосстановление" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog off" +msgstr "Автовосстановление выключено" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog on" +msgstr "Автовосстановление включено" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog repairs" +msgstr "Автовосстановление" + +#: web/src/admin/access.ts +msgid "Web" +msgstr "Веб" + +#: web/src/admin/pages/settings/updates.ts +msgid "Weekly" +msgstr "Раз в неделю" + +#: web/src/admin/device.ts +msgid "Went offline" +msgstr "Вышло из сети" + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "What people see" +msgstr "Что видят люди" + +#: web/src/admin/pages/server.ts +msgid "Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access." +msgstr "Всё, что обрабатывает домашний трафик на этом роутере (прокси, фильтры, DNS), обработает и их трафик. Изменить можно позже в разделе Серверы → Доступ." + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "What’s new" +msgstr "Что нового" + +#: web/src/admin/pages/components/hero.ts +msgid "What’s new in Dawnline %s" +msgstr "Что нового в Dawnline %s" + +#: web/src/admin/pages/components/awg.ts +msgid "What’s new in the %s build" +msgstr "Что нового в сборке %s" + +#: web/src/admin/pages/settings/updates.ts +msgid "When" +msgstr "Когда" + +#: web/src/admin/pages/settings/updates.ts +msgid "When GitHub is unreachable, download through mirrors. Checksums are still verified." +msgstr "Если GitHub недоступен, скачивать через зеркала. Контрольные суммы всё равно проверяются." + +#: web/src/admin/pages/person/dialogs.ts +msgid "When access ends" +msgstr "Когда доступ закончится" + +#: web/src/admin/pages/person/limits.ts +msgid "When it ends: %s" +msgstr "По окончании: %s" + +#: web/src/admin/pages/person/limits.ts +msgid "When it ends: %s, warn %s day before" +msgid_plural "When it ends: %s, warn %s days before" +msgstr[0] "По окончании: %s, предупредить за %s день" +msgstr[1] "По окончании: %s, предупредить за %s дня" +msgstr[2] "По окончании: %s, предупредить за %s дней" + +#: web/src/admin/logs.ts +msgid "Where" +msgstr "Место" + +#: web/src/admin/pages/server.ts +msgid "Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes." +msgstr "Куда подключаются устройства. С именем хоста, которое всегда указывает на ваш роутер (DDNS), ссылки работают и после смены IP." + +#: web/src/admin/pages/server.ts +msgid "Where devices reach AmneziaWG from the internet" +msgstr "Где устройства находят AmneziaWG из интернета" + +#: web/src/admin/cores/awg.ts +msgid "Where devices reach this core from the internet" +msgstr "Куда устройства подключаются из интернета" + +#: web/src/admin/pages/overview.ts +msgid "Where people connect from" +msgstr "Откуда подключаются" + +#: web/src/admin/logs.ts +msgid "Which events" +msgstr "Какие события" + +#: web/src/admin/access.ts +msgid "Who reaches what" +msgstr "Кому что доступно" + +#: web/src/admin/pages/person/pickers.ts +msgid "Whole home network" +msgstr "Вся домашняя сеть" + +#: web/src/admin/pages/person/pickers.ts +msgid "Whole home network. Pick services to narrow it down." +msgstr "Вся домашняя сеть. Выберите сервисы, чтобы ограничить доступ." + +#: web/src/admin/access.ts +msgid "Why something does or does not connect" +msgstr "Почему соединение проходит или нет" + +#: web/src/admin/interfaces.ts +msgid "Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never." +msgstr "Внутри круга: семья видит семью, гости - гостей. Каждый видит свои устройства. Люди только с интернетом - никогда." + +#: web/src/admin/updater/operation.ts +msgid "Working…" +msgstr "Выполняется…" + +#: web/src/admin/netcheck.ts +msgid "Wrong links are sent there instead of a “Not found”." +msgstr "Неверные ссылки будут вести на этот адрес вместо «Not found»." + +#: web/src/admin/netcheck.ts +msgid "Wrong links get a bare “Not found”." +msgstr "По неверной ссылке откроется просто «Not found»." + +#: web/src/admin/events/render.ts +#: web/src/admin/places/model.ts +#: web/src/admin/widgets/spark.ts +msgid "Yesterday" +msgstr "Вчера" + +#: web/src/admin/pages/settings/backups.ts +msgid "Yesterday, %s" +msgstr "Вчера, %s" + +#: web/src/admin/events/render.ts +msgid "You" +msgstr "Вы" + +#: web/src/admin/events/model.ts +msgid "You added circle %s" +msgstr "Вы добавили круг %s" + +#: web/src/admin/events/render.ts +msgid "You added device %s for %s" +msgstr "Вы добавили устройство %s (%s)" + +#: web/src/admin/events/render.ts +msgid "You added person %s" +msgstr "Вы добавили человека %s" + +#: web/src/admin/events/model.ts +msgid "You changed circle %s" +msgstr "Вы изменили круг %s" + +#: web/src/admin/events/render.ts +msgid "You changed device %s of %s" +msgstr "Вы изменили устройство %s (%s)" + +#: web/src/admin/events/render.ts +msgid "You changed person %s" +msgstr "Вы изменили настройки: %s" + +#: web/src/admin/events/model.ts +msgid "You changed server %s" +msgstr "Вы изменили сервер %s" + +#: web/src/admin/events/model.ts +msgid "You changed the personal portal" +msgstr "Вы изменили настройки личного портала" + +#: web/src/admin/events/model.ts +msgid "You cleared the activity log" +msgstr "Вы очистили журнал событий" + +#: web/src/admin/events/model.ts +msgid "You cleared the service log" +msgstr "Вы очистили журнал служб" + +#: web/src/admin/events/model.ts +msgid "You created server %s" +msgstr "Вы создали сервер %s" + +#: web/src/admin/events/model.ts +msgid "You exported all settings" +msgstr "Вы экспортировали все настройки" + +#: web/src/admin/events/model.ts +msgid "You imported settings from a file" +msgstr "Вы импортировали настройки из файла" + +#: web/src/admin/events/render.ts +msgid "You issued a new link for person %s" +msgstr "Вы выпустили новую личную ссылку: %s" + +#: web/src/admin/events/render.ts +msgid "You issued new keys for device %s of %s" +msgstr "Вы выпустили новые ключи для устройства %s (%s)" + +#: web/src/admin/events/render.ts +msgid "You paused person %s" +msgstr "Вы приостановили доступ: %s" + +#: web/src/admin/events/model.ts +msgid "You removed circle %s" +msgstr "Вы удалили круг %s" + +#: web/src/admin/events/render.ts +msgid "You removed device %s from %s" +msgstr "Вы удалили устройство %s (%s)" + +#: web/src/admin/events/render.ts +msgid "You removed person %s" +msgstr "Вы удалили человека %s" + +#: web/src/admin/events/model.ts +msgid "You removed server %s" +msgstr "Вы удалили сервер %s" + +#: web/src/admin/events/render.ts +msgid "You renamed device %s of %s" +msgstr "Вы переименовали устройство %s (%s)" + +#: web/src/admin/events/model.ts +msgid "You reset traffic history for %s" +msgstr "Вы сбросили историю трафика: %s" + +#: web/src/admin/events/model.ts +msgid "You reset traffic history for everyone" +msgstr "Вы сбросили историю трафика у всех" + +#: web/src/admin/events/model.ts +msgid "You restored a backup from a file" +msgstr "Вы восстановили резервную копию из файла" + +#: web/src/admin/events/model.ts +msgid "You restored backup %s" +msgstr "Вы восстановили резервную копию %s" + +#: web/src/admin/events/render.ts +msgid "You resumed person %s" +msgstr "Вы возобновили доступ: %s" + +#: web/src/admin/events/render.ts +msgid "You turned off device %s of %s" +msgstr "Вы выключили устройство %s (%s)" + +#: web/src/admin/events/model.ts +msgid "You turned off server %s" +msgstr "Вы выключили сервер %s" + +#: web/src/admin/events/model.ts +msgid "You turned off the personal portal" +msgstr "Вы выключили личный портал" + +#: web/src/admin/events/model.ts +msgid "You turned off the watchdog" +msgstr "Вы выключили автовосстановление" + +#: web/src/admin/events/render.ts +msgid "You turned on device %s of %s" +msgstr "Вы включили устройство %s (%s)" + +#: web/src/admin/events/model.ts +msgid "You turned on server %s" +msgstr "Вы включили сервер %s" + +#: web/src/admin/events/model.ts +msgid "You turned on the personal portal" +msgstr "Вы включили личный портал" + +#: web/src/admin/events/model.ts +msgid "You turned on the watchdog" +msgstr "Вы включили автовосстановление" + +#: web/src/admin/pages/server.ts +msgid "Your WAN address now - it may change; a DDNS name is better." +msgstr "Ваш текущий адрес WAN - он может измениться; лучше имя DDNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access has ended." +msgstr "Ваш доступ закончился." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access is paused." +msgstr "Ваш доступ на паузе." + +#: web/src/admin/pages/settings/portal.ts +msgid "Your address" +msgstr "Ваш адрес" + +#: web/src/admin/pages/settings/portal.ts +msgid "Your files" +msgstr "Ваши файлы" + +#: web/src/admin/pages/settings/portal.ts +msgid "Your own files" +msgstr "Свои файлы" + +#: web/src/admin/invite.ts +msgid "Your personal VPN link" +msgstr "Ваша личная ссылка на VPN" + +#: web/src/admin/pages/server.ts +msgid "Your router has no public address (CGNAT)" +msgstr "У роутера нет публичного адреса (CGNAT)" + +#: web/src/admin/pages/server.ts +msgid "Your router is behind another router (WAN %s)" +msgstr "Роутер стоит за другим роутером (WAN %s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Zone %s and the WAN rule for UDP %d exist." +msgstr "Зона %s и правило WAN для UDP %d на месте." + +#: web/src/admin/events/render.ts +msgid "a device" +msgstr "без имени" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "a new build needs a manual switch in Components" +msgstr ": новую сборку нужно включить вручную в «Компонентах»" + +#: web/src/admin/events/model.ts +msgid "access" +msgstr "доступ" + +#: web/src/admin/events/model.ts +msgid "address %s" +msgstr "адрес %s" + +#: web/src/admin/pages/components/hero.ts +msgid "ahead of the latest release" +msgstr "новее последнего релиза" + +#: web/src/admin/events/render.ts +msgid "all Cloudflare visitors" +msgstr "всех посетителей через Cloudflare" + +#: web/src/admin/access.ts +msgid "all networks" +msgstr "все сети" + +#: web/src/admin/access.ts +msgid "all ports" +msgstr "все порты" + +#: web/src/admin/events/model.ts +msgid "allowed hours" +msgstr "часы доступа" + +#: web/src/admin/map.ts +msgid "an unknown city" +msgstr "неизвестный город" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "another program on this router" +msgstr "другая программа на этом роутере" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "answers again" +msgstr "снова отвечает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "apk did not reinstall the version that is already installed" +msgstr "apk не переустановил уже установленную версию" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "apk doesn't reinstall an installed version. Install a different release, or run install.sh on the router" +msgstr "apk не переустанавливает уже установленную версию. Установите другой релиз или запустите install.sh на роутере" + +#: web/src/admin/map.ts +msgid "approximate" +msgstr "приблизительно" + +#: web/src/admin/map.ts +msgid "approximate location" +msgstr "приблизительное местоположение" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "are loaded again" +msgstr "снова загружены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "are missing" +msgstr "отсутствуют" + +#: web/src/admin/pages/components/hero.ts +msgid "as soon as found" +msgstr "сразу при обнаружении" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "automatic update failed" +msgstr ": автоматическое обновление не удалось" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "background check failed: %s" +msgstr ": ошибка фоновой проверки (%s)" + +#: web/src/shared/format.ts +msgid "bit/s" +msgstr "бит/с" + +#: web/src/admin/device.ts +msgid "by you" +msgstr "вами" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "can't reach Dawnline (luci.dawnline is missing in rpcd)" +msgstr "не видит Dawnline (в rpcd нет luci.dawnline)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "can't use the network interface %s: it exists and isn't Dawnline's" +msgstr ": нельзя использовать сетевой интерфейс %s, он уже есть и создан не Dawnline" + +#: web/src/admin/events/model.ts +msgid "certificate" +msgstr "сертификат" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate expires %s" +msgstr ": сертификат истекает %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate expires within 7 days" +msgstr ": сертификат истекает в течение 7 дней" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate renewed · valid until %s" +msgstr ": сертификат обновлён · действует до %s" + +#: web/src/admin/pages/components/index.ts +msgid "checked %s" +msgstr "проверено %s" + +#: web/src/admin/pages/components/hero.ts +msgid "checks daily" +msgstr "проверка ежедневно" + +#: web/src/admin/pages/components/hero.ts +msgid "checks every 12 h" +msgstr "проверка каждые 12 ч" + +#: web/src/admin/pages/components/hero.ts +msgid "checks every 6 h" +msgstr "проверка каждые 6 ч" + +#: web/src/admin/pages/components/hero.ts +msgid "checks off" +msgstr "проверка выкл." + +#: web/src/admin/pages/components/hero.ts +msgid "checks weekly" +msgstr "проверка раз в неделю" + +#: web/src/admin/access.ts +msgid "circle" +msgstr "в круге" + +#: web/src/admin/events/model.ts +msgctxt "setting" +msgid "circle" +msgstr "круг" + +#: web/src/admin/map.ts +msgid "click to zoom in" +msgstr "нажмите, чтобы приблизить" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "couldn't be repaired: %s" +msgstr ": не удалось исправить (%s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "couldn't be updated - the previous rules stay, and changes to access wait until they load" +msgstr "не обновились - действуют прежние, изменения доступа ждут их загрузки" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "couldn't load - no device is loaded into the tunnels until they do" +msgstr "не загрузились - пока они не загрузятся, ни одно устройство не попадёт в туннели" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "couldn't load devices into the tunnel" +msgstr ": не удалось загрузить устройства в туннель" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "couldn't start" +msgstr ": не запускается" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "couldn't start · %d failed attempts in %d min" +msgstr ": не запускается · неудачных попыток: %d за %d мин" + +#: web/src/admin/pages/person/devices.ts +msgid "created %s by you." +msgstr "создано вами %s." + +#: web/src/admin/pages/person/devices.ts +msgid "created %s in the portal." +msgstr "создано на портале %s." + +#: web/src/admin/pages/components/hero.ts +msgid "daily at %s" +msgstr "ежедневно в %s" + +#: web/src/admin/events/model.ts +msgid "data limit" +msgstr "лимит трафика" + +#: web/src/admin/events/model.ts +msgid "data limit period" +msgstr "период лимита трафика" + +#: web/src/admin/events/model.ts +msgid "data limit reached" +msgstr "исчерпан лимит трафика" + +#: web/src/admin/map.ts +msgid "device" +msgstr "устройство" + +#: web/src/admin/events/model.ts +msgid "device limit" +msgstr "лимит устройств" + +#: web/src/admin/events/model.ts +msgid "devices kept apart" +msgstr "устройства не видят друг друга" + +#: web/src/admin/events/model.ts +msgid "devices reach each other" +msgstr "устройства видят друг друга" + +#: web/src/admin/events/model.ts +msgid "devices reach each other in circles" +msgstr "устройства видят друг друга внутри кругов" + +#: web/src/admin/access.ts +msgid "direct" +msgstr "напрямую" + +#: web/src/admin/events/model.ts +msgid "disguise: %s" +msgstr "маскировка: %s" + +#: web/src/admin/events/render.ts +msgid "down" +msgstr "остановка" + +#: web/src/admin/pages/people.ts +msgid "e.g. Myata" +msgstr "например, Мята" + +#: web/src/admin/events/model.ts +msgid "end date" +msgstr "дата окончания" + +#: web/src/admin/events/model.ts +msgid "end date reached" +msgstr "наступила дата окончания" + +#: web/src/admin/pages/person/limits.ts +msgid "ended" +msgstr "закончился" + +#: web/src/admin/pages/people.ts +msgid "ended %s" +msgstr "закончился %s" + +#: web/src/shared/format.ts +msgid "ends in %s day" +msgid_plural "ends in %s days" +msgstr[0] "закончится через %s день" +msgstr[1] "закончится через %s дня" +msgstr[2] "закончится через %s дней" + +#: web/src/shared/format.ts +msgid "ends today" +msgstr "закончится сегодня" + +#: web/src/shared/format.ts +msgid "ends tomorrow" +msgstr "закончится завтра" + +#: web/src/admin/events/render.ts +msgid "error" +msgstr "ошибка" + +#: web/src/admin/pages/components/awg.ts +msgid "every app" +msgstr "все приложения" + +#: web/src/admin/events/model.ts +msgid "extra data" +msgstr "дополнительный трафик" + +#: web/src/admin/updater/operation.ts +msgid "failed" +msgstr "ошибка" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "failed - internet goes out directly for now" +msgstr ": не работает - пока интернет идёт напрямую" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "failed: %s" +msgstr ": ошибка (%s)" + +#: web/src/admin/device.ts +msgid "from the portal" +msgstr "через портал" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "h1-h4 must be distinct" +msgstr "h1-h4 должны быть разными" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "has an invalid interface name \"%s\"" +msgstr ": недопустимое имя интерфейса «%s»" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "home" +msgstr "домашняя сеть" + +#: web/src/admin/events/model.ts +msgid "home network and internet path" +msgstr "домашняя сеть и выход в интернет" + +#: web/src/admin/events/model.ts +msgid "home networks" +msgstr "домашние сети" + +#: web/src/admin/events/model.ts +msgid "home services" +msgstr "домашние сервисы" + +#: web/src/admin/pages/people.ts +msgid "in total" +msgstr "всего" + +#: web/src/admin/pages/people.ts +msgid "includes +%s GB extra" +msgstr "включая +%s ГБ дополнительно" + +#: web/src/admin/events/render.ts +msgid "info" +msgstr "информация" + +#: web/src/admin/pages/components/hero.ts +msgid "install any release" +msgstr "установить любой релиз" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "installed the %s build" +msgstr ": установлена сборка %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "installed the %s build · %s" +msgstr ": установлена сборка %s · %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "interface %s" +msgstr "интерфейс %s" + +#: web/src/admin/access.ts +msgid "internet" +msgstr "интернет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down" +msgstr ": остановлен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down: its disguise needs AmneziaWG %s (installed: %s)" +msgstr ": остановлен, для маскировки нужен AmneziaWG %s (установлен %s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down: its disguise needs AmneziaWG %s (installed: none)" +msgstr ": остановлен, для маскировки нужен AmneziaWG %s (не установлен)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "is off" +msgstr "выключен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "is on · traffic enters %s as %s" +msgstr "включён · трафик входит в %s как %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is ready again" +msgstr "снова готов" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't answering on port %d" +msgstr "не отвечает на порту %d" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "isn't installed: no tunnel can run - install it in Dawnline → Components" +msgstr "не установлен: туннели не могут работать - установите его в Dawnline → Компоненты" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc +msgid "isn't installed: tunnels were left as they are" +msgstr "не установлен: туннели оставлены как есть" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "isn't known to the network service - restart the network or reboot" +msgstr "неизвестен сетевой службе - перезапустите сеть или роутер" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't running" +msgstr "не работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't running on this router (fw4): tunnels and the portal are closed" +msgstr "не работает на этом роутере (fw4): туннели и портал закрыты" + +#: web/src/admin/events/render.ts +msgid "it needs its new configuration" +msgstr "нужна новая конфигурация" + +#: web/src/shared/format.ts +msgid "just now" +msgstr "только что" + +#: web/src/shared/format.ts +msgid "kbit/s" +msgstr "кбит/с" + +#: web/src/admin/pages/person/limits.ts +msgid "keep access" +msgstr "сохранить доступ" + +#: web/src/admin/events/model.ts +msgid "kept in memory only (lost on reboot)" +msgstr "только в памяти (пропадают при перезагрузке)" + +#: web/src/admin/pages/components/hero.ts +msgid "kept on flash" +msgstr "во флеш-памяти" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "kernel module isn't installed: no tunnel can run - install it in Dawnline → Components" +msgstr ": модуль ядра не установлен, туннели не могут работать - установите его в Dawnline → Компоненты" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "kernel module isn't loaded" +msgstr ": модуль ядра не загружен" + +#: web/src/admin/widgets/tiles.ts +msgid "last 15 min" +msgstr "за 15 мин" + +#: web/src/admin/pages/person/header.ts +msgid "last seen %s" +msgstr "в сети %s" + +#: web/src/admin/pages/person/activity.ts +msgid "latest 10 of %s" +msgstr "последние 10 из %s" + +#: web/src/admin/pages/components/hero.ts +msgid "latest release" +msgstr "последний релиз" + +#: web/src/admin/interfaces.ts +msgid "leaves through %s" +msgstr "выход через %s" + +#: web/src/admin/access.ts +msgid "like home" +msgstr "как из дома" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "loading it" +msgstr "загружаем" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "loading them again" +msgstr "загружаем заново" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/packages.ts +msgid "missing %s" +msgstr "не хватает: %s" + +#: web/src/admin/events/model.ts +msgid "moved to %s" +msgstr "перенос на %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "moved to word codes" +msgstr "переведены на коды из слов" + +#: web/src/admin/events/model.ts +msgid "name" +msgstr "имя" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "netifd doesn't know the amneziawg protocol (AmneziaWG missing, or the network wasn't restarted after installing it)." +msgstr "netifd не знает протокол amneziawg (AmneziaWG не установлен или сеть не перезапускали после установки)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed." +msgstr "netifd читает обработчики протоколов при запуске, а запущен он был ещё до установки AmneziaWG." + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "network changed - Dawnline set itself up again" +msgstr ": сеть изменилась, Dawnline настроился заново" + +#: web/src/shared/format.ts +msgid "never" +msgstr "никогда" + +#: web/src/admin/pages/person/header.ts +msgid "never connected" +msgstr "подключений не было" + +#: web/src/admin/pages/components/hero.ts +msgid "next in %s" +msgstr "следующая через %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "nightly backup failed: %s" +msgstr ": ночная резервная копия не создана (%s)" + +#: web/src/admin/pages/person/dialogs.ts +msgid "no address" +msgstr "нет адреса" + +#: web/src/admin/events/model.ts +msgid "no age limit" +msgstr "без ограничения срока" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "no circle" +msgstr "без круга" + +#: web/src/admin/pages/person/limits.ts +msgid "no end date" +msgstr "бессрочно" + +#: web/src/admin/interfaces.ts +msgid "no firewall zone" +msgstr "нет зоны межсетевого экрана" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "no limit" +msgstr "без лимита" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "no repairs today" +msgstr "сегодня без исправлений" + +#: web/src/admin/events/model.ts +msgid "no server" +msgstr "нет сервера" + +#: web/src/admin/access.ts +msgid "nobody yet" +msgstr "пока никого" + +#: web/src/admin/pages/components/awg.ts +msgid "none yet" +msgstr "пока нет" + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "not checked yet" +msgstr "ещё не проверено" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/packages.ts +msgid "not installed" +msgstr "не установлено" + +#: web/src/admin/pages/people.ts +msgid "not set up" +msgstr "не настроено" + +#: web/src/admin/map.ts +#: web/src/admin/places/render.ts +msgid "now" +msgstr "сейчас" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "of %s" +msgstr "из %s" + +#: web/src/admin/events/model.ts +msgid "older than %s day" +msgid_plural "older than %s days" +msgstr[0] "старше %s дня" +msgstr[1] "старше %s дней" +msgstr[2] "старше %s дней" + +#: web/src/admin/device.ts +msgid "on the portal" +msgstr "на портале" + +#: web/src/admin/pages/overview.ts +msgid "online" +msgstr "в сети" + +#: web/src/admin/pages/overview.ts +msgid "online for %s" +msgstr "в сети %s" + +#: web/src/admin/pages/people.ts +msgid "online from %s" +msgstr "в сети с адреса %s" + +#: web/src/admin/pages/person/header.ts +msgid "online now" +msgstr "сейчас в сети" + +#: web/src/admin/events/model.ts +msgid "other addresses" +msgstr "другие адреса" + +#: web/src/admin/events/model.ts +msgid "outside allowed hours" +msgstr "вне часов доступа" + +#: web/src/admin/pages/person/pickers.ts +msgid "over the limit" +msgstr "сверх лимита" + +#: web/src/admin/events/model.ts +msgid "pause" +msgstr "пауза" + +#: web/src/admin/pages/person/limits.ts +msgid "pause access" +msgstr "приостановить доступ" + +#: web/src/admin/events/model.ts +msgid "paused by admin" +msgstr "приостановлено администратором" + +#: web/src/admin/widgets/tiles.ts +msgid "peak %s" +msgstr "пик %s" + +#: web/src/admin/events/model.ts +msgid "port %s" +msgstr "порт %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "port forward “%s”" +msgstr "проброс порта «%s»" + +#: web/src/admin/access.ts +msgid "ports %s" +msgstr "порты %s" + +#: web/src/admin/events/model.ts +msgid "problems are only logged, nothing is repaired" +msgstr "проблемы только записываются в журнал, ничего не исправляется" + +#: web/src/admin/events/model.ts +msgid "public address" +msgstr "публичный адрес" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "public address changed · %s → %s" +msgstr ": публичный адрес изменился · %s → %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "reaches Dawnline again" +msgstr "снова видит Dawnline" + +#: web/src/admin/events/model.ts +msgid "redirect" +msgstr "перенаправление" + +#: web/src/admin/pages/components/hero.ts +msgid "release %s" +msgstr "релиз %s" + +#: web/src/admin/pages/components/hero.ts +msgid "released %s" +msgstr "вышел %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "reloading rpcd" +msgstr "перезагружаем rpcd" + +#: web/src/admin/pages/person/limits.ts +msgid "remove their devices" +msgstr "удалить устройства" + +#: web/src/admin/events/render.ts +msgid "repair" +msgstr "исправление" + +#: web/src/admin/pages/person/limits.ts +msgid "resets on the 1st" +msgstr "сброс 1-го числа" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "restarted · version %s" +msgstr "перезапущен · версия %s" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "restarting for the AmneziaWG update" +msgstr ": перезапуск для обновления AmneziaWG" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "restarting it" +msgstr "перезапускаем" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "restoring them" +msgstr "восстанавливаем" + +#: web/src/admin/cores/awg.ts +msgid "router %s" +msgstr "роутер %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline are in place again" +msgstr ": правила Dawnline снова на месте" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline aren't loaded" +msgstr ": правила Dawnline не загружены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline were changed or removed" +msgstr ": правила Dawnline изменены или удалены" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "runs again" +msgstr "снова работает" + +#: web/src/admin/events/model.ts +msgid "saved to flash every 10 minutes" +msgstr "записываются во флеш-память каждые 10 минут" + +#: web/src/admin/events/model.ts +msgid "saved to flash hourly" +msgstr "записываются во флеш-память раз в час" + +#: web/src/admin/pages/people.ts +msgid "seen %s" +msgstr "в сети %s" + +#: web/src/admin/events/model.ts +msgid "server" +msgstr "сервер" + +#: web/src/admin/events/model.ts +msgid "server turned off" +msgstr "сервер выключен" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "server “%s”" +msgstr "сервер «%s»" + +#: web/src/admin/access.ts +msgid "services" +msgstr "сервисы" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "setting it up again" +msgstr "настраиваем заново" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "sha256 matches the release (%s…)" +msgstr "sha256 совпадает с релизом (%s…)" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "started" +msgstr ": запущен" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "started with the router · version %s" +msgstr "запущен вместе с роутером · версия %s" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "started · accepting connections on port %s" +msgstr ": запущен · принимает подключения на порту %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "started · version %s" +msgstr "запущен · версия %s" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "stopped unexpectedly" +msgstr ": неожиданно остановился" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "stopped unexpectedly - started again" +msgstr "неожиданно остановился - запущен снова" + +#: web/src/admin/events/model.ts +msgid "the file holds private keys" +msgstr "в файле есть приватные ключи" + +#: web/src/admin/interfaces.ts +msgid "the link is down" +msgstr "связь не установлена" + +#: web/src/admin/events/render.ts +msgid "the old link stopped working" +msgstr "старая больше не работает" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "the router itself" +msgstr "сам роутер" + +#: web/src/admin/pages/person/dialogs.ts +msgid "the server" +msgstr "новый сервер" + +#: web/src/admin/access.ts +msgid "their networks" +msgstr "свои сети" + +#: web/src/admin/access.ts +msgid "their own" +msgstr "свой" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "this month" +msgstr "в этом месяце" + +#: web/src/admin/pages/person/limits.ts +msgctxt "time range" +msgid "to" +msgstr "до" + +#: web/src/admin/widgets/tiles.ts +msgid "today" +msgstr "сегодня" + +#: web/src/admin/pages/people.ts +msgid "today %s" +msgstr "сегодня %s" + +#: web/src/admin/events/model.ts +msgid "tunnel network" +msgstr "сеть туннеля" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/settings/portal.ts +msgid "until %s" +msgstr "до %s" + +#: web/src/admin/events/render.ts +msgid "up" +msgstr "запуск" + +#: web/src/admin/pages/server.ts +msgid "up %s" +msgstr "работает %s" + +#: web/src/admin/events/model.ts +msgid "up to %s event" +msgid_plural "up to %s events" +msgstr[0] "до %s события" +msgstr[1] "до %s событий" +msgstr[2] "до %s событий" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "update failed" +msgstr ": обновление не удалось" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "update to %s failed its check - rolled back to %s" +msgstr ": обновление до %s не прошло проверку - откат на %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated automatically · %s" +msgstr "обновлены автоматически · %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated automatically · %s → %s" +msgstr "обновлён автоматически · %s → %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated · %s" +msgstr "обновлены · %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated · %s → %s" +msgstr "обновлён · %s → %s" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updates available · %s" +msgstr ": есть обновления · %s" + +#: web/src/admin/pages/components/awg.ts +msgid "version not checked" +msgstr "версия не проверена" + +#: web/src/admin/pages/settings/portal.ts +msgid "vpn.example.com or an IP" +msgstr "vpn.example.com или IP-адрес" + +#: web/src/admin/events/model.ts +msgid "warning before the end" +msgstr "предупреждение до окончания" + +#: web/src/admin/events/render.ts +msgid "was %s" +msgstr "прежнее имя: %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "was broken - set up again (%s as %s)" +msgstr ": был сломан - настроен заново (%s как %s)" + +#: web/src/admin/pages/components/hero.ts +msgid "weekly at %s" +msgstr "еженедельно в %s" + +#: web/src/admin/events/model.ts +msgid "what happens at the end" +msgstr "действие по окончании" + +#: web/src/admin/events/model.ts +msgid "with %s person" +msgid_plural "with %s people" +msgstr[0] "с %s человеком" +msgstr[1] "с %s людьми" +msgstr[2] "с %s людьми" + +#: web/src/admin/interfaces.ts +msgid "zone %s" +msgstr "зона %s" + +#: web/src/admin/netcheck.ts +msgid "“%s” already exists - pick another name." +msgstr "«%s» уже есть - выберите другое имя." + +#: web/src/admin/netcheck.ts +msgid "“%s” is not a port (1–65535)." +msgstr "«%s» - не порт (1–65535)." + +#: web/src/admin/netcheck.ts +msgid "“%s” is not an IP address. Separate several with commas." +msgstr "«%s» - не IP-адрес. Несколько адресов разделяйте запятыми." + +#: web/src/admin/pages/components/hero.ts +msgid "← Newer" +msgstr "← Новее" diff --git a/package/luci-app-dawnline/po/templates/dawnline.pot b/package/luci-app-dawnline/po/templates/dawnline.pot new file mode 100644 index 0000000..f5591a6 --- /dev/null +++ b/package/luci-app-dawnline/po/templates/dawnline.pot @@ -0,0 +1,8073 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" already exists." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "\"%s\" is already taken." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "\"%s\" is not a device or an IPv4 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "\"Devices reach each other\" is off on %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "%d MB free on the overlay" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d MB free on the overlay." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d device is loaded in the tunnel." +msgid_plural "%d devices are loaded in the tunnel." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d of %d device missing, %d loaded that should not be." +msgid_plural "%d of %d devices missing, %d loaded that should not be." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%d of %d device missing." +msgid_plural "%d of %d devices missing." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "%d package update in the feeds: %s" +msgid_plural "%d package updates in the feeds: %s" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%d system package" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%d system packages" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s %s automatically" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s %s by you" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s (after %d repair)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s (after %d repairs)" +msgstr "" + +#: web/src/admin/pages/settings/map.ts +msgid "%s (fallback: %s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - %d repairs didn't help" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s - not repaired again (%d repairs didn't help)" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you)." +msgid_plural "%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s MB free: settings may stop saving. Remove old backups (Settings → Backups) or shorten the history." +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +msgid "%s added" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s added by you" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s address" +msgid_plural "%s addresses" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "%s already exists." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s already has %d device. Remove one first to lower the limit to %d." +msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/device.ts +msgid "%s already has %s of %s device. As admin you can still add one." +msgid_plural "%s already has %s of %s devices. As admin you can still add one." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/netcheck.ts +msgid "%s already uses %s." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "%s and %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s and %s are not in one circle" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "%s applied" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "%s blocked %s for 15 min after too many wrong codes" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "%s build" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "%s byte" +msgid_plural "%s bytes" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: it is outside their allowed hours" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: it is turned off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: their access has ended" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: their server is turned off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they are paused" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they have no server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't be reached: they used up their data" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: it is outside their allowed hours" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: their access has ended" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: their server is turned off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they are paused" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they have no server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s can't connect: they used up their data" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s can't use the network interface %s: it exists and isn't Dawnline's." +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s check failed" +msgstr "" + +#: web/src/admin/device.ts +msgid "%s copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s covers %s and is valid for more than 14 days." +msgstr "" + +#: web/src/shared/format.ts +msgid "%s d ago" +msgstr "" + +#: web/src/admin/events/model.ts +#: web/src/admin/pages/settings/logs.ts +msgid "%s day" +msgid_plural "%s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s day before" +msgid_plural "%s days before" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/limits.ts +msgid "%s day left" +msgid_plural "%s days left" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/access.ts +msgid "%s deleted" +msgstr "" + +#: web/src/admin/map.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "%s device" +msgid_plural "%s devices" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind." +msgid_plural "%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/server.ts +msgid "%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you)." +msgid_plural "%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you)." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/map.ts +msgid "%s device in %s, %s" +msgid_plural "%s devices in %s, %s" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/map.ts +msgid "%s device in an unknown city, %s" +msgid_plural "%s devices in an unknown city, %s" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s device in use" +msgid_plural "%s devices in use" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "%s device is disconnected immediately and the personal link stops working." +msgid_plural "All %s devices are disconnected immediately and the personal link stops working." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/people.ts +msgid "%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups." +msgid_plural "All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/overview.ts +msgid "%s device needs its configuration again (networks or DNS changed)." +msgid_plural "%s devices need their configuration again (networks or DNS changed)." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not cover %s (it has %s): browsers will warn." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not overlap other networks." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s does not resolve." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s doesn't reach %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "%s entry" +msgid_plural "%s entries" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/events/model.ts +#: web/src/admin/pages/settings/logs.ts +msgid "%s event" +msgid_plural "%s events" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/logs.ts +msgid "%s event removed" +msgid_plural "%s events removed" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s expires within 14 days." +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s found by a check" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s found by the automatic check" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive." +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "%s from the OpenWrt feeds. Services that use them restart for a moment." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s goes through Cloudflare; in Russia such connections often stall after ~16 KB." +msgstr "" + +#: web/src/shared/format.ts +msgid "%s h ago" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home and Internet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only: only DNS and the portal on the router." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Home only: their device's own internet reaches it, not the tunnel." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has Internet only: only DNS and the portal on the router." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s has an invalid interface name \"%s\"." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has never connected" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "%s has no IPv4 address." +msgstr "" + +#: web/src/admin/access.ts +msgid "%s has no home access: their devices aren't reachable anyway" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s has no room for every device on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has no server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s has only some home services" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s has used 90% of the data limit." +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "%s home service only" +msgid_plural "%s home services only" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s in memory" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s in memory, %s on flash" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "%s in total" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is %s, one of %s's home services" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "%s is 0 or 1." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is active" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is at home (%s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is connected" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is down." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is down: %s." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s is in %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is in %s, which %s doesn't reach" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is in home network %s" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s is in no circle" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: %s)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: none)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is missing." +msgid_plural "%s are missing." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "%s is not a bridge, so Dawnline cannot join the LAN as a device." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "%s is not a package Dawnline manages" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is not an IP address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is not in a firewall zone, so the server port cannot be opened on it." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "%s is not in any home network of this server: nobody would reach it." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is not one of %s's home services" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is not one of Dawnline's tunnels." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is on another server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is on the internet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is part of %s; choose %s instead." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "%s is ready" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s is the WAN." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router on a network %s doesn't reach" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router: DNS is open to everyone" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is this router: the personal portal is open to everyone" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s is turned off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s is up, listening on UDP %d." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s isn't connected right now" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s isn't in %s's home network" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "%s junk" +msgid_plural "%s junk" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s left" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s min ago" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s month" +msgid_plural "%s months" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/widgets/health.ts +msgid "%s more in Diagnostics" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "%s moves to %s with OpenWrt %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s must be a number or range" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "%s needs a manual switch in Components" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s needs its configuration again." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s of %s" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s of %s GB" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s of %s GB this month" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "%s of %s check passed" +msgid_plural "%s of %s checks passed" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "%s of %s device" +msgid_plural "%s of %s devices" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/components/index.ts +msgid "%s of %s needs an update" +msgid_plural "%s of %s need an update" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/backups.ts +msgid "%s older backup" +msgid_plural "%s older backups" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s on flash" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "%s on this router" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "%s online" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s overlaps %s." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "%s paused" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/map.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "%s person" +msgid_plural "%s people" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/interfaces.ts +msgid "%s person has Home-only access: their devices need the configuration again to reach the new networks." +msgid_plural "%s people have Home-only access: their devices need the configuration again to reach the new networks." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/activity.ts +msgid "%s place in 30 days" +msgid_plural "%s places in 30 days" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at %s, not this router (%s)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at %s, not this router (WAN %s). Check your DNS / DDNS." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s points at this router (%s)." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s problem needs attention." +msgid_plural "%s problems need attention." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/cores/awg.ts +msgid "%s random packet of %s–%s bytes before each handshake." +msgid_plural "%s random packets of %s–%s bytes before each handshake." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/overview.ts +msgid "%s reached the data limit." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s reaches %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s reaches %s." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "%s reaches every home network" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s reaches no home network." +msgstr "" + +#: web/src/admin/access.ts +msgid "%s removed" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s repair" +msgid_plural "%s repairs" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s repair today, last %s at %s" +msgid_plural "%s repairs today, last %s at %s" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/people.ts +msgid "%s resumed" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s since %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations." +msgstr "" + +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/updater/jobs.ts +msgid "%s system package" +msgid_plural "%s system packages" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/netcheck.ts +msgid "%s takes over when the tunnel is down." +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/header.ts +#: web/src/shared/format.ts +msgid "%s this month" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "%s time" +msgid_plural "%s times" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/overview.ts +msgid "%s today" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "%s update" +msgid_plural "%s updates" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s update failed" +msgstr "" + +#: web/src/admin/access.ts +msgid "%s updated" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s updated automatically" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "%s updated by you" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s uses %s now - devices need their configuration again" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "%s warning." +msgid_plural "%s warnings." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/logs.ts +msgid "%s year" +msgid_plural "%s years" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "%s · restored" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "%s – %s (router time)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s (Cloudflare). %s reaches the router only if this name is DNS-only there, or use the router's IP." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s (this router)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s: IPv6 only, so only devices with IPv6 connect (the router's IPv4 %s has no name)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "%s → %s: IPv6 only, so only devices with IPv6 connect." +msgstr "" + +#: web/src/admin/places/render.ts +msgid "%s%% of the time" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "%s%% used" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s, online" +msgstr "" + +#: web/src/admin/map.ts +msgid "%s: %s device in %s" +msgid_plural "%s: %s devices in %s" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/map.ts +msgid "%s: %s device in an unknown city" +msgid_plural "%s: %s devices in an unknown city" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/disguise.ts +msgid "%s: %s of 4" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "%s: the device's own network handles it." +msgstr "" + +#: web/src/shared/format.ts +msgid "%sd %sh" +msgstr "" + +#: web/src/shared/format.ts +msgid "%sh %sm" +msgstr "" + +#: web/src/shared/format.ts +msgid "%sm" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s’s access %s." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s’s access has ended." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "%s’s end date passed (%s) · access kept." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "(%d more)" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "+%s more in What’s new" +msgid_plural "+%s more in What’s new" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 month" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 week" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "+1 year" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "+10 GB this month" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "+3 months" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "1 month" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "1 year" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "15 min" +msgstr "" + +#: web/src/admin/map.ts +msgid "24h" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "3 months" +msgstr "" + +#: web/src/admin/map.ts +msgid "30 days" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "4500 is IPsec’s port: most networks let it through." +msgstr "" + +#: web/src/admin/map.ts +msgid "7 days" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "A DDNS name would follow it by itself." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "A first packet shaped like a DNS answer." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "A hostname has no spaces." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "A number of GB, up to 100000." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "A page where each person adds and manages their devices with their personal link." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "A page where each person adds their own devices with their personal link" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "A set time keeps tunnel restarts out of the evening; the run happens within an hour of it." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "ACME isn’t installed. With it the router gets a certificate and browsers stop warning." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +msgid "Access" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Access %s (router time)" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Access & limits" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Access and limits" +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "Access ended" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Access ended %s" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Access ends" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Access ends %s" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Access ends in %s day (%s)." +msgid_plural "Access ends in %s days (%s)." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/netcheck.ts +msgid "Access ends today (%s)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Access must be lan, internet or both." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Access rules" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Access rules aren’t loaded" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Access rules couldn't be updated (%s): the previous rules stay, so this change isn't in effect yet." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Access rules couldn't load (%s): no device is loaded into the tunnels until they do." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Access rules loaded" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Access saved" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Access until %s" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Access: %s" +msgstr "" + +#: web/src/shared/format.ts +msgid "Active" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgctxt "build" +msgid "Active" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/device.ts +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Activity" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Activity log" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Activity: %s." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Add" +msgstr "" + +#: web/src/admin/device.ts +msgid "Add a device for %s" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Add a server" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "Add device" +msgstr "" + +#: web/src/admin/access.ts +msgid "Add from devices at home" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "Add note" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Add person" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Add server" +msgstr "" + +#: web/src/admin/access.ts +msgid "Add service" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Add the device and connect" +msgstr "" + +#: web/src/admin/device.ts +msgid "Added" +msgstr "" + +#: web/src/admin/device.ts +msgid "Added %s" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgctxt "date" +msgid "Added %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Adding the Russian translation" +msgstr "" + +#: web/src/admin/access.ts +msgid "Address" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Address copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Address must be an IPv4 address." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Address range" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Addresses" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Addresses devices get inside the tunnel" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Adds the LAN this router uses." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Agent" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Alert at 90%" +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/people.ts +msgid "All" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "All %s check passed" +msgid_plural "All %s checks passed" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/device.ts +msgid "All activity" +msgstr "" + +#: web/src/admin/logs.ts +msgid "All categories" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "All checks passed." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "All components" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "All good. Nothing needs you right now." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "All in Log" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "All in Log →" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +#: web/src/admin/access.ts +msgid "All ports" +msgstr "" + +#: web/src/admin/access.ts +msgid "All ports, or e.g. 445, 5000" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "All ports." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Allow fewer devices" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Allow more devices" +msgstr "" + +#: web/src/admin/access.ts +msgid "Allowed" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Allowed %s–%s" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "Allowed hours" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Allowed: %s" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Already has %s device: remove %s first, or allow more." +msgid_plural "Already has %s devices: remove %s first, or allow more." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/netcheck.ts +msgid "Already has %s device: remove one first, or allow more." +msgid_plural "Already has %s devices: remove one first, or allow more." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/invite.ts +msgid "Also" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaVPN → %s. Keep it private." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "AmneziaWG %s is installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG %s: no source publishes this build for this firmware any more" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 2.0+ apps" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 3.1 apps" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG answers may not reach devices" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG answers reach devices" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG devices loaded" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG firewall" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG firewall rules are missing" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG is down" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "AmneziaWG is installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is installed, but its kernel module doesn't load on this firmware" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is missing from the router" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is not installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components, then choose Balanced." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components, then choose Maximum." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components." +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "AmneziaWG is off by default: a new kernel module restarts every tunnel." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is running again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG is running again · accepting connections on port %d" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG is up to date (%s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG isn't accepting connections on port %d" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "AmneziaWG isn't running" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/pages/server.ts +msgid "AmneziaWG isn’t installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG needs a build for the new firmware" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "AmneziaWG not installed" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "AmneziaWG port" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG port is free" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG port is taken" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG running" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "AmneziaWG saved" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG subnet is unique" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG subnet overlaps another network" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "AmneziaWG update is available: %s → %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "AmneziaWG's kernel module doesn't load on this firmware: reinstall a build for this kernel in Components." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "AmneziaWG’s kernel module doesn’t load" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "AmneziaWG’s kernel module doesn’t load on this firmware" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc +msgid "An update is running: wait for it to finish, then remove Dawnline." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +#: web/src/admin/pages/components/index.ts +msgid "Another component action is already running" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s are swallowed by a proxy on the router (%s): clients get no reply." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s go straight out." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Answers from %s go straight out. A proxy on the router diverts its own traffic (%s); these answers skip it." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Answers reach visitors" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Any WireGuard app" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Any time" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Appearance" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Applies at once: every AmneziaWG device imports its configuration again." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Apps with AmneziaWG 3.1 (current AmneziaVPN)" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "As soon as found" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "At a set time" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/interfaces.ts +msgid "Auto" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Auto-detect LAN" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Auto-detect WAN" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Auto-update" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Automatic certificate" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Automatic update: %s" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: AmneziaWG" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: Dawnline" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: components" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Automatic update: system packages" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/shared/format.ts +msgid "B" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Back" +msgstr "" + +#: web/src/admin/pages/person/index.ts +msgid "Back to Servers" +msgstr "" + +#: web/src/admin/places/render.ts +msgid "Back to now" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Back up now" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Background agent isn’t running" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Background agent running" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Backing up configuration" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Backup" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backup created" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backup deleted" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup does not contain /etc/config/dawnline." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup failed: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup failed: the archive could not be written (is the flash full?)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup is too large." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Backup not found." +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backups" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router." +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Balanced" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Balanced needs AmneziaWG 2.0 or newer on the router: install a current build in Dawnline → Components." +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before import" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before removing a server" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before restore" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Before update" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Behind Cloudflare · often stalls in Russia" +msgstr "" + +#: web/src/admin/access.ts +msgid "Blocked" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "Blocked portal sign-ins (tunnels and services are in the service log)" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/limits.ts +msgid "Both" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Both are %s's devices" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Both are in %s" +msgstr "" + +#: web/src/admin/pages/person/index.ts +msgid "Breadcrumb" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Browse the internet through your router. No access to devices at home, and home cannot reach theirs." +msgstr "" + +#: web/src/admin/widgets/access-picker.ts +msgid "Browse the internet through your router. No access to devices at home." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Build and translation" +msgstr "" + +#: web/src/admin/logs.ts +msgid "By" +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "CSV (spreadsheet)" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Can reach" +msgstr "" + +#: web/src/admin/pages/server.ts +#: web/src/admin/ui/modal.ts +msgid "Cancel" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Cannot detect the firmware target" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Cannot reach github.com/%s" +msgstr "" + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Can’t start" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Category" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate file" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Certificate saved" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Certificates (ACME)" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Change" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Change limit" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Change the tunnel network" +msgstr "" + +#: web/src/admin/device.ts +msgid "Changed network" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Changing it marks devices “Update config” until they import again" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Changing these marks devices “Update config” until they import again" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/pages/components/index.ts +msgid "Check" +msgstr "" + +#: web/src/admin/access.ts +msgid "Check access" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Check all" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Check automatically" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Check every 6h, 12h, 1d or 7d." +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Check failed" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Check for updates" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Check for updates to see the builds for this router." +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Check system packages" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/index.ts +msgid "Checking AmneziaWG" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "Checking Dawnline" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Checking all components" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Checking components" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/components/packages.ts +msgid "Checking system packages" +msgstr "" + +#: web/src/admin/netcheck.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Checking where it points…" +msgstr "" + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/updater/operation.ts +msgid "Checking…" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Checks" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Choose %s to include it." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Choose a device on at least one side." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Choose a free port between 1 and 65535 (not 22, 53, 80 or 443)." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Choose a server on their page" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Choose another interface name in the server settings." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Choose the interface that leads to the internet." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Circle %s: server %s does not exist." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Circles" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "City-level, from the client IP" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "City-level, from the client IP · locations cached on the router" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/settings/logs.ts +msgid "Clear" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/activity.ts +msgid "Clear %s's activity" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Clear activity" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Clear one person or device from their own page." +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Clear the log" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Clears %s's traffic history and that of their devices. Their data limit starts again from zero." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Clears traffic history for everyone. Data limits start again from zero." +msgstr "" + +#: web/src/admin/device.ts +msgid "Client IP" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Clock is set" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Clock isn’t set" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/ui/drawer.ts +#: web/src/admin/ui/toast.ts +#: web/src/admin/updater/notes.ts +#: web/src/admin/updater/operation.ts +msgid "Close" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "Collecting… 1 point a minute" +msgstr "" + +#: web/src/admin/access.ts +msgid "Colour" +msgstr "" + +#: web/src/admin/access.ts +msgid "Colour %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Components" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Computers and routers get %s, phones and tablets %s." +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "Config" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Configuration" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Configuration copied" +msgstr "" + +#: web/src/admin/ui/modal.ts +msgid "Confirm" +msgstr "" + +#: web/src/admin/device.ts +msgctxt "section" +msgid "Connect" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Connected" +msgstr "" + +#: web/src/admin/device.ts +msgid "Connected from %s" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Connection" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/events/model.ts +msgid "Connections" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "Connects, disconnects and IP changes" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgctxt "AmneziaVPN app" +msgid "Continue" +msgstr "" + +#: web/src/admin/ui/files.ts +msgid "Copied to clipboard" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/admin/updater/notes.ts +msgid "Copy" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Copy AmneziaVPN config" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Copy address" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Copy as config" +msgstr "" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Copy link" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Copy log" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Copy this link" +msgstr "" + +#: web/src/admin/ui/files.ts +msgid "Copying is blocked here. Select the text and copy it by hand." +msgstr "" + +#: web/src/admin/invite.ts +msgid "Could not draw the card" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Could not find a free id, try again." +msgstr "" + +#: web/src/admin/map.ts +msgid "Could not load the map library (no internet access from this browser?)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Couldn't load devices into %s: %s." +msgstr "" + +#: web/src/admin/access.ts +msgid "Couldn't read the devices at home." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc +msgid "Couldn't save /etc/config/dawnline: %s. Is the flash full?" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc +msgid "Couldn't save /etc/config/dawnline: the write failed. Is the flash full?" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Couldn't show people: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Couldn't write %s. Is the flash full?" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Counts traffic and enforces end dates and quotas." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Create" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Create a new link?" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Create and copy link" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Create new link" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Create server" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Created. Turn on the personal portal in Settings to get a link, or add devices for them here." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Cross-site request refused." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Current" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Current parameters" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Custom" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgctxt "disguise" +msgid "Custom" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "DNS" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "DNS for Home-only devices" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "DNS for Home-only devices isn’t working" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "DNS for devices" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "DNS-like first packets" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Daily" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Daily traffic" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Daily traffic history must be 7-1830 days." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Danger zone" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Data" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/ui/badges.ts +msgid "Data limit" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit %s GB" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit (GB)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Data limit must be a positive number of GB." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Data limit period" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/shared/format.ts +msgid "Data limit reached" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Date" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +msgid "Dawnline" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Dawnline %s is installed." +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed." +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Dawnline is up to date (%s)" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Dawnline removed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Dawnline update is available: %s → %s" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Dawnline updated to %s" +msgstr "" + +#: web/src/admin/state/live.ts +msgid "Dawnline was updated to %s: reload the page." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Default device limit must be 1-32." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Default: a packet every 25 s keeps NAT open and “Connected” accurate." +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Delete" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Delete %s?" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Delete this backup?" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Deleted" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Detail" +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Details" +msgstr "" + +#: web/src/admin/device.ts +msgctxt "section" +msgid "Details" +msgstr "" + +#: web/src/admin/logs.ts +#: web/src/admin/map.ts +msgid "Device" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Device %s changed network %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Device %s connected" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Device %s connected from %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is also used by device %s of %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is not a plain IPv4 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is outside %s's tunnel %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is the router's own address on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address (none) is not a plain IPv4 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the preshared key is not a key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the private key is not a key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the public key is not a key." +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Device %s went offline" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s: person %s does not exist." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Device DNS - devices need their configuration again" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Device addresses" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Device addresses come from it." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Device addresses: %s" +msgstr "" + +#: web/src/admin/device.ts +msgid "Device disabled" +msgstr "" + +#: web/src/admin/device.ts +msgid "Device enabled" +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Device hostnames" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit must be between 1 and 32." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit reached (%d)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Device not found." +msgstr "" + +#: web/src/admin/device.ts +msgid "Device removed" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +#: web/src/admin/pages/person/pickers.ts +msgid "Devices" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Devices added through the old link keep working until they are removed. Remove them too:" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +msgid "Devices are marked “Update config” until they import again." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Devices can’t connect" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Devices can’t connect until you resume" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Devices connect once it is on" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Devices connect to" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Devices connect to %s." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Devices get %s – %s, the router %s." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Devices get names like %s." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices in one circle reach each other." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Devices need AmneziaVPN 3.1 or newer." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Devices of different people never reach each other; a person's own devices don't either." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices of different servers never reach each other." +msgstr "" + +#: web/src/admin/access.ts +msgid "Devices of people in one circle reach each other. A person is in one circle at a time." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Devices of people with home access reach each other, like home devices do. Internet-only people never." +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Devices per person" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Devices reach each other" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Devices reach each other on this server" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Devices reach each other: %s" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Devices see each other" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Devices send a packet every %s s to keep NAT open (a little battery on phones)." +msgstr "" + +#: web/src/admin/access.ts +msgid "Devices that got an address from this router. Pick the ports to open, or all ports." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Devices use %s - home names and your LAN’s DNS filters no longer apply to them." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Device’s own DNS" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/diagnostics/index.ts +msgid "Diagnostics" +msgstr "" + +#: web/src/admin/device.ts +msgid "Disable" +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "Disabled" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Disguise" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Disguise method" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Domain may use lowercase letters, digits, dashes and dots." +msgstr "" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/widgets/health.ts +msgid "Done" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/events/render.ts +msgid "Done by you in LuCI" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Don’t warn" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Download" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgctxt "speed" +msgid "Download" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Download AmneziaWG config" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Download card" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Download failed: %s" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Download the log as %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Downloading %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Downloading %s from %s" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Downloads and installs new versions of the components below." +msgstr "" + +#: web/src/admin/access.ts +msgid "Each other" +msgstr "" + +#: web/src/admin/access.ts +msgid "Edit" +msgstr "" + +#: web/src/admin/access.ts +msgid "Edit %s" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "Edit note" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Empty" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Empty = the portal’s address (%s)." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Empty = the portal’s address." +msgstr "" + +#: web/src/admin/device.ts +msgid "Enable" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Enable portal" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Encrypted headers" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "End date" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "End date must be YYYY-MM-DD." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "End dates and quotas use the router clock." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Endpoint must be a hostname or IP address." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "English only" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Enter a circle name: up to 32 characters, without < > \" or \\." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Enter a device name (up to 48 characters)." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Enter a hostname or IP address." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Enter a name." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc +msgid "Enter a name: up to 48 characters, without < > \" or \\." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Enter a release tag like 0.3.1" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Enter a time as HH:MM, 00:00 to 23:59." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Enter both times, like 07:00 and 23:00." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Error: %s" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Every 10 min" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Every 12 h" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Every 6 h" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Every device has a key and an address of its own inside its server." +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Every interface restarts. Connections drop for a few seconds." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Every minute it checks the tunnels and services and repairs what it can on its own." +msgstr "" + +#: web/src/admin/access.ts +msgid "Every step lets it through" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Everyone" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Everyone online" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Everything" +msgstr "" + +#: web/src/admin/pages/diagnostics/index.ts +msgid "Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own." +msgstr "" + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/updater/jobs.ts +msgid "Everything is up to date" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Everything returns to %s. The current state is backed up first." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Example code; each person gets their own three words." +msgstr "" + +#: web/src/shared/format.ts +msgid "Expired" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/diagnostics/log.ts +msgid "Export" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Export CSV" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/backups.ts +msgid "Export JSON" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Export or clear" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Extend 1 month" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Extended by 1 month" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Extra data must be a positive number of GB." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Extra packets sent before the handshake." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Failed" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Failed to load versions: %s" +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Fallback DNS" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Fallback DNS must be an IPv4 address (or empty for none)." +msgstr "" + +#: web/src/admin/access.ts +msgid "Family" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "File" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "File %s does not exist." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Find a person or device" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Find…" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/updater/operation.ts +msgid "Finished" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Firewall" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Firewall zone or WAN rule is missing." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "First three numbers of the device addresses" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Fix" +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "For Home-only devices using home names: %s" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "For every device" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Found automatically" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Free certificate from Let’s Encrypt" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Free slot" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Free space on the router" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "From" +msgstr "" + +#: web/src/admin/access.ts +msgid "From the rules on this server" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "From your DDNS name." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "From your Let’s Encrypt certificate." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "GB" +msgstr "" + +#: web/src/shared/format.ts +msgid "Gbit/s" +msgstr "" + +#: web/src/admin/device.ts +msgid "Generate" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Generate and apply" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Generate new disguise values?" +msgstr "" + +#: web/src/admin/device.ts +msgid "Generate new keys?" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Generate new values" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub API rate limit reached: try again in an hour." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub did not answer, trying mirrors" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "GitHub mirrors" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "GitHub: %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "H1–H4 random" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "HTTPS for the portal" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "HTTPS here, plain HTTP for links on IP addresses on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "HTTPS isn't available on this router: install %s." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "HTTPS isn’t available on this router" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "HTTPS on this port, opened on WAN." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Handshake and key timers vary within these ranges instead of WireGuard’s fixed values." +msgstr "" + +#: web/src/admin/pages/diagnostics/index.ts +#: web/src/admin/pages/overview.ts +msgid "Health" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Hi, %s" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Hide" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Hide key" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +#: web/src/admin/access.ts +#: web/src/admin/map.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +msgid "Home" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home access includes the router." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Home access reaches %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home access reaches every home network." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home and Internet" +msgstr "" + +#: web/src/admin/widgets/access-picker.ts +msgid "Home devices and the internet, all through your router." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Home devices and the internet, all through your router. Home reaches their devices too." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home devices reach only people with home access." +msgstr "" + +#: web/src/admin/access.ts +msgid "Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home names" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home names on - devices need their configuration again" +msgstr "" + +#: web/src/admin/interfaces.ts +#: web/src/shared/format.ts +msgid "Home network" +msgstr "" + +#: web/src/shared/format.ts +msgid "Home network + Internet" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home networks %s reaches. Networks added to the server later stay out." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home networks %s reaches: all of them. Untick one to keep %s out of it." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Home only" +msgstr "" + +#: web/src/admin/map.ts +msgid "Home router" +msgstr "" + +#: web/src/admin/access.ts +msgid "Home services" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Home services updated" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Home-like link" +msgstr "" + +#: web/src/admin/access.ts +msgid "Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Hourly" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Hours must look like 07:00-23:00." +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "How devices reach the internet" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "How often" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "How the portal listens (80 and 443 stay free)" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Idle right now" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import JSON" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Import?" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Imported" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "In every device configuration" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "In total" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Includes +%s GB extra this month" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgctxt "AmneziaVPN app" +msgid "Insert" +msgstr "" + +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/packages.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pkgs.ts +#: web/src/admin/widgets/health.ts +msgid "Install" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Install %s on the device" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Install ACME" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Install ACME certificates?" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Install AmneziaWG %s?" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Install AmneziaWG first" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Install AmneziaWG?" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Install Dawnline %s?" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Install HTTPS for the portal?" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Install automatically" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc +msgid "Install it in Dawnline → Components." +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Install the home-like link?" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Install updates immediately or scheduled." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Installation failed" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installed Dawnline %s is newer than the release %s" +msgstr "" + +#: web/src/admin/updater/jobs.ts +msgid "Installed version is newer than the release (%s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +#: web/src/admin/pages/components/packages.ts +msgid "Installing %s" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Installing ACME certificates" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pkgs.ts +msgid "Installing AmneziaWG" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Installing Dawnline %s" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Installing HTTPS for the portal" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installing package" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Installing the %s build" +msgstr "" + +#: web/src/admin/pkgs.ts +msgid "Installing the home-like link" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Installing the translation" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Interface" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Interface %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Interface name: 1-12 lowercase letters, digits or _." +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/shared/format.ts +msgid "Internet" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet interface" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Internet keeps working exactly as without the VPN. Reach home devices by IP address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/server.ts +msgid "Internet like a home device" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet like a home device isn’t working" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet like a home device not bypassed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Internet only" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet straight to %s" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Internet through the LAN is off: %s" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet traffic enters %s as %s, so whatever handles home traffic (proxies, filters, DNS) handles it too." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet traffic goes straight to the WAN for now." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Internet traffic leaves through WAN directly." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Invalid JSON." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid backup name." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid option %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Invalid port %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Invalid public key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Invalid section %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Invalid service id." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Invalid value for %s." +msgstr "" + +#: web/src/admin/invite.ts +msgid "Invite %s" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Invite card" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Invite card for %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It is in the tunnel network %s." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves like a home device would." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves through %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "It leaves through the WAN." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Its configuration doesn't send it to the router" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Its configuration sends it to the router" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Junk packets" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Just the name, without a path." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Just the name, without a port (the port is on AmneziaWG)." +msgstr "" + +#: web/src/shared/format.ts +msgid "KB" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Keep access" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Keep activity" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Keep activity for 0 (no age limit) to 9999 days." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Keep at least one network, or choose Internet only." +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Keep the previous version" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Keep-alive" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Keep-alive must be 0-600 seconds." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Keeping AmneziaWG %s for rollback" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Keeping Dawnline %s for rollback" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Kept after the next update" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "Kept for %s, %s, %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Kernel module, awg tool and the netifd protocol are present." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Key" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Key copied" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Key file" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed (is amneziawg-tools installed?)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Key generation failed (no random data)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed." +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "Last 30 days" +msgstr "" + +#: web/src/admin/device.ts +msgid "Last 7 days" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Last check" +msgstr "" + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Last seen" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Last seen %s" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Last: %s, %s" +msgstr "" + +#: web/src/admin/updater/jobs.ts +msgid "Latest version is installed" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Leave out https:// - just the name." +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Let’s Encrypt certificate for the portal" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Limit hours" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Link copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Links on %s use plain HTTP: the link and the VPN keys in configurations travel unencrypted." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Links on IP addresses also need %s, used by %s. Choose another port." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Links on IP addresses also need the next port: choose a lower one." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Links on IP addresses use plain HTTP on the next port (%d), which the portal cannot take. Choose another portal port." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Links use %s." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Links will open for the people you send them to." +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Listening" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Listening on TCP %d." +msgstr "" + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Listening port" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Live tunnel" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Loading interfaces…" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Loading people…" +msgstr "" + +#: web/src/admin/updater/notes.ts +msgid "Loading release notes…" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Loading the kernel module" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Loading versions…" +msgstr "" + +#: web/src/admin/device.ts +msgid "Loading…" +msgstr "" + +#: web/src/admin/device.ts +msgid "Local address" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Location cache" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Location cache cleared" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/settings/map.ts +msgid "Locations" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Locations are off" +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Locations are off. %s." +msgstr "" + +#: web/src/admin/pages/diagnostics/index.ts +msgid "Log" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Log copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Log size must be 100-20000 events." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Logs & history" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Looked %s" +msgstr "" + +#: web/src/admin/access.ts +msgid "Looking for devices at home…" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Looking for the %s build for OpenWrt %s" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Looks for new versions in the background; Components shows what it found and the service log names it." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Lowercase letters, digits, dashes and dots." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Lowercase only." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "LuCI link" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "LuCI pages for AmneziaWG" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "LuCI pages for Dawnline" +msgstr "" + +#: web/src/shared/format.ts +msgid "MB" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "MTU is now automatic" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "MTU must be 1280-1500." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "MTU must be 1280–1500, or empty for automatic." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Made by the router: browsers warn until a certificate covers the address." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Main" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Make main" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Manual" +msgstr "" + +#: web/src/admin/pages/settings/map.ts +msgid "Map & locations" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Maximum" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Maximum events" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Maximum needs AmneziaWG 3.1 on the router (kmod-amneziawg, amneziawg-tools 3.1): install a 3.1 build in Dawnline → Components." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Maximum size" +msgstr "" + +#: web/src/shared/format.ts +msgid "Mbit/s" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Memory only" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Method not allowed." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Missing: %s." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Monthly" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Monthly data (GB)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Monthly data must be a positive number of GB." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Monthly traffic" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Monthly traffic history must be 1-120 months." +msgstr "" + +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/pages/settings/backups.ts +msgid "More" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Most: %s" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Move" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Move %s to another server" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "Move to server…" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Moved to %s" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Must start with http:// or https://." +msgstr "" + +#: web/src/admin/access.ts +msgid "NAS" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/server.ts +msgid "Name" +msgstr "" + +#: web/src/admin/access.ts +msgctxt "circle or service" +msgid "Name" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +msgctxt "person" +msgid "Name" +msgstr "" + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Name" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Name: %s" +msgstr "" + +#: web/src/admin/device.ts +msgid "Named after its type: %s." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Names can’t contain < > \" or \\." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down)." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down." +msgstr "" + +#: web/src/admin/map.ts +msgid "Near %s" +msgstr "" + +#: web/src/admin/map.ts +msgid "Near the server" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Need a little more this month?" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Needs %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Needs %s. Internet traffic leaves through WAN directly until then." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG 3.1 on the router: install it first." +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Needs AmneziaWG on the router." +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Needs attention" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Network interface %s already exists." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Networks" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Networks a person does not reach cannot reach them either." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Never" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Never connected" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Never reached from the internet yet - test with a phone on mobile data." +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/pickers.ts +msgid "New circle" +msgstr "" + +#: web/src/admin/device.ts +msgid "New keys" +msgstr "" + +#: web/src/admin/device.ts +msgid "New keys %s" +msgstr "" + +#: web/src/admin/device.ts +msgid "New keys generated" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "New link" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link copied" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link created" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "New link created, %s device removed" +msgid_plural "New link created, %s devices removed" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "New people" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "New values applied" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Newer than release" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Newest events are kept when the log is full." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Next" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Nightly" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Nightly when something changed, and before every restore, import or update. The last 10 are kept." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No %s build for OpenWrt %s in %s, or it could not be verified" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No AmneziaWG build for OpenWrt %s (%s) yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No AmneziaWG build for OpenWrt %s yet" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "No IPv4 network" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No LAN detected." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "No WAN found" +msgstr "" + +#: web/src/admin/device.ts +msgid "No activity yet." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "No answer" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "No backups yet." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "No build" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "No circle" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "No data limit" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "No device has connected yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "No device uses %s" +msgstr "" + +#: web/src/admin/access.ts +msgid "No devices found in the home network right now." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "No devices on this server yet: nothing else changes." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "No end" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "No end date" +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "No events match." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free address left on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free address on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free addresses left in the server subnet." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free link-local range for the internal link." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "No free routing table." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "No home network: Home access reaches nothing but this router." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "No junk packets." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgctxt "retention" +msgid "No limit" +msgstr "" + +#: web/src/admin/places/render.ts +msgid "No locations in this period." +msgstr "" + +#: web/src/admin/map.ts +#: web/src/admin/pages/person/activity.ts +msgid "No locations yet" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "No more versions." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "No netifd interface" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "No one here right now." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No other policy routing ahead of the tunnel rules." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "No people yet. Add someone and send them their personal link." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "No previous AmneziaWG build is kept on the router" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "No previous Dawnline version is kept on the router" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "No problems in the last 7 days." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No public address: devices will not know where to connect." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "No release %s in %s." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/ui/badges.ts +#: web/src/shared/format.ts +msgid "No server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "No server yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "No server yet." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "No server yet. %s before adding people." +msgstr "" + +#: web/src/admin/access.ts +msgid "No services yet: pick ports of a device below." +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "No traffic yet." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "No values yet" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "No versions found." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Nobody can connect. Turn it on to bring the tunnel back." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Nobody else in %s yet" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Nobody is connected" +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "None" +msgstr "" + +#: web/src/admin/pages/people.ts +msgctxt "end date" +msgid "None" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "None: without the tunnel those devices have no DNS." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Not a Dawnline export." +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Not a JSON file." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Not a usable address (no spaces or quotes)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Not a valid backup archive." +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Not checked" +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "Not connected yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "Not enough free space on the router: %d MB free, about %d MB needed. Remove old backups or packages first" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Not every device is loaded into AmneziaWG" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Not found now: using %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +#: web/src/admin/interfaces.ts +msgid "Not found." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Not in a firewall zone: the firewall rejects this traffic." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Not installed" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Not present right now" +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Not recorded: %s." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Not running" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +#: web/src/admin/ui/badges.ts +msgid "Not set up yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Not set up." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Not set: the certificate is picked automatically." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Not working" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Not working: %s" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note removed" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Note saved" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Nothing else was changed." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Nothing listens on TCP %d." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Nothing matched" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Nothing to install" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc +msgid "Nothing to save." +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Nothing yet." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Nothing yet. Connections, new devices and pauses appear here." +msgstr "" + +#: web/src/admin/access.ts +msgid "Now in %s" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Now: %s, was %s." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Now: %s." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "OK" +msgstr "" + +#: web/src/admin/disguise.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/server.ts +msgid "Off" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Off: NAT may close the tunnel when idle, and “Connected” lags." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Off: only you add devices, from LuCI. On: people manage their devices within the limits you set." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Off: problems are only written to the log. Nothing is repaired on its own." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Offline" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Older events are removed automatically." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Older than %s day" +msgid_plural "Older than %s days" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Older than must be a number of days." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Older →" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/server.ts +msgid "On" +msgstr "" + +#: web/src/admin/updater/notes.ts +msgid "On GitHub" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "On one of the networks %s reaches." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "One of the networks %s reaches." +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/people.ts +msgid "Online" +msgstr "" + +#: web/src/admin/map.ts +msgid "Online now" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Only %s's own devices" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only devices of people with home access can be reached." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only home devices reach people's devices." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Only people with home access reach other devices." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Only the admin can turn devices off." +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Only the selected services at home." +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Only you see this" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Open" +msgstr "" + +#: web/src/admin/map.ts +msgid "Open %s" +msgstr "" + +#: web/src/admin/pages/server.ts +#: web/src/admin/widgets/health.ts +msgid "Open Components" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Open Diagnostics" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "Open Diagnostics → Health." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Open Settings" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Open on GitHub" +msgstr "" + +#: web/src/admin/map.ts +msgid "Open person" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Open the OpenWrt package list" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Open the link or scan the code" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Open this link over HTTPS to get the connection settings." +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "OpenSSL for uhttpd" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "Opened on the WAN firewall automatically." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Operation completed" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Operation failed" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Operation log" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Operation started. Waiting for log output…" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Optional. No data limit." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Optional. No end date." +msgstr "" + +#: web/src/admin/interfaces.ts +#: web/src/shared/format.ts +msgid "Other" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Other address" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Other addresses must be hostnames or IP addresses." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Other interfaces" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Other policy routing bypasses the home-device path" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/shared/format.ts +msgid "Outside allowed hours" +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "Outside hours" +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "Over the limit" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Over the limit: admins can still add" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Overview" +msgstr "" + +#: web/src/shared/format.ts +msgid "PC" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Package installation failed" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Packet types" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Padding" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Page %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Parameters copied" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Paths on the router. Leave both empty to pick a certificate automatically." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Pause" +msgstr "" + +#: web/src/admin/places/render.ts +msgctxt "replay" +msgid "Pause" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Pause access" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +#: web/src/admin/ui/badges.ts +#: web/src/shared/format.ts +msgid "Paused" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Paused after %s GB in total." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Paused after %s GB this month, resumed on the 1st." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Paused until it resets on %s" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Paused until the limit is raised" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/access.ts +#: web/src/admin/events/model.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/index.ts +#: web/src/admin/pages/server.ts +msgid "People" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "People and devices are inconsistent" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "People and devices consistent" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "People and their devices added, changed, paused, removed" +msgstr "" + +#: web/src/admin/access.ts +msgid "People limited to this service lose access to it." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "People with Home or Both" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "People with Internet or Both" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Per-day history behind the charts." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Per-month totals; data limits use the current month." +msgstr "" + +#: web/src/admin/logs.ts +msgid "Person" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s - all devices removed, end date reached" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s added device %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s added device %s on their portal" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s issued new keys for device %s on their portal" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s paused" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s paused - %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s removed device %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s removed device %s on their portal" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s resumed" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s resumed - %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: circle %s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: has the same personal link as %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: home service %s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: server %s does not exist." +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s’s access ends in %s day" +msgid_plural "Person %s’s access ends in %s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/events/render.ts +msgid "Person %s’s access ends in a few days" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "Person %s’s end date passed (%s) · access kept" +msgstr "" + +#: web/src/admin/pages/person/index.ts +msgid "Person not found" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Person removed" +msgstr "" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +msgid "Personal link copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "Personal links" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +#: web/src/admin/events/render.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Personal portal" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Personal portal isn’t working" +msgstr "" + +#: web/src/shared/format.ts +msgid "Phone" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Pick one or more; the first is the main link" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Plain HTTP" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain HTTP links" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Plain HTTP: the link and VPN keys travel unencrypted" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Plain WireGuard" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain resolver on port %d." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Plain resolver running next to the LAN (%s)." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at %s, not this router" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at this router · Let’s Encrypt certificate" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points at this router · no certificate yet" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Points here" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Policy routing and the veth pair" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Policy routing on the router (%s) sends marked traffic straight out, past the home-device path: tunnel traffic it matches skips your LAN's proxies and filters." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Port" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Port %s." +msgid_plural "Ports %s." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Port must be 1-65535." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Port of %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Port, MTU and keep-alive apply at once." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +#: web/src/admin/events/model.ts +#: web/src/admin/pages/server.ts +msgid "Portal" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address doesn’t point here" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address isn’t set" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal address points here" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal addresses" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal answers may not reach visitors" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal answers reach visitors" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal certificate" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal certificate needs attention" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal is off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Portal links use plain HTTP" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Portal port must be 1-65535." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Portal port: %s" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Portal running" +msgstr "" + +#: web/src/admin/access.ts +msgid "Ports" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Ports %s" +msgstr "" + +#: web/src/admin/access.ts +msgid "Ports they announce over Bonjour. Pick what to open, or all ports." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Ports: %s" +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "Pre-filled when you add someone." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/updater/notes.ts +msgid "Pre-release" +msgstr "" + +#: web/src/admin/access.ts +msgid "Printer" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Private addresses outside the home network are blocked." +msgstr "" + +#: web/src/admin/events/model.ts +msgid "Problems" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Protection" +msgstr "" + +#: web/src/admin/pages/settings/map.ts +msgid "Provider" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/pages/server.ts +msgid "Public address" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Public address changed: %s still gives devices %s, the router is %s now." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Public address must be a hostname or IP address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Public address needs attention" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Public address: %s" +msgstr "" + +#: web/src/admin/device.ts +msgid "Public key" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Public key copied" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/shared/qr.ts +msgid "QR code" +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "QR, file, key, rename, new keys, remove" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard." +msgstr "" + +#: web/src/admin/widgets/access-picker.ts +msgid "Reach devices at home (NAS, printer, cameras). Internet stays on their own connection." +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Reach devices at home, and home reaches theirs. Internet stays on their own connection." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Reached from the internet %s." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Read the interfaces again" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Ready" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Ready to share" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Recent problems" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Recommended" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Record" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Redirect must be a full http:// or https:// address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Refreshing package lists" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Reinstall %s" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Reinstall this build" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Reinstalling AmneziaWG" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Reinstalling Dawnline" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s has no %s: it stays as it is" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s has no translation into %s: install a release that has one" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Release %s publishes no checksum for %s: not installing an unverified package" +msgstr "" + +#: web/src/admin/updater/notes.ts +msgid "Release notes copied" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Release tag" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Reload devices" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Reload now" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Reloading the kernel module (%d tunnel restarts)" +msgid_plural "Reloading the kernel module (%d tunnels restart)" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/updater/operation.ts +msgid "Reloading the page…" +msgstr "" + +#: web/src/admin/access.ts +msgid "Remote desktop" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/danger.ts +msgid "Remove" +msgstr "" + +#: web/src/admin/access.ts +msgid "Remove %s" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/server.ts +msgid "Remove %s?" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline from this router" +msgstr "" + +#: web/src/admin/pages/settings/danger.ts +msgid "Remove Dawnline?" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Remove a device first to lower the limit" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Remove server" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Remove their devices" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/device.ts +msgid "Removed" +msgstr "" + +#: web/src/admin/device.ts +msgid "Removed %s" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Removes events about %s and their devices." +msgstr "" + +#: web/src/admin/device.ts +msgid "Removes events about %s." +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +#: web/src/admin/pages/settings/logs.ts +msgid "Removes events from the log on the router." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first." +msgid_plural "Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Removing the Russian translation" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Removing the translation" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/header.ts +msgid "Rename" +msgstr "" + +#: web/src/admin/device.ts +msgid "Rename %s" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/dialogs.ts +msgid "Renamed" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Repair" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Repaired by the watchdog at %s" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Replace the current Dawnline configuration with %s? The current state is backed up first." +msgstr "" + +#: web/src/admin/places/render.ts +msgid "Replay this period" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Request too large." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Rescan" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Reset" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Reset all traffic history?" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Reset traffic history for %s?" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Reset usage" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "Resolver" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Restart network" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Restart service" +msgstr "" + +#: web/src/admin/widgets/health.ts +msgid "Restart the network?" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Restarting the network so it knows AmneziaWG (connections drop for a few seconds)" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Restarting the network so it knows AmneziaWG: back in a few seconds" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Restarting with the new settings." +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore from file" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore from file?" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restore this backup?" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Restored" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/header.ts +msgid "Resume" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "Resumed" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Right now" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Roll back" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Roll back AmneziaWG to %s?" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Roll back to %s" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Roll back to Dawnline %s?" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Rollback" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Rolling back AmneziaWG" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Rolling back Dawnline" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Rolling back to %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/shared/format.ts +msgid "Router" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Run a check or an update by hand in Components." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Run again" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Run the setup wizard" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Run the setup wizard on the Server tab." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Running" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +#: web/src/admin/pages/settings/portal.ts +msgid "Running checks…" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Runs within an hour after %s (router time)." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Russian" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "Russian translation" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +#: web/src/admin/interfaces.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/person/limits.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/defaults.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/map.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Save" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Save the log every 10min, hourly or off." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Save to flash" +msgstr "" + +#: web/src/admin/access.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/defaults.ts +#: web/src/admin/pages/settings/logs.ts +#: web/src/admin/pages/settings/map.ts +#: web/src/admin/pages/settings/portal.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Saved" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB." +msgstr "" + +#: web/src/admin/invite.ts +msgid "Scan to connect to %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Scan with AmneziaVPN or AmneziaWG on the device." +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/device.ts +msgid "Scan with AmneziaVPN or any WireGuard app on the device." +msgstr "" + +#: web/src/admin/access.ts +msgid "Screen sharing" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Seen recently" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Self-signed" +msgstr "" + +#: web/src/admin/invite.ts +#: web/src/admin/pages/people.ts +msgid "Send %s the card or the link. They open it, add their devices and connect - no account needed." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +#: web/src/admin/events/render.ts +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +#: web/src/admin/pages/server.ts +msgid "Server" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server %d" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: %s is one of the router's own network interfaces." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: UDP %s is also used by %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Server %s: interface %s is also used by %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server ID may use lowercase letters, digits and underscores." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Server configured" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Server created" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Server is disabled." +msgstr "" + +#: web/src/shared/format.ts +msgid "Server is turned off" +msgstr "" + +#: web/src/admin/ui/badges.ts +msgid "Server off" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Server public key" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Server removed" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Server turned off" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Server turned on" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Server → Access → Home network." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Server: Enter a name: up to 48 characters, without < > \" or \\." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +#: web/src/admin/pages/person/index.ts +#: web/src/admin/pages/server.ts +msgid "Servers" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Service: Enter a name: up to 48 characters, without < > \" or \\." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Services are back. Reloading…" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Services restarted. Reload the page to use the new version." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Set by hand" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "Set the hours, then press Enter" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Set the public hostname in Settings so links can be generated." +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "Set up %s" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Set up Dawnline" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Set up a server first." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Set up the server first, then add people." +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Set up the server first." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/luci/menu.d/luci-app-dawnline.json +#: web/src/admin/pages/components/index.ts +#: web/src/admin/pages/settings/index.ts +msgid "Settings" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "Setup failed: %s" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Share card" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Share link" +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "Show %s more of %s" +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "Show QR" +msgstr "" + +#: web/src/admin/device.ts +msgid "Show QR code" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Show key" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Show map" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Show progress" +msgstr "" + +#: web/src/admin/pages/settings/map.ts +msgid "Show where people connect from on the Overview and person pages, at city level." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Show “Not found”" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "Shown after a device connects" +msgstr "" + +#: web/src/admin/device.ts +msgid "Shown in the portal and in the app." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/dialogs.ts +msgid "Shown in their portal and apps." +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Shown in their portal and on the Overview." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Shown on the person cards." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Shown to people in their portal and apps." +msgstr "" + +#: web/src/admin/access.ts +msgid "Shown to people who may reach it." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Signature packets" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Signatures" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard" +msgstr "" + +#: web/src/admin/map.ts +msgid "Someone" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "Sort" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Source" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Speed" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "Speed now" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Standard (old)" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Starts within a minute" +msgstr "" + +#: web/src/admin/device.ts +msgid "Status" +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/disguise.ts +msgid "Stealth" +msgstr "" + +#: web/src/admin/access.ts +msgid "Stops at step %s of %s" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Stops the tunnel and disconnects everyone on it. Settings and people are kept." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Stored data" +msgstr "" + +#: web/src/admin/disguise.ts +msgid "Strong (old)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Subnet must look like 10.77.0.0/24." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Subnet overlaps %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Such devices are left out of the tunnels: fix or remove them." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switch" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Switch and apply" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Switch to %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Switch to %s?" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switch to AmneziaWG %s?" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Switch to Balanced or Maximum" +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Switched-off categories are not logged from now on." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts %s for a few seconds." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations." +msgid_plural "Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching takes a few seconds." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching takes a few seconds. Devices keep their configurations." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "Switching to AmneziaWG %s" +msgstr "" + +#: web/src/admin/logs.ts +#: web/src/admin/pages/diagnostics/log.ts +msgid "System" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/activity.ts +#: web/src/admin/pages/settings/updates.ts +#: web/src/admin/updater/jobs.ts +msgid "System packages" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "System packages are up to date" +msgstr "" + +#: web/src/shared/format.ts +msgid "TB" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "TCP %d is already used by %s. Choose another port in Settings." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is already used by %s. Choose another portal port." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is already used by %s. Links on IP addresses use plain HTTP on the port after the portal's. Choose another portal port." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "TCP %d is sent on by port forward “%s”. Choose another portal port." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Table inet dawnline enforces who may reach LAN and the internet." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Table inet dawnline is missing: no device is loaded into the tunnels until it is back." +msgstr "" + +#: web/src/shared/format.ts +msgid "Tablet" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Tag, e.g. 0.3.1" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "That date has passed: access would end at once." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "That id is taken." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "That is the same device" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "The %s build, %s." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The WAN address %s is CGNAT (shared by the ISP): %s cannot be forwarded to this router from outside unless the ISP gives a public address or IPv6." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The WAN address %s is private: this router is behind another one. Forward %s on it, or devices cannot connect." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "The admin has turned this device off." +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "The agent has not checked in for %s min; cron restarts it after 5." +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "The backup from %s is removed from the router." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "The configuration in this file cannot be read." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "The copy kept on the router replaces %s. A backup of the settings is made first." +msgstr "" + +#: web/src/admin/device.ts +msgid "The current configuration on this device stops working until it is imported again." +msgstr "" + +#: web/src/admin/pages/settings/defaults.ts +msgid "The default, 3. Pre-filled when you add someone." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "The default, lan: devices get names like %s." +msgstr "" + +#: web/src/admin/device.ts +msgid "The device is disconnected immediately and its configuration stops working." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "The device’s address at home." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "The firewall lets it through" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The firmware changed (kernel %s → %s): the AmneziaWG build installed for it is gone. Install the build for this firmware." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The id may use lowercase letters, digits and underscores." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "The interface with the default route: the server port opens there and Internet access leaves through it." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The kept AmneziaWG build was made for another firmware: it would not load on this one" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The kernel module doesn't load. Reinstall a build for this kernel in Components." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The kernel module doesn't load: %s Reinstall a build for this kernel in Components." +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "The latest release is %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The link is up but not attached to %s." +msgstr "" + +#: web/src/admin/pages/diagnostics/log.ts +msgid "The log is empty." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The main address is an IP: its links use plain HTTP." +msgstr "" + +#: web/src/admin/map.ts +msgid "The map library from the CDN is not the expected file: not loading it." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "The name people see, where devices find the router, and DNS. The port is on AmneziaWG." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The network doesn’t know AmneziaWG yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The new AmneziaWG kernel module doesn't load on this firmware: the tunnels stay down until it does (see the log above)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "The old AmneziaWG kernel module is still loaded (another AmneziaWG interface may use it): reboot the router to finish the update" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "The old link stops working right away." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The person has no server." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "The personal portal is off." +msgstr "" + +#: web/src/admin/invite.ts +msgid "The personal portal is off. Turn it on in Settings." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "The portal needs %s. It can’t start without them." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "The portal’s address." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "The portal’s checks from Health" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The resolver is not running; Home-only devices cannot resolve names." +msgstr "" + +#: web/src/admin/state/poller.ts +msgid "The router answers again." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The router clock looks wrong; end dates will misbehave. Check NTP." +msgstr "" + +#: web/src/admin/state/poller.ts +msgid "The router is not answering: what you see may be out of date." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "The router is running out of flash" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "The router reaches it only while its VPN is on." +msgstr "" + +#: web/src/admin/pages/settings/map.ts +msgid "The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "The router stopped answering. The job may still finish: reopen Components in a minute." +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "The server is turned off" +msgstr "" + +#: web/src/admin/logs.ts +msgid "The service log was not cleared: %s" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "The start and the end must differ." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "The translation could not be removed" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "The translation is installed." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "The translation is removed." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "The tunnel needs %s. Install the build made for this firmware, then create the server." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted." +msgid_plural "The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc +msgid "The update stopped unexpectedly." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "The values that replace WireGuard’s recognisable message types." +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Then" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "There is no session the router could reach." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "They can add %s device themselves." +msgid_plural "They can add %s devices themselves." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/person/pickers.ts +msgid "They can add a device here" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "They have no devices yet: nothing else changes." +msgstr "" + +#: web/src/admin/pages/person/index.ts +msgid "They may have been removed." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "They need an app with AmneziaWG 2.0 or newer." +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "They need an app with AmneziaWG 3.1." +msgstr "" + +#: web/src/admin/logs.ts +msgid "This cannot be undone; export first if you want a copy." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "This configuration can't be used: %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "This device generated its own keys in the browser, so its full configuration only exists on that device." +msgstr "" + +#: web/src/admin/device.ts +msgid "This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below." +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "This device made its own keys in the browser; its configuration only exists there." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "This is a SNAPSHOT firmware: the AmneziaWG projects publish builds for releases only" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "This key is already in use." +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/people.ts +msgid "This month" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "This month by device" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "This person was just removed." +msgstr "" + +#: web/src/admin/updater/notes.ts +msgid "This release has no notes." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first." +msgid_plural "This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/settings/backups.ts +msgid "This replaces the whole Dawnline configuration on this router. The current state is backed up first." +msgstr "" + +#: web/src/admin/access.ts +msgid "This router" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "This router (%s): queries go where your home network sends them, and home names work." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "This router (recommended)" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "This server" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "This server is off" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Three numbers, like 10.77.0." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Through the home network" +msgstr "" + +#: web/src/admin/logs.ts +#: web/src/admin/pages/settings/updates.ts +msgid "Time" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Time: %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Timing" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "To" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "To keep the old disguise for some people, add a second server and move them there." +msgstr "" + +#: web/src/admin/events/render.ts +#: web/src/admin/places/model.ts +#: web/src/admin/widgets/spark.ts +#: web/src/admin/widgets/tiles.ts +msgid "Today" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "Today %s" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Today, %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Too many changes in a short time. Try again in a few minutes." +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/pages/person/limits.ts +msgid "Total" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "Traffic" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Traffic enters %s as %s, so it is handled like any device on your LAN." +msgstr "" + +#: web/src/admin/pages/settings/logs.ts +msgid "Traffic history" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Traffic history reset" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Translation" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "Translation removed by you" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Try %s." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Try again" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Try another build in Components, or update OpenWrt. The server can’t start until it loads." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "Trying mirror %s" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Tunnel" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Tunnel %s is down." +msgstr "" + +#: web/src/admin/device.ts +msgid "Tunnel address" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Tunnel network" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Tunnel network changed" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Tunnel subnet" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Turn off" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Turn off %s?" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Turn off this server" +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +#: web/src/admin/pages/server.ts +msgid "Turn on" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "Turn the device on again on its page." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Turn the portal on to see its certificate." +msgstr "" + +#: web/src/admin/pages/overview.ts +#: web/src/admin/pages/person/activity.ts +msgid "Turn them on in Settings" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Turned off" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/logs.ts +msgid "Type" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc +msgid "Type \"remove\" to confirm." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "UDP %d is also used by %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "UDP %d is used by %s. Choose another port." +msgstr "" + +#: web/src/admin/cores/awg.ts +#: web/src/admin/pages/server.ts +msgid "UDP port" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "UDP port must be 1-65535." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "UDP port: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Unexpected entry in backup: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Unexpected file in backup: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Unknown AmneziaWG build %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown DNS choice." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Unknown action." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown category." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Unknown choice for devices reaching each other." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Unknown circle." +msgstr "" + +#: web/src/admin/places/render.ts +msgid "Unknown city" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "Unknown component %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown device." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "Unknown disguise method." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown end action." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Unknown fix." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Unknown links" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Unknown location service." +msgstr "" + +#: web/src/admin/map.ts +msgid "Unknown network" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown page." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown person." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown release." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +msgid "Unknown scope." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Unknown server." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown service %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +msgid "Unknown service." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +msgid "Unknown setting %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +msgid "Unknown update target." +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "Unlimited" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Until they are installed, internet traffic goes straight to the WAN." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Up to %s character (%s now)." +msgid_plural "Up to %s characters (%s now)." +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/pages/components/index.ts +msgid "Up to date" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Update" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgctxt "noun" +msgid "Update" +msgstr "" + +#: web/src/admin/pages/components/packages.ts +msgid "Update %s?" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Update available" +msgstr "" + +#: web/src/admin/updater/jobs.ts +msgid "Update available: %s" +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "Update config" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +msgid "Update failed" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Update now" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/updater/operation.ts +msgid "Update to %s" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Updated %s" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Updated system packages" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Updates" +msgstr "" + +#: web/src/admin/pages/components/activity.ts +msgid "Updates, and checks that found something, show up here." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +#: web/src/admin/pages/components/packages.ts +msgid "Updating %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/index.ts +msgid "Updating AmneziaWG" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "Updating Dawnline" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Updating components" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +#: web/src/admin/pages/components/index.ts +msgid "Updating system packages" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "Updating…" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgctxt "speed" +msgid "Upload" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +msgid "Upload is empty or too large." +msgstr "" + +#: web/src/admin/pages/people.ts +msgctxt "sort" +msgid "Usage" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use 0–600 seconds." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use 1–32." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use HH:MM, 00:00–23:59." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use a date." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use a hostname or an IP address." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use a port from 1 to 65535." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use a private range: 10.x.x, 172.16–31.x or 192.168.x." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use an IPv4 address, like 192.168.1.10." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Use an IPv4 address, or leave it empty." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Use files" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Use the new address" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Use your own certificate" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Used by %s. Choose another port." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Used for HTTPS links" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Using a self-signed certificate: browsers will show a warning." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Using a self-signed certificate: browsers will show a warning. ACME can get a free Let’s Encrypt one." +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "VPN & tunnels" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "Versions" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "View all" +msgstr "" + +#: web/src/admin/device.ts +#: web/src/admin/ui/badges.ts +msgid "Waiting for the first connection" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Waiting for the router to restart its services (%s of 30)…" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Waiting for the router to restart its services…" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "Warn" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Warning must be 0-60 days." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +msgid "Warning: %s sent a file that does not match GitHub's sha256, discarded" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "Warning: could not keep %s: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +msgid "Warning: the installed build is no longer published, nothing to keep for rollback" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog off" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog on" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "Watchdog repairs" +msgstr "" + +#: web/src/admin/access.ts +msgid "Web" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "Weekly" +msgstr "" + +#: web/src/admin/device.ts +msgid "Went offline" +msgstr "" + +#: web/src/admin/pages/server.ts +#: web/src/admin/pages/settings/portal.ts +msgid "What people see" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access." +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/hero.ts +msgid "What’s new" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "What’s new in Dawnline %s" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "What’s new in the %s build" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "When" +msgstr "" + +#: web/src/admin/pages/settings/updates.ts +msgid "When GitHub is unreachable, download through mirrors. Checksums are still verified." +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "When access ends" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "When it ends: %s" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "When it ends: %s, warn %s day before" +msgid_plural "When it ends: %s, warn %s days before" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/logs.ts +msgid "Where" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes." +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Where devices reach AmneziaWG from the internet" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "Where devices reach this core from the internet" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "Where people connect from" +msgstr "" + +#: web/src/admin/logs.ts +msgid "Which events" +msgstr "" + +#: web/src/admin/access.ts +msgid "Who reaches what" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Whole home network" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "Whole home network. Pick services to narrow it down." +msgstr "" + +#: web/src/admin/access.ts +msgid "Why something does or does not connect" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never." +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "Working…" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Wrong links are sent there instead of a “Not found”." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "Wrong links get a bare “Not found”." +msgstr "" + +#: web/src/admin/events/render.ts +#: web/src/admin/places/model.ts +#: web/src/admin/widgets/spark.ts +msgid "Yesterday" +msgstr "" + +#: web/src/admin/pages/settings/backups.ts +msgid "Yesterday, %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You added circle %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You added device %s for %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You added person %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You changed circle %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You changed device %s of %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You changed person %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You changed server %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You changed the personal portal" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You cleared the activity log" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You cleared the service log" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You created server %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You exported all settings" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You imported settings from a file" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You issued a new link for person %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You issued new keys for device %s of %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You paused person %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You removed circle %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You removed device %s from %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You removed person %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You removed server %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You renamed device %s of %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You reset traffic history for %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You reset traffic history for everyone" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You restored a backup from a file" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You restored backup %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You resumed person %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You turned off device %s of %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned off server %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned off the personal portal" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned off the watchdog" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "You turned on device %s of %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned on server %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned on the personal portal" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "You turned on the watchdog" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Your WAN address now - it may change; a DDNS name is better." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access has ended." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access is paused." +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Your address" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Your files" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "Your own files" +msgstr "" + +#: web/src/admin/invite.ts +msgid "Your personal VPN link" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Your router has no public address (CGNAT)" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "Your router is behind another router (WAN %s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "Zone %s and the WAN rule for UDP %d exist." +msgstr "" + +#: web/src/admin/events/render.ts +msgid "a device" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "a new build needs a manual switch in Components" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "access" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "address %s" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "ahead of the latest release" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "all Cloudflare visitors" +msgstr "" + +#: web/src/admin/access.ts +msgid "all networks" +msgstr "" + +#: web/src/admin/access.ts +msgid "all ports" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "allowed hours" +msgstr "" + +#: web/src/admin/map.ts +msgid "an unknown city" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "another program on this router" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "answers again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "apk did not reinstall the version that is already installed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +msgid "apk doesn't reinstall an installed version. Install a different release, or run install.sh on the router" +msgstr "" + +#: web/src/admin/map.ts +msgid "approximate" +msgstr "" + +#: web/src/admin/map.ts +msgid "approximate location" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "are loaded again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "are missing" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "as soon as found" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "automatic update failed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "background check failed: %s" +msgstr "" + +#: web/src/shared/format.ts +msgid "bit/s" +msgstr "" + +#: web/src/admin/device.ts +msgid "by you" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "can't reach Dawnline (luci.dawnline is missing in rpcd)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "can't use the network interface %s: it exists and isn't Dawnline's" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "certificate" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate expires %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate expires within 7 days" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "certificate renewed · valid until %s" +msgstr "" + +#: web/src/admin/pages/components/index.ts +msgid "checked %s" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "checks daily" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "checks every 12 h" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "checks every 6 h" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "checks off" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "checks weekly" +msgstr "" + +#: web/src/admin/access.ts +msgid "circle" +msgstr "" + +#: web/src/admin/events/model.ts +msgctxt "setting" +msgid "circle" +msgstr "" + +#: web/src/admin/map.ts +msgid "click to zoom in" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "couldn't be repaired: %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "couldn't be updated - the previous rules stay, and changes to access wait until they load" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +msgid "couldn't load - no device is loaded into the tunnels until they do" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "couldn't load devices into the tunnel" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "couldn't start" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "couldn't start · %d failed attempts in %d min" +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "created %s by you." +msgstr "" + +#: web/src/admin/pages/person/devices.ts +msgid "created %s in the portal." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "daily at %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "data limit" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "data limit period" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "data limit reached" +msgstr "" + +#: web/src/admin/map.ts +msgid "device" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "device limit" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "devices kept apart" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "devices reach each other" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "devices reach each other in circles" +msgstr "" + +#: web/src/admin/access.ts +msgid "direct" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "disguise: %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "down" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "e.g. Myata" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "end date" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "end date reached" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "ended" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "ended %s" +msgstr "" + +#: web/src/shared/format.ts +msgid "ends in %s day" +msgid_plural "ends in %s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/shared/format.ts +msgid "ends today" +msgstr "" + +#: web/src/shared/format.ts +msgid "ends tomorrow" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "error" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "every app" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "extra data" +msgstr "" + +#: web/src/admin/updater/operation.ts +msgid "failed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "failed - internet goes out directly for now" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "failed: %s" +msgstr "" + +#: web/src/admin/device.ts +msgid "from the portal" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "h1-h4 must be distinct" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "has an invalid interface name \"%s\"" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "home" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "home network and internet path" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "home networks" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "home services" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "in total" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "includes +%s GB extra" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "info" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "install any release" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "installed the %s build" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "installed the %s build · %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "interface %s" +msgstr "" + +#: web/src/admin/access.ts +msgid "internet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down: its disguise needs AmneziaWG %s (installed: %s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is kept down: its disguise needs AmneziaWG %s (installed: none)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "is off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "is on · traffic enters %s as %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "is ready again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't answering on port %d" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "isn't installed: no tunnel can run - install it in Dawnline → Components" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc +msgid "isn't installed: tunnels were left as they are" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "isn't known to the network service - restart the network or reboot" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't running" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "isn't running on this router (fw4): tunnels and the portal are closed" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "it needs its new configuration" +msgstr "" + +#: web/src/shared/format.ts +msgid "just now" +msgstr "" + +#: web/src/shared/format.ts +msgid "kbit/s" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "keep access" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "kept in memory only (lost on reboot)" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "kept on flash" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "kernel module isn't installed: no tunnel can run - install it in Dawnline → Components" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "kernel module isn't loaded" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "last 15 min" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "last seen %s" +msgstr "" + +#: web/src/admin/pages/person/activity.ts +msgid "latest 10 of %s" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "latest release" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "leaves through %s" +msgstr "" + +#: web/src/admin/access.ts +msgid "like home" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "loading it" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "loading them again" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/packages.ts +msgid "missing %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "moved to %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +msgid "moved to word codes" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "name" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +msgid "netifd doesn't know the amneziawg protocol (AmneziaWG missing, or the network wasn't restarted after installing it)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed." +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "network changed - Dawnline set itself up again" +msgstr "" + +#: web/src/shared/format.ts +msgid "never" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "never connected" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "next in %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "nightly backup failed: %s" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "no address" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "no age limit" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +msgid "no circle" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "no end date" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "no firewall zone" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "no limit" +msgstr "" + +#: web/src/admin/pages/diagnostics/health.ts +msgid "no repairs today" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "no server" +msgstr "" + +#: web/src/admin/access.ts +msgid "nobody yet" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "none yet" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +#: web/src/admin/pages/components/index.ts +msgid "not checked yet" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +#: web/src/admin/pages/components/packages.ts +msgid "not installed" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "not set up" +msgstr "" + +#: web/src/admin/map.ts +#: web/src/admin/places/render.ts +msgid "now" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/limits.ts +msgid "of %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "older than %s day" +msgid_plural "older than %s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/device.ts +msgid "on the portal" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "online" +msgstr "" + +#: web/src/admin/pages/overview.ts +msgid "online for %s" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "online from %s" +msgstr "" + +#: web/src/admin/pages/person/header.ts +msgid "online now" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "other addresses" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "outside allowed hours" +msgstr "" + +#: web/src/admin/pages/person/pickers.ts +msgid "over the limit" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "pause" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "pause access" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "paused by admin" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "peak %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "port %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "port forward “%s”" +msgstr "" + +#: web/src/admin/access.ts +msgid "ports %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "problems are only logged, nothing is repaired" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "public address" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "public address changed · %s → %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "reaches Dawnline again" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "redirect" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "release %s" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "released %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "reloading rpcd" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "remove their devices" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "repair" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgid "resets on the 1st" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "restarted · version %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "restarting for the AmneziaWG update" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "restarting it" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "restoring them" +msgstr "" + +#: web/src/admin/cores/awg.ts +msgid "router %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline are in place again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline aren't loaded" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "rules for Dawnline were changed or removed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +msgid "runs again" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "saved to flash every 10 minutes" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "saved to flash hourly" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "seen %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "server" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "server turned off" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +msgid "server “%s”" +msgstr "" + +#: web/src/admin/access.ts +msgid "services" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "setting it up again" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +msgid "sha256 matches the release (%s…)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "started" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "started with the router · version %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "started · accepting connections on port %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "started · version %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/bin/dawnline +msgid "stopped unexpectedly" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "stopped unexpectedly - started again" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "the file holds private keys" +msgstr "" + +#: web/src/admin/interfaces.ts +msgid "the link is down" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "the old link stopped working" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +msgid "the router itself" +msgstr "" + +#: web/src/admin/pages/person/dialogs.ts +msgid "the server" +msgstr "" + +#: web/src/admin/access.ts +msgid "their networks" +msgstr "" + +#: web/src/admin/access.ts +msgid "their own" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/person/devices.ts +msgid "this month" +msgstr "" + +#: web/src/admin/pages/person/limits.ts +msgctxt "time range" +msgid "to" +msgstr "" + +#: web/src/admin/widgets/tiles.ts +msgid "today" +msgstr "" + +#: web/src/admin/pages/people.ts +msgid "today %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "tunnel network" +msgstr "" + +#: web/src/admin/pages/people.ts +#: web/src/admin/pages/settings/portal.ts +msgid "until %s" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "up" +msgstr "" + +#: web/src/admin/pages/server.ts +msgid "up %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "up to %s event" +msgid_plural "up to %s events" +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "update failed" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +msgid "update to %s failed its check - rolled back to %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated automatically · %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated automatically · %s → %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated · %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/agent +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updated · %s → %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/libexec/dawnline/updater +msgid "updates available · %s" +msgstr "" + +#: web/src/admin/pages/components/awg.ts +msgid "version not checked" +msgstr "" + +#: web/src/admin/pages/settings/portal.ts +msgid "vpn.example.com or an IP" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "warning before the end" +msgstr "" + +#: web/src/admin/events/render.ts +msgid "was %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +msgid "was broken - set up again (%s as %s)" +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "weekly at %s" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "what happens at the end" +msgstr "" + +#: web/src/admin/events/model.ts +msgid "with %s person" +msgid_plural "with %s people" +msgstr[0] "" +msgstr[1] "" + +#: web/src/admin/interfaces.ts +msgid "zone %s" +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "“%s” already exists - pick another name." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "“%s” is not a port (1–65535)." +msgstr "" + +#: web/src/admin/netcheck.ts +msgid "“%s” is not an IP address. Separate several with commas." +msgstr "" + +#: web/src/admin/pages/components/hero.ts +msgid "← Newer" +msgstr "" diff --git a/package/luci-app-dawnline/root/usr/bin/dawnline b/package/luci-app-dawnline/root/usr/bin/dawnline index a6529cc..026db4d 100755 --- a/package/luci-app-dawnline/root/usr/bin/dawnline +++ b/package/luci-app-dawnline/root/usr/bin/dawnline @@ -13,6 +13,7 @@ import * as watchdog from 'dawnline.watchdog'; import * as awg from 'dawnline.awg'; import * as store from 'dawnline.store'; import * as devices from 'dawnline.devices'; +import { L_ } from 'dawnline.i18n'; import { VERSION, slog, slog_read, sh_out, q, take_iface_intent, read_json, write_json, ensure_dir, with_lock, RUN_DIR } from 'dawnline.util'; @@ -139,7 +140,7 @@ function ifup_failed(ifname, who) { return out; }); if (r) - slog('awg', 'error', r.n > 1 ? `couldn't start · ${r.n} failed attempts in ${r.mins} min` : "couldn't start", + slog('awg', 'error', r.n > 1 ? sprintf(L_("couldn't start · %d failed attempts in %d min"), r.n, r.mins) : L_("couldn't start"), watchdog.iface_errors(ifname), who); } @@ -308,16 +309,16 @@ try { if (args[1] == 'ifup') { ifup_ok(ifname); let port = sh_out(`awg show ${q(ifname)} listen-port 2>/dev/null`); - slog('awg', 'up', port ? `started · accepting connections on port ${port}` : 'started', null, who); + slog('awg', 'up', port ? sprintf(L_('started · accepting connections on port %s'), port) : L_('started'), null, who); } else if (args[1] == 'ifdown') { // Stops Dawnline made itself are explained by the admin's own line // (changed, turned off, removed); only an AmneziaWG update gets one here. if (it?.reason == 'update') - slog('awg', 'info', 'restarting for the AmneziaWG update', null, who); + slog('awg', 'info', L_('restarting for the AmneziaWG update'), null, who); else if (!it) - slog('awg', 'down', 'stopped unexpectedly', join('\n', filter([ - "Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed.", + slog('awg', 'down', L_('stopped unexpectedly'), join('\n', filter([ + L_("Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed."), watchdog.iface_errors(ifname), ], (x) => x)), who); } diff --git a/package/luci-app-dawnline/root/usr/libexec/dawnline/agent b/package/luci-app-dawnline/root/usr/libexec/dawnline/agent index 48ec997..41a1765 100755 --- a/package/luci-app-dawnline/root/usr/libexec/dawnline/agent +++ b/package/luci-app-dawnline/root/usr/libexec/dawnline/agent @@ -26,6 +26,7 @@ import * as net from 'dawnline.net'; import * as store from 'dawnline.store'; import * as upd from 'dawnline.updates'; import * as awg from 'dawnline.awg'; +import { L_ } from 'dawnline.i18n'; const TICK = 60 * 1000; const WATCH = 1000; @@ -423,7 +424,7 @@ function check_cert(m) { let c = pc.portal_cert(m.settings); let mt = stat(c.cert)?.mtime; if (cert_mtime != null && mt != null && mt != cert_mtime) { - slog('portal', 'up', `certificate renewed · valid until ${cert_end(c.cert) ?? '?'}`, null, 'Personal portal'); + slog('portal', 'up', sprintf(L_('certificate renewed · valid until %s'), cert_end(c.cert) ?? '?'), null, L_('Personal portal')); system('/etc/init.d/dawnline reload >/dev/null 2>&1 &'); } cert_mtime = mt; @@ -432,8 +433,9 @@ function check_cert(m) { return; last_cert_check = time(); if (notes.cert_warned != mt && system(`openssl x509 -checkend 604800 -noout -in ${q(c.cert)} >/dev/null 2>&1`) != 0) { - slog('portal', 'error', `certificate expires ${cert_end(c.cert) ?? 'within 7 days'}`, - 'Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.', 'Personal portal'); + let end = cert_end(c.cert); + slog('portal', 'error', end ? sprintf(L_('certificate expires %s'), end) : L_('certificate expires within 7 days'), + L_('Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.'), L_('Personal portal')); note('cert_warned', mt); } } @@ -454,10 +456,13 @@ function check_wan(m) { return; let stuck = map(filter(values(m.servers), (x) => core.endpoint_host(m, x) == was), (x) => x.name); if (length(stuck)) - slog('dawnline', 'error', `public address changed · ${was} → ${ip}`, - `${join(', ', stuck)} still give${length(stuck) == 1 ? 's' : ''} devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.`, 'Router'); + slog('dawnline', 'error', sprintf(L_('public address changed · %s → %s'), was, ip), + sprintf(length(stuck) == 1 + ? L_('%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.') + : L_('%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.'), + join(', ', stuck)), L_('Router')); else - slog('dawnline', 'info', `public address changed · ${was} → ${ip}`, null, 'Router'); + slog('dawnline', 'info', sprintf(L_('public address changed · %s → %s'), was, ip), null, L_('Router')); } let last_backup_day = null; @@ -476,7 +481,7 @@ function nightly_backup() { } catch (e) { // Tried again tomorrow; meanwhile the admin should know (a full flash, mostly). - slog('dawnline', 'error', `nightly backup failed: ${e.message}`, null, 'Backup'); + slog('dawnline', 'error', sprintf(L_('nightly backup failed: %s'), e.message), null, L_('Backup')); } } } @@ -545,7 +550,7 @@ function check_network(t) { return; } pending_net = null; - slog('dawnline', 'info', 'network changed — Dawnline set itself up again', null, 'Router'); + slog('dawnline', 'info', L_('network changed - Dawnline set itself up again'), null, L_('Router')); apply.apply(); base_net = readfile(apply.NET_SIG) ?? apply.net_signature(core.load()); } @@ -561,33 +566,33 @@ const STEPS = [ t.m = core.load(); t.pol = live.policy(t.m.settings.retention); } }, - { who: 'Traffic', run: (t) => { + { who: L_('Traffic'), run: (t) => { t.reset = check_usage_reset(t.m); live.collect(t.m, usage, live.dump(t.m)); } }, - { who: 'Speed', quiet: true, run: (t) => record_rate(t.m) }, - { who: 'People', run: (t) => { + { who: L_('Speed'), quiet: true, run: (t) => record_rate(t.m) }, + { who: L_('People'), run: (t) => { t.states = apply.states_for(t.m, usage); check_people(t.m, t.states, t.events); check_expiry(t.m, t.events); } }, - { who: 'Access rules', run: (t) => { + { who: L_('Access rules'), run: (t) => { if (t.states) sync_runtime(t); } }, // Tunnels going down and up are in the service log (hotplug, watchdog), with names and reasons. - { who: 'Activity', run: (t) => { + { who: L_('Activity'), run: (t) => { live.add_events(t.events, t.pol); // Pauses and resumes on their own: the UI shows them without waiting for its next poll. if (length(t.events)) save_presence(uniq(map(filter(t.events, (e) => e.person), (e) => e.person))); } }, - { who: 'Internet like a home device', run: (t) => apply.sync_loop(t.m, usage) }, - { who: 'Router', run: check_network }, - { who: 'Watchdog', run: (t) => watchdog.run(core.load()) }, - { who: 'Personal portal', run: (t) => check_cert(t.m) }, - { who: 'Router', quiet: true, run: (t) => check_wan(t.m) }, - { who: 'Backup', run: (t) => nightly_backup() }, + { who: L_('Internet like a home device'), run: (t) => apply.sync_loop(t.m, usage) }, + { who: L_('Router'), run: check_network }, + { who: L_('Watchdog'), run: (t) => watchdog.run(core.load()) }, + { who: L_('Personal portal'), run: (t) => check_cert(t.m) }, + { who: L_('Router'), quiet: true, run: (t) => check_wan(t.m) }, + { who: L_('Backup'), run: (t) => nightly_backup() }, { who: 'updates', quiet: true, run: (t) => check_updates(t.m) }, { who: 'geo', quiet: true, run: (t) => check_geo(t.m) }, ]; @@ -603,7 +608,7 @@ function step(i, s, fn) { catch (e) { system(`logger -t dawnline-agent ${q(`${s.who}: ${e.message}`)}`); if (!s.quiet && step_err[i] != e.message) - slog('dawnline', 'error', `failed: ${e.message}`, e.stacktrace?.[0]?.context, s.who); + slog('dawnline', 'error', sprintf(L_('failed: %s'), e.message), e.stacktrace?.[0]?.context, s.who); step_err[i] = e.message; } } @@ -625,7 +630,7 @@ function tick() { step(i, s, () => s.run(t)); let persist = t.reset || time() - last_flush >= FLUSH_EVERY; - step('save', { who: 'Traffic' }, () => { + step('save', { who: L_('Traffic') }, () => { live.save_usage(usage, persist); if (persist) { last_flush = time(); @@ -633,7 +638,7 @@ function tick() { } }); step('slog', { who: 'Dawnline', quiet: true }, () => slog_trim(persist)); - step('events', { who: 'Activity' }, () => { + step('events', { who: L_('Activity') }, () => { let pol = t.pol ?? live.policy(); if (pol.persist == 'off' || time() - last_log_flush >= LOG_FLUSH[pol.persist]) { live.persist_events(pol); @@ -667,20 +672,20 @@ slog_restore(); let rolled = trim(readfile(`${RUN_DIR}/update-rolled-back`) ?? ''); unlink(`${RUN_DIR}/update-rolled-back`); if (rolled) - slog('dawnline', 'error', `update to ${rolled} failed its check — rolled back to ${VERSION}`, - 'The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.', 'Dawnline'); + slog('dawnline', 'error', sprintf(L_('update to %s failed its check - rolled back to %s'), rolled, VERSION), + L_('The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.'), 'Dawnline'); else if (was && was != VERSION) - slog('dawnline', 'up', `updated · ${was} → ${VERSION}`, null, 'Dawnline'); + slog('dawnline', 'up', sprintf(L_('updated · %s → %s'), was, VERSION), null, 'Dawnline'); else if (crashed) - slog('dawnline', 'repair', 'stopped unexpectedly — started again', + slog('dawnline', 'repair', L_('stopped unexpectedly - started again'), // Why, when syslog knows: procd, the kernel (out of memory, segfault), ucode errors. sh_out('logread -l 400 2>/dev/null | grep -iE "kernel:.*(out of memory|killed process|oom-kill|segfault)|procd:.*dawnline|dawnline/agent" | tail -n 6'), 'Dawnline'); else if (stopped && time() - stopped < 300) - slog('dawnline', 'info', `restarted · version ${VERSION}`, null, 'Dawnline'); + slog('dawnline', 'info', sprintf(L_('restarted · version %s'), VERSION), null, 'Dawnline'); else if (live.uptime() < 600) - slog('dawnline', 'info', `started with the router · version ${VERSION}`, null, 'Dawnline'); + slog('dawnline', 'info', sprintf(L_('started with the router · version %s'), VERSION), null, 'Dawnline'); else - slog('dawnline', 'info', `started · version ${VERSION}`, null, 'Dawnline'); + slog('dawnline', 'info', sprintf(L_('started · version %s'), VERSION), null, 'Dawnline'); uloop.init(); @@ -690,14 +695,14 @@ timer = uloop.timer(1000, function() { tick(); } catch (e) { - slog('dawnline', 'error', `background check failed: ${e.message}`, e.stacktrace?.[0]?.context, 'Dawnline'); + slog('dawnline', 'error', sprintf(L_('background check failed: %s'), e.message), e.stacktrace?.[0]?.context, 'Dawnline'); } timer.set(TICK); }); let watcher; watcher = uloop.timer(WATCH, function() { - step('watch', { who: 'Connections' }, watch); + step('watch', { who: L_('Connections') }, watch); watcher.set(WATCH); }); diff --git a/package/luci-app-dawnline/root/usr/libexec/dawnline/postupdate b/package/luci-app-dawnline/root/usr/libexec/dawnline/postupdate index 71533ff..8c06693 100755 --- a/package/luci-app-dawnline/root/usr/libexec/dawnline/postupdate +++ b/package/luci-app-dawnline/root/usr/libexec/dawnline/postupdate @@ -12,6 +12,9 @@ KEEP=/etc/dawnline/keep/app to="${1:-?}" sleep 2 +# LuCI reads a language's catalogs once per web server: a replaced translation +# needs a fresh one, before the new version answers and the page reloads. +ls /usr/lib/lua/luci/i18n/dawnline.*.lmo >/dev/null 2>&1 && /etc/init.d/uhttpd restart >/dev/null 2>&1 /etc/init.d/rpcd reload >/dev/null 2>&1 /etc/init.d/dawnline restart >/dev/null 2>&1 diff --git a/package/luci-app-dawnline/root/usr/libexec/dawnline/updater b/package/luci-app-dawnline/root/usr/libexec/dawnline/updater index e9ec1e8..43b4b88 100755 --- a/package/luci-app-dawnline/root/usr/libexec/dawnline/updater +++ b/package/luci-app-dawnline/root/usr/libexec/dawnline/updater @@ -21,12 +21,18 @@ import * as upd from 'dawnline.updates'; import * as app from 'dawnline.upd_app'; import * as awg from 'dawnline.upd_awg'; import * as pkgs from 'dawnline.upd_pkgs'; +import * as i18n from 'dawnline.i18n'; +import { _, L_ } from 'dawnline.i18n'; + +// The phases and errors of a job LuCI started are in the admin's language (rpc/updates.uc hands it over). +i18n.use(getenv('DAWNLINE_LANG')); const PID = +split(fs.readfile('/proc/self/stat') ?? '0', ' ')[0]; const POL = core.load().settings.updates; const CHECKS = { app: app.check, amneziawg: awg.check, packages: pkgs.check }; const INSTALLS = { app: app.install, amneziawg: awg.install, pkgs: pkgs.install }; -const WHO = { app: 'Dawnline', amneziawg: 'AmneziaWG', pkgs: 'System packages', packages: 'System packages' }; +// Names in the service log (English there, like the rest of it); the phases are checking() and updating(). +const WHO = { app: 'Dawnline', amneziawg: 'AmneziaWG', pkgs: L_('System packages'), packages: L_('System packages') }; let job = { id: `${time()}-${PID}`, action: ARGV[0], component: ARGV[1] ?? null, state: 'running', started: time(), finished: null, @@ -82,6 +88,24 @@ const ctx = { after: (what) => after[what] = true, }; +/** The phase of a component's check (app, amneziawg, packages). */ +function checking(name) { + if (name == 'app') + return _('Checking Dawnline'); + if (name == 'amneziawg') + return _('Checking AmneziaWG'); + return _('Checking system packages'); +} + +/** The phase of a component's update (app, amneziawg, pkgs). */ +function updating(name) { + if (name == 'app') + return _('Updating Dawnline'); + if (name == 'amneziawg') + return _('Updating AmneziaWG'); + return _('Updating system packages'); +} + /* ---------- check results ---------- */ function checks_file() { @@ -98,7 +122,10 @@ function save_check(res) { write_json(upd.CHECK_FILE, c, 0o644); } -/** What a check found, as short names ("Dawnline 0.3.3", "2 system packages"). */ +/** + * What a check found, as short names ("Dawnline 0.3.3", "2 system packages"): + * kept in the history and shown later, so English whatever the job's language. + */ function found_in(res) { let found = []; if (res.app?.update) @@ -106,19 +133,19 @@ function found_in(res) { if (res.amneziawg?.update && res.amneziawg.installed) push(found, `AmneziaWG ${res.amneziawg.latest}`); if (res.packages?.updates) - push(found, `${res.packages.updates} system package${res.packages.updates == 1 ? '' : 's'}`); + push(found, sprintf(res.packages.updates == 1 ? L_('%d system package') : L_('%d system packages'), res.packages.updates)); return found; } function run_checks(which) { let res = {}; for (let name in which) { - phase(`Checking ${WHO[name]}`); + phase(checking(name)); try { res[name] = CHECKS[name](ctx); } catch (e) { - log(`Error: ${e.message}`); + log(sprintf(_('Error: %s'), e.message)); res[name] = { error: e.message, status: '' }; } } @@ -132,7 +159,7 @@ function note_found(res, st, auto) { let sig = join(', ', found); if (length(found) && sig != st.announced) { if (auto) - slog('dawnline', 'info', `updates available · ${sig}`, null, 'Components'); + slog('dawnline', 'info', sprintf(L_('updates available · %s'), sig), null, L_('Components')); upd.history_add({ kind: 'found', items: found, auto }); } st.announced = sig; @@ -142,14 +169,14 @@ function note_found(res, st, auto) { /** A line in the service log for each finished update (Dawnline's own is logged by the new agent). */ function log_update(name, r) { - let how = job.auto ? ' automatically' : ''; if (name == 'amneziawg') { let b = r?.before?.['kmod-amneziawg'], a = r?.after?.['kmod-amneziawg']; - slog('awg', 'up', b && a && b != a ? `updated${how} · ${b} → ${a}` - : `installed the ${r?.build ?? ''} build${a ? ' · ' + a : ''}`, null, 'AmneziaWG'); + slog('awg', 'up', b && a && b != a ? sprintf(job.auto ? L_('updated automatically · %s → %s') : L_('updated · %s → %s'), b, a) + : a ? sprintf(L_('installed the %s build · %s'), r?.build ?? '', a) : sprintf(L_('installed the %s build'), r?.build ?? ''), null, 'AmneziaWG'); } else if (name == 'pkgs' && length([ ...(r?.updated ?? []), ...(r?.installed ?? []) ])) - slog('dawnline', 'up', `updated${how} · ${join(', ', [ ...(r.updated ?? []), ...(r.installed ?? []) ])}`, null, 'System packages'); + slog('dawnline', 'up', sprintf(job.auto ? L_('updated automatically · %s') : L_('updated · %s'), + join(', ', [ ...(r.updated ?? []), ...(r.installed ?? []) ])), null, L_('System packages')); } function split_target(w) { @@ -172,9 +199,9 @@ function install(what) { for (let w in what) { let t = split_target(w), name = t[0], arg = t[1]; if (!INSTALLS[name]) - die(`Unknown component ${name}`); + die(sprintf(_('Unknown component %s'), name)); job.current = name; - phase(`Updating ${WHO[name]}`); + phase(updating(name)); let r = INSTALLS[name](ctx, arg); job.result[name] = r; log_update(name, r); @@ -228,7 +255,7 @@ function auto() { if (a.current && !a.gen_change) push(todo, `amneziawg:${a.current}${a.ru ? ':ru' : ''}`); else - slog('awg', 'info', `${a.latest ?? 'a new build'} needs a manual switch in Components`, null, 'AmneziaWG'); + slog('awg', 'info', a.latest ? sprintf(L_('%s needs a manual switch in Components'), a.latest) : L_('a new build needs a manual switch in Components'), null, 'AmneziaWG'); } if (index(POL.targets, 'app') >= 0 && res.app?.update) push(todo, 'app'); @@ -239,7 +266,7 @@ function auto() { job.component = join(' ', todo); job.auto = true; job.log = []; - log(`Automatic update: ${join(', ', todo)}`); + log(sprintf(_('Automatic update: %s'), join(', ', todo))); install(todo); } @@ -257,7 +284,8 @@ function restarts() { let cmds = []; if (after.apply) push(cmds, '/usr/bin/dawnline apply'); - if (after.uhttpd) + // LuCI's own web server reads a language's catalogs once: a new translation needs a fresh one. + if (after.uhttpd || after.luci) push(cmds, '/etc/init.d/uhttpd restart'); if (after.apply || after.uhttpd) push(cmds, '/etc/init.d/dawnline restart'); @@ -265,6 +293,46 @@ function restarts() { system(`( sleep 2; ${join('; ', cmds)} ) /dev/null 2>&1 &`); } +/** The job the command line asks for, to its final state: done, or failed with the error in the log and the history. */ +function main() { + try { + if (job.action == 'check') { + let which = job.component ? [ job.component ] : upd.TARGETS; + for (let w in which) + if (!CHECKS[w]) + die(sprintf(_('Unknown component %s'), w)); + job.result = run_checks(which); + let st = upd.auto_state(); + note_found(job.result, st, false); + if (length(which) == length(upd.TARGETS)) + st.check = time(); + upd.auto_save(st); + } + else if (job.action == 'install') + install([ job.component ]); + else if (job.action == 'auto') + auto(); + else + die('Usage: updater check [app|amneziawg|packages] | install | auto'); + job.state = 'done'; + phase(_('Finished')); + } + catch (e) { + quiet = false; + job.state = 'failed'; + job.error = e.message; + log(sprintf(_('Error: %s'), e.message)); + let name = job.current ?? split_target(split(job.component ?? '', ' ')[0])[0]; + if (job.action != 'check') { + slog(name == 'amneziawg' ? 'awg' : 'dawnline', 'error', job.auto ? L_('automatic update failed') : L_('update failed'), e.message, WHO[name] ?? 'Dawnline'); + upd.history_add({ kind: 'install', component: name, from: job.from, to: job.to, state: 'failed', auto: job.auto, error: e.message, + took: time() - job.started }); + } + else + upd.history_add({ kind: 'error', component: job.component ?? 'all', state: 'failed', error: e.message }); + } +} + /* ---------- main ---------- */ ensure_dir(RUN_DIR); @@ -279,43 +347,7 @@ if (!LOCK) exit(0); fs.mkdir(ctx.work, 0o700); save(); - -try { - if (job.action == 'check') { - let which = job.component ? [ job.component ] : upd.TARGETS; - for (let w in which) - if (!CHECKS[w]) - die(`Unknown component ${w}`); - job.result = run_checks(which); - let st = upd.auto_state(); - note_found(job.result, st, false); - if (length(which) == length(upd.TARGETS)) - st.check = time(); - upd.auto_save(st); - } - else if (job.action == 'install') - install([ job.component ]); - else if (job.action == 'auto') - auto(); - else - die('Usage: updater check [app|amneziawg|packages] | install | auto'); - job.state = 'done'; - phase('Finished'); -} -catch (e) { - quiet = false; - job.state = 'failed'; - job.error = e.message; - log(`Error: ${e.message}`); - let name = job.current ?? split_target(split(job.component ?? '', ' ')[0])[0]; - if (job.action != 'check') { - slog(name == 'amneziawg' ? 'awg' : 'dawnline', 'error', `${job.auto ? 'automatic ' : ''}update failed`, e.message, WHO[name] ?? 'Dawnline'); - upd.history_add({ kind: 'install', component: name, from: job.from, to: job.to, state: 'failed', auto: job.auto, error: e.message, - took: time() - job.started }); - } - else - upd.history_add({ kind: 'error', component: job.component ?? 'all', state: 'failed', error: e.message }); -} +main(); system(`rm -rf '${ctx.work}'`); job.finished = time(); diff --git a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css index bd7c462..906d4b4 100644 --- a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css +++ b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css @@ -1 +1 @@ -@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.knob:active{transform:scale(.8)}.knob .i{width:16px;height:16px}.knob.back .i{transform:rotate(180deg)}.knob[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.btn{height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 20px;font-size:16px;font-weight:500;letter-spacing:-.015em;user-select:none;-webkit-user-select:none;transition:transform .2s var(--ease-out),background-color .2s var(--ease-out),color .2s var(--ease-out)}.btn:active{transform:scale(.95)}.btn.block{width:100%}.btn.sm{height:40px;font-size:15px;padding:0 16px}.btn.accent{background:var(--accent);color:var(--accent-ink);font-weight:600}.btn.accent:hover{background:color-mix(in srgb,var(--accent) 82%,transparent)}.btn.tint{background:var(--accent-soft);color:var(--accent);font-weight:600}.btn.tint:hover{background:color-mix(in srgb,var(--accent) 20%,transparent)}.btn.tint:active{background:color-mix(in srgb,var(--accent) 24%,transparent)}.btn.soft{background:var(--knob);color:var(--text)}.btn.soft:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.btn.red{background:var(--bad);color:#fff;font-weight:600}.busy{position:relative}.orb{position:absolute;inset:0;margin:auto;width:28px;height:28px;overflow:hidden;contain:strict;pointer-events:none}.orb i{position:absolute;left:50%;top:50%;width:7px;height:7px;margin:-3.5px 0 0 -3.5px;border-radius:50%;background:currentColor;animation:orb-converge 1.8s linear infinite both}.orb i:nth-child(2){animation:orb-breathe 1.8s ease-in-out infinite both}@keyframes orb-converge{0%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:linear}10%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}22%{transform:translate(2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}33%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}43%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}55%{transform:translateY(2.5px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}66%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}77%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}88%{transform:translate(-2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}to{transform:translateY(-5px) scale(1);filter:blur(0)}}@keyframes orb-breathe{0%,to{opacity:.16;filter:blur(2.4px);transform:scale(1.2)}50%{opacity:.32;filter:blur(1.6px);transform:scale(.98)}}.field{height:48px;border-radius:var(--r-field);background:var(--field);display:flex;align-items:center;gap:12px;padding:0 4px 0 16px;overflow:hidden;transition:box-shadow .2s var(--ease-out)}.field:focus-within{box-shadow:inset 0 0 0 1.5px color-mix(in srgb,var(--text) 16%,transparent)}.field input{flex:1;min-width:0;border:0;outline:0;background:transparent;padding:0;font:500 16px/24px var(--font);color:var(--text);letter-spacing:-.012em}.field input::placeholder{color:var(--text-3)}.go{width:48px;height:40px;border-radius:12px;background:var(--knob);color:var(--text-3);display:grid;place-items:center;flex:none;transition:background-color .2s var(--ease-out),color .2s var(--ease-out),transform .2s var(--ease-out)}.go .i{width:20px;height:20px}.go.ready{background:var(--accent);color:var(--accent-ink)}.go.ready:active{transform:scale(.9)}.go:not(.ready){cursor:not-allowed}.seg{position:relative;display:flex;align-items:center;height:48px;padding:0 4px;border-radius:var(--r-field);background:var(--field)}.seg-pill{position:absolute;left:0;top:4px;height:40px;border-radius:12px;background:var(--seg);box-shadow:var(--seg-shadow);pointer-events:none}.seg-b{position:relative;z-index:1;height:40px;font-size:16px;font-weight:500;color:var(--text-3);white-space:nowrap;transition:color .2s var(--ease-out)}.seg-b.on{color:var(--text)}.seg-b:not(.on):hover{color:var(--text-2)}.appseg .seg-b{flex:0 0 56px;display:flex;align-items:center;justify-content:center;justify-content:safe center;gap:8px;padding:0 18px;overflow:hidden}.appseg .seg-b.on{flex:1 1 56px}.appseg .seg-b .i{width:20px;height:20px}.appseg .seg-l{max-width:0;opacity:0;margin-left:-8px;overflow:hidden;white-space:nowrap}.appseg .seg-b.on .seg-l{max-width:180px;opacity:1;margin-left:0}.appseg{container-type:inline-size}@container (max-width: 300px){.appseg .seg-b{flex-basis:44px;padding:0 12px}}.kinds{display:grid;grid-template-columns:repeat(var(--n, 4),minmax(0,1fr));gap:8px;position:relative;container-type:inline-size}.kind{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;color:var(--text-3);font-size:12px;line-height:16px;font-weight:500;transition:color .2s var(--ease-out)}.kind-tile{width:100%;height:56px;border-radius:14px;background:var(--field);display:grid;place-items:center;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out),box-shadow .22s var(--ease-out)}.kind.on .kind-tile{box-shadow:inset 0 0 0 1.5px var(--accent)}.kind-lbl{white-space:nowrap}.kind:hover .kind-tile,.kind:focus-visible .kind-tile{background:var(--knob)}.kind:active .kind-tile{transform:scale(.94)}.kind:focus-visible{outline:none}.kind:focus-visible .kind-lbl,.kind.on{color:var(--text)}.kind .gi{width:26px;height:26px;filter:grayscale(1);opacity:.55;transition:filter .26s var(--ease-out),opacity .26s var(--ease-out)}.kind.on .gi{filter:none;opacity:1}@container (max-width: 330px){.kind-tile{height:50px}.kind{font-size:11.5px}}.or{display:flex;align-items:center;gap:12px;margin:22px 0;color:var(--text-3);font-size:12px;font-weight:500;letter-spacing:.06em}.or:before,.or:after{content:"";flex:1;height:1px;background:var(--line)}.badge{width:100%;text-align:left;display:flex;align-items:center;gap:12px;height:60px;padding:0 14px 0 12px;border-radius:18px;background:var(--field);transition:background-color .2s,transform .2s var(--ease-out)}.badge:hover{background:var(--knob)}.badge:active{transform:scale(.98)}.badge .b-ic{width:36px;height:36px;border-radius:10px;background:var(--text);color:var(--raised);display:grid;place-items:center;flex:none}.badge .b-ic .i{width:20px;height:20px}.badge .b-t{flex:1;min-width:0;display:flex;flex-direction:column}.badge .b-top{font-size:12px;line-height:16px;color:var(--text-2)}.badge .b-main{font-size:15px;line-height:20px;font-weight:500}.badge>.i{color:var(--text-3);width:16px;height:16px}.badge.primary .b-ic{background:var(--accent-soft);color:var(--accent)}.badges2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.badges2 .badge{padding:0 10px;gap:10px}.badges2 .badge>.i{display:none}.badges2 .b-ic{width:32px;height:32px}.hint{margin:0;font-size:13px;line-height:18px;color:var(--text-2)}.hint a,.hint button{color:var(--accent);font-weight:500}.howto{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;color:var(--text-2)}.howto li{display:inline-flex;align-items:center;gap:6px}.howto li+li:before{content:"\203a";color:var(--text-3)}.howto b{color:var(--text);font-weight:500}.linkrow{display:flex;align-items:center;gap:8px;height:44px;padding:0 4px 0 14px;border-radius:14px;background:color-mix(in srgb,var(--knob) 72%,var(--field))}.view>.linkrow{background:var(--field)}.linkrow .mono{flex:1;min-width:0;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:all}.linkrow .knob{width:36px;height:36px;border-radius:10px;background:transparent}.linkrow .knob:hover{background:var(--knob)}.qrbox{position:relative;width:148px;height:148px;flex:none;border-radius:18px;overflow:hidden;background:var(--qr-bg)}.qrbox.light{box-shadow:inset 0 0 0 1px var(--line)}.qrbox.big{width:208px;height:208px;border-radius:24px;align-self:center}.qrbox.big+.linkrow{margin-top:16px}.qrbox.dense{width:100%;max-width:none;height:auto;aspect-ratio:1;align-self:stretch;border-radius:22px}.qrbox svg{display:block;width:100%;height:100%}.qrbox>svg.old{position:absolute;inset:0}.coderow{display:flex;gap:14px;align-items:flex-start}.coderow.stacked{flex-direction:column;align-items:stretch}.coderow .side{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;font-size:14px;line-height:20px;color:var(--text-2)}.coderow .side b{color:var(--text);font-weight:500}.side .words{display:flex;flex-direction:column;gap:8px}.side .words.old{position:absolute;left:0;right:0;top:0;pointer-events:none}.side .arr{color:var(--text-2);font-weight:400;margin:0 6px}@media(max-width:380px){.coderow{flex-direction:column}}@media(prefers-reduced-motion:reduce){.orb i{animation:none;opacity:.3;filter:blur(1.4px)}.orb i:first-child{opacity:1;filter:none}}.mt{position:relative}.mt-ib{display:inline-block;white-space:nowrap}.mt-new{white-space:nowrap}.mt-old{position:absolute;white-space:nowrap;pointer-events:none}.mt-new.w,.mt-old.w{white-space:inherit}.mt-new i,.mt-old i{font-style:normal;display:inline-block;white-space:pre}.acc{display:flex;flex-direction:column}.acc-row{background:var(--raised);overflow:hidden;border-radius:0;padding:0 8px;transition:background-color .15s}.acc-row.rt{border-top-left-radius:var(--r-row);border-top-right-radius:var(--r-row)}.acc-row.rb{border-bottom-left-radius:var(--r-row);border-bottom-right-radius:var(--r-row)}.acc-row.open{margin-block:10px}.acc-row.open:first-child{margin-top:0}.acc-row.open:last-child{margin-bottom:0}.acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--raised),var(--knob) 40%)}.acc-head{width:100%;display:flex;align-items:center;gap:10px;height:52px;padding:0 6px 0 8px;text-align:left}.acc-row.still .acc-head{cursor:default;padding-right:10px}.acc-head .gi{width:22px;height:22px}.acc-title{flex:1;min-width:0;font-size:15px;font-weight:500;letter-spacing:-.02em;display:flex;align-items:center;gap:8px}.acc-title .t{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.acc-val{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:14px;white-space:nowrap;transition:opacity .2s var(--ease-out),filter .2s var(--ease-out),transform .26s var(--ease-out)}.acc-val>span{display:inline-flex;align-items:center;gap:8px}.acc-row.open .acc-val.hide-open{opacity:0;filter:blur(4px);transform:translate(8px);pointer-events:none}.acc-chev{width:16px;height:16px;color:var(--text-2);transform:rotate(90deg);transition:transform var(--spring-soft-dur, .47s) var(--spring-soft, ease)}.acc-row.open .acc-chev{transform:rotate(-90deg)}.acc-body{display:none;padding:0 8px 16px 40px}.acc-row.open .acc-body,.acc-row.closing .acc-body{display:flex;flex-direction:column;gap:12px}.acc .desc{margin:0;font-size:14px;line-height:20px;opacity:.6}.acc.inset .acc-row{background:var(--field)}.acc.inset .acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--field),var(--knob) 50%)}.acc.inset .acc-body{padding-left:8px}.acc.inset .seg{background:color-mix(in srgb,var(--knob) 65%,var(--field))}@media(prefers-reduced-motion:reduce){.acc-chev{transition:none}}.edge-fade{position:fixed;left:0;right:0;z-index:30;pointer-events:none}.edge-fade.top{top:0;height:calc(80px + env(safe-area-inset-top,0px));opacity:0;transition:opacity .2s;background:linear-gradient(var(--bg) 0%,color-mix(in srgb,var(--bg) 75%,transparent) 50%,transparent 100%);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);-webkit-mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%);mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%)}body.scrolled .edge-fade.top{opacity:1}.edge-fade.bot{bottom:0;height:calc(96px + env(safe-area-inset-bottom,0px));background:linear-gradient(to top in oklab,var(--bg) 0%,transparent 100%)}.crumbs{display:flex;align-items:center;gap:10px;height:32px;margin:0 0 32px}.cr-mark{width:32px;height:32px;display:grid;place-items:center;flex:none}.logo{width:24px;height:24px;flex:none;overflow:hidden}.logo .sun,.logo .bar{fill:var(--text)}.cr-path{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:15px;line-height:22px;letter-spacing:-.15px;color:var(--text-2)}.cr-path span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cr-path .cur{color:var(--text);font-weight:500}.cr-path .i{width:14px;height:14px}.page{max-width:1072px;margin:0 auto;padding-left:var(--gutter-l);padding-right:var(--gutter-r);padding-block:calc(40px + env(safe-area-inset-top,0px)) 112px}.cols{display:grid;gap:40px}.cols>.access{order:-1}@media(min-width:960px){.cols{grid-template-columns:minmax(0,1fr) 384px;gap:36px;align-items:start}.cols>.access{order:0;position:sticky;top:calc(84px + env(safe-area-inset-top,0px))}}.sec-head{display:flex;align-items:baseline;gap:8px;padding:0 4px 12px}.sec-head h2{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.025em}.sec-head .aside{color:var(--text-3);font-size:14px;font-weight:500}.sec-head .aside.warn-t{color:var(--warn)}.note-s{margin:12px 4px 0;color:var(--text-3);font-size:13px;line-height:18px}.notice{display:flex;align-items:center;gap:14px;padding:14px 18px 14px 14px;border-radius:24px;background:var(--raised);margin:0 0 22px}.notice .gi{width:36px;height:36px}.notice .t{display:flex;flex-direction:column;min-width:0}.notice b{font-weight:500;font-size:15px;line-height:22px;letter-spacing:-.02em}.notice span{color:var(--text-2);font-size:14px;line-height:20px}.notice.warn{background:color-mix(in srgb,var(--warn) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 22%,transparent)}.notice.bad{background:color-mix(in srgb,var(--bad) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bad) 22%,transparent)}.page.single{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-block:calc(24px + env(safe-area-inset-top,0px)) calc(24px + env(safe-area-inset-bottom,0px))}.page.single .crumbs{position:relative;left:12px;max-width:calc(100% - 84px);margin:0 0 16px}.page.single .cr-mark{position:absolute;right:calc(100% + 10px);top:0}.page.single .page-body{width:100%;max-width:400px}.page.single .gone{margin:0}.gone{max-width:400px;margin:12vh auto 0;padding:32px 24px 28px;border-radius:var(--r-sheet);background:var(--raised);text-align:center;display:flex;flex-direction:column;align-items:center}.gone .gi{width:56px;height:56px;margin-bottom:16px}.gone h1{margin:0;font-size:22px;line-height:28px;font-weight:500;letter-spacing:-.03em}.gone p{margin:6px 0 0;color:var(--text-2);text-wrap:balance}.dgrid{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}@media(min-width:560px){.dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}.dev{background:var(--raised);border-radius:var(--r-card);padding:8px;display:flex;flex-direction:column;gap:8px;min-width:0}.dev.is-here{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 32%,transparent)}.dev.off{opacity:.5}.dev-top{display:flex;align-items:center;gap:12px;padding:8px 6px 6px 10px}.dev-top .gi{width:32px;height:32px}.dev-id{flex:1;min-width:0;display:flex;flex-direction:column}.dev-name{font-size:16px;line-height:22px;font-weight:500;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat.ok-t{color:var(--ok)}.dev-stat.warn-t{color:var(--warn)}.dev-stat.here-t{color:var(--accent)}.dev-use{margin-top:auto;background:var(--field);border-radius:var(--r-row);padding:12px 14px 12px 16px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px;min-height:66px}.use-txt{display:flex;flex-direction:column;min-width:0}.use-lbl{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap}.use-val{font-size:17px;line-height:24px;font-weight:500;letter-spacing:-.02em}.spark{display:flex;align-items:flex-end;gap:4px;height:34px}.spark i{width:6px;border-radius:3px;background:var(--bar);transition:background-color .15s}.spark i.today{background:var(--accent)}.spark i:hover{background:var(--text-2)}.spark i.today:hover{background:color-mix(in srgb,var(--accent) 75%,var(--text))}.dev .setup-btn{margin-top:auto}.upd-pill{display:inline-flex;align-items:center;align-self:center;gap:6px;height:32px;padding:0 12px 0 10px;border-radius:999px;flex:none;background:color-mix(in srgb,var(--warn) 14%,transparent);color:var(--warn);font-size:13px;font-weight:600;transition:background-color .15s,transform .15s var(--ease-out)}.upd-pill:hover{background:color-mix(in srgb,var(--warn) 22%,transparent)}.upd-pill:active{transform:scale(.94)}.upd-pill .i{width:14px;height:14px}.dev.add{align-items:center;justify-content:center;min-height:144px;gap:10px;color:var(--text-2);font-weight:500;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out)}.dev.add:hover{background:color-mix(in srgb,var(--raised),var(--knob) 45%)}.dev.add:active{transform:scale(.98)}.dev.add .gi{width:36px;height:36px}.dev.first{grid-column:1 / -1;align-items:center;text-align:center;padding:28px 24px 24px;gap:6px}.dev.first .gi{width:44px;height:44px;margin-bottom:8px}.dev.first b{font-size:18px;line-height:24px;font-weight:500;letter-spacing:-.02em}.dev.first p{margin:0 0 14px;color:var(--text-2);font-size:14px;line-height:20px;max-width:34ch;text-wrap:balance}.dev.first .btn{max-width:320px}.reach2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.reach-tile{position:relative;display:flex;flex-direction:column;gap:1px;padding:12px 12px 12px 14px;border-radius:16px;background:var(--field);min-width:0}.reach-tile .rt-ic{width:28px;height:28px;margin-bottom:10px}.reach-tile b{font-size:14px;line-height:20px;font-weight:500;letter-spacing:-.015em}.reach-tile .rt-sub{font-size:12px;line-height:16px;color:var(--text-2)}.reach-tile .rt-mark{position:absolute;top:12px;right:12px;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--ok-soft);color:var(--ok)}.reach-tile .rt-mark .i{width:12px;height:12px;stroke-width:2.4}.reach-tile.off b{color:var(--text-2)}.reach-tile.off .rt-sub{color:var(--text-3)}.reach-tile.off .rt-ic{opacity:.45}.reach-tile.off .rt-mark{background:var(--knob);color:var(--text-3)}.lbl-s{font-size:12px;font-weight:500;color:var(--text-2)}.names{display:flex;flex-wrap:wrap;gap:6px}.namechip{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px 0 12px;border-radius:10px;background:var(--field);font-family:var(--mono);font-size:13px;letter-spacing:0;transition:background-color .15s,transform .15s var(--ease-out)}.namechip:hover{background:var(--knob)}.namechip:active{transform:scale(.96)}.namechip .faint{color:var(--text-3)}.namechip .i{width:14px;height:14px;color:var(--text-2)}.ring{width:16px;height:16px;transform:rotate(-90deg)}.ring .trk{stroke:var(--bar)}.ring .arc{stroke:var(--accent)}.ring .arc.warn{stroke:var(--warn)}.ring .arc.bad{stroke:var(--bad)}.month{display:flex;flex-direction:column;gap:8px}.mbars{display:flex;align-items:flex-end;gap:3px;height:64px}.mbars i{flex:1;border-radius:2.5px;background:var(--bar);min-height:3px;transition:background-color .12s}.mbars i.future{background:color-mix(in srgb,var(--bar) 45%,transparent)}.mbars i.today{background:var(--accent)}.mbars i:not(.future):hover{background:var(--text-2)}.month-axis{position:relative;display:flex;justify-content:space-between;font-size:11px;color:var(--text-3);font-weight:500}.month-axis .td{position:absolute;transform:translate(-50%);color:var(--accent)}.month-axis .hide{visibility:hidden}.month-read{display:flex;justify-content:space-between;align-items:baseline;margin-top:10px;font-size:13px;color:var(--text-2)}.month-read b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.meter{height:6px;border-radius:3px;background:var(--bar);overflow:hidden}.meter>i{display:block;height:100%;border-radius:3px;background:var(--accent)}.meter>i.warn{background:var(--warn)}.meter>i.bad{background:var(--bad)}.until{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;border-radius:16px;background:var(--field)}.until-num{display:flex;flex-direction:column;min-width:0}.until-num b{font-size:36px;line-height:40px;font-weight:600;letter-spacing:-.045em}.until-num span{font-size:13px;line-height:18px;color:var(--text-2)}.until-num .until-sub{margin-top:8px;font-size:12px;color:var(--text-3)}.until.soon .until-num b{color:var(--warn)}.cal{display:flex;flex-direction:column;gap:6px;flex:none}.cal-h,.cal-g{display:grid;grid-template-columns:repeat(7,10px);gap:5px}.cal-h span{font-size:9px;line-height:10px;font-weight:600;color:var(--text-3);text-align:center}.cal-g i{width:10px;height:10px;border-radius:3px;background:color-mix(in srgb,var(--text) 16%,transparent)}.cal-g i.past{background:color-mix(in srgb,var(--text) 5%,transparent)}.cal-g i.today{background:var(--accent)}.cal-g i.end{background:transparent;box-shadow:inset 0 0 0 1.5px var(--accent)}.cal-g i.after{background:transparent}.until.soon .cal-g i.today{background:var(--warn)}.until.soon .cal-g i.end{box-shadow:inset 0 0 0 1.5px var(--warn)}.acc-row.open .cal-g i{animation:cal-in .36s var(--ease-out) backwards;animation-delay:calc(var(--i) * 7ms)}@keyframes cal-in{0%{opacity:0;transform:scale(.4)}}.hours{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background:var(--field)}.hours-top{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--text-2)}.hours-top b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.hours-bar{position:relative;height:8px;border-radius:4px;background:color-mix(in srgb,var(--text) 8%,transparent)}.hours-bar i{position:absolute;top:0;bottom:0;border-radius:4px;background:color-mix(in srgb,var(--ok) 70%,transparent)}.hours-now{position:absolute;top:-4px;width:2px;height:16px;margin-left:-1px;border-radius:1px;background:var(--text);box-shadow:0 0 0 2px var(--field)}.hours-now.out{background:var(--warn)}.hours-axis{display:flex;justify-content:space-between;font-size:10px;color:var(--text-3);font-weight:500}@media(prefers-reduced-motion:reduce){.acc-row.open .cal-g i{animation:none}}.sheet-root{position:fixed;inset:0;z-index:50;display:none}.sheet-root.open{display:block}.scrim{position:absolute;inset:0;background:var(--scrim);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.sheet{position:absolute;left:var(--gutter-l);right:var(--gutter-r);bottom:calc(16px + env(safe-area-inset-bottom,0px));margin:0 auto;max-width:400px;max-height:calc(100% - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));background:var(--raised);border-radius:var(--r-sheet);box-shadow:var(--sheet-shadow);overflow:hidden;display:flex;flex-direction:column}@media(min-width:760px){.sheet-root.open{display:flex;align-items:center;justify-content:center}.sheet{position:relative;left:auto;right:auto;bottom:auto;margin:0;width:calc(100% - var(--gutter-l) - var(--gutter-r))}}.sheet .x{position:absolute;z-index:3;right:22px;top:22px}.vp{position:relative;overflow:hidden;flex:none}.sheet-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.view{padding:0 24px 24px;display:flex;flex-direction:column}.vhead{display:flex;align-items:center;gap:12px;height:76px;padding-right:44px;flex:none;cursor:grab;touch-action:none}.vhead h2{flex:1;margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vhead.center h2{text-align:center}.vhead.with-acts{padding-right:126px}.vsub{margin:-16px 0 18px;color:var(--text-2);font-size:14px;line-height:20px}.vhead.center+.vsub{text-align:center;margin:-6px auto 24px;max-width:32ch;text-wrap:balance}.kinds-note{margin:14px 2px 16px}.view>.hint.bad-t{margin-top:8px}.secure-note{margin-top:12px;text-align:center}.sheet-acts{position:absolute;z-index:3;top:22px;right:58px}.hpill{position:relative;display:flex;gap:2px}.hp-b{display:grid;place-items:center;width:38px;height:32px;background:var(--knob);color:var(--text);transition:background-color .15s,transform .15s var(--ease-out)}.hp-b:first-of-type{border-radius:16px 6px 6px 16px}.hp-b:last-of-type{border-radius:6px 16px 16px 6px}.hp-b .i{width:16px;height:16px}.hp-b:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.hp-b:active{transform:scale(.94)}.hp-b.done{color:var(--ok)}.hp-tip{position:absolute;z-index:4;left:0;top:calc(100% + 8px);height:26px;padding:0 10px;display:flex;align-items:center;border-radius:999px;background:var(--toast);color:var(--toast-fg);font:500 12px/1 var(--font);letter-spacing:-.1px;white-space:nowrap;box-shadow:0 0 0 1px var(--line-glass),var(--pop-shadow);opacity:0;pointer-events:none;overflow:hidden;transform-origin:50% 0}.hp-tip.on{opacity:1}.hp-tip .tt{position:relative;display:inline-flex;justify-content:center;white-space:nowrap}.hp-tip .tt-m{position:absolute;left:0;top:0;visibility:hidden;white-space:nowrap}.sheet .x,.sheet-acts{transition:transform .15s var(--ease-out),background-color .15s,opacity .24s var(--ease-out),filter .24s var(--ease-out),scale .24s var(--ease-out)}.sheet.arrived .x,.sheet.arrived .sheet-acts{opacity:0;filter:blur(3px);scale:.9;pointer-events:none}.center-col{display:flex;flex-direction:column;align-items:center;text-align:center}.center-col.ask{padding-top:28px}.center-col.secure{padding-top:4px}.center-col .gi.xl{width:64px;height:64px;margin:8px 0 16px}.center-col h3{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px}.center-col p{margin:6px 0 22px;color:var(--text-2);font-size:15px;line-height:21px;max-width:30ch;text-wrap:balance}.center-col.secure p{margin-top:0}.btnrow{display:flex;gap:8px;width:100%}.btnrow .btn{flex:1}.btnrow2{display:grid;gap:8px}.btnrow2 .btn{width:100%}.setup{display:flex;flex-direction:column}.setup .notice{margin:0 0 16px}.steps-gap{height:22px}.step{display:flex;gap:12px}.step+.step{margin-top:20px}.step-n{width:24px;height:24px;border-radius:50%;background:var(--knob);font-size:13px;font-weight:600;display:grid;place-items:center;flex:none}.step-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}.step-t{font-size:16px;line-height:24px;font-weight:500;letter-spacing:-.02em}.step-box{display:flex;flex-direction:column;gap:10px}.way{display:flex;flex-direction:column;padding:12px 14px;border-radius:20px;background:var(--field);margin-bottom:18px}.way-row{display:flex;align-items:center;gap:10px}.way-end{width:34px;height:34px;border-radius:11px;background:var(--knob);display:grid;place-items:center;flex:none;color:var(--text-2);transition:background-color .4s var(--ease-out),color .4s var(--ease-out)}.way-end .i{width:17px;height:17px}.way-end.home{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}.way-track{position:relative;flex:1;height:8px}.way-track:before,.way-glow,.way-fill{content:"";position:absolute;inset:0;-webkit-mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x;mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x}.way-track:before{background:var(--text-3);opacity:.8}.way-glow{overflow:hidden;transition:opacity .2s var(--ease-out)}.way-glow i{position:absolute;inset:0;background:linear-gradient(90deg,transparent 32%,var(--accent) 50%,transparent 68%);transform:translate(-70%);animation:way-run 2s cubic-bezier(.45,0,.55,1) infinite}@keyframes way-run{0%{transform:translate(-70%)}72%,to{transform:translate(70%)}}.way-fill{background:var(--ok);clip-path:inset(0 100% 0 0);transition:clip-path .7s var(--ease-out) 80ms}.way.done .way-fill{clip-path:inset(0)}.way.done .way-glow,.way.stopped .way-glow{opacity:0}.way.done .way-end{color:var(--ok);background:var(--ok-soft)}.way.done .way-end.home{transition-delay:.6s}.way.done .way-end.home .i{animation:way-pop .42s var(--spring-bouncy, ease) .6s backwards}@keyframes way-pop{0%{transform:scale(.6)}to{transform:none}}.way-text{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:30px;margin-top:10px;text-align:center}.way-text .t{display:flex;flex-direction:column;align-items:center;min-width:0}.way-text b{position:relative;display:inline-flex;justify-content:center;white-space:nowrap;font-weight:500;font-size:14px;line-height:20px;transition:color .3s var(--ease-out)}.way-text .ws{color:var(--text-2);font-size:13px;line-height:18px}.way.done .way-text b{color:var(--ok)}.filecard{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:18px;background:var(--field)}.fc-row{display:flex;align-items:center;gap:12px;min-width:0}.filecard-ic{width:38px;height:46px;border-radius:9px;background:var(--knob);font:600 10px/1 var(--mono);display:grid;place-items:center;color:var(--text-2);flex:none}.filecard .t{flex:1;min-width:0;display:flex;flex-direction:column}.filecard .t .mono{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.filecard .t span:last-child{font-size:12px;color:var(--text-2);line-height:16px}.confbar{display:flex;gap:8px}.conf{margin:0;padding:12px 14px;border-radius:14px;background:var(--field);font:12px/18px var(--mono);max-height:16rem;overflow:auto;white-space:pre;color:var(--text-2)}.conf .k{color:var(--text)}.conf .sec{color:var(--accent)}.conf .mask{color:var(--text-3);letter-spacing:1px}.osm{white-space:normal}.osm-ic{display:inline-grid;width:1.05em;height:1.05em;margin-right:.25em;vertical-align:-.16em}.osm-ic>svg{grid-area:1 / 1;width:100%;height:100%}.osm-ic .eye{fill:var(--field)}.osm-p{display:inline-block;white-space:pre}.scanline{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:.3em}.scanline .osm{white-space:nowrap}@media(max-width:440px){.scanline{flex-direction:column;align-items:flex-start}}.way-text b .mt-old{color:var(--text-2)}@media(prefers-reduced-motion:reduce){.way-glow{display:none}.way-fill{transition:none}.way.done .way-end.home .i{animation:none}}.menu{position:fixed;z-index:60;min-width:224px;padding:6px;border-radius:20px;background:var(--field);box-shadow:var(--pop-shadow),inset 0 0 0 1px var(--line)}.menu-hl{position:absolute;left:6px;right:6px;top:6px;height:40px;border-radius:14px;background:var(--knob);opacity:0;transition:opacity .15s var(--ease-out);pointer-events:none}.menu-hl.moving{transition:opacity .15s var(--ease-out),transform var(--spring-quick-dur, .3s) var(--spring-quick, ease-out),background-color .15s}.menu-hl.bad{background:var(--bad-soft)}.menu-hl.warn{background:color-mix(in srgb,var(--warn) 13%,transparent)}.mi{position:relative;z-index:1;display:flex;align-items:center;gap:12px;width:100%;height:40px;padding:0 12px;border-radius:14px;font-size:14px;font-weight:500;text-align:left}.mi .i{width:16px;height:16px;color:var(--text-2)}.mi.warn,.mi.warn .i{color:var(--warn)}.mi.bad,.mi.bad .i{color:var(--bad)}.menu-sep{height:1px;margin:6px 12px;background:var(--line)}.toasts{position:fixed;left:0;right:0;height:42px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:70;display:flex;justify-content:center;align-items:flex-end;pointer-events:none;padding-left:var(--gutter-l);padding-right:var(--gutter-r)}.toast{position:absolute;display:flex;align-items:center;gap:8px;height:42px;padding:0 18px 0 13px;border-radius:999px;background:var(--toast);color:var(--toast-fg);font-size:14px;font-weight:500;box-shadow:var(--pop-shadow);white-space:nowrap}.toast .i{width:18px;height:18px;color:var(--ok)}.toast.bad .i{color:var(--bad)} +@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.knob:active{transform:scale(.8)}.knob .i{width:16px;height:16px}.knob.back .i{transform:rotate(180deg)}.knob[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.btn{height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 20px;font-size:16px;font-weight:500;letter-spacing:-.015em;user-select:none;-webkit-user-select:none;transition:transform .2s var(--ease-out),background-color .2s var(--ease-out),color .2s var(--ease-out)}.btn:active{transform:scale(.95)}.btn.block{width:100%}.btn.sm{height:40px;font-size:15px;padding:0 16px}.btn.accent{background:var(--accent);color:var(--accent-ink);font-weight:600}.btn.accent:hover{background:color-mix(in srgb,var(--accent) 82%,transparent)}.btn.tint{background:var(--accent-soft);color:var(--accent);font-weight:600}.btn.tint:hover{background:color-mix(in srgb,var(--accent) 20%,transparent)}.btn.tint:active{background:color-mix(in srgb,var(--accent) 24%,transparent)}.btn.soft{background:var(--knob);color:var(--text)}.btn.soft:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.btn.red{background:var(--bad);color:#fff;font-weight:600}.busy{position:relative}.orb{position:absolute;inset:0;margin:auto;width:28px;height:28px;overflow:hidden;contain:strict;pointer-events:none}.orb i{position:absolute;left:50%;top:50%;width:7px;height:7px;margin:-3.5px 0 0 -3.5px;border-radius:50%;background:currentColor;animation:orb-converge 1.8s linear infinite both}.orb i:nth-child(2){animation:orb-breathe 1.8s ease-in-out infinite both}@keyframes orb-converge{0%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:linear}10%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}22%{transform:translate(2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}33%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}43%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}55%{transform:translateY(2.5px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}66%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}77%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}88%{transform:translate(-2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}to{transform:translateY(-5px) scale(1);filter:blur(0)}}@keyframes orb-breathe{0%,to{opacity:.16;filter:blur(2.4px);transform:scale(1.2)}50%{opacity:.32;filter:blur(1.6px);transform:scale(.98)}}.field{height:48px;border-radius:var(--r-field);background:var(--field);display:flex;align-items:center;gap:12px;padding:0 4px 0 16px;overflow:hidden;transition:box-shadow .2s var(--ease-out)}.field:focus-within{box-shadow:inset 0 0 0 1.5px color-mix(in srgb,var(--text) 16%,transparent)}.field input{flex:1;min-width:0;border:0;outline:0;background:transparent;padding:0;font:500 16px/24px var(--font);color:var(--text);letter-spacing:-.012em}.field input::placeholder{color:var(--text-3)}.go{width:48px;height:40px;border-radius:12px;background:var(--knob);color:var(--text-3);display:grid;place-items:center;flex:none;transition:background-color .2s var(--ease-out),color .2s var(--ease-out),transform .2s var(--ease-out)}.go .i{width:20px;height:20px}.go.ready{background:var(--accent);color:var(--accent-ink)}.go.ready:active{transform:scale(.9)}.go:not(.ready){cursor:not-allowed}.seg{position:relative;display:flex;align-items:center;height:48px;padding:0 4px;border-radius:var(--r-field);background:var(--field)}.seg-pill{position:absolute;left:0;top:4px;height:40px;border-radius:12px;background:var(--seg);box-shadow:var(--seg-shadow);pointer-events:none}.seg-b{position:relative;z-index:1;height:40px;font-size:16px;font-weight:500;color:var(--text-3);white-space:nowrap;transition:color .2s var(--ease-out)}.seg-b.on{color:var(--text)}.seg-b:not(.on):hover{color:var(--text-2)}.appseg .seg-b{flex:0 0 56px;display:flex;align-items:center;justify-content:center;justify-content:safe center;gap:8px;padding:0 18px;overflow:hidden}.appseg .seg-b.on{flex:1 1 56px}.appseg .seg-b .i{width:20px;height:20px}.appseg .seg-l{max-width:0;opacity:0;margin-left:-8px;overflow:hidden;white-space:nowrap}.appseg .seg-b.on .seg-l{max-width:180px;opacity:1;margin-left:0}.appseg{container-type:inline-size}@container (max-width: 300px){.appseg .seg-b{flex-basis:44px;padding:0 12px}}.kinds{display:grid;grid-template-columns:repeat(var(--n, 4),minmax(0,1fr));gap:8px;position:relative;container-type:inline-size}.kind{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;color:var(--text-3);font-size:12px;line-height:16px;font-weight:500;transition:color .2s var(--ease-out)}.kind-tile{width:100%;height:56px;border-radius:14px;background:var(--field);display:grid;place-items:center;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out),box-shadow .22s var(--ease-out)}.kind.on .kind-tile{box-shadow:inset 0 0 0 1.5px var(--accent)}.kind-lbl{white-space:nowrap}.kind:hover .kind-tile,.kind:focus-visible .kind-tile{background:var(--knob)}.kind:active .kind-tile{transform:scale(.94)}.kind:focus-visible{outline:none}.kind:focus-visible .kind-lbl,.kind.on{color:var(--text)}.kind .gi{width:26px;height:26px;filter:grayscale(1);opacity:.55;transition:filter .26s var(--ease-out),opacity .26s var(--ease-out)}.kind.on .gi{filter:none;opacity:1}@container (max-width: 330px){.kind-tile{height:50px}.kind{font-size:11.5px}}.or{display:flex;align-items:center;gap:12px;margin:22px 0;color:var(--text-3);font-size:12px;font-weight:500;letter-spacing:.06em}.or:before,.or:after{content:"";flex:1;height:1px;background:var(--line)}.badge{width:100%;text-align:left;display:flex;align-items:center;gap:12px;height:60px;padding:0 14px 0 12px;border-radius:18px;background:var(--field);transition:background-color .2s,transform .2s var(--ease-out)}.badge:hover{background:var(--knob)}.badge:active{transform:scale(.98)}.badge .b-ic{width:36px;height:36px;border-radius:10px;background:var(--text);color:var(--raised);display:grid;place-items:center;flex:none}.badge .b-ic .i{width:20px;height:20px}.badge .b-t{flex:1;min-width:0;display:flex;flex-direction:column}.badge .b-top{font-size:12px;line-height:16px;color:var(--text-2)}.badge .b-main{font-size:15px;line-height:20px;font-weight:500}.badge>.i{color:var(--text-3);width:16px;height:16px}.badge.primary .b-ic{background:var(--accent-soft);color:var(--accent)}.badges2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.badges2 .badge{padding:0 10px;gap:10px}.badges2 .badge>.i{display:none}.badges2 .b-ic{width:32px;height:32px}.hint{margin:0;font-size:13px;line-height:18px;color:var(--text-2)}.hint a,.hint button{color:var(--accent);font-weight:500}.howto{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;color:var(--text-2)}.howto li{display:inline-flex;align-items:center;gap:6px}.howto li+li:before{content:"\203a";color:var(--text-3)}.howto b{color:var(--text);font-weight:500}.linkrow{display:flex;align-items:center;gap:8px;height:44px;padding:0 4px 0 14px;border-radius:14px;background:color-mix(in srgb,var(--knob) 72%,var(--field))}.view>.linkrow{background:var(--field)}.linkrow .mono{flex:1;min-width:0;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:all}.linkrow .knob{width:36px;height:36px;border-radius:10px;background:transparent}.linkrow .knob:hover{background:var(--knob)}.qrbox{position:relative;width:148px;height:148px;flex:none;border-radius:18px;overflow:hidden;background:var(--qr-bg)}.qrbox.light{box-shadow:inset 0 0 0 1px var(--line)}.qrbox.big{width:208px;height:208px;border-radius:24px;align-self:center}.qrbox.big+.linkrow{margin-top:16px}.qrbox.dense{width:100%;max-width:none;height:auto;aspect-ratio:1;align-self:stretch;border-radius:22px}.qrbox svg{display:block;width:100%;height:100%}.qrbox>svg.old{position:absolute;inset:0}.coderow{display:flex;gap:14px;align-items:flex-start}.coderow.stacked{flex-direction:column;align-items:stretch}.coderow .side{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;font-size:14px;line-height:20px;color:var(--text-2)}.coderow .side b{color:var(--text);font-weight:500}.side .words{display:flex;flex-direction:column;gap:8px}.side .words.old{position:absolute;left:0;right:0;top:0;pointer-events:none}.side .arr{color:var(--text-2);font-weight:400;margin:0 6px}@media(max-width:380px){.coderow{flex-direction:column}}@media(prefers-reduced-motion:reduce){.orb i{animation:none;opacity:.3;filter:blur(1.4px)}.orb i:first-child{opacity:1;filter:none}}.mt{position:relative}.mt-ib{display:inline-block;white-space:nowrap}.mt-new{white-space:nowrap}.mt-old{position:absolute;white-space:nowrap;pointer-events:none}.mt-new.w,.mt-old.w{white-space:inherit}.mt-new i,.mt-old i{font-style:normal;display:inline-block;white-space:pre}.acc{display:flex;flex-direction:column}.acc-row{background:var(--raised);overflow:hidden;border-radius:0;padding:0 8px;transition:background-color .15s}.acc-row.rt{border-top-left-radius:var(--r-row);border-top-right-radius:var(--r-row)}.acc-row.rb{border-bottom-left-radius:var(--r-row);border-bottom-right-radius:var(--r-row)}.acc-row.open{margin-block:10px}.acc-row.open:first-child{margin-top:0}.acc-row.open:last-child{margin-bottom:0}.acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--raised),var(--knob) 40%)}.acc-head{width:100%;display:flex;align-items:center;gap:10px;height:52px;padding:0 6px 0 8px;text-align:left}.acc-row.still .acc-head{cursor:default;padding-right:10px}.acc-head .gi{width:22px;height:22px}.acc-title{flex:1;min-width:0;font-size:15px;font-weight:500;letter-spacing:-.02em;display:flex;align-items:center;gap:8px}.acc-title .t{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.acc-val{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:14px;white-space:nowrap;transition:opacity .2s var(--ease-out),filter .2s var(--ease-out),transform .26s var(--ease-out)}.acc-val>span{display:inline-flex;align-items:center;gap:8px}.acc-row.open .acc-val.hide-open{opacity:0;filter:blur(4px);transform:translate(8px);pointer-events:none}.acc-chev{width:16px;height:16px;color:var(--text-2);transform:rotate(90deg);transition:transform var(--spring-soft-dur, .47s) var(--spring-soft, ease)}.acc-row.open .acc-chev{transform:rotate(-90deg)}.acc-body{display:none;padding:0 8px 16px 40px}.acc-row.open .acc-body,.acc-row.closing .acc-body{display:flex;flex-direction:column;gap:12px}.acc .desc{margin:0;font-size:14px;line-height:20px;opacity:.6}.acc.inset .acc-row{background:var(--field)}.acc.inset .acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--field),var(--knob) 50%)}.acc.inset .acc-body{padding-left:8px}.acc.inset .seg{background:color-mix(in srgb,var(--knob) 65%,var(--field))}@media(prefers-reduced-motion:reduce){.acc-chev{transition:none}}.edge-fade{position:fixed;left:0;right:0;z-index:30;pointer-events:none}.edge-fade.top{top:0;height:calc(80px + env(safe-area-inset-top,0px));opacity:0;transition:opacity .2s;background:linear-gradient(var(--bg) 0%,color-mix(in srgb,var(--bg) 75%,transparent) 50%,transparent 100%);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);-webkit-mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%);mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%)}body.scrolled .edge-fade.top{opacity:1}.edge-fade.bot{bottom:0;height:calc(96px + env(safe-area-inset-bottom,0px));background:linear-gradient(to top in oklab,var(--bg) 0%,transparent 100%)}.crumbs{display:flex;align-items:center;gap:10px;height:32px;margin:0 0 32px}.cr-mark{width:32px;height:32px;display:grid;place-items:center;flex:none}.logo{width:24px;height:24px;flex:none;overflow:hidden}.logo .sun,.logo .bar{fill:var(--text)}.cr-path{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:15px;line-height:22px;letter-spacing:-.15px;color:var(--text-2)}.cr-path span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cr-path .cur{color:var(--text);font-weight:500}.cr-path .i{width:14px;height:14px}.cr-lang{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 8px 0 12px;border-radius:999px;background:var(--knob);color:var(--text);font-size:14px;font-weight:500;letter-spacing:-.01em;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.cr-lang:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.cr-lang:active{transform:scale(.94)}.cr-lang[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.cr-down{width:14px;height:14px;color:var(--text-2);transform:rotate(90deg);transition:transform .2s var(--ease-out)}.cr-lang[aria-expanded=true] .cr-down{transform:rotate(-90deg)}.page{max-width:1072px;margin:0 auto;padding-left:var(--gutter-l);padding-right:var(--gutter-r);padding-block:calc(40px + env(safe-area-inset-top,0px)) 112px}.cols{display:grid;gap:40px}.cols>.access{order:-1}@media(min-width:960px){.cols{grid-template-columns:minmax(0,1fr) 384px;gap:36px;align-items:start}.cols>.access{order:0;position:sticky;top:calc(84px + env(safe-area-inset-top,0px))}}.sec-head{display:flex;align-items:baseline;gap:8px;padding:0 4px 12px}.sec-head h2{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.025em}.sec-head .aside{color:var(--text-3);font-size:14px;font-weight:500}.sec-head .aside.warn-t{color:var(--warn)}.note-s{margin:12px 4px 0;color:var(--text-3);font-size:13px;line-height:18px}.notice{display:flex;align-items:center;gap:14px;padding:14px 18px 14px 14px;border-radius:24px;background:var(--raised);margin:0 0 22px}.notice .gi{width:36px;height:36px}.notice .t{display:flex;flex-direction:column;min-width:0}.notice b{font-weight:500;font-size:15px;line-height:22px;letter-spacing:-.02em}.notice span{color:var(--text-2);font-size:14px;line-height:20px}.notice.warn{background:color-mix(in srgb,var(--warn) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 22%,transparent)}.notice.bad{background:color-mix(in srgb,var(--bad) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bad) 22%,transparent)}.page.single{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-block:calc(24px + env(safe-area-inset-top,0px)) calc(24px + env(safe-area-inset-bottom,0px))}.page.single .crumbs{position:relative;left:12px;max-width:calc(100% - 84px);margin:0 0 16px}.page.single .cr-mark{position:absolute;right:calc(100% + 10px);top:0}.page.single .page-body{width:100%;max-width:400px}.page.single .gone{margin:0}.gone{max-width:400px;margin:12vh auto 0;padding:32px 24px 28px;border-radius:var(--r-sheet);background:var(--raised);text-align:center;display:flex;flex-direction:column;align-items:center}.gone .gi{width:56px;height:56px;margin-bottom:16px}.gone h1{margin:0;font-size:22px;line-height:28px;font-weight:500;letter-spacing:-.03em}.gone p{margin:6px 0 0;color:var(--text-2);text-wrap:balance}.dgrid{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}@media(min-width:560px){.dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}.dev{background:var(--raised);border-radius:var(--r-card);padding:8px;display:flex;flex-direction:column;gap:8px;min-width:0}.dev.is-here{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 32%,transparent)}.dev.off{opacity:.5}.dev-top{display:flex;align-items:center;gap:12px;padding:8px 6px 6px 10px}.dev-top .gi{width:32px;height:32px}.dev-id{flex:1;min-width:0;display:flex;flex-direction:column}.dev-name{font-size:16px;line-height:22px;font-weight:500;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat.ok-t{color:var(--ok)}.dev-stat.warn-t{color:var(--warn)}.dev-stat.here-t{color:var(--accent)}.dev-use{margin-top:auto;background:var(--field);border-radius:var(--r-row);padding:12px 14px 12px 16px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px;min-height:66px}.use-txt{display:flex;flex-direction:column;min-width:0}.use-lbl{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap}.use-val{font-size:17px;line-height:24px;font-weight:500;letter-spacing:-.02em}.spark{display:flex;align-items:flex-end;gap:4px;height:34px}.spark i{width:6px;border-radius:3px;background:var(--bar);transition:background-color .15s}.spark i.today{background:var(--accent)}.spark i:hover{background:var(--text-2)}.spark i.today:hover{background:color-mix(in srgb,var(--accent) 75%,var(--text))}.dev .setup-btn{margin-top:auto}.upd-pill{display:inline-flex;align-items:center;align-self:center;gap:6px;height:32px;padding:0 12px 0 10px;border-radius:999px;flex:none;background:color-mix(in srgb,var(--warn) 14%,transparent);color:var(--warn);font-size:13px;font-weight:600;transition:background-color .15s,transform .15s var(--ease-out)}.upd-pill:hover{background:color-mix(in srgb,var(--warn) 22%,transparent)}.upd-pill:active{transform:scale(.94)}.upd-pill .i{width:14px;height:14px}.dev.add{align-items:center;justify-content:center;min-height:144px;gap:10px;color:var(--text-2);font-weight:500;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out)}.dev.add:hover{background:color-mix(in srgb,var(--raised),var(--knob) 45%)}.dev.add:active{transform:scale(.98)}.dev.add .gi{width:36px;height:36px}.dev.first{grid-column:1 / -1;align-items:center;text-align:center;padding:28px 24px 24px;gap:6px}.dev.first .gi{width:44px;height:44px;margin-bottom:8px}.dev.first b{font-size:18px;line-height:24px;font-weight:500;letter-spacing:-.02em}.dev.first p{margin:0 0 14px;color:var(--text-2);font-size:14px;line-height:20px;max-width:34ch;text-wrap:balance}.dev.first .btn{max-width:320px}.reach2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.reach-tile{position:relative;display:flex;flex-direction:column;gap:1px;padding:12px 12px 12px 14px;border-radius:16px;background:var(--field);min-width:0}.reach-tile .rt-ic{width:28px;height:28px;margin-bottom:10px}.reach-tile b{font-size:14px;line-height:20px;font-weight:500;letter-spacing:-.015em}.reach-tile .rt-sub{font-size:12px;line-height:16px;color:var(--text-2)}.reach-tile .rt-mark{position:absolute;top:12px;right:12px;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--ok-soft);color:var(--ok)}.reach-tile .rt-mark .i{width:12px;height:12px;stroke-width:2.4}.reach-tile.off b{color:var(--text-2)}.reach-tile.off .rt-sub{color:var(--text-3)}.reach-tile.off .rt-ic{opacity:.45}.reach-tile.off .rt-mark{background:var(--knob);color:var(--text-3)}.lbl-s{font-size:12px;font-weight:500;color:var(--text-2)}.names{display:flex;flex-wrap:wrap;gap:6px}.namechip{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px 0 12px;border-radius:10px;background:var(--field);font-family:var(--mono);font-size:13px;letter-spacing:0;transition:background-color .15s,transform .15s var(--ease-out)}.namechip:hover{background:var(--knob)}.namechip:active{transform:scale(.96)}.namechip .faint{color:var(--text-3)}.namechip .i{width:14px;height:14px;color:var(--text-2)}.ring{width:16px;height:16px;transform:rotate(-90deg)}.ring .trk{stroke:var(--bar)}.ring .arc{stroke:var(--accent)}.ring .arc.warn{stroke:var(--warn)}.ring .arc.bad{stroke:var(--bad)}.month{display:flex;flex-direction:column;gap:8px}.mbars{display:flex;align-items:flex-end;gap:3px;height:64px}.mbars i{flex:1;border-radius:2.5px;background:var(--bar);min-height:3px;transition:background-color .12s}.mbars i.future{background:color-mix(in srgb,var(--bar) 45%,transparent)}.mbars i.today{background:var(--accent)}.mbars i:not(.future):hover{background:var(--text-2)}.month-axis{position:relative;display:flex;justify-content:space-between;font-size:11px;color:var(--text-3);font-weight:500}.month-axis .td{position:absolute;transform:translate(-50%);color:var(--accent)}.month-axis .hide{visibility:hidden}.month-read{display:flex;justify-content:space-between;align-items:baseline;margin-top:10px;font-size:13px;color:var(--text-2)}.month-read b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.meter{height:6px;border-radius:3px;background:var(--bar);overflow:hidden}.meter>i{display:block;height:100%;border-radius:3px;background:var(--accent)}.meter>i.warn{background:var(--warn)}.meter>i.bad{background:var(--bad)}.until{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;border-radius:16px;background:var(--field)}.until-num{display:flex;flex-direction:column;min-width:0}.until-num b{font-size:36px;line-height:40px;font-weight:600;letter-spacing:-.045em}.until-num span{font-size:13px;line-height:18px;color:var(--text-2)}.until-num .until-sub{margin-top:8px;font-size:12px;color:var(--text-3)}.until.soon .until-num b{color:var(--warn)}.cal{display:flex;flex-direction:column;gap:6px;flex:none}.cal-h,.cal-g{display:grid;grid-template-columns:repeat(7,10px);gap:5px}.cal-h span{font-size:9px;line-height:10px;font-weight:600;color:var(--text-3);text-align:center}.cal-g i{width:10px;height:10px;border-radius:3px;background:color-mix(in srgb,var(--text) 16%,transparent)}.cal-g i.past{background:color-mix(in srgb,var(--text) 5%,transparent)}.cal-g i.today{background:var(--accent)}.cal-g i.end{background:transparent;box-shadow:inset 0 0 0 1.5px var(--accent)}.cal-g i.after{background:transparent}.until.soon .cal-g i.today{background:var(--warn)}.until.soon .cal-g i.end{box-shadow:inset 0 0 0 1.5px var(--warn)}.acc-row.open .cal-g i{animation:cal-in .36s var(--ease-out) backwards;animation-delay:calc(var(--i) * 7ms)}@keyframes cal-in{0%{opacity:0;transform:scale(.4)}}.hours{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background:var(--field)}.hours-top{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--text-2)}.hours-top b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.hours-bar{position:relative;height:8px;border-radius:4px;background:color-mix(in srgb,var(--text) 8%,transparent)}.hours-bar i{position:absolute;top:0;bottom:0;border-radius:4px;background:color-mix(in srgb,var(--ok) 70%,transparent)}.hours-now{position:absolute;top:-4px;width:2px;height:16px;margin-left:-1px;border-radius:1px;background:var(--text);box-shadow:0 0 0 2px var(--field)}.hours-now.out{background:var(--warn)}.hours-axis{display:flex;justify-content:space-between;font-size:10px;color:var(--text-3);font-weight:500}@media(prefers-reduced-motion:reduce){.acc-row.open .cal-g i{animation:none}}.sheet-root{position:fixed;inset:0;z-index:50;display:none}.sheet-root.open{display:block}.scrim{position:absolute;inset:0;background:var(--scrim);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.sheet{position:absolute;left:var(--gutter-l);right:var(--gutter-r);bottom:calc(16px + env(safe-area-inset-bottom,0px));margin:0 auto;max-width:400px;max-height:calc(100% - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));background:var(--raised);border-radius:var(--r-sheet);box-shadow:var(--sheet-shadow);overflow:hidden;display:flex;flex-direction:column}@media(min-width:760px){.sheet-root.open{display:flex;align-items:center;justify-content:center}.sheet{position:relative;left:auto;right:auto;bottom:auto;margin:0;width:calc(100% - var(--gutter-l) - var(--gutter-r))}}.sheet .x{position:absolute;z-index:3;right:22px;top:22px}.vp{position:relative;overflow:hidden;flex:none}.sheet-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.view{padding:0 24px 24px;display:flex;flex-direction:column}.vhead{display:flex;align-items:center;gap:12px;height:76px;padding-right:44px;flex:none;cursor:grab;touch-action:none}.vhead h2{flex:1;margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vhead.center h2{text-align:center}.vhead.with-acts{padding-right:126px}.vsub{margin:-16px 0 18px;color:var(--text-2);font-size:14px;line-height:20px}.vhead.center+.vsub{text-align:center;margin:-6px auto 24px;max-width:32ch;text-wrap:balance}.kinds-note{margin:14px 2px 16px}.view>.hint.bad-t{margin-top:8px}.secure-note{margin-top:12px;text-align:center}.sheet-acts{position:absolute;z-index:3;top:22px;right:58px}.hpill{position:relative;display:flex;gap:2px}.hp-b{display:grid;place-items:center;width:38px;height:32px;background:var(--knob);color:var(--text);transition:background-color .15s,transform .15s var(--ease-out)}.hp-b:first-of-type{border-radius:16px 6px 6px 16px}.hp-b:last-of-type{border-radius:6px 16px 16px 6px}.hp-b .i{width:16px;height:16px}.hp-b:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.hp-b:active{transform:scale(.94)}.hp-b.done{color:var(--ok)}.hp-tip{position:absolute;z-index:4;left:0;top:calc(100% + 8px);height:26px;padding:0 10px;display:flex;align-items:center;border-radius:999px;background:var(--toast);color:var(--toast-fg);font:500 12px/1 var(--font);letter-spacing:-.1px;white-space:nowrap;box-shadow:0 0 0 1px var(--line-glass),var(--pop-shadow);opacity:0;pointer-events:none;overflow:hidden;transform-origin:50% 0}.hp-tip.on{opacity:1}.hp-tip .tt{position:relative;display:inline-flex;justify-content:center;white-space:nowrap}.hp-tip .tt-m{position:absolute;left:0;top:0;visibility:hidden;white-space:nowrap}.sheet .x,.sheet-acts{transition:transform .15s var(--ease-out),background-color .15s,opacity .24s var(--ease-out),filter .24s var(--ease-out),scale .24s var(--ease-out)}.sheet.arrived .x,.sheet.arrived .sheet-acts,.sheet.asks .x{opacity:0;filter:blur(3px);scale:.9;pointer-events:none}.center-col,.ask{display:flex;flex-direction:column}.center-col{align-items:center;text-align:center}.ask{align-items:flex-start;text-align:left;padding-top:24px}.center-col.secure{padding-top:4px}:is(.center-col,.ask) .gi.xl{width:64px;height:64px;margin:8px 0 16px}.ask .gi.xl{margin:0 0 18px}:is(.center-col,.ask) h3{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px}:is(.center-col,.ask) p{margin:6px 0 22px;color:var(--text-2);font-size:15px;line-height:21px}.center-col p{max-width:30ch;text-wrap:balance}.ask p{text-wrap:pretty}.center-col.secure p{margin-top:0}.btnrow{display:flex;gap:8px;width:100%}.btnrow .btn{flex:1}.btnrow2{display:grid;gap:8px}.btnrow2 .btn{width:100%}.setup{display:flex;flex-direction:column}.setup .notice{margin:0 0 16px}.steps-gap{height:22px}.step{display:flex;gap:12px}.step+.step{margin-top:20px}.step-n{width:24px;height:24px;border-radius:50%;background:var(--knob);font-size:13px;font-weight:600;display:grid;place-items:center;flex:none}.step-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}.step-t{font-size:16px;line-height:24px;font-weight:500;letter-spacing:-.02em}.step-box{display:flex;flex-direction:column;gap:10px}.way{display:flex;flex-direction:column;padding:12px 14px;border-radius:20px;background:var(--field);margin-bottom:18px}.way-row{display:flex;align-items:center;gap:10px}.way-end{width:34px;height:34px;border-radius:11px;background:var(--knob);display:grid;place-items:center;flex:none;color:var(--text-2);transition:background-color .4s var(--ease-out),color .4s var(--ease-out)}.way-end .i{width:17px;height:17px}.way-end.home{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}.way-track{position:relative;flex:1;height:8px}.way-track:before,.way-glow,.way-fill{content:"";position:absolute;inset:0;-webkit-mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x;mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x}.way-track:before{background:var(--text-3);opacity:.8}.way-glow{overflow:hidden;transition:opacity .2s var(--ease-out)}.way-glow i{position:absolute;inset:0;background:linear-gradient(90deg,transparent 32%,var(--accent) 50%,transparent 68%);transform:translate(-70%);animation:way-run 2s cubic-bezier(.45,0,.55,1) infinite}@keyframes way-run{0%{transform:translate(-70%)}72%,to{transform:translate(70%)}}.way-fill{background:var(--ok);clip-path:inset(0 100% 0 0);transition:clip-path .7s var(--ease-out) 80ms}.way.done .way-fill{clip-path:inset(0)}.way.done .way-glow,.way.stopped .way-glow{opacity:0}.way.done .way-end{color:var(--ok);background:var(--ok-soft)}.way.done .way-end.home{transition-delay:.6s}.way.done .way-end.home .i{animation:way-pop .42s var(--spring-bouncy, ease) .6s backwards}@keyframes way-pop{0%{transform:scale(.6)}to{transform:none}}.way-text{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:30px;margin-top:10px;text-align:center}.way-text .t{display:flex;flex-direction:column;align-items:center;min-width:0}.way-text b{position:relative;display:inline-flex;justify-content:center;white-space:nowrap;font-weight:500;font-size:14px;line-height:20px;transition:color .3s var(--ease-out)}.way-text .ws{color:var(--text-2);font-size:13px;line-height:18px}.way.done .way-text b{color:var(--ok)}.filecard{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:18px;background:var(--field)}.fc-row{display:flex;align-items:center;gap:12px;min-width:0}.filecard-ic{width:38px;height:46px;border-radius:9px;background:var(--knob);font:600 10px/1 var(--mono);display:grid;place-items:center;color:var(--text-2);flex:none}.filecard .t{flex:1;min-width:0;display:flex;flex-direction:column}.filecard .t .mono{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.filecard .t span:last-child{font-size:12px;color:var(--text-2);line-height:16px}.confbar{display:flex;gap:8px}.conf{margin:0;padding:12px 14px;border-radius:14px;background:var(--field);font:12px/18px var(--mono);max-height:16rem;overflow:auto;white-space:pre;color:var(--text-2)}.conf .k{color:var(--text)}.conf .sec{color:var(--accent)}.conf .mask{color:var(--text-3);letter-spacing:1px}.osm{white-space:normal}.osm-ic{display:inline-grid;width:1.05em;height:1.05em;margin-right:.25em;vertical-align:-.16em}.osm-ic>svg{grid-area:1 / 1;width:100%;height:100%}.osm-ic .eye{fill:var(--field)}.osm-p{display:inline-block;white-space:pre}.scanline{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:.3em}.scanline .osm{white-space:nowrap}@media(max-width:440px){.scanline{flex-direction:column;align-items:flex-start}}.way-text b .mt-old{color:var(--text-2)}@media(prefers-reduced-motion:reduce){.way-glow{display:none}.way-fill{transition:none}.way.done .way-end.home .i{animation:none}}.menu{position:fixed;z-index:60;min-width:224px;padding:6px;border-radius:20px;background:var(--field);box-shadow:var(--pop-shadow),inset 0 0 0 1px var(--line)}.menu-hl{position:absolute;left:6px;right:6px;top:6px;height:40px;border-radius:14px;background:var(--knob);opacity:0;transition:opacity .15s var(--ease-out);pointer-events:none}.menu-hl.moving{transition:opacity .15s var(--ease-out),transform var(--spring-quick-dur, .3s) var(--spring-quick, ease-out),background-color .15s}.menu-hl.bad{background:var(--bad-soft)}.menu-hl.warn{background:color-mix(in srgb,var(--warn) 13%,transparent)}.mi{position:relative;z-index:1;display:flex;align-items:center;gap:12px;width:100%;height:40px;padding:0 12px;border-radius:14px;font-size:14px;font-weight:500;text-align:left}.mi .i{width:16px;height:16px;color:var(--text-2)}.mi .i.off{visibility:hidden}.mi.warn,.mi.warn .i{color:var(--warn)}.mi.bad,.mi.bad .i{color:var(--bad)}.menu-sep{height:1px;margin:6px 12px;background:var(--line)}.toasts{position:fixed;left:0;right:0;height:42px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:70;display:flex;justify-content:center;align-items:flex-end;pointer-events:none;padding-left:var(--gutter-l);padding-right:var(--gutter-r)}.toast{position:absolute;display:flex;align-items:center;gap:8px;height:42px;padding:0 18px 0 13px;border-radius:999px;background:var(--toast);color:var(--toast-fg);font-size:14px;font-weight:500;box-shadow:var(--pop-shadow);white-space:nowrap}.toast .i{width:18px;height:18px;color:var(--ok)}.toast.bad .i{color:var(--bad)} diff --git a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js index a890724..6527714 100644 --- a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js +++ b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js @@ -1,6 +1,6 @@ -"use strict";(()=>{var Oo=Object.create;var On=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var No=Object.getOwnPropertyNames;var Io=Object.getPrototypeOf,Fo=Object.prototype.hasOwnProperty;var Ko=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var qo=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of No(e))!Fo.call(t,o)&&o!==n&&On(t,o,{get:()=>e[o],enumerable:!(r=Ro(e,o))||r.enumerable});return t};var Go=(t,e,n)=>(n=t!=null?Oo(Io(t)):{},qo(e||!t||!t.__esModule?On(n,"default",{value:t,enumerable:!0}):n,t));var gr=Ko((hr,mr)=>{"use strict";var fr=(function(){var t=function(d,m){var s=236,h=17,f=d,E=n[m],p=null,l=0,L=null,x=[],C={},R=function(w,k){l=f*4+17,p=(function(y){for(var T=new Array(y),S=0;S=7&&ot(w),L==null&&(L=$t(f,E,x)),G(L,k)},I=function(w,k){for(var y=-1;y<=7;y+=1)if(!(w+y<=-1||l<=w+y))for(var T=-1;T<=7;T+=1)k+T<=-1||l<=k+T||(0<=y&&y<=6&&(T==0||T==6)||0<=T&&T<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=T&&T<=4?p[w+y][k+T]=!0:p[w+y][k+T]=!1)},z=function(){for(var w=0,k=0,y=0;y<8;y+=1){R(!0,y);var T=o.getLostPoint(C);(y==0||w>T)&&(w=T,k=y)}return k},Q=function(){for(var w=8;w>y&1)==1;p[Math.floor(y/3)][y%3+l-8-3]=T}for(var y=0;y<18;y+=1){var T=!w&&(k>>y&1)==1;p[y%3+l-8-3][Math.floor(y/3)]=T}},it=function(w,k){for(var y=E<<3|k,T=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var D=!w&&(T>>S&1)==1;S<6?p[S][8]=D:S<8?p[S+1][8]=D:p[l-15+S][8]=D}for(var S=0;S<15;S+=1){var D=!w&&(T>>S&1)==1;S<8?p[8][l-S-1]=D:S<9?p[8][15-S-1+1]=D:p[8][15-S-1]=D}p[l-8][8]=!w},G=function(w,k){for(var y=-1,T=l-1,S=7,D=0,K=o.getMaskFunction(k),N=l-1;N>0;N-=2)for(N==6&&(N-=1);;){for(var X=0;X<2;X+=1)if(p[T][N-X]==null){var nt=!1;D>>S&1)==1);var q=K(T,N-X);q&&(nt=!nt),p[T][N-X]=nt,S-=1,S==-1&&(D+=1,S=7)}if(T+=y,T<0||l<=T){T-=y,y=-y;break}}},V=function(w,k){for(var y=0,T=0,S=0,D=new Array(k.length),K=new Array(k.length),N=0;N=0?Dn.getAt(Bn):0}}for(var Hn=0,q=0;qN*8)throw"code length overflow. ("+S.getLengthInBits()+">"+N*8+")";for(S.getLengthInBits()+4<=N*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=N*8||(S.put(s,8),S.getLengthInBits()>=N*8));)S.put(h,8);return V(S,T)};C.addData=function(w,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=u(w);break;case"Alphanumeric":y=M(w);break;case"Byte":y=b(w);break;case"Kanji":y=A(w);break;default:throw"mode:"+k}x.push(y),L=null},C.isDark=function(w,k){if(w<0||l<=w||k<0||l<=k)throw w+","+k;return p[w][k]},C.getModuleCount=function(){return l},C.make=function(){if(f<1){for(var w=1;w<40;w++){for(var k=g.getRSBlocks(w,E),y=v(),T=0;T";for(var S=0;S';y+=""}return y+="",y+="",y},C.createSvgTag=function(w,k,y,T){var S={};typeof arguments[0]=="object"&&(S=arguments[0],w=S.cellSize,k=S.margin,y=S.alt,T=S.title),w=w||2,k=typeof k=="undefined"?w*4:k,y=typeof y=="string"?{text:y}:y||{},y.text=y.text||null,y.id=y.text?y.id||"qrcode-description":null,T=typeof T=="string"?{text:T}:T||{},T.text=T.text||null,T.id=T.text?T.id||"qrcode-title":null;var D=C.getModuleCount()*w+k*2,K,N,X,nt,q="",gt;for(gt="l"+w+",0 0,"+w+" -"+w+",0 0,-"+w+"z ",q+=''+lt(T.text)+"":"",q+=y.text?''+lt(y.text)+"":"",q+='',q+='":k+=">";break;case"&":k+="&";break;case'"':k+=""";break;default:k+=T;break}}return k},rn=function(w){var k=1;w=typeof w=="undefined"?k*2:w;var y=C.getModuleCount()*k+w*2,T=w,S=y-w,D,K,N,X,nt,q={"██":"█","█ ":"▀"," █":"▄"," ":" "},gt={"██":"▀","█ ":"▀"," █":" "," ":" "},vt="";for(D=0;D=S?gt[nt]:q[nt];vt+=` -`}return y%2&&w>0?vt.substring(0,vt.length-y-1)+Array(y+1).join("▀"):vt.substring(0,vt.length-1)};return C.createASCII=function(w,k){if(w=w||1,w<2)return rn(k);w-=1,k=typeof k=="undefined"?w*2:k;var y=C.getModuleCount()*w+k*2,T=k,S=y-k,D,K,N,X,nt=Array(w+1).join("██"),q=Array(w+1).join(" "),gt="",vt="";for(D=0;D>>8),E.push(L&255)):E.push(h)}}return E}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],m=1335,s=7973,h=21522,f={},E=function(p){for(var l=0;p!=0;)l+=1,p>>>=1;return l};return f.getBCHTypeInfo=function(p){for(var l=p<<10;E(l)-E(m)>=0;)l^=m<=0;)l^=s<5&&(L+=3+R-5)}for(var x=0;x=256;)f-=255;return d[f]},h})();function c(d,m){if(typeof d.length=="undefined")throw d.length+"/"+m;var s=(function(){for(var f=0;f>>7-h%8&1)==1},s.put=function(h,f){for(var E=0;E>>f-E-1&1)==1)},s.getLengthInBits=function(){return m},s.putBit=function(h){var f=Math.floor(m/8);d.length<=f&&d.push(0),h&&(d[f]|=128>>>m%8),m+=1},s},u=function(d){var m=e.MODE_NUMBER,s=d,h={};h.getMode=function(){return m},h.getLength=function(p){return s.length},h.write=function(p){for(var l=s,L=0;L+2>>8&255)*192+(x&255),p.put(x,13),L+=2}if(L>>8)},m.writeBytes=function(s,h,f){h=h||0,f=f||s.length;for(var E=0;E0&&(s+=","),s+=d[h];return s+="]",s},m},B=function(){var d=0,m=0,s=0,h="",f={},E=function(l){h+=String.fromCharCode(p(l&63))},p=function(l){if(!(l<0)){if(l<26)return 65+l;if(l<52)return 97+(l-26);if(l<62)return 48+(l-52);if(l==62)return 43;if(l==63)return 47}throw"n:"+l};return f.writeByte=function(l){for(d=d<<8|l&255,m+=8,s+=1;m>=6;)E(d>>>m-6),m-=6},f.flush=function(){if(m>0&&(E(d<<6-m),d=0,m=0),s%3!=0)for(var l=3-s%3,L=0;L=m.length){if(f==0)return-1;throw"unexpected end of file./"+f}var l=m.charAt(s);if(s+=1,l=="=")return f=0,-1;if(l.match(/^\s$/))continue;h=h<<6|p(l.charCodeAt(0)),f+=6}var L=h>>>f-8&255;return f-=8,L};var p=function(l){if(65<=l&&l<=90)return l-65;if(97<=l&&l<=122)return l-97+26;if(48<=l&&l<=57)return l-48+52;if(l==43)return 62;if(l==47)return 63;throw"c:"+l};return E},H=function(d,m){var s=d,h=m,f=new Array(d*m),E={};E.setPixel=function(x,C,R){f[C*s+x]=R},E.write=function(x){x.writeString("GIF87a"),x.writeShort(s),x.writeShort(h),x.writeByte(128),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(255),x.writeByte(255),x.writeByte(255),x.writeString(","),x.writeShort(0),x.writeShort(0),x.writeShort(s),x.writeShort(h),x.writeByte(0);var C=2,R=l(C);x.writeByte(C);for(var I=0;R.length-I>255;)x.writeByte(255),x.writeBytes(R,I,255),I+=255;x.writeByte(R.length-I),x.writeBytes(R,I,R.length-I),x.writeByte(0),x.writeString(";")};var p=function(x){var C=x,R=0,I=0,z={};return z.write=function(Q,et){if(Q>>>et)throw"length over";for(;R+et>=8;)C.writeByte(255&(Q<>>=8-R,I=0,R=0;I=Q<0&&C.writeByte(I)},z},l=function(x){for(var C=1<>6,128|a&63):a<55296||a>=57344?r.push(224|a>>12,128|a>>6&63,128|a&63):(o++,a=65536+((a&1023)<<10|n.charCodeAt(o)&1023),r.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}return r}return e(t)}})();(function(t){typeof define=="function"&&define.amd?define([],t):typeof hr=="object"&&(mr.exports=t())})(function(){return fr})});var Rn={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function Se(t,e="dl-icon"){var r;let n=(r=Rn[t])!=null?r:Rn.phone;return``}function Nn(t,e){let n=r=>{r==null||r===!1||(Array.isArray(r)?r.forEach(n):t.appendChild(typeof r=="string"?document.createTextNode(r):r))};e.forEach(n)}function i(t,e={},...n){let r=document.createElement(t);for(let[o,a]of Object.entries(e))a==null||a===!1||(o.startsWith("on")&&typeof a=="function"?r.addEventListener(o.slice(2),a):o==="class"?r.className=String(a):a===!0?r.setAttribute(o,""):r.setAttribute(o,String(a)));return Nn(r,n),r}function Rt(t,...e){t.replaceChildren(),Nn(t,e)}function _t(t){let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}var F=(t,e="i")=>_t(Se(t,e));var Lt=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function Qt(t,e,n=1){let r=Math.sqrt(t/n),o=e/(2*Math.sqrt(t*n)),a=u=>{if(o<.999){let O=r*Math.sqrt(1-o*o);return 1-Math.exp(-o*r*u)*(Math.cos(O*u)+o*r/O*Math.sin(O*u))}if(o<=1.001)return 1-Math.exp(-r*u)*(1+r*u);let M=Math.sqrt(o*o-1),b=-r*(o-M),A=-r*(o+M);return 1-(A*Math.exp(b*u)-b*Math.exp(A*u))/(A-b)},c=0;for(let u=0;u<3;u+=.004)Math.abs(1-a(u))>.0015&&(c=u);c+=.004;let g=[];for(let u=0;u<=64;u++)g.push(+a(c*u/64).toFixed(4));g[64]=1;let v=Math.round(c*1e3);return{duration:v,easing:`linear(${g.join(", ")})`,at:u=>u>=v?1:a(u/1e3)}}var kt=Qt(300,20),U=Qt(300,35),yt=Qt(520,24),Fn=Qt(520,46),Et=Qt(380,28),In=Qt(900,60),Y="cubic-bezier(0.23, 1, 0.32, 1)",J="cubic-bezier(0.55, 0, 1, 0.45)",an="cubic-bezier(0.32, 0.72, 0, 1)";function Kn(t){t.style.setProperty("--spring-bouncy",kt.easing),t.style.setProperty("--spring-bouncy-dur",`${kt.duration}ms`),t.style.setProperty("--spring-smooth",U.easing),t.style.setProperty("--spring-smooth-dur",`${U.duration}ms`),t.style.setProperty("--spring-soft",Et.easing),t.style.setProperty("--spring-soft-dur",`${Et.duration}ms`),t.style.setProperty("--spring-quick",In.easing),t.style.setProperty("--spring-quick-dur",`${In.duration}ms`)}function _(t,e,n){var r;return Lt()?e.some(o=>"opacity"in o)?t.animate(e.map(o=>"opacity"in o?{opacity:o.opacity}:{}),{duration:Math.min(Number((r=n.duration)!=null?r:200),160),easing:"ease-out",fill:n.fill}):t.animate(e,{...n,duration:0,delay:0}):t.animate(e,n)}function qn(t,e){return t<=0||e<=0?0:(1-1/(t*.55/e+1))*e}function Gn(t,e,n){return t<=0||e<-.1?!1:e>.4||t>n/3}function ct(t){if(!t||t<0)return"0 B";let e=["B","KB","MB","GB","TB"],n=0,r=t;for(;r>=1024&&n=100||n===0?Math.round(r):r.toFixed(1)} ${e[n]}`}function Un(t,e=Date.now()/1e3){if(!t)return"never";let n=Math.max(0,Math.round(e-t));return n<60?"just now":n<3600?`${Math.floor(n/60)} min ago`:n<86400?`${Math.floor(n/3600)} h ago`:n<86400*30?`${Math.floor(n/86400)} d ago`:new Date(t*1e3).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function $e(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function Tt(t){let[e,n,r]=t.split("-").map(Number);return new Date(e,(n||1)-1,r||1,12)}function Uo(t){return(typeof t=="string"?/^\d{4}-\d{2}-\d{2}$/.test(t)?Tt(t):new Date(t):t).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function pe(t){return t?Uo(t):""}function Wo(t,e){let n=r=>{let[o,a,c]=r.split("-").map(Number);return Date.UTC(o,a-1,c)};return Math.round((n(t)-n(e))/864e5)}function Xt(t,e){let n=Tt(t);return n.setDate(n.getDate()+e),$e(n)}function _e(t,e=Date.now()){if(!t)return null;let n=typeof e=="number"?$e(new Date(e)):e,r=Wo(t,n);return r>=0?r+1:r}function fe(t,e){return e!=null&&e>0&&t.expire_warn>0&&e<=t.expire_warn}function Wn(t){return t<=1?"ends today":t===2?"ends tomorrow":`ends in ${t} days`}var zn={lan:"Home network",internet:"Internet",both:"Home network + Internet"};var sn={computer:"PC",phone:"Phone",tablet:"Tablet",router:"Router",other:"Other"};function Pe(t){let e=n=>n.disabled?3:n.online?0:n.handshake?1:2;return t.map((n,r)=>[n,r]).sort((n,r)=>e(n[0])-e(r[0])||n[1]-r[1]).map(([n])=>n)}var at={vpn:"AmneziaVPN",awg:"AmneziaWG",wg:"WireGuard"};function Yn(t,e=0){return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&e>1?"ios":/Android/.test(t)?"android":/Windows/.test(t)?"windows":/Mac OS X|Macintosh/.test(t)?"mac":/CrOS/.test(t)?"unknown":/Linux|X11/.test(t)?"linux":"unknown"}var jn=t=>/Telegram|FBAN|FBAV|Instagram|VKClient|Line\//i.test(t);function Qn(t,e){return t==="router"||e==="unknown"?!1:t==="phone"||t==="tablet"?e==="ios"||e==="android":t==="computer"?e==="windows"||e==="mac"||e==="linux":!0}function Xn(t){let e=[{id:"vpn",name:at.vpn},{id:"awg",name:at.awg}];return t==="off"&&e.push({id:"wg",name:at.wg}),e}var De="https://github.com/amnezia-vpn/amnezia-client/releases/latest",Vn={href:De,top:"APK file on",main:"GitHub",mark:"github",why:"The APK is for phones without Google Play, or where the store hides the app."};function Jn(t,e){var r;return(r={vpn:{ios:{href:"https://apps.apple.com/app/amneziavpn/id1600529900",top:"Download on the",main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.vpn",top:"Get it on",main:"Google Play",mark:"googleplay",alt:Vn},windows:{href:De,top:"Official release on GitHub",main:"Download for Windows",mark:"windows"},mac:{href:De,top:"Official release on GitHub",main:"Download for Mac",mark:"apple"},linux:{href:De,top:"Official release on GitHub",main:"Download for Linux",mark:"linux"}},awg:{ios:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:"Download on the",main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.awg",top:"Get it on",main:"Google Play",mark:"googleplay",alt:{...Vn,href:"https://github.com/amnezia-vpn/amneziawg-android/releases"}},windows:{href:"https://github.com/amnezia-vpn/amneziawg-windows-client/releases",top:"Official release on GitHub",main:"Download for Windows",mark:"windows"},mac:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:"Download on the",main:"Mac App Store",mark:"appstore"},linux:{href:"https://github.com/amnezia-vpn/amneziawg-tools",top:"On GitHub",main:"amneziawg-tools",mark:"linux"}},wg:{ios:{href:"https://apps.apple.com/app/wireguard/id1441195209",top:"Download on the",main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=com.wireguard.android",top:"Get it on",main:"Google Play",mark:"googleplay"},windows:{href:"https://www.wireguard.com/install/",top:"Download from",main:"wireguard.com",mark:"windows"},mac:{href:"https://apps.apple.com/app/wireguard/id1451685025",top:"Download on the",main:"Mac App Store",mark:"appstore"},linux:{href:"https://www.wireguard.com/install/",top:"Install from",main:"wireguard.com",mark:"linux"}}}[t][e])!=null?r:null}var Zn=t=>t==="wg"?{href:"https://openwrt.org/docs/guide-user/services/vpn/wireguard/start",top:"OpenWrt packages",main:"wireguard-tools",mark:"openwrt"}:{href:"https://openwrt.org/packages/start",top:"OpenWrt packages + kmod",main:"amneziawg-tools",mark:"openwrt"},ln=t=>t==="android",he=t=>`${t.replace(/\.conf$/i,"")}.vpn`,Be={ios:{file:"+ → Create from file or archive",qr:"+ → Create from QR code"},android:{file:"+ → Import from file or archive",qr:"+ → Scan from QR code"},mac:{file:"+ → Import tunnel(s) from file"},windows:{file:"Add Tunnel → Import tunnel(s) from file"}};function me(t,e="unknown"){var r;if(t==="vpn")return"Add server → Scan QR";let n=(r=Be[e])==null?void 0:r.qr;return n!=null?n:`${Be.ios.qr} (Android: ${Be.android.qr.replace(/^.* → /,"")})`}function zo(t,e="unknown"){var n,r;return t==="vpn"?"Add server → Insert key":(r=(n=Be[e])==null?void 0:n.file)!=null?r:"Add tunnel → Import from file"}function tr(t,e,n,r){if(e==="linux")return[["Open a terminal in the folder with the file",""],["Run ",`sudo ${t==="wg"?"wg-quick":"awg-quick"} up ./${n}`]];let o=zo(t,e);return[[`Open ${at[t]}`,""],[o.replace(/ → [^→]*$/," → "),o.replace(/^.* → /,"")],[r?"Confirm the import and connect":"Pick the file and connect",""]]}var er={ios:"iPhone / iPad",android:"Android",windows:"Windows",mac:"Mac",linux:"Linux",unknown:"this device"},nr=(t,e)=>`${t}#setup=${e}`;function rr(t){var e,n;return(n=(e=/^#setup=(d_[0-9a-f]{8})$/.exec(t))==null?void 0:e[1])!=null?n:null}var or=t=>`${t}#add`,ir=t=>t==="#add",ar=t=>({phone:"phone",tablet:"tablet",computer:"computer",router:"router",other:"device"})[t];var tt=null,dt=()=>tt;function xt(t){tt=t}var Vo=document.getElementById("app"),sr,Jt=(sr=Vo.dataset.base)!=null?sr:"",lr=/^\/[a-z]{6}-[a-z]{6}-[a-z]{6}$/.test(Jt)?Jt.slice(1):"",Zt=()=>location.origin+location.pathname,Pt=()=>{var t;return(t=tt==null?void 0:tt.today)!=null?t:$e(new Date)},te=()=>{var t;return(t=tt==null?void 0:tt.now)!=null?t:Date.now()/1e3},He=()=>Yn(navigator.userAgent,navigator.maxTouchPoints),Yo=()=>(tt==null?void 0:tt.server.awg_disguise)===!1,cr=()=>{var t;return(t=tt==null?void 0:tt.server.preset)!=null?t:Yo()?"off":"max"},dr=()=>(tt==null?void 0:tt.https_url)||null,Ut=()=>(tt==null?void 0:tt.server.name)||"Dawnline",ur=()=>{};function pr(t){ur=t}var Mt=(t={})=>ur(t);var Nt=class extends Error{constructor(n,r,o){super(r);this.status=n;this.httpsUrl=o}};async function ut(t,e){var o;let n=await fetch(`${Jt}/api/${t}`,{method:e===void 0?"GET":"POST",credentials:"omit",headers:e===void 0?{}:{"Content-Type":"application/json"},body:e===void 0?void 0:JSON.stringify(e),cache:"no-store"}),r=null;try{r=await n.json()}catch{}if(!n.ok)throw new Nt(n.status,(o=r==null?void 0:r.error)!=null?o:`Request failed (${n.status})`,(r==null?void 0:r.https_url)||void 0);return r}var Oe=t=>t instanceof Nt&&(t.status===404||t.status===401);var yr=Go(gr(),1),jo=t=>``,vr="#0a0a0a",Qo="#f2f2f2",Xo={night:[vr,Qo],day:["#ffffff",vr]},dn=t=>t.length>300,ee=t=>+t.toFixed(2);function cn(t,e,n,r,o){return`M${ee(t+o)} ${ee(e)}h${ee(n-2*o)}a${o} ${o} 0 0 1 ${o} ${o}v${ee(r-2*o)}a${o} ${o} 0 0 1 -${o} ${o}h-${ee(n-2*o)}a${o} ${o} 0 0 1 -${o} -${o}v-${ee(r-2*o)}a${o} ${o} 0 0 1 ${o} -${o}z`}function xr(t,e=3,n=!0,r="plain"){let o=dn(t),a=r!=="plain",[c,g]=a?Xo[r]:["#fff","#000"],v=(0,yr.default)(0,o?"L":"H");v.addData(t,"Byte"),v.make();let u=v.getModuleCount(),M=u+e*2,b=n&&!o?Math.round(u*.22):0;b&&(u-b)%2&&b++;let A=(u-b)/2,O=A+b,B=(s,h)=>b>0&&s>=A&&s=A&&ha&&(h<7&&s<7||h<7&&s>=u-7||h>=u-7&&s<7),H="";if(a){let s=o?.48:.42;for(let h=0;h${jo(a?c:"#fff")}`}let m=``;return a?`${m}${d}`:`${m}${d}`}var br={opacity:1,filter:"blur(0px)",transform:"none"},Jo={opacity:0,filter:"blur(5px)",transform:"scale(.86)"},wr={opacity:0,filter:"blur(5px)",transform:"scale(.6)"},Mr={duration:180,easing:J,fill:"forwards"},Re={duration:340,delay:70,easing:Y,fill:"backwards"},Cr=Re.delay+Re.duration,Ne=new WeakMap;function un(t){let e=getComputedStyle(t);return{opacity:e.opacity,filter:e.filter==="none"?"blur(0px)":e.filter,transform:e.transform}}function kr(t){var e;for(let n of[...t.childNodes])n.nodeType===Node.TEXT_NODE&&((e=n.textContent)!=null&&e.trim())&&n.replaceWith(i("span",{},n.textContent));return[...t.children].filter(n=>!n.classList.contains("orb"))}function Er(t,e){var r;let n=(r=Ne.get(t))!=null?r:[];Ne.set(t,e),n.forEach(o=>o.cancel())}function Lr(t){var o;(o=t.querySelector(":scope > .orb"))==null||o.remove();let e=kr(t),n=e.map(un),r=i("span",{class:"orb","aria-hidden":"true"},i("i"),i("i"));t.append(r),t.classList.add("busy"),t.setAttribute("aria-busy","true"),Er(t,[...e.map((a,c)=>_(a,[n[c],Jo],Mr)),_(r,[wr,br],Re)])}function Tr(t){let e=t.querySelector(":scope > .orb"),n=kr(t),r=[...e?[_(e,[un(e),wr],Mr)]:[],...n.map(o=>_(o,[un(o),br],Re))];Er(t,r),t.removeAttribute("aria-busy"),Promise.all(r.map(o=>o.finished)).then(()=>{Ne.get(t)===r&&(Ne.delete(t),r.forEach(o=>o.cancel()),e==null||e.remove(),t.classList.remove("busy"))},()=>{})}var Ar=t=>[...t].map(e=>i("i",{},e)),ne=new WeakMap,ge=t=>{var e,n,r;return(r=(n=(e=ne.get(t))==null?void 0:e.text)!=null?n:t.textContent)!=null?r:""};function hn(t){let e=document.createRange();return e.selectNodeContents(t),e.getBoundingClientRect()}function Sr(t){var a;let e=t.firstChild;if(!e||e.nodeType!==Node.TEXT_NODE)return[];let n=document.createRange(),r=[],o=0;for(let c of(a=e.textContent)!=null?a:"")n.setStart(e,o),n.setEnd(e,o+c.length),r.push(n.getBoundingClientRect().left),o+=c.length;return r.map(c=>c-r[0])}function $r(t,e){let n=[...t.children];if(!n.length)return;let r=n[0].getBoundingClientRect().left;n.forEach((o,a)=>{if(!a||e[a]===void 0)return;let c=r+e[a]-o.getBoundingClientRect().left;Math.abs(c)>.01&&(o.style.marginLeft=`${c}px`)})}function Zo(t,e){let n=0;for(;nnew Array(a.length+1).fill(0));for(let v=o.length-1;v>=0;v--)for(let u=a.length-1;u>=0;u--)c[v][u]=o[v]===a[u]?c[v+1][u+1]+1:Math.max(c[v+1][u],c[v][u+1]);let g=[];for(let v=0;v=c[v][u+1]?v++:u++;for(let v=r;v>0;v--)g.push([t.length-v,e.length-v]);return g}function Ie(t){let e=ne.get(t);e&&(clearTimeout(e.timer),ne.delete(t),t.getAnimations().forEach(n=>n.cancel()),t.classList.remove("mt","mt-ib"),t.textContent=e.text)}function bt(t,e){Ie(t),t.textContent=e}function Z(t,e,n=ge(t),r={}){var ot,it;let{whole:o=!1,at:a}=r,c=((ot=r.glide)!=null?ot:!0)&&!a,g=ne.has(t)?t.getBoundingClientRect().width:null;if(Ie(t),n===e||Lt()||!t.getClientRects().length){t.textContent=e;return}let v=getComputedStyle(t),u=o&&v.display==="inline";v.display==="inline"&&!o&&t.classList.add("mt-ib"),v.position==="static"&&t.classList.add("mt");let M=null,b=a!=null?a:null,A=[];b||(t.textContent=n,M=t.getBoundingClientRect(),b=hn(t),A=Sr(t)),t.textContent=e;let O=t.getBoundingClientRect(),B=Sr(t),P=(it=g!=null?g:M==null?void 0:M.width)!=null?it:O.width,H=c&&!u&&!!M&&Math.abs(O.width-P)>.5,$=!H||!M||Math.abs(O.left-M.left)<.5?"start":Math.abs(O.right-M.right)<.5?"end":"middle",d=i("span",{class:o?"mt-new w":"mt-new"},o?e:Ar(e)),m=i("span",{class:o?"mt-old w":"mt-old","aria-hidden":"true"},o?n:Ar(n));o&&(m.style.width=`${b.width+1}px`),t.replaceChildren(d,m),H&&_(t,[{width:`${P}px`},{width:`${O.width}px`}],{duration:U.duration,easing:U.easing,fill:"forwards"});let s=t.getBoundingClientRect(),h=(G,V)=>{m.style.top=`${V}px`,$==="end"?m.style.right=`${-G}px`:$==="middle"?(m.style.left="50%",m.style.translate=`calc(-50% + ${G}px) 0`):m.style.left=`${G}px`},f=$==="end"?b.right-s.right:$==="middle"?(b.left+b.right-s.left-s.right)/2:b.left-s.left;h(f,b.top-s.top);let E=hn(m);if(h(f+b.left-E.left,b.top-s.top+b.top-E.top),o){_(m,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:J,fill:"forwards"}),_(d,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:Y,fill:"backwards"});let G=Math.max(340,H?U.duration:0)+40;ne.set(t,{text:e,timer:window.setTimeout(()=>Ie(t),G)});return}$r(d,B),$r(m,A);let p=[...m.children],l=[...d.children],L=Zo([...n],[...e]),x=new Set(L.map(([G])=>G)),C=new Set(L.map(([,G])=>G));L.forEach(([G,V])=>{let $t=p[G].getBoundingClientRect(),lt=l[V].getBoundingClientRect();p[G].style.visibility="hidden",(Math.abs($t.left-lt.left)>.5||Math.abs($t.top-lt.top)>.5)&&_(l[V],[{transform:`translate(${$t.left-lt.left}px, ${$t.top-lt.top}px)`},{transform:"none"}],{duration:U.duration,easing:U.easing})});let R=p.filter((G,V)=>!x.has(V)),I=l.filter((G,V)=>!C.has(V)),z=Math.min(12,160/Math.max(1,R.length)),Q=Math.min(22,260/Math.max(1,I.length));R.forEach((G,V)=>_(G,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(4px)",transform:"translateY(-0.45em)"}],{duration:220,delay:V*z,easing:J,fill:"forwards"})),I.forEach((G,V)=>_(G,[{opacity:0,filter:"blur(4px)",transform:"translateY(0.45em)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:380,delay:120+V*Q,easing:Y,fill:"backwards"}));let et=Math.max(220+R.length*z,I.length?120+I.length*Q+380:0,H||L.length?U.duration:0)+40;ne.set(t,{text:e,timer:window.setTimeout(()=>Ie(t),et)})}function Fe(t){return new Map([...t.querySelectorAll("[data-t]")].map(e=>[e.dataset.t,ge(e)]))}function Ke(t,e){t.querySelectorAll("[data-t]").forEach(n=>{var a;let r=e.get(n.dataset.t),o=(a=n.textContent)!=null?a:"";r!==void 0&&r!==o&&Z(n,o,r)})}var _r=t=>`${t.tagName}.${[...t.classList].filter(e=>e!=="mt"&&e!=="mt-ib").join(" ")}`,Pr=t=>t.outerHTML.replace(/\bgl\d+/g,"gl");function ti(t){let e=new Map,n=(r,o)=>r.childNodes.forEach((a,c)=>{var M,b;let g=`${o}/${c}`;if(a.nodeType===Node.TEXT_NODE){if((M=a.textContent)!=null&&M.trim()){let A=document.createRange();A.selectNodeContents(a);let O=A.getBoundingClientRect();e.set(g,{kind:"#text",text:a.textContent,svg:"",at:O,words:O,node:a})}return}if(!(a instanceof Element))return;let v=a instanceof SVGElement?Pr(a):"",u=a instanceof HTMLElement&&!v?hn((b=a.querySelector(":scope > .mt-new"))!=null?b:a):null;e.set(g,{kind:_r(a),text:a instanceof HTMLElement?ge(a):"",svg:v,at:a.getBoundingClientRect(),words:u,node:a}),v||n(a,g)});return n(t,""),e}var pn=t=>_(t,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:Y,fill:"backwards"});function qe(t,e){var O;let n=ti(t),r=t.getBoundingClientRect();if(Rt(t,e),!n.size||Lt())return;let o=t.getBoundingClientRect(),a=B=>B&&new DOMRect(B.left-r.left+o.left,B.top-r.top+o.top,B.width,B.height),c=[],g=[],v=new Set,u=(B,P,H)=>{var m;let $=B.parentElement,d=H?(m=n.get(H))==null?void 0:m.at:r;P!=null&&P.at&&P.node instanceof Element&&g.push($&&d?[P.node,P.at,$,d]:[P.node,P.at,t,r]),c.push(()=>pn(B))},M=(B,P,H)=>{let $=B.getBoundingClientRect(),d=P.left-r.left-($.left-o.left),m=P.top-r.top-($.top-o.top),s=d-H[0],h=m-H[1];return(Math.abs(s)>.5||Math.abs(h)>.5)&&_(B,[{transform:`translate(${s}px, ${h}px)`},{transform:"none"}],{duration:U.duration,easing:U.easing}),[d,m]},b=(B,P,H)=>[...B.childNodes].forEach(($,d)=>{var E,p;let m=`${P}/${d}`;v.add(m);let s=n.get(m);if($.nodeType===Node.TEXT_NODE){let l=(E=$.textContent)!=null?E:"";if(!l.trim()||(s==null?void 0:s.kind)==="#text"&&s.text===l)return;let L=i("span",{},l);$.replaceWith(L),s!=null&&s.at&&M(L,s.at,H),c.push(()=>{var x;return(s==null?void 0:s.kind)==="#text"&&l.length<=40&&s.text.length<=40?Z(L,l,s.text,{whole:!0,at:(x=a(s.words))!=null?x:void 0}):pn(L)});return}if(!($ instanceof Element))return;let h=$.getBoundingClientRect();if(!s||s.kind!==_r($)||s.at&&Math.abs(s.at.height-h.height)>1&&!($ instanceof SVGElement))return u($,s,P);let f=s.at?M($,s.at,H):H;if($ instanceof SVGElement){s.svg!==Pr($)&&c.push(()=>pn($));return}if(!$.children.length&&$ instanceof HTMLElement){let l=(p=$.textContent)!=null?p:"";l!==s.text&&c.push(()=>{var L;return l.length<=40&&s.text.length<=40?Z($,l,s.text,{whole:!0,at:(L=a(s.words))!=null?L:void 0}):u($,s,P)});return}b($,m,f)});b(t,"",[0,0]);for(let[B,P]of n)!v.has(B)&&B.lastIndexOf("/")===0&&P.at&&P.node instanceof Element&&g.push([P.node,P.at,t,r]);c.forEach(B=>B());let A=new Map;for(let[,,B]of g)!A.has(B)&&getComputedStyle(B).position==="static"&&B.classList.add("mt"),A.set(B,((O=A.get(B))!=null?O:0)+1);for(let[B,P,H,$]of g){let d=B;d.style.position="absolute",d.style.margin="0",d.style.left=`${P.left-$.left-H.clientLeft}px`,d.style.top=`${P.top-$.top-H.clientTop}px`,d.style.width=`${P.width}px`,d.style.pointerEvents="none",d.setAttribute("aria-hidden","true"),H.appendChild(d),_(d,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:J,fill:"forwards"}).onfinish=()=>{d.remove();let m=A.get(H)-1;A.set(H,m),m||H.classList.remove("mt")}}}var ei='',fn=()=>[F("apple"),_t(ei)];function ni(t,e){if(t===e)return["",t,t,""];let n=t.split(" "),r=e.split(" "),o=0;for(;ov?d[2]:d[1],M=d=>i("span",{class:"osm-p"},d),b=()=>{c=o.findIndex(d=>d[1]!==d[2]),c<0&&(v=0),a=o.map(d=>({pre:M(d[0]),word:M(u(d)),suf:M(d[3])})),g=c>=0?i("span",{class:"osm-ic"},fn()[v]):null,n.replaceChildren(...a.flatMap((d,m)=>[m?i("span",{class:"arr"},"›"):null,d.pre,m===c?g:null,d.word,d.suf]).filter(d=>!!d))},A={width:"1.05em",marginRight:"0.25em"},O=d=>_(d,[{opacity:1,filter:"blur(0px)",...A},{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"}],{duration:220,easing:J,fill:"forwards"}).onfinish=()=>d.remove(),B=d=>_(d,[{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"},{opacity:1,filter:"blur(0px)",...A}],{duration:U.duration,easing:U.easing}),P=(d,m)=>{r.setAttribute("aria-label",(d===m?d:`${d} (Android: ${m.split(" → ").pop()})`).replace(/ → /g," › "));let s=d.split(" → "),h=m.split(" → "),f=s.map((p,l)=>{var L;return ni(p,(L=h[l])!=null?L:p)});if(!a.length||f.length!==o.length)return o=f,b();let E=c;o=f,c=o.findIndex(p=>p[1]!==p[2]),c<0&&(v=0),o.forEach((p,l)=>{Z(a[l].pre,p[0],void 0,{whole:!0}),Z(a[l].word,u(p),void 0,{whole:!0}),Z(a[l].suf,p[3],void 0,{whole:!0})}),c!==E&&(g&&O(g),g=c>=0?i("span",{class:"osm-ic"},fn()[v]):null,g&&(a[c].word.before(g),B(g)))};P(t,e);let H=()=>{if(!r.isConnected)return clearInterval($);if(c<0||!g||!r.offsetParent)return;v=1-v,Z(a[c].word,u(o[c]));let d=g.firstElementChild,m=fn()[v];if(Lt()){d.replaceWith(m);return}g.appendChild(m),_(d,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(-40deg)"}],{duration:200,easing:J,fill:"forwards"}).onfinish=()=>d.remove(),_(m,[{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(40deg)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:yt.duration,delay:80,easing:yt.easing,fill:"backwards"})},$=window.setInterval(H,3e3);return{el:r,set:P}}var Ge=null,ve=null,Br=0,Hr=(t,e,n)=>_(t,e,{duration:n,easing:J,fill:"forwards"}).onfinish=()=>t.remove();function wt(t,e=!1){Ge!=null||(Ge=document.body.appendChild(i("div",{class:"toasts"}))),ve&&Hr(ve,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(4px)"}],140);let n=i("div",{class:`toast${e?" bad":""}`,role:"status"},F(e?"alert":"check"),i("span",{},t));Ge.appendChild(n),ve=n,_(n,[{opacity:0,transform:"translateY(18px) scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:kt.duration,easing:kt.easing}),clearTimeout(Br),Br=window.setTimeout(()=>{ve===n&&(ve=null,Hr(n,[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.96)",filter:"blur(4px)"}],180))},2400)}function ri(t){var a;if(t.classList.contains("copied"))return;let e=t.querySelector("svg.i"),n=t.querySelector(".lbl, .b-main"),r=n?ge(n):"";t.classList.add("copied");let o=null;e&&(o=F("check",(a=e.getAttribute("class"))!=null?a:"i"),e.replaceWith(o),_(o,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:yt.duration,easing:yt.easing})),n&&/^Copy/.test(r)&&Z(n,"Copied"),setTimeout(()=>{o&&e&&o.replaceWith(e),n&&/^Copy/.test(r)&&Z(n,r),t.classList.remove("copied")},1600)}async function pt(t,e="Copied",n){try{await navigator.clipboard.writeText(t)}catch{let r=i("textarea",{class:"offscreen"},t);document.body.appendChild(r),r.select();let o=document.execCommand("copy");if(r.remove(),!o)return wt("Copying is blocked here. Select the text and copy it by hand.",!0)}n instanceof Element&&ri(n),wt(e)}function Wt(t,e){var o;let n=navigator;if(He()!=="ios"||typeof n.share!="function"||typeof File=="undefined")return null;let r=new File([e],t,{type:"application/octet-stream"});return(o=n.canShare)!=null&&o.call(n,{files:[r]})?async()=>{try{await n.share({files:[r]})}catch(a){(a==null?void 0:a.name)!=="AbortError"&&Ue(t,e)}}:null}function Ue(t,e){let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"})),r=i("a",{href:n,download:t,class:"offscreen"});document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.remove()},1e3)}function ye(t,e){let n=Wt(t,e);n?n():Ue(t,e)}async function zt(t,e){if(t.disabled)return;t.disabled=!0,Lr(t);let n=performance.now();try{await e()}finally{let r=Lt()?0:Cr-(performance.now()-n);r>0&&await new Promise(o=>setTimeout(o,r)),Tr(t),t.disabled=!1}}var mn=matchMedia("(prefers-color-scheme: light)"),oi=()=>mn.matches?"day":"night";function gn(t,e){var n,r;t.dataset.qr=e,t.classList.toggle("dense",dn(e)),t.classList.toggle("light",mn.matches),t.innerHTML=xr(e,3,!0,oi()),t.dataset.mods=String((r=(n=t.firstElementChild)==null?void 0:n.viewBox.baseVal.width)!=null?r:0)}function xe(t,e=!1){let n=i("div",{class:`qrbox${e?" big":""}`});return gn(n,t),n}mn.addEventListener("change",()=>document.querySelectorAll(".qrbox[data-qr]").forEach(t=>{var e;(e=t.querySelector("svg.old"))==null||e.remove(),gn(t,t.dataset.qr)}));function vn(t,e){let n=xe(t),r=i("div",{class:"words"},e),o=i("div",{class:"side"},r),a=i("div",{class:`coderow${n.classList.contains("dense")?" stacked":""}`},n,o);return{el:a,swap(c,g){let v=n.dataset.qr===c?null:n.querySelector("svg");if(v){gn(n,c),a.classList.toggle("stacked",n.classList.contains("dense"));let M=n.querySelector("svg");v.classList.add("old"),n.appendChild(v),_(M,[{opacity:0},{opacity:1}],{duration:200,easing:Y}),_(v,[{opacity:1},{opacity:0}],{duration:220,delay:110,easing:J,fill:"forwards"}).onfinish=()=>v.remove()}if(!g)return;let u=r;r=i("div",{class:"words"},g),o.appendChild(r),u.classList.add("old"),_(r,[{opacity:0,filter:"blur(3px)"},{opacity:1,filter:"blur(0px)"}],{duration:220,easing:Y}),_(u,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(3px)"}],{duration:200,delay:90,easing:J,fill:"forwards"}).onfinish=()=>u.remove()}}}function re(t){let e=typeof navigator.share=="function";return i("div",{class:"linkrow"},i("span",{class:"mono"},t.replace(/^https?:\/\//,"")),i("button",{type:"button",class:"knob","aria-label":"Copy the link",onclick:n=>pt(t,"Link copied",n.currentTarget)},F("copy")),e?i("button",{type:"button",class:"knob","aria-label":"Share the link",onclick:()=>navigator.share({url:t,title:Ut()}).catch(()=>{})},F("share")):null)}var Vt=null,Dt=null,be=()=>!!Vt;function Bt(t=!1){let e=Vt;if(e){if(Vt=null,Dt==null||Dt.setAttribute("aria-expanded","false"),Dt=null,t){e.remove();return}_(e,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(3px)"}],{duration:120,easing:J,fill:"forwards"}).onfinish=()=>e.remove()}}function Or(t,e){var u;if(Dt===t&&Vt)return Bt();Bt(!0);let n=e.filter((M,b)=>M||b>0&&e[b-1]&&e.slice(b+1).some(Boolean)),r=i("span",{class:"menu-hl"}),o=i("div",{class:"menu",role:"menu"},r);for(let M of n){if(!M){o.appendChild(i("div",{class:"menu-sep"}));continue}let b=i("button",{type:"button",role:"menuitem",class:`mi ${(u=M.tone)!=null?u:""}`,onclick:()=>{Bt(),M.run()}},F(M.icon),i("span",{},M.label));b.addEventListener("pointerenter",()=>{var A;r.className=`menu-hl${r.style.opacity==="1"?" moving":""} ${(A=M.tone)!=null?A:""}`,r.style.transform=`translateY(${b.offsetTop-6}px)`,r.style.opacity="1"}),o.appendChild(b)}o.addEventListener("pointerleave",()=>r.style.opacity="0"),document.body.appendChild(o);let a=t.getBoundingClientRect(),c=o.offsetWidth,g=o.offsetHeight,v=a.bottom+8+g{let e=t.target;Vt&&!Vt.contains(e)&&!(Dt!=null&&Dt.contains(e))&&Bt()});addEventListener("scroll",()=>Bt(),{passive:!0});var st,At,W,Rr,ae,Ft,rt,It=[],We=null,yn=null,we=!1,oe=null,St=()=>!!(st!=null&&st.classList.contains("open")),se=400,Nr=80,ii=3.2,le=()=>matchMedia("(min-width: 760px)").matches,ie=se,xn=null;function ce(){var o;if(!st||!St())return null;if(!le())return W.style.maxWidth&&(W.style.maxWidth=""),ie=se,null;let t=[...rt.querySelectorAll(".qrbox.dense")].find(a=>{let c=a.closest(".acc-row");return a.offsetWidth&&(!c||c.classList.contains("open"))&&!a.closest(".leaving")}),e=se;if(t){let a=Math.min(innerWidth-32-Nr,innerHeight-120);e=Math.max(se,Math.round(Math.min(+((o=t.dataset.mods)!=null?o:0)*ii,a)+Nr))}let n=t&&t!==xn?t:null;if(xn=t!=null?t:null,Math.abs(e-ie)<8)return n?{from:e,want:e,reveal:n}:null;let r=parseFloat(getComputedStyle(W).maxWidth)||ie;return ie=e,W.getAnimations().filter(a=>{var c;return(c=a.effect)==null?void 0:c.getKeyframes().some(g=>"maxWidth"in g)}).forEach(a=>a.cancel()),W.style.maxWidth=`${e}px`,{from:r,want:e,reveal:n}}function de(t){if(!t)return;Math.abs(t.from-t.want)>1&&_(W,[{maxWidth:`${t.from}px`},{maxWidth:`${t.want}px`}],{duration:U.duration,easing:U.easing});let e=t.reveal;e&&setTimeout(()=>{if(!e.isConnected)return;let n=Ft.getBoundingClientRect(),r=e.getBoundingClientRect(),o=r.bottom>n.bottom-16?r.bottom-n.bottom+16:r.topft()},F("x")),ae=i("div",{class:"sheet-acts"}),rt=i("div",{class:"vp"}),Ft=i("div",{class:"sheet-scroll"},rt),W=i("div",{class:"sheet",role:"dialog","aria-modal":"true"},Rr,ae,Ft),At=i("div",{class:"scrim",onclick:()=>ft()}),st=i("div",{class:"sheet-root","aria-hidden":"true"},At,W),document.body.appendChild(st),new ResizeObserver(()=>de(ce())).observe(rt),li()}function Ir(t){W.setAttribute("aria-label",t.label),W.setAttribute("role",t.asks?"alertdialog":"dialog")}function ze(){let t=yn;yn=null,t==null||t()}function Fr(t){yn=t}function Yt(t){We=t}function ht(t){if(st||ai(),Bt(!0),ze(),St()){It=[t],bn(t());return}oe=document.activeElement instanceof HTMLElement?document.activeElement:null,It=[t],We=null,ie=se,xn=null,W.style.maxWidth="",W.classList.remove("arrived");let e=t();rt.replaceChildren(e.el),Kr(e,!1),Ir(e),st.classList.add("open"),st.setAttribute("aria-hidden","false"),document.body.classList.add("locked");let n=ce();if(n&&de({...n,from:n.want}),W.getAnimations().forEach(r=>r.cancel()),At.getAnimations().forEach(r=>r.cancel()),W.style.transform="",le()?_(W,[{opacity:0,transform:"scale(.9)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Et.duration,easing:Et.easing}):_(W,[{transform:"translateY(calc(100% + 40px))"},{transform:"none"}],{duration:500,easing:an}),_(At,[{opacity:0},{opacity:1}],le()?{duration:Et.duration,easing:Et.easing}:{duration:420,easing:"ease-out"}),!we)try{history.pushState({sheet:!0},""),we=!0}catch{}}function ft(t=!1){if(!St()||st.dataset.closing)return;ze(),we&&(we=!1,history.back()),document.body.classList.remove("locked");let e=()=>{st.classList.remove("open"),st.setAttribute("aria-hidden","true"),delete st.dataset.closing,W.style.transform="",At.style.opacity="",W.getAnimations().forEach(a=>a.cancel()),At.getAnimations().forEach(a=>a.cancel()),rt.getAnimations().forEach(a=>a.cancel()),rt.replaceChildren(),ae.replaceChildren(),W.classList.remove("arrived"),W.style.maxWidth="",ie=se,It=[],oe!=null&&oe.isConnected&&oe.focus({preventScroll:!0}),oe=null;let o=We;We=null,o==null||o()};if(t)return e();st.dataset.closing="1";let n=getComputedStyle(W).transform;W.getAnimations().forEach(o=>o.cancel()),_(At,[{opacity:getComputedStyle(At).opacity},{opacity:0}],le()?{duration:120,easing:J,fill:"forwards"}:{duration:320,easing:"ease-out",fill:"forwards"});let r=n==="none"?"none":n;_(W,le()?[{opacity:1,transform:r,filter:"blur(0px)"},{opacity:0,transform:`${r==="none"?"":r} scale(.96)`.trim(),filter:"blur(3px)"}]:[{transform:r},{transform:"translateY(calc(100% + 40px))"}],le()?{duration:120,easing:J,fill:"forwards"}:{duration:420,easing:an,fill:"forwards"}).onfinish=e}addEventListener("popstate",()=>{St()&&(we=!1,ft())});function Kr(t,e=!0){var o;let n=(o=t.acts)!=null?o:null,r=ae.firstElementChild;if(n!==r){if(!e||r&&n&&r.dataset.key===n.dataset.key)return ae.replaceChildren(...n?[n]:[]);r&&(Object.assign(r.style,{position:"absolute",right:"0",top:"0",pointerEvents:"none"}),_(r,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(3px)"}],{duration:180,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>r.remove()),n&&(ae.appendChild(n),_(n,[{opacity:0,transform:"scale(.9)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:260,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"}))}}function bn(t){Ir(t),Kr(t),W.classList.remove("arrived");let e=[...rt.children],n=rt.getBoundingClientRect().height;rt.getAnimations().forEach(a=>a.cancel()),e.forEach(a=>{a.classList.add("leaving"),Object.assign(a.style,{position:"absolute",left:"0",right:"0",top:"0",pointerEvents:"none"}),a.inert=!0}),rt.appendChild(t.el),t.el.style.pointerEvents="none",setTimeout(()=>t.el.style.pointerEvents="",320),Ft.scrollTop=0;let r=ce(),o=t.el.getBoundingClientRect().height;_(rt,[{height:`${n}px`},{height:`${o}px`}],{duration:360,easing:"cubic-bezier(.25,1,.5,1)"}),de(r),e.forEach(a=>_(a,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.96)",filter:"blur(2px)"}],{duration:200,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>a.remove()),_(t.el,[{opacity:0,transform:"scale(.96)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:280,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"})}function Ve(t){if(!St())return ht(t);ze(),It.push(t),bn(t())}function si(){It.length<2||(ze(),It.pop(),bn(It[It.length-1]()))}function qr(t,e=[]){if(!St())return t();let n=rt.getBoundingClientRect().height;rt.getAnimations().forEach(v=>v.cancel());let r=rt.lastElementChild,o=new Map;r==null||r.querySelectorAll("*").forEach(v=>{(!(v instanceof SVGElement)||v instanceof SVGSVGElement)&&o.set(v,v.getBoundingClientRect())}),t();let a=ce(),c=rt.getBoundingClientRect().height;Math.abs(c-n)>1&&_(rt,[{height:`${n}px`},{height:`${c}px`}],{duration:U.duration,easing:U.easing}),de(a);let g=new Set;for(let[v,u]of o){if(!v.isConnected||!u.width||!u.height)continue;let M=v.getBoundingClientRect();if(!M.width||!M.height)continue;let b=u.left-M.left,A=u.top-M.top;if(Math.abs(b)<.5&&Math.abs(A)<.5)continue;g.add(v);let O=v.parentElement;for(;O&&O!==r&&!g.has(O);)O=O.parentElement;O&&O!==r||_(v,[{transform:`translate(${b}px, ${A}px)`},{transform:"none"}],{duration:U.duration,easing:U.easing})}for(let v of e)v&&_(v,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:Y})}function Gr(){W==null||W.classList.add("arrived")}var Ur=()=>Ft==null?void 0:Ft.scrollTo({top:0,behavior:"smooth"}),wn=t=>St()&&rt.contains(t)&&!t.closest(".leaving");function li(){let t=null;W.addEventListener("pointerdown",n=>{let r=n.target;!r.closest(".vhead")||r.closest("button, a, input")||(t={y:n.clientY,t:performance.now(),dy:0,v:0},W.setPointerCapture(n.pointerId))}),W.addEventListener("pointermove",n=>{if(!t)return;let r=n.clientY-t.y,o=performance.now(),a=r>0?r:-qn(-r,W.offsetHeight);t.v=(a-t.dy)/Math.max(1,o-t.t),t.dy=a,t.t=o,W.style.transform=`translateY(${a}px)`,At.style.opacity=String(Math.max(0,1-Math.max(0,a)/420))});let e=()=>{if(!t)return;let{dy:n,v:r}=t;if(t=null,Gn(n,r,W.offsetHeight))return ft();let o=W.style.transform;W.style.transform="",At.style.opacity="",n!==0&&_(W,[{transform:o},{transform:"none"}],{duration:U.duration,easing:U.easing})};W.addEventListener("pointerup",e),W.addEventListener("pointercancel",e)}function Ct(t,e={}){return i("div",{class:`vhead${e.back?" center":""}${e.acts?" with-acts":""}`},e.back?i("button",{type:"button",class:"knob back","aria-label":"Back",onclick:si},F("chevron")):null,i("h2",{},t))}var Ht=t=>i("p",{class:"vsub"},t),Kt=(...t)=>i("p",{class:"hint"},...t);function Wr(){ht(()=>{let t=Zt();return{el:i("div",{class:"view"},Ct("Open on another device"),Ht("Point its camera at the code: this page opens there."),xe(t,!0),re(t)),label:"Open on another device"}})}var ci='',je=null,Me=null,Ye=null;function Mn(t){if(Me)return Me;je=i("header",{class:"crumbs"}),Me=i("div",{class:"page-body"}),t.replaceChildren(i("div",{class:"edge-fade top","aria-hidden":"true"}),i("div",{class:"edge-fade bot","aria-hidden":"true"}),Ye=i("main",{class:"page"},je,Me));let e=()=>document.body.classList.toggle("scrolled",scrollY>2);return addEventListener("scroll",e,{passive:!0}),e(),Me}function Cn(t){Ye==null||Ye.classList.toggle("single",t)}function kn(t=!1,e=!1){var o;if(!je)return;let n=t?null:(o=dt())==null?void 0:o.person,r=i("span",{class:n?"":"cur","aria-current":n?null:"page"},Ut());je.replaceChildren(i("span",{class:"cr-mark"},_t(ci)),i("nav",{class:"cr-path","aria-label":"Breadcrumb"},r,n?[F("chevron"),i("span",{class:"cur","aria-current":"page"},n.name)]:null),...n&&!e?[i("button",{type:"button",class:"knob cr-qr","aria-label":"Open on another device",onclick:Wr},F("qr"))]:[])}function Vr(t,e,n=10){let r=g=>(Tt(g).getDay()+6)%7,o=Xt(t,-r(t)),a=Xt(e,6-r(e)),c=[];for(let g=o;g<=a;g=Xt(g,1))if(c.push({day:g,kind:gn*7)return null;return c}var di=/^([01]?\d|2[0-3]):([0-5]\d)$/;function zr(t){let e=di.exec(t.trim());return e?+e[1]*60+ +e[2]:null}var Ce=t=>(t%1440+1440)%1440,jt=t=>`${String(Math.floor(Ce(t)/60)).padStart(2,"0")}:${String(Ce(t)%60).padStart(2,"0")}`;function Qe(t,e,n){let[r,o]=t.split("-"),a=zr(r!=null?r:""),c=zr(o!=null?o:"");if(a==null||c==null)return null;let g=e==null?0:n-e;return{from:Ce(a+g),to:Ce(c+g),yours:e!=null}}var Yr=t=>t.fromCe(Math.floor(t/60)+e);function Qr(t){let e=Tt(t);return{days:new Date(e.getFullYear(),e.getMonth()+1,0).getDate(),day:e.getDate()}}var Xr={phone:{b:'',f:'',d:''},mobile:{b:'',f:'',d:''},tablet:{b:'',f:'',d:''},computer:{b:'',f:'',d:''},router:{b:'',f:'',d:''},other:{b:'',f:'',d:""},plus:{b:'',f:'',d:''},globe:{b:'',f:'',d:''},home:{b:'',f:'',d:''},shield:{b:'',f:'',d:''},chart:{b:'',f:'',d:''},calendar:{b:'',f:'',d:''},clock:{b:'',f:'',d:''},pause:{b:'',f:'',d:''},server:{b:'',f:'',d:''},link:{b:'',f:'',d:''},key:{b:'',f:'',d:''},lock:{b:'',f:'',d:''},check:{b:'',f:'',d:''},trash:{b:'',f:'',d:''},refresh:{b:'',f:'',d:''},app:{b:'',f:'',d:null},file:{b:'',f:'',d:''}},ui=()=>Se("amnezia","").replace(/^]*>/,"").replace(/<\/svg>$/,""),pi=0;function fi(t,e="grey",n="gi"){var c;let r=(c=Xr[t])!=null?c:Xr.other,o=`gl${++pi}`,a=r.d===null?`${ui()}`:`${r.d}`;return``}var j=(t,e="grey",n="gi")=>_t(fi(t,e,n));function Xe(t,e,n,r){return i("div",{class:`notice ${t}`},j(e,t==="bad"?"red":"orange"),i("div",{class:"t"},n?i("b",{},n):null,i("span",{},r)))}function hi(t){var n;let e=Qe(t,(n=dt())==null?void 0:n.tz_offset,-new Date().getTimezoneOffset());return e?`${jt(e.from)}–${jt(e.to)} ${e.yours?"your time":"(router time)"}`:`${t.replace("-","–")} (router time)`}function En(t){switch(t.state){case"server_off":return["server","Server is disabled","Your devices can’t connect until it’s enabled again."];case"no_server":return["server","No server yet","You haven’t been added to one."];case"quota":return["chart","Out of data","Nothing gets through until it resets."];case"expired":return["calendar","Access ended","Your devices can’t connect until it’s extended."];case"hours":return["clock","Outside your hours",`Open ${hi(t.hours)}.`];default:return["pause","Access paused","Your devices can’t connect until it’s resumed."]}}function Jr(t){if(t.state!=="active")return Xe(t.state==="quota"||t.state==="expired"?"bad":"warn",...En(t));let e=_e(t.expires,Pt());return fe(t,e)?Xe("warn","calendar",`Access ${Wn(e)}`,`On ${pe(t.expires)}.`):null}function mi(t){let e=i("div",{class:"view"},Ct("Open the link securely"),Ht("Connection settings only travel encrypted"),i("div",{class:"center-col secure"},j("lock","blue","gi xl"),i("p",{},"This page is open without encryption. To add or set up a device, open the same link over HTTPS:")),i("a",{class:"btn accent block",href:t},F("lock"),i("span",{},"Open securely")),Kt("The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”)."));return e.lastElementChild.classList.add("secure-note"),{el:e,label:"Open the link securely"}}var ke=t=>ht(()=>mi(t));function ue(){let t=dr();return t?(ke(t),!0):!1}var gi={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},vi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function yi(t){let e={};for(let[n,r]of Object.entries(vi))t[n]!=null&&t[n]!==""&&(e[r]=String(t[n]));return e}function xi(t,e){var v;let n=t.amnezia,r=(v=n.obfuscation)!=null?v:{},o=u=>r[u]!=null&&r[u]!==""?String(r[u]):gi[u],a=n.host.replace(/^\[(.*)\]$/,"$1"),c={H1:o("h1"),H2:o("h2"),H3:o("h3"),H4:o("h4"),I1:o("i1"),I2:o("i2"),I3:o("i3"),I4:o("i4"),I5:o("i5"),Jc:o("jc"),Jmin:o("jmin"),Jmax:o("jmax"),S1:o("s1"),S2:o("s2"),S3:o("s3"),S4:o("s4"),...yi(r),allowed_ips:n.allowed_ips,client_ip:n.client_ip,client_priv_key:n.client_priv_key,client_pub_key:n.client_pub_key,config:t.conf.replace(/\r?\n/g,`\r -`),hostName:a,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},g={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(c),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return n.dns[0]&&(g.dns1=n.dns[0]),n.dns[1]&&(g.dns2=n.dns[1]),g}function bi(t){let e="";for(let n=0;nt.replace(/^vpn:\/\//,"");var to=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function qt(t,e={}){let n=i("div",{class:`acc${e.inset?" inset":""}`}),r=t.map((u,M)=>{var $;let b=u.body.filter(d=>!!d),A=!b.length,O=[u.icon,i("span",{class:"acc-title"},i("span",{class:"t"},u.title),($=u.tag)!=null?$:null),u.val?i("span",{class:`acc-val${u.valHide?" hide-open":""}`},u.val):null],B=M===e.open&&!A,P=A?i("div",{class:"acc-head"},...O):i("button",{type:"button",class:"acc-head","aria-expanded":String(B),onclick:()=>v(H)},...O,F("chevron","i acc-chev")),H=i("div",{class:`acc-row${A?" still":""}${B?" open":""}`},P,i("div",{class:"acc-body"},...b));return n.appendChild(H),H}),o=u=>u.querySelector(".acc-body"),a=()=>r.forEach((u,M)=>{let b=u.classList.contains("open");u.classList.toggle("rt",M===0||b||r[M-1].classList.contains("open")),u.classList.toggle("rb",M===r.length-1||b||r[M+1].classList.contains("open"))}),c=u=>{let M=getComputedStyle(u),b={};for(let A of to)b[A]=A==="height"?`${u.getBoundingClientRect().height}px`:M[A];return b},g=()=>r.forEach(u=>{var M;return(M=u.querySelector("button.acc-head"))==null?void 0:M.setAttribute("aria-expanded",String(u.classList.contains("open")))});function v(u){var B;let M=r.map(c);r.forEach(P=>P.getAnimations().forEach(H=>H.cancel())),r.forEach(P=>o(P).getAnimations().forEach(H=>H.cancel()));let b=!u.classList.contains("open"),A=r.filter(P=>P.classList.contains("open")&&(P===u||b));r.forEach(P=>{P.classList.remove("closing"),P!==u&&P.classList.remove("open")}),u.classList.toggle("open",b),a();let O=ce();r.forEach((P,H)=>{let $=c(P);to.some(d=>M[H][d]!==$[d])&&(A.includes(P)&&P.classList.add("closing"),_(P,[M[H],$],{duration:Et.duration,easing:Et.easing}).onfinish=()=>P.classList.remove("closing"))}),A.forEach(P=>_(o(P),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:J,fill:"forwards"})),b&&_(o(u),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),de(O),g(),(B=e.onToggle)==null||B.call(e,r.indexOf(u),b,!1)}return a(),{el:n,openIndex:()=>r.findIndex(u=>u.classList.contains("open")),setOpen(u){r.forEach((M,b)=>M.classList.toggle("open",b===u&&!M.classList.contains("still"))),a(),g(),r.forEach((M,b)=>{var A;return(A=e.onToggle)==null?void 0:A.call(e,b,M.classList.contains("open"),!0)})}}}function eo(t,e,n){let r=i("span",{class:"seg-pill"}),o=i("div",{class:"seg appseg",role:"tablist"},r),a=t.map(A=>{let O=i("button",{type:"button",class:"seg-b",role:"tab","aria-label":A.label,title:A.label,onclick:()=>b(A.value)},F(A.icon),i("span",{class:"seg-l"},A.label));return O.dataset.v=A.value,o.appendChild(O),O}),c=A=>A.querySelector(".seg-l"),g=()=>a.forEach(A=>{let O=A.dataset.v===e;A.classList.toggle("on",O),A.setAttribute("aria-selected",String(O))}),v=()=>{let A=a.find(O=>O.dataset.v===e);return A&&A.offsetWidth?[A.offsetLeft,o.clientWidth-A.offsetLeft-A.offsetWidth]:null},u=()=>{let A=v();A&&(r.style.left=`${A[0]}px`,r.style.right=`${A[1]}px`)},M=0;function b(A){if(A===e)return;let O=a.findIndex(C=>C.dataset.v===e),B=a.findIndex(C=>C.dataset.v===A),P=getComputedStyle(r),H=parseFloat(P.left)||0,$=parseFloat(P.right)||0,d=a.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),m=c(a[O]),s=m.getBoundingClientRect().width;[...a,...a.map(c)].forEach(C=>C.getAnimations().forEach(R=>R.cancel())),e=A,g(),a.forEach((C,R)=>{let I=R===B?1:0;d[R]!==I&&_(C,[{flexGrow:d[R]},{flexGrow:I}],{duration:U.duration,easing:U.easing})}),_(m,[{opacity:1,maxWidth:`${s}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),_(c(a[B]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:Y,fill:"backwards"});let h=B>O,f=Lt()?U:Fn,E=performance.now(),p=Math.max(U.duration,f.duration),l=h?U:f,L=h?f:U;cancelAnimationFrame(M);let x=()=>{let C=Lt()?p:performance.now()-E,R=v();if(!R){M=0;return}r.style.left=`${H+(R[0]-H)*l.at(C)}px`,r.style.right=`${$+(R[1]-$)*L.at(C)}px`,M=C{M||u()}).observe(o),{el:o,sync(A){A!==e&&(e=A,g(),u())}}}var oo={vpn:"amnezia",awg:"amneziawg",wg:"wireguard"},io=t=>`dl.app.${t.id}`;function ao(t){try{let e=localStorage.getItem(io(t));return e==="vpn"||e==="awg"||e==="wg"?e:null}catch{return null}}function so(t,e){try{localStorage.setItem(io(t),e)}catch{}}function Gt(t,e=!1){var a,c;let n=[i("span",{class:"b-ic"},F(t.mark)),i("span",{class:"b-t"},i("span",{class:"b-top"},t.top),i("span",{class:"b-main"},t.main)),F(t.onclick||(a=t.href)!=null&&a.startsWith("vpn:")?"chevron":"open")],r=`badge${e?" primary":""}`;if(t.onclick)return i("button",{type:"button",class:r,onclick:t.onclick},n);let o=(c=t.href)==null?void 0:c.startsWith("vpn:");return i("a",{class:r,href:t.href,target:o?null:"_blank",rel:"noopener noreferrer"},n)}function lo(t,e,n){let r=n?Zn(t):Jn(t,e);return r?r.alt?[i("div",{class:"badges2"},Gt(r),Gt(r.alt)),Kt(r.alt.why)]:[Gt(r)]:[Kt(`Get ${at[t]} on the ${er[e]} and come back here.`)]}var no=t=>i("ol",{class:"howto"},t.map(([e,n])=>i("li",{},e.replace(/ → $/," ›"),n?[" ",i("b",{},n)]:null))),Mi=(t,e)=>i("button",{type:"button",onclick:e},t);function co(t){let e=t.app(),n=at[e],r=t.pf==="ios"||t.pf==="android",o=t.same()&&r,a=v=>pt(t.key,"Key copied",v.currentTarget),c=e==="vpn"&&o&&!ln(t.pf)?Wt(he(t.cfg.filename),t.key):null;if(e==="vpn"&&o&&(ln(t.pf)||c))return[Gt(c?{top:"Then come back here and tap",main:"Send to AmneziaVPN",mark:"amnezia",onclick:()=>void c()}:{href:t.key,top:"Then come back here and tap",main:"Open in AmneziaVPN",mark:"amnezia"},!0),Kt(c?"Pick AmneziaVPN in the share sheet. Not there? ":"Nothing opened? ",Mi("Copy the key",a)," and add it in the app.")];if(e==="vpn")return[Gt({top:"The connection as one key",main:"Copy the key",mark:"copy",onclick:a},!0),no([["Open AmneziaVPN",""],["Add server › ","Insert key"],["Paste the key and connect",""]])];let g=r?Wt(t.cfg.filename,t.cfg.conf):null;return[Gt(g?{top:t.same()?`Straight into ${n}`:`Send it to the ${t.there}`,main:"Share the file",mark:"share",onclick:()=>void g()}:{top:"Then import it in the app",main:"Download the file",mark:"download",onclick:()=>Ue(t.cfg.filename,t.cfg.conf)},!0),no(tr(e,t.pf,t.cfg.filename,!!g&&t.same()))]}function uo(t){let e=t.app(),n=(o,a,c)=>i("button",{type:"button",class:"btn soft sm",onclick:c},F(o),i("span",{class:"lbl"},a));if(e==="vpn"){let o=he(t.cfg.filename),a=!!Wt(o,t.key);return[i("p",{class:"desc"},`Send it to the ${t.there} in a message or a note, then in AmneziaVPN: Add server › Insert key.`),i("div",{class:"btnrow2"},n("copy","Copy the key",c=>pt(t.key,"Key copied",c.currentTarget)),n(a?"share":"download",a?"Share as a file":"Download the key",()=>ye(o,t.key)))]}let r=!!Wt(t.cfg.filename,t.cfg.conf);return[i("p",{class:"desc"},`Send it to the ${t.there}, then import `,i("b",{},t.cfg.filename),` in ${at[e]}.`),i("div",{class:"btnrow2"},n(r?"share":"download",r?"Share the file":"Download the file",()=>ye(t.cfg.filename,t.cfg.conf)),n("copy","Copy the configuration",o=>pt(t.cfg.conf,"Configuration copied",o.currentTarget)))]}function ro(t,e){if(/^\s*\[.+\]\s*$/.test(t))return i("span",{class:"sec"},t);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(t);if(!n)return document.createTextNode(t);let r=/^(\s*)(PrivateKey|PresharedKey)\b/.test(t);return i("span",{},i("span",{class:"k"},n[1])," ",r&&!e?i("span",{class:"mask"},"••••••••••••••••"):n[2])}function po(t){let e=!1,n=i("pre",{class:"conf"}),r=()=>n.replaceChildren(...t.conf.split(` -`).flatMap((u,M)=>M?[` -`,ro(u,e)]:[ro(u,e)]));r();let o=!!Wt(t.filename,t.conf),a=i("button",{type:"button",class:"btn soft sm",onclick:()=>{e=!e,a.replaceChildren(F(e?"x":"key"),i("span",{},e?"Hide key":"Show key")),r(),n.querySelectorAll(".mask, .k").forEach(u=>_(u,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:Y}))}},F("key"),i("span",{},"Show key")),c=i("button",{type:"button",class:"btn soft sm",onclick:u=>pt(t.conf,"Configuration copied",u.currentTarget)},F("copy"),i("span",{class:"lbl"},"Copy")),g=i("div",{class:"filecard"},i("div",{class:"fc-row"},i("span",{class:"filecard-ic"},".conf"),i("span",{class:"t"},i("span",{class:"mono"},t.filename),i("span",{},"For computers and routers"))),i("button",{type:"button",class:"btn accent sm block",onclick:()=>ye(t.filename,t.conf)},F(o?"open":"download"),i("span",{},o?"Share file":"Download"))),v=qt([{icon:j("file"),title:"Configuration",body:[i("div",{class:"confbar"},a,c),n]}],{inset:!0});return i("div",{class:"step-box"},g,v.el)}function fo(t){let e=i("span",{class:"osm-p"},at[t]),n=Dr(me(t,"ios"),me(t,"android"));return{el:i("span",{class:"scanline"},i("span",{},"In ",e,":"),n.el),set(r){Z(e,at[r],void 0,{whole:!0}),n.set(me(r,"ios"),me(r,"android"))}}}function ho(t){let e=i("span",{class:"tt"}),n=i("span",{class:"tt-m"}),r=i("span",{class:"hp-tip","aria-hidden":"true"},e,n),o=i("button",{type:"button",class:"hp-b",onclick:()=>ye(t().file,t().text)},F("download")),a=i("button",{type:"button",class:"hp-b"},F("copy")),c=i("div",{class:"hpill",role:"group","aria-label":"The connection","data-key":"conn"},o,a,r),g=null,v=0,u=0,M=s=>{var h;return s===a&&a.classList.contains("done")?"Copied":(h=s.getAttribute("aria-label"))!=null?h:""},b=(s,h)=>{n.textContent=h;let f=n.offsetWidth+20;return Math.min(s.offsetLeft+s.offsetWidth/2,c.offsetWidth+46-f/2)},A=s=>`translateX(${s}px) translateX(-50%)`,O=s=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(f=>f.cancel()),r.style.transform=A(s),_(r,[{transform:h},{transform:A(s)}],{duration:U.duration,easing:U.easing})},B=s=>Z(e,s),P=s=>{if(clearTimeout(v),g===s&&r.classList.contains("on"))return;if(g=s,r.classList.contains("on")){let f=M(s);return O(b(s,f)),B(f)}let h=()=>{let f=M(s);bt(e,f);let E=b(s,f);r.getAnimations().forEach(p=>p.cancel()),r.style.transform=A(E),r.classList.add("on"),_(r,[{opacity:0,transform:`${A(E)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:A(E),filter:"blur(0px)"}],{duration:220,easing:Y})};performance.now(){clearTimeout(v),g=null,r.classList.contains("on")&&(u=performance.now()+500,r.classList.remove("on"),_(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let s of[o,a])s.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&P(s)}),s.addEventListener("focus",()=>{s.matches(":focus-visible")&&P(s)}),s.addEventListener("blur",H);c.addEventListener("pointerleave",H);let $=s=>{let h=F(s);a.querySelector("svg").replaceWith(h),_(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:yt.duration,easing:yt.easing})},d=()=>{if(g!==a||!r.classList.contains("on"))return;let s=M(a);O(b(a,s)),B(s)},m=0;return a.addEventListener("click",()=>{let s=t();pt(s.text,s.msg),clearTimeout(m),a.classList.contains("done")||(a.classList.add("done"),$("check"),d()),m=window.setTimeout(()=>{a.classList.remove("done"),$("copy"),d()},1600)}),{el:c,sync(){let s=t().app;o.setAttribute("aria-label",`Download ${s} config`),a.setAttribute("aria-label",`Copy ${s} config`)}}}function go(t){let e=i("b",{},"Waiting for the connection"),n=i("span",{class:"ws",hidden:!0}),r=i("div",{class:"way",role:"status","aria-live":"polite"},i("div",{class:"way-row"},i("span",{class:"way-end"},F(t.kind)),i("span",{class:"way-track"},i("span",{class:"way-glow"},i("i")),i("span",{class:"way-fill"})),i("span",{class:"way-end home"},F("server"))),i("div",{class:"way-text"},i("span",{class:"t"},e,n)));return{el:r,connected(){r.classList.add("done"),Z(e,`${t.name} connected`)},gaveUp(){r.classList.add("stopped"),Z(e,"No connection yet"),n.textContent="Close this and open it again to keep checking.",n.hidden=!1,_(e.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:Y})}}}function vo(t,e=4){window.setTimeout(async()=>{var n;try{let r=await ut("state");xt(r),be()||Mt(),!((n=r.person.devices.find(o=>o.id===t))!=null&&n.online)&&e>1&&vo(t,e-1)}catch{}},1500)}function yo(t,e,n){let r=te(),o=0,a=0,c=!1,g=Date.now(),v=async()=>{if(o=0,!c){if(Date.now()-g>6e5){c=!0,n();return}if(document.hidden)return u();try{let b=await ut("state");xt(b);let A=b.person.devices.find(O=>O.id===t.id);if(A&&A.handshake>r){c=!0,e(),A.online||vo(t.id);return}}catch(b){if(Oe(b)){c=!0;return}}a++,u()}},u=()=>{!c&&!o&&(o=window.setTimeout(v,a<6?5e3:a<12?15e3:3e4))},M=()=>{!document.hidden&&!c&&!o&&v()};return document.addEventListener("visibilitychange",M),u(),()=>{c=!0,o&&clearTimeout(o),document.removeEventListener("visibilitychange",M)}}var mo=t=>new Promise(e=>setTimeout(e,t));async function xo(t,e,n){t.connected(),Gr(),Ur(),await mo(400),wn(t.el)&&(e.style.overflow="hidden",_(e,[{height:`${e.offsetHeight}px`,opacity:1,filter:"none"},{height:"0px",opacity:0,filter:"blur(4px)"}],{duration:520,easing:Y,fill:"forwards"}),_(t.el,[{marginBottom:"18px"},{marginBottom:"0px"}],{duration:520,easing:Y,fill:"forwards"}),await mo(2400),wn(t.el)&&(Yt(()=>Mt({flash:n.id})),ft()))}async function Ci(t){try{return await ut(`devices/${t.id}/config`)}catch(e){return e instanceof Nt&&e.httpsUrl?ke(e.httpsUrl):wt(e.message,!0),null}}async function Je(t,e){if(ue())return;let n=async()=>{let r=await Ci(t);if(!r)return;let o=await Ln(r,r.server);ht(()=>wo(t,r,o))};e instanceof HTMLButtonElement?await zt(e,n):await n()}async function Ze(t,e){let n=await Ln(e,e.server);Ve(()=>wo(t,e,n))}function bo(t,e,n){return i("div",{class:"step"},i("span",{class:"step-n"},t),i("div",{class:"step-b"},typeof e=="string"?i("span",{class:"step-t"},e):e,n))}function ki(t,e,n){let r=t.hidden?0:t.getBoundingClientRect().height;if(t.getAnimations().forEach(g=>g.cancel()),n){t.hidden=e;return}t.style.overflow="hidden",t.hidden=!1;let o=e?0:t.getBoundingClientRect().height,[a,c]=e?[1,0]:[0,1];_(t,[{height:`${r}px`,opacity:a,filter:`blur(${4-a*4}px)`},{height:`${o}px`,opacity:c,filter:`blur(${4-c*4}px)`}],{duration:U.duration,easing:U.easing}).onfinish=()=>{t.style.overflow="",t.hidden=e}}function wo(t,e,n){var ot,it;let r=He(),o=Xn(cr()),a=t.kind==="phone"||t.kind==="tablet",c=t.kind==="router",g=Qn(t.kind,r),v=g?"same":c?"router":a?"away":"pc-away",u=ar(t.kind),M=o.filter(G=>!c||G.id!=="vpn"),b=(ot=ao(t))!=null?ot:c?"awg":"vpn";M.some(G=>G.id===b)||(b=M[0].id);let A={d:t,cfg:e,key:n,pf:r,there:u,app:()=>b,same:()=>g},O=[],B=()=>{if(M.length<2)return null;let G=eo(M.map(V=>({value:V.id,label:V.name,icon:oo[V.id]})),b,V=>{b=V,so(t,V),O.forEach($t=>$t.sync(V)),qr(p)});return O.push(G),G.el},P=i("span",{class:"step-t"}),H=i("div",{class:"step-box"}),$=i("div",{class:"step-box"}),d=i("div",{class:"step-box"}),m=i("div",{class:"step-box"}),s=null,h=null,f=null,E=v==="away"?ho(()=>({...b==="vpn"?{text:n,msg:"Key copied",file:he(e.filename)}:{text:e.conf,msg:"Configuration copied",file:e.filename},app:at[b]})):null;function p(){Z(P,c?`Get ${at[b]} on the router`:`Get ${at[b]}`,void 0,{whole:!0}),qe(H,lo(b,r,c)),c?$.firstChild||Rt($,po(e)):qe($,co(A));let G=b==="vpn"?Zr(n):e.conf;s&&h&&s.el.isConnected?f!==b&&(s.swap(G),h.set(b)):(h=fo(b),s=vn(G,[h.el]),d.replaceChildren(s.el)),f=b,qe(m,uo(A)),E==null||E.sync()}p();let l=nr(Zt(),t.id),L=()=>[a?vn(l,[i("span",{},"Point its camera at the code: the link opens there.")]).el:i("p",{class:"desc"},`Open this link on the ${u} to set it up there.`),re(l)],x=()=>bo("1",P,[B(),H]),C=()=>bo("2",c?"Import the configuration":"Add the connection",[$]),R=i("div",{class:"setup"});if(jn(navigator.userAgent)&&R.appendChild(Xe("warn","shield",null,"Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.")),v==="same"){let G=i("div",{class:"steps-wrap"},i("div",{class:"steps-gap"}),x(),C()),V=qt([{icon:j("link"),title:`Not on the ${u} right now?`,body:L()}],{inset:!0,onToggle:($t,lt,rn)=>ki(G,lt,rn)});R.append(V.el,G)}else v==="router"?R.append(x(),C()):v==="away"?R.appendChild(qt([{icon:j("link"),title:`Open your link on the ${u}`,body:L()},{icon:j("app"),title:"Already has the app",body:[B(),d]}],{inset:!0,open:1}).el):R.appendChild(qt([{icon:j("link"),title:`Open your link on the ${u}`,body:L()},{icon:j("key"),title:"Copy or save the connection",body:[B(),m]}],{inset:!0,open:0}).el);let I=go(t),z=!1;Fr(yo(t,()=>{z||(z=!0,xo(I,R,t))},I.gaveUp)),Yt(()=>Mt());let Q=v==="same"?"Two steps, about a minute":c?"The packages and the file for OpenWrt":`The app goes on the ${u}.`;return{el:i("div",{class:"view"},Ct(`Set up ${t.name}`,{acts:!!E}),Ht(Q),I.el,R),label:`Set up ${t.name}`,acts:(it=E==null?void 0:E.el)!=null?it:null}}var mt=navigator.userAgent,ko=/iPad/.test(mt)||/Macintosh/.test(mt)&&navigator.maxTouchPoints>1;function Le(){return ko||/Tablet/i.test(mt)||/Android/.test(mt)&&!/Mobile/.test(mt)?"tablet":/Android|iPhone|Mobile/i.test(mt)?"phone":"computer"}var Ei=[[/^SM-S93/,"Galaxy S25"],[/^SM-S92/,"Galaxy S24"],[/^SM-S91/,"Galaxy S23"],[/^SM-S90/,"Galaxy S22"],[/^SM-G99/,"Galaxy S21"],[/^SM-F9/,"Galaxy Z Fold"],[/^SM-F7/,"Galaxy Z Flip"],[/^SM-A5/,"Galaxy A5x"],[/^SM-A3/,"Galaxy A3x"],[/^SM-X/,"Galaxy Tab"]],Tn="",Li=(async()=>{var e;let t=navigator.userAgentData;if(!t||!/Android/.test(mt))return"";try{let n=((e=(await t.getHighEntropyValues(["model"])).model)!=null?e:"").trim();if(!n||n==="K")return"";let r=Ei.find(([o])=>o.test(n));Tn=r?`${r[1]} (${n})`:/^SM-/.test(n)?`Galaxy ${n}`:n}catch{}return Tn})();function Ti(t){return/iPhone/.test(mt)?"iPhone":ko?"iPad":/Android/.test(mt)?Tn||(t==="tablet"?"Android tablet":"Android phone"):/CrOS/.test(mt)?"Chromebook":/Mac OS X/.test(mt)?"Mac":/Windows/.test(mt)?"Windows PC":/Linux/.test(mt)?"Linux PC":sn[t]}var Mo={computer:"PC",mobile:"Mobile",router:"Router",other:"Other"},Ee=t=>t==="phone"||t==="tablet"?"mobile":t,Co=t=>t!=="mobile"?t:Le()==="tablet"?"tablet":"phone";function Te(){let t=dt();if(!(!t||t.locked)){if(!t.can_add)return wt(`You have reached your limit of ${t.person.device_limit} devices`,!0);ue()||ht(Ai)}}function Ai(){let t=dt(),e=t.person,n=["computer","mobile","router","other"].filter(d=>t.kinds.some(m=>Ee(m)===d)),r=n.includes(Ee(Le()))?Ee(Le()):n[0],o=!1,a=new Set(e.devices.map(d=>d.name.toLowerCase())),c=d=>{let m=d===Ee(Le())?Ti(Co(d)):d==="mobile"?"Phone":sn[d];if(!a.has(m.toLowerCase()))return m;for(let s=2;s<20;s++)if(!a.has(`${m} ${s}`.toLowerCase()))return`${m} ${s}`;return m},g=i("div",{class:"kinds",role:"radiogroup","aria-label":"What is it?"});g.style.setProperty("--n",String(n.length));let v=n.map(d=>{let m=i("button",{type:"button",class:"kind",role:"radio","aria-label":Mo[d],onclick:()=>O(d)},i("span",{class:"kind-tile"},j(d,"blue")),i("span",{class:"kind-lbl"},Mo[d]));return g.appendChild(m),m}),u=i("input",{type:"text",maxlength:48,required:!0,"aria-label":"Name",autocomplete:"off"}),M=i("button",{class:"go ready",type:"submit","aria-label":"Create connection"},F("arrow")),b=i("p",{class:"hint bad-t",hidden:!0}),A=d=>{if(!b.hidden)return Z(b,d);b.textContent=d,b.hidden=!1,_(b,[{opacity:0,transform:"translateY(-4px)"},{opacity:1,transform:"none"}],{duration:220,easing:Y})};u.value=c(r),u.addEventListener("input",()=>{o=!0,M.classList.toggle("ready",!!u.value.trim()),b.hidden=!0}),Li.then(()=>{!o&&r===Ee(Le())&&(u.value=c(r))});function O(d){r=d,v.forEach((m,s)=>{let h=n[s]===d;m.classList.toggle("on",h),m.setAttribute("aria-checked",String(h))}),o||(u.value=c(d),M.classList.add("ready"))}O(r);let B=i("form",{class:"field",autocomplete:"off"},u,M);B.addEventListener("submit",d=>{d.preventDefault();let m=u.value.trim();if(m){if(a.has(m.toLowerCase()))return A("You already have a device with this name.");zt(M,async()=>{try{let s=await ut("devices",{name:m,kind:Co(r)});xt(s.state),Mt({pop:s.id});let h=s.state.person.devices.find(f=>f.id===s.id);await Ze(h,s.config)}catch(s){if(s instanceof Nt&&s.httpsUrl)return ke(s.httpsUrl);A(s.message)}})}});let P=i("button",{type:"button",class:"btn soft block",onclick:()=>Ve(Si)},F("qr"),i("span",{},"Add it from the device")),H=e.device_limit-e.devices.length,$=i("div",{class:"view"},Ct("Add a device"),Ht(`${H} of ${e.device_limit} slots free`),g,Kt("Phones and tablets get a smaller packet size that suits mobile networks."),B,b,i("div",{class:"or"},"OR"),P);return $.querySelector(".hint").classList.add("kinds-note"),{el:$,label:"Add a device"}}function Si(){let t=or(Zt());return{el:i("div",{class:"view"},Ct("Open on the device",{back:!0}),Ht("Point its camera at the code: your page opens there with this device ready to add."),xe(t,!0),re(t)),label:"Open on the device"}}function Eo(t){let e=i("button",{type:"button",class:`btn ${t.cls}`,onclick:r=>zt(r.currentTarget,t.run)},i("span",{},t.action));return{el:i("div",{class:"view"},i("div",{class:"center-col ask"},j(t.icon,t.tone,"gi xl"),i("h3",{},t.title),i("p",{},t.text),i("div",{class:"btnrow"},i("button",{type:"button",class:"btn soft",onclick:()=>ft()},"Cancel"),e))),label:t.title,asks:!0}}function Lo(t){ht(()=>{let e=i("input",{type:"text",maxlength:48,"aria-label":"Device name",autocomplete:"off"});e.value=t.name;let n=i("button",{class:"go",type:"submit","aria-label":"Save"},F("check"));e.addEventListener("input",()=>n.classList.toggle("ready",!!e.value.trim()&&e.value.trim()!==t.name));let r=i("form",{class:"field",autocomplete:"off"},e,n);return r.addEventListener("submit",o=>{o.preventDefault();let a=e.value.trim();!a||a===t.name||zt(n,async()=>{try{let c=await ut(`devices/${t.id}`,{action:"rename",name:a});xt(c.state),Yt(()=>{Mt(),wt("Renamed")}),ft()}catch(c){wt(c.message,!0)}})}),setTimeout(()=>e.select(),60),{el:i("div",{class:"view"},Ct(`Rename ${t.name}`),r),label:`Rename ${t.name}`}})}function An(t){var n;if(ue())return;let e=((n=dt())==null?void 0:n.here)===t.id;ht(()=>Eo({icon:"refresh",tone:"orange",title:`Reconnect ${t.name}?`,text:e?"It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.":"It gets new keys and its current settings stop working. Set it up again with the new ones that open next.",action:"Reconnect",cls:"accent",run:async()=>{var r;try{let o=await ut(`devices/${t.id}`,{action:"reconnect"});xt(o.state),Mt(),await Ze((r=o.state.person.devices.find(a=>a.id===t.id))!=null?r:{...t,handshake:0},o.config)}catch(o){wt(o.message,!0)}}}))}function To(t){ht(()=>Eo({icon:"trash",tone:"red",title:`Remove ${t.name}?`,text:"Its connection stops working at once. You can add it again later.",action:"Remove",cls:"red",run:async()=>{try{let e=await ut(`devices/${t.id}`,{action:"delete"});xt(e.state),Yt(()=>{let n=document.querySelector(`.dev[data-id="${CSS.escape(t.id)}"]`),r=()=>{Mt(),wt("Device removed")};if(!n)return r();_(n,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(6px)"}],{duration:220,easing:J,fill:"forwards"}).onfinish=r}),ft()}catch(e){wt(e.message,!0)}}}))}var Sn=(t,e)=>t.access!=="internet"&&t.state==="active"&&!e.disabled;function $i(t,e){return t.disabled?["","Disabled"]:t.config_stale&&t.handshake?["warn-t","Settings changed"]:t.online&&e.state==="quota"?["warn-t","Connected, no data left"]:t.online&&e.state==="hours"?["warn-t","Connected, outside your hours"]:t.online?["ok-t","Connected"]:t.handshake?["",`Last connected ${Un(t.handshake,te())}`]:["warn-t","Not set up yet"]}function _i(t,e){return[...Sn(e.person,t)?[{label:"Copy IP address",icon:"copy",run:()=>pt(t.address,"IP address copied")},...t.hostname?[{label:"Copy local address",icon:"home",run:()=>pt(t.hostname,"Address copied")}]:[],null]:[],...t.disabled?[]:[{label:"Rename",icon:"edit",run:()=>Lo(t)},{label:"Reconnect",icon:"refresh",tone:"warn",run:()=>An(t)},{label:"Remove",icon:"trash",tone:"bad",run:()=>To(t)}]]}function Pi(t){return t===0?"Today":t===1?"Yesterday":Tt(Xt(Pt(),-t)).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"})}function Di(t,e){let n=t.spark.reduce((c,g)=>c+g,0),r=i("span",{class:"use-lbl"},"Last 7 days"),o=i("span",{class:"use-val num","data-t":`${t.id}:use`},ct(n)),a;if(e)a=i("button",{type:"button",class:"upd-pill","aria-label":"Update the connection",title:"Its settings changed: update the connection",onclick:()=>An(t)},F("refresh"),i("span",{},"Update"));else{let c=Math.max(1,...t.spark);a=i("div",{class:"spark"}),t.spark.forEach((g,v)=>{let u=t.spark.length-1-v,M=i("i",{class:u===0?"today":""});M.style.height=`${Math.max(3,Math.round(g/c*34))}px`,M.addEventListener("pointerenter",()=>{bt(r,Pi(u)),bt(o,ct(g))}),M.addEventListener("pointerleave",()=>{bt(r,"Last 7 days"),bt(o,ct(n))}),a.appendChild(M)})}return i("div",{class:"dev-use"},i("div",{class:"use-txt"},r,o),a)}function Bi(t,e){let n=e.person,r=!!e.locked,o=e.here===t.id,[a,c]=o?["here-t","This device"]:$i(t,n),g=!t.handshake&&!t.disabled,v=t.config_stale&&!g&&!r&&!t.disabled,u=!o&&t.handshake&&!t.online&&!t.disabled&&!t.config_stale?new Date(t.handshake*1e3).toLocaleString("en-GB"):v?"Settings changed, update needed":c,M=_i(t,e),b=r||!M.length?null:i("button",{type:"button",class:"knob more","aria-label":`${t.name} options`,"aria-haspopup":"menu","aria-expanded":"false"},F("more"));return b==null||b.addEventListener("click",()=>Or(b,M)),i("article",{class:`dev${o?" is-here":""}${t.disabled?" off":""}`,"data-id":t.id},i("div",{class:"dev-top"},j(t.kind,o?"blue":"grey"),i("div",{class:"dev-id"},i("span",{class:"dev-name","data-t":`${t.id}:name`},t.name),i("span",{class:`dev-stat ${a}`,title:u,"data-t":`${t.id}:stat`},c)),b),g&&r?null:g?i("button",{type:"button",class:"btn tint block setup-btn","aria-label":`Set up ${t.name}`,onclick:A=>Je(t,A.currentTarget)},F("qr"),i("span",{},"Connect")):Di(t,v))}var Hi=t=>i("div",{class:"dev first","data-id":"first"},j("plus","blue"),i("b",{},"Add your first device"),i("p",{},"Two steps, about a minute: get the app, then add the connection."),i("button",{type:"button",class:"btn accent block",onclick:Te},F("plus"),i("span",{},t?"Add this phone":"Add this device"))),Oi=()=>i("button",{type:"button",class:"dev add","data-id":"add",onclick:Te},j("plus"),i("span",{},"Add device"));function Ao(){return i("section",{class:"devices",id:"devices","aria-label":"Your devices"},i("div",{class:"sec-head"},i("h2",{},"Your devices"),i("span",{class:"aside num"})),i("div",{class:"dgrid"}),i("p",{class:"note-s limit",hidden:!0}))}function So(t,e,n={}){let r=e.person,o=t.querySelector(".dgrid"),a=o.childElementCount>0,c=new Map([...o.querySelectorAll("[data-id]")].map($=>[$.dataset.id,$.getBoundingClientRect()])),g=Fe(o),u=Pe(r.devices).sort(($,d)=>+(d.id===e.here)-+($.id===e.here)).map($=>Bi($,e)),M=e.locked?0:Math.max(0,r.device_limit-r.devices.length),b=matchMedia("(max-width: 959px)").matches||/Android|iPhone|iPad/.test(navigator.userAgent);!r.devices.length&&M?u.push(Hi(b)):e.can_add&&!e.locked&&u.push(Oi()),o.classList.toggle("empty",!r.devices.length),o.replaceChildren(...u);for(let $ of u){let d=c.get($.dataset.id),m=$.getBoundingClientRect();$.dataset.id===n.pop?_($,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:kt.duration,easing:kt.easing}):d&&(d.left!==m.left||d.top!==m.top)?_($,[{transform:`translate(${d.left-m.left}px, ${d.top-m.top}px)`},{transform:"none"}],{duration:U.duration,easing:U.easing}):!d&&a&&_($,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:getComputedStyle($).opacity,transform:"none",filter:"none"}],{duration:U.duration,delay:60,easing:U.easing,fill:"backwards"}),$.dataset.id===n.flash&&$.animate([{boxShadow:"inset 0 0 0 1.5px var(--ok)"},{boxShadow:"inset 0 0 0 1.5px transparent"}],{duration:1800,easing:"ease-out"})}a&&Ke(o,g);let A=t.querySelector(".sec-head .aside"),O=`${r.devices.length} of ${r.device_limit}`;a?Z(A,O):A.textContent=O,A.classList.toggle("warn-t",r.devices.length>r.device_limit);let B=t.querySelector(".limit"),P=B.hidden,H=e.can_add||!!e.locked;if(B.textContent=`You have reached your limit of ${r.device_limit} devices. Remove one to add another.`,B.getAnimations().forEach($=>$.cancel()),a&&!P&&H){let $=_(B,[{opacity:1,filter:"none"},{opacity:0,filter:"blur(4px)"}],{duration:200,easing:J,fill:"forwards"});$.onfinish=()=>{B.hidden=!0,$.cancel()}}else B.hidden=H,a&&P&&!H&&_(B,[{opacity:0,transform:"translateY(6px)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:420,easing:Y})}var $n=t=>i("p",{class:"desc"},t),en=(t,e)=>`${(t/e*100).toFixed(2)}%`;function Ri(t){let e=(n,r,o,a)=>i("div",{class:`reach-tile${n?"":" off"}`},j(r,n?"blue":"grey","gi rt-ic"),i("b",{},o),i("span",{class:"rt-sub"},n?a:"Not included"),i("span",{class:"rt-mark","aria-label":n?"Included":"Not included"},F(n?"check":"minus")));return i("div",{class:"reach2"},e(t!=="internet","home","Home network","Devices at home"),e(t!=="lan","globe","Internet","Through the router"))}function Ni(t,e){let n=Pe(t.devices).filter(c=>c.hostname&&Sn(t,c));if(!n.length)return[];let r=n[0].hostname,o=r.indexOf("."),a=o>0?r.slice(o):"";return[i("span",{class:"lbl-s"},e?"Devices at home and on this VPN reach yours as ":"Other devices at home reach yours as ",i("span",{class:"mono"},`name${a}`)),i("div",{class:"names"},n.map(c=>{let g=c.hostname.indexOf(".");return i("button",{type:"button",class:"namechip",title:c.name,"aria-label":`Copy ${c.hostname}`,onclick:v=>pt(c.hostname,"Address copied",v.currentTarget)},i("span",{},g>0?[c.hostname.slice(0,g),i("span",{class:"faint"},c.hostname.slice(g))]:c.hostname),F("copy"))}))]}function Ii(t){let e=2*Math.PI*6,n=t>=100?" bad":t>=90?" warn":"";return _t(``)}function Fi(t){let e=i("i",{class:t>=100?"bad":t>=90?"warn":""});return e.style.width=`${t.toFixed(1)}%`,i("div",{class:"meter"},e)}function Ki(t,e,n){var B,P;let{days:r,day:o}=Qr(Pt()),a=(B=t.month_days)!=null?B:[],c=Math.max(1,...a),g=H=>Tt(`${Pt().slice(0,8)}${String(H).padStart(2,"0")}`).toLocaleDateString("en-GB",{day:"numeric",month:"short"}),v=i("b",{class:"num","data-t":"m-used"},ct(e)),u=i("span",{}," used"),M=i("span",{class:"mread"},v,u),b=i("div",{class:"mbars"});for(let H=0;H=o){b.appendChild(i("i",{class:"future"}));continue}let $=(P=a[H])!=null?P:0,d=i("i",{class:H===o-1?"today":""});d.style.height=`${Math.max(3,Math.round($/c*64))}px`,d.addEventListener("pointerenter",()=>{bt(v,ct($)),bt(u,` on ${g(H+1)}`)}),d.addEventListener("pointerleave",()=>{bt(v,ct(e)),bt(u," used")}),b.appendChild(d)}let A=i("span",{class:"td"},"Today");A.style.left=en(o-.5,r);let O=i("div",{class:"month-axis"},i("span",{class:o<=4?"hide":""},g(1)),A,i("span",{class:o>=r-3?"hide":""},g(r)));return i("div",{class:"month"},b,O,i("div",{class:"month-read"},M,i("span",{class:`num${t.state==="quota"?" bad-t":""}`,"data-t":"m-left"},t.quota_limit?`${ct(Math.max(0,t.quota_limit-e))} left`:"No limit")),t.quota_limit?Fi(n):null)}function qi(t,e){let n=a=>Tt(a).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short"}),r=Vr(Pt(),t.expires),o=r?i("div",{class:"cal","aria-hidden":"true"},i("div",{class:"cal-h"},["M","T","W","T","F","S","S"].map(a=>i("span",{},a))),i("div",{class:"cal-g"},r.map((a,c)=>{let g=i("i",{class:a.kind,title:n(a.day)});return g.style.setProperty("--i",String(c)),g}))):null;return i("div",{class:`until${fe(t,e)?" soon":""}`},i("div",{class:"until-num"},i("b",{class:"num"},String(e)),i("span",{},`${e===1?"day":"days"} left`),i("span",{class:"until-sub"},`Ends ${n(t.expires)}`)),o)}function Gi(t,e){let n=-new Date().getTimezoneOffset(),r=Qe(t,e,n);if(!r)return null;let o=jr(te(),r.yours?n:e!=null?e:n),a=Yr(r),c=a.some(([u,M])=>o>=u&&oi("span",{},u))))}function Ui(t,e=1){let n=t.person,r=n.quota_used||n.month[0]+n.month[1],o=n.quota_limit?Math.min(100,r/n.quota_limit*100):0,a=n.quota_period==="total"&&!!n.quota_gb,c=_e(n.expires,Pt()),g=n.expires?i("span",{class:"until-val"},i("span",{class:"num","data-t":"until-date"},pe(n.expires).replace(/ \d{4}$/,"")),c!=null?i("span",{class:`num ${c<0?"bad-t":fe(n,c)?"warn-t":"ok-t"}`,"data-t":"until-left"},c>=0?`${c} day${c===1?"":"s"}`:"ended"):null):i("span",{},"No end date"),v=[n.expires?c!=null&&c<0?$n(`It ended on ${pe(n.expires)}.`):qi(n,c!=null?c:0):null,n.hours?Gi(n.hours,t.tz_offset):null];return qt([{icon:j(n.access==="internet"?"globe":n.access==="lan"?"home":"shield"),title:zn[n.access],body:[Ri(n.access),...Ni(n,!!t.server.device_mesh)]},{icon:j("chart"),title:a?"Data used":"Data this month",val:i("span",{class:"data-val"},n.quota_limit?Ii(o):null,i("span",{class:"num","data-t":"data-val"},`${ct(r)}${n.quota_limit?` / ${ct(n.quota_limit)}`:" · no limit"}`)),valHide:!0,body:[a?$n(`${ct(r)} of ${ct(n.quota_limit)} in total.`):Ki(n,r,o),$n(n.quota_limit?a?"A total for your whole access, it does not reset.":"Resets on the 1st.":"No data limit. The count starts again on the 1st.")]},{icon:j("calendar"),title:"Access until",val:g,valHide:!!n.expires&&(c!=null?c:0)>=0,body:v}],{open:e})}function $o(){return i("section",{class:"access",id:"access","aria-label":"Your access"},i("div",{class:"sec-head"},i("h2",{},"Your access")),i("div",{class:"acc-slot"}))}var tn=null;function _o(t,e){let n=Ui(e,tn?tn.openIndex():1),r=Fe(t);t.querySelector(".acc-slot").replaceChildren(n.el),tn&&Ke(t,r),tn=n}Kn(document.documentElement);var nn=document.getElementById("app"),Ot=null,_n=!1;function Po(){let t=[...nn.querySelectorAll(".crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone")],e=t.map(n=>getComputedStyle(n).opacity);t.forEach((n,r)=>_(n,[{opacity:0,transform:"translateY(10px)",filter:"blur(4px)"},{opacity:e[r],transform:"none",filter:"none"}],{duration:520,delay:60+r*40,easing:Y,fill:"backwards"})),nn.querySelectorAll(".logo .sun").forEach(n=>_(n,[{transform:"translateY(7px)"},{transform:"none"}],{duration:900,delay:150,easing:Y,fill:"backwards"})),_n=!0}function Do(t={}){let e=dt();if(!e)return;if(e.person.state==="paused"){document.title=Ut();let[r,o,a]=En(e.person);return Pn(r,o,a,!1,"orange")}let n=Mn(nn);Cn(!1),kn(),document.title=Ut(),Ot||(Ot={notice:i("div",{class:"notice-slot"}),devices:Ao(),access:$o()},Rt(n,Ot.notice,i("div",{class:"cols"},Ot.devices,Ot.access))),Rt(Ot.notice,Jr(e.person)),So(Ot.devices,e,t),_o(Ot.access,e),_n||Po()}pr(Do);function Pn(t,e,n,r=!1,o="grey"){Ot=null;let a=Mn(nn);Cn(!0),kn(r,!0),Rt(a,i("div",{class:"gone"},j(t,o),i("h1",{},e),i("p",{},n))),_n||Po()}function Bo(){xt(null),ft(!0),Pn("key","This link no longer works","Ask for a new one.",!0)}function Ho(){let t=dt(),e=rr(location.hash),n=ir(location.hash);if(!t||!e&&!n)return;if(history.replaceState(null,"",location.pathname+location.search),n)return Te();let r=t.person.devices.find(o=>o.id===e);r&&!r.handshake&&!r.disabled&&!t.locked&&Je(r)}addEventListener("hashchange",Ho);async function Wi(){try{xt(await ut("state")),!St()&&!be()&&Do(),Ho()}catch(t){Oe(t)?Bo():dt()||Pn("server","The page could not load",t.message)}}document.addEventListener("keydown",t=>{t.key==="Escape"&&(be()?Bt(!0):St()&&ft(!0))});!Jt||!lr?Bo():Wi();})(); +"use strict";(()=>{var li=Object.create;var tr=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,pi=Object.prototype.hasOwnProperty;var fi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var hi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of di(t))!pi.call(e,o)&&o!==n&&tr(e,o,{get:()=>t[o],enumerable:!(r=ci(t,o))||r.enumerable});return e};var mi=(e,t,n)=>(n=e!=null?li(ui(e)):{},hi(t||!e||!e.__esModule?tr(n,"default",{value:e,enumerable:!0}):n,e));var Ur=fi((zr,Kr)=>{"use strict";var Wr=(function(){var e=function(d,v){var a=236,h=17,p=d,A=n[v],u=null,l=0,E=null,x=[],C={},I=function(w,k){l=p*4+17,u=(function(y){for(var L=new Array(y),S=0;S=7&&le(w),E==null&&(E=ie(p,A,x)),Y(E,k)},G=function(w,k){for(var y=-1;y<=7;y+=1)if(!(w+y<=-1||l<=w+y))for(var L=-1;L<=7;L+=1)k+L<=-1||l<=k+L||(0<=y&&y<=6&&(L==0||L==6)||0<=L&&L<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=L&&L<=4?u[w+y][k+L]=!0:u[w+y][k+L]=!1)},V=function(){for(var w=0,k=0,y=0;y<8;y+=1){I(!0,y);var L=o.getLostPoint(C);(y==0||w>L)&&(w=L,k=y)}return k},J=function(){for(var w=8;w>y&1)==1;u[Math.floor(y/3)][y%3+l-8-3]=L}for(var y=0;y<18;y+=1){var L=!w&&(k>>y&1)==1;u[y%3+l-8-3][Math.floor(y/3)]=L}},ue=function(w,k){for(var y=A<<3|k,L=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<6?u[S][8]=H:S<8?u[S+1][8]=H:u[l-15+S][8]=H}for(var S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<8?u[8][l-S-1]=H:S<9?u[8][15-S-1+1]=H:u[8][15-S-1]=H}u[l-8][8]=!w},Y=function(w,k){for(var y=-1,L=l-1,S=7,H=0,K=o.getMaskFunction(k),W=l-1;W>0;W-=2)for(W==6&&(W-=1);;){for(var X=0;X<2;X+=1)if(u[L][W-X]==null){var se=!1;H>>S&1)==1);var U=K(L,W-X);U&&(se=!se),u[L][W-X]=se,S-=1,S==-1&&(H+=1,S=7)}if(L+=y,L<0||l<=L){L-=y,y=-y;break}}},ee=function(w,k){for(var y=0,L=0,S=0,H=new Array(k.length),K=new Array(k.length),W=0;W=0?Xn.getAt(Zn):0}}for(var er=0,U=0;UW*8)throw"code length overflow. ("+S.getLengthInBits()+">"+W*8+")";for(S.getLengthInBits()+4<=W*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=W*8||(S.put(a,8),S.getLengthInBits()>=W*8));)S.put(h,8);return ee(S,L)};C.addData=function(w,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=f(w);break;case"Alphanumeric":y=T(w);break;case"Byte":y=M(w);break;case"Kanji":y=b(w);break;default:throw"mode:"+k}x.push(y),E=null},C.isDark=function(w,k){if(w<0||l<=w||k<0||l<=k)throw w+","+k;return u[w][k]},C.getModuleCount=function(){return l},C.make=function(){if(p<1){for(var w=1;w<40;w++){for(var k=m.getRSBlocks(w,A),y=g(),L=0;L";for(var S=0;S';y+=""}return y+="",y+="",y},C.createSvgTag=function(w,k,y,L){var S={};typeof arguments[0]=="object"&&(S=arguments[0],w=S.cellSize,k=S.margin,y=S.alt,L=S.title),w=w||2,k=typeof k=="undefined"?w*4:k,y=typeof y=="string"?{text:y}:y||{},y.text=y.text||null,y.id=y.text?y.id||"qrcode-description":null,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-title":null;var H=C.getModuleCount()*w+k*2,K,W,X,se,U="",ye;for(ye="l"+w+",0 0,"+w+" -"+w+",0 0,-"+w+"z ",U+=''+ne(L.text)+"":"",U+=y.text?''+ne(y.text)+"":"",U+='',U+='":k+=">";break;case"&":k+="&";break;case'"':k+=""";break;default:k+=L;break}}return k},Bt=function(w){var k=1;w=typeof w=="undefined"?k*2:w;var y=C.getModuleCount()*k+w*2,L=w,S=y-w,H,K,W,X,se,U={"██":"█","█ ":"▀"," █":"▄"," ":" "},ye={"██":"▀","█ ":"▀"," █":" "," ":" "},be="";for(H=0;H=S?ye[se]:U[se];be+=` +`}return y%2&&w>0?be.substring(0,be.length-y-1)+Array(y+1).join("▀"):be.substring(0,be.length-1)};return C.createASCII=function(w,k){if(w=w||1,w<2)return Bt(k);w-=1,k=typeof k=="undefined"?w*2:k;var y=C.getModuleCount()*w+k*2,L=k,S=y-k,H,K,W,X,se=Array(w+1).join("██"),U=Array(w+1).join(" "),ye="",be="";for(H=0;H>>8),A.push(E&255)):A.push(h)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],v=1335,a=7973,h=21522,p={},A=function(u){for(var l=0;u!=0;)l+=1,u>>>=1;return l};return p.getBCHTypeInfo=function(u){for(var l=u<<10;A(l)-A(v)>=0;)l^=v<=0;)l^=a<5&&(E+=3+I-5)}for(var x=0;x=256;)p-=255;return d[p]},h})();function c(d,v){if(typeof d.length=="undefined")throw d.length+"/"+v;var a=(function(){for(var p=0;p>>7-h%8&1)==1},a.put=function(h,p){for(var A=0;A>>p-A-1&1)==1)},a.getLengthInBits=function(){return v},a.putBit=function(h){var p=Math.floor(v/8);d.length<=p&&d.push(0),h&&(d[p]|=128>>>v%8),v+=1},a},f=function(d){var v=t.MODE_NUMBER,a=d,h={};h.getMode=function(){return v},h.getLength=function(u){return a.length},h.write=function(u){for(var l=a,E=0;E+2>>8&255)*192+(x&255),u.put(x,13),E+=2}if(E>>8)},v.writeBytes=function(a,h,p){h=h||0,p=p||a.length;for(var A=0;A0&&(a+=","),a+=d[h];return a+="]",a},v},B=function(){var d=0,v=0,a=0,h="",p={},A=function(l){h+=String.fromCharCode(u(l&63))},u=function(l){if(!(l<0)){if(l<26)return 65+l;if(l<52)return 97+(l-26);if(l<62)return 48+(l-52);if(l==62)return 43;if(l==63)return 47}throw"n:"+l};return p.writeByte=function(l){for(d=d<<8|l&255,v+=8,a+=1;v>=6;)A(d>>>v-6),v-=6},p.flush=function(){if(v>0&&(A(d<<6-v),d=0,v=0),a%3!=0)for(var l=3-a%3,E=0;E=v.length){if(p==0)return-1;throw"unexpected end of file./"+p}var l=v.charAt(a);if(a+=1,l=="=")return p=0,-1;if(l.match(/^\s$/))continue;h=h<<6|u(l.charCodeAt(0)),p+=6}var E=h>>>p-8&255;return p-=8,E};var u=function(l){if(65<=l&&l<=90)return l-65;if(97<=l&&l<=122)return l-97+26;if(48<=l&&l<=57)return l-48+52;if(l==43)return 62;if(l==47)return 63;throw"c:"+l};return A},R=function(d,v){var a=d,h=v,p=new Array(d*v),A={};A.setPixel=function(x,C,I){p[C*a+x]=I},A.write=function(x){x.writeString("GIF87a"),x.writeShort(a),x.writeShort(h),x.writeByte(128),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(255),x.writeByte(255),x.writeByte(255),x.writeString(","),x.writeShort(0),x.writeShort(0),x.writeShort(a),x.writeShort(h),x.writeByte(0);var C=2,I=l(C);x.writeByte(C);for(var G=0;I.length-G>255;)x.writeByte(255),x.writeBytes(I,G,255),G+=255;x.writeByte(I.length-G),x.writeBytes(I,G,I.length-G),x.writeByte(0),x.writeString(";")};var u=function(x){var C=x,I=0,G=0,V={};return V.write=function(J,re){if(J>>>re)throw"length over";for(;I+re>=8;)C.writeByte(255&(J<>>=8-I,G=0,I=0;G=J<0&&C.writeByte(G)},V},l=function(x){for(var C=1<>6,128|s&63):s<55296||s>=57344?r.push(224|s>>12,128|s>>6&63,128|s&63):(o++,s=65536+((s&1023)<<10|n.charCodeAt(o)&1023),r.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63))}return r}return t(e)}})();(function(e){typeof define=="function"&&define.amd?define([],e):typeof zr=="object"&&(Kr.exports=e())})(function(){return Wr})});var nr={s:{'"%s" already exists.':"Устройство «%s» уже есть.",'"%s" is already taken.':"Идентификатор «%s» уже занят.","%s (Android: %s)":"%s (на Android: %s)","%s (router time)":"%s (по времени роутера)","%s can't use the network interface %s: it exists and isn't Dawnline's.":"Сервер %s не может использовать сетевой интерфейс %s: он уже существует и создан не Dawnline.","%s connected":"Подключено: %s","%s d ago":"%s дн. назад","%s h ago":"%s ч назад",'%s has an invalid interface name "%s".':"У сервера %s недопустимое имя интерфейса «%s».","%s has no room for every device on %s.":"В подсети %s не хватит адресов для всех устройств сервера %s.","%s in total":"%s всего","%s is kept down.":"Сервер %s остановлен.","%s is kept down: its disguise needs AmneziaWG %s (installed: %s).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (установлен %s).","%s is kept down: its disguise needs AmneziaWG %s (installed: none).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (не установлен).","%s left":"осталось %s","%s min ago":"%s мин назад","%s must be a number or range":"%s: нужно число или диапазон","%s of %s":"%s из %s","%s of %s GB":"%s из %s ГБ","%s of %s GB this month":"%s из %s ГБ в этом месяце","%s of %s in total.":"Всего %s из %s.","%s on %s":"%s за %s","%s options":"Действия с устройством %s","%s this month":"%s в этом месяце","%s used":"%s использовано","%s your time":"%s по вашему времени","%sd %sh":"%s д %s ч","%sh %sm":"%s ч %s мин","%sm":"%s мин","A total for your whole access, it does not reset.":"Считается за весь срок доступа и не обнуляется.","APK file on":"APK-файл на","Access %s":"Доступ %s","Access ended":"Доступ закончился","Access must be lan, internet or both.":"Доступ должен быть lan, internet или both.","Access paused":"Доступ на паузе","Access until":"Доступ до",Active:"Активен","WireGuard appAdd Tunnel":"Добавить туннель","Add a device":"Добавить устройство","Add device":"Добавить устройство","Add it from the device":"Добавить с самого устройства","Add the connection":"Добавьте подключение","Add this device":"Добавить это устройство","Add this phone":"Добавить этот телефон","Add your first device":"Добавьте первое устройство","Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link.":"Сейчас добавить устройство нельзя: VPN-сервер не готов. Обратитесь к тому, кто прислал вам эту ссылку.","Address copied":"Адрес скопирован","Already has the app":"Приложение уже установлено","AmneziaWG is not installed (%s): install it in Dawnline → Components.":"AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты.","AmneziaWG is not installed: install it in Dawnline → Components.":"AmneziaWG не установлен: установите его в Dawnline → Компоненты.","Android phone":"Телефон Android","Android tablet":"Планшет Android","Ask for a new one.":"Попросите новую.",B:"Б",Back:"Назад",Breadcrumb:"Навигационная цепочка",Cancel:"Отмена","Circle %s: server %s does not exist.":"Круг %s: сервера %s нет.",Close:"Закрыть","Close this and open it again to keep checking.":"Закройте окно и откройте его снова, чтобы проверить ещё раз.",Configuration:"Конфигурация","Configuration copied":"Конфигурация скопирована","Confirm the import and connect":"Подтвердите импорт и подключитесь",Connect:"Подключить",Connected:"Подключено","Connected, no data left":"Подключено, трафик закончился","Connected, outside your hours":"Подключено, вне часов доступа","Connection settings only travel encrypted":"Настройки подключения передаются только в зашифрованном виде","AmneziaVPN appContinue":"Продолжить",Copied:"Скопировано",Copy:"Скопировать","Copy %s":"Скопировать %s","Copy %s config":"Скопировать конфигурацию %s","Copy IP address":"Скопировать IP-адрес","Copy local address":"Скопировать локальный адрес","Copy or save the connection":"Скопировать или сохранить подключение","Copy the configuration":"Скопировать конфигурацию","Copy the key":"Скопировать ключ","in a sentenceCopy the key":"Скопируйте ключ","Copy the link":"Скопировать ссылку","Copying is blocked here. Select the text and copy it by hand.":"Копирование здесь заблокировано. Выделите текст и скопируйте его вручную.","Create connection":"Создать подключение","WireGuard appCreate from QR code":"Создать из QR-кода","WireGuard appCreate from file or archive":"Создать из файла или архива","Cross-site request refused.":"Запрос с другого сайта отклонён.","Data limit must be a positive number of GB.":"Лимит трафика должен быть положительным числом ГБ.","Data limit reached":"Лимит трафика исчерпан","Data this month":"Трафик за месяц","Data used":"Трафик всего","Device %s of %s: address %s is also used by device %s of %s.":"Устройство %s (%s): адрес %s уже занят устройством %s (%s).","Device %s of %s: address %s is not a plain IPv4 address.":"Устройство %s (%s): адрес %s не является обычным IPv4-адресом.","Device %s of %s: address %s is outside %s's tunnel %s.":"Устройство %s (%s): адрес %s вне туннеля сервера %s (%s).","Device %s of %s: address %s is the router's own address on %s.":"Устройство %s (%s): адрес %s принадлежит самому роутеру на сервере %s.","Device %s of %s: address (none) is not a plain IPv4 address.":"Устройство %s (%s): нет IPv4-адреса.","Device %s of %s: the preshared key is not a key.":"Устройство %s (%s): общий ключ (PSK) некорректен.","Device %s of %s: the private key is not a key.":"Устройство %s (%s): приватный ключ некорректен.","Device %s of %s: the public key is not a key.":"Устройство %s (%s): публичный ключ некорректен.","Device %s: person %s does not exist.":"Устройство %s: человека %s нет.","Device limit must be between 1 and 32.":"Лимит устройств: от 1 до 32.","Device limit reached (%d).":"Достигнут лимит устройств (%d).","Device name":"Имя устройства","Device not found.":"Устройство не найдено.","Device removed":"Устройство удалено","Devices at home":"Устройства дома","Devices at home and on this VPN reach yours as %s":"Устройства дома и в этом VPN обращаются к вашим по адресу %s",Disabled:"Отключено",Download:"Скачать","Download %s config":"Скачать конфигурацию %s","Download for Linux":"Скачать для Linux","Download for Mac":"Скачать для Mac","Download for Windows":"Скачать для Windows","Download from":"Скачать с сайта","Download on the":"Загрузите в","Download the file":"Скачать файл","Download the key":"Скачать ключ","End date must be YYYY-MM-DD.":"Дата окончания должна быть в формате ГГГГ-ММ-ДД.","Endpoint must be a hostname or IP address.":"Адрес сервера должен быть именем хоста или IP-адресом.","Ends %s":"Закончится %s","Enter a device name (up to 48 characters).":"Введите название устройства (до 48 символов).",Expired:"Срок истёк","Extra data must be a positive number of GB.":"Дополнительный трафик должен быть положительным числом ГБ.","For computers and routers":"Для компьютеров и роутеров",GB:"ГБ","Gbit/s":"Гбит/с","Get %s":"Установите %s","Get %s on the %s and come back here.":"Установите %s на %s и вернитесь сюда.","Get %s on the router":"Установите %s на роутер","Get it on":"Доступно в","Hide key":"Скрыть ключ","Home network":"Домашняя сеть","Home network + Internet":"Домашняя сеть и интернет","Hours must look like 07:00-23:00.":"Часы доступа указываются так: 07:00-23:00.","Hours, router time":"Часы доступа, время роутера","Hours, your time":"Часы доступа, ваше время","IP address copied":"IP-адрес скопирован","WireGuard appImport Tunnel(s) from File…":"Импорт туннелей из файла…","WireGuard appImport from file or archive":"Импорт из файла или архива","Import the configuration":"Импортируйте конфигурацию","WireGuard appImport tunnel(s) from file…":"Импорт туннелей из файла…","In %s:":"В %s:",Included:"Есть доступ","AmneziaVPN appInsert":"Вставить","Install from":"Установить с сайта","Interface name: 1-12 lowercase letters, digits or _.":"Имя интерфейса: 1–12 строчных латинских букв, цифр или _.",Internet:"Интернет","Invalid JSON.":"Некорректный JSON.","Invalid public key.":"Недопустимый публичный ключ.","It ended on %s.":"Доступ закончился %s.","It gets new keys and its current settings stop working. Set it up again with the new ones that open next.":"Устройство получит новые ключи, а текущие настройки перестанут работать. Настройте его заново с новыми - они откроются следом.","It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.":"Устройство получит новые ключи. Сейчас вы подключены через его текущие настройки: через несколько секунд после подтверждения связь прервётся. Добавьте новые - они откроются следом.","Its connection stops working at once. You can add it again later.":"Подключение сразу перестанет работать. Устройство можно будет добавить снова.","Its settings changed: update the connection":"Настройки изменились: обновите подключение",KB:"КБ","Key copied":"Ключ скопирован","Key generation failed (is amneziawg-tools installed?).":"Не удалось создать ключ (установлен ли amneziawg-tools?).","Key generation failed (no random data).":"Не удалось создать ключ (нет случайных данных).","Key generation failed.":"Не удалось создать ключ.",Language:"Язык","Last 7 days":"За 7 дней","Last connected %s":"В сети %s","Link copied":"Ссылка скопирована","Linux PC":"Компьютер с Linux",MB:"МБ","Mbit/s":"Мбит/с","Method not allowed.":"Метод не поддерживается.",Mobile:"Мобильный","Monthly data must be a positive number of GB.":"Месячный лимит трафика должен быть положительным числом ГБ.",Name:"Имя","No connection yet":"Подключения пока нет","No data limit. The count starts again on the 1st.":"Лимита трафика нет. Счёт начинается заново 1-го числа.","No end date":"Бессрочно","No free address left on %s.":"На сервере %s не осталось свободных адресов.","No free addresses left in the server subnet.":"В подсети сервера не осталось свободных адресов.","No limit":"Без лимита","No server":"Нет сервера","No server yet":"Сервера пока нет","Not found.":"Не найден.","Not included":"Нет доступа","Not on the %s right now?":"Открыли на другом %s?","Not set up yet":"Ещё не настроено","Nothing gets through until it resets.":"Ничего не проходит, пока лимит не обнулится.","Nothing opened? %s and add it in the app.":"Ничего не открылось? %s и добавьте его в приложении.","Now, %s":"Сейчас %s",OR:"ИЛИ","Official release on GitHub":"Официальная версия на GitHub","On %s.":"Дата окончания - %s.","On GitHub":"На GitHub","Only the admin can turn devices off.":"Отключать устройства может только администратор.","stepOpen %s":"Откройте %s","Open %s.":"Доступ открыт %s.","Open a terminal in the folder with the file":"Откройте терминал в папке с файлом","Open in AmneziaVPN":"Открыть в AmneziaVPN","Open on another device":"Открыть на другом устройстве","Open on the device":"Открыть на устройстве","Open securely":"Открыть по HTTPS","Open the link securely":"Откройте защищённую ссылку","Open this link on the %s to set it up there.":"Откройте эту ссылку на %s, чтобы настроить его там.","Open this link over HTTPS to get the connection settings.":"Чтобы получить настройки подключения, откройте эту ссылку по HTTPS.","Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.":"Откройте эту страницу в Safari или Chrome: магазин отсюда откроется, а передача в приложение - нет.","Open your link on the %s":"Откройте свою ссылку на %s","OpenWrt packages":"Пакеты OpenWrt","OpenWrt packages + kmod":"Пакеты OpenWrt + kmod",Other:"Другое","Other devices at home reach yours as %s":"Другие устройства дома обращаются к вашим по адресу %s","Out of data":"Трафик закончился","Outside allowed hours":"Вне часов доступа","Outside your hours":"Вне часов доступа",PC:"Компьютер",Paused:"На паузе","Person %s: circle %s does not exist.":"Человек %s: круга %s нет.","Person %s: has the same personal link as %s.":"Человек %s: личная ссылка совпадает со ссылкой человека %s.","Person %s: home service %s does not exist.":"Человек %s: домашнего сервиса %s нет.","Person %s: server %s does not exist.":"Человек %s: сервера %s нет.",Phone:"Телефон","Phones and tablets get a smaller packet size that suits mobile networks.":"У телефонов и планшетов пакеты меньше - так лучше для мобильных сетей.","Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app.":"Выберите AmneziaVPN в меню «Поделиться». Его там нет? %s и добавьте его в приложении.","Pick the file and connect":"Выберите файл и подключитесь","Point its camera at the code: the link opens there.":"Наведите камеру устройства на код - ссылка откроется на нём.","Point its camera at the code: this page opens there.":"Наведите камеру устройства на код - там откроется эта страница.","Point its camera at the code: your page opens there with this device ready to add.":"Наведите камеру устройства на код - там откроется ваша страница, и его можно будет сразу добавить.","Port must be 1-65535.":"Порт: от 1 до 65535.","QR code":"QR-код","AmneziaVPN appQR code":"QR-код",Reconnect:"Переподключить","Reconnect %s?":"Переподключить «%s»?",Remove:"Удалить","Remove %s?":"Удалить «%s»?",Rename:"Переименовать","Rename %s":"Переименовать «%s»",Renamed:"Переименовано","Request failed (%s)":"Не удалось выполнить запрос (%s)","Request too large.":"Слишком большой запрос.","Resets on the 1st.":"Обнуляется 1-го числа.",Router:"Роутер",Run:"Выполните",Save:"Сохранить","WireGuard appScan from QR code":"Сканировать QR-код","Send it to the %s":"Отправить на %s","Send it to the %s in a message or a note, then in AmneziaVPN: %s.":"Отправьте его на %s в сообщении или заметке, затем в AmneziaVPN: %s.","Send it to the %s, then import %s in %s.":"Отправьте его на %s, затем импортируйте %s в %s.","Send to AmneziaVPN":"Отправить в AmneziaVPN","Server is disabled":"Сервер выключен","Server is turned off":"Сервер выключен","Set up %s":"Настроить %s","Set up a server first.":"Сначала настройте сервер.","Settings changed":"Настройки изменились","Settings changed, update needed":"Настройки изменились, нужно обновить","Share as a file":"Поделиться файлом","Share file":"Поделиться файлом","Share the file":"Поделиться файлом","Share the link":"Поделиться ссылкой","Show key":"Показать ключ","Straight into %s":"Сразу в %s","Subnet must look like 10.77.0.0/24.":"Подсеть указывается так: 10.77.0.0/24.","Subnet overlaps %s.":"Подсеть пересекается с %s.",TB:"ТБ",Tablet:"Планшет","Tap “%s” and connect":"Нажмите «%s» и подключитесь","The APK is for phones without Google Play, or where the store hides the app.":"APK - для телефонов без Google Play или если магазин скрывает приложение.","The admin has turned this device off.":"Администратор отключил это устройство.","The app goes on the %s.":"Приложение ставится на %s.","The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).":"Браузер может предупредить, что сертификату нельзя доверять: это собственный сертификат роутера. Продолжите переход («Дополнительные» → «Перейти на сайт»).","The connection":"Подключение","The connection as one key":"Подключение одним ключом","The id may use lowercase letters, digits and underscores.":"В идентификаторе можно использовать строчные латинские буквы, цифры и подчёркивания.","The packages and the file for OpenWrt":"Пакеты и файл для OpenWrt","The page could not load":"Не удалось загрузить страницу","The person has no server.":"У человека нет сервера.","Then come back here and tap":"Затем вернитесь сюда и нажмите","Then import it in the app":"Затем импортируйте его в приложении","This device":"Это устройство","This key is already in use.":"Этот ключ уже используется.","This link no longer works":"Эта ссылка больше не работает","This page is open without encryption. To add or set up a device, open the same link over HTTPS:":"Эта страница открыта без шифрования. Чтобы добавить или настроить устройство, откройте ту же ссылку по HTTPS:","Through the router":"Через роутер",Today:"Сегодня","Too many changes in a short time. Try again in a few minutes.":"Слишком много изменений за короткое время. Попробуйте ещё раз через несколько минут.","Two steps, about a minute":"Два шага, около минуты","Two steps, about a minute: get the app, then add the connection.":"Два шага, около минуты: установите приложение, затем добавьте подключение.","Unknown DNS choice.":"Неизвестный вариант DNS.","Unknown action.":"Неизвестное действие.","Unknown circle.":"Неизвестный круг.","Unknown device.":"Неизвестное устройство.","Unknown end action.":"Неизвестное действие по окончании доступа.","Unknown person.":"Неизвестный человек.","Unknown server.":"Неизвестный сервер.","Unknown service %s.":"Неизвестный сервис %s.",Update:"Обновить","Update the connection":"Обновить подключение","Waiting for the connection":"Ждём подключения","Warning must be 0-60 days.":"Предупреждать можно за 0–60 дней.","What is it?":"Что это за устройство?","Windows PC":"Компьютер с Windows",Yesterday:"Вчера","You already have a device with this name.":"У вас уже есть устройство с таким именем.","You haven’t been added to one.":"Вас ещё не добавили ни на один сервер.","Your access":"Ваш доступ","Your access has ended.":"Ваш доступ закончился.","Your access is paused.":"Ваш доступ на паузе.","Your devices":"Ваши устройства","Your devices can’t connect until it’s enabled again.":"Ваши устройства не подключатся, пока его снова не включат.","Your devices can’t connect until it’s extended.":"Ваши устройства не подключатся, пока доступ не продлят.","Your devices can’t connect until it’s resumed.":"Ваши устройства не подключатся, пока доступ не возобновят.","bit/s":"бит/с",computer:"компьютер","on thecomputer":"компьютере",device:"устройство","on thedevice":"устройстве",ended:"закончился","ends today":"закончится сегодня","ends tomorrow":"закончится завтра","h1-h4 must be distinct":"h1-h4 должны быть разными","just now":"только что","kbit/s":"кбит/с",name:"имя",never:"никогда","no limit":"без лимита",phone:"телефон","on thephone":"телефоне",router:"роутер","on therouter":"роутере",tablet:"планшет","on thetablet":"планшете","this device":"это устройство"},p:{"%s already has %d device. Remove one first to lower the limit to %d.":["%s: уже %d устройство. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройства. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройств. Чтобы снизить лимит до %d, сначала удалите одно из них."],"%s day":["%s день","%s дня","%s дней"],"%s of %s slot free":["Свободно %s из %s места","Свободно %s из %s мест","Свободно %s из %s мест"],"You have reached your limit of %s device":["Достигнут лимит - %s устройство","Достигнут лимит - %s устройства","Достигнут лимит - %s устройств"],"You have reached your limit of %s device. Remove one to add another.":["Достигнут лимит - %s устройство. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройства. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройств. Удалите одно, чтобы добавить новое."],"day left":["день остался","дня осталось","дней осталось"],"ends in %s day":["закончится через %s день","закончится через %s дня","закончится через %s дней"]}};var It=[{code:"en",name:"English"},{code:"ru",name:"Русский"}],vi={ru:[nr]},rr={en:e=>e!==1?1:0,ru:e=>e%10===1&&e%100!==11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},ir="dl.lang";function yi(e,t){var r,o;let n=s=>s&&It.some(c=>c.code===s)?s:null;return(o=(r=n(e))!=null?r:t.map(s=>n(s.toLowerCase().split(/[-_]/)[0])).find(Boolean))!=null?o:"en"}var ot="en",xn=[],sr=[],ar=(e,t)=>t?`${t}${e}`:e;function lr(e,t){let n=ar(e,t);for(let r of xn)if(n in r.s)return r.s[n];return e}function bi(e,t,n,r){var c,m,g;let o=ar(t,r),s=(c=xn.find(f=>o in f.p))==null?void 0:c.p[o];return(g=s==null?void 0:s[((m=rr[ot])!=null?m:rr.en)(e)])!=null?g:e===1?t:n}var Je=()=>ot,cr=e=>lr(e);function wn(e,t=!0){var n;if(ot=It.some(r=>r.code===e)?e:"en",xn=(n=vi[ot])!=null?n:[],document.documentElement.lang=ot,t)try{localStorage.setItem(ir,ot)}catch{}sr.forEach(r=>r())}function dr(e){sr.push(e)}function xi(){try{return localStorage.getItem(ir)}catch{return null}}Object.assign(globalThis,{_:lr,N_:bi});var or;wn(yi(xi(),(or=navigator.languages)!=null&&or.length?navigator.languages:[navigator.language]),!1);var ur={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function Gt(e,t="dl-icon"){var r;let n=(r=ur[e])!=null?r:ur.phone;return``}function pr(e,t){let n=r=>{r==null||r===!1||(Array.isArray(r)?r.forEach(n):e.appendChild(typeof r=="string"?document.createTextNode(r):r))};t.forEach(n)}function i(e,t={},...n){let r=document.createElement(e);for(let[o,s]of Object.entries(t))s==null||s===!1||(o.startsWith("on")&&typeof s=="function"?r.addEventListener(o.slice(2),s):o==="class"?r.className=String(s):s===!0?r.setAttribute(o,""):r.setAttribute(o,String(s)));return pr(r,n),r}function We(e,...t){e.replaceChildren(),pr(e,t)}function Re(e){let t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstElementChild}var z=(e,t="i")=>Re(Gt(e,t));var Se=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function it(e,t,n=1){let r=Math.sqrt(e/n),o=t/(2*Math.sqrt(e*n)),s=f=>{if(o<.999){let O=r*Math.sqrt(1-o*o);return 1-Math.exp(-o*r*f)*(Math.cos(O*f)+o*r/O*Math.sin(O*f))}if(o<=1.001)return 1-Math.exp(-r*f)*(1+r*f);let T=Math.sqrt(o*o-1),M=-r*(o-T),b=-r*(o+T);return 1-(b*Math.exp(M*f)-M*Math.exp(b*f))/(b-M)},c=0;for(let f=0;f<3;f+=.004)Math.abs(1-s(f))>.0015&&(c=f);c+=.004;let m=[];for(let f=0;f<=64;f++)m.push(+s(c*f/64).toFixed(4));m[64]=1;let g=Math.round(c*1e3);return{duration:g,easing:`linear(${m.join(", ")})`,at:f=>f>=g?1:s(f/1e3)}}var Le=it(300,20),q=it(300,35),xe=it(520,24),hr=it(520,46),Ae=it(380,28),fr=it(900,60),j="cubic-bezier(0.23, 1, 0.32, 1)",Z="cubic-bezier(0.55, 0, 1, 0.45)",Mn="cubic-bezier(0.32, 0.72, 0, 1)";function mr(e){e.style.setProperty("--spring-bouncy",Le.easing),e.style.setProperty("--spring-bouncy-dur",`${Le.duration}ms`),e.style.setProperty("--spring-smooth",q.easing),e.style.setProperty("--spring-smooth-dur",`${q.duration}ms`),e.style.setProperty("--spring-soft",Ae.easing),e.style.setProperty("--spring-soft-dur",`${Ae.duration}ms`),e.style.setProperty("--spring-quick",fr.easing),e.style.setProperty("--spring-quick-dur",`${fr.duration}ms`)}function $(e,t,n){var r;return Se()?t.some(o=>"opacity"in o)?e.animate(t.map(o=>"opacity"in o?{opacity:o.opacity}:{}),{duration:Math.min(Number((r=n.duration)!=null?r:200),160),easing:"ease-out",fill:n.fill}):e.animate(t,{...n,duration:0,delay:0}):e.animate(t,n)}function gr(e,t){return e<=0||t<=0?0:(1-1/(e*.55/t+1))*t}function vr(e,t,n){return e<=0||t<-.1?!1:t>.4||e>n/3}function wi(){return(typeof document=="undefined"?"":document.documentElement.lang)||"en"}function _e(){let e=wi();return e==="en"?"en-GB":e}function N(e,...t){let n=0;return e.replace(/%([%sd])/g,(r,o)=>{var s;return o==="%"?"%":String((s=t[n++])!=null?s:"")})}function we(e,t){return e.toLocaleString(_e(),t===void 0?void 0:{minimumFractionDigits:t,maximumFractionDigits:t})}function ze(e,t,n){return N(N_(e,t,n),we(e))}function Ke(e,...t){let n=0;return e.split(/(%[%sd])/).filter(Boolean).map(r=>r==="%%"?"%":r==="%s"||r==="%d"?t[n++]:r)}function Mi(e,t,n){let r=0;for(;e>=n&&r=100||r===0?we(Math.round(e)):we(e,1)} ${t[r]}`}function Me(e){return Mi(!e||e<0?0:e,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function yr(e,t=Date.now()/1e3){if(!e)return _("never");let n=Math.max(0,Math.round(t-e));return n<60?_("just now"):n<3600?N(_("%s min ago"),Math.floor(n/60)):n<86400?N(_("%s h ago"),Math.floor(n/3600)):n<86400*30?N(_("%s d ago"),Math.floor(n/86400)):new Date(e*1e3).toLocaleDateString(_e(),{day:"numeric",month:"short",year:"numeric"})}function Wt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Pe(e){let[t,n,r]=e.split("-").map(Number);return new Date(t,(n||1)-1,r||1,12)}function ki(e){return(typeof e=="string"?/^\d{4}-\d{2}-\d{2}$/.test(e)?Pe(e):new Date(e):e).toLocaleDateString(_e(),{day:"numeric",month:"short",year:"numeric"})}function zt(e){return e?ki(e):""}function Ci(e,t){let n=r=>{let[o,s,c]=r.split("-").map(Number);return Date.UTC(o,s-1,c)};return Math.round((n(e)-n(t))/864e5)}function st(e,t){let n=Pe(e);return n.setDate(n.getDate()+t),Wt(n)}function Kt(e,t=Date.now()){if(!e)return null;let n=typeof t=="number"?Wt(new Date(t)):t,r=Ci(e,n);return r>=0?r+1:r}function wt(e,t){return t!=null&&t>0&&e.expire_warn>0&&t<=e.expire_warn}function br(e){return e<=1?_("ends today"):e===2?_("ends tomorrow"):ze(e,"ends in %s day","ends in %s days")}function xr(e){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[e]}function Ut(e){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[e]}function qt(e){let t=n=>n.disabled?3:n.online?0:n.handshake?1:2;return e.map((n,r)=>[n,r]).sort((n,r)=>t(n[0])-t(r[0])||n[1]-r[1]).map(([n])=>n)}var ce={vpn:"AmneziaVPN",awg:"AmneziaWG",wg:"WireGuard"};function Mr(e,t=0){return/iPhone|iPad|iPod/.test(e)||/Macintosh/.test(e)&&t>1?"ios":/Android/.test(e)?"android":/Windows/.test(e)?"windows":/Mac OS X|Macintosh/.test(e)?"mac":/CrOS/.test(e)?"unknown":/Linux|X11/.test(e)?"linux":"unknown"}var kr=e=>/Telegram|FBAN|FBAV|Instagram|VKClient|Line\//i.test(e);function Cr(e,t){return e==="router"||t==="unknown"?!1:e==="phone"||e==="tablet"?t==="ios"||t==="android":e==="computer"?t==="windows"||t==="mac"||t==="linux":!0}function _r(e){let t=[{id:"vpn",name:ce.vpn},{id:"awg",name:ce.awg}];return e==="off"&&t.push({id:"wg",name:ce.wg}),t}var Ft="https://github.com/amnezia-vpn/amnezia-client/releases/latest",wr=e=>({href:e,top:_("APK file on"),main:"GitHub",mark:"github",why:_("The APK is for phones without Google Play, or where the store hides the app.")});function Er(e,t){var c;let n=_("Download on the"),r=_("Get it on"),o=_("Official release on GitHub");return(c={vpn:{ios:{href:"https://apps.apple.com/app/amneziavpn/id1600529900",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.vpn",top:r,main:"Google Play",mark:"googleplay",alt:wr(Ft)},windows:{href:Ft,top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:Ft,top:o,main:_("Download for Mac"),mark:"apple"},linux:{href:Ft,top:o,main:_("Download for Linux"),mark:"linux"}},awg:{ios:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.awg",top:r,main:"Google Play",mark:"googleplay",alt:wr("https://github.com/amnezia-vpn/amneziawg-android/releases")},windows:{href:"https://github.com/amnezia-vpn/amneziawg-windows-client/releases",top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://github.com/amnezia-vpn/amneziawg-tools",top:_("On GitHub"),main:"amneziawg-tools",mark:"linux"}},wg:{ios:{href:"https://apps.apple.com/app/wireguard/id1441195209",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=com.wireguard.android",top:r,main:"Google Play",mark:"googleplay"},windows:{href:"https://www.wireguard.com/install/",top:_("Download from"),main:"wireguard.com",mark:"windows"},mac:{href:"https://apps.apple.com/app/wireguard/id1451685025",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://www.wireguard.com/install/",top:_("Install from"),main:"wireguard.com",mark:"linux"}}}[e][t])!=null?c:null}var Tr=e=>e==="wg"?{href:"https://openwrt.org/docs/guide-user/services/vpn/wireguard/start",top:_("OpenWrt packages"),main:"wireguard-tools",mark:"openwrt"}:{href:"https://openwrt.org/packages/start",top:_("OpenWrt packages + kmod"),main:"amneziawg-tools",mark:"openwrt"},kn=e=>e==="android",kt=e=>`${e.replace(/\.conf$/i,"")}.vpn`,Ue=(...e)=>e.join(" → ");function Mt(e){return{ios:{file:Ue("+",_("Create from file or archive","WireGuard app")),qr:Ue("+",_("Create from QR code","WireGuard app"))},android:{file:Ue("+",_("Import from file or archive","WireGuard app")),qr:Ue("+",_("Scan from QR code","WireGuard app"))},mac:{file:Ue("+",_("Import Tunnel(s) from File…","WireGuard app"))},windows:{file:Ue(_("Add Tunnel","WireGuard app"),_("Import tunnel(s) from file…","WireGuard app"))}}[e]}function Ct(e,t="unknown"){var r;if(e==="vpn")return Ue("+",_("QR code","AmneziaVPN app"));let n=(r=Mt(t))==null?void 0:r.qr;return n!=null?n:N(_("%s (Android: %s)"),Mt("ios").qr,Mt("android").qr.replace(/^.* → /,""))}function Vt(e,t="unknown"){var n;return e==="vpn"?Ue("+",_("Insert","AmneziaVPN app")):((n=Mt(t))!=null?n:Mt("android")).file}var Lr=()=>N(_("Tap “%s” and connect"),_("Continue","AmneziaVPN app"));function Ar(e,t,n,r){if(t==="linux")return[[_("Open a terminal in the folder with the file"),""],[`${_("Run")} `,`sudo ${e==="wg"?"wg-quick":"awg-quick"} up ./${n}`]];let o=Vt(e,t);return[[N(_("Open %s","step"),ce[e]),""],[o.replace(/ → [^→]*$/," → "),o.replace(/^.* → /,"")],[r?_("Confirm the import and connect"):_("Pick the file and connect"),""]]}function Sr(e){return{ios:"iPhone / iPad",android:"Android",windows:"Windows",mac:"Mac",linux:"Linux",unknown:_("this device")}[e]}var Pr=(e,t)=>`${e}#setup=${t}`;function $r(e){var t,n;return(n=(t=/^#setup=(d_[0-9a-f]{8})$/.exec(e))==null?void 0:t[1])!=null?n:null}var Dr=e=>`${e}#add`,Hr=e=>e==="#add",Cn=(e,t=!1)=>(t?{phone:_("phone","on the"),tablet:_("tablet","on the"),computer:_("computer","on the"),router:_("router","on the"),other:_("device","on the")}:{phone:_("phone"),tablet:_("tablet"),computer:_("computer"),router:_("router"),other:_("device")})[e];var oe=null,pe=()=>oe;function ke(e){oe=e}var _i=document.getElementById("app"),Or,at=(Or=_i.dataset.base)!=null?Or:"",Rr=/^\/[a-z]{6}-[a-z]{6}-[a-z]{6}$/.test(at)?at.slice(1):"",lt=()=>location.origin+location.pathname,Be=()=>{var e;return(e=oe==null?void 0:oe.today)!=null?e:Wt(new Date)},ct=()=>{var e;return(e=oe==null?void 0:oe.now)!=null?e:Date.now()/1e3},Yt=()=>Mr(navigator.userAgent,navigator.maxTouchPoints),Ei=()=>(oe==null?void 0:oe.server.awg_disguise)===!1,Br=()=>{var e;return(e=oe==null?void 0:oe.server.preset)!=null?e:Ei()?"off":"max"},Nr=()=>(oe==null?void 0:oe.https_url)||null,Xe=()=>(oe==null?void 0:oe.server.name)||"Dawnline",Ir=()=>{};function Gr(e){Ir=e}var Ee=(e={})=>Ir(e);var qe=class extends Error{constructor(n,r,o){super(r);this.status=n;this.httpsUrl=o}};async function fe(e,t){let n=await fetch(`${at}/api/${e}`,{method:t===void 0?"GET":"POST",credentials:"omit",headers:t===void 0?{"Accept-Language":Je()}:{"Content-Type":"application/json","Accept-Language":Je()},body:t===void 0?void 0:JSON.stringify(t),cache:"no-store"}),r=null;try{r=await n.json()}catch{}if(!n.ok)throw new qe(n.status,r!=null&&r.error?cr(r.error):N(_("Request failed (%s)"),n.status),(r==null?void 0:r.https_url)||void 0);return r}var jt=e=>e instanceof qe&&(e.status===404||e.status===401);var Fr=mi(Ur(),1),Ti=e=>``,qr="#0a0a0a",Li="#f2f2f2",Ai={night:[qr,Li],day:["#ffffff",qr]},En=e=>e.length>300,dt=e=>+e.toFixed(2);function _n(e,t,n,r,o){return`M${dt(e+o)} ${dt(t)}h${dt(n-2*o)}a${o} ${o} 0 0 1 ${o} ${o}v${dt(r-2*o)}a${o} ${o} 0 0 1 -${o} ${o}h-${dt(n-2*o)}a${o} ${o} 0 0 1 -${o} -${o}v-${dt(r-2*o)}a${o} ${o} 0 0 1 ${o} -${o}z`}function Vr(e,t=3,n=!0,r="plain"){let o=En(e),s=r!=="plain",[c,m]=s?Ai[r]:["#fff","#000"],g=(0,Fr.default)(0,o?"L":"H");g.addData(e,"Byte"),g.make();let f=g.getModuleCount(),T=f+t*2,M=n&&!o?Math.round(f*.22):0;M&&(f-M)%2&&M++;let b=(f-M)/2,O=b+M,B=(a,h)=>M>0&&a>=b&&a=b&&hs&&(h<7&&a<7||h<7&&a>=f-7||h>=f-7&&a<7),R="";if(s){let a=o?.48:.42;for(let h=0;h${Ti(s?c:"#fff")}`}let v=``;return s?`${v}${d}`:`${v}${d}`}var Yr={opacity:1,filter:"blur(0px)",transform:"none"},Si={opacity:0,filter:"blur(5px)",transform:"scale(.86)"},jr={opacity:0,filter:"blur(5px)",transform:"scale(.6)"},Qr={duration:180,easing:Z,fill:"forwards"},Qt={duration:340,delay:70,easing:j,fill:"backwards"},Jr=Qt.delay+Qt.duration,Jt=new WeakMap;function Tn(e){let t=getComputedStyle(e);return{opacity:t.opacity,filter:t.filter==="none"?"blur(0px)":t.filter,transform:t.transform}}function Xr(e){var t;for(let n of[...e.childNodes])n.nodeType===Node.TEXT_NODE&&((t=n.textContent)!=null&&t.trim())&&n.replaceWith(i("span",{},n.textContent));return[...e.children].filter(n=>!n.classList.contains("orb"))}function Zr(e,t){var r;let n=(r=Jt.get(e))!=null?r:[];Jt.set(e,t),n.forEach(o=>o.cancel())}function eo(e){var o;(o=e.querySelector(":scope > .orb"))==null||o.remove();let t=Xr(e),n=t.map(Tn),r=i("span",{class:"orb","aria-hidden":"true"},i("i"),i("i"));e.append(r),e.classList.add("busy"),e.setAttribute("aria-busy","true"),Zr(e,[...t.map((s,c)=>$(s,[n[c],Si],Qr)),$(r,[jr,Yr],Qt)])}function to(e){let t=e.querySelector(":scope > .orb"),n=Xr(e),r=[...t?[$(t,[Tn(t),jr],Qr)]:[],...n.map(o=>$(o,[Tn(o),Yr],Qt))];Zr(e,r),e.removeAttribute("aria-busy"),Promise.all(r.map(o=>o.finished)).then(()=>{Jt.get(e)===r&&(Jt.delete(e),r.forEach(o=>o.cancel()),t==null||t.remove(),e.classList.remove("busy"))},()=>{})}var no=e=>[...e].map(t=>i("i",{},t)),ut=new WeakMap,_t=e=>{var t,n,r;return(r=(n=(t=ut.get(e))==null?void 0:t.text)!=null?n:e.textContent)!=null?r:""};function Sn(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect()}function ro(e){var s;let t=e.firstChild;if(!t||t.nodeType!==Node.TEXT_NODE)return[];let n=document.createRange(),r=[],o=0;for(let c of(s=t.textContent)!=null?s:"")n.setStart(t,o),n.setEnd(t,o+c.length),r.push(n.getBoundingClientRect().left),o+=c.length;return r.map(c=>c-r[0])}function oo(e,t){let n=[...e.children];if(!n.length)return;let r=n[0].getBoundingClientRect().left;n.forEach((o,s)=>{if(!s||t[s]===void 0)return;let c=r+t[s]-o.getBoundingClientRect().left;Math.abs(c)>.01&&(o.style.marginLeft=`${c}px`)})}function Pi(e,t){let n=0;for(;nnew Array(s.length+1).fill(0));for(let g=o.length-1;g>=0;g--)for(let f=s.length-1;f>=0;f--)c[g][f]=o[g]===s[f]?c[g+1][f+1]+1:Math.max(c[g+1][f],c[g][f+1]);let m=[];for(let g=0;g=c[g][f+1]?g++:f++;for(let g=r;g>0;g--)m.push([e.length-g,t.length-g]);return m}function Xt(e){let t=ut.get(e);t&&(clearTimeout(t.timer),ut.delete(e),e.getAnimations().forEach(n=>n.cancel()),e.classList.remove("mt","mt-ib"),e.textContent=t.text)}function Ne(e,t){Xt(e),e.textContent=t}function te(e,t,n=_t(e),r={}){var le,ue;let{whole:o=!1,at:s}=r,c=((le=r.glide)!=null?le:!0)&&!s,m=ut.has(e)?e.getBoundingClientRect().width:null;if(Xt(e),n===t||Se()||!e.getClientRects().length){e.textContent=t;return}let g=getComputedStyle(e),f=o&&g.display==="inline";g.display==="inline"&&!o&&e.classList.add("mt-ib"),g.position==="static"&&e.classList.add("mt");let T=null,M=s!=null?s:null,b=[];M||(e.textContent=n,T=e.getBoundingClientRect(),M=Sn(e),b=ro(e)),e.textContent=t;let O=e.getBoundingClientRect(),B=ro(e),D=(ue=m!=null?m:T==null?void 0:T.width)!=null?ue:O.width,R=c&&!f&&!!T&&Math.abs(O.width-D)>.5,P=!R||!T||Math.abs(O.left-T.left)<.5?"start":Math.abs(O.right-T.right)<.5?"end":"middle",d=i("span",{class:o?"mt-new w":"mt-new"},o?t:no(t)),v=i("span",{class:o?"mt-old w":"mt-old","aria-hidden":"true"},o?n:no(n));o&&(v.style.width=`${M.width+1}px`),e.replaceChildren(d,v),R&&$(e,[{width:`${D}px`},{width:`${O.width}px`}],{duration:q.duration,easing:q.easing,fill:"forwards"});let a=e.getBoundingClientRect(),h=(Y,ee)=>{v.style.top=`${ee}px`,P==="end"?v.style.right=`${-Y}px`:P==="middle"?(v.style.left="50%",v.style.translate=`calc(-50% + ${Y}px) 0`):v.style.left=`${Y}px`},p=P==="end"?M.right-a.right:P==="middle"?(M.left+M.right-a.left-a.right)/2:M.left-a.left;h(p,M.top-a.top);let A=Sn(v);if(h(p+M.left-A.left,M.top-a.top+M.top-A.top),o){$(v,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}),$(d,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});let Y=Math.max(340,R?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),Y)});return}oo(d,B),oo(v,b);let u=[...v.children],l=[...d.children],E=Pi([...n],[...t]),x=new Set(E.map(([Y])=>Y)),C=new Set(E.map(([,Y])=>Y));E.forEach(([Y,ee])=>{let ie=u[Y].getBoundingClientRect(),ne=l[ee].getBoundingClientRect();u[Y].style.visibility="hidden",(Math.abs(ie.left-ne.left)>.5||Math.abs(ie.top-ne.top)>.5)&&$(l[ee],[{transform:`translate(${ie.left-ne.left}px, ${ie.top-ne.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})});let I=u.filter((Y,ee)=>!x.has(ee)),G=l.filter((Y,ee)=>!C.has(ee)),V=Math.min(12,160/Math.max(1,I.length)),J=Math.min(22,260/Math.max(1,G.length));I.forEach((Y,ee)=>$(Y,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(4px)",transform:"translateY(-0.45em)"}],{duration:220,delay:ee*V,easing:Z,fill:"forwards"})),G.forEach((Y,ee)=>$(Y,[{opacity:0,filter:"blur(4px)",transform:"translateY(0.45em)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:380,delay:120+ee*J,easing:j,fill:"backwards"}));let re=Math.max(220+I.length*V,G.length?120+G.length*J+380:0,R||E.length?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),re)})}function Zt(e){return new Map([...e.querySelectorAll("[data-t]")].map(t=>[t.dataset.t,_t(t)]))}function en(e,t){e.querySelectorAll("[data-t]").forEach(n=>{var s;let r=t.get(n.dataset.t),o=(s=n.textContent)!=null?s:"";r!==void 0&&r!==o&&te(n,o,r)})}var io=e=>`${e.tagName}.${[...e.classList].filter(t=>t!=="mt"&&t!=="mt-ib").join(" ")}`,so=e=>e.outerHTML.replace(/\bgl\d+/g,"gl");function $i(e){let t=new Map,n=(r,o)=>r.childNodes.forEach((s,c)=>{var T,M;let m=`${o}/${c}`;if(s.nodeType===Node.TEXT_NODE){if((T=s.textContent)!=null&&T.trim()){let b=document.createRange();b.selectNodeContents(s);let O=b.getBoundingClientRect();t.set(m,{kind:"#text",text:s.textContent,svg:"",at:O,words:O,node:s})}return}if(!(s instanceof Element))return;let g=s instanceof SVGElement?so(s):"",f=s instanceof HTMLElement&&!g?Sn((M=s.querySelector(":scope > .mt-new"))!=null?M:s):null;t.set(m,{kind:io(s),text:s instanceof HTMLElement?_t(s):"",svg:g,at:s.getBoundingClientRect(),words:f,node:s}),g||n(s,m)});return n(e,""),t}var Ln=e=>$(e,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});function tn(e,t){var O;let n=$i(e),r=e.getBoundingClientRect();if(We(e,t),!n.size||Se())return;let o=e.getBoundingClientRect(),s=B=>B&&new DOMRect(B.left-r.left+o.left,B.top-r.top+o.top,B.width,B.height),c=[],m=[],g=new Set,f=(B,D,R)=>{var v;let P=B.parentElement,d=R?(v=n.get(R))==null?void 0:v.at:r;D!=null&&D.at&&D.node instanceof Element&&m.push(P&&d?[D.node,D.at,P,d]:[D.node,D.at,e,r]),c.push(()=>Ln(B))},T=(B,D,R)=>{let P=B.getBoundingClientRect(),d=D.left-r.left-(P.left-o.left),v=D.top-r.top-(P.top-o.top),a=d-R[0],h=v-R[1];return(Math.abs(a)>.5||Math.abs(h)>.5)&&$(B,[{transform:`translate(${a}px, ${h}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}),[d,v]},M=(B,D,R)=>[...B.childNodes].forEach((P,d)=>{var A,u;let v=`${D}/${d}`;g.add(v);let a=n.get(v);if(P.nodeType===Node.TEXT_NODE){let l=(A=P.textContent)!=null?A:"";if(!l.trim()||(a==null?void 0:a.kind)==="#text"&&a.text===l)return;let E=i("span",{},l);P.replaceWith(E),a!=null&&a.at&&T(E,a.at,R),c.push(()=>{var x;return(a==null?void 0:a.kind)==="#text"&&l.length<=40&&a.text.length<=40?te(E,l,a.text,{whole:!0,at:(x=s(a.words))!=null?x:void 0}):Ln(E)});return}if(!(P instanceof Element))return;let h=P.getBoundingClientRect();if(!a||a.kind!==io(P)||a.at&&Math.abs(a.at.height-h.height)>1&&!(P instanceof SVGElement))return f(P,a,D);let p=a.at?T(P,a.at,R):R;if(P instanceof SVGElement){a.svg!==so(P)&&c.push(()=>Ln(P));return}if(!P.children.length&&P instanceof HTMLElement){let l=(u=P.textContent)!=null?u:"";l!==a.text&&c.push(()=>{var E;return l.length<=40&&a.text.length<=40?te(P,l,a.text,{whole:!0,at:(E=s(a.words))!=null?E:void 0}):f(P,a,D)});return}M(P,v,p)});M(e,"",[0,0]);for(let[B,D]of n)!g.has(B)&&B.lastIndexOf("/")===0&&D.at&&D.node instanceof Element&&m.push([D.node,D.at,e,r]);c.forEach(B=>B());let b=new Map;for(let[,,B]of m)!b.has(B)&&getComputedStyle(B).position==="static"&&B.classList.add("mt"),b.set(B,((O=b.get(B))!=null?O:0)+1);for(let[B,D,R,P]of m){let d=B;d.style.position="absolute",d.style.margin="0",d.style.left=`${D.left-P.left-R.clientLeft}px`,d.style.top=`${D.top-P.top-R.clientTop}px`,d.style.width=`${D.width}px`,d.style.pointerEvents="none",d.setAttribute("aria-hidden","true"),R.appendChild(d),$(d,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}).onfinish=()=>{d.remove();let v=b.get(R)-1;b.set(R,v),v||R.classList.remove("mt")}}}var Di='',An=()=>[z("apple"),Re(Di)];function Hi(e,t){if(e===t)return["",e,e,""];let n=e.split(" "),r=t.split(" "),o=0;for(;og?d[2]:d[1],T=d=>i("span",{class:"osm-p"},d),M=()=>{c=o.findIndex(d=>d[1]!==d[2]),c<0&&(g=0),s=o.map(d=>({pre:T(d[0]),word:T(f(d)),suf:T(d[3])})),m=c>=0?i("span",{class:"osm-ic"},An()[g]):null,n.replaceChildren(...s.flatMap((d,v)=>[v?i("span",{class:"arr"},"›"):null,d.pre,v===c?m:null,d.word,d.suf]).filter(d=>!!d))},b={width:"1.05em",marginRight:"0.25em"},O=d=>$(d,[{opacity:1,filter:"blur(0px)",...b},{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),B=d=>$(d,[{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"},{opacity:1,filter:"blur(0px)",...b}],{duration:q.duration,easing:q.easing}),D=(d,v)=>{r.setAttribute("aria-label",(d===v?d:N(_("%s (Android: %s)"),d,v.split(" → ").pop())).replace(/ → /g," › "));let a=d.split(" → "),h=v.split(" → "),p=a.map((u,l)=>{var E;return Hi(u,(E=h[l])!=null?E:u)});if(!s.length||p.length!==o.length)return o=p,M();let A=c;o=p,c=o.findIndex(u=>u[1]!==u[2]),c<0&&(g=0),o.forEach((u,l)=>{te(s[l].pre,u[0],void 0,{whole:!0}),te(s[l].word,f(u),void 0,{whole:!0}),te(s[l].suf,u[3],void 0,{whole:!0})}),c!==A&&(m&&O(m),m=c>=0?i("span",{class:"osm-ic"},An()[g]):null,m&&(s[c].word.before(m),B(m)))};D(e,t);let R=()=>{if(!r.isConnected)return clearInterval(P);if(c<0||!m||!r.offsetParent)return;g=1-g,te(s[c].word,f(o[c]));let d=m.firstElementChild,v=An()[g];if(Se()){d.replaceWith(v);return}m.appendChild(v),$(d,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(-40deg)"}],{duration:200,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),$(v,[{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(40deg)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:xe.duration,delay:80,easing:xe.easing,fill:"backwards"})},P=window.setInterval(R,3e3);return{el:r,set:D}}var nn=null,Et=null,lo=0,co=(e,t,n)=>$(e,t,{duration:n,easing:Z,fill:"forwards"}).onfinish=()=>e.remove();function Ce(e,t=!1){nn!=null||(nn=document.body.appendChild(i("div",{class:"toasts"}))),Et&&co(Et,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(4px)"}],140);let n=i("div",{class:`toast${t?" bad":""}`,role:"status"},z(t?"alert":"check"),i("span",{},e));nn.appendChild(n),Et=n,$(n,[{opacity:0,transform:"translateY(18px) scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Le.duration,easing:Le.easing}),clearTimeout(lo),lo=window.setTimeout(()=>{Et===n&&(Et=null,co(n,[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.96)",filter:"blur(4px)"}],180))},2400)}function Oi(e){var s;if(e.classList.contains("copied"))return;let t=e.querySelector("svg.i"),n=e.querySelector(".lbl, .b-main"),r=n?_t(n):"";e.classList.add("copied");let o=null;t&&(o=z("check",(s=t.getAttribute("class"))!=null?s:"i"),t.replaceWith(o),$(o,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})),n&&te(n,_("Copied")),setTimeout(()=>{o&&t&&o.replaceWith(t),n&&te(n,r),e.classList.remove("copied")},1600)}async function he(e,t=_("Copied"),n){try{await navigator.clipboard.writeText(e)}catch{let r=i("textarea",{class:"offscreen"},e);document.body.appendChild(r),r.select();let o=document.execCommand("copy");if(r.remove(),!o)return Ce(_("Copying is blocked here. Select the text and copy it by hand."),!0)}n instanceof Element&&Oi(n),Ce(t)}function Ze(e,t){var o;let n=navigator;if(Yt()!=="ios"||typeof n.share!="function"||typeof File=="undefined")return null;let r=new File([t],e,{type:"application/octet-stream"});return(o=n.canShare)!=null&&o.call(n,{files:[r]})?async()=>{try{await n.share({files:[r]})}catch(s){(s==null?void 0:s.name)!=="AbortError"&&rn(e,t)}}:null}function rn(e,t){let n=URL.createObjectURL(new Blob([t],{type:"application/octet-stream"})),r=i("a",{href:n,download:e,class:"offscreen"});document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.remove()},1e3)}function Tt(e,t){let n=Ze(e,t);n?n():rn(e,t)}async function et(e,t){if(e.disabled)return;e.disabled=!0,eo(e);let n=performance.now();try{await t()}finally{let r=Se()?0:Jr-(performance.now()-n);r>0&&await new Promise(o=>setTimeout(o,r)),to(e),e.disabled=!1}}var Pn=matchMedia("(prefers-color-scheme: light)"),Ri=()=>Pn.matches?"day":"night";function $n(e,t){var n,r;e.dataset.qr=t,e.classList.toggle("dense",En(t)),e.classList.toggle("light",Pn.matches),e.innerHTML=Vr(t,3,!0,Ri()),e.dataset.mods=String((r=(n=e.firstElementChild)==null?void 0:n.viewBox.baseVal.width)!=null?r:0)}function Lt(e,t=!1){let n=i("div",{class:`qrbox${t?" big":""}`});return $n(n,e),n}Pn.addEventListener("change",()=>document.querySelectorAll(".qrbox[data-qr]").forEach(e=>{var t;(t=e.querySelector("svg.old"))==null||t.remove(),$n(e,e.dataset.qr)}));function Dn(e,t){let n=Lt(e),r=i("div",{class:"words"},t),o=i("div",{class:"side"},r),s=i("div",{class:`coderow${n.classList.contains("dense")?" stacked":""}`},n,o);return{el:s,swap(c,m){let g=n.dataset.qr===c?null:n.querySelector("svg");if(g){$n(n,c),s.classList.toggle("stacked",n.classList.contains("dense"));let T=n.querySelector("svg");g.classList.add("old"),n.appendChild(g),$(T,[{opacity:0},{opacity:1}],{duration:200,easing:j}),$(g,[{opacity:1},{opacity:0}],{duration:220,delay:110,easing:Z,fill:"forwards"}).onfinish=()=>g.remove()}if(!m)return;let f=r;r=i("div",{class:"words"},m),o.appendChild(r),f.classList.add("old"),$(r,[{opacity:0,filter:"blur(3px)"},{opacity:1,filter:"blur(0px)"}],{duration:220,easing:j}),$(f,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(3px)"}],{duration:200,delay:90,easing:Z,fill:"forwards"}).onfinish=()=>f.remove()}}}function pt(e){let t=typeof navigator.share=="function";return i("div",{class:"linkrow"},i("span",{class:"mono"},e.replace(/^https?:\/\//,"")),i("button",{type:"button",class:"knob","aria-label":_("Copy the link"),onclick:n=>he(e,_("Link copied"),n.currentTarget)},z("copy")),t?i("button",{type:"button",class:"knob","aria-label":_("Share the link"),onclick:()=>navigator.share({url:e,title:Xe()}).catch(()=>{})},z("share")):null)}var tt=null,Ie=null,At=()=>!!tt;function $e(e=!1){let t=tt;if(t){if(tt=null,Ie==null||Ie.setAttribute("aria-expanded","false"),Ie=null,e){t.remove();return}$(t,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(3px)"}],{duration:120,easing:Z,fill:"forwards"}).onfinish=()=>t.remove()}}function on(e,t){var f,T;if(Ie===e&&tt)return $e();$e(!0);let n=t.filter((M,b)=>M||b>0&&t[b-1]&&t.slice(b+1).some(Boolean)),r=i("span",{class:"menu-hl"}),o=i("div",{class:"menu",role:"menu"},r);for(let M of n){if(!M){o.appendChild(i("div",{class:"menu-sep"}));continue}let b=i("button",{type:"button",role:M.checked===void 0?"menuitem":"menuitemradio","aria-checked":M.checked===void 0?null:String(M.checked),class:`mi ${(f=M.tone)!=null?f:""}`,onclick:()=>{$e(),M.run()}},M.checked===void 0?z((T=M.icon)!=null?T:""):z("check",M.checked?"i":"i off"),i("span",{},M.label));b.addEventListener("pointerenter",()=>{var O;r.className=`menu-hl${r.style.opacity==="1"?" moving":""} ${(O=M.tone)!=null?O:""}`,r.style.transform=`translateY(${b.offsetTop-6}px)`,r.style.opacity="1"}),o.appendChild(b)}o.addEventListener("pointerleave",()=>r.style.opacity="0"),document.body.appendChild(o);let s=e.getBoundingClientRect(),c=o.offsetWidth,m=o.offsetHeight,g=s.bottom+8+m{let t=e.target;tt&&!tt.contains(t)&&!(Ie!=null&&Ie.contains(t))&&$e()});addEventListener("scroll",()=>$e(),{passive:!0});var de,De,F,Hn,mt,Ve,ae,Fe=[],sn=null,On=null,St=!1,ft=null,He=()=>!!(de!=null&&de.classList.contains("open")),gt=400,uo=80,Bi=3.2,vt=()=>matchMedia("(min-width: 760px)").matches,ht=gt,Rn=null;function yt(){var o;if(!de||!He())return null;if(!vt())return F.style.maxWidth&&(F.style.maxWidth=""),ht=gt,null;let e=[...ae.querySelectorAll(".qrbox.dense")].find(s=>{let c=s.closest(".acc-row");return s.offsetWidth&&(!c||c.classList.contains("open"))&&!s.closest(".leaving")}),t=gt;if(e){let s=Math.min(innerWidth-32-uo,innerHeight-120);t=Math.max(gt,Math.round(Math.min(+((o=e.dataset.mods)!=null?o:0)*Bi,s)+uo))}let n=e&&e!==Rn?e:null;if(Rn=e!=null?e:null,Math.abs(t-ht)<8)return n?{from:t,want:t,reveal:n}:null;let r=parseFloat(getComputedStyle(F).maxWidth)||ht;return ht=t,F.getAnimations().filter(s=>{var c;return(c=s.effect)==null?void 0:c.getKeyframes().some(m=>"maxWidth"in m)}).forEach(s=>s.cancel()),F.style.maxWidth=`${t}px`,{from:r,want:t,reveal:n}}function bt(e){if(!e)return;Math.abs(e.from-e.want)>1&&$(F,[{maxWidth:`${e.from}px`},{maxWidth:`${e.want}px`}],{duration:q.duration,easing:q.easing});let t=e.reveal;t&&setTimeout(()=>{if(!t.isConnected)return;let n=Ve.getBoundingClientRect(),r=t.getBoundingClientRect(),o=r.bottom>n.bottom-16?r.bottom-n.bottom+16:r.topme()},z("x")),mt=i("div",{class:"sheet-acts"}),ae=i("div",{class:"vp"}),Ve=i("div",{class:"sheet-scroll"},ae),F=i("div",{class:"sheet",role:"dialog","aria-modal":"true"},Hn,mt,Ve),De=i("div",{class:"scrim",onclick:()=>me()}),de=i("div",{class:"sheet-root","aria-hidden":"true"},De,F),document.body.appendChild(de),new ResizeObserver(()=>bt(yt())).observe(ae),Gi()}function po(e){F.setAttribute("aria-label",e.label),Hn.setAttribute("aria-label",_("Close")),F.setAttribute("role",e.asks?"alertdialog":"dialog"),F.classList.toggle("asks",!!e.asks)}function an(){let e=On;On=null,e==null||e()}function fo(e){On=e}function nt(e){sn=e}function ge(e){if(de||Ni(),$e(!0),an(),He()){Fe=[e],Bn(e());return}ft=document.activeElement instanceof HTMLElement?document.activeElement:null,Fe=[e],sn=null,ht=gt,Rn=null,F.style.maxWidth="",F.classList.remove("arrived");let t=e();ae.replaceChildren(t.el),ho(t,!1),po(t),de.classList.add("open"),de.setAttribute("aria-hidden","false"),document.body.classList.add("locked");let n=yt();if(n&&bt({...n,from:n.want}),F.getAnimations().forEach(r=>r.cancel()),De.getAnimations().forEach(r=>r.cancel()),F.style.transform="",vt()?$(F,[{opacity:0,transform:"scale(.9)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Ae.duration,easing:Ae.easing}):$(F,[{transform:"translateY(calc(100% + 40px))"},{transform:"none"}],{duration:500,easing:Mn}),$(De,[{opacity:0},{opacity:1}],vt()?{duration:Ae.duration,easing:Ae.easing}:{duration:420,easing:"ease-out"}),!St)try{history.pushState({sheet:!0},""),St=!0}catch{}}function me(e=!1){if(!He()||de.dataset.closing)return;an(),St&&(St=!1,history.back()),document.body.classList.remove("locked");let t=()=>{de.classList.remove("open"),de.setAttribute("aria-hidden","true"),delete de.dataset.closing,F.style.transform="",De.style.opacity="",F.getAnimations().forEach(s=>s.cancel()),De.getAnimations().forEach(s=>s.cancel()),ae.getAnimations().forEach(s=>s.cancel()),ae.replaceChildren(),mt.replaceChildren(),F.classList.remove("arrived"),F.style.maxWidth="",ht=gt,Fe=[],ft!=null&&ft.isConnected&&ft.focus({preventScroll:!0}),ft=null;let o=sn;sn=null,o==null||o()};if(e)return t();de.dataset.closing="1";let n=getComputedStyle(F).transform;F.getAnimations().forEach(o=>o.cancel()),$(De,[{opacity:getComputedStyle(De).opacity},{opacity:0}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:320,easing:"ease-out",fill:"forwards"});let r=n==="none"?"none":n;$(F,vt()?[{opacity:1,transform:r,filter:"blur(0px)"},{opacity:0,transform:`${r==="none"?"":r} scale(.96)`.trim(),filter:"blur(3px)"}]:[{transform:r},{transform:"translateY(calc(100% + 40px))"}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:420,easing:Mn,fill:"forwards"}).onfinish=t}addEventListener("popstate",()=>{He()&&(St=!1,me())});function ho(e,t=!0){var o;let n=(o=e.acts)!=null?o:null,r=mt.firstElementChild;if(n!==r){if(!t||r&&n&&r.dataset.key===n.dataset.key)return mt.replaceChildren(...n?[n]:[]);r&&(Object.assign(r.style,{position:"absolute",right:"0",top:"0",pointerEvents:"none"}),$(r,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(3px)"}],{duration:180,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>r.remove()),n&&(mt.appendChild(n),$(n,[{opacity:0,transform:"scale(.9)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:260,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"}))}}function Bn(e){po(e),ho(e),F.classList.remove("arrived");let t=[...ae.children],n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(s=>s.cancel()),t.forEach(s=>{s.classList.add("leaving"),Object.assign(s.style,{position:"absolute",left:"0",right:"0",top:"0",pointerEvents:"none"}),s.inert=!0}),ae.appendChild(e.el),e.el.style.pointerEvents="none",setTimeout(()=>e.el.style.pointerEvents="",320),Ve.scrollTop=0;let r=yt(),o=e.el.getBoundingClientRect().height;$(ae,[{height:`${n}px`},{height:`${o}px`}],{duration:360,easing:"cubic-bezier(.25,1,.5,1)"}),bt(r),t.forEach(s=>$(s,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.96)",filter:"blur(2px)"}],{duration:200,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>s.remove()),$(e.el,[{opacity:0,transform:"scale(.96)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:280,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"})}function ln(e){if(!He())return ge(e);an(),Fe.push(e),Bn(e())}function Ii(){Fe.length<2||(an(),Fe.pop(),Bn(Fe[Fe.length-1]()))}function mo(e,t=[]){if(!He())return e();let n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(g=>g.cancel());let r=ae.lastElementChild,o=new Map;r==null||r.querySelectorAll("*").forEach(g=>{(!(g instanceof SVGElement)||g instanceof SVGSVGElement)&&o.set(g,g.getBoundingClientRect())}),e();let s=yt(),c=ae.getBoundingClientRect().height;Math.abs(c-n)>1&&$(ae,[{height:`${n}px`},{height:`${c}px`}],{duration:q.duration,easing:q.easing}),bt(s);let m=new Set;for(let[g,f]of o){if(!g.isConnected||!f.width||!f.height)continue;let T=g.getBoundingClientRect();if(!T.width||!T.height)continue;let M=f.left-T.left,b=f.top-T.top;if(Math.abs(M)<.5&&Math.abs(b)<.5)continue;m.add(g);let O=g.parentElement;for(;O&&O!==r&&!m.has(O);)O=O.parentElement;O&&O!==r||$(g,[{transform:`translate(${M}px, ${b}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})}for(let g of t)g&&$(g,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}function go(){F==null||F.classList.add("arrived")}var vo=()=>Ve==null?void 0:Ve.scrollTo({top:0,behavior:"smooth"}),Nn=e=>He()&&ae.contains(e)&&!e.closest(".leaving");function Gi(){let e=null;F.addEventListener("pointerdown",n=>{let r=n.target;!r.closest(".vhead")||r.closest("button, a, input")||(e={y:n.clientY,t:performance.now(),dy:0,v:0},F.setPointerCapture(n.pointerId))}),F.addEventListener("pointermove",n=>{if(!e)return;let r=n.clientY-e.y,o=performance.now(),s=r>0?r:-gr(-r,F.offsetHeight);e.v=(s-e.dy)/Math.max(1,o-e.t),e.dy=s,e.t=o,F.style.transform=`translateY(${s}px)`,De.style.opacity=String(Math.max(0,1-Math.max(0,s)/420))});let t=()=>{if(!e)return;let{dy:n,v:r}=e;if(e=null,vr(n,r,F.offsetHeight))return me();let o=F.style.transform;F.style.transform="",De.style.opacity="",n!==0&&$(F,[{transform:o},{transform:"none"}],{duration:q.duration,easing:q.easing})};F.addEventListener("pointerup",t),F.addEventListener("pointercancel",t)}function Te(e,t={}){return i("div",{class:`vhead${t.back?" center":""}${t.acts?" with-acts":""}`},t.back?i("button",{type:"button",class:"knob back","aria-label":_("Back"),onclick:Ii},z("chevron")):null,i("h2",{},e))}var Ge=e=>i("p",{class:"vsub"},e),Ye=(...e)=>i("p",{class:"hint"},...e);function yo(){ge(()=>{let e=lt();return{el:i("div",{class:"view"},Te(_("Open on another device")),Ge(_("Point its camera at the code: this page opens there.")),Lt(e,!0),pt(e)),label:_("Open on another device")}})}var Wi='',dn=null,Pt=null,cn=null;function In(e){if(Pt)return Pt;dn=i("header",{class:"crumbs"}),Pt=i("div",{class:"page-body"}),e.replaceChildren(i("div",{class:"edge-fade top","aria-hidden":"true"}),i("div",{class:"edge-fade bot","aria-hidden":"true"}),cn=i("main",{class:"page"},dn,Pt));let t=()=>document.body.classList.toggle("scrolled",scrollY>2);return addEventListener("scroll",t,{passive:!0}),t(),Pt}function Gn(e){cn==null||cn.classList.toggle("single",e)}function zi(){let e=i("button",{type:"button",class:"cr-lang","aria-label":_("Language"),"aria-haspopup":"menu","aria-expanded":"false"},i("span",{},Je().toUpperCase()),z("chevron","i cr-down"));return e.addEventListener("click",()=>on(e,It.map(t=>({label:t.name,checked:t.code===Je(),run:()=>t.code!==Je()&&wn(t.code)})))),e}function Wn(e=!1,t=!1){var o;if(!dn)return;let n=e?null:(o=pe())==null?void 0:o.person,r=i("span",{class:n?"":"cur","aria-current":n?null:"page"},Xe());dn.replaceChildren(i("span",{class:"cr-mark"},Re(Wi)),i("nav",{class:"cr-path","aria-label":_("Breadcrumb")},r,n?[z("chevron"),i("span",{class:"cur","aria-current":"page"},n.name)]:null),...t?[]:[zi()],...n&&!t?[i("button",{type:"button",class:"knob cr-qr","aria-label":_("Open on another device"),onclick:yo},z("qr"))]:[])}function xo(e,t,n=10){let r=m=>(Pe(m).getDay()+6)%7,o=st(e,-r(e)),s=st(t,6-r(t)),c=[];for(let m=o;m<=s;m=st(m,1))if(c.push({day:m,kind:mn*7)return null;return c}var Ki=/^([01]?\d|2[0-3]):([0-5]\d)$/;function bo(e){let t=Ki.exec(e.trim());return t?+t[1]*60+ +t[2]:null}var $t=e=>(e%1440+1440)%1440,rt=e=>`${String(Math.floor($t(e)/60)).padStart(2,"0")}:${String($t(e)%60).padStart(2,"0")}`;function un(e,t,n){let[r,o]=e.split("-"),s=bo(r!=null?r:""),c=bo(o!=null?o:"");if(s==null||c==null)return null;let m=t==null?0:n-t;return{from:$t(s+m),to:$t(c+m),yours:t!=null}}var wo=e=>e.from$t(Math.floor(e/60)+t);function ko(e){let t=Pe(e);return{days:new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),day:t.getDate()}}var Co={phone:{b:'',f:'',d:''},mobile:{b:'',f:'',d:''},tablet:{b:'',f:'',d:''},computer:{b:'',f:'',d:''},router:{b:'',f:'',d:''},other:{b:'',f:'',d:""},plus:{b:'',f:'',d:''},globe:{b:'',f:'',d:''},home:{b:'',f:'',d:''},shield:{b:'',f:'',d:''},chart:{b:'',f:'',d:''},calendar:{b:'',f:'',d:''},clock:{b:'',f:'',d:''},pause:{b:'',f:'',d:''},server:{b:'',f:'',d:''},link:{b:'',f:'',d:''},key:{b:'',f:'',d:''},lock:{b:'',f:'',d:''},check:{b:'',f:'',d:''},trash:{b:'',f:'',d:''},refresh:{b:'',f:'',d:''},app:{b:'',f:'',d:null},file:{b:'',f:'',d:''}},Ui=()=>Gt("amnezia","").replace(/^]*>/,"").replace(/<\/svg>$/,""),qi=0;function Fi(e,t="grey",n="gi"){var c;let r=(c=Co[e])!=null?c:Co.other,o=`gl${++qi}`,s=r.d===null?`${Ui()}`:`${r.d}`;return``}var Q=(e,t="grey",n="gi")=>Re(Fi(e,t,n));function pn(e,t,n,r){return i("div",{class:`notice ${e}`},Q(t,e==="bad"?"red":"orange"),i("div",{class:"t"},n?i("b",{},n):null,i("span",{},r)))}function Vi(e){var r;let t=un(e,(r=pe())==null?void 0:r.tz_offset,-new Date().getTimezoneOffset());if(!t)return N(_("%s (router time)"),e.replace("-","–"));let n=`${rt(t.from)}–${rt(t.to)}`;return N(t.yours?_("%s your time"):_("%s (router time)"),n)}function zn(e){switch(e.state){case"server_off":return["server",_("Server is disabled"),_("Your devices can’t connect until it’s enabled again.")];case"no_server":return["server",_("No server yet"),_("You haven’t been added to one.")];case"quota":return["chart",_("Out of data"),_("Nothing gets through until it resets.")];case"expired":return["calendar",_("Access ended"),_("Your devices can’t connect until it’s extended.")];case"hours":return["clock",_("Outside your hours"),N(_("Open %s."),Vi(e.hours))];default:return["pause",_("Access paused"),_("Your devices can’t connect until it’s resumed.")]}}function _o(e){if(e.state!=="active")return pn(e.state==="quota"||e.state==="expired"?"bad":"warn",...zn(e));let t=Kt(e.expires,Be());return wt(e,t)?pn("warn","calendar",N(_("Access %s"),br(t)),N(_("On %s."),zt(e.expires))):null}function Yi(e){let t=i("div",{class:"view"},Te(_("Open the link securely")),Ge(_("Connection settings only travel encrypted")),i("div",{class:"center-col secure"},Q("lock","blue","gi xl"),i("p",{},_("This page is open without encryption. To add or set up a device, open the same link over HTTPS:"))),i("a",{class:"btn accent block",href:e},z("lock"),i("span",{},_("Open securely"))),Ye(_("The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).")));return t.lastElementChild.classList.add("secure-note"),{el:t,label:_("Open the link securely")}}var Dt=e=>ge(()=>Yi(e));function xt(){let e=Nr();return e?(Dt(e),!0):!1}var ji={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},Qi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function Ji(e){let t={};for(let[n,r]of Object.entries(Qi))e[n]!=null&&e[n]!==""&&(t[r]=String(e[n]));return t}function Xi(e,t){var g;let n=e.amnezia,r=(g=n.obfuscation)!=null?g:{},o=f=>r[f]!=null&&r[f]!==""?String(r[f]):ji[f],s=n.host.replace(/^\[(.*)\]$/,"$1"),c={H1:o("h1"),H2:o("h2"),H3:o("h3"),H4:o("h4"),I1:o("i1"),I2:o("i2"),I3:o("i3"),I4:o("i4"),I5:o("i5"),Jc:o("jc"),Jmin:o("jmin"),Jmax:o("jmax"),S1:o("s1"),S2:o("s2"),S3:o("s3"),S4:o("s4"),...Ji(r),allowed_ips:n.allowed_ips,client_ip:n.client_ip,client_priv_key:n.client_priv_key,client_pub_key:n.client_pub_key,config:e.conf.replace(/\r?\n/g,`\r +`),hostName:s,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},m={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(c),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:s};return n.dns[0]&&(m.dns1=n.dns[0]),n.dns[1]&&(m.dns2=n.dns[1]),m}function Zi(e){let t="";for(let n=0;ne.replace(/^vpn:\/\//,"");var To=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function je(e,t={}){let n=i("div",{class:`acc${t.inset?" inset":""}`}),r=e.map((f,T)=>{var P;let M=f.body.filter(d=>!!d),b=!M.length,O=[f.icon,i("span",{class:"acc-title"},i("span",{class:"t"},f.title),(P=f.tag)!=null?P:null),f.val?i("span",{class:`acc-val${f.valHide?" hide-open":""}`},f.val):null],B=T===t.open&&!b,D=b?i("div",{class:"acc-head"},...O):i("button",{type:"button",class:"acc-head","aria-expanded":String(B),onclick:()=>g(R)},...O,z("chevron","i acc-chev")),R=i("div",{class:`acc-row${b?" still":""}${B?" open":""}`},D,i("div",{class:"acc-body"},...M));return n.appendChild(R),R}),o=f=>f.querySelector(".acc-body"),s=()=>r.forEach((f,T)=>{let M=f.classList.contains("open");f.classList.toggle("rt",T===0||M||r[T-1].classList.contains("open")),f.classList.toggle("rb",T===r.length-1||M||r[T+1].classList.contains("open"))}),c=f=>{let T=getComputedStyle(f),M={};for(let b of To)M[b]=b==="height"?`${f.getBoundingClientRect().height}px`:T[b];return M},m=()=>r.forEach(f=>{var T;return(T=f.querySelector("button.acc-head"))==null?void 0:T.setAttribute("aria-expanded",String(f.classList.contains("open")))});function g(f){var B;let T=r.map(c);r.forEach(D=>D.getAnimations().forEach(R=>R.cancel())),r.forEach(D=>o(D).getAnimations().forEach(R=>R.cancel()));let M=!f.classList.contains("open"),b=r.filter(D=>D.classList.contains("open")&&(D===f||M));r.forEach(D=>{D.classList.remove("closing"),D!==f&&D.classList.remove("open")}),f.classList.toggle("open",M),s();let O=yt();r.forEach((D,R)=>{let P=c(D);To.some(d=>T[R][d]!==P[d])&&(b.includes(D)&&D.classList.add("closing"),$(D,[T[R],P],{duration:Ae.duration,easing:Ae.easing}).onfinish=()=>D.classList.remove("closing"))}),b.forEach(D=>$(o(D),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:Z,fill:"forwards"})),M&&$(o(f),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),bt(O),m(),(B=t.onToggle)==null||B.call(t,r.indexOf(f),M,!1)}return s(),{el:n,openIndex:()=>r.findIndex(f=>f.classList.contains("open")),setOpen(f){r.forEach((T,M)=>T.classList.toggle("open",M===f&&!T.classList.contains("still"))),s(),m(),r.forEach((T,M)=>{var b;return(b=t.onToggle)==null?void 0:b.call(t,M,T.classList.contains("open"),!0)})}}}function Lo(e,t,n){let r=i("span",{class:"seg-pill"}),o=i("div",{class:"seg appseg",role:"tablist"},r),s=e.map(b=>{let O=i("button",{type:"button",class:"seg-b",role:"tab","aria-label":b.label,title:b.label,onclick:()=>M(b.value)},z(b.icon),i("span",{class:"seg-l"},b.label));return O.dataset.v=b.value,o.appendChild(O),O}),c=b=>b.querySelector(".seg-l"),m=()=>s.forEach(b=>{let O=b.dataset.v===t;b.classList.toggle("on",O),b.setAttribute("aria-selected",String(O))}),g=()=>{let b=s.find(O=>O.dataset.v===t);return b&&b.offsetWidth?[b.offsetLeft,o.clientWidth-b.offsetLeft-b.offsetWidth]:null},f=()=>{let b=g();b&&(r.style.left=`${b[0]}px`,r.style.right=`${b[1]}px`)},T=0;function M(b){if(b===t)return;let O=s.findIndex(C=>C.dataset.v===t),B=s.findIndex(C=>C.dataset.v===b),D=getComputedStyle(r),R=parseFloat(D.left)||0,P=parseFloat(D.right)||0,d=s.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),v=c(s[O]),a=v.getBoundingClientRect().width;[...s,...s.map(c)].forEach(C=>C.getAnimations().forEach(I=>I.cancel())),t=b,m(),s.forEach((C,I)=>{let G=I===B?1:0;d[I]!==G&&$(C,[{flexGrow:d[I]},{flexGrow:G}],{duration:q.duration,easing:q.easing})}),$(v,[{opacity:1,maxWidth:`${a}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),$(c(s[B]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:j,fill:"backwards"});let h=B>O,p=Se()?q:hr,A=performance.now(),u=Math.max(q.duration,p.duration),l=h?q:p,E=h?p:q;cancelAnimationFrame(T);let x=()=>{let C=Se()?u:performance.now()-A,I=g();if(!I){T=0;return}r.style.left=`${R+(I[0]-R)*l.at(C)}px`,r.style.right=`${P+(I[1]-P)*E.at(C)}px`,T=C{T||f()}).observe(o),{el:o,sync(b){b!==t&&(t=b,m(),f())}}}var Po={vpn:"amnezia",awg:"amneziawg",wg:"wireguard"},$o=e=>`dl.app.${e.id}`;function Do(e){try{let t=localStorage.getItem($o(e));return t==="vpn"||t==="awg"||t==="wg"?t:null}catch{return null}}function Ho(e,t){try{localStorage.setItem($o(e),t)}catch{}}function Qe(e,t=!1){var s,c;let n=[i("span",{class:"b-ic"},z(e.mark)),i("span",{class:"b-t"},i("span",{class:"b-top"},e.top),i("span",{class:"b-main"},e.main)),z(e.onclick||(s=e.href)!=null&&s.startsWith("vpn:")?"chevron":"open")],r=`badge${t?" primary":""}`;if(e.onclick)return i("button",{type:"button",class:r,onclick:e.onclick},n);let o=(c=e.href)==null?void 0:c.startsWith("vpn:");return i("a",{class:r,href:e.href,target:o?null:"_blank",rel:"noopener noreferrer"},n)}function Oo(e,t,n){let r=n?Tr(e):Er(e,t);return r?r.alt?[i("div",{class:"badges2"},Qe(r),Qe(r.alt)),Ye(r.alt.why)]:[Qe(r)]:[Ye(N(_("Get %s on the %s and come back here."),ce[e],Sr(t)))]}var Ao=e=>i("ol",{class:"howto"},e.map(([t,n])=>i("li",{},t.replace(/ → $/," ›"),n?[" ",i("b",{},n)]:null))),ts=(e,t)=>i("button",{type:"button",onclick:t},e);function Ro(e){let t=e.app(),n=ce[t],r=e.pf==="ios"||e.pf==="android",o=e.same()&&r,s=g=>he(e.key,_("Key copied"),g.currentTarget),c=t==="vpn"&&o&&!kn(e.pf)?Ze(kt(e.cfg.filename),e.key):null;if(t==="vpn"&&o&&(kn(e.pf)||c))return[Qe(c?{top:_("Then come back here and tap"),main:_("Send to AmneziaVPN"),mark:"amnezia",onclick:()=>void c()}:{href:e.key,top:_("Then come back here and tap"),main:_("Open in AmneziaVPN"),mark:"amnezia"},!0),Ye(...Ke(c?_("Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app."):_("Nothing opened? %s and add it in the app."),ts(_("Copy the key","in a sentence"),s)))];if(t==="vpn"){let g=Vt("vpn");return[Qe({top:_("The connection as one key"),main:_("Copy the key"),mark:"copy",onclick:s},!0),Ao([[N(_("Open %s","step"),n),""],[g.replace(/ → [^→]*$/," → "),g.replace(/^.* → /,"")],[Lr(),""]])]}let m=r?Ze(e.cfg.filename,e.cfg.conf):null;return[Qe(m?{top:e.same()?N(_("Straight into %s"),n):N(_("Send it to the %s"),e.there),main:_("Share the file"),mark:"share",onclick:()=>void m()}:{top:_("Then import it in the app"),main:_("Download the file"),mark:"download",onclick:()=>rn(e.cfg.filename,e.cfg.conf)},!0),Ao(Ar(t,e.pf,e.cfg.filename,!!m&&e.same()))]}function Bo(e){let t=e.app(),n=(o,s,c)=>i("button",{type:"button",class:"btn soft sm",onclick:c},z(o),i("span",{class:"lbl"},s));if(t==="vpn"){let o=kt(e.cfg.filename),s=!!Ze(o,e.key);return[i("p",{class:"desc"},N(_("Send it to the %s in a message or a note, then in AmneziaVPN: %s."),e.there,Vt("vpn").replace(/ → /g," › "))),i("div",{class:"btnrow2"},n("copy",_("Copy the key"),c=>he(e.key,_("Key copied"),c.currentTarget)),n(s?"share":"download",s?_("Share as a file"):_("Download the key"),()=>Tt(o,e.key)))]}let r=!!Ze(e.cfg.filename,e.cfg.conf);return[i("p",{class:"desc"},...Ke(_("Send it to the %s, then import %s in %s."),e.there,i("b",{},e.cfg.filename),ce[t])),i("div",{class:"btnrow2"},n(r?"share":"download",r?_("Share the file"):_("Download the file"),()=>Tt(e.cfg.filename,e.cfg.conf)),n("copy",_("Copy the configuration"),o=>he(e.cfg.conf,_("Configuration copied"),o.currentTarget)))]}function So(e,t){if(/^\s*\[.+\]\s*$/.test(e))return i("span",{class:"sec"},e);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(e);if(!n)return document.createTextNode(e);let r=/^(\s*)(PrivateKey|PresharedKey)\b/.test(e);return i("span",{},i("span",{class:"k"},n[1])," ",r&&!t?i("span",{class:"mask"},"••••••••••••••••"):n[2])}function No(e){let t=!1,n=i("pre",{class:"conf"}),r=()=>n.replaceChildren(...e.conf.split(` +`).flatMap((f,T)=>T?[` +`,So(f,t)]:[So(f,t)]));r();let o=!!Ze(e.filename,e.conf),s=i("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,s.replaceChildren(z(t?"x":"key"),i("span",{},t?_("Hide key"):_("Show key"))),r(),n.querySelectorAll(".mask, .k").forEach(f=>$(f,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:j}))}},z("key"),i("span",{},_("Show key"))),c=i("button",{type:"button",class:"btn soft sm",onclick:f=>he(e.conf,_("Configuration copied"),f.currentTarget)},z("copy"),i("span",{class:"lbl"},_("Copy"))),m=i("div",{class:"filecard"},i("div",{class:"fc-row"},i("span",{class:"filecard-ic"},".conf"),i("span",{class:"t"},i("span",{class:"mono"},e.filename),i("span",{},_("For computers and routers")))),i("button",{type:"button",class:"btn accent sm block",onclick:()=>Tt(e.filename,e.conf)},z(o?"open":"download"),i("span",{},o?_("Share file"):_("Download")))),g=je([{icon:Q("file"),title:_("Configuration"),body:[i("div",{class:"confbar"},s,c),n]}],{inset:!0});return i("div",{class:"step-box"},m,g.el)}function Io(e){let t=i("span",{class:"osm-p"},ce[e]),n=ao(Ct(e,"ios"),Ct(e,"android"));return{el:i("span",{class:"scanline"},i("span",{},...Ke(_("In %s:"),t)),n.el),set(r){te(t,ce[r],void 0,{whole:!0}),n.set(Ct(r,"ios"),Ct(r,"android"))}}}function Go(e){let t=i("span",{class:"tt"}),n=i("span",{class:"tt-m"}),r=i("span",{class:"hp-tip","aria-hidden":"true"},t,n),o=i("button",{type:"button",class:"hp-b",onclick:()=>Tt(e().file,e().text)},z("download")),s=i("button",{type:"button",class:"hp-b"},z("copy")),c=i("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},o,s,r),m=null,g=0,f=0,T=a=>{var h;return a===s&&s.classList.contains("done")?_("Copied"):(h=a.getAttribute("aria-label"))!=null?h:""},M=(a,h)=>{n.textContent=h;let p=n.offsetWidth+20;return Math.min(a.offsetLeft+a.offsetWidth/2,c.offsetWidth+46-p/2)},b=a=>`translateX(${a}px) translateX(-50%)`,O=a=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(p=>p.cancel()),r.style.transform=b(a),$(r,[{transform:h},{transform:b(a)}],{duration:q.duration,easing:q.easing})},B=a=>te(t,a),D=a=>{if(clearTimeout(g),m===a&&r.classList.contains("on"))return;if(m=a,r.classList.contains("on")){let p=T(a);return O(M(a,p)),B(p)}let h=()=>{let p=T(a);Ne(t,p);let A=M(a,p);r.getAnimations().forEach(u=>u.cancel()),r.style.transform=b(A),r.classList.add("on"),$(r,[{opacity:0,transform:`${b(A)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(A),filter:"blur(0px)"}],{duration:220,easing:j})};performance.now(){clearTimeout(g),m=null,r.classList.contains("on")&&(f=performance.now()+500,r.classList.remove("on"),$(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let a of[o,s])a.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&D(a)}),a.addEventListener("focus",()=>{a.matches(":focus-visible")&&D(a)}),a.addEventListener("blur",R);c.addEventListener("pointerleave",R);let P=a=>{let h=z(a);s.querySelector("svg").replaceWith(h),$(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})},d=()=>{if(m!==s||!r.classList.contains("on"))return;let a=T(s);O(M(s,a)),B(a)},v=0;return s.addEventListener("click",()=>{let a=e();he(a.text,a.msg),clearTimeout(v),s.classList.contains("done")||(s.classList.add("done"),P("check"),d()),v=window.setTimeout(()=>{s.classList.remove("done"),P("copy"),d()},1600)}),{el:c,sync(){let a=e().app;o.setAttribute("aria-label",N(_("Download %s config"),a)),s.setAttribute("aria-label",N(_("Copy %s config"),a))}}}function zo(e){let t=i("b",{},_("Waiting for the connection")),n=i("span",{class:"ws",hidden:!0}),r=i("div",{class:"way",role:"status","aria-live":"polite"},i("div",{class:"way-row"},i("span",{class:"way-end"},z(e.kind)),i("span",{class:"way-track"},i("span",{class:"way-glow"},i("i")),i("span",{class:"way-fill"})),i("span",{class:"way-end home"},z("server"))),i("div",{class:"way-text"},i("span",{class:"t"},t,n)));return{el:r,connected(){r.classList.add("done"),te(t,N(_("%s connected"),e.name))},gaveUp(){r.classList.add("stopped"),te(t,_("No connection yet")),n.textContent=_("Close this and open it again to keep checking."),n.hidden=!1,$(t.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}}}function Ko(e,t=4){window.setTimeout(async()=>{var n;try{let r=await fe("state");ke(r),At()||Ee(),!((n=r.person.devices.find(o=>o.id===e))!=null&&n.online)&&t>1&&Ko(e,t-1)}catch{}},1500)}function Uo(e,t,n){let r=ct(),o=0,s=0,c=!1,m=Date.now(),g=async()=>{if(o=0,!c){if(Date.now()-m>6e5){c=!0,n();return}if(document.hidden)return f();try{let M=await fe("state");ke(M);let b=M.person.devices.find(O=>O.id===e.id);if(b&&b.handshake>r){c=!0,t(),b.online||Ko(e.id);return}}catch(M){if(jt(M)){c=!0;return}}s++,f()}},f=()=>{!c&&!o&&(o=window.setTimeout(g,s<6?5e3:s<12?15e3:3e4))},T=()=>{!document.hidden&&!c&&!o&&g()};return document.addEventListener("visibilitychange",T),f(),()=>{c=!0,o&&clearTimeout(o),document.removeEventListener("visibilitychange",T)}}var Wo=e=>new Promise(t=>setTimeout(t,e));async function qo(e,t,n){e.connected(),go(),vo(),await Wo(400),Nn(e.el)&&(t.style.overflow="hidden",$(t,[{height:`${t.offsetHeight}px`,opacity:1,filter:"none"},{height:"0px",opacity:0,filter:"blur(4px)"}],{duration:520,easing:j,fill:"forwards"}),$(e.el,[{marginBottom:"18px"},{marginBottom:"0px"}],{duration:520,easing:j,fill:"forwards"}),await Wo(2400),Nn(e.el)&&(nt(()=>Ee({flash:n.id})),me()))}async function ns(e){try{return await fe(`devices/${e.id}/config`)}catch(t){return t instanceof qe&&t.httpsUrl?Dt(t.httpsUrl):Ce(t.message,!0),null}}async function fn(e,t){if(xt())return;let n=async()=>{let r=await ns(e);if(!r)return;let o=await Kn(r,r.server);ge(()=>Vo(e,r,o))};t instanceof HTMLButtonElement?await et(t,n):await n()}async function hn(e,t){let n=await Kn(t,t.server);ln(()=>Vo(e,t,n))}function Fo(e,t,n){return i("div",{class:"step"},i("span",{class:"step-n"},e),i("div",{class:"step-b"},typeof t=="string"?i("span",{class:"step-t"},t):t,n))}function rs(e,t,n){let r=e.hidden?0:e.getBoundingClientRect().height;if(e.getAnimations().forEach(m=>m.cancel()),n){e.hidden=t;return}e.style.overflow="hidden",e.hidden=!1;let o=t?0:e.getBoundingClientRect().height,[s,c]=t?[1,0]:[0,1];$(e,[{height:`${r}px`,opacity:s,filter:`blur(${4-s*4}px)`},{height:`${o}px`,opacity:c,filter:`blur(${4-c*4}px)`}],{duration:q.duration,easing:q.easing}).onfinish=()=>{e.style.overflow="",e.hidden=t}}function Vo(e,t,n){var Y,ee;let r=Yt(),o=_r(Br()),s=e.kind==="phone"||e.kind==="tablet",c=e.kind==="router",m=Cr(e.kind,r),g=m?"same":c?"router":s?"away":"pc-away",f=Cn(e.kind),T=Cn(e.kind,!0),M=o.filter(ie=>!c||ie.id!=="vpn"),b=(Y=Do(e))!=null?Y:c?"awg":"vpn";M.some(ie=>ie.id===b)||(b=M[0].id);let O={d:e,cfg:t,key:n,pf:r,there:f,app:()=>b,same:()=>m},B=[],D=()=>{if(M.length<2)return null;let ie=Lo(M.map(ne=>({value:ne.id,label:ne.name,icon:Po[ne.id]})),b,ne=>{b=ne,Ho(e,ne),B.forEach(Bt=>Bt.sync(ne)),mo(l)});return B.push(ie),ie.el},R=i("span",{class:"step-t"}),P=i("div",{class:"step-box"}),d=i("div",{class:"step-box"}),v=i("div",{class:"step-box"}),a=i("div",{class:"step-box"}),h=null,p=null,A=null,u=g==="away"?Go(()=>({...b==="vpn"?{text:n,msg:_("Key copied"),file:kt(t.filename)}:{text:t.conf,msg:_("Configuration copied"),file:t.filename},app:ce[b]})):null;function l(){te(R,c?N(_("Get %s on the router"),ce[b]):N(_("Get %s"),ce[b]),void 0,{whole:!0}),tn(P,Oo(b,r,c)),c?d.firstChild||We(d,No(t)):tn(d,Ro(O));let ie=b==="vpn"?Eo(n):t.conf;h&&p&&h.el.isConnected?A!==b&&(h.swap(ie),p.set(b)):(p=Io(b),h=Dn(ie,[p.el]),v.replaceChildren(h.el)),A=b,tn(a,Bo(O)),u==null||u.sync()}l();let E=Pr(lt(),e.id),x=()=>[s?Dn(E,[i("span",{},_("Point its camera at the code: the link opens there."))]).el:i("p",{class:"desc"},N(_("Open this link on the %s to set it up there."),T)),pt(E)],C=()=>Fo("1",R,[D(),P]),I=()=>Fo("2",c?_("Import the configuration"):_("Add the connection"),[d]),G=i("div",{class:"setup"});if(kr(navigator.userAgent)&&G.appendChild(pn("warn","shield",null,_("Open this page in Safari or Chrome: the store opens from here, but the app handoff does not."))),g==="same"){let ie=i("div",{class:"steps-wrap"},i("div",{class:"steps-gap"}),C(),I()),ne=je([{icon:Q("link"),title:N(_("Not on the %s right now?"),T),body:x()}],{inset:!0,onToggle:(Bt,w,k)=>rs(ie,w,k)});G.append(ne.el,ie)}else g==="router"?G.append(C(),I()):g==="away"?G.appendChild(je([{icon:Q("link"),title:N(_("Open your link on the %s"),T),body:x()},{icon:Q("app"),title:_("Already has the app"),body:[D(),v]}],{inset:!0,open:1}).el):G.appendChild(je([{icon:Q("link"),title:N(_("Open your link on the %s"),T),body:x()},{icon:Q("key"),title:_("Copy or save the connection"),body:[D(),a]}],{inset:!0,open:0}).el);let V=zo(e),J=!1;fo(Uo(e,()=>{J||(J=!0,qo(V,G,e))},V.gaveUp)),nt(()=>Ee());let re=g==="same"?_("Two steps, about a minute"):c?_("The packages and the file for OpenWrt"):N(_("The app goes on the %s."),f),le=N(_("Set up %s"),e.name);return{el:i("div",{class:"view"},Te(le,{acts:!!u}),Ge(re),V.el,G),label:le,acts:(ee=u==null?void 0:u.el)!=null?ee:null}}var ve=navigator.userAgent,Qo=/iPad/.test(ve)||/Macintosh/.test(ve)&&navigator.maxTouchPoints>1;function Ot(){return Qo||/Tablet/i.test(ve)||/Android/.test(ve)&&!/Mobile/.test(ve)?"tablet":/Android|iPhone|Mobile/i.test(ve)?"phone":"computer"}var os=[[/^SM-S93/,"Galaxy S25"],[/^SM-S92/,"Galaxy S24"],[/^SM-S91/,"Galaxy S23"],[/^SM-S90/,"Galaxy S22"],[/^SM-G99/,"Galaxy S21"],[/^SM-F9/,"Galaxy Z Fold"],[/^SM-F7/,"Galaxy Z Flip"],[/^SM-A5/,"Galaxy A5x"],[/^SM-A3/,"Galaxy A3x"],[/^SM-X/,"Galaxy Tab"]],Un="",is=(async()=>{var t;let e=navigator.userAgentData;if(!e||!/Android/.test(ve))return"";try{let n=((t=(await e.getHighEntropyValues(["model"])).model)!=null?t:"").trim();if(!n||n==="K")return"";let r=os.find(([o])=>o.test(n));Un=r?`${r[1]} (${n})`:/^SM-/.test(n)?`Galaxy ${n}`:n}catch{}return Un})();function ss(e){return/iPhone/.test(ve)?"iPhone":Qo?"iPad":/Android/.test(ve)?Un||(e==="tablet"?_("Android tablet"):_("Android phone")):/CrOS/.test(ve)?"Chromebook":/Mac OS X/.test(ve)?"Mac":/Windows/.test(ve)?_("Windows PC"):/Linux/.test(ve)?_("Linux PC"):Ut(e)}var Yo=e=>e==="mobile"?_("Mobile"):Ut(e),Ht=e=>e==="phone"||e==="tablet"?"mobile":e,jo=e=>e!=="mobile"?e:Ot()==="tablet"?"tablet":"phone";function Rt(){let e=pe();if(!(!e||e.locked)){if(!e.can_add)return Ce(ze(e.person.device_limit,"You have reached your limit of %s device","You have reached your limit of %s devices"),!0);xt()||ge(as)}}function as(){let e=pe(),t=e.person,n=["computer","mobile","router","other"].filter(d=>e.kinds.some(v=>Ht(v)===d)),r=n.includes(Ht(Ot()))?Ht(Ot()):n[0],o=!1,s=new Set(t.devices.map(d=>d.name.toLowerCase())),c=d=>{let v=d===Ht(Ot())?ss(jo(d)):Ut(d==="mobile"?"phone":d);if(!s.has(v.toLowerCase()))return v;for(let a=2;a<20;a++)if(!s.has(`${v} ${a}`.toLowerCase()))return`${v} ${a}`;return v},m=i("div",{class:"kinds",role:"radiogroup","aria-label":_("What is it?")});m.style.setProperty("--n",String(n.length));let g=n.map(d=>{let v=i("button",{type:"button",class:"kind",role:"radio","aria-label":Yo(d),onclick:()=>O(d)},i("span",{class:"kind-tile"},Q(d,"blue")),i("span",{class:"kind-lbl"},Yo(d)));return m.appendChild(v),v}),f=i("input",{type:"text",maxlength:48,required:!0,"aria-label":_("Name"),autocomplete:"off"}),T=i("button",{class:"go ready",type:"submit","aria-label":_("Create connection")},z("arrow")),M=i("p",{class:"hint bad-t",hidden:!0}),b=d=>{if(!M.hidden)return te(M,d);M.textContent=d,M.hidden=!1,$(M,[{opacity:0,transform:"translateY(-4px)"},{opacity:1,transform:"none"}],{duration:220,easing:j})};f.value=c(r),f.addEventListener("input",()=>{o=!0,T.classList.toggle("ready",!!f.value.trim()),M.hidden=!0}),is.then(()=>{!o&&r===Ht(Ot())&&(f.value=c(r))});function O(d){r=d,g.forEach((v,a)=>{let h=n[a]===d;v.classList.toggle("on",h),v.setAttribute("aria-checked",String(h))}),o||(f.value=c(d),T.classList.add("ready"))}O(r);let B=i("form",{class:"field",autocomplete:"off"},f,T);B.addEventListener("submit",d=>{d.preventDefault();let v=f.value.trim();if(v){if(s.has(v.toLowerCase()))return b(_("You already have a device with this name."));et(T,async()=>{try{let a=await fe("devices",{name:v,kind:jo(r)});ke(a.state),Ee({pop:a.id});let h=a.state.person.devices.find(p=>p.id===a.id);await hn(h,a.config)}catch(a){if(a instanceof qe&&a.httpsUrl)return Dt(a.httpsUrl);b(a.message)}})}});let D=i("button",{type:"button",class:"btn soft block",onclick:()=>ln(ls)},z("qr"),i("span",{},_("Add it from the device"))),R=t.device_limit-t.devices.length,P=i("div",{class:"view"},Te(_("Add a device")),Ge(N(N_(t.device_limit,"%s of %s slot free","%s of %s slots free"),we(R),we(t.device_limit))),m,Ye(_("Phones and tablets get a smaller packet size that suits mobile networks.")),B,M,i("div",{class:"or"},_("OR")),D);return P.querySelector(".hint").classList.add("kinds-note"),{el:P,label:_("Add a device")}}function ls(){let e=Dr(lt());return{el:i("div",{class:"view"},Te(_("Open on the device"),{back:!0}),Ge(_("Point its camera at the code: your page opens there with this device ready to add.")),Lt(e,!0),pt(e)),label:_("Open on the device")}}function Jo(e){let t=i("button",{type:"button",class:`btn ${e.cls}`,onclick:r=>et(r.currentTarget,e.run)},i("span",{},e.action));return{el:i("div",{class:"view"},i("div",{class:"ask"},Q(e.icon,e.tone,"gi xl"),i("h3",{},e.title),i("p",{},e.text),i("div",{class:"btnrow"},i("button",{type:"button",class:"btn soft",onclick:()=>me()},_("Cancel")),t))),label:e.title,asks:!0}}function Xo(e){ge(()=>{let t=i("input",{type:"text",maxlength:48,"aria-label":_("Device name"),autocomplete:"off"});t.value=e.name;let n=i("button",{class:"go",type:"submit","aria-label":_("Save")},z("check"));t.addEventListener("input",()=>n.classList.toggle("ready",!!t.value.trim()&&t.value.trim()!==e.name));let r=i("form",{class:"field",autocomplete:"off"},t,n);r.addEventListener("submit",s=>{s.preventDefault();let c=t.value.trim();!c||c===e.name||et(n,async()=>{try{let m=await fe(`devices/${e.id}`,{action:"rename",name:c});ke(m.state),nt(()=>{Ee(),Ce(_("Renamed"))}),me()}catch(m){Ce(m.message,!0)}})}),setTimeout(()=>t.select(),60);let o=N(_("Rename %s"),e.name);return{el:i("div",{class:"view"},Te(o),r),label:o}})}function qn(e){var n;if(xt())return;let t=((n=pe())==null?void 0:n.here)===e.id;ge(()=>Jo({icon:"refresh",tone:"orange",title:N(_("Reconnect %s?"),e.name),text:t?_("It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next."):_("It gets new keys and its current settings stop working. Set it up again with the new ones that open next."),action:_("Reconnect"),cls:"accent",run:async()=>{var r;try{let o=await fe(`devices/${e.id}`,{action:"reconnect"});ke(o.state),Ee(),await hn((r=o.state.person.devices.find(s=>s.id===e.id))!=null?r:{...e,handshake:0},o.config)}catch(o){Ce(o.message,!0)}}}))}function Zo(e){ge(()=>Jo({icon:"trash",tone:"red",title:N(_("Remove %s?"),e.name),text:_("Its connection stops working at once. You can add it again later."),action:_("Remove"),cls:"red",run:async()=>{try{let t=await fe(`devices/${e.id}`,{action:"delete"});ke(t.state),nt(()=>{let n=document.querySelector(`.dev[data-id="${CSS.escape(e.id)}"]`),r=()=>{Ee(),Ce(_("Device removed"))};if(!n)return r();$(n,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(6px)"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=r}),me()}catch(t){Ce(t.message,!0)}}}))}var Fn=(e,t)=>e.access!=="internet"&&e.state==="active"&&!t.disabled;function cs(e,t){return e.disabled?["",_("Disabled")]:e.config_stale&&e.handshake?["warn-t",_("Settings changed")]:e.online&&t.state==="quota"?["warn-t",_("Connected, no data left")]:e.online&&t.state==="hours"?["warn-t",_("Connected, outside your hours")]:e.online?["ok-t",_("Connected")]:e.handshake?["",N(_("Last connected %s"),yr(e.handshake,ct()))]:["warn-t",_("Not set up yet")]}function ds(e,t){return[...Fn(t.person,e)?[{label:_("Copy IP address"),icon:"copy",run:()=>he(e.address,_("IP address copied"))},...e.hostname?[{label:_("Copy local address"),icon:"home",run:()=>he(e.hostname,_("Address copied"))}]:[],null]:[],...e.disabled?[]:[{label:_("Rename"),icon:"edit",run:()=>Xo(e)},{label:_("Reconnect"),icon:"refresh",tone:"warn",run:()=>qn(e)},{label:_("Remove"),icon:"trash",tone:"bad",run:()=>Zo(e)}]]}function us(e){return e===0?_("Today"):e===1?_("Yesterday"):Pe(st(Be(),-e)).toLocaleDateString(_e(),{weekday:"short",day:"numeric",month:"short"})}function ps(e,t){let n=e.spark.reduce((c,m)=>c+m,0),r=i("span",{class:"use-lbl"},_("Last 7 days")),o=i("span",{class:"use-val num","data-t":`${e.id}:use`},Me(n)),s;if(t)s=i("button",{type:"button",class:"upd-pill","aria-label":_("Update the connection"),title:_("Its settings changed: update the connection"),onclick:()=>qn(e)},z("refresh"),i("span",{},_("Update")));else{let c=Math.max(1,...e.spark);s=i("div",{class:"spark"}),e.spark.forEach((m,g)=>{let f=e.spark.length-1-g,T=i("i",{class:f===0?"today":""});T.style.height=`${Math.max(3,Math.round(m/c*34))}px`,T.addEventListener("pointerenter",()=>{Ne(r,us(f)),Ne(o,Me(m))}),T.addEventListener("pointerleave",()=>{Ne(r,_("Last 7 days")),Ne(o,Me(n))}),s.appendChild(T)})}return i("div",{class:"dev-use"},i("div",{class:"use-txt"},r,o),s)}function fs(e,t){let n=t.person,r=!!t.locked,o=t.here===e.id,[s,c]=o?["here-t",_("This device")]:cs(e,n),m=!e.handshake&&!e.disabled,g=e.config_stale&&!m&&!r&&!e.disabled,f=!o&&e.handshake&&!e.online&&!e.disabled&&!e.config_stale?new Date(e.handshake*1e3).toLocaleString(_e()):g?_("Settings changed, update needed"):c,T=ds(e,t),M=r||!T.length?null:i("button",{type:"button",class:"knob more","aria-label":N(_("%s options"),e.name),"aria-haspopup":"menu","aria-expanded":"false"},z("more"));return M==null||M.addEventListener("click",()=>on(M,T)),i("article",{class:`dev${o?" is-here":""}${e.disabled?" off":""}`,"data-id":e.id},i("div",{class:"dev-top"},Q(e.kind,o?"blue":"grey"),i("div",{class:"dev-id"},i("span",{class:"dev-name","data-t":`${e.id}:name`},e.name),i("span",{class:`dev-stat ${s}`,title:f,"data-t":`${e.id}:stat`},c)),M),m&&r?null:m?i("button",{type:"button",class:"btn tint block setup-btn","aria-label":N(_("Set up %s"),e.name),onclick:b=>fn(e,b.currentTarget)},z("qr"),i("span",{},_("Connect"))):ps(e,g))}var hs=e=>i("div",{class:"dev first","data-id":"first"},Q("plus","blue"),i("b",{},_("Add your first device")),i("p",{},_("Two steps, about a minute: get the app, then add the connection.")),i("button",{type:"button",class:"btn accent block",onclick:Rt},z("plus"),i("span",{},e?_("Add this phone"):_("Add this device")))),ms=()=>i("button",{type:"button",class:"dev add","data-id":"add",onclick:Rt},Q("plus"),i("span",{},_("Add device")));function ei(){return i("section",{class:"devices",id:"devices","aria-label":_("Your devices")},i("div",{class:"sec-head"},i("h2",{},_("Your devices")),i("span",{class:"aside num"})),i("div",{class:"dgrid"}),i("p",{class:"note-s limit",hidden:!0}))}function ti(e,t,n={}){let r=t.person,o=e.querySelector(".dgrid"),s=o.childElementCount>0,c=new Map([...o.querySelectorAll("[data-id]")].map(P=>[P.dataset.id,P.getBoundingClientRect()])),m=Zt(o),f=qt(r.devices).sort((P,d)=>+(d.id===t.here)-+(P.id===t.here)).map(P=>fs(P,t)),T=t.locked?0:Math.max(0,r.device_limit-r.devices.length),M=matchMedia("(max-width: 959px)").matches||/Android|iPhone|iPad/.test(navigator.userAgent);!r.devices.length&&T?f.push(hs(M)):t.can_add&&!t.locked&&f.push(ms()),o.classList.toggle("empty",!r.devices.length),o.replaceChildren(...f);for(let P of f){let d=c.get(P.dataset.id),v=P.getBoundingClientRect();P.dataset.id===n.pop?$(P,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Le.duration,easing:Le.easing}):d&&(d.left!==v.left||d.top!==v.top)?$(P,[{transform:`translate(${d.left-v.left}px, ${d.top-v.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}):!d&&s&&$(P,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:getComputedStyle(P).opacity,transform:"none",filter:"none"}],{duration:q.duration,delay:60,easing:q.easing,fill:"backwards"}),P.dataset.id===n.flash&&P.animate([{boxShadow:"inset 0 0 0 1.5px var(--ok)"},{boxShadow:"inset 0 0 0 1.5px transparent"}],{duration:1800,easing:"ease-out"})}s&&en(o,m);let b=e.querySelector(".sec-head .aside"),O=N(_("%s of %s"),we(r.devices.length),we(r.device_limit));s?te(b,O):b.textContent=O,b.classList.toggle("warn-t",r.devices.length>r.device_limit);let B=e.querySelector(".limit"),D=B.hidden,R=t.can_add||!!t.locked;if(B.textContent=ze(r.device_limit,"You have reached your limit of %s device. Remove one to add another.","You have reached your limit of %s devices. Remove one to add another."),B.getAnimations().forEach(P=>P.cancel()),s&&!D&&R){let P=$(B,[{opacity:1,filter:"none"},{opacity:0,filter:"blur(4px)"}],{duration:200,easing:Z,fill:"forwards"});P.onfinish=()=>{B.hidden=!0,P.cancel()}}else B.hidden=R,s&&D&&!R&&$(B,[{opacity:0,transform:"translateY(6px)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:420,easing:j})}var Vn=e=>i("p",{class:"desc"},e),gn=(e,t)=>`${(e/t*100).toFixed(2)}%`,ni=e=>Pe(e).toLocaleDateString(_e(),{day:"numeric",month:"short"});function gs(e){let t=(n,r,o,s)=>i("div",{class:`reach-tile${n?"":" off"}`},Q(r,n?"blue":"grey","gi rt-ic"),i("b",{},o),i("span",{class:"rt-sub"},n?s:_("Not included")),i("span",{class:"rt-mark","aria-label":n?_("Included"):_("Not included")},z(n?"check":"minus")));return i("div",{class:"reach2"},t(e!=="internet","home",_("Home network"),_("Devices at home")),t(e!=="lan","globe",_("Internet"),_("Through the router")))}function vs(e,t){let n=qt(e.devices).filter(m=>m.hostname&&Fn(e,m));if(!n.length)return[];let r=n[0].hostname,o=r.indexOf("."),s=o>0?r.slice(o):"",c=i("span",{class:"mono"},`${_("name")}${s}`);return[i("span",{class:"lbl-s"},...Ke(t?_("Devices at home and on this VPN reach yours as %s"):_("Other devices at home reach yours as %s"),c)),i("div",{class:"names"},n.map(m=>{let g=m.hostname.indexOf(".");return i("button",{type:"button",class:"namechip",title:m.name,"aria-label":N(_("Copy %s"),m.hostname),onclick:f=>he(m.hostname,_("Address copied"),f.currentTarget)},i("span",{},g>0?[m.hostname.slice(0,g),i("span",{class:"faint"},m.hostname.slice(g))]:m.hostname),z("copy"))}))]}function ys(e){let t=2*Math.PI*6,n=e>=100?" bad":e>=90?" warn":"";return Re(``)}function bs(e){let t=i("i",{class:e>=100?"bad":e>=90?"warn":""});return t.style.width=`${e.toFixed(1)}%`,i("div",{class:"meter"},t)}function xs(e,t,n){var B,D;let{days:r,day:o}=ko(Be()),s=(B=e.month_days)!=null?B:[],c=Math.max(1,...s),m=R=>ni(`${Be().slice(0,8)}${String(R).padStart(2,"0")}`),g=i("b",{class:"num","data-t":"m-used"},Me(t)),f=i("span",{class:"mread"}),T=(R,P)=>{Ne(g,Me(R)),f.replaceChildren(...P?Ke(_("%s on %s"),g,m(P)):Ke(_("%s used"),g))};T(t);let M=i("div",{class:"mbars"});for(let R=0;R=o){M.appendChild(i("i",{class:"future"}));continue}let P=(D=s[R])!=null?D:0,d=i("i",{class:R===o-1?"today":""});d.style.height=`${Math.max(3,Math.round(P/c*64))}px`,d.addEventListener("pointerenter",()=>T(P,R+1)),d.addEventListener("pointerleave",()=>T(t)),M.appendChild(d)}let b=i("span",{class:"td"},_("Today"));b.style.left=gn(o-.5,r);let O=i("div",{class:"month-axis"},i("span",{class:o<=4?"hide":""},m(1)),b,i("span",{class:o>=r-3?"hide":""},m(r)));return i("div",{class:"month"},M,O,i("div",{class:"month-read"},f,i("span",{class:`num${e.state==="quota"?" bad-t":""}`,"data-t":"m-left"},e.quota_limit?N(_("%s left"),Me(Math.max(0,e.quota_limit-t))):_("No limit"))),e.quota_limit?bs(n):null)}function ws(e,t){let n=c=>Pe(c).toLocaleDateString(_e(),{weekday:"short",day:"numeric",month:"short"}),r=Array.from({length:7},(c,m)=>new Date(2024,0,1+m,12).toLocaleDateString(_e(),{weekday:"narrow"})),o=xo(Be(),e.expires),s=o?i("div",{class:"cal","aria-hidden":"true"},i("div",{class:"cal-h"},r.map(c=>i("span",{},c))),i("div",{class:"cal-g"},o.map((c,m)=>{let g=i("i",{class:c.kind,title:n(c.day)});return g.style.setProperty("--i",String(m)),g}))):null;return i("div",{class:`until${wt(e,t)?" soon":""}`},i("div",{class:"until-num"},i("b",{class:"num"},we(t)),i("span",{},N_(t,"day left","days left")),i("span",{class:"until-sub"},N(_("Ends %s"),n(e.expires)))),s)}function Ms(e,t){let n=-new Date().getTimezoneOffset(),r=un(e,t,n);if(!r)return null;let o=Mo(ct(),r.yours?n:t!=null?t:n),s=wo(r),c=s.some(([f,T])=>o>=f&&oi("span",{},f))))}function ks(e,t=1){let n=e.person,r=n.quota_used||n.month[0]+n.month[1],o=n.quota_limit?Math.min(100,r/n.quota_limit*100):0,s=n.quota_period==="total"&&!!n.quota_gb,c=Kt(n.expires,Be()),m=n.expires?i("span",{class:"until-val"},i("span",{class:"num","data-t":"until-date"},ni(n.expires)),c!=null?i("span",{class:`num ${c<0?"bad-t":wt(n,c)?"warn-t":"ok-t"}`,"data-t":"until-left"},c>=0?ze(c,"%s day","%s days"):_("ended")):null):i("span",{},_("No end date")),g=[n.expires?c!=null&&c<0?Vn(N(_("It ended on %s."),zt(n.expires))):ws(n,c!=null?c:0):null,n.hours?Ms(n.hours,e.tz_offset):null];return je([{icon:Q(n.access==="internet"?"globe":n.access==="lan"?"home":"shield"),title:xr(n.access),body:[gs(n.access),...vs(n,!!e.server.device_mesh)]},{icon:Q("chart"),title:s?_("Data used"):_("Data this month"),val:i("span",{class:"data-val"},n.quota_limit?ys(o):null,i("span",{class:"num","data-t":"data-val"},`${Me(r)} ${n.quota_limit?`/ ${Me(n.quota_limit)}`:`· ${_("no limit")}`}`)),valHide:!0,body:[s?Vn(N(_("%s of %s in total."),Me(r),Me(n.quota_limit))):xs(n,r,o),Vn(n.quota_limit?s?_("A total for your whole access, it does not reset."):_("Resets on the 1st."):_("No data limit. The count starts again on the 1st."))]},{icon:Q("calendar"),title:_("Access until"),val:m,valHide:!!n.expires&&(c!=null?c:0)>=0,body:g}],{open:t})}function ri(){return i("section",{class:"access",id:"access","aria-label":_("Your access")},i("div",{class:"sec-head"},i("h2",{},_("Your access"))),i("div",{class:"acc-slot"}))}var mn=null;function oi(e,t){let n=ks(t,mn?mn.openIndex():1),r=Zt(e);e.querySelector(".acc-slot").replaceChildren(n.el),mn&&en(e,r),mn=n}mr(document.documentElement);var vn=document.getElementById("app"),Oe=null,Yn=!1,yn=()=>{};function ii(){let e=[...vn.querySelectorAll(".crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone")],t=e.map(n=>getComputedStyle(n).opacity);e.forEach((n,r)=>$(n,[{opacity:0,transform:"translateY(10px)",filter:"blur(4px)"},{opacity:t[r],transform:"none",filter:"none"}],{duration:520,delay:60+r*40,easing:j,fill:"backwards"})),vn.querySelectorAll(".logo .sun").forEach(n=>$(n,[{transform:"translateY(7px)"},{transform:"none"}],{duration:900,delay:150,easing:j,fill:"backwards"})),Yn=!0}function jn(e={}){let t=pe();if(!t)return;if(yn=jn,t.person.state==="paused"){document.title=Xe();let[r,o,s]=zn(t.person);return Qn(r,o,s,!1,"orange")}let n=In(vn);Gn(!1),Wn(),document.title=Xe(),Oe||(Oe={notice:i("div",{class:"notice-slot"}),devices:ei(),access:ri()},We(n,Oe.notice,i("div",{class:"cols"},Oe.devices,Oe.access))),We(Oe.notice,_o(t.person)),ti(Oe.devices,t,e),oi(Oe.access,t),Yn||ii()}Gr(jn);function Qn(e,t,n,r=!1,o="grey"){Oe=null;let s=In(vn);Gn(!0),Wn(r,!0),We(s,i("div",{class:"gone"},Q(e,o),i("h1",{},t),i("p",{},n))),Yn||ii()}function Jn(){ke(null),me(!0),yn=Jn,Qn("key",_("This link no longer works"),_("Ask for a new one."),!0)}function si(e){yn=()=>si(e),Qn("server",_("The page could not load"),e)}function ai(){let e=pe(),t=$r(location.hash),n=Hr(location.hash);if(!e||!t&&!n)return;if(history.replaceState(null,"",location.pathname+location.search),n)return Rt();let r=e.person.devices.find(o=>o.id===t);r&&!r.handshake&&!r.disabled&&!e.locked&&fn(r)}addEventListener("hashchange",ai);async function Cs(){try{ke(await fe("state")),!He()&&!At()&&jn(),ai()}catch(e){jt(e)?Jn():pe()||si(e.message)}}dr(()=>{$e(!0),Oe=null,yn()});document.addEventListener("keydown",e=>{e.key==="Escape"&&(At()?$e(!0):He()&&me(!0))});!at||!Rr?Jn():Cs();})(); diff --git a/package/luci-app-dawnline/root/usr/share/dawnline/portal/cgi.uc b/package/luci-app-dawnline/root/usr/share/dawnline/portal/cgi.uc index 885d067..6345bea 100755 --- a/package/luci-app-dawnline/root/usr/share/dawnline/portal/cgi.uc +++ b/package/luci-app-dawnline/root/usr/share/dawnline/portal/cgi.uc @@ -9,7 +9,7 @@ import { serve } from 'dawnline.portal'; let env = {}; for (let k in [ 'REQUEST_METHOD', 'REQUEST_URI', 'REMOTE_ADDR', 'HTTPS', 'CONTENT_LENGTH', 'CONTENT_TYPE', - 'HTTP_HOST', 'HTTP_ORIGIN', 'HTTP_USER_AGENT', 'HTTP_ACCEPT', + 'HTTP_HOST', 'HTTP_ORIGIN', 'HTTP_USER_AGENT', 'HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', // The visitor behind Cloudflare (believed only when REMOTE_ADDR is Cloudflare's). 'HTTP_CF_CONNECTING_IP' ]) env[k] = getenv(k); diff --git a/package/luci-app-dawnline/root/usr/share/rpcd/ucode/luci.dawnline b/package/luci-app-dawnline/root/usr/share/rpcd/ucode/luci.dawnline index 8407989..b4340bb 100644 --- a/package/luci-app-dawnline/root/usr/share/rpcd/ucode/luci.dawnline +++ b/package/luci-app-dawnline/root/usr/share/rpcd/ucode/luci.dawnline @@ -4,7 +4,9 @@ // servers, people (and their devices), settings, home (services, circles), // maint (Diagnostics, backups, removal) and updates (Components). Each module // exports `methods` as { name: { args, call } }; read-only users get the -// methods listed under "read" in acl.d/luci-app-dawnline.json. +// methods listed under "read" in acl.d/luci-app-dawnline.json. Every method +// also takes `lang`, the admin page's language, and answers in it (its +// errors and the texts the backend writes, through dawnline.i18n). 'use strict'; import * as status from 'dawnline.rpc.status'; @@ -14,9 +16,29 @@ import * as settings from 'dawnline.rpc.settings'; import * as home from 'dawnline.rpc.home'; import * as maint from 'dawnline.rpc.maint'; import * as updates from 'dawnline.rpc.updates'; +import * as i18n from 'dawnline.i18n'; + +/** The methods with `lang` added: the language is set for the call, the method never sees it. */ +function in_lang(methods) { + let out = {}; + for (let name, m in methods) { + let call = m.call; + out[name] = { + ...m, + args: { ...(m.args ?? {}), lang: '' }, + call: function(req) { + i18n.use(req.args?.lang); + if (req.args) + delete req.args.lang; + return call(req); + }, + }; + } + return out; +} return { - 'luci.dawnline': { + 'luci.dawnline': in_lang({ ...status.methods, ...servers.methods, ...people.methods, @@ -24,5 +46,5 @@ return { ...home.methods, ...maint.methods, ...updates.methods, - }, + }), }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc index ba0173b..4ee50e7 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/access.uc @@ -1,5 +1,6 @@ // Dawnline: "Check access" — walks the same rules the nft table and the -// client configuration apply, and says in words where a connection stops. +// client configuration apply, and says in words where a connection stops +// (in the admin's language: each step is a whole sentence). 'use strict'; @@ -9,17 +10,68 @@ import * as net from 'dawnline.net'; import * as live from 'dawnline.live'; import * as view from 'dawnline.view'; import * as awg from 'dawnline.awg'; +import { _ } from 'dawnline.i18n'; -const STATE_TEXT = { - no_server: 'they have no server', - server_off: 'their server is turned off', - paused: 'they are paused', - expired: 'their access has ended', - quota: 'they used up their data', - hours: 'it is outside their allowed hours', -}; +/** "Bob can't connect: they are paused", by the person's state (core.person_state). */ +function cant_connect(name, st) { + if (st == 'no_server') + return sprintf(_("%s can't connect: they have no server"), name); + if (st == 'server_off') + return sprintf(_("%s can't connect: their server is turned off"), name); + if (st == 'paused') + return sprintf(_("%s can't connect: they are paused"), name); + if (st == 'expired') + return sprintf(_("%s can't connect: their access has ended"), name); + if (st == 'quota') + return sprintf(_("%s can't connect: they used up their data"), name); + if (st == 'hours') + return sprintf(_("%s can't connect: it is outside their allowed hours"), name); + return sprintf(_("%s can't connect: %s"), name, st); +} -const ACCESS_TEXT = { lan: 'Home only', internet: 'Internet only', both: 'Home and Internet' }; +/** "Bob · Phone can't be reached: it is turned off", by the device and its person's state. */ +function cant_reach(who, disabled, st) { + if (disabled) + return sprintf(_("%s can't be reached: it is turned off"), who); + if (st == 'no_server') + return sprintf(_("%s can't be reached: they have no server"), who); + if (st == 'server_off') + return sprintf(_("%s can't be reached: their server is turned off"), who); + if (st == 'paused') + return sprintf(_("%s can't be reached: they are paused"), who); + if (st == 'expired') + return sprintf(_("%s can't be reached: their access has ended"), who); + if (st == 'quota') + return sprintf(_("%s can't be reached: they used up their data"), who); + if (st == 'hours') + return sprintf(_("%s can't be reached: it is outside their allowed hours"), who); + return sprintf(_("%s can't be reached: %s"), who, st); +} + +/** A person's access as the admin page names it. */ +function access_text(a) { + if (a == 'lan') + return _('Home only'); + if (a == 'internet') + return _('Internet only'); + if (a == 'both') + return _('Home and Internet'); + return a; +} + +/** "Bob has Internet only": the step where access stops a connection. */ +function has_access(name, a) { + if (a == 'lan') + return sprintf(_('%s has Home only'), name); + if (a == 'internet') + return sprintf(_('%s has Internet only'), name); + return sprintf(_('%s has Home and Internet'), name); +} + +/** "Bob reaches lan, guest." (the person's home networks), or that there is none. */ +function reaches(name, devs) { + return length(devs) ? sprintf(_('%s reaches %s.'), name, join(', ', devs)) : sprintf(_('%s reaches no home network.'), name); +} function step(ok, title, detail) { return { ok: !!ok, title, detail: detail ?? '' }; @@ -65,7 +117,7 @@ function peer_of(dmp, d) { /** What the device sends to the router: its configuration's AllowedIPs. */ function routed(m, srv, p, d) { - return { nets: awg.allowed_ips(m, srv, p), what: 'Its configuration', list: null }; + return awg.allowed_ips(m, srv, p); } /** The home network (interface) of a server that holds an address. */ @@ -87,19 +139,19 @@ function router_addrs(snap) { function person_ok(m, p, d, states) { let st = states[p.id] ?? 'active'; if (d.disabled) - return step(false, `${d.name} is turned off`, 'Turn the device on again on its page.'); + return step(false, sprintf(_('%s is turned off'), d.name), _('Turn the device on again on its page.')); if (st != 'active') - return step(false, `${p.name} can't connect: ${STATE_TEXT[st] ?? st}`, ''); - return step(true, `${p.name} is active`, ACCESS_TEXT[p.access]); + return step(false, cant_connect(p.name, st), ''); + return step(true, sprintf(_('%s is active'), p.name), access_text(p.access)); } function connected(dmp, d, who) { let peer = peer_of(dmp, d); if (!peer || !(peer.handshake > 0)) - return step(false, `${who} has never connected`, 'There is no session the router could reach.'); + return step(false, sprintf(_('%s has never connected'), who), _('There is no session the router could reach.')); if (!live.online(dmp, d.id, peer)) - return step(false, `${who} isn't connected right now`, 'The router reaches it only while its VPN is on.'); - return step(true, `${who} is connected`, ''); + return step(false, sprintf(_("%s isn't connected right now"), who), _('The router reaches it only while its VPN is on.')); + return step(true, sprintf(_('%s is connected'), who), ''); } /** A device → somewhere: the router, home, another device or the internet. */ @@ -107,18 +159,18 @@ function from_device(m, d, t, states, dmp, snap) { let p = m.people[d.person]; let srv = p ? m.servers[p.server] : null; if (!p || !srv) - return [ step(false, `${d.name} has no server`, '') ]; + return [ step(false, sprintf(_('%s has no server'), d.name), '') ]; let steps = [ person_ok(m, p, d, states) ]; if (!steps[0].ok) return steps; - let r = routed(m, srv, p, d); - let allowed = r.nets; + let allowed = routed(m, srv, p, d); let via = (ip) => { let hit = in_nets(ip, allowed); - let what = r.list ? `${r.what}: ${r.list}` : `AllowedIPs ${join(', ', filter(allowed, (x) => index(x, ':') < 0))}`; + // The configuration's own words: the option and its value. + let what = `AllowedIPs ${join(', ', filter(allowed, (x) => index(x, ':') < 0))}`; return hit - ? step(true, `${r.what} sends it to the router`, what) - : step(false, `${r.what} doesn't send it to the router`, `${what}: the device's own network handles it.`); + ? step(true, _('Its configuration sends it to the router'), what) + : step(false, _("Its configuration doesn't send it to the router"), sprintf(_("%s: the device's own network handles it."), what)); }; // Another device. @@ -126,27 +178,27 @@ function from_device(m, d, t, states, dmp, snap) { let q = m.people[t.dev.person]; let who = `${q?.name ?? '?'} · ${t.dev.name}`; if (t.dev.id == d.id) - return [ step(false, 'That is the same device', '') ]; + return [ step(false, _('That is the same device'), '') ]; if (!q || q.server != p.server) - return stop(steps, step(false, `${who} is on another server`, 'Devices of different servers never reach each other.')); + return stop(steps, step(false, sprintf(_('%s is on another server'), who), _('Devices of different servers never reach each other.'))); if (!home_access(p)) - return stop(steps, step(false, `${p.name} has ${ACCESS_TEXT[p.access]}`, 'Only people with home access reach other devices.')); + return stop(steps, step(false, has_access(p.name, p.access), _('Only people with home access reach other devices.'))); if (!home_access(q)) - return stop(steps, step(false, `${q.name} has ${ACCESS_TEXT[q.access]}`, 'Only devices of people with home access can be reached.')); + return stop(steps, step(false, has_access(q.name, q.access), _('Only devices of people with home access can be reached.'))); if (srv.mesh == 'off') - return stop(steps, step(false, `"Devices reach each other" is off on ${srv.name}`, 'Server → Access → Home network.')); + return stop(steps, step(false, sprintf(_('"Devices reach each other" is off on %s'), srv.name), _('Server → Access → Home network.'))); if (srv.mesh == 'circles' && q.id != p.id) { let a = core.person_circle(m, p), b = core.person_circle(m, q); if (!a || !b || a.id != b.id) - return stop(steps, step(false, `${p.name} and ${q.name} are not in one circle`, - `${p.name}: ${a?.name ?? 'no circle'} · ${q.name}: ${b?.name ?? 'no circle'}`)); - push(steps, step(true, `Both are in ${a.name}`, 'Devices in one circle reach each other.')); + return stop(steps, step(false, sprintf(_('%s and %s are not in one circle'), p.name, q.name), + `${p.name}: ${a?.name ?? _('no circle')} · ${q.name}: ${b?.name ?? _('no circle')}`)); + push(steps, step(true, sprintf(_('Both are in %s'), a.name), _('Devices in one circle reach each other.'))); } else - push(steps, step(true, q.id == p.id ? `Both are ${p.name}'s devices` : 'Devices reach each other on this server', '')); + push(steps, step(true, q.id == p.id ? sprintf(_("Both are %s's devices"), p.name) : _('Devices reach each other on this server'), '')); let st = states[q.id] ?? 'active'; if (st != 'active' || t.dev.disabled) - return stop(steps, step(false, `${who} can't be reached: ${t.dev.disabled ? 'it is turned off' : STATE_TEXT[st] ?? st}`, '')); + return stop(steps, step(false, cant_reach(who, t.dev.disabled, st), '')); push(steps, via(t.ip)); push(steps, connected(dmp, t.dev, who)); return steps; @@ -156,17 +208,20 @@ function from_device(m, d, t, states, dmp, snap) { if (index(router_addrs(snap), t.ip) >= 0) { let portal = m.settings.portal_enabled && (t.port == m.settings.portal_port || (core.portal_http(m) && t.port == core.portal_http_port(m))); if (t.port == 53) - push(steps, step(true, `${t.ip} is this router: DNS is open to everyone`, '')); + push(steps, step(true, sprintf(_('%s is this router: DNS is open to everyone'), t.ip), '')); else if (portal) - push(steps, step(true, `${t.ip} is this router: the personal portal is open to everyone`, '')); + push(steps, step(true, sprintf(_('%s is this router: the personal portal is open to everyone'), t.ip), '')); else if (!home_access(p)) - return stop(steps, step(false, `${t.ip} is this router`, `${p.name} has ${ACCESS_TEXT[p.access]}: only DNS and the portal on the router.`)); + return stop(steps, step(false, sprintf(_('%s is this router'), t.ip), sprintf(p.access == 'lan' + ? _('%s has Home only: only DNS and the portal on the router.') + : _('%s has Internet only: only DNS and the portal on the router.'), p.name))); else { // Like any home address: only on the networks the person reaches. let h = core.person_home(srv, p, snap); if (!h.all && !in_nets(t.ip, h.nets)) - return stop(steps, step(false, `${t.ip} is this router on a network ${p.name} doesn't reach`, `${p.name} reaches ${join(', ', h.devs) || 'no home network'}.`)); - push(steps, step(true, `${t.ip} is this router`, h.all ? 'Home access includes the router.' : `On one of the networks ${p.name} reaches.`)); + return stop(steps, step(false, sprintf(_("%s is this router on a network %s doesn't reach"), t.ip, p.name), reaches(p.name, h.devs))); + push(steps, step(true, sprintf(_('%s is this router'), t.ip), + h.all ? _('Home access includes the router.') : sprintf(_('On one of the networks %s reaches.'), p.name))); } push(steps, via(t.ip)); return steps; @@ -175,14 +230,14 @@ function from_device(m, d, t, states, dmp, snap) { // A tunnel address no device has. let tn = in_tunnels(m, t.ip); if (tn) - return stop(steps, step(false, `No device uses ${t.ip}`, `It is in the tunnel network ${tn}.`)); + return stop(steps, step(false, sprintf(_('No device uses %s'), t.ip), sprintf(_('It is in the tunnel network %s.'), tn))); // Home. let sn = net.server_net(srv, snap); let hdev = home_dev_of(srv, t.ip, snap); if (hdev) { if (p.access == 'internet') - return stop(steps, step(false, `${t.ip} is at home (${hdev})`, `${p.name} has Internet only.`)); + return stop(steps, step(false, sprintf(_('%s is at home (%s)'), t.ip, hdev), sprintf(_('%s has Internet only.'), p.name))); if (p.access == 'lan' && length(p.services)) { let hit = null; for (let sid in p.services) { @@ -192,28 +247,32 @@ function from_device(m, d, t, states, dmp, snap) { } let names = join(', ', map(filter(map(p.services, (x) => m.services[x]), (x) => x), (x) => x.name)); if (!hit) - return stop(steps, step(false, `${t.ip}${t.port ? `:${t.port}` : ''} is not one of ${p.name}'s home services`, `Allowed: ${names}`)); - push(steps, step(true, `${t.ip} is ${hit.name}, one of ${p.name}'s home services`, - length(hit.ports) ? `Ports ${join(', ', hit.ports)}` : 'All ports')); + return stop(steps, step(false, sprintf(_("%s is not one of %s's home services"), t.port ? `${t.ip}:${t.port}` : t.ip, p.name), + sprintf(_('Allowed: %s'), names))); + push(steps, step(true, sprintf(_("%s is %s, one of %s's home services"), t.ip, hit.name, p.name), + length(hit.ports) ? sprintf(_('Ports %s'), join(', ', hit.ports)) : _('All ports'))); } else { let h = core.person_home(srv, p, snap); if (!in_nets(t.ip, h.nets)) - return stop(steps, step(false, `${t.ip} is in ${hdev}, which ${p.name} doesn't reach`, `${p.name} reaches ${join(', ', h.devs) || 'no home network'}.`)); - push(steps, step(true, `${t.ip} is in ${hdev}`, h.all ? 'Home access reaches every home network.' : `One of the networks ${p.name} reaches.`)); + return stop(steps, step(false, sprintf(_("%s is in %s, which %s doesn't reach"), t.ip, hdev, p.name), reaches(p.name, h.devs))); + push(steps, step(true, sprintf(_('%s is in home network %s'), t.ip, hdev), + h.all ? _('Home access reaches every home network.') : sprintf(_('One of the networks %s reaches.'), p.name))); } push(steps, via(t.ip)); - push(steps, step(true, 'The firewall lets it through', `${srv.ifname} → ${join(', ', sn.zones) || 'home'}`)); + push(steps, step(true, _('The firewall lets it through'), `${srv.ifname} → ${join(', ', sn.zones) || _('home')}`)); return steps; } // Another private address, or the internet. if (in_nets(t.ip, [ '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', '100.64.0.0/10', '169.254.0.0/16' ])) - return stop(steps, step(false, `${t.ip} isn't in ${srv.name}'s home network`, 'Private addresses outside the home network are blocked.')); + return stop(steps, step(false, sprintf(_("%s isn't in %s's home network"), t.ip, srv.name), _('Private addresses outside the home network are blocked.'))); if (p.access == 'lan') - return stop(steps, step(true, `${t.ip} is on the internet`, `${p.name} has Home only: their device's own internet reaches it, not the tunnel.`)); + return stop(steps, step(true, sprintf(_('%s is on the internet'), t.ip), + sprintf(_("%s has Home only: their device's own internet reaches it, not the tunnel."), p.name))); push(steps, via(t.ip)); - push(steps, step(true, `${t.ip} is on the internet`, srv.lan_like ? 'It leaves like a home device would.' : `It leaves through ${sn.wan.dev ?? 'the WAN'}.`)); + push(steps, step(true, sprintf(_('%s is on the internet'), t.ip), srv.lan_like ? _('It leaves like a home device would.') + : sn.wan.dev != null ? sprintf(_('It leaves through %s.'), sn.wan.dev) : _('It leaves through the WAN.'))); return steps; } @@ -222,22 +281,22 @@ function to_device(m, ip, d, states, dmp, snap) { let p = m.people[d.person]; let srv = p ? m.servers[p.server] : null; if (!p || !srv) - return [ step(false, `${d.name} has no server`, '') ]; + return [ step(false, sprintf(_('%s has no server'), d.name), '') ]; let who = `${p.name} · ${d.name}`; let hdev = in_tunnels(m, ip) ? null : home_dev_of(srv, ip, snap); if (!hdev) - return [ step(false, `${ip} isn't in ${srv.name}'s home network`, 'Only home devices reach people\'s devices.') ]; - let steps = [ step(true, `${ip} is at home (${hdev})`, '') ]; + return [ step(false, sprintf(_("%s isn't in %s's home network"), ip, srv.name), _("Only home devices reach people's devices.")) ]; + let steps = [ step(true, sprintf(_('%s is at home (%s)'), ip, hdev), '') ]; if (!home_access(p)) - return stop(steps, step(false, `${p.name} has ${p.access == 'lan' ? 'only some home services' : ACCESS_TEXT[p.access]}`, - 'Home devices reach only people with home access.')); + return stop(steps, step(false, p.access == 'lan' ? sprintf(_('%s has only some home services'), p.name) : has_access(p.name, p.access), + _('Home devices reach only people with home access.'))); let h = core.person_home(srv, p, snap); if (!in_nets(ip, h.nets)) - return stop(steps, step(false, `${p.name} doesn't reach ${hdev}`, 'Networks a person does not reach cannot reach them either.')); + return stop(steps, step(false, sprintf(_("%s doesn't reach %s"), p.name, hdev), _('Networks a person does not reach cannot reach them either.'))); push(steps, person_ok(m, p, d, states)); if (!steps[length(steps) - 1].ok) return steps; - push(steps, step(true, 'The firewall lets it through', `${join(', ', net.server_net(srv, snap).zones) || 'home'} → ${srv.ifname}`)); + push(steps, step(true, _('The firewall lets it through'), `${join(', ', net.server_net(srv, snap).zones) || _('home')} → ${srv.ifname}`)); push(steps, connected(dmp, d, who)); return steps; } @@ -246,9 +305,9 @@ function to_device(m, ip, d, states, dmp, snap) { export function check(m, from, to) { let a = parse_target(m, from), b = parse_target(m, to); if (!a) - die(`"${from}" is not a device or an IPv4 address.`); + die(sprintf(_('"%s" is not a device or an IPv4 address.'), from)); if (!b) - die(`"${to}" is not a device or an IPv4 address.`); + die(sprintf(_('"%s" is not a device or an IPv4 address.'), to)); let usage = core.load_usage(); let states = view.states(m, usage); let dmp = live.dump(m); @@ -259,7 +318,7 @@ export function check(m, from, to) { else if (b.dev) steps = to_device(m, a.ip, b.dev, states, dmp, snap); else - die('Choose a device on at least one side.'); + die(_('Choose a device on at least one side.')); let ok = length(filter(steps, (s) => !s.ok)) == 0; return { ok, steps }; }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc index 0e2fe2d..413a4fd 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/apply.uc @@ -22,6 +22,7 @@ import * as nft from 'dawnline.nft'; import * as fw from 'dawnline.fw'; import * as netifd from 'dawnline.netifd'; import * as migrate from 'dawnline.migrate'; +import { _, L_ } from 'dawnline.i18n'; const HOSTS_FILE = '/tmp/hosts/dawnline'; /** The network signature the last apply() worked from (the agent compares against it). */ @@ -93,9 +94,9 @@ function nft_result(err, present) { return null; } if (was != err) { - log('Access rules', present - ? "couldn't be updated — the previous rules stay, and changes to access wait until they load" - : "couldn't load — no device is loaded into the tunnels until they do", 'error', err); + log(L_('Access rules'), present + ? L_("couldn't be updated - the previous rules stay, and changes to access wait until they load") + : L_("couldn't load - no device is loaded into the tunnels until they do"), 'error', err); ensure_dir(RUN_DIR); writefile(NFT_ERR, err); } @@ -138,18 +139,19 @@ export function firewall_drift(m) { /** * What an admin should hear when a sync did not fully take: the access table - * failed, or a server did not accept its devices. Null when all went in. + * failed, or a server did not accept its devices (sentences in the caller's + * language, with what nft or awg said). Null when all went in. */ function sync_warning(m, table, peers) { let out = []; if (table != null) push(out, nft.present() - ? `Access rules couldn't be updated (${table}): the previous rules stay, so this change isn't in effect yet.` - : `Access rules couldn't load (${table}): no device is loaded into the tunnels until they do.`); + ? sprintf(_("Access rules couldn't be updated (%s): the previous rules stay, so this change isn't in effect yet."), table) + : sprintf(_("Access rules couldn't load (%s): no device is loaded into the tunnels until they do."), table)); for (let id, r in peers) if (r != 'ok' && r != 'down') - push(out, `Couldn't load devices into ${m.servers[id]?.name ?? id}: ${r}.`); - return length(out) ? join(' ', out) + ' Open Diagnostics → Health.' : null; + push(out, sprintf(_("Couldn't load devices into %s: %s."), m.servers[id]?.name ?? id, r)); + return length(out) ? join(' ', [ ...out, _('Open Diagnostics → Health.') ]) : null; } /* @@ -242,7 +244,7 @@ export function apply(opts) { return { network, firewall, lp, peers: s.peers, warning: s.warning }; }); loop.remember(r.lp); - return { network: r.network, firewall: r.firewall, like_home: r.lp.error ? { error: r.lp.error } : !r.lp.off, peers: r.peers, warning: r.warning }; + return { network: r.network, firewall: r.firewall, like_home: r.lp.error ? { error: loop.error_text(r.lp.error) } : !r.lp.off, peers: r.peers, warning: r.warning }; }; /** Remove everything Dawnline created (used by the uninstaller). */ diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc index 7ca8097..4687b4c 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc @@ -1,8 +1,8 @@ // Dawnline — the AmneziaWG core: keys, disguise (obfuscation), client // configurations (.conf, AmneziaVPN key), the netifd options of a server's -// tunnel, its peers (`awg syncconf`, no restart), live counters and what the -// watchdog and Health check about it. Plain WireGuard is AmneziaWG with the -// disguise off. +// tunnel, its peers (`awg syncconf`, no restart), live counters, the words for +// why a tunnel is kept down (blocked_text) and what the watchdog and Health +// check about it. Plain WireGuard is AmneziaWG with the disguise off. import { readfile, stat, unlink } from 'fs'; import { @@ -13,6 +13,7 @@ import * as core from 'dawnline.core'; import * as net from 'dawnline.net'; import * as pkg from 'dawnline.pkg'; import * as builds from 'dawnline.awg_builds'; +import { _, L_ } from 'dawnline.i18n'; /** Names in .conf files (and AmneziaVPN keys); netifd uses `awg_`. */ export const OBF_CONF = { @@ -98,15 +99,15 @@ export function genpsk() { export function new_keys(public_key) { let psk = genpsk(); if (!valid_key(psk)) - die('Key generation failed (no random data).'); + die(_('Key generation failed (no random data).')); if (public_key) { if (!valid_key(public_key)) - die('Invalid public key.'); + die(_('Invalid public key.')); return { public_key, preshared_key: psk }; } let priv = genkey(), pub = pubkey(priv); if (!pub) - die('Key generation failed (is amneziawg-tools installed?).'); + die(_('Key generation failed (is amneziawg-tools installed?).')); return { private_key: priv, public_key: pub, preshared_key: psk }; }; @@ -114,7 +115,7 @@ export function new_keys(public_key) { export function server_keys() { let priv = genkey(), pub = pubkey(priv); if (!pub) - die('Key generation failed (is amneziawg-tools installed?).'); + die(_('Key generation failed (is amneziawg-tools installed?).')); return { private_key: priv, public_key: pub }; }; @@ -172,10 +173,11 @@ export function caps() { }; /** - * Why this AmneziaWG cannot run a server's disguise values, or null: a 3.1 - * preset after a rollback to a 2.0 build would come up without the header - * protection every device expects, so such a server is kept down instead - * (dawnline.netifd). + * Why this AmneziaWG cannot run a server's disguise values, as a reason to + * keep the server down (blocked_text): { code: 'disguise', need, installed } + * (installed null: none), or null when it can. A 3.1 preset after a rollback + * to a 2.0 build would come up without the header protection every device + * expects, so such a server is kept down instead (dawnline.netifd). */ export function obf_unsupported(o) { let c = caps(); @@ -185,9 +187,9 @@ export function obf_unsupported(o) { let v2 = [ 's3', 's4', 'i1', 'i2', 'i3', 'i4', 'i5' ]; let ranged = length(filter([ 'h1', 'h2', 'h3', 'h4' ], (k) => match(`${o?.[k] ?? ''}`, /-/))) > 0; if (has(v3) && !c.v3) - return `its disguise needs AmneziaWG 3.1 (installed: ${c.kmod ?? c.tools ?? 'none'})`; + return { code: 'disguise', need: '3.1', installed: c.kmod ?? c.tools }; if ((has(v2) || ranged) && !c.v2) - return `its disguise needs AmneziaWG 2.0 (installed: ${c.kmod ?? c.tools ?? 'none'})`; + return { code: 'disguise', need: '2.0', installed: c.kmod ?? c.tools }; return null; }; @@ -293,9 +295,9 @@ export function obf_errors(o) { if (v == null || v == '') continue; if (!match(v, /^[0-9]+(-[0-9]+)?$/)) - push(errs, `${k} must be a number or range`); + push(errs, sprintf(_('%s must be a number or range'), k)); else if (hs[v]) - push(errs, 'h1-h4 must be distinct'); + push(errs, _('h1-h4 must be distinct')); hs[v] = true; } return errs; @@ -482,7 +484,7 @@ export function sync_peers(m, states) { unlink(f); res[id] = r.code == 0 ? 'ok' : trim(r.out); if (r.code != 0) - slog('awg', 'error', "couldn't load devices into the tunnel", trim(r.out), srv.name); + slog('awg', 'error', L_("couldn't load devices into the tunnel"), trim(r.out), srv.name); } return res; }; @@ -528,6 +530,56 @@ export function server_state(srv) { return { up: !!st?.up, uptime: st?.uptime ?? 0 }; }; +/* ---------- why a tunnel is kept down ---------- */ + +/* + * dawnline.netifd keeps a server's tunnel down for a reason, kept per server + * in core.BLOCKED and loaded as `srv.blocked`. apply writes it, at boot and + * from the agent with no language, so it holds a code and its values, made + * into text when read: + * { code: 'ifname', ifname } the interface name is invalid + * { code: 'taken', ifname } network. exists and isn't Dawnline's + * { code: 'disguise', need, installed } obf_unsupported() + * Files written by older versions hold the English fragment ("has an invalid + * interface name …"), shown as it is. + */ + +/** A reason as the service log says it after the server's name: English, like every log line. */ +export function blocked_note(r) { + if (type(r) != 'object') + return `${r}`; + if (r.code == 'ifname') + return sprintf(L_('has an invalid interface name "%s"'), r.ifname); + if (r.code == 'taken') + return sprintf(L_("can't use the network interface %s: it exists and isn't Dawnline's"), r.ifname); + if (r.code == 'disguise') + return r.installed ? sprintf(L_('is kept down: its disguise needs AmneziaWG %s (installed: %s)'), r.need, r.installed) + : sprintf(L_('is kept down: its disguise needs AmneziaWG %s (installed: none)'), r.need); + return L_('is kept down'); +}; + +/** + * Why the server's tunnel is kept down (`srv.blocked`), as a sentence with + * its name in the reader's language: what the admin UI shows. Null when it + * is not kept down. + */ +export function blocked_text(srv) { + let r = srv?.blocked; + if (!r) + return null; + if (type(r) != 'object') + return `${srv.name} ${r}.`; + if (r.code == 'ifname') + return sprintf(_('%s has an invalid interface name "%s".'), srv.name, r.ifname); + if (r.code == 'taken') + return sprintf(_("%s can't use the network interface %s: it exists and isn't Dawnline's."), srv.name, r.ifname); + if (r.code == 'disguise') + return r.installed + ? sprintf(_('%s is kept down: its disguise needs AmneziaWG %s (installed: %s).'), srv.name, r.need, r.installed) + : sprintf(_('%s is kept down: its disguise needs AmneziaWG %s (installed: none).'), srv.name, r.need); + return sprintf(_('%s is kept down.'), srv.name); +}; + /* ---------- watchdog ---------- */ /** Why a tunnel is down, from netifd and the last related syslog lines. */ @@ -553,19 +605,20 @@ export function probes(m, ctx) { // AmneziaWG itself first: without it no tunnel can run (they come back on the next pass). // Missing packages and an unknown protocol are reported once; only the module can be loaded here. let st = state(); - let base = { id: 'awg', src: 'awg', name: 'AmneziaWG', who: 'AmneziaWG', back: 'is ready again' }; + let base = { id: 'awg', src: 'awg', name: 'AmneziaWG', who: 'AmneziaWG', back: L_('is ready again') }; if (!st.tools || !st.kmod) { push(out, { ...base, ok: false, repair: null, - problem: `${st.tools ? "kernel module isn't" : "isn't"} installed: no tunnel can run — install it in Dawnline → Components`, - detail: () => `Missing: ${join(', ', st.missing)}.` }); + problem: st.tools ? L_("kernel module isn't installed: no tunnel can run - install it in Dawnline → Components") + : L_("isn't installed: no tunnel can run - install it in Dawnline → Components"), + detail: () => sprintf(L_('Missing: %s.'), join(', ', st.missing)) }); return out; } push(out, { ...base, ok: st.loaded && st.handler, - problem: !st.loaded ? "kernel module isn't loaded" : "isn't known to the network service — restart the network or reboot", + problem: !st.loaded ? L_("kernel module isn't loaded") : L_("isn't known to the network service - restart the network or reboot"), detail: !st.loaded ? () => sh_out("modprobe amneziawg 2>&1; dmesg 2>/dev/null | grep -i amneziawg | grep -iE 'error|fail|invalid|unknown|disagrees|taint' | tail -n 4") - : () => 'netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.', - repair: !st.loaded ? { what: 'loading it', run: () => system('modprobe amneziawg >/dev/null 2>&1') } : null, + : () => L_('netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.'), + repair: !st.loaded ? { what: L_('loading it'), run: () => system('modprobe amneziawg >/dev/null 2>&1') } : null, }); // Without the protocol handler ifup cannot work: the tunnels are not probed (or restarted) one by one. if (st.loaded && !st.handler) @@ -574,13 +627,13 @@ export function probes(m, ctx) { // A tunnel Dawnline may not set up (dawnline.netifd) is reported, never restarted: // an interface of the same name that isn't Dawnline's may be your LAN. let own = core.valid_ifname(srv.ifname) ? ctx.owner?.(srv.ifname) : null; - let why = srv.blocked ?? (!core.valid_ifname(srv.ifname) ? `has an invalid interface name "${srv.ifname}"` - : own != null && own != srv.id ? `can't use the network interface ${srv.ifname}: it exists and isn't Dawnline's` : null); + let why = srv.blocked ?? (!core.valid_ifname(srv.ifname) ? { code: 'ifname', ifname: srv.ifname } + : own != null && own != srv.id ? { code: 'taken', ifname: srv.ifname } : null); if (why) { push(out, { id: `up_${srv.id}`, src: 'awg', name: `${srv.name} · AmneziaWG`, who: srv.name, ok: false, repair: null, - problem: why, back: 'AmneziaWG is running again', - detail: () => 'Choose another interface name in the server settings.', + problem: blocked_note(why), back: L_('AmneziaWG is running again'), + detail: () => L_('Choose another interface name in the server settings.'), }); continue; } @@ -588,10 +641,11 @@ export function probes(m, ctx) { let up = !!s?.up; push(out, { id: `up_${srv.id}`, src: 'awg', name: `${srv.name} · AmneziaWG`, who: srv.name, ok: up && ctx.udp_listening(srv.port), - problem: !s ? 'AmneziaWG is missing from the router' : !up ? "AmneziaWG isn't running" : `AmneziaWG isn't accepting connections on port ${srv.port}`, - back: `AmneziaWG is running again · accepting connections on port ${srv.port}`, + problem: !s ? L_('AmneziaWG is missing from the router') : !up ? L_("AmneziaWG isn't running") + : sprintf(L_("AmneziaWG isn't accepting connections on port %d"), srv.port), + back: sprintf(L_('AmneziaWG is running again · accepting connections on port %d'), srv.port), detail: () => iface_errors(srv.ifname), - repair: s ? { what: 'restarting it', run: () => system(`ifup ${q(srv.ifname)}`) } : { what: 'setting it up again', run: ctx.reapply }, + repair: s ? { what: L_('restarting it'), run: () => system(`ifup ${q(srv.ifname)}`) } : { what: L_('setting it up again'), run: ctx.reapply }, }); } return out; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc index 4353a67..8eeda5d 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/backup.uc @@ -13,6 +13,7 @@ import * as live from 'dawnline.live'; import * as apply from 'dawnline.apply'; import * as net from 'dawnline.net'; import * as health from 'dawnline.health'; +import { _ } from 'dawnline.i18n'; const BACKUP_DIR = `${DATA_DIR}/backups`; /** @@ -51,17 +52,16 @@ export function config_errors(c) { let internal = values(net.INTERNAL); let ifnames = {}, ports = {}, subnets = []; for (let id, srv in m.servers) { - let who = `Server ${srv.name}`; for (let e in core.server_errors(m, srv, [ ...foreign, ...subnets ])) - push(errs, `${who}: ${e}`); + push(errs, sprintf(_('Server %s: %s'), srv.name, e)); if (ifnames[srv.ifname]) - push(errs, `${who}: interface ${srv.ifname} is also used by ${ifnames[srv.ifname]}.`); + push(errs, sprintf(_('Server %s: interface %s is also used by %s.'), srv.name, srv.ifname, ifnames[srv.ifname])); ifnames[srv.ifname] = srv.name; let t = nc.get('network', srv.ifname); if (index(internal, srv.ifname) >= 0 || (t != null && (t != 'interface' || nc.get('network', srv.ifname, '_dawnline') == null))) - push(errs, `${who}: ${srv.ifname} is one of the router's own network interfaces.`); + push(errs, sprintf(_("Server %s: %s is one of the router's own network interfaces."), srv.name, srv.ifname)); if (ports[srv.port]) - push(errs, `${who}: UDP ${srv.port} is also used by ${ports[srv.port]}.`); + push(errs, sprintf(_('Server %s: UDP %s is also used by %s.'), srv.name, srv.port, ports[srv.port])); ports[srv.port] = srv.name; if (srv.subnet) push(subnets, srv.subnet); @@ -75,10 +75,10 @@ function check_config_dir(dir) { // Its own delta directory: changes staged in LuCI must not leak into the check. let c = cursor(dir, `${dir}/.delta`); if (!c.load('dawnline')) - die('The configuration in this file cannot be read.'); + die(_('The configuration in this file cannot be read.')); let errs = config_errors(c); if (length(errs)) - die(`This configuration can't be used: ${join(' ', errs)}`); + die(sprintf(_("This configuration can't be used: %s"), join(' ', errs))); } /** A private scratch directory under RUN_DIR (the caller removes it). */ @@ -129,7 +129,8 @@ export function backup_create(reason, keep) { let r = sh(`tar -czf ${q(tmp)} -C / ${files}`); if (r.code != 0 || !rename(tmp, `${BACKUP_DIR}/${name}`)) { unlink(tmp); - die(`Backup failed: ${trim(r.out) || 'the archive could not be written (is the flash full?)'}`); + let why = trim(r.out); + die(why ? sprintf(_('Backup failed: %s'), why) : _('Backup failed: the archive could not be written (is the flash full?)')); } system(`chmod 600 ${q(BACKUP_DIR + '/' + name)}`); let by_kind = {}; @@ -144,10 +145,10 @@ export function backup_create(reason, keep) { function backup_path(name) { if (!match(name ?? '', NAME)) - die('Invalid backup name.'); + die(_('Invalid backup name.')); let p = `${BACKUP_DIR}/${name}`; if (!file_exists(p)) - die('Backup not found.'); + die(_('Backup not found.')); return p; } @@ -158,24 +159,24 @@ function backup_path(name) { function check_archive(path) { let r = sh(`tar -tvzf ${q(path)}`); if (r.code != 0) - die('Not a valid backup archive.'); + die(_('Not a valid backup archive.')); let has_config = false, total = 0; for (let line in split(trim(r.out), '\n')) { let f = split(trim(line), /[ \t]+/); let name = replace(f[length(f) >= 6 ? 5 : length(f) - 1] ?? '', /^\.?\//, ''); // "-rw------- root/root 1234 2026-01-01 12:00:00 etc/config/dawnline"; links show "a -> b". if (substr(line, 0, 1) != '-' || index(line, ' -> ') >= 0 || index(line, ' link to ') >= 0) - die(`Unexpected entry in backup: ${name}`); + die(sprintf(_('Unexpected entry in backup: %s'), name)); if (index(FILES, name) < 0) - die(`Unexpected file in backup: ${name}`); + die(sprintf(_('Unexpected file in backup: %s'), name)); total += +(f[2] ?? 0) || 0; if (name == 'etc/config/dawnline') has_config = true; } if (!has_config) - die('Backup does not contain /etc/config/dawnline.'); + die(_('Backup does not contain /etc/config/dawnline.')); if (total > MAX_UNPACKED) - die('Backup is too large.'); + die(_('Backup is too large.')); } /** @@ -190,7 +191,7 @@ function install_files(dir) { for (let f in FILES) { let data = readfile(`${dir}/${f}`); if (data != null && !write_file(`/${f}`, data, 0o600)) - die(`Couldn't write /${f}. Is the flash full?`); + die(sprintf(_("Couldn't write %s. Is the flash full?"), `/${f}`)); } } catch (e) { @@ -208,7 +209,7 @@ export function backup_restore(name, path) { try { let r = sh(`tar -xzf ${q(path)} -C ${q(dir)} ${join(' ', map(FILES, q))} 2>/dev/null; test -f ${q(dir + '/etc/config/dawnline')}`); if (r.code != 0) - die('Not a valid backup archive.'); + die(_('Not a valid backup archive.')); check_config_dir(`${dir}/etc/config`); backup_create('pre-restore', name); install_files(dir); @@ -238,7 +239,7 @@ export function backup_read(name) { export function backup_upload(data_b64) { let data = b64dec(data_b64 ?? ''); if (!data || length(data) > 4 * 1024 * 1024) - die('Upload is empty or too large.'); + die(_('Upload is empty or too large.')); ensure_dir(RUN_DIR); let tmp = `${RUN_DIR}/upload.tar.gz`; write_file(tmp, data); @@ -273,23 +274,23 @@ export function export_json() { /** An export as /etc/config/dawnline text; dies on anything that is not one. */ function export_to_uci(data) { if (type(data) != 'object' || data.format != 'dawnline' || type(data.sections) != 'array') - die('Not a Dawnline export.'); + die(_('Not a Dawnline export.')); let types = { settings: true, server: true, person: true, device: true, service: true, circle: true }; let esc = (x) => replace(`${x}`, "'", "'\\''"); let lines = []; for (let s in data.sections) { if (type(s) != 'object' || !types[s['.type']] || !match(s['.name'] ?? '', /^[A-Za-z0-9_]{1,64}$/)) - die(`Invalid section ${s?.['.name']}.`); + die(sprintf(_('Invalid section %s.'), s?.['.name'])); push(lines, `config ${s['.type']} '${s['.name']}'`); for (let k, v in s) { if (substr(k, 0, 1) == '.') continue; if (!match(k, /^[a-z0-9_]{1,32}$/) || (type(v) != 'string' && type(v) != 'array')) - die(`Invalid option ${k}.`); + die(sprintf(_('Invalid option %s.'), k)); if (type(v) == 'array') for (let x in v) { if (type(x) != 'string') - die(`Invalid option ${k}.`); + die(sprintf(_('Invalid option %s.'), k)); push(lines, `\tlist ${k} '${esc(x)}'`); } else @@ -317,6 +318,6 @@ export function import_json(data) { let ok = write_file('/etc/config/dawnline', text, 0o600); unlock(l); if (!ok) - die("Couldn't write /etc/config/dawnline. Is the flash full?"); + die(sprintf(_("Couldn't write %s. Is the flash full?"), '/etc/config/dawnline')); return apply.apply(); }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc index 42a9889..bb6a90c 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc @@ -4,9 +4,10 @@ import { cursor } from 'uci'; import { - valid_name, valid_key, valid_host, valid_date, slugify, host_label, ucut, NAME_RULE, parse_cidr, cidr_overlaps, int2ip, ip2int, + valid_name, valid_key, valid_host, valid_date, slugify, host_label, ucut, name_rule, parse_cidr, cidr_overlaps, int2ip, ip2int, rand_hex, rand_bytes, date_end, month_key, read_json, DATA_DIR, RUN_DIR, uniq } from 'dawnline.util'; +import { _, N_ } from 'dawnline.i18n'; import * as net from 'dawnline.net'; import * as schema from 'dawnline.schema'; import { policy as updates_policy } from 'dawnline.updates'; @@ -481,35 +482,35 @@ export function new_code() { export function create_person(c, m, a) { if (!valid_name(a.name)) - fail(NAME_RULE); + fail(name_rule()); // The id is a UCI section name: letters, digits and underscores only (a dash // makes uci drop the section). Repeated names get _2, _3, … let base = replace(a.slug ?? slugify(a.name), /-/g, '_'); if (!match(base, /^[a-z0-9_]{1,32}$/)) - fail('The id may use lowercase letters, digits and underscores.'); + fail(_('The id may use lowercase letters, digits and underscores.')); // Any kind of section (store.id_taken, which imports this module). let taken = (id) => m.people[id] || m.servers[id] || m.devices[id] || m.services[id] || m.circles[id] || index([ 'settings', 'main', 'global', 'defaults' ], id) >= 0; let slug = base; for (let n = 2; taken(slug); n++) { if (n > 99) - fail(`"${base}" is already taken.`); + fail(sprintf(_('"%s" is already taken.'), base)); slug = `${substr(base, 0, 28)}_${n}`; } let srv_id = a.server ?? keys(m.servers)[0]; if (!m.servers[srv_id]) - fail('Set up a server first.'); + fail(_('Set up a server first.')); let access = a.access ?? 'internet'; if (index(ACCESS, access) < 0) - fail('Access must be lan, internet or both.'); + fail(_('Access must be lan, internet or both.')); let limit = toint(a.device_limit, m.settings.default_device_limit); if (limit < 1 || limit > 32) - fail('Device limit must be between 1 and 32.'); + fail(_('Device limit must be between 1 and 32.')); if (a.expires && !valid_date(a.expires)) - fail('End date must be YYYY-MM-DD.'); + fail(_('End date must be YYYY-MM-DD.')); let quota = num(a.quota_gb, 0); if (quota < 0 || quota > 100000) - fail('Monthly data must be a positive number of GB.'); + fail(_('Monthly data must be a positive number of GB.')); c.set(CONFIG, slug, 'person'); c.set(CONFIG, slug, 'server', srv_id); @@ -535,52 +536,53 @@ export function create_person(c, m, a) { export function update_person(c, m, id, a) { let p = m.people[id]; if (!p) - fail('Unknown person.'); + fail(_('Unknown person.')); let set = (k, v) => (v == null || v == '') ? c.delete(CONFIG, id, k) : c.set(CONFIG, id, k, `${v}`); if (a.name != null) { if (!valid_name(a.name)) - fail(NAME_RULE); + fail(name_rule()); set('name', trim(a.name)); } if (a.access != null) { if (index(ACCESS, a.access) < 0) - fail('Access must be lan, internet or both.'); + fail(_('Access must be lan, internet or both.')); set('access', a.access); } if (a.device_limit != null) { let n = toint(a.device_limit, 0); if (n < 1 || n > 32) - fail('Device limit must be between 1 and 32.'); + fail(_('Device limit must be between 1 and 32.')); let have = length(p.devices); if (n < have) - fail(`${p.name} already has ${have} devices. Remove one first to lower the limit to ${n}.`); + fail(sprintf(N_(have, '%s already has %d device. Remove one first to lower the limit to %d.', + '%s already has %d devices. Remove one first to lower the limit to %d.'), p.name, have, n)); set('device_limit', n); } if (a.expires != null) { if (a.expires != '' && !valid_date(a.expires)) - fail('End date must be YYYY-MM-DD.'); + fail(_('End date must be YYYY-MM-DD.')); set('expires', a.expires); } if (a.expire_action != null) { if (index([ 'pause', 'notify', 'remove' ], a.expire_action) < 0) - fail('Unknown end action.'); + fail(_('Unknown end action.')); set('expire_action', a.expire_action == 'pause' ? '' : a.expire_action); } if (a.dns_mode != null) { if (index([ 'device', 'home' ], a.dns_mode) < 0) - fail('Unknown DNS choice.'); + fail(_('Unknown DNS choice.')); set('dns_mode', a.dns_mode == 'device' ? '' : a.dns_mode); } if (a.expire_warn != null) { let n = toint(a.expire_warn, -1); if (n < 0 || n > 60) - fail('Warning must be 0-60 days.'); + fail(_('Warning must be 0-60 days.')); set('expire_warn', n == 3 ? '' : n); } if (a.quota_gb != null) { let q = num(a.quota_gb, -1); if (a.quota_gb != '' && (q < 0 || q > 100000)) - fail('Data limit must be a positive number of GB.'); + fail(_('Data limit must be a positive number of GB.')); set('quota_gb', q > 0 ? q : ''); } if (a.quota_period != null) @@ -588,13 +590,13 @@ export function update_person(c, m, id, a) { if (a.bonus_gb != null) { let b = num(a.bonus_gb, -1); if (b < 0 || b > 100000) - fail('Extra data must be a positive number of GB.'); + fail(_('Extra data must be a positive number of GB.')); set('bonus_gb', b > 0 ? b : ''); set('bonus_month', b > 0 ? month_key() : ''); } if (a.hours != null) { if (a.hours != '' && !parse_hours(a.hours)) - fail('Hours must look like 07:00-23:00.'); + fail(_('Hours must look like 07:00-23:00.')); set('hours', a.hours); } if (a.note != null) @@ -602,7 +604,7 @@ export function update_person(c, m, id, a) { if (type(a.services) == 'array') { for (let sid in a.services) if (!m.services[sid]) - fail(`Unknown service ${sid}.`); + fail(sprintf(_('Unknown service %s.'), sid)); if (length(a.services)) c.set(CONFIG, id, 'service', a.services); else @@ -611,7 +613,7 @@ export function update_person(c, m, id, a) { if (a.circle != null) { let ci = m.circles[a.circle]; if (a.circle != '' && (!ci || ci.server != p.server)) - fail('Unknown circle.'); + fail(_('Unknown circle.')); set('circle', a.circle); } // Another server: every device gets an address in its tunnel (so each @@ -619,13 +621,13 @@ export function update_person(c, m, id, a) { // server's and go. if (a.server != null && a.server != '' && a.server != p.server) { if (!m.servers[a.server]) - fail('Unknown server.'); + fail(_('Unknown server.')); set('server', a.server); p.server = a.server; for (let did in p.devices) { let addr = alloc_address(m, m.servers[a.server]); if (!addr) - fail(`No free address left on ${m.servers[a.server].name}.`); + fail(sprintf(_('No free address left on %s.'), m.servers[a.server].name)); m.devices[did].address = addr; c.set(CONFIG, did, 'address', addr); } @@ -652,29 +654,29 @@ export function create_device(c, m, person_id, name, kind, opts) { opts ??= {}; let p = m.people[person_id]; if (!p) - fail('Unknown person.'); + fail(_('Unknown person.')); let srv = m.servers[p.server]; if (!srv) - fail('The person has no server.'); + fail(_('The person has no server.')); name = trim(name ?? ''); if (!valid_name(name)) - fail('Enter a device name (up to 48 characters).'); + fail(_('Enter a device name (up to 48 characters).')); if (index(KINDS, kind) < 0) kind = 'other'; if (opts.by == 'portal' && length(p.devices) >= p.device_limit) - fail(`Device limit reached (${p.device_limit}).`); + fail(sprintf(_('Device limit reached (%d).'), p.device_limit)); for (let id in p.devices) if (lc(m.devices[id].name) == lc(name)) - fail(`"${name}" already exists.`); + fail(sprintf(_('"%s" already exists.'), name)); let addr = alloc_address(m, srv); if (!addr) - fail('No free addresses left in the server subnet.'); + fail(_('No free addresses left in the server subnet.')); let k = opts.keys ?? {}; if (!valid_key(k.public_key)) - fail('Key generation failed (is amneziawg-tools installed?).'); + fail(_('Key generation failed (is amneziawg-tools installed?).')); for (let o, d in m.devices) if (d.public_key == k.public_key) - fail('This key is already in use.'); + fail(_('This key is already in use.')); let id = `d_${rand_hex(4)}`; let dev = { id, person: person_id, name, kind, address: addr, public_key: k.public_key, private_key: k.private_key ?? '', @@ -699,13 +701,13 @@ export function create_device(c, m, person_id, name, kind, opts) { export function rename_device(c, m, id, name) { let d = m.devices[id]; if (!d) - fail('Unknown device.'); + fail(_('Unknown device.')); name = trim(name ?? ''); if (!valid_name(name)) - fail('Enter a device name (up to 48 characters).'); + fail(_('Enter a device name (up to 48 characters).')); for (let o in m.people[d.person]?.devices ?? []) if (o != id && lc(m.devices[o].name) == lc(name)) - fail(`"${name}" already exists.`); + fail(sprintf(_('"%s" already exists.'), name)); c.set(CONFIG, id, 'name', name); d.name = name; }; @@ -713,7 +715,7 @@ export function rename_device(c, m, id, name) { export function delete_device(c, m, id) { let d = m.devices[id]; if (!d) - fail('Unknown device.'); + fail(_('Unknown device.')); c.delete(CONFIG, id); let p = m.people[d.person]; if (p) @@ -725,9 +727,9 @@ export function delete_device(c, m, id) { export function rotate_device(c, m, id, keys) { let d = m.devices[id]; if (!d) - fail('Unknown device.'); + fail(_('Unknown device.')); if (!valid_key(keys?.public_key) || !keys?.private_key) - fail('Key generation failed.'); + fail(_('Key generation failed.')); c.set(CONFIG, id, 'private_key', keys.private_key); c.set(CONFIG, id, 'public_key', keys.public_key); if (keys.preshared_key) @@ -737,7 +739,7 @@ export function rotate_device(c, m, id, keys) { export function delete_person(c, m, id) { let p = m.people[id]; if (!p) - fail('Unknown person.'); + fail(_('Unknown person.')); for (let d in p.devices) c.delete(CONFIG, d); c.delete(CONFIG, id); @@ -757,20 +759,20 @@ export function private_cidr(c) { export function server_errors(m, srv, others_subnets) { let errs = []; if (!valid_ifname(srv.ifname)) - push(errs, 'Interface name: 1-12 lowercase letters, digits or _.'); + push(errs, _('Interface name: 1-12 lowercase letters, digits or _.')); if (srv.port < 1 || srv.port > 65535) - push(errs, 'Port must be 1-65535.'); + push(errs, _('Port must be 1-65535.')); let c = parse_cidr(srv.subnet); if (!c) - push(errs, 'Subnet must look like 10.77.0.0/24.'); + push(errs, _('Subnet must look like 10.77.0.0/24.')); else for (let o in others_subnets ?? []) { let oc = parse_cidr(o); if (oc && cidr_overlaps(c, oc)) - push(errs, `Subnet overlaps ${o}.`); + push(errs, sprintf(_('Subnet overlaps %s.'), o)); } if (srv.endpoint != '' && !valid_host(srv.endpoint)) - push(errs, 'Endpoint must be a hostname or IP address.'); + push(errs, _('Endpoint must be a hostname or IP address.')); return errs; }; @@ -788,52 +790,55 @@ export function model_errors(m) { let errs = []; let codes = {}, addrs = {}; for (let id, p in m.people) { - let who = `Person ${p.name}`; if (p.server != '' && !m.servers[p.server]) - push(errs, `${who}: server ${p.server} does not exist.`); + push(errs, sprintf(_('Person %s: server %s does not exist.'), p.name, p.server)); if (p.circle != '' && !m.circles[p.circle]) - push(errs, `${who}: circle ${p.circle} does not exist.`); + push(errs, sprintf(_('Person %s: circle %s does not exist.'), p.name, p.circle)); for (let sid in p.services) if (!m.services[sid]) - push(errs, `${who}: home service ${sid} does not exist.`); + push(errs, sprintf(_('Person %s: home service %s does not exist.'), p.name, sid)); if (p.code != '') { if (codes[p.code]) - push(errs, `${who}: has the same personal link as ${codes[p.code]}.`); + push(errs, sprintf(_('Person %s: has the same personal link as %s.'), p.name, codes[p.code])); codes[p.code] = p.name; } } for (let id, d in m.devices) { let p = m.people[d.person]; - let who = `Device ${d.name}${p ? ` of ${p.name}` : ''}`; if (!p) { - push(errs, `${who}: person ${d.person} does not exist.`); + push(errs, sprintf(_('Device %s: person %s does not exist.'), d.name, d.person)); continue; } + let say = (msg, ...args) => push(errs, sprintf(msg, d.name, p.name, ...args)); if (!valid_key(d.public_key)) - push(errs, `${who}: the public key is not a key.`); + say(_('Device %s of %s: the public key is not a key.')); if (d.private_key != '' && !valid_key(d.private_key)) - push(errs, `${who}: the private key is not a key.`); + say(_('Device %s of %s: the private key is not a key.')); if (d.preshared_key != '' && !valid_key(d.preshared_key)) - push(errs, `${who}: the preshared key is not a key.`); + say(_('Device %s of %s: the preshared key is not a key.')); let n = ip2int(d.address); if (n == null) { - push(errs, `${who}: address ${d.address || '(none)'} is not a plain IPv4 address.`); + if (d.address) + say(_('Device %s of %s: address %s is not a plain IPv4 address.'), d.address); + else + say(_('Device %s of %s: address (none) is not a plain IPv4 address.')); continue; } let srv = m.servers[p.server]; let t = srv ? parse_cidr(srv.subnet) : null; if (t && (n < t.first || n > t.last)) - push(errs, `${who}: address ${d.address} is outside ${srv.name}'s tunnel ${srv.subnet}.`); + say(_("Device %s of %s: address %s is outside %s's tunnel %s."), d.address, srv.name, srv.subnet); else if (t && n == t.first) - push(errs, `${who}: address ${d.address} is the router's own address on ${srv.name}.`); + say(_("Device %s of %s: address %s is the router's own address on %s."), d.address, srv.name); let key = `${p.server} ${d.address}`; - if (addrs[key]) - push(errs, `${who}: address ${d.address} is also used by ${addrs[key]}.`); - addrs[key] = who; + let o = addrs[key]; + if (o) + say(_('Device %s of %s: address %s is also used by device %s of %s.'), d.address, o.device, o.person); + addrs[key] = { device: d.name, person: p.name }; } for (let id, ci in m.circles) if (!m.servers[ci.server]) - push(errs, `Circle ${ci.name}: server ${ci.server} does not exist.`); + push(errs, sprintf(_('Circle %s: server %s does not exist.'), ci.name, ci.server)); return errs; }; @@ -854,7 +859,7 @@ export function renumber_server(c, m, srv, subnet) { for (let did in p.devices) { let addr = alloc_address(m, srv); if (!addr) - fail(`${subnet} has no room for every device on ${srv.name}.`); + fail(sprintf(_('%s has no room for every device on %s.'), subnet, srv.name)); m.devices[did].address = addr; c.set(CONFIG, did, 'address', addr); } diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc index 3f1bbc7..e226ec9 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc @@ -13,6 +13,7 @@ import * as awg from 'dawnline.awg'; import * as apply from 'dawnline.apply'; import * as live from 'dawnline.live'; import * as store from 'dawnline.store'; +import { _ } from 'dawnline.i18n'; /** AmneziaWG is on the router, so device keys can be made and loaded. */ export function ready() { @@ -23,7 +24,8 @@ export function ready() { export function need_awg() { if (!awg.installed()) { let miss = awg.state().missing ?? []; - die(`AmneziaWG is not installed${length(miss) ? ` (${join(', ', miss)})` : ''}: install it in Dawnline → Components.`); + die(length(miss) ? sprintf(_('AmneziaWG is not installed (%s): install it in Dawnline → Components.'), join(', ', miss)) + : _('AmneziaWG is not installed: install it in Dawnline → Components.')); } }; @@ -31,9 +33,9 @@ export function need_awg() { function own(m, id, opts) { let d = m.devices[id]; if (!d || (opts.person != null && d.person != opts.person)) - die(opts.person != null ? 'Device not found.' : 'Unknown device.'); + die(opts.person != null ? _('Device not found.') : _('Unknown device.')); if (opts.by == 'portal' && d.disabled) - die('The admin has turned this device off.'); + die(_('The admin has turned this device off.')); return d; } @@ -57,7 +59,7 @@ export function update(id, ch, opts) { opts ??= {}; let by = opts.by ?? 'admin'; if (ch.disabled != null && by != 'admin') - die('Only the admin can turn devices off.'); + die(_('Only the admin can turn devices off.')); let d0 = store.transact((c, m) => { let d = own(m, id, opts); let was = { ...d }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc index 33575d4..b797219 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/github.uc @@ -8,6 +8,7 @@ import { stat, popen, access } from 'fs'; import { q, read_json, write_json, ensure_dir, RUN_DIR } from 'dawnline.util'; +import { _ } from 'dawnline.i18n'; /** Prefixes that fetch github.com files when GitHub itself is unreachable. */ export const MIRRORS = [ 'https://ghfast.top/', 'https://gh-proxy.com/', 'https://ghproxy.net/' ]; @@ -54,11 +55,11 @@ function api_json(url) { return null; } if (r.status == 403 || r.status == 429 || (type(j) == 'object' && match(j.message ?? '', /rate limit/i))) - die('GitHub API rate limit reached: try again in an hour.'); + die(_('GitHub API rate limit reached: try again in an hour.')); if (r.status == 404) return null; if (r.status >= 400) - die(`GitHub: ${j?.message ?? `HTTP ${r.status}`}`); + die(sprintf(_('GitHub: %s'), j?.message ?? `HTTP ${r.status}`)); return j; } @@ -209,18 +210,18 @@ export function download(url, dest, o) { for (let i, u in tries) { let host = replace(u, /^https:\/\/([^\/]+)\/.*$/, '$1'); if (i > 0) - o.log?.(`Trying mirror ${host}`); + o.log?.(sprintf(_('Trying mirror %s'), host)); let r = have_curl() ? run(`curl -fsSL --connect-timeout 15 --max-time 300 --retry 1 -o ${q(dest)} ${q(u)}`) : run(`uclient-fetch -q -T 30 -O ${q(dest)} ${q(u)}`); if (r.code == 0 && (stat(dest)?.size ?? 0) > 0) { if (!want || sha256(dest) == want) return u; - o.log?.(`Warning: ${host} sent a file that does not match GitHub's sha256, discarded`); + o.log?.(sprintf(_("Warning: %s sent a file that does not match GitHub's sha256, discarded"), host)); } system(`rm -f ${q(dest)}`); if (i == 0 && length(tries) > 1) - o.log?.('GitHub did not answer, trying mirrors'); + o.log?.(_('GitHub did not answer, trying mirrors')); } return null; }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc index c53bf2d..b096994 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/health.uc @@ -1,8 +1,10 @@ // Dawnline — Health: what the router has and lacks (packages, listeners, // networks), the checks shown on Diagnostics → Health, and their fixes. +// The checks' texts are in the language of the call (dawnline.i18n). import { readfile, stat, lsdir } from 'fs'; import { cursor } from 'uci'; +import { _, N_ } from 'dawnline.i18n'; import { q, sh, sh_out, parse_cidr, cidr_overlaps, ip2int, in_cidr, file_exists, cloudflare_ip } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as live from 'dawnline.live'; @@ -174,43 +176,12 @@ export function foreign_subnets() { /* * Checks are named for the healthy state ("Clock is set"); a failed one also - * gets the problem in words for notices ("Clock isn't set"). Longest names - * first; a server's name after the check name is kept. + * gets the problem in words for notices ("Clock isn't set"), passed with it. + * A server's checks carry its name after both (` (Home)`, with several servers). */ -const PROBLEM = [ - [ 'AmneziaWG answers reach devices', 'AmneziaWG answers may not reach devices' ], - [ 'AmneziaWG devices loaded', 'Not every device is loaded into AmneziaWG' ], - [ 'AmneziaWG subnet is unique', 'AmneziaWG subnet overlaps another network' ], - [ 'AmneziaWG port is free', 'AmneziaWG port is taken' ], - [ 'AmneziaWG installed', 'AmneziaWG isn’t ready' ], - [ 'AmneziaWG firewall', 'AmneziaWG firewall rules are missing' ], - [ 'AmneziaWG running', 'AmneziaWG is down' ], - [ 'Portal answers reach visitors', 'Portal answers may not reach visitors' ], - [ 'Portal address points here', 'Portal address doesn’t point here' ], - [ 'Portal address', 'Portal address isn’t set' ], - [ 'Portal certificate', 'Portal certificate needs attention' ], - [ 'Personal portal', 'Personal portal isn’t working' ], - [ 'Plain HTTP links', 'Portal links use plain HTTP' ], - [ 'Internet like a home device', 'Internet like a home device isn’t working' ], - [ 'DNS for Home-only devices', 'DNS for Home-only devices isn’t working' ], - [ 'Background agent running', 'Background agent isn’t running' ], - [ 'Access rules loaded', 'Access rules aren’t loaded' ], - [ 'Server configured', 'No server yet' ], - [ 'Public address', 'Public address needs attention' ], - [ 'Clock is set', 'Clock isn’t set' ], -]; - -function problem_of(title) { - for (let p in PROBLEM) - if (substr(title, 0, length(p[0])) == p[0]) - return p[1] + substr(title, length(p[0])); - return title; -} - -/** problem: the failed check in words, when the table's wording does not fit the case. */ function check(id, title, status, detail, fix, problem) { let bad = status == 'warn' || status == 'error'; - return { id, title, status, detail: detail ?? '', fix: fix ?? null, problem: bad ? (problem ?? problem_of(title)) : null }; + return { id, title, status, detail: detail ?? '', fix: fix ?? null, problem: bad ? (problem ?? title) : null }; } /** @@ -222,13 +193,14 @@ function replies(m) { return { ok: fw.reply_ok(m, d), diverts: map(d, fw.divert_str) }; } -function reply_check(id, title, proto, port, r) { +function reply_check(id, title, problem, proto, port, r) { let via = join(', ', r.diverts); + let from = `${uc(proto)} ${port}`; return check(id, title, r.ok ? 'ok' : 'error', - !r.ok ? `Answers from ${uc(proto)} ${port} are swallowed by a proxy on the router (${via}): clients get no reply.` - : length(r.diverts) ? `Answers from ${uc(proto)} ${port} go straight out. A proxy on the router diverts its own traffic (${via}); these answers skip it.` - : `Answers from ${uc(proto)} ${port} go straight out.`, - r.ok ? null : 'apply'); + !r.ok ? sprintf(_('Answers from %s are swallowed by a proxy on the router (%s): clients get no reply.'), from, via) + : length(r.diverts) ? sprintf(_('Answers from %s go straight out. A proxy on the router diverts its own traffic (%s); these answers skip it.'), from, via) + : sprintf(_('Answers from %s go straight out.'), from), + r.ok ? null : 'apply', problem); } const PRIVATE = map([ '100.64.0.0/10', '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16' ], parse_cidr); @@ -260,29 +232,36 @@ export function endpoint_facts(srv, host) { }; }; -/** The facts in words: { status: ok|warn|error, text }. `proto_note` names what must get through ("UDP 4500"). */ +/** + * The facts in words, in the language of the call: { status: ok|warn|error, text } + * (text a whole sentence). `proto_note` names what must get through ("UDP 4500"). + */ export function endpoint_words(f, proto_note) { if (!f.host) - return { status: 'error', text: 'No public address: devices will not know where to connect.' }; + return { status: 'error', text: _('No public address: devices will not know where to connect.') }; if (!length(f.ips)) - return { status: 'error', text: `${f.host} does not resolve.` }; + return { status: 'error', text: sprintf(_('%s does not resolve.'), f.host) }; if (f.cloudflare) - return { status: 'error', text: `${f.host} → ${join(', ', f.ips)} (Cloudflare). ${proto_note} reaches the router only if this name is DNS-only there, or use the router's IP.` }; + return { status: 'error', text: sprintf(_("%s → %s (Cloudflare). %s reaches the router only if this name is DNS-only there, or use the router's IP."), + f.host, join(', ', f.ips), proto_note) }; if (f.v6_only) - return { status: f.kind == 'public' ? 'warn' : 'ok', text: `${f.host} → ${join(', ', f.ips6)}: IPv6 only, so only devices with IPv6 connect${f.kind == 'public' ? ` (the router's IPv4 ${f.wan} has no name)` : ''}.` }; + return { status: f.kind == 'public' ? 'warn' : 'ok', text: f.kind == 'public' + ? sprintf(_("%s → %s: IPv6 only, so only devices with IPv6 connect (the router's IPv4 %s has no name)."), f.host, join(', ', f.ips6), f.wan) + : sprintf(_('%s → %s: IPv6 only, so only devices with IPv6 connect.'), f.host, join(', ', f.ips6)) }; if (f.kind == 'cgnat' || f.kind == 'private') return { status: 'warn', text: f.kind == 'cgnat' - ? `The WAN address ${f.wan} is CGNAT (shared by the ISP): ${proto_note} cannot be forwarded to this router from outside unless the ISP gives a public address or IPv6.` - : `The WAN address ${f.wan} is private: this router is behind another one. Forward ${proto_note} on it, or devices cannot connect.` }; + ? sprintf(_('The WAN address %s is CGNAT (shared by the ISP): %s cannot be forwarded to this router from outside unless the ISP gives a public address or IPv6.'), f.wan, proto_note) + : sprintf(_('The WAN address %s is private: this router is behind another one. Forward %s on it, or devices cannot connect.'), f.wan, proto_note) }; if (f.wan && !f.here) - return { status: 'warn', text: `${f.host} points at ${join(', ', f.ips4)}, not this router (WAN ${f.wan}). Check your DNS / DDNS.` }; - return { status: 'ok', text: f.here ? `${f.host} points at this router (${f.wan}).` : `${f.host} → ${join(', ', f.ips)}` }; + return { status: 'warn', text: sprintf(_('%s points at %s, not this router (WAN %s). Check your DNS / DDNS.'), f.host, join(', ', f.ips4), f.wan) }; + // Without the router's WAN address only the facts: names and addresses, no words. + return { status: 'ok', text: f.here ? sprintf(_('%s points at this router (%s).'), f.host, f.wan) : `${f.host} → ${join(', ', f.ips)}` }; }; /** What a public address resolves to and whether that reaches this router (for a core's protocol). */ -function endpoint_check(id, title, srv, host, proto_note) { +function endpoint_check(id, title, problem, srv, host, proto_note) { let w = endpoint_words(endpoint_facts(srv, host), proto_note); - return check(id, title, w.status, w.text); + return check(id, title, w.status, w.text, null, problem); } /** @@ -306,7 +285,9 @@ function policy_routing() { return out; } -const NO_PROTO = "netifd doesn't know the amneziawg protocol (AmneziaWG missing, or the network wasn't restarted after installing it)."; +function no_proto() { + return _("netifd doesn't know the amneziawg protocol (AmneziaWG missing, or the network wasn't restarted after installing it)."); +} /** Free space on the overlay in KB (null when unknown). */ function overlay_free_kb() { @@ -318,27 +299,29 @@ function overlay_free_kb() { /** Is AmneziaWG there and usable: packages, kernel module, netifd's protocol handler. */ function awg_check() { let st = awg.load(); - let title = 'AmneziaWG installed'; - if (length(st.missing ?? [])) { + let title = _('AmneziaWG installed'); + let missing = st.missing ?? []; + if (length(missing)) { // The module was built for the kernel of the firmware it was installed on. let kc = builds.kernel_changed(); - if (kc && index(st.missing, 'kmod-amneziawg') >= 0) + if (kc && index(missing, 'kmod-amneziawg') >= 0) return check('awg', title, 'error', - `The firmware changed (kernel ${kc.was} → ${kc.now}): the AmneziaWG build installed for it is gone. Install the build for this firmware.`, - 'install:awg', 'AmneziaWG needs a build for the new firmware'); - return check('awg', title, 'error', `${join(' and ', st.missing)} ${length(st.missing) == 1 ? 'is' : 'are'} missing.`, 'install:awg', - 'AmneziaWG isn’t installed'); + sprintf(_('The firmware changed (kernel %s → %s): the AmneziaWG build installed for it is gone. Install the build for this firmware.'), kc.was, kc.now), + 'install:awg', _('AmneziaWG needs a build for the new firmware')); + return check('awg', title, 'error', sprintf(N_(length(missing), '%s is missing.', '%s are missing.'), join(', ', missing)), 'install:awg', + _('AmneziaWG isn’t installed')); } if (!st.loaded) { // load() tried it: the second modprobe only repeats why. let why = trim(sh('modprobe amneziawg 2>&1; dmesg | grep -i amneziawg | tail -n 3').out); return check('awg', title, 'error', - `The kernel module doesn't load${why ? `: ${why}` : '.'} Reinstall a build for this kernel in Components.`, 'updates', - 'AmneziaWG’s kernel module doesn’t load'); + why ? sprintf(_("The kernel module doesn't load: %s Reinstall a build for this kernel in Components."), why) + : _("The kernel module doesn't load. Reinstall a build for this kernel in Components."), + 'updates', _('AmneziaWG’s kernel module doesn’t load')); } if (!st.handler) - return check('awg', title, 'error', NO_PROTO, 'netrestart', 'The network doesn’t know AmneziaWG yet'); - return check('awg', title, 'ok', 'Kernel module, awg tool and the netifd protocol are present.'); + return check('awg', title, 'error', no_proto(), 'netrestart', _('The network doesn’t know AmneziaWG yet')); + return check('awg', title, 'ok', _('Kernel module, awg tool and the netifd protocol are present.')); } /** Checks of a server's AmneziaWG tunnel. */ @@ -347,13 +330,15 @@ function awg_checks(m, id, srv, label, fwc, dmp, rep) { let st = live.iface_status(srv.ifname); let up = !!st?.up; let codes = map(st?.errors ?? [], (e) => e.code); + let running = _('AmneziaWG running') + label, down = _('AmneziaWG is down') + label; if (!up && index(codes, 'INVALID_PROTO') >= 0) - push(out, check(`up_${id}`, `AmneziaWG running${label}`, 'error', NO_PROTO, 'netrestart')); + push(out, check(`up_${id}`, running, 'error', no_proto(), 'netrestart', down)); else - push(out, check(`up_${id}`, `AmneziaWG running${label}`, up ? 'ok' : 'error', - up ? `${srv.ifname} is up, listening on UDP ${srv.port}.` : - (st ? `${srv.ifname} is down${length(codes) ? ': ' + join(', ', codes) : ''}.` : `${srv.ifname} does not exist.`), - up ? null : (st ? 'ifup:' + srv.ifname : 'apply'))); + push(out, check(`up_${id}`, running, up ? 'ok' : 'error', + up ? sprintf(_('%s is up, listening on UDP %d.'), srv.ifname, srv.port) : + !st ? sprintf(_('%s does not exist.'), srv.ifname) : + length(codes) ? sprintf(_('%s is down: %s.'), srv.ifname, join(', ', codes)) : sprintf(_('%s is down.'), srv.ifname), + up ? null : (st ? 'ifup:' + srv.ifname : 'apply'), down)); if (up) { // By key, not by count: a stale peer standing in for a missing one would // make the numbers match. @@ -375,17 +360,20 @@ function awg_checks(m, id, srv, label, fwc, dmp, rep) { let missing = length(filter(keys(wanted), (k) => !loaded[k])); let extra = length(filter(keys(loaded), (k) => !wanted[k])); let same = !missing && !extra; - push(out, check(`peers_${id}`, `AmneziaWG devices loaded${label}`, same ? 'ok' : 'warn', - same ? `${actual} device${actual == 1 ? ' is' : 's are'} loaded in the tunnel.` : - `${missing} of ${expected} device${expected == 1 ? '' : 's'} missing${extra ? `, ${extra} loaded that should not be` : ''}.`, - same ? null : 'sync')); + push(out, check(`peers_${id}`, _('AmneziaWG devices loaded') + label, same ? 'ok' : 'warn', + same ? sprintf(N_(actual, '%d device is loaded in the tunnel.', '%d devices are loaded in the tunnel.'), actual) : + extra ? sprintf(N_(expected, '%d of %d device missing, %d loaded that should not be.', '%d of %d devices missing, %d loaded that should not be.'), + missing, expected, extra) + : sprintf(N_(expected, '%d of %d device missing.', '%d of %d devices missing.'), missing, expected), + same ? null : 'sync', _('Not every device is loaded into AmneziaWG') + label)); } let rule = fwc.get('firewall', `dawnline_${id}_port`) == 'rule'; let zone = fwc.get('firewall', `dawnline_${id}_zone`) == 'zone'; - push(out, check(`fw_${id}`, `AmneziaWG firewall${label}`, rule && zone ? 'ok' : 'error', - rule && zone ? `Zone ${srv.ifname} and the WAN rule for UDP ${srv.port} exist.` : 'Firewall zone or WAN rule is missing.', - rule && zone ? null : 'apply')); - push(out, reply_check(`reply_${id}`, `AmneziaWG answers reach devices${label}`, 'udp', srv.port, rep)); + push(out, check(`fw_${id}`, _('AmneziaWG firewall') + label, rule && zone ? 'ok' : 'error', + rule && zone ? sprintf(_('Zone %s and the WAN rule for UDP %d exist.'), srv.ifname, srv.port) : _('Firewall zone or WAN rule is missing.'), + rule && zone ? null : 'apply', _('AmneziaWG firewall rules are missing') + label)); + push(out, reply_check(`reply_${id}`, _('AmneziaWG answers reach devices') + label, _('AmneziaWG answers may not reach devices') + label, + 'udp', srv.port, rep)); // Port collisions with other tunnels. let clash = []; let nc = cursor(); @@ -395,7 +383,8 @@ function awg_checks(m, id, srv, label, fwc, dmp, rep) { push(clash, s['.name']); }); if (length(clash)) - push(out, check(`port_${id}`, `AmneziaWG port is free${label}`, 'error', `UDP ${srv.port} is also used by ${join(', ', clash)}.`)); + push(out, check(`port_${id}`, _('AmneziaWG port is free') + label, 'error', sprintf(_('UDP %d is also used by %s.'), srv.port, join(', ', clash)), + null, _('AmneziaWG port is taken') + label)); let overlaps = []; let sc = parse_cidr(srv.subnet); for (let o in other_subnets(id)) { @@ -403,8 +392,9 @@ function awg_checks(m, id, srv, label, fwc, dmp, rep) { if (sc && oc && cidr_overlaps(sc, oc)) push(overlaps, `${o.iface} (${o.cidr})`); } - push(out, check(`subnet_${id}`, `AmneziaWG subnet is unique${label}`, length(overlaps) ? 'error' : 'ok', - length(overlaps) ? `${srv.subnet} overlaps ${join(', ', overlaps)}.` : `${srv.subnet} does not overlap other networks.`)); + push(out, check(`subnet_${id}`, _('AmneziaWG subnet is unique') + label, length(overlaps) ? 'error' : 'ok', + length(overlaps) ? sprintf(_('%s overlaps %s.'), srv.subnet, join(', ', overlaps)) : sprintf(_('%s does not overlap other networks.'), srv.subnet), + null, _('AmneziaWG subnet overlaps another network') + label)); return out; } @@ -412,50 +402,59 @@ function awg_checks(m, id, srv, label, fwc, dmp, rep) { function portal_checks(m, need, rep) { let out = []; let s = m.settings; + let portal = _('Personal portal'), portal_bad = _('Personal portal isn’t working'); if (length(need.https)) - return [ check('portal', 'Personal portal', 'error', `HTTPS isn't available on this router: install ${join(' and ', need.https)}.`, 'install:https') ]; + return [ check('portal', portal, 'error', sprintf(_("HTTPS isn't available on this router: install %s."), join(', ', need.https)), 'install:https', portal_bad) ]; let owners = tcp_port_owners(s.portal_port); let listening = tcp_listening(s.portal_port); if (length(owners)) - push(out, check('portal', 'Personal portal', 'error', - `TCP ${s.portal_port} is already used by ${join(', ', owners)}. Choose another port in Settings.`)); + push(out, check('portal', portal, 'error', + sprintf(_('TCP %d is already used by %s. Choose another port in Settings.'), s.portal_port, join(', ', owners)), null, portal_bad)); else - push(out, check('portal', 'Personal portal', listening ? 'ok' : 'error', - listening ? `Listening on TCP ${s.portal_port}.` : `Nothing listens on TCP ${s.portal_port}.`, listening ? null : 'restart')); + push(out, check('portal', portal, listening ? 'ok' : 'error', + listening ? sprintf(_('Listening on TCP %d.'), s.portal_port) : sprintf(_('Nothing listens on TCP %d.'), s.portal_port), + listening ? null : 'restart', portal_bad)); if (!s.portal_host) - push(out, check('portal_host', 'Portal address', 'error', 'Set the public hostname in Settings so links can be generated.')); + push(out, check('portal_host', _('Portal address'), 'error', _('Set the public hostname in Settings so links can be generated.'), + null, _('Portal address isn’t set'))); else { let ips = lookup.resolve(s.portal_host), wan = lookup.router_wan(m); let cf = filter(ips, (x) => cloudflare_ip(x)); - push(out, check('portal_dns', 'Portal address points here', !length(ips) ? 'error' : length(cf) ? 'ok' : wan && index(ips, wan) < 0 ? 'warn' : 'ok', - !length(ips) ? `${s.portal_host} does not resolve.` : - length(cf) ? `${s.portal_host} goes through Cloudflare; in Russia such connections often stall after ~16 KB.` : - wan && index(ips, wan) < 0 ? `${s.portal_host} points at ${join(', ', ips)}, not this router (${wan}).` : - `${s.portal_host} → ${join(', ', ips)}${wan ? ' (this router)' : ''}.`)); + let h = s.portal_host; + push(out, check('portal_dns', _('Portal address points here'), !length(ips) ? 'error' : length(cf) ? 'ok' : wan && index(ips, wan) < 0 ? 'warn' : 'ok', + !length(ips) ? sprintf(_('%s does not resolve.'), h) : + length(cf) ? sprintf(_('%s goes through Cloudflare; in Russia such connections often stall after ~16 KB.'), h) : + wan && index(ips, wan) < 0 ? sprintf(_('%s points at %s, not this router (%s).'), h, join(', ', ips), wan) : + wan ? sprintf(_('%s → %s (this router).'), h, join(', ', ips)) : `${h} → ${join(', ', ips)}.`, + null, _('Portal address doesn’t point here'))); } - push(out, reply_check('portal_reply', 'Portal answers reach visitors', 'tcp', s.portal_port, rep)); + push(out, reply_check('portal_reply', _('Portal answers reach visitors'), _('Portal answers may not reach visitors'), 'tcp', s.portal_port, rep)); if (core.portal_http(m)) { let ipl = filter(core.portal_hosts(m), (h) => ip2int(h) != null); - push(out, check('portal_http', 'Plain HTTP links', 'warn', - `Links on ${join(', ', ipl)} use plain HTTP: the link and the VPN keys in configurations travel unencrypted.`)); + push(out, check('portal_http', _('Plain HTTP links'), 'warn', + sprintf(_('Links on %s use plain HTTP: the link and the VPN keys in configurations travel unencrypted.'), join(', ', ipl)), + null, _('Portal links use plain HTTP'))); } if (ip2int(s.portal_host) != null) { - push(out, check('cert', 'Portal certificate', 'skip', 'The main address is an IP: its links use plain HTTP.')); + push(out, check('cert', _('Portal certificate'), 'skip', _('The main address is an IP: its links use plain HTTP.'))); return out; } let cert = pc.portal_cert(s); let ok = system(`openssl x509 -checkend 1209600 -noout -in ${q(cert.cert)} >/dev/null 2>&1`) == 0; let sans = cert.self_signed ? [] : pc.cert_names(cert.cert); let covers = !s.portal_host || cert.self_signed || length(filter(sans, (n) => pc.name_covers(n, s.portal_host))) > 0; - push(out, check('cert', 'Portal certificate', cert.self_signed || !ok || !covers ? 'warn' : 'ok', - cert.self_signed ? `Using a self-signed certificate: browsers will show a warning.${length(need.acme) ? ' ACME can get a free Let’s Encrypt one.' : ''}` : - !covers ? `${cert.cert} does not cover ${s.portal_host} (it has ${join(', ', sans)}): browsers will warn.` : - ok ? `${cert.cert} covers ${s.portal_host} and is valid for more than 14 days.` : `${cert.cert} expires within 14 days.`)); + push(out, check('cert', _('Portal certificate'), cert.self_signed || !ok || !covers ? 'warn' : 'ok', + cert.self_signed ? (length(need.acme) ? _('Using a self-signed certificate: browsers will show a warning. ACME can get a free Let’s Encrypt one.') + : _('Using a self-signed certificate: browsers will show a warning.')) : + !covers ? sprintf(_('%s does not cover %s (it has %s): browsers will warn.'), cert.cert, s.portal_host, join(', ', sans)) : + ok ? sprintf(_('%s covers %s and is valid for more than 14 days.'), cert.cert, s.portal_host) : sprintf(_('%s expires within 14 days.'), cert.cert), + null, _('Portal certificate needs attention'))); return out; } /** - * Run all checks. Each result: { id, title, status: ok|warn|error|skip, detail, fix }. + * Run all checks. Each result: { id, title, status: ok|warn|error|skip, detail, fix, + * problem (a failed check in words, else null) }, the texts in the language of the call. * `fix` names an action accepted by fix(), or one the UI handles itself * (install:, updates). */ @@ -469,46 +468,50 @@ export function health(m) { if (length(m.servers)) push(out, awg_check()); let y = localtime().year; - push(out, check('clock', 'Clock is set', y >= 2025 ? 'ok' : 'error', - y >= 2025 ? 'End dates and quotas use the router clock.' : 'The router clock looks wrong; end dates will misbehave. Check NTP.')); + push(out, check('clock', _('Clock is set'), y >= 2025 ? 'ok' : 'error', + y >= 2025 ? _('End dates and quotas use the router clock.') : _('The router clock looks wrong; end dates will misbehave. Check NTP.'), + null, _('Clock isn’t set'))); let agent = service_running('dawnline', 'agent'); - push(out, check('agent', 'Background agent running', agent ? 'ok' : 'error', - 'Counts traffic and enforces end dates and quotas.', agent ? null : 'restart')); + push(out, check('agent', _('Background agent running'), agent ? 'ok' : 'error', + _('Counts traffic and enforces end dates and quotas.'), agent ? null : 'restart', _('Background agent isn’t running'))); // A full overlay fails every config write on the router, Dawnline's and // OpenWrt's own; backups and history are what Dawnline adds to it. let free = overlay_free_kb(); if (free != null) - push(out, check('flash', 'Free space on the router', free < 512 ? 'error' : free < 2048 ? 'warn' : 'ok', - free < 2048 ? `${int(free / 1024 * 10) / 10} MB free: settings may stop saving. Remove old backups (Settings → Backups) or shorten the history.` - : `${int(free / 1024)} MB free on the overlay.`, - null, 'The router is running out of flash')); + push(out, check('flash', _('Free space on the router'), free < 512 ? 'error' : free < 2048 ? 'warn' : 'ok', + free < 2048 ? sprintf(_('%s MB free: settings may stop saving. Remove old backups (Settings → Backups) or shorten the history.'), int(free / 1024 * 10) / 10) + : sprintf(_('%d MB free on the overlay.'), int(free / 1024)), + null, _('The router is running out of flash'))); if (!length(m.servers)) { - push(out, check('server', 'Server configured', 'warn', 'Run the setup wizard on the Server tab.')); + push(out, check('server', _('Server configured'), 'warn', _('Run the setup wizard on the Server tab.'), null, _('No server yet'))); return out; } let nft_ok = system('nft list table inet dawnline >/dev/null 2>&1') == 0; - push(out, check('nft', 'Access rules loaded', nft_ok ? 'ok' : 'error', - nft_ok ? 'Table inet dawnline enforces who may reach LAN and the internet.' - : 'Table inet dawnline is missing: no device is loaded into the tunnels until it is back.', - nft_ok ? null : 'apply')); + push(out, check('nft', _('Access rules loaded'), nft_ok ? 'ok' : 'error', + nft_ok ? _('Table inet dawnline enforces who may reach LAN and the internet.') + : _('Table inet dawnline is missing: no device is loaded into the tunnels until it is back.'), + nft_ok ? null : 'apply', _('Access rules aren’t loaded'))); if (length(filter(values(m.servers), (s) => s.lan_like && s.enabled))) { let pr = policy_routing(); - push(out, check('policy', 'Internet like a home device not bypassed', length(pr) ? 'warn' : 'ok', - length(pr) ? `Policy routing on the router (${join('; ', pr)}) sends marked traffic straight out, past the home-device path: tunnel traffic it matches skips your LAN's proxies and filters.` - : 'No other policy routing ahead of the tunnel rules.', - null, 'Other policy routing bypasses the home-device path')); + push(out, check('policy', _('Internet like a home device not bypassed'), length(pr) ? 'warn' : 'ok', + length(pr) ? sprintf(_("Policy routing on the router (%s) sends marked traffic straight out, past the home-device path: tunnel traffic it matches skips your LAN's proxies and filters."), join('; ', pr)) + : _('No other policy routing ahead of the tunnel rules.'), + null, _('Other policy routing bypasses the home-device path'))); } // A device the sync has to leave out (a merged import, a hand-edited config). + // Its sentences (core.model_errors), how many more, then what it means. let data = core.model_errors(m); - push(out, check('data', 'People and devices consistent', length(data) ? 'error' : 'ok', - length(data) ? `${join(' ', slice(data, 0, 4))}${length(data) > 4 ? ` (${length(data) - 4} more)` : ''} Such devices are left out of the tunnels: fix or remove them.` - : 'Every device has a key and an address of its own inside its server.')); + push(out, check('data', _('People and devices consistent'), length(data) ? 'error' : 'ok', + length(data) ? join(' ', filter([ join(' ', slice(data, 0, 4)), length(data) > 4 ? sprintf(_('(%d more)'), length(data) - 4) : null, + _('Such devices are left out of the tunnels: fix or remove them.') ], (x) => x)) + : _('Every device has a key and an address of its own inside its server.'), + null, _('People and devices are inconsistent'))); let fwc = cursor(); fwc.load('firewall'); @@ -516,21 +519,23 @@ export function health(m) { for (let id, srv in m.servers) { let label = length(m.servers) > 1 ? ` (${srv.name})` : ''; if (!srv.enabled) { - push(out, check(`srv_${id}`, `Server${label}`, 'skip', 'Server is disabled.')); + push(out, check(`srv_${id}`, _('Server') + label, 'skip', _('Server is disabled.'))); continue; } push(out, ...awg_checks(m, id, srv, label, fwc, dmp, rep)); - push(out, endpoint_check(`ep_${id}`, `Public address${label}`, srv, core.endpoint_host(m, srv), `UDP ${srv.port}`)); + push(out, endpoint_check(`ep_${id}`, _('Public address') + label, _('Public address needs attention') + label, + srv, core.endpoint_host(m, srv), `UDP ${srv.port}`)); if (srv.lan_like) { let ls = loop.status(); let nh = need.home; - push(out, check(`home_${id}`, `Internet like a home device${label}`, ls.active && ls.bridged ? 'ok' : 'warn', - ls.active && ls.bridged ? `Traffic enters ${ls.dev} as ${ls.address}, so it is handled like any device on your LAN.` : - length(nh) ? `Needs ${join(' and ', nh)}. Internet traffic leaves through WAN directly until then.` : - ls.active ? `The link is up but not attached to ${ls.dev}.` : - `${ls.error ?? 'Not set up.'} Internet traffic leaves through WAN directly.`, - ls.active && ls.bridged ? null : length(nh) ? 'install:home' : 'apply')); + push(out, check(`home_${id}`, _('Internet like a home device') + label, ls.active && ls.bridged ? 'ok' : 'warn', + ls.active && ls.bridged ? sprintf(_('Traffic enters %s as %s, so it is handled like any device on your LAN.'), ls.dev, ls.address) : + length(nh) ? sprintf(_('Needs %s. Internet traffic leaves through WAN directly until then.'), join(', ', nh)) : + ls.active ? sprintf(_('The link is up but not attached to %s.'), ls.dev) : + // loop.status()'s own sentence, then what it means. + `${ls.error ?? _('Not set up.')} ${_('Internet traffic leaves through WAN directly.')}`, + ls.active && ls.bridged ? null : length(nh) ? 'install:home' : 'apply', _('Internet like a home device isn’t working') + label)); } } @@ -542,10 +547,11 @@ export function health(m) { // A new config (a server turned on, the home link up) restarts it: give it a few seconds. let restarting = !running && conf != null && time() - conf.mtime < 10; let ok = running || restarting; - push(out, check('resolver', 'DNS for Home-only devices', ok ? 'ok' : 'warn', - restarting ? 'Restarting with the new settings.' : - ok ? (rt.mode == 'ns' ? `Plain resolver running next to the LAN (${rt.address}).` : `Plain resolver on port ${rt.port}.`) - : 'The resolver is not running; Home-only devices cannot resolve names.', ok ? null : 'apply')); + push(out, check('resolver', _('DNS for Home-only devices'), ok ? 'ok' : 'warn', + restarting ? _('Restarting with the new settings.') : + ok ? (rt.mode == 'ns' ? sprintf(_('Plain resolver running next to the LAN (%s).'), rt.address) : sprintf(_('Plain resolver on port %d.'), rt.port)) + : _('The resolver is not running; Home-only devices cannot resolve names.'), + ok ? null : 'apply', _('DNS for Home-only devices isn’t working'))); } if (m.settings.portal_enabled) @@ -572,9 +578,9 @@ export function fix(id) { // Only Dawnline's own tunnels: never another interface of the router. let mine = filter(values(core.load().servers), (s) => s.ifname == m[1] && s.private_key); if (!length(mine)) - die(`${m[1]} is not one of Dawnline's tunnels.`); + die(sprintf(_("%s is not one of Dawnline's tunnels."), m[1])); system(`ifup ${q(m[1])}`); return { ok: true }; } - die('Unknown fix.'); + die(_('Unknown fix.')); }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/i18n.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/i18n.uc new file mode 100644 index 0000000..e40803d --- /dev/null +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/i18n.uc @@ -0,0 +1,71 @@ +// Dawnline — the backend's messages in the admin's language: what die() +// reports, the health checks, the updater's phases. Text is English in the +// code, wrapped in _() and N_() (web/i18n/extract.ts collects them into the +// luci-i18n-dawnline- catalog with the admin UI's strings), with +// placeholders filled by sprintf() after the lookup: +// +// die(sprintf(_('Download failed: %s'), asset)); +// +// Translated through LuCI's own catalog reader (luci.core, as LuCI's pages +// are) in the language use() set: the admin page's, sent with every RPC call +// (rpcd/ucode/luci.dawnline) and handed to the updater. With no language, +// no Dawnline translation installed for it, or no luci-base (the unit tests' +// rootfs), the English as written. The portal sets none: its page translates +// the messages it gets with its own catalog. + +import { stat } from 'fs'; + +const DIR = '/usr/lib/lua/luci/i18n'; + +// A C module, loaded at run time: luci-base may be missing, and a static import would not compile then. +let lmo = null; +try { + lmo = require('luci.core'); +} +catch (e) { + lmo = null; +} + +let active = null; + +/** + * Speak `lang` from now on ("ru"; null or "en" for English). Only a language + * with a Dawnline catalog: LuCI's others alone would translate a few words. + */ +export function use(lang) { + active = null; + if (!lmo || type(lang) != 'string' || lang == 'en' || !match(lang, /^[a-z][a-z][a-z]?([_-][A-Za-z][A-Za-z][A-Za-z]?[A-Za-z]?)?$/)) + return; + lang = lc(replace(lang, '_', '-')); + if (!stat(`${DIR}/dawnline.${lang}.lmo`)) + return; + if (lmo.load_catalog(lang, DIR) && lmo.change_catalog(lang)) + active = lang; +}; + +/** The language use() set, when its catalog is in use; null for English. */ +export function current() { + return active; +}; + +/** `msg` in the language use() set (the English when the catalog has no translation). */ +export function _(msg) { + return (active ? lmo.translate(msg) : null) ?? msg; +}; + +/** `one` or `many` for n, by the language's plural rules (Russian has three forms). */ +export function N_(n, one, many) { + return (active ? lmo.ntranslate(n, one, many) : null) ?? (n == 1 ? one : many); +}; + +/** + * A service log line's words, as written: the log is kept in English (the + * agent that writes most of it has no language) and read later in any. + * Marking them collects them into the catalog and into the admin page's list + * of log templates, which puts each line into the reader's language when it + * is shown (web/src/admin/events/logwords.ts): sprintf(L_('updated · %s → %s'), a, b). + * Keep a line's English as it was: old lines match it too. + */ +export function L_(s) { + return s; +}; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc index 8dcc6dd..bb37427 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/loop.uc @@ -22,7 +22,8 @@ // // Everything is derived from the router at run time; nothing assumes a // particular subnet or tool. If the LAN is not a bridge or setup fails, the -// direct path stays and status() says why. +// direct path stays and status() says why (kept as a code in loop.json, which +// apply and the agent write with no language; error_text() makes the words). import { readfile, writefile, readlink, stat, unlink } from 'fs'; import { cursor } from 'uci'; @@ -33,6 +34,7 @@ import * as net from 'dawnline.net'; import * as core from 'dawnline.core'; import * as store from 'dawnline.store'; import * as resolver from 'dawnline.resolver'; +import { _, L_ } from 'dawnline.i18n'; export const NS = 'dawnline'; const TX_ROOT = net.INTERNAL.transit, TX_NS = 'dlx1', LAN_ROOT = net.INTERNAL.lan, LAN_NS = 'dll1'; @@ -40,7 +42,7 @@ const PREF_LOOP_DNS = 5205, PREF_MAIN = 5210, PREF_LOOP = 5290; export const RESOLVER_CONF = resolver.CONF; const STATE = `${RUN_DIR}/loop.json`; -const WHO = 'Internet like a home device'; +const WHO = L_('Internet like a home device'); function log(msg, level, detail) { slog('dawnline', level ?? 'info', msg, detail, WHO); @@ -180,6 +182,57 @@ function pick_table(saved) { return null; } +/* ---------- why it is off ---------- */ + +/* + * The reasons plan() and ensure() give, kept in loop.json: + * { code: 'no_lan' } no LAN detected + * { code: 'not_bridge', dev } the LAN is not a bridge + * { code: 'no_ipv4', dev } the LAN has no IPv4 address + * { code: 'no_address', net } no free address on the LAN's network + * { code: 'no_transit' } no free link-local range for the internal link + * { code: 'no_table' } no free routing table + * { code: 'setup', detail } a command failed (detail: it and what it said) + */ + +/** A reason from plan() for the service log: English, like every log line. */ +function error_note(e) { + if (e.code == 'no_lan') + return L_('No LAN detected.'); + if (e.code == 'not_bridge') + return sprintf(L_('%s is not a bridge, so Dawnline cannot join the LAN as a device.'), e.dev); + if (e.code == 'no_ipv4') + return sprintf(L_('%s has no IPv4 address.'), e.dev); + if (e.code == 'no_address') + return sprintf(L_('No free address on %s.'), e.net); + if (e.code == 'no_transit') + return L_('No free link-local range for the internal link.'); + return L_('No free routing table.'); +} + +/** + * Why "like a home device" is off (a reason above), as a sentence in the + * reader's language. Null for none; the English of a loop.json written by an + * older version as it is. + */ +export function error_text(e) { + if (type(e) != 'object') + return e ?? null; + if (e.code == 'no_lan') + return _('No LAN detected.'); + if (e.code == 'not_bridge') + return sprintf(_('%s is not a bridge, so Dawnline cannot join the LAN as a device.'), e.dev); + if (e.code == 'no_ipv4') + return sprintf(_('%s has no IPv4 address.'), e.dev); + if (e.code == 'no_address') + return sprintf(_('No free address on %s.'), e.net); + if (e.code == 'no_transit') + return _('No free link-local range for the internal link.'); + if (e.code == 'no_table') + return _('No free routing table.'); + return sprintf(_('Setup failed: %s'), e.detail); +}; + /* ---------- plan ---------- */ function settings() { @@ -199,8 +252,8 @@ function all_ifnames(m) { } /** - * What should exist, or { error } when it cannot. Pure apart from reading - * router state (and one ping per candidate address). + * What should exist, or { error } (a reason, see error_text) when it cannot. + * Pure apart from reading router state (and one ping per candidate address). */ export function plan(m) { let srvs = wanted(m); @@ -210,24 +263,24 @@ export function plan(m) { let dev = snap.lan; let d = snap.devices[dev]; if (!dev || !d) - return { error: 'No LAN detected.' }; + return { error: { code: 'no_lan' } }; if (d.kind != 'bridge') - return { error: `${dev} is not a bridge, so Dawnline cannot join the LAN as a device.` }; + return { error: { code: 'not_bridge', dev } }; let lan = parse_cidr(d.addrs[0]); if (!lan) - return { error: `${dev} has no IPv4 address.` }; + return { error: { code: 'no_ipv4', dev } }; let facts = dhcp_facts(d.logical, lan); let st = settings(); let addr = pick_address(lan, facts, st.lan_address, dev); if (!addr) - return { error: `No free address on ${int2ip(lan.net)}/${lan.prefix}.` }; + return { error: { code: 'no_address', net: `${int2ip(lan.net)}/${lan.prefix}` } }; let last = read_json(STATE, {}); let tx = pick_transit(last?.transit); if (tx == null) - return { error: 'No free link-local range for the internal link.' }; + return { error: { code: 'no_transit' } }; let table = pick_table(last?.plan?.table); if (table == null) - return { error: 'No free routing table.' }; + return { error: { code: 'no_table' } }; let servers = []; for (let srv in srvs) { let sn = net.server_net(srv, snap); @@ -362,8 +415,8 @@ export function ensure(m, force) { remove(ifnames); ensure_dir(RUN_DIR); write_json(STATE, { error: p.error, off: !!p.off }, 0o644); - if (p.error && p.error != was.error) - log('is off', 'error', p.error); + if (p.error && sprintf('%J', p.error) != sprintf('%J', was.error)) + log(L_('is off'), 'error', error_note(p.error)); return p; } let last = read_json(STATE, {}); @@ -411,18 +464,19 @@ export function ensure(m, force) { push(errs, ...run(sync_rules(p, ifnames))); if (length(errs)) { - if (read_json(STATE, {}).error != `Setup failed: ${errs[0]}`) - log('failed — internet goes out directly for now', 'error', errs[0]); + let why = { code: 'setup', detail: errs[0] }; + if (sprintf('%J', read_json(STATE, {}).error) != sprintf('%J', why)) + log(L_('failed - internet goes out directly for now'), 'error', errs[0]); remove(ifnames); - write_json(STATE, { error: `Setup failed: ${errs[0]}` }, 0o644); - return { error: errs[0] }; + write_json(STATE, { error: why }, 0o644); + return { error: why }; } ensure_dir(RUN_DIR); write_json(STATE, { applied: time(), plan: p, transit: p.transit }, 0o644); if (!last.applied || last.plan?.dev != p.dev || last.plan?.address != p.address) - log(`is on · traffic enters ${p.dev} as ${p.address}`, 'up'); + log(sprintf(L_('is on · traffic enters %s as %s'), p.dev, p.address), 'up'); else if (!healthy) - log(`was broken — set up again (${p.dev} as ${p.address})`, 'repair'); + log(sprintf(L_('was broken - set up again (%s as %s)'), p.dev, p.address), 'repair'); return p; }; @@ -440,7 +494,7 @@ export function remember(p) { }); }; -/** Last applied state for views and health checks. */ +/** Last applied state for views and health checks; `error` says why it is off (error_text). */ export function status() { let s = read_json(STATE, {}); if (s.plan) @@ -449,7 +503,7 @@ export function status() { dev: s.plan.dev, address: s.plan.address, dns: s.plan.dns, gateway: s.plan.gateway, transit: s.plan.tx_ns, bridged: replace(readlink(`/sys/class/net/${LAN_ROOT}/master`) ?? '', /^.*\//, '') == s.plan.dev, }; - return { active: false, off: !!s.off, error: s.error }; + return { active: false, off: !!s.off, error: error_text(s.error) }; }; /** The DNS address tunnel clients should use while the loop is up. */ diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc index d5016ac..77b73f9 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/migrate.uc @@ -8,6 +8,7 @@ import { stat, unlink } from 'fs'; import { q, slog } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as store from 'dawnline.store'; +import { L_ } from 'dawnline.i18n'; const LAN_CGI = '/www/cgi-bin/dawnline-portal'; const LAN_CGI_URL = '/cgi-bin/dawnline-portal'; @@ -32,7 +33,7 @@ function word_codes() { } }); }); - slog('dawnline', 'info', 'moved to word codes', null, 'Personal links'); + slog('dawnline', 'info', L_('moved to word codes'), null, L_('Personal links')); } /* @@ -101,7 +102,7 @@ function auto_mtu() { mark_migrated(w, 'auto_mtu'); }); if (any) - slog('dawnline', 'info', 'MTU is now automatic', null, 'Servers'); + slog('dawnline', 'info', L_('MTU is now automatic'), null, L_('Servers')); } /** All of them, in order. */ diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc index 6e616f5..fa056ee 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/netifd.uc @@ -2,13 +2,15 @@ // ifname and marked `_dawnline` = server id. Only interfaces Dawnline created // are changed or removed: a name already used by another interface (`lan`, a // tunnel of your own, one from an imported config) is left alone and the -// server is reported instead. +// server is reported instead. Why a server is kept down is kept in +// core.BLOCKED as a code with its values (awg.blocked_text says it). import { cursor } from 'uci'; import { stat, unlink, writefile } from 'fs'; import { q, uci_put, uci_section, ack_config, iface_intent, ensure_dir, read_json, write_json, slog, RUN_DIR } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as awg from 'dawnline.awg'; +import { L_ } from 'dawnline.i18n'; // Set while AmneziaWG is missing and that was logged (once until it is back). const NO_AWG = `${RUN_DIR}/netifd-no-awg`; @@ -35,12 +37,12 @@ export function sync(m) { let changed = false, touched = [], want = {}; // Servers whose interface can't be set up (core.BLOCKED), each logged once while it lasts. let was = read_json(core.BLOCKED, {}), blocked = {}; - let block = (srv, msg, detail) => { - blocked[srv.id] = msg; + let block = (srv, why, detail) => { + blocked[srv.id] = why; // The rest of this apply works from the same model: no tunnel for it there either. - srv.blocked = msg; - if (was[srv.id] != msg) - log(srv.name, msg, 'error', detail); + srv.blocked = why; + if (sprintf('%J', was[srv.id]) != sprintf('%J', why)) + log(srv.name, awg.blocked_note(why), 'error', detail); }; // Without amneziawg-tools there is no protocol script: changing or bringing @@ -49,7 +51,7 @@ export function sync(m) { if (tools && stat(NO_AWG)) unlink(NO_AWG); else if (!tools && length(filter(values(m.servers), (s) => s.private_key)) && !stat(NO_AWG)) { - log('AmneziaWG', "isn't installed: tunnels were left as they are", 'error', 'Install it in Dawnline → Components.'); + log('AmneziaWG', L_("isn't installed: tunnels were left as they are"), 'error', L_('Install it in Dawnline → Components.')); ensure_dir(RUN_DIR); writefile(NO_AWG, `${time()}`); } @@ -59,12 +61,12 @@ export function sync(m) { continue; let ifn = srv.ifname; if (!core.valid_ifname(ifn)) { - block(srv, `has an invalid interface name "${ifn}"`, 'Interface name: 1-12 lowercase letters, digits or _.'); + block(srv, { code: 'ifname', ifname: ifn }, 'Interface name: 1-12 lowercase letters, digits or _.'); continue; } let own = owner(ifn, c); if (own != null && own != id) { - block(srv, `can't use the network interface ${ifn}: it exists and isn't Dawnline's`, + block(srv, { code: 'taken', ifname: ifn }, 'Dawnline never changes interfaces it did not create. Choose another interface name for this server.'); continue; } @@ -74,7 +76,7 @@ export function sync(m) { // disguise is changed. let why = tools ? awg.obf_unsupported(srv.obf) : null; if (why) { - block(srv, `is kept down: ${why}`, 'Install that AmneziaWG build in Dawnline → Components, or switch the disguise on the Server page.'); + block(srv, why, 'Install that AmneziaWG build in Dawnline → Components, or switch the disguise on the Server page.'); continue; } delete srv.blocked; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc index da2f56d..a75d387 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/pkg.uc @@ -4,6 +4,7 @@ import { access, popen, stat } from 'fs'; import { q } from 'dawnline.util'; +import { _ } from 'dawnline.i18n'; function run(cmd) { let p = popen(cmd + ' 2>&1', 'r'); @@ -99,8 +100,9 @@ function preflight(files, need_kb, log) { for (let f in files ?? []) need += int(((stat(f)?.size ?? 0) * 3) / 1024); if (free < need) - die(`Not enough free space on the router: ${int(free / 1024)} MB free, about ${int(need / 1024) + 1} MB needed. Remove old backups or packages first`); - log?.(` ${int(free / 1024)} MB free on the overlay`); + die(sprintf(_('Not enough free space on the router: %d MB free, about %d MB needed. Remove old backups or packages first'), + int(free / 1024), int(need / 1024) + 1)); + log?.(' ' + sprintf(_('%d MB free on the overlay'), int(free / 1024))); } /** Package files (from a release): force also reinstalls the same version or goes back to an older one. */ @@ -115,8 +117,8 @@ export function install_files(files, force, log) { let before = force ? stat(marker)?.mtime : null; let ok = logged(`apk add --allow-untrusted ${args}`, log).code == 0; if (ok && force && before != null && stat(marker)?.mtime == before) { - log?.(' apk did not reinstall the version that is already installed'); - die("apk doesn't reinstall an installed version. Install a different release, or run install.sh on the router"); + log?.(' ' + _('apk did not reinstall the version that is already installed')); + die(_("apk doesn't reinstall an installed version. Install a different release, or run install.sh on the router")); } return ok; }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc index 421bfdf..602596f 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc @@ -24,6 +24,10 @@ // disguise) only go over HTTPS: a plain-HTTP link (an IP address in Settings) // shows the page, but gets them from its HTTPS twin. // +// Messages go out in the page's language (Accept-Language: the portal's +// fetch sends the visitor's choice) when a Dawnline translation for it is +// installed; else in English, and the page translates the ones it knows. +// // handle() serves one request: `io` = { env, headers, read(n), write(s) }; the // CGI script (cgi.uc) is its wrapper, behind the shell door www/cgi-bin/portal // that answers anything not shaped like a link (its not_found() twin). @@ -36,6 +40,8 @@ import * as live from 'dawnline.live'; import * as view from 'dawnline.view'; import * as schema from 'dawnline.schema'; import * as devices from 'dawnline.devices'; +import * as i18n from 'dawnline.i18n'; +import { _ } from 'dawnline.i18n'; const RATE = `${RUN_DIR}/portal-rate.json`; const ASSETS = '/usr/share/dawnline/portal/assets'; @@ -60,13 +66,22 @@ const SECURITY_HEADERS = { 'Cache-Control': 'no-store', }; -const NOT_READY = "Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link."; - // States the admin stopped the person in: the portal only shows, it changes nothing. -const LOCKED = { - paused: 'Your access is paused.', - expired: 'Your access has ended.', -}; +const LOCKED = [ 'paused', 'expired' ]; + +/** Why a stopped person (a LOCKED state) can't change anything, in the visitor's language; null for other states. */ +function locked_reason(st) { + if (st == 'paused') + return _('Your access is paused.'); + if (st == 'expired') + return _('Your access has ended.'); + return null; +} + +/** Why a new device or a new set-up is refused while the router has no AmneziaWG. */ +function not_ready() { + return _("Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link."); +} function html_escape(s) { return replace(`${s}`, /[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]); @@ -124,7 +139,7 @@ function body(r) { if (len <= 0) return {}; if (len > BODY_MAX) - fail(r, '413 Payload Too Large', 'Request too large.'); + fail(r, '413 Payload Too Large', _('Request too large.')); let raw = ''; while (length(raw) < len) { let chunk = r.io.read(len - length(raw)); @@ -137,7 +152,7 @@ function body(r) { return type(j) == 'object' ? j : {}; } catch (e) { - fail(r, '400 Bad Request', 'Invalid JSON.'); + fail(r, '400 Bad Request', _('Invalid JSON.')); } } @@ -236,7 +251,7 @@ function rate_action(r) { write_json(RATE, st, 0o600); unlock(l); if (v.count > ACTION_LIMIT) - fail(r, '429 Too Many Requests', 'Too many changes in a short time. Try again in a few minutes.'); + fail(r, '429 Too Many Requests', _('Too many changes in a short time. Try again in a few minutes.')); } /* ---------- pages ---------- */ @@ -305,7 +320,7 @@ function person_state(m, p, usage) { let st = core.person_state(m, p, usage); if (st == 'server_off') { let own = core.own_state(m, p, usage); - if (LOCKED[own]) + if (index(LOCKED, own) >= 0) return own; } return st; @@ -313,7 +328,7 @@ function person_state(m, p, usage) { /** Why the person can't change anything right now, or null. */ function locked(r) { - return LOCKED[person_state(r.m, r.person, core.load_usage())] ?? null; + return locked_reason(person_state(r.m, r.person, core.load_usage())); } /** Refuses a change (or a config) while the person is stopped. */ @@ -340,7 +355,7 @@ function https_url(r) { function need_https(r) { let u = https_url(r); if (u) - send_json(r, '403 Forbidden', { error: 'Open this link over HTTPS to get the connection settings.', https_url: u }); + send_json(r, '403 Forbidden', { error: _('Open this link over HTTPS to get the connection settings.'), https_url: u }); } /** The router's offset from UTC in minutes: the admin sets hours in its time, the page shows the visitor's. */ @@ -371,7 +386,7 @@ function state(r) { preset: !srv || awg.obf_neutral(srv.obf) ? 'off' : index([ 'balanced', 'max' ], srv.preset) >= 0 ? srv.preset : 'legacy', }, can_add: length(person.devices) < person.device_limit, - locked: LOCKED[v.state] != null, + locked: index(LOCKED, v.state) >= 0, // Over plain HTTP: where the configurations are (keys only travel encrypted). https_url: https_url(r), kinds: core.KINDS, @@ -389,7 +404,7 @@ function state(r) { function own_device(r, id) { let d = r.m.devices[id]; if (!d || d.person != r.person.id) - fail(r, '404 Not Found', 'Device not found.'); + fail(r, '404 Not Found', _('Device not found.')); return d; } @@ -402,7 +417,7 @@ function api_add(r) { need_https(r); let b = body(r); if (!devices.ready()) - fail(r, '503 Service Unavailable', NOT_READY); + fail(r, '503 Service Unavailable', not_ready()); rate_action(r); let res = guard(r, () => devices.add(r.person.id, b.name, b.kind, { by: 'portal', public_key: b.public_key })); reload(r); @@ -427,7 +442,7 @@ const ACTIONS = { reconnect: (r, d, b) => { need_https(r); if (!devices.ready()) - fail(r, '503 Service Unavailable', NOT_READY); + fail(r, '503 Service Unavailable', not_ready()); let config = guard(r, () => devices.reconnect(d.id, { by: 'portal', person: r.person.id, defer: d.address == r.peer })); return { config }; }, @@ -443,7 +458,7 @@ function api_device(r, id) { let b = body(r); let act = ACTIONS[b.action]; if (!act) - fail(r, '400 Bad Request', 'Unknown action.'); + fail(r, '400 Bad Request', _('Unknown action.')); rate_action(r); let res = act(r, d, b); reload(r); @@ -542,21 +557,23 @@ export function handle(io) { let origin = header('origin'); if (!match(env.CONTENT_TYPE ?? '', /^application\/json/) || (origin != null && origin != `${https ? 'https' : 'http'}://${host}`)) - fail(r, '403 Forbidden', 'Cross-site request refused.'); + fail(r, '403 Forbidden', _('Cross-site request refused.')); } else if (r.method != 'GET') - fail(r, '405 Method Not Allowed', 'Method not allowed.'); + fail(r, '405 Method Not Allowed', _('Method not allowed.')); let rt = route(API, r.method, slice(rest, 1)); if (!rt) - fail(r, '404 Not Found', 'Not found.'); + fail(r, '404 Not Found', _('Not found.')); rt.run(r, rt.args[0]); - fail(r, '404 Not Found', 'Not found.'); + fail(r, '404 Not Found', _('Not found.')); }; /** Run handle() and swallow its early end. */ export function serve(io) { try { + // "ru-RU,ru;q=0.9" → ru (i18n.use takes plain language codes only). + i18n.use((match(io.env.HTTP_ACCEPT_LANGUAGE ?? '', /^[ \t]*([A-Za-z][A-Za-z][A-Za-z]?)/) ?? [])[1]); handle(io); } catch (e) { diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc index 90370f7..9efdbf2 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/common.uc @@ -6,6 +6,7 @@ import * as awg from 'dawnline.awg'; import * as health from 'dawnline.health'; import * as schema from 'dawnline.schema'; import { uniq } from 'dawnline.util'; +import { _ } from 'dawnline.i18n'; /** * An rpcd handler from fn(args): an object result is passed on, anything else @@ -45,16 +46,16 @@ export function default_method() { /** A disguise method the installed AmneziaWG can run. */ export function check_method(name) { if (index(METHODS, name) < 0) - die('Unknown disguise method.'); + die(_('Unknown disguise method.')); let c = awg.caps(); if (name == 'max' && !c.v3) die(awg.installed() - ? 'Maximum needs AmneziaWG 3.1 on the router (kmod-amneziawg, amneziawg-tools 3.1): install a 3.1 build in Dawnline → Components.' - : 'AmneziaWG is not installed: install it in Dawnline → Components, then choose Maximum.'); + ? _('Maximum needs AmneziaWG 3.1 on the router (kmod-amneziawg, amneziawg-tools 3.1): install a 3.1 build in Dawnline → Components.') + : _('AmneziaWG is not installed: install it in Dawnline → Components, then choose Maximum.')); if (name == 'balanced' && !c.v2) die(awg.installed() - ? 'Balanced needs AmneziaWG 2.0 or newer on the router: install a current build in Dawnline → Components.' - : 'AmneziaWG is not installed: install it in Dawnline → Components, then choose Balanced.'); + ? _('Balanced needs AmneziaWG 2.0 or newer on the router: install a current build in Dawnline → Components.') + : _('AmneziaWG is not installed: install it in Dawnline → Components, then choose Balanced.')); return name; }; @@ -75,6 +76,7 @@ function tcp_forwards(m) { /** * TCP ports the portal can't take, and who holds them: [{ from, to, who }]. * The router's own (22, 53, 80, 443), other programs and port forwards from WAN. + * `who` is shown in the admin's language ("Used by %s."). */ export function tcp_taken(m) { let out = []; @@ -86,11 +88,11 @@ export function tcp_taken(m) { } }; for (let p in schema.RESERVED_PORTS) - hold(p, 'the router itself'); + hold(p, _('the router itself')); for (let p, name in health.tcp_port_programs()) - hold(+p, `${name} on this router`); + hold(+p, sprintf(_('%s on this router'), name)); for (let f in tcp_forwards(m)) - push(out, { from: f.from, to: f.to, who: `port forward “${f.name}”` }); + push(out, { from: f.from, to: f.to, who: sprintf(_('port forward “%s”'), f.name) }); return out; }; @@ -100,12 +102,12 @@ export function check_portal(m, was) { return; let port = s.portal_port; if (!schema.valid_port(port) || index(schema.RESERVED_PORTS, port) >= 0) - die('Choose a free port between 1 and 65535 (not 22, 53, 80 or 443).'); + die(_('Choose a free port between 1 and 65535 (not 22, 53, 80 or 443).')); let ports = [ port ]; if (core.portal_http(m)) { let hp = core.portal_http_port(m); if (!schema.valid_port(hp) || index(schema.RESERVED_PORTS, hp) >= 0) - die(`Links on IP addresses use plain HTTP on the next port (${hp}), which the portal cannot take. Choose another portal port.`); + die(sprintf(_('Links on IP addresses use plain HTTP on the next port (%d), which the portal cannot take. Choose another portal port.'), hp)); push(ports, hp); } // Only ports the portal does not hold already: our own uhttpd is not an owner anyway. @@ -120,11 +122,13 @@ export function check_portal(m, was) { continue; let owners = health.tcp_port_owners(p); if (length(owners)) - die(`TCP ${p} is already used by ${join(', ', owners)}.${p != port ? ' Links on IP addresses use plain HTTP on the port after the portal\'s.' : ''} Choose another portal port.`); + die(sprintf(p != port + ? _("TCP %d is already used by %s. Links on IP addresses use plain HTTP on the port after the portal's. Choose another portal port.") + : _('TCP %d is already used by %s. Choose another portal port.'), p, join(', ', owners))); } // A forwarded port never reaches the router: the portal would be unreachable. for (let p in ports) for (let f in tcp_forwards(m)) if (f.from <= p && p <= f.to) - die(`TCP ${p} is sent on by port forward “${f.name}”. Choose another portal port.`); + die(sprintf(_('TCP %d is sent on by port forward “%s”. Choose another portal port.'), p, f.name)); }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc index 5ea9129..4b27dc7 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/home.uc @@ -4,7 +4,7 @@ import { readfile } from 'fs'; import { cursor } from 'uci'; -import { sh_out, ip2int, rand_int, rand_hex, admin_log, valid_name, ulength, NAME_RULE } from 'dawnline.util'; +import { sh_out, ip2int, rand_int, rand_hex, admin_log, valid_name, ulength } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as apply from 'dawnline.apply'; import * as net from 'dawnline.net'; @@ -12,6 +12,7 @@ import * as access from 'dawnline.access'; import * as store from 'dawnline.store'; import * as schema from 'dawnline.schema'; import { wrap, str } from 'dawnline.rpc.common'; +import { _ } from 'dawnline.i18n'; /* ---------- services ---------- */ @@ -22,29 +23,29 @@ function new_id(m, make) { if (!store.id_taken(m, id)) return id; } - die('Could not find a free id, try again.'); + die(_('Could not find a free id, try again.')); } function service_set(a) { let name = str(a.name); if (!valid_name(name)) - die(`Service: ${NAME_RULE}`); + die(_('Service: Enter a name: up to 48 characters, without < > " or \\.')); let address = str(a.address); if (!schema.ipv4(address)) - die('Address must be an IPv4 address.'); + die(_('Address must be an IPv4 address.')); let ports = filter(map(type(a.ports) == 'array' ? a.ports : split(str(a.ports), /[ ,]+/), str), (x) => x != ''); for (let pt in ports) if (!schema.valid_port(pt)) - die(`Invalid port ${pt}.`); + die(sprintf(_('Invalid port %s.'), pt)); let id = store.transact((c, m) => { let id = str(a.id); if (id == '') id = new_id(m, () => `svc_${rand_int(100000, 999999)}`); else if (!match(id, /^[A-Za-z0-9_]{1,32}$/)) - die('Invalid service id.'); + die(_('Invalid service id.')); // Never turn a person, device, server, circle or the settings into a service. else if (!m.services[id] && store.id_taken(m, id)) - die('That id is taken.'); + die(_('That id is taken.')); c.set(core.CONFIG, id, 'service'); c.set(core.CONFIG, id, 'name', name); c.set(core.CONFIG, id, 'address', address); @@ -61,7 +62,7 @@ function service_set(a) { function service_delete(a) { store.transact((c, m) => { if (!m.services[a.id]) - die('Unknown service.'); + die(_('Unknown service.')); c.delete(core.CONFIG, a.id); for (let pid, p in m.people) if (index(p.services, a.id) >= 0) { @@ -82,17 +83,17 @@ function service_delete(a) { function circle_set(a) { let name = str(a.name); if (!valid_name(name) || ulength(name) > 32) - die('Enter a circle name: up to 32 characters, without < > " or \\.'); + die(_('Enter a circle name: up to 32 characters, without < > " or \\.')); let res = store.transact((c, m) => { let ci = a.id ? m.circles[a.id] : null; if (a.id && !ci) - die('Unknown circle.'); + die(_('Unknown circle.')); let server = ci?.server ?? a.server; if (!m.servers[server]) - die('Unknown server.'); + die(_('Unknown server.')); for (let id, o in m.circles) if (id != a.id && o.server == server && lc(o.name) == lc(name)) - die(`${name} already exists.`); + die(sprintf(_('%s already exists.'), name)); let id = ci?.id ?? new_id(m, () => `c_${rand_hex(4)}`); let n = core.CIRCLE_COLORS; c.set(core.CONFIG, id, 'circle'); @@ -121,7 +122,7 @@ function circle_delete(a) { let res = store.transact((c, m) => { let ci = m.circles[a.id]; if (!ci) - die('Unknown circle.'); + die(_('Unknown circle.')); c.delete(core.CONFIG, a.id); for (let pid, p in m.people) if (p.circle == a.id) @@ -173,7 +174,7 @@ function home_hosts(a) { let m = core.load(); let srv = m.servers[a.id] ?? values(m.servers)[0]; if (!srv) - die('No server yet.'); + die(_('No server yet.')); let nets = []; for (let cidr in net.server_net(srv).nets) { let x = match(cidr, /^([0-9.]+)\/([0-9]+)$/); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc index e340821..a4a64fc 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/maint.uc @@ -1,6 +1,7 @@ // Dawnline rpcd methods: Diagnostics (Health, the service log), backups, // export / import, and removing Dawnline. +import { _ } from 'dawnline.i18n'; import { slog_clear, admin_log } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as apply from 'dawnline.apply'; @@ -49,10 +50,10 @@ function import_all(a) { /** Remove Dawnline's state from the router (the package is removed by the UI afterwards). */ function uninstall(a) { if (a.confirm != 'remove') - die('Type "remove" to confirm.'); + die(_('Type "remove" to confirm.')); // Not in the middle of an update (opkg/apk may be installing Dawnline itself). if (upd.busy()) - die('An update is running: wait for it to finish, then remove Dawnline.'); + die(_('An update is running: wait for it to finish, then remove Dawnline.')); backup.backup_create('pre-remove'); // Stop first: the agent would put back what teardown removes, and could start an automatic update. system('/etc/init.d/dawnline stop >/dev/null 2>&1; /etc/init.d/dawnline disable >/dev/null 2>&1'); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc index ae8cd95..f726c05 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/people.uc @@ -9,6 +9,7 @@ import * as awg from 'dawnline.awg'; import * as store from 'dawnline.store'; import * as devices from 'dawnline.devices'; import { wrap, str, clamp_days } from 'dawnline.rpc.common'; +import { _ } from 'dawnline.i18n'; const PERSON_FIELDS = [ 'name', 'access', 'device_limit', 'expires', 'expire_action', 'expire_warn', 'quota_gb', 'quota_period', 'bonus_gb', 'hours', 'note', 'dns_mode', 'server' ]; @@ -61,7 +62,7 @@ function person_update(a) { function person_pause(a) { store.transact((c, m) => { if (!m.people[a.id]) - die('Unknown person.'); + die(_('Unknown person.')); if (a.paused) c.set(core.CONFIG, a.id, 'paused', '1'); else @@ -79,7 +80,7 @@ function person_pause(a) { function person_regen(a) { let gone = store.transact((c, m) => { if (!m.people[a.id]) - die('Unknown person.'); + die(_('Unknown person.')); c.set(core.CONFIG, a.id, 'code', core.new_code()); c.set(core.CONFIG, a.id, 'code_set', `${time()}`); let gone = []; @@ -106,7 +107,7 @@ function person_links(a) { let m = core.load(); let p = m.people[a.id]; if (!p) - die('Unknown person.'); + die(_('Unknown person.')); return { code: p.code, link: core.portal_url(m, p), links: core.portal_urls(m, p) }; } @@ -125,7 +126,7 @@ function person_usage(a) { let m = core.load(); let p = m.people[a.id]; if (!p) - die('Unknown person.'); + die(_('Unknown person.')); let days = clamp_days(a.days); let devs = {}; for (let d in p.devices) @@ -144,7 +145,7 @@ function device_config(a) { let m = core.load(); let d = m.devices[a.id]; if (!d) - die('Unknown device.'); + die(_('Unknown device.')); awg.mark_issued(m, d.id); return awg.client_config(m, d); } diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc index 629e2c4..4c11b4f 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/servers.uc @@ -2,7 +2,7 @@ // Interfaces settings, its disguise, and removing it. import { cursor } from 'uci'; -import { sh_out, sh_bg, parse_cidr, cidr_str, cidr_overlaps, valid_host, valid_name, NAME_RULE, rand_int, uniq, admin_log } from 'dawnline.util'; +import { sh_out, sh_bg, parse_cidr, cidr_str, cidr_overlaps, valid_host, valid_name, rand_int, uniq, admin_log } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as live from 'dawnline.live'; import * as apply from 'dawnline.apply'; @@ -15,6 +15,7 @@ import * as health from 'dawnline.health'; import * as backup from 'dawnline.backup'; import * as devices from 'dawnline.devices'; import { wrap, str, check_method, default_method, check_portal, tcp_taken } from 'dawnline.rpc.common'; +import { _ } from 'dawnline.i18n'; /** Server ids that would shadow a portal path. */ const PORTAL_PATHS = [ 'api', 'assets', 'cgi-bin' ]; @@ -27,6 +28,7 @@ const MESH_WORDS = { off: 'devices kept apart', all: 'devices reach each other', * UDP ports a server can't listen on, and who holds them: [{ from, to, who }]. * Other servers, tunnel interfaces, programs on the router and port forwards * from its WAN zone. `srv` is the server being edited: its own port isn't counted. + * `who` is shown in the admin's language ("Used by %s."). */ function udp_taken(m, srv, wan_zone) { let out = []; @@ -39,26 +41,26 @@ function udp_taken(m, srv, wan_zone) { }; for (let id, o in m.servers) if (id != srv?.id) - hold(o.port, `server “${o.name}”`); + hold(o.port, sprintf(_('server “%s”'), o.name)); let nc = cursor(); nc.load('network'); nc.foreach('network', 'interface', (s) => { if (s.listen_port && s['.name'] != srv?.ifname) - hold(+s.listen_port, `interface ${s['.name']}`); + hold(+s.listen_port, sprintf(_('interface %s'), s['.name'])); }); let progs = health.udp_port_programs(); for (let p in health.udp_bound()) if (p != srv?.port) - hold(p, progs[`${p}`] ? `${progs[`${p}`]} on this router` : 'another program on this router'); + hold(p, progs[`${p}`] ? sprintf(_('%s on this router'), progs[`${p}`]) : _('another program on this router')); for (let f in core.wan_forwards(wan_zone, 'udp')) - push(out, { from: f.from, to: f.to, who: `port forward “${f.name}”` }); + push(out, { from: f.from, to: f.to, who: sprintf(_('port forward “%s”'), f.name) }); return out; } function check_udp_port(port, taken) { for (let t in taken) if (t.from <= port && port <= t.to) - die(`UDP ${port} is used by ${t.who}. Choose another port.`); + die(sprintf(_('UDP %d is used by %s. Choose another port.'), port, t.who)); } /** The usual AmneziaWG port when free, otherwise a random high one. */ @@ -197,7 +199,8 @@ function setup_defaults(a) { let port = free_port(udp); return { id: free_server_id(m), - name: length(m.servers) ? `Server ${length(m.servers) + 1}` : 'Home', + // A name to start from, in the admin's language (it is theirs once saved). + name: length(m.servers) ? sprintf(_('Server %d'), length(m.servers) + 1) : _('Home'), ifname: free_ifname(m), port, subnet: free_subnet(map(networks, (n) => n.cidr)), @@ -229,7 +232,7 @@ function setup_defaults(a) { function endpoint_probe(a) { let host = str(a.host); if (host != '' && !valid_host(host)) - die('Public address must be a hostname or IP address.'); + die(_('Public address must be a hostname or IP address.')); let m = core.load(); let srv = m.servers[str(a.id)] ?? null; let f = health.endpoint_facts(srv, host); @@ -241,14 +244,14 @@ function endpoint_probe(a) { function need_awg_loaded() { devices.need_awg(); if (!awg.load().loaded) - die("AmneziaWG's kernel module doesn't load on this firmware: reinstall a build for this kernel in Components."); + die(_("AmneziaWG's kernel module doesn't load on this firmware: reinstall a build for this kernel in Components.")); } /** An MTU as typed: '' (automatic) or 1280-1500. */ function check_mtu(v) { let s = str(v); if (s != '' && (!match(s, /^[0-9]{1,4}$/) || +s < 1280 || +s > 1500)) - die('MTU must be 1280-1500.'); + die(_('MTU must be 1280-1500.')); return s; } @@ -260,19 +263,19 @@ function server_create(a) { let id = str(a.id) || 'home'; // A UCI section name: a dash would make uci drop it silently. if (!match(id, /^[a-z][a-z0-9_]{0,23}$/)) - die('Server ID may use lowercase letters, digits and underscores.'); + die(_('Server ID may use lowercase letters, digits and underscores.')); if (!id_free(m, id)) - die(`"${id}" is already taken.`); + die(sprintf(_('"%s" is already taken.'), id)); let nc = cursor(); nc.load('network'); let ifname = str(a.ifname) || free_ifname(m); if (!ifname_free(m, nc, ifname)) - die(`Network interface ${ifname} already exists.`); + die(sprintf(_('Network interface %s already exists.'), ifname)); let udp = udp_taken(m, null, str(a.wan_zone) || 'wan'); let port = free_port(udp); if (a.port != null && str(a.port) != '' && str(a.port) != '0') { if (!schema.valid_port(a.port)) - die('UDP port must be 1-65535.'); + die(_('UDP port must be 1-65535.')); port = +str(a.port); } check_udp_port(port, udp); @@ -285,7 +288,7 @@ function server_create(a) { // Public addresses inside the tunnel would hide the real hosts behind them. // New servers only: a restored backup keeps what it had. if (pc && !core.private_cidr(pc)) - die('Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x.'); + die(_('Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x.')); let taken = [ ...router_subnets ]; for (let sid, o in m.servers) push(taken, o.subnet); @@ -298,7 +301,7 @@ function server_create(a) { c.set(core.CONFIG, 'settings', 'settings'); c.set(core.CONFIG, id, 'server'); if (!valid_name(str(a.name) || 'Home')) - die(`Server: ${NAME_RULE}`); + die(_('Server: Enter a name: up to 48 characters, without < > " or \\.')); set('name', str(a.name) || 'Home'); set('ifname', ifname); set('port', `${port}`); @@ -329,7 +332,7 @@ function server_create(a) { c.set(core.CONFIG, 'settings', 'portal_enabled', on ? '1' : '0'); if (a.portal_port != null && str(a.portal_port) != '' && str(a.portal_port) != '0') { if (!schema.valid_port(a.portal_port)) - die('Portal port must be 1-65535.'); + die(_('Portal port must be 1-65535.')); c.set(core.CONFIG, 'settings', 'portal_port', `${+str(a.portal_port)}`); } } @@ -394,7 +397,7 @@ function interfaces_get(a) { let m = core.load(); let srv = m.servers[a.id] ?? values(m.servers)[0]; if (!srv) - die('No server yet.'); + die(_('No server yet.')); return interfaces_view(m, srv, net.snapshot(true)); } @@ -406,12 +409,12 @@ function server_interfaces(a) { let res = store.transact((c, m) => { let srv = m.servers[a.id]; if (!srv) - die('Unknown server.'); + die(_('Unknown server.')); if (!auto_wan) { if (!snap.devices[wan_dev]) - die('Choose the interface that leads to the internet.'); + die(_('Choose the interface that leads to the internet.')); if (!snap.devices[wan_dev].zone) - die(`${wan_dev} is not in a firewall zone, so the server port cannot be opened on it.`); + die(sprintf(_('%s is not in a firewall zone, so the server port cannot be opened on it.'), wan_dev)); } let lans = []; for (let d in (type(a.lan_devices) == 'array' ? a.lan_devices : [])) { @@ -420,9 +423,9 @@ function server_interfaces(a) { if (d == '' || d == srv.ifname || (!snap.devices[d] && index(srv.lan_devices, d) < 0)) continue; if (snap.devices[d]?.master) - die(`${d} is part of ${snap.devices[d].master}; choose ${snap.devices[d].master} instead.`); + die(sprintf(_('%s is part of %s; choose %s instead.'), d, snap.devices[d].master, snap.devices[d].master)); if (d == (auto_wan ? snap.wan : wan_dev)) - die(`${d} is the WAN.`); + die(sprintf(_('%s is the WAN.'), d)); push(lans, d); } lans = uniq(lans); @@ -485,7 +488,7 @@ function dns_list(v) { let list = filter(map(type(v) == 'array' ? v : split(str(v), /[ ,]+/), str), (x) => x != ''); for (let d in list) if (!schema.ip(d)) - die(`${d} is not an IP address.`); + die(sprintf(_('%s is not an IP address.'), d)); return list; } @@ -497,22 +500,22 @@ function server_update(a) { let srv = store.transact((c, m) => { let srv = m.servers[a.id]; if (!srv) - die('Unknown server.'); + die(_('Unknown server.')); let set = (k, val) => (val == null || val == '') ? c.delete(core.CONFIG, srv.id, k) : c.set(core.CONFIG, srv.id, k, val); if (v.name != null) { if (!valid_name(str(v.name))) - die(`Server: ${NAME_RULE}`); + die(_('Server: Enter a name: up to 48 characters, without < > " or \\.')); set('name', str(v.name)); } // Empty = the portal's address (core.endpoint_host), as at creation. if (v.endpoint != null) { if (str(v.endpoint) != '' && !valid_host(str(v.endpoint))) - die('Public address must be a hostname or IP address.'); + die(_('Public address must be a hostname or IP address.')); set('endpoint', str(v.endpoint)); } if (v.port != null) { if (!schema.valid_port(v.port)) - die('UDP port must be 1-65535.'); + die(_('UDP port must be 1-65535.')); let n = +str(v.port); if (n != srv.port) check_udp_port(n, udp_taken(m, srv, srv.wan_zone)); @@ -522,7 +525,7 @@ function server_update(a) { set('enabled', v.enabled === true || v.enabled == '1' ? '1' : '0'); if (v.mesh != null) { if (index(core.MESH, v.mesh) < 0) - die('Unknown choice for devices reaching each other.'); + die(_('Unknown choice for devices reaching each other.')); set('mesh', v.mesh); set('device_mesh', null); } @@ -530,7 +533,7 @@ function server_update(a) { set('mtu', check_mtu(v.mtu)); if (v.keepalive != null) { if (str(v.keepalive) != '' && (!match(str(v.keepalive), /^[0-9]{1,3}$/) || +v.keepalive > 600)) - die('Keep-alive must be 0-600 seconds.'); + die(_('Keep-alive must be 0-600 seconds.')); set('keepalive', str(v.keepalive)); } if (v.dns != null) { @@ -544,13 +547,13 @@ function server_update(a) { if (v.subnet != null && str(v.subnet) != '' && str(v.subnet) != srv.subnet) { let pc = parse_cidr(str(v.subnet)); if (!pc) - die('Subnet must look like 10.77.0.0/24.'); + die(_('Subnet must look like 10.77.0.0/24.')); if (!core.private_cidr(pc)) - die('Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x.'); + die(_('Use a private range: 10.x.x.x, 172.16–31.x.x or 192.168.x.x.')); let taken = map(filter(taken_networks(m), (n) => n.cidr != srv.subnet && n.name != srv.name), (n) => n.cidr); for (let t in taken) if (cidr_overlaps(pc, parse_cidr(t))) - die(`Subnet overlaps ${t}.`); + die(sprintf(_('Subnet overlaps %s.'), t)); core.renumber_server(c, m, srv, cidr_str(pc)); } return srv; @@ -583,7 +586,7 @@ function server_ports(a) { let m = core.load(); let srv = m.servers[a.id]; if (!srv) - die('Unknown server.'); + die(_('Unknown server.')); // `networks`: what a new tunnel network must not overlap (everything but this server's own). return { udp_taken: udp_taken(m, srv, srv.wan_zone), tcp_taken: tcp_taken(m), networks: filter(taken_networks(m), (n) => n.cidr != srv.subnet) }; @@ -595,7 +598,7 @@ function server_obfuscation(a) { let srv = store.transact((c, m) => { let srv = m.servers[a.id]; if (!srv) - die('Unknown server.'); + die(_('Unknown server.')); for (let k in core.OBF_KEYS) c.delete(core.CONFIG, srv.id, k); for (let k, v in o) @@ -611,12 +614,12 @@ function server_obfuscation(a) { /** Remove a server with its people, their devices and its circles (a backup is made first). */ function server_delete(a) { if (!core.load().servers[a.id]) - die('Unknown server.'); + die(_('Unknown server.')); backup.backup_create('pre-delete'); let res = store.transact((c, m) => { let srv = m.servers[a.id]; if (!srv) - die('Unknown server.'); + die(_('Unknown server.')); let gone = 0; for (let pid, p in m.people) if (p.server == srv.id) { diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc index 1fe72d2..de9bf30 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/settings.uc @@ -12,6 +12,7 @@ import * as schema from 'dawnline.schema'; import * as health from 'dawnline.health'; import * as pc from 'dawnline.portalcert'; import { wrap, check_portal, tcp_taken } from 'dawnline.rpc.common'; +import { _ } from 'dawnline.i18n'; /** The portal's own checks from Health, shown next to its settings. */ const PORTAL_CHECKS = [ 'portal', 'portal_dns', 'portal_reply', 'portal_http', 'cert' ]; @@ -92,7 +93,7 @@ function same(a, b) { function settings_update(a) { let v = a.values ?? {}; if (type(v) != 'object') - die('Nothing to save.'); + die(_('Nothing to save.')); let res = store.transact((c, m) => { let restart = false; c.set(core.CONFIG, 'settings', 'settings'); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc index 1e9a0ab..2aa0098 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/status.uc @@ -2,6 +2,7 @@ // people, totals, map, recent activity), the activity log and traffic history. import { readfile } from 'fs'; +import { _ } from 'dawnline.i18n'; import { read_json, write_json, ensure_dir, lock, unlock, admin_log, VERSION, RUN_DIR } from 'dawnline.util'; import * as core from 'dawnline.core'; import * as live from 'dawnline.live'; @@ -122,7 +123,8 @@ function server_view(m, srv, usage, dmp, rates, days) { mtus: { computer: core.device_mtu(srv, { kind: 'computer' }), phone: core.device_mtu(srv, { kind: 'phone' }) }, address: core.server_address(srv), up: !!st.up, uptime: st.uptime ?? 0, // Why the tunnel cannot run (its interface name belongs to another network section), or null. - blocked: srv.blocked ?? null, + // Why it can't start, as a whole sentence in the admin's language (stored as a code). + blocked: awg.blocked_text(srv), // Home networks (interfaces) for the per-person picker. home: map(net.server_net(srv).home, (h) => ({ dev: h.dev, nets: h.nets })), peers, online, obf: srv.obf, @@ -221,19 +223,19 @@ function logs_clear(a) { let f = {}; if (a.person) { if (!m.people[a.person]) - die('Unknown person.'); + die(_('Unknown person.')); f.person = a.person; } if (a.device) f.device = a.device; if (a.category) { if (index(live.CATEGORIES, a.category) < 0) - die('Unknown category.'); + die(_('Unknown category.')); f.category = a.category; } if (a.older_days) { if (!match(a.older_days, /^[1-9][0-9]{0,3}$/)) - die('Older than must be a number of days.'); + die(_('Older than must be a number of days.')); f.before = time() - +a.older_days * 86400; } let removed = live.clear_events(f); @@ -252,11 +254,11 @@ function logs_clear(a) { function usage_clear(a) { let m = core.load(); if (index([ 'all', 'person', 'device' ], a.scope) < 0) - die('Unknown scope.'); + die(_('Unknown scope.')); if (a.scope == 'person' && !m.people[a.id]) - die('Unknown person.'); + die(_('Unknown person.')); if (a.scope == 'device' && !m.devices[a.id]) - die('Unknown device.'); + die(_('Unknown device.')); let req = { scope: a.scope, id: a.id, ts: time() }; ensure_dir(RUN_DIR); let l = lock('usage-reset'); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc index a0969df..0bd5295 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/rpc/updates.uc @@ -11,11 +11,14 @@ import * as upd from 'dawnline.updates'; import * as gh from 'dawnline.github'; import * as builds from 'dawnline.awg_builds'; import { NAMES as PKG_NAMES } from 'dawnline.upd_pkgs'; +import { langs } from 'dawnline.upd_app'; +import * as i18n from 'dawnline.i18n'; +import { _ } from 'dawnline.i18n'; const TAG = /^v?[0-9][0-9A-Za-z.+~-]{0,40}$/; -// check[:app|amneziawg|packages] | app[@tag|:reinstall|:rollback] +// check[:app|amneziawg|packages] | app[@tag|:reinstall|:rollback|:lang:|:nolang] // | amneziawg[:auto|slava|grey[:ru]|:rollback] | pkgs: (only packages Dawnline manages) -const TARGET = /^(check(:(app|amneziawg|packages))?|app(@v?[0-9][0-9A-Za-z.+~-]{0,40}|:reinstall|:rollback)?|amneziawg(:rollback|:(auto|slava|grey)(:ru)?)?|pkgs:[a-z0-9][a-z0-9.+,-]*)$/; +const TARGET = /^(check(:(app|amneziawg|packages))?|app(@v?[0-9][0-9A-Za-z.+~-]{0,40}|:reinstall|:rollback|:lang:[a-z]{2,3}(_[A-Za-z]{2,4})?|:nolang)?|amneziawg(:rollback|:(auto|slava|grey)(:ru)?)?|pkgs:[a-z0-9][a-z0-9.+,-]*)$/; function wrap(fn) { return function(req) { @@ -62,6 +65,8 @@ function status(a) { policy: m.settings.updates, auto: upd.auto_state(), kept: upd.kept_all(builds.firmware()?.postfix), + // The admin's translations installed (luci-i18n-dawnline-). + translations: langs(), history: slice(upd.history(), 0, 12), tunnels: awg_tunnels(), }; @@ -71,7 +76,7 @@ function status(a) { function releases(a) { let page = +(a.page ?? 1); if (page != int(page) || page < 1 || page > 50) - die('Unknown page.'); + die(_('Unknown page.')); return { releases: map(gh.releases(REPO, page), (x) => ({ ...x, body: null, digests: null })), page }; } @@ -80,12 +85,12 @@ function notes(a) { let rp = a.component == 'amneziawg' ? builds.SOURCES[a.build || 'slava']?.repo : REPO; let tag = a.tag ?? ''; if (!rp || !match(tag, TAG)) - die('Unknown release.'); + die(_('Unknown release.')); let r = gh.release(rp, tag); if (!r && a.component != 'amneziawg' && substr(tag, 0, 1) != 'v') r = gh.release(rp, `v${tag}`); if (!r) - die(`No release ${tag} in ${rp}.`); + die(sprintf(_('No release %s in %s.'), tag, rp)); return { ...r, digests: null, repo: rp }; } @@ -93,7 +98,7 @@ function notes(a) { function changes(a) { let to = a.to ?? '', from = a.from ?? ''; if (!match(to, TAG) || (from != '' && !match(from, TAG))) - die('Unknown release.'); + die(_('Unknown release.')); // The installed version as a tag when it was released (a build ahead of the releases has none). let base = null; for (let t in (from != '' ? [ `v${replace(from, /^v/, '')}`, replace(from, /^v/, '') ] : [])) @@ -109,18 +114,20 @@ function changes(a) { function run(a) { let what = a.what ?? 'check'; if (length(what) > 400 || !match(what, TARGET)) - die('Unknown update target.'); + die(_('Unknown update target.')); // Checked here too, so a wrong name never becomes a failed job in the history. if (substr(what, 0, 5) == 'pkgs:') for (let n in split(substr(what, 5), ',')) if (index(PKG_NAMES, n) < 0) - die(n == '' ? 'Unknown update target.' : `${n} is not a package Dawnline manages.`); + die(n == '' ? _('Unknown update target.') : sprintf(_('%s is not a package Dawnline manages'), n)); if (upd.busy()) - die('Another component action is already running.'); + die(_('Another component action is already running')); ensure_dir(RUN_DIR); let t0 = time(); let args = substr(what, 0, 5) == 'check' ? `check ${substr(what, 6)}` : `install ${what}`; - system(`start-stop-daemon -S -b -x /usr/libexec/dawnline/updater -- ${args}`); + // The job speaks the admin's language (use() let only a plain language code through). + let lang = i18n.current(); + system(`${lang ? `DAWNLINE_LANG=${lang} ` : ''}start-stop-daemon -S -b -x /usr/libexec/dawnline/updater -- ${args}`); for (let i = 0; i < 20; i++) { let j = read_json(upd.JOB_FILE, null); if (j?.state == 'running' && j.started >= t0) diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc index 6709dbf..71f5c0e 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/schema.uc @@ -8,6 +8,7 @@ import { stat } from 'fs'; import { ip2int, valid_host, ulength } from 'dawnline.util'; import { INTERVALS, TARGETS } from 'dawnline.updates'; +import { _ } from 'dawnline.i18n'; /* ---------- addresses ---------- */ @@ -109,37 +110,36 @@ export function to_int(v, dflt, lo, hi) { /* * type: bool | int | enum | host | hosts | url | file | domain | ipv4 | time | targets * dflt: the parsed default; restart: the portal (uhttpd) must restart when it changes; - * min/max: ints; values: enums; msg: the error for a bad value. + * min/max: ints; values: enums. The error for a bad value is in messages(). */ export const SETTINGS = { portal_enabled: { type: 'bool', dflt: false, restart: true }, - portal_host: { type: 'host', dflt: '', restart: true, msg: 'Public address must be a hostname or IP address.' }, - portal_alt: { type: 'hosts', dflt: [], restart: true, msg: 'Other addresses must be hostnames or IP addresses.' }, - portal_port: { type: 'int', dflt: 8443, min: 1, max: 65535, restart: true, - msg: 'Choose a free port between 1 and 65535 (not 22, 53, 80 or 443).' }, - portal_redirect: { type: 'url', dflt: '', msg: 'Redirect must be a full http:// or https:// address.' }, + portal_host: { type: 'host', dflt: '', restart: true }, + portal_alt: { type: 'hosts', dflt: [], restart: true }, + portal_port: { type: 'int', dflt: 8443, min: 1, max: 65535, restart: true }, + portal_redirect: { type: 'url', dflt: '' }, portal_cert: { type: 'file', dflt: '', restart: true }, portal_key: { type: 'file', dflt: '', restart: true }, - default_device_limit: { type: 'int', dflt: 3, min: 1, max: 32, msg: 'Default device limit must be 1-32.' }, + default_device_limit: { type: 'int', dflt: 3, min: 1, max: 32 }, hostnames: { type: 'bool', dflt: true }, - domain: { type: 'domain', dflt: 'lan', msg: 'Domain may use lowercase letters, digits, dashes and dots.' }, + domain: { type: 'domain', dflt: 'lan' }, // Off until the admin turns it on: lookups send people's addresses to a third party. geo_enabled: { type: 'bool', dflt: false }, - geo_provider: { type: 'enum', dflt: 'ipwho.is', values: [ 'ipwho.is', 'ipapi.co' ], msg: 'Unknown location service.' }, + geo_provider: { type: 'enum', dflt: 'ipwho.is', values: [ 'ipwho.is', 'ipapi.co' ] }, log_connections: { type: 'bool', dflt: true }, watchdog: { type: 'bool', dflt: true }, - log_keep_days: { type: 'int', dflt: 30, min: 0, max: 9999, msg: 'Keep activity for 0 (no age limit) to 9999 days.' }, - log_max: { type: 'int', dflt: 2000, min: 100, max: 20000, msg: 'Log size must be 100-20000 events.' }, - log_persist: { type: 'enum', dflt: 'hourly', values: [ '10min', 'hourly', 'off' ], msg: 'Save the log every 10min, hourly or off.' }, - usage_keep_days: { type: 'int', dflt: 62, min: 7, max: 1830, msg: 'Daily traffic history must be 7-1830 days.' }, - usage_keep_months: { type: 'int', dflt: 24, min: 1, max: 120, msg: 'Monthly traffic history must be 1-120 months.' }, + log_keep_days: { type: 'int', dflt: 30, min: 0, max: 9999 }, + log_max: { type: 'int', dflt: 2000, min: 100, max: 20000 }, + log_persist: { type: 'enum', dflt: 'hourly', values: [ '10min', 'hourly', 'off' ] }, + usage_keep_days: { type: 'int', dflt: 62, min: 7, max: 1830 }, + usage_keep_months: { type: 'int', dflt: 24, min: 1, max: 120 }, // Empty means "no fallback" (stored as 'none'); unset means the default. - home_dns_fallback: { type: 'ipv4', dflt: '1.1.1.1', msg: 'Fallback DNS must be an IPv4 address (or empty for none).' }, + home_dns_fallback: { type: 'ipv4', dflt: '1.1.1.1' }, update_check: { type: 'bool', dflt: true }, - update_interval: { type: 'enum', dflt: '1d', values: keys(INTERVALS), msg: 'Check every 6h, 12h, 1d or 7d.' }, + update_interval: { type: 'enum', dflt: '1d', values: keys(INTERVALS) }, update_auto: { type: 'bool', dflt: true }, - update_mode: { type: 'enum', dflt: 'scheduled', values: [ 'immediate', 'scheduled' ], msg: 'Install updates immediately or scheduled.' }, - update_time: { type: 'time', dflt: '04:00', msg: 'Enter a time as HH:MM, 00:00 to 23:59.' }, + update_mode: { type: 'enum', dflt: 'scheduled', values: [ 'immediate', 'scheduled' ] }, + update_time: { type: 'time', dflt: '04:00' }, update_targets: { type: 'targets', dflt: [ 'app', 'packages' ] }, update_keep: { type: 'bool', dflt: false }, update_mirrors: { type: 'bool', dflt: true }, @@ -148,8 +148,30 @@ export const SETTINGS = { /** Ports the portal never takes: SSH, DNS and the LuCI web server. */ export const RESERVED_PORTS = [ 22, 53, 80, 443 ]; -function bad(spec, key) { - die(spec.msg ?? `Invalid value for ${key}.`); +/** What the admin is told about a bad value, by setting (made per call: the language changes between calls). */ +function messages() { + return { + portal_host: _('Public address must be a hostname or IP address.'), + portal_alt: _('Other addresses must be hostnames or IP addresses.'), + portal_port: _('Choose a free port between 1 and 65535 (not 22, 53, 80 or 443).'), + portal_redirect: _('Redirect must be a full http:// or https:// address.'), + default_device_limit: _('Default device limit must be 1-32.'), + domain: _('Domain may use lowercase letters, digits, dashes and dots.'), + geo_provider: _('Unknown location service.'), + log_keep_days: _('Keep activity for 0 (no age limit) to 9999 days.'), + log_max: _('Log size must be 100-20000 events.'), + log_persist: _('Save the log every 10min, hourly or off.'), + usage_keep_days: _('Daily traffic history must be 7-1830 days.'), + usage_keep_months: _('Monthly traffic history must be 1-120 months.'), + home_dns_fallback: _('Fallback DNS must be an IPv4 address (or empty for none).'), + update_interval: _('Check every 6h, 12h, 1d or 7d.'), + update_mode: _('Install updates immediately or scheduled.'), + update_time: _('Enter a time as HH:MM, 00:00 to 23:59.'), + }; +} + +function bad(key) { + die(messages()[key] ?? sprintf(_('Invalid value for %s.'), key)); } /** @@ -160,14 +182,14 @@ function bad(spec, key) { export function validate(key, val) { let spec = SETTINGS[key]; if (!spec) - die(`Unknown setting ${key}.`); + die(sprintf(_('Unknown setting %s.'), key)); let t = spec.type; if (t == 'hosts') { let lst = []; for (let x in (type(val) == 'array' ? val : [])) { // A typo must not vanish on Save: refused, like the main address. if (type(x) != 'string' || (trim(x) != '' && !valid_host(trim(x)))) - bad(spec, key); + bad(key); if (trim(x) != '' && index(lst, trim(x)) < 0) push(lst, trim(x)); } @@ -190,40 +212,40 @@ export function validate(key, val) { return null; if (t == 'bool') { if (val != '0' && val != '1') - die(`${key} is 0 or 1.`); + die(sprintf(_('%s is 0 or 1.'), key)); } else if (t == 'int') { if (!match(val, /^[0-9]{1,9}$/) || +val < spec.min || +val > spec.max) - bad(spec, key); + bad(key); val = `${+val}`; } else if (t == 'enum') { if (index(spec.values, val) < 0) - bad(spec, key); + bad(key); } else if (t == 'host') { if (!valid_host(val)) - bad(spec, key); + bad(key); } else if (t == 'url') { if (length(val) > 300 || !match(val, /^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^[:space:]"'<>]*)?$/)) - bad(spec, key); + bad(key); } else if (t == 'file') { if (substr(val, 0, 1) != '/' || !stat(val)) - die(`${val} does not exist.`); + die(sprintf(_('File %s does not exist.'), val)); } else if (t == 'domain') { if (!match(val, /^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/)) - bad(spec, key); + bad(key); } else if (t == 'ipv4') { if (!ipv4(val)) - bad(spec, key); + bad(key); } else if (t == 'time') { if (!match(val, /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)) - bad(spec, key); + bad(key); } return val; }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc index 13c4f55..e00fb41 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/store.uc @@ -5,6 +5,7 @@ import { lock, unlock } from 'dawnline.util'; import * as core from 'dawnline.core'; +import { _ } from 'dawnline.i18n'; /** Section names that are never ids of people, devices, servers, services or circles. */ export const RESERVED_IDS = [ 'settings', 'main', 'global', 'defaults' ]; @@ -15,8 +16,11 @@ export const RESERVED_IDS = [ 'settings', 'main', 'global', 'defaults' ]; * caller's change never happened, and nothing downstream may act on it. */ export function commit(c) { - if (!c.commit(core.CONFIG)) - die(`Couldn't save /etc/config/dawnline: ${c.error() ?? 'the write failed'}. Is the flash full?`); + if (!c.commit(core.CONFIG)) { + let why = c.error(); + die(why != null ? sprintf(_("Couldn't save /etc/config/dawnline: %s. Is the flash full?"), why) + : _("Couldn't save /etc/config/dawnline: the write failed. Is the flash full?")); + } system('chmod 600 /etc/config/dawnline'); }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc index 1ead852..95f5846 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_app.uc @@ -1,12 +1,15 @@ // Dawnline updater: Dawnline itself — check the latest release, install a // release (latest, a tag, the same one again) or the kept previous version. +// The admin's translations installed on the router (luci-i18n-dawnline-) +// come from the same release and go in with it, in one transaction. // ctx is the updater's job context (see usr/libexec/dawnline/updater). -import { readfile } from 'fs'; +import { readfile, lsdir } from 'fs'; import { VERSION, REPO } from 'dawnline.util'; import * as upd from 'dawnline.updates'; import * as gh from 'dawnline.github'; import * as pkg from 'dawnline.pkg'; +import { _ } from 'dawnline.i18n'; function status(installed, latest) { let c = upd.version_cmp(installed, latest); @@ -16,12 +19,12 @@ function status(installed, latest) { export function check(ctx) { let r = gh.latest(REPO); if (!r) - return { installed: VERSION, latest: null, update: false, repo: REPO, status: '', note: `Cannot reach github.com/${REPO}` }; + return { installed: VERSION, latest: null, update: false, repo: REPO, status: '', note: sprintf(_('Cannot reach github.com/%s'), REPO) }; let latest = replace(r.tag, /^v/, ''); let st = status(VERSION, latest); - ctx.log(st == 'outdated' ? `Dawnline update is available: ${VERSION} → ${latest}` - : st == 'dev' ? `Installed Dawnline ${VERSION} is newer than the release ${latest}` - : `Dawnline is up to date (${VERSION})`); + ctx.log(st == 'outdated' ? sprintf(_('Dawnline update is available: %s → %s'), VERSION, latest) + : st == 'dev' ? sprintf(_('Installed Dawnline %s is newer than the release %s'), VERSION, latest) + : sprintf(_('Dawnline is up to date (%s)'), VERSION)); return { installed: VERSION, latest, tag: r.tag, repo: REPO, url: r.url, published: r.published, update: st == 'outdated', status: st }; }; @@ -44,21 +47,51 @@ function want_sha(ctx, tag, asset, dir) { return null; } -/** Download a release's package, verified against its sha256. */ -function fetch(ctx, tag, dir) { - let ver = replace(tag, /^v/, ''); - let asset = `luci-app-dawnline-${ver}.${pkg.ext()}`; - ctx.phase(`Downloading ${asset}`); +/** The languages of the translations installed here, by their catalogs (dawnline..lmo). */ +export function langs() { + let out = []; + for (let f in lsdir('/usr/lib/lua/luci/i18n') ?? []) { + let m = match(f, /^dawnline\.([A-Za-z_-]+)\.lmo$/); + if (m) + push(out, m[1]); + } + return sort(out); +}; + +const i18n_pkg = (lang) => `luci-i18n-dawnline-${lang}`; + +/** + * Download one file of a release, verified against its sha256. `optional`: a + * release without it (one from before the translations) gives null. + */ +function fetch_file(ctx, tag, asset, dir, optional) { + ctx.phase(sprintf(_('Downloading %s'), asset)); let want = want_sha(ctx, tag, asset, dir); + if (!want && optional) { + ctx.log(sprintf(_('Release %s has no %s: it stays as it is'), tag, asset)); + return null; + } if (!want) - die(`Release ${tag} publishes no checksum for ${asset}: not installing an unverified package`); + die(sprintf(_('Release %s publishes no checksum for %s: not installing an unverified package'), tag, asset)); let f = `${dir}/${asset}`; if (!gh.download(`https://github.com/${REPO}/releases/download/${tag}/${asset}`, f, { sha256: want, mirrors: ctx.pol.mirrors, log: ctx.log })) - die(`Download failed: ${asset}`); - ctx.log(`sha256 matches the release (${substr(want, 0, 12)}…)`); + die(sprintf(_('Download failed: %s'), asset)); + ctx.log(sprintf(_('sha256 matches the release (%s…)'), substr(want, 0, 12))); return f; } +/** A release's package and the translations installed here, verified. */ +function fetch(ctx, tag, dir) { + let ver = replace(tag, /^v/, ''); + let files = [ fetch_file(ctx, tag, `luci-app-dawnline-${ver}.${pkg.ext()}`, dir) ]; + for (let l in langs()) { + let f = fetch_file(ctx, tag, `${i18n_pkg(l)}-${ver}.${pkg.ext()}`, dir, true); + if (f) + push(files, f); + } + return files; +} + /** The release tag of a version: tags may or may not carry the v. */ function tag_of(ver) { for (let t in [ `v${ver}`, ver ]) { @@ -72,23 +105,54 @@ function tag_of(ver) { } function backup(ctx) { - ctx.phase('Backing up configuration'); + ctx.phase(_('Backing up configuration')); system('/usr/bin/dawnline backup --reason pre-update >/dev/null 2>&1'); } -/** arg: null (latest) | @ | reinstall | rollback */ +/** + * Add the translation `lang` of the installed version from its release, or + * (lang null) remove the installed ones. LuCI reads its catalogs once per web + * server process: it restarts after the job. + */ +function set_lang(ctx, lang) { + if (lang == null) { + let have = map(langs(), i18n_pkg); + if (length(have)) { + ctx.phase(_('Removing the translation')); + if (!pkg.remove(have, ctx.log)) + die(_('The translation could not be removed')); + } + } + else { + let tag = tag_of(VERSION); + let f = fetch_file(ctx, tag, `${i18n_pkg(lang)}-${VERSION}.${pkg.ext()}`, ctx.work, true); + if (!f) + die(sprintf(_('Release %s has no translation into %s: install a release that has one'), tag, lang)); + ctx.phase(_('Installing the translation')); + if (!pkg.install_files([ f ], false, ctx.log)) + die(_('Installation failed')); + } + ctx.after('luci'); + return { from: VERSION, to: VERSION, lang }; +} + +/** arg: null (latest) | @ | reinstall | rollback | lang: | nolang */ export function install(ctx, arg) { + if (arg == 'nolang') + return set_lang(ctx, null); + if (substr(arg ?? '', 0, 5) == 'lang:') + return set_lang(ctx, substr(arg, 5)); let out = { from: VERSION, to: null }; if (arg == 'rollback') { let k = upd.kept('app'); if (!k) - die('No previous Dawnline version is kept on the router'); + die(_('No previous Dawnline version is kept on the router')); out.to = k.version; ctx.versions(VERSION, k.version); backup(ctx); - ctx.phase(`Rolling back to ${k.version}`); + ctx.phase(sprintf(_('Rolling back to %s'), k.version)); if (!pkg.install_files(k.files, true, ctx.log)) - die('Installation failed'); + die(_('Installation failed')); upd.forget('app'); ctx.after('app'); return out; @@ -114,25 +178,25 @@ export function install(ctx, arg) { } out.to = replace(tag, /^v/, ''); ctx.versions(VERSION, out.to); - let f = fetch(ctx, tag, ctx.work); + let files = fetch(ctx, tag, ctx.work); // The version being replaced, for Roll back (downloaded again: opkg keeps // no package files). Always for an automatic run: nobody is there to // recover a router whose new version does not come up (postupdate rolls // back to it on its own). if ((ctx.pol.keep || ctx.auto?.()) && out.to != VERSION && upd.kept('app')?.version != VERSION) { - ctx.phase(`Keeping Dawnline ${VERSION} for rollback`); + ctx.phase(sprintf(_('Keeping Dawnline %s for rollback'), VERSION)); try { system(`mkdir -p '${ctx.work}/keep'`); - upd.keep('app', VERSION, [ fetch(ctx, tag_of(VERSION), `${ctx.work}/keep`) ]); + upd.keep('app', VERSION, fetch(ctx, tag_of(VERSION), `${ctx.work}/keep`)); } catch (e) { - ctx.log(`Warning: could not keep ${VERSION}: ${e.message}`); + ctx.log(sprintf(_('Warning: could not keep %s: %s'), VERSION, e.message)); } } backup(ctx); - ctx.phase('Installing package'); - if (!pkg.install_files([ f ], force, ctx.log)) - die('Installation failed'); + ctx.phase(_('Installing package')); + if (!pkg.install_files(files, force, ctx.log)) + die(_('Installation failed')); ctx.after('app'); return out; }; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc index d38f124..67ae5a9 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_awg.uc @@ -10,6 +10,7 @@ import * as upd from 'dawnline.updates'; import * as gh from 'dawnline.github'; import * as pkg from 'dawnline.pkg'; import * as builds from 'dawnline.awg_builds'; +import { _, N_ } from 'dawnline.i18n'; function sh(cmd) { return system(`${cmd} >/dev/null 2>&1`); @@ -51,16 +52,16 @@ export function check(ctx) { let fw = builds.firmware(); if (!fw) return { installed: cur, gen: builds.gen(cur), packages: installed, current: null, ru, sources: {}, update: false, status: '', - note: 'Cannot detect the firmware target' }; + note: _('Cannot detect the firmware target') }; if (fw.snapshot) return { installed: cur, gen: builds.gen(cur), packages: installed, current: null, ru, sources: {}, update: false, status: '', - note: 'This is a SNAPSHOT firmware: the AmneziaWG projects publish builds for releases only' }; + note: _('This is a SNAPSHOT firmware: the AmneziaWG projects publish builds for releases only') }; let dir = `${ctx.work}/check`; system(`mkdir -p '${dir}'`); let sources = {}; for (let id in builds.ORDER) { let src = builds.SOURCES[id]; - ctx.log(`Looking for the ${src.label} build for OpenWrt ${substr(fw.tag, 1)}`); + ctx.log(sprintf(_('Looking for the %s build for OpenWrt %s'), src.label, substr(fw.tag, 1))); let f = fetch(ctx, fw, 'amneziawg-tools', id, dir); let v = f ? pkg.file_version(f) : null; let date = null; @@ -89,16 +90,16 @@ export function check(ctx) { let mine = current ? sources[current] : null; let c = cur && mine?.version ? pkg.cmp(cur, mine.version) : null; let st = c == null ? '' : c < 0 ? 'outdated' : c > 0 ? 'dev' : 'latest'; - ctx.log(cur == null ? 'AmneziaWG is not installed' - : !current ? `AmneziaWG ${cur}: no source publishes this build for this firmware any more` - : st == 'outdated' ? `AmneziaWG update is available: ${cur} → ${mine.version}` - : `AmneziaWG is up to date (${cur})`); + ctx.log(cur == null ? _('AmneziaWG is not installed') + : !current ? sprintf(_('AmneziaWG %s: no source publishes this build for this firmware any more'), cur) + : st == 'outdated' ? sprintf(_('AmneziaWG update is available: %s → %s'), cur, mine.version) + : sprintf(_('AmneziaWG is up to date (%s)'), cur)); return { installed: cur, gen: builds.gen(cur), packages: installed, current, ru, release: fw.tag, sources, latest: mine?.version ?? null, status: st, update: cur == null || st == 'outdated', // An update that changes the generation (2.0 → 3.1) breaks older apps: never automatic. gen_change: cur != null && mine?.version != null && builds.gen(cur) != builds.gen(mine.version), - note: !length(filter(values(sources), (x) => x.version)) ? `No AmneziaWG build for OpenWrt ${substr(fw.tag, 1)} yet` : null }; + note: !length(filter(values(sources), (x) => x.version)) ? sprintf(_('No AmneziaWG build for OpenWrt %s yet'), substr(fw.tag, 1)) : null }; }; /** Tunnels on a new kernel module: every AmneziaWG interface is brought down and up again. */ @@ -112,7 +113,8 @@ function reload_module(ctx, before, after) { if (s.proto == 'amneziawg' && s.disabled != '1') push(ifaces, s['.name']); }); - ctx.phase(`Reloading the kernel module (${length(ifaces)} tunnel(s) restart)`); + let n = length(ifaces); + ctx.phase(sprintf(N_(n, 'Reloading the kernel module (%d tunnel restarts)', 'Reloading the kernel module (%d tunnels restart)'), n)); for (let i in ifaces) { iface_intent(i, 'update', c.get('network', i, '_dawnline_name') ?? i); sh(`ifdown '${i}'`); @@ -121,10 +123,10 @@ function reload_module(ctx, before, after) { // no module at all) leave every tunnel down while the job says "done". ctx.run('rmmod amneziawg'); if (stat('/sys/module/amneziawg')) - die('The old AmneziaWG kernel module is still loaded (another AmneziaWG interface may use it): reboot the router to finish the update'); + die(_('The old AmneziaWG kernel module is still loaded (another AmneziaWG interface may use it): reboot the router to finish the update')); ctx.run('modprobe amneziawg'); if (!stat('/sys/module/amneziawg')) - die("The new AmneziaWG kernel module doesn't load on this firmware: the tunnels stay down until it does (see the log above)"); + die(_("The new AmneziaWG kernel module doesn't load on this firmware: the tunnels stay down until it does (see the log above)")); for (let i in ifaces) sh(`ifup '${i}'`); } @@ -132,15 +134,15 @@ function reload_module(ctx, before, after) { /** After packages changed: the module loaded, netifd knowing the protocol, Dawnline set up again. */ function settle(ctx, before, after) { if (!before['kmod-amneziawg'] && after['kmod-amneziawg']) { - ctx.phase('Loading the kernel module'); + ctx.phase(_('Loading the kernel module')); if (ctx.run('modprobe amneziawg').code != 0 && !stat('/sys/module/amneziawg')) - die("AmneziaWG is installed, but its kernel module doesn't load on this firmware"); + die(_("AmneziaWG is installed, but its kernel module doesn't load on this firmware")); } else reload_module(ctx, before, after); // netifd reads its protocol handlers when it starts. if (index(ctx.run('ubus call network get_proto_handlers').out, '"amneziawg"') < 0) { - ctx.phase('Restarting the network so it knows AmneziaWG (connections drop for a few seconds)'); + ctx.phase(_('Restarting the network so it knows AmneziaWG (connections drop for a few seconds)')); ctx.run('/etc/init.d/network restart'); } ctx.after('apply'); @@ -166,19 +168,19 @@ export function install(ctx, arg) { let out = { from: before['amneziawg-tools'], to: null, before }; let fw = builds.firmware(); if (!fw) - die('Cannot detect the firmware target'); + die(_('Cannot detect the firmware target')); if (arg == 'rollback') { let k = upd.kept('amneziawg'); if (!k) - die('No previous AmneziaWG build is kept on the router'); + die(_('No previous AmneziaWG build is kept on the router')); if (k.firmware && k.firmware != fw.postfix) - die('The kept AmneziaWG build was made for another firmware: it would not load on this one'); + die(_('The kept AmneziaWG build was made for another firmware: it would not load on this one')); out.to = k.version; out.build = k.build; ctx.versions(out.from, out.to); - ctx.phase(`Rolling back to ${k.version}`); + ctx.phase(sprintf(_('Rolling back to %s'), k.version)); if (!pkg.install_files(k.files, true, ctx.log)) - die('Package installation failed'); + die(_('Package installation failed')); upd.forget('amneziawg'); out.after = builds.installed(); settle(ctx, before, out.after); @@ -190,18 +192,18 @@ export function install(ctx, arg) { if (id == 'auto') { id = pick(fw); if (!id) - die(`No AmneziaWG build for OpenWrt ${substr(fw.tag, 1)} (${fw.postfix}) yet`); + die(sprintf(_('No AmneziaWG build for OpenWrt %s (%s) yet'), substr(fw.tag, 1), fw.postfix)); } let src = builds.SOURCES[id]; if (!src) - die(`Unknown AmneziaWG build ${id}`); + die(sprintf(_('Unknown AmneziaWG build %s'), id)); out.build = id; let files = []; for (let p in [ ...builds.PKGS, ...(want_ru ? [ builds.RU ] : []) ]) { - ctx.phase(`Downloading ${p} from ${src.repo}`); + ctx.phase(sprintf(_('Downloading %s from %s'), p, src.repo)); let f = fetch(ctx, fw, p, id, ctx.work); if (!f) - die(`No ${p} build for OpenWrt ${substr(fw.tag, 1)} in ${src.repo}, or it could not be verified`); + die(sprintf(_('No %s build for OpenWrt %s in %s, or it could not be verified'), p, substr(fw.tag, 1), src.repo)); push(files, f); } out.to = pkg.file_version(files[1]); @@ -219,19 +221,19 @@ export function install(ctx, arg) { kept = sid; } if (kept) { - ctx.phase(`Keeping AmneziaWG ${out.from} for rollback`); + ctx.phase(sprintf(_('Keeping AmneziaWG %s for rollback'), out.from)); let keepf = filter(map(builds.PKGS, (p) => fetch(ctx, fw, p, kept, dir)), (x) => x); if (length(keepf) == length(builds.PKGS)) upd.keep('amneziawg', out.from, keepf, kept, fw.postfix); } else - ctx.log('Warning: the installed build is no longer published, nothing to keep for rollback'); + ctx.log(_('Warning: the installed build is no longer published, nothing to keep for rollback')); } - ctx.phase('Refreshing package lists'); + ctx.phase(_('Refreshing package lists')); pkg.refresh(ctx.log); - ctx.phase(`Installing the ${src.label} build`); + ctx.phase(sprintf(_('Installing the %s build'), src.label)); if (!pkg.install_files(files, true, ctx.log)) - die('Package installation failed'); + die(_('Package installation failed')); if (!want_ru && pkg.version(builds.RU)) pkg.remove([ builds.RU ], ctx.log); out.after = builds.installed(); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc index dc4253d..a868f4a 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/upd_pkgs.uc @@ -4,6 +4,7 @@ // ctx is the updater's job context (see usr/libexec/dawnline/updater). import * as pkg from 'dawnline.pkg'; +import { _, N_ } from 'dawnline.i18n'; /** What Dawnline itself adds to OpenWrt (the rest of LuCI, ucode, rpcd and uhttpd is the stock system). */ export const NAMES = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme' ]; @@ -41,7 +42,7 @@ function with_family(names, up) { /** refresh: update the package lists first (a check by hand or on schedule). */ export function check(ctx, refresh) { if (refresh ?? true) { - ctx.phase('Refreshing package lists'); + ctx.phase(_('Refreshing package lists')); pkg.refresh(); } let up = pkg.upgradable(); @@ -54,7 +55,8 @@ export function check(ctx, refresh) { all[x] = true; } let n = length(keys(all)); - ctx.log(n ? `${n} package update${n == 1 ? '' : 's'} in the feeds: ${join(', ', sort(keys(all)))}` : 'System packages are up to date'); + ctx.log(n ? sprintf(N_(n, '%d package update in the feeds: %s', '%d package updates in the feeds: %s'), n, join(', ', sort(keys(all)))) + : _('System packages are up to date')); return { pkgs: res, updates: n, status: n ? 'outdated' : 'latest' }; }; @@ -63,22 +65,22 @@ export function install(ctx, arg) { let names = filter(split(arg ?? '', ','), (x) => x != ''); for (let n in names) if (index(NAMES, n) < 0) - die(`${n} is not a package Dawnline manages`); + die(sprintf(_('%s is not a package Dawnline manages'), n)); if (!length(names)) - die('Nothing to install'); - ctx.phase('Refreshing package lists'); + die(_('Nothing to install')); + ctx.phase(_('Refreshing package lists')); pkg.refresh(ctx.log); let missing = filter(names, (n) => pkg.version(n) == null); let have = with_family(filter(names, (n) => pkg.version(n) != null), pkg.upgradable()); if (length(have)) { - ctx.phase(`Updating ${join(', ', have)}`); + ctx.phase(sprintf(_('Updating %s'), join(', ', have))); if (!pkg.upgrade(have, ctx.log)) - die('Update failed'); + die(_('Update failed')); } if (length(missing)) { - ctx.phase(`Installing ${join(', ', missing)}`); + ctx.phase(sprintf(_('Installing %s'), join(', ', missing))); if (!pkg.add(missing, ctx.log)) - die('Installation failed'); + die(_('Installation failed')); } // The portal's HTTPS runs in uhttpd; a piece that just arrived lets the portal or the home-like link start. let touched = [ ...missing, ...have ]; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc index 36a62ad..cddd7c4 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/updates.uc @@ -6,6 +6,7 @@ import { open, stat } from 'fs'; import { q, read_json, write_json, ensure_dir, RUN_DIR, DATA_DIR } from 'dawnline.util'; +import { _ } from 'dawnline.i18n'; export const JOB_FILE = `${RUN_DIR}/update-job.json`; export const CHECK_FILE = `${RUN_DIR}/update-check.json`; @@ -126,12 +127,16 @@ export function busy() { return false; }; -/** The last job; a "running" one whose worker is gone (the lock is free) reads as failed. */ +/** + * The last job; a "running" one whose worker is gone (the lock is free) reads + * as failed. Its phases, log and error are in the language of whoever started + * it (English for automatic runs); only the stopped-job error is made here. + */ export function job() { let j = read_json(JOB_FILE, null); if (j?.state == 'running' && !busy()) { j.state = 'failed'; - j.error = 'The update stopped unexpectedly.'; + j.error = _('The update stopped unexpectedly.'); j.finished = j.finished ?? time(); } return j; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc index e5e2f55..59c6b02 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc @@ -3,8 +3,9 @@ // helpers work on a cursor the caller owns). import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs'; +import { _ } from 'dawnline.i18n'; -export const VERSION = '0.10.0'; +export const VERSION = '0.11.0'; /** GitHub repository with Dawnline releases (updates and the installer). */ export const REPO = 'tickcount/luci-app-dawnline'; export const RUN_DIR = '/var/run/dawnline'; @@ -543,8 +544,10 @@ export function valid_name(s) { return type(s) == 'string' && ulength(trim(s)) > 0 && ulength(s) <= 48 && match(s, /[<>"\\[:cntrl:]]/) == null; }; -/** What valid_name wants, for the admin. */ -export const NAME_RULE = 'Enter a name: up to 48 characters, without < > " or \\.'; +/** What valid_name wants, for the admin (in the admin's language). */ +export function name_rule() { + return _('Enter a name: up to 48 characters, without < > " or \\.'); +}; export function valid_key(s) { return type(s) == 'string' && match(s, /^[A-Za-z0-9+\/]{42}[AEIMQUYcgkosw048]=$/) != null; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc index 0865dfb..30a160e 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/watchdog.uc @@ -1,10 +1,12 @@ // Dawnline — watchdog. The agent runs it every minute: it checks what keeps // people connected and repairs what it can, waiting longer after each repair -// that did not help. What it finds goes to the service log; its state to -// RUN_DIR for the Health page. A cron job (libexec/dawnline/heartbeat) looks -// after the agent itself. +// that did not help. What it finds goes to the service log (English, as +// logged); its state to RUN_DIR for the Health page, whose chip names are put +// in the admin's language when they are read (view()). A cron job +// (libexec/dawnline/heartbeat) looks after the agent itself. import { stat } from 'fs'; +import { _, L_ } from 'dawnline.i18n'; import { sh_out, q, read_json, write_json, slog, slog_read, RUN_DIR } from 'dawnline.util'; import * as apply from 'dawnline.apply'; import * as loop from 'dawnline.loop'; @@ -34,8 +36,10 @@ function restart_services() { } /** - * What to look at: { id (= the Health check id), src, name (chip), who (the log's subject), ok, - * problem, back, detail?, repair: { what, run }? }. The log reads " — ". + * What to look at: { id (= the Health check id), src, name (chip, stored in English: view() + * shows names() by id), who (the log's subject), ok, + * problem, back, detail?, repair: { what, run }? }. The log reads " - "; its + * words are L_(): English in the log, translated where it is shown. */ function probes(m) { let out = []; @@ -43,48 +47,48 @@ function probes(m) { push(out, ...awg.probes(m, { udp_listening: health.udp_listening, reapply: () => apply.apply(), owner: (ifn) => netifd.owner(ifn) })); if (length(m.servers)) push(out, { - id: 'nft', src: 'dawnline', name: 'Access rules', who: 'Access rules', ok: nft.present(), - problem: 'are missing', back: 'are loaded again', - repair: { what: 'loading them again', run: () => apply.apply() }, + id: 'nft', src: 'dawnline', name: 'Access rules', who: L_('Access rules'), ok: nft.present(), + problem: L_('are missing'), back: L_('are loaded again'), + repair: { what: L_('loading them again'), run: () => apply.apply() }, }); if (length(filter(values(m.servers), (x) => x.private_key))) { let fw = apply.firewall_drift(m); push(out, { - id: 'fw', src: 'dawnline', name: 'Firewall', who: 'Firewall', ok: fw == null, - problem: fw == 'off' ? "isn't running on this router (fw4): tunnels and the portal are closed" - : fw == 'changed' ? "rules for Dawnline were changed or removed" : "rules for Dawnline aren't loaded", - back: 'rules for Dawnline are in place again', + id: 'fw', src: 'dawnline', name: 'Firewall', who: L_('Firewall'), ok: fw == null, + problem: fw == 'off' ? L_("isn't running on this router (fw4): tunnels and the portal are closed") + : fw == 'changed' ? L_("rules for Dawnline were changed or removed") : L_("rules for Dawnline aren't loaded"), + back: L_('rules for Dawnline are in place again'), // fw4 stopped on purpose is the admin's call: report it, do not start it. - repair: fw == 'off' ? null : { what: 'restoring them', run: () => { apply.apply(); system('fw4 -q reload'); } }, + repair: fw == 'off' ? null : { what: L_('restoring them'), run: () => { apply.apply(); system('fw4 -q reload'); } }, }); } let s = m.settings; if (s.portal_enabled && !length(health.needs().https) && !length(health.tcp_port_owners(s.portal_port))) push(out, { - id: 'portal', src: 'portal', name: 'Portal', who: 'Personal portal', ok: health.tcp_listening(s.portal_port), - problem: `isn't answering on port ${s.portal_port}`, back: 'answers again', + id: 'portal', src: 'portal', name: 'Portal', who: L_('Personal portal'), ok: health.tcp_listening(s.portal_port), + problem: sprintf(L_("isn't answering on port %d"), s.portal_port), back: L_('answers again'), detail: () => sh_out("logread -l 400 2>/dev/null | grep 'uhttpd' | grep -iE 'error|fail|cert|key|bind|address' | tail -n 4"), - repair: { what: 'restarting it', run: restart_services }, + repair: { what: L_('restarting it'), run: restart_services }, }); // Only while a server is on: with all of them off it idles on loopback. if (stat(loop.RESOLVER.conf) && length(filter(values(m.servers), (x) => x.enabled && x.private_key))) push(out, { - id: 'resolver', src: 'dawnline', name: 'Resolver', who: 'DNS for Home-only devices', ok: loop.resolver_running(), - problem: "isn't running", back: 'runs again', - repair: { what: 'restarting it', run: restart_services }, + id: 'resolver', src: 'dawnline', name: 'Resolver', who: L_('DNS for Home-only devices'), ok: loop.resolver_running(), + problem: L_("isn't running"), back: L_('runs again'), + repair: { what: L_('restarting it'), run: restart_services }, }); push(out, { id: 'rpc', src: 'dawnline', name: 'LuCI link', who: 'LuCI', ok: system('ubus list luci.dawnline >/dev/null 2>&1') == 0, - problem: "can't reach Dawnline (luci.dawnline is missing in rpcd)", back: 'reaches Dawnline again', + problem: L_("can't reach Dawnline (luci.dawnline is missing in rpcd)"), back: L_('reaches Dawnline again'), detail: () => sh_out('logread -l 400 2>/dev/null | grep rpcd | tail -n 4'), // A reload keeps LuCI logins; a restart (second try) signs everyone out — // and after three it stops: restarting rpcd every hour for good would // sign every admin out for good. - repair: { what: 'reloading rpcd', max: 3, run: (n) => system(n > 1 ? '/etc/init.d/rpcd restart >/dev/null 2>&1' : '/etc/init.d/rpcd reload >/dev/null 2>&1') }, + repair: { what: L_('reloading rpcd'), max: 3, run: (n) => system(n > 1 ? '/etc/init.d/rpcd restart >/dev/null 2>&1' : '/etc/init.d/rpcd reload >/dev/null 2>&1') }, }); return out; } @@ -107,7 +111,8 @@ export function run(m) { x.ok = p.ok; if (p.ok) { if (x.reported) - slog(p.src, 'up', p.back + (x.stuck ? ' · restored' : x.tries ? ` (after ${x.tries} repair${x.tries > 1 ? 's' : ''})` : ''), null, p.who); + slog(p.src, 'up', x.stuck ? sprintf(L_('%s · restored'), p.back) + : x.tries ? sprintf(x.tries > 1 ? L_('%s (after %d repairs)') : L_('%s (after %d repair)'), p.back, x.tries) : p.back, null, p.who); x.bad = 0; x.next = 0; x.reported = false; @@ -128,7 +133,7 @@ export function run(m) { if (busy) continue; if (p.repair?.max && x.tries >= p.repair.max && !x.reported) { - slog(p.src, 'error', `${p.problem} — not repaired again (${p.repair.max} repairs didn't help)`, p.detail?.(), p.who); + slog(p.src, 'error', sprintf(L_("%s - not repaired again (%d repairs didn't help)"), p.problem, p.repair.max), p.detail?.(), p.who); x.reported = true; continue; } @@ -142,7 +147,7 @@ export function run(m) { // trying quietly until it works again (that is logged). if (x.tries >= 3 && !x.stuck && now - (x.last ?? 0) >= 50) { x.stuck = true; - slog(p.src, 'error', `${p.problem} — ${x.tries} repairs didn't help`, p.detail?.(), p.who); + slog(p.src, 'error', sprintf(L_("%s - %d repairs didn't help"), p.problem, x.tries), p.detail?.(), p.who); } if (now < x.next) continue; @@ -151,13 +156,13 @@ export function run(m) { x.next = now + WAIT[min(x.tries, length(WAIT) - 1)]; x.reported = true; if (!x.stuck) - slog(p.src, 'repair', `${p.problem} — ${p.repair.what}`, p.detail?.(), p.who); + slog(p.src, 'repair', sprintf(L_('%s - %s'), p.problem, p.repair.what), p.detail?.(), p.who); try { p.repair.run(x.tries); } catch (e) { if (!x.stuck) - slog(p.src, 'error', `couldn't be repaired: ${e.message}`, null, p.who); + slog(p.src, 'error', sprintf(L_("couldn't be repaired: %s"), e.message), null, p.who); } if (!x.stuck) push(repairs, { ts: now, id: p.id, name: p.name }); @@ -168,18 +173,33 @@ export function run(m) { write_json(STATE, { last: now, targets: t, repairs }, 0o644); }; -/** For the Health page: the watchdog's state and the newest log entries. */ +/** + * The chip names of probes() by target id, in the language of the call. The + * others (AmneziaWG's, "Home · AmneziaWG") are names only and stay as stored. + */ +function names() { + return { + agent: _('Agent'), nft: _('Access rules'), fw: _('Firewall'), portal: _('Portal'), + resolver: _('Resolver'), rpc: _('LuCI link'), + }; +} + +/** + * For the Health page: the watchdog's state and the newest log entries. Target + * and repair names in the language of the call; the log as it was written. + */ export function view(m) { let st = read_json(STATE, {}); let beat = +(read_json(BEAT, 0) ?? 0); + let n = names(); // The agent itself: fine while it ticks (cron restarts it after 5 minutes without). - let targets = [ { id: 'agent', name: 'Agent', ok: beat > 0 && time() - beat < 180, tries: 0 } ]; + let targets = [ { id: 'agent', name: n.agent, ok: beat > 0 && time() - beat < 180, tries: 0 } ]; for (let id, x in (type(st.targets) == 'object' ? st.targets : {})) - push(targets, { id, name: x.name, ok: !!x.ok, tries: x.tries ?? 0 }); + push(targets, { id, name: n[id] ?? x.name, ok: !!x.ok, tries: x.tries ?? 0 }); return { watchdog: { enabled: m.settings.watchdog, last: st.last ?? null, beat: beat || null, now: time(), - targets, repairs: st.repairs ?? [], + targets, repairs: map(st.repairs ?? [], (r) => ({ ...r, name: n[r.id] ?? r.name })), }, log: slog_read(200), }; diff --git a/rules/backend.md b/rules/backend.md index ae75a82..971fa0a 100644 --- a/rules/backend.md +++ b/rules/backend.md @@ -16,6 +16,7 @@ Read with `code-standards.md`. Everything here runs on a small router (2 × Cort - Modules with `export` cannot be loaded with `require()`: imports are static and compiled on every start of the script. - Doc comments (`/** … */`) on every export: what it returns, including the null/empty case. - Shell out through one small helper per module (`run()`/`sh()`), with `2>&1` captured and the exit code checked. +- Messages people read (`die()` texts, check titles and details, phases) go through `_()` / `N_()` of `dawnline.i18n`, inside functions, with `sprintf()` for values (`i18n.md`). - nft changes load as one script (`nft.load()`, a transaction); tables Dawnline owns are named `dawnline*` and rebuilt whole (`table X` + `delete table X` + the table). ## Cost on the router diff --git a/rules/code-standards.md b/rules/code-standards.md index eddcc0d..cb0bd76 100644 --- a/rules/code-standards.md +++ b/rules/code-standards.md @@ -15,7 +15,7 @@ Match the code around you: its naming, comment density and idiom win over person - **Every module opens with a header comment**: what it owns, what it deliberately does not (and where that lives), and any invariant callers rely on (locks, files it writes, who may call it). - **Layers point one way.** Pure helpers and the data model know nothing about the router or the UI; orchestration calls them, never the reverse. Dawnline's layers are in `backend.md`. - **No god files, no grab-bag `ops`/`misc`/`kit` modules.** When a helper is used by one module, it stays private in that module. -- **Delete, don't deprecate.** When something is replaced, move every caller and remove the old code in the same change; no shims, no commented-out blocks. +- **Delete, don't deprecate.** When something is replaced, move every caller and remove the old code in the same change; no shims, no commented-out blocks. The same goes for its strings: new text is translated in the same change, removed text leaves the catalogs (`i18n.md`). ## Logic and state diff --git a/rules/frontend.md b/rules/frontend.md index 952be79..0fe981b 100644 --- a/rules/frontend.md +++ b/rules/frontend.md @@ -1,6 +1,6 @@ # Frontend (TypeScript: admin UI and portal) -Read with `code-standards.md` and, for anything visible, `ui-design.md`. +Read with `code-standards.md` and, for anything visible, `ui-design.md` and `i18n.md` (every visible string goes through `_()`). ## Code @@ -16,4 +16,4 @@ Read with `code-standards.md` and, for anything visible, `ui-design.md`. ## Checks -- In `web/`: `npm run format:check`, `npm run typecheck`, `npm test`, `npm run build`; the rebuilt bundles under `package/` are committed (CI fails otherwise). +- In `web/`: `npm run format:check`, `npm run typecheck`, `npm run i18n:check`, `npm test`, `npm run build`; the rebuilt bundles under `package/` and the catalogs are committed (CI fails otherwise). diff --git a/rules/i18n.md b/rules/i18n.md new file mode 100644 index 0000000..b16557d --- /dev/null +++ b/rules/i18n.md @@ -0,0 +1,97 @@ +# Translations (admin UI, portal, backend messages) + +Dawnline is written in English and translated through gettext catalogs. Russian is the first translation. Read with `frontend.md` (and `backend.md` for messages the router sends). + +## The rule + +- **What is added is localized in the same change.** A new page, section, control, toast, error, check or log line in the admin UI, the portal or the backend comes with its strings wrapped (`_()`, `N_()`, `plural()`, `L_()`) and translated in every `ru.po`. Not "later": CI refuses a catalog with an untranslated string. +- **What is removed leaves nothing behind.** Deleting or rewording text deletes its old entries: `npm run i18n` drops every entry no code uses any more, and `npm run i18n:check` (CI) fails while a catalog still holds one. No dead entries, no hand-kept leftovers, no commented-out translations: the catalogs follow the code, as the code follows `code-standards.md` ("Delete, don't deprecate"). +- **Every change to visible text is checked in Russian too**: the wording against the glossary below, the layout at narrow widths (Russian runs longer). + +## How it fits together + +- **Admin UI (LuCI).** Every visible string goes through LuCI's globals `_()` and `N_()`. The catalog is `package/luci-app-dawnline/po/ru/dawnline.po`; luci.mk compiles it with po2lmo into the separate package `luci-i18n-dawnline-ru` (`/usr/lib/lua/luci/i18n/dawnline.ru.lmo`, plus the uci-defaults that adds Russian to LuCI's languages). LuCI loads it when the page language is Russian (`luci.main.lang`, or `auto` with a Russian browser). Without the package everything stays English. The LuCI menu titles (`menu.d`) are in the same catalog. +- **Portal.** Not LuCI: it carries its own catalog (`web/src/portal/i18n/ru.po`, made into a lookup table at build time and bundled into `portal.js`), so it speaks Russian on every router, with or without the admin's package. `portal/i18n.ts` installs `_()`/`N_()` with LuCI's meaning, opens in the visitor's kept choice or the browser's language, and the language menu in the breadcrumb switches it in place. The demo's own strings are in `web/src/portal/demo/i18n/`. +- **Shared code** (`web/src/shared`) runs in both and is in both catalogs. +- **Backend messages** (ucode: `die()` texts, health checks, endpoint verdicts, the updater's phases) go through `_()` / `N_()` from `dawnline.i18n` and are in the `dawnline` catalog too. The admin page sends its language with every RPC call (`lang`, added by `web/src/admin/api.ts` and stripped by `rpcd/ucode/luci.dawnline`), the updater gets it from the job's start (`DAWNLINE_LANG`), the portal's CGI from `Accept-Language` (the portal's fetch sends the visitor's choice). `dawnline.i18n` reads LuCI's catalog through `luci.core`, so the backend speaks Russian where `luci-i18n-dawnline-ru` is installed; the portal page translates what reaches it in English from `portal.uc`, `devices.uc`, `core.uc` and `awg.uc` with its own catalog. The agent's and the CLI's terminal output stay English. Text the backend stores and shows later is stored as a code (or, for service log lines, as `L_()` templates) and put into words when it is read. +- **Delivery.** The release has `luci-i18n-dawnline-ru-.{ipk,apk}` next to the app. `install.sh` adds it when LuCI is in Russian (its setting, or `luci-i18n-base-ru` installed) or with `--lang ru`; the updater installs it with every Dawnline update when it is installed; Components → Dawnline → Translation adds or removes it. LuCI reads a language's catalogs once per web server process, so each of these restarts uhttpd afterwards. +- **Collecting.** `npm run i18n` (in `web/`) reads the code and rewrites the `.pot` templates and the `.po` files: new strings are added untranslated, gone ones removed, translations kept (and reused across catalogs). `npm run i18n:check` (CI) fails when a catalog is out of date, a string is untranslated, or a translation lost a placeholder. After changing visible text: run `npm run i18n`, translate the new entries in each `ru.po`, commit the catalogs with the code. + +## Writing strings + +- **Every visible string is wrapped**: text, buttons, headings, toasts, errors, tooltips (`title`), `aria-label`, `placeholder`, `alt`, the page title, confirm dialogs, CSV headers. Not wrapped: product and protocol names standing alone (Dawnline, AmneziaWG, WireGuard, OpenWrt, LuCI), ids, keys, paths, commands, package names, CSS classes, URLs, values sent to the router, log/event ids, `console` output. +- **Literals only.** `_('Save')`, never `_(label)` or `` _(`Hello ${name}`) ``: the extractor cannot collect them and fails. Placeholders `%s` (or `%d`) are filled with `fmt()` from `shared/i18n.ts`: `fmt(_('Removed %s'), name)`. +- **Whole sentences.** Never glue a sentence from pieces (`'Removed ' + name + ' from ' + circle`, or `_('ends') + ' ' + date`): word order and case endings differ. One msgid per sentence with placeholders. Pieces joined by separators (`PC · 10.0.0.2 · online`) are separate facts and stay separate strings. +- **Elements inside a sentence** (a link, a ``): `fill(_('Install it in %s'), link)` returns the children for `E()` / `h()`. The link text is its own `_()`. +- **Counts** go through `plural(n, '%s device', '%s devices')` (number formatted, both forms literals) or `N_(n, 'Device', 'Devices')` when the number is not in the text. Never `n === 1 ? … : …` or `` `${n} devices` ``: Russian has three forms (1 устройство, 2 устройства, 5 устройств), and 21 takes the singular. Use them even where English always has the plural. +- **Numbers and dates** in the page's language: `num(n)` (2,000 / 2 000), `num(v, 1)` for one decimal, `bytes()`, `fmtDay()`, `toLocaleDateString(locale(), …)`. Never a hard-coded `'en-GB'` or `toFixed()` for shown numbers. +- **Text is made when it is drawn**, inside functions, never at module level in the portal and the shared code (the portal changes language in place; the extractor refuses it there). A table of labels becomes a function: `kindLabel(k)` in `shared/format.ts`. +- **Context** when one English word means two things: `_('Off', 'state')` vs `_('Off', 'switch')`. Use it only for real clashes. +- **Whitespace and line breaks** are not part of a msgid: no leading/trailing spaces, no double spaces, no `\n` (LuCI squeezes whitespace before the lookup; po2lmo cannot carry newlines). Put spacing in the markup or the separator. +- **Keep the English as it is** when wrapping, except to turn a glued sentence into one with placeholders. +- **Other apps' labels** (the menus of AmneziaVPN, WireGuard and AmneziaWG in set-up steps) are quoted word for word, with a context of their own (`_('Create from QR code', 'WireGuard app')`), and translated with the app's own Russian from its sources (English where the app has no Russian). Where they come from is noted in `portal/setup.ts`. +- **Messages from the router** arrive in the page's language already (admin) or are translated with `routerText()` (portal): never glue them into a sentence of the page's own; ask the backend for a whole sentence instead. + +## Writing backend messages + +- `import { _, N_ } from 'dawnline.i18n';` and wrap literals only: `die(_('Backup not found.'))`, `die(sprintf(_('Download failed: %s'), asset))`, `sprintf(N_(n, '%d device', '%d devices'), n)`. Placeholders `%s` and `%d` only, filled after the lookup. +- `_()` inside functions only: rpcd keeps the modules loaded and the language changes with each call (the extractor refuses module-level calls). +- Wrap what a person reads in LuCI or the portal; leave ids, status values, command lines and sentinels alone. +- Messages a portal visitor can get belong in `portal.uc` or `devices.uc` and are best static sentences: the page can translate those without the package. +- **Service log lines** (`slog()` and the watchdog's problem/back/what texts) are written once, in English, by processes with no language (the agent), and read later. Mark their words with `L_()` instead of `_()`: `slog('awg', 'up', sprintf(L_('updated · %s → %s'), a, b), null, L_('System packages'))`. `L_` returns the English; the extractor collects it into the catalog and into `web/src/admin/events/log-templates.ts`, and the admin page matches each line against those templates and translates it (`logText()` in `events/model.ts`), values and nested templates included. Keep a template's English when you touch it (lines already in logs match it), and give the Russian the agreement its subject needs; a translation may start with «:» to go on after the subject («Сервер Home: AmneziaWG не работает»). + +## Russian + +Write like a careful Russian product (Telegram, Яндекс), not a word-for-word translation. + +- **Tone:** polite and short, «вы» in lower case. Buttons and menu items are verbs in the infinitive (perfective where it fits): «Сохранить», «Удалить», «Скопировать», «Добавить устройство», «Изменить»; «Отмена» for Cancel, «Закрыть», «Готово», «Назад», «Далее». +- **States** in forms that fit any person: «На паузе» (not «Приостановлен/а»), «Доступ закончился», «В сети» / «Не в сети». Prefer constructions without gender; when unavoidable, masculine as the neutral form. +- **Typography:** «ёлочки» for quotes, «ё» where it belongs (ещё, всё, истёк), the ellipsis character «…». No em dashes (—): where a dash is needed, a plain one with spaces ( - ), or a colon or a comma (the catalog check refuses «—»). Ranges keep the en dash (1–32, 07:00–23:00). Numbers with a space before units: «1,5 ГБ», «20 Мбит/с». +- **Units:** Б, КБ, МБ, ГБ, ТБ; бит/с, кбит/с, Мбит/с, Гбит/с; «5 мин назад», «3 ч назад», «2 дн. назад»; «2 д 5 ч», «5 ч 12 мин», «12 мин». +- **Length:** Russian runs ~20–30% longer. Keep buttons, pills, tabs and segmented controls short (abbreviate or rephrase), and check the layout in the browser at narrow widths. +- **Product and technical names stay as they are:** Dawnline, AmneziaWG, AmneziaVPN, WireGuard, OpenWrt, LuCI, GitHub, Cloudflare, Let's Encrypt, DDNS, DNS, MTU, UDP, TCP, IPv4/IPv6, NAT, CGNAT, LAN, WAN, QR-код, opkg/apk. + +### Glossary + +| English | Russian | +|---|---| +| server | сервер | +| person / people (the page) | человек / люди («Люди»); Add person — «Добавить человека» | +| device | устройство | +| circle | круг | +| access | доступ | +| home network | домашняя сеть | +| internet | интернет | +| home network + internet | домашняя сеть и интернет | +| portal, personal link, personal page | портал, личная ссылка, личная страница | +| invite (card) | приглашение (карточка приглашения) | +| disguise; Off / Balanced / Maximum | маскировка; Выкл. / Сбалансированная / Максимальная | +| data limit | лимит трафика | +| usage, traffic | трафик | +| end date; ends in 3 days | дата окончания; закончится через 3 дня | +| allowed hours; outside allowed hours | часы доступа; вне часов доступа | +| pause / resume; paused | приостановить / возобновить; на паузе | +| online / offline; last seen 12 min ago | в сети / не в сети; «В сети 12 мин назад» (not «Было в сети») | +| set up a device; setup | настроить устройство; настройка | +| app | приложение | +| key, public key, private key | ключ, публичный ключ, приватный ключ | +| configuration file (.conf) | файл конфигурации (.conf) | +| endpoint, public address | адрес сервера, публичный адрес | +| port, port forward | порт, проброс порта | +| tunnel | туннель | +| handshake | рукопожатие | +| router | роутер | +| firewall, zone | межсетевой экран, зона | +| interface, network | интерфейс, сеть | +| certificate | сертификат | +| Overview / Servers / People / Activity | Обзор / Серверы / Люди / События | +| Diagnostics / Health / Logs | Диагностика / Состояние / Журналы | +| Settings / Components / Updates | Настройки / Компоненты / Обновления | +| backup, restore | резервная копия, восстановить | +| check (health), fix | проверка, исправить | +| What's new | Что нового | +| Advanced | Дополнительно | +| watchdog | автовосстановление | +| places (map) | места | +| Copied | Скопировано | +| Undo | Отменить | diff --git a/rules/ui-design.md b/rules/ui-design.md index 0e72e62..04a80fd 100644 --- a/rules/ui-design.md +++ b/rules/ui-design.md @@ -29,4 +29,4 @@ A mock is judged against the page it will live on, so it must already look like ## Done means seen -Deploy, then look at it in the browser (desktop width, and narrow when layout changes) before reporting. Check modals and drawers stack correctly and long values do not overflow. +Deploy, then look at it in the browser (desktop width, and narrow when layout changes) before reporting. Check modals and drawers stack correctly and long values do not overflow. Look at it in Russian too: a visible change is localized in the same change (`i18n.md`), and Russian text is longer. diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index e757b49..f02e4c8 100755 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Build the release packages with the OpenWrt SDK in Docker (as CI does): # scripts/build-packages.sh [ipk|apk|all] -# Output: dist/luci-app-dawnline-.{ipk,apk} and dist/sha256sums.txt +# Output: dist/luci-app-dawnline-.{ipk,apk}, a translation package per +# po/ (dist/luci-i18n-dawnline--.{ipk,apk}) and dist/sha256sums.txt set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" @@ -25,13 +26,29 @@ build() { rm -rf "$OUT/.$type" && mkdir -p "$OUT/.$type" docker cp "$id:/builder/out/." "$OUT/.$type/" docker rm "$id" >/dev/null - local f - f="$(find "$OUT/.$type" -type f -name "*.$type" | head -n1)" - [ -n "$f" ] || { echo "no .$type built" >&2; exit 1; } - # ipk names use underscores (luci-app-dawnline_0.1.0-r1_all.ipk): one stable name for both. - mv "$f" "$OUT/luci-app-dawnline-$VERSION.$type" + local f name + for f in "$OUT/.$type"/*."$type"; do + [ -f "$f" ] || continue + # ipk names use underscores (luci-app-dawnline_0.1.0-r1_all.ipk), apk names + # dashes: one stable name per package for both, its name and the version. + name="$(basename "$f")" + name="${name%%[_-][0-9]*}" + mv "$f" "$OUT/$name-$VERSION.$type" + echo "$OUT/$name-$VERSION.$type" + done rm -rf "$OUT/.$type" - echo "$OUT/luci-app-dawnline-$VERSION.$type" + for name in luci-app-dawnline $(i18n_packages); do + [ -f "$OUT/$name-$VERSION.$type" ] || { echo "no $name .$type built" >&2; exit 1; } + done +} + +# The translation packages luci.mk makes: one per po/. +i18n_packages() { + local d + for d in "$APP"/po/*/; do + d="$(basename "$d")" + [ "$d" = templates ] || printf 'luci-i18n-dawnline-%s\n' "$d" + done } case "$WHAT" in @@ -43,9 +60,10 @@ esac ( cd "$OUT" - set -- luci-app-dawnline-"$VERSION".ipk luci-app-dawnline-"$VERSION".apk files="" - for f in "$@"; do [ -f "$f" ] && files="$files $f"; done + for name in luci-app-dawnline $(i18n_packages); do + for f in "$name-$VERSION".ipk "$name-$VERSION".apk; do [ -f "$f" ] && files="$files $f"; done + done # shellcheck disable=SC2086 if command -v sha256sum >/dev/null; then sha256sum $files; else shasum -a 256 $files; fi > sha256sums.txt ) diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 6e47dc8..ad1cf42 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -1,7 +1,10 @@ #!/usr/bin/env bash # Build the web bundles and pack luci-app-dawnline as a filesystem overlay -# tarball: dist/luci-app-dawnline-.tar.gz (paths relative to /). -# This is the asset the in-app updater and install.sh install. +# tarball: dist/luci-app-dawnline-.tar.gz (paths relative to /), with +# the translations as their packages lay them out (the catalogs compiled by +# web/i18n/lmo.ts, byte for byte po2lmo's, and the uci-defaults that adds the +# language to LuCI). scripts/deploy.sh installs it for development; releases +# are the .ipk/.apk packages (build-packages.sh). set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" @@ -19,6 +22,15 @@ grep -q "\"version\": \"$VERSION\"" "$ROOT/web/package.json" || { echo "web/pack mkdir -p "$STAGE/www" "$OUT" cp -R "$APP/root/." "$STAGE/" cp -R "$APP/htdocs/." "$STAGE/www/" +for po in "$APP"/po/*/dawnline.po; do + l="$(basename "$(dirname "$po")")" + [ "$l" = templates ] && continue + mkdir -p "$STAGE/usr/lib/lua/luci/i18n" + node "$ROOT/web/i18n/lmo.ts" "$po" "$STAGE/usr/lib/lua/luci/i18n/dawnline.$l.lmo" + # The name LuCI lists the language by (luci.mk's LUCI_LANG.). + case "$l" in ru) name='Русский (Russian)' ;; *) name="$l" ;; esac + printf "uci set luci.languages.%s='%s'; uci commit luci\n" "$l" "$name" > "$STAGE/etc/uci-defaults/luci-i18n-dawnline-$l" +done chmod 755 "$STAGE/usr/bin/dawnline" "$STAGE/usr/libexec/dawnline/agent" "$STAGE/usr/libexec/dawnline/updater" "$STAGE/usr/libexec/dawnline/resolver" "$STAGE/usr/libexec/dawnline/postupdate" \ "$STAGE/etc/init.d/dawnline" "$STAGE/etc/uci-defaults/90_dawnline" "$STAGE/etc/hotplug.d/iface/95-dawnline" \ "$STAGE/usr/share/dawnline/portal/www/cgi-bin/portal" "$STAGE/usr/share/dawnline/portal/cgi.uc" diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 7d2eff3..97ea64f 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -20,6 +20,11 @@ ls -d /root/dawnline-predeploy-* 2>/dev/null | sort | head -n -5 | xargs -r rm - tar -xozf /tmp/luci-app-dawnline.tar.gz -C / rm -f /tmp/luci-app-dawnline.tar.gz sh /etc/uci-defaults/90_dawnline && rm -f /etc/uci-defaults/90_dawnline +for f in /etc/uci-defaults/luci-i18n-dawnline-*; do + if [ -f "$f" ]; then sh "$f" && rm -f "$f"; fi +done +# LuCI reads a language's catalogs once per web server: the new ones need a fresh one. +/etc/init.d/uhttpd restart sleep 1 ubus list luci.dawnline >/dev/null && echo "luci.dawnline registered (backup: /root/dawnline-predeploy-$ts)" REMOTE diff --git a/scripts/lint-ucode.py b/scripts/lint-ucode.py index 65b7974..cddc19a 100755 --- a/scripts/lint-ucode.py +++ b/scripts/lint-ucode.py @@ -146,7 +146,7 @@ if methods and os.path.exists(ACL): # Layering (rules/backend.md): util, schema → core → store → domain modules → # apply → entry points. A module importing one from a layer above it is # reported, not failed, until the existing edges are untangled. -LAYER = {'util': 0, 'schema': 1, 'core': 2, 'store': 3, 'apply': 5} +LAYER = {'util': 0, 'i18n': 0, 'schema': 1, 'core': 2, 'store': 3, 'apply': 5} LAYER_NAME = {0: 'util', 1: 'schema', 2: 'core', 3: 'store', 4: 'domain', 5: 'apply'} notes = 0 for f in modules: diff --git a/tests/ucode/awg.test.uc b/tests/ucode/awg.test.uc index 4bc3282..fa76447 100644 --- a/tests/ucode/awg.test.uc +++ b/tests/ucode/awg.test.uc @@ -103,3 +103,15 @@ test('handshake_since: Reconnect hides older handshakes', () => { eq(awg.handshake_since(1600, 1500), 1600, 'connected after'); eq(awg.handshake_since(0, 1500), 0, 'never connected'); }); + +test('blocked reasons', () => { + let srv = (b) => ({ name: 'Home', blocked: b }); + eq(awg.blocked_text(srv(null)), null, 'not kept down'); + eq(awg.blocked_text(srv({ code: 'ifname', ifname: 'bad name' })), 'Home has an invalid interface name "bad name".', 'interface name'); + eq(awg.blocked_text(srv({ code: 'taken', ifname: 'wg0' })), "Home can't use the network interface wg0: it exists and isn't Dawnline's.", 'foreign interface'); + eq(awg.blocked_text(srv({ code: 'disguise', need: '3.1', installed: '2.0' })), 'Home is kept down: its disguise needs AmneziaWG 3.1 (installed: 2.0).', 'disguise'); + eq(awg.blocked_text(srv({ code: 'disguise', need: '3.1' })), 'Home is kept down: its disguise needs AmneziaWG 3.1 (installed: none).', 'disguise, none installed'); + // Files of older versions hold the English fragment after the name. + eq(awg.blocked_text(srv('has an invalid interface name "x"')), 'Home has an invalid interface name "x".', 'old fragment'); + eq(awg.blocked_note({ code: 'ifname', ifname: 'x' }), 'has an invalid interface name "x"', 'the log keeps the fragment'); +}); diff --git a/tests/ucode/i18n.test.uc b/tests/ucode/i18n.test.uc new file mode 100644 index 0000000..3598e70 --- /dev/null +++ b/tests/ucode/i18n.test.uc @@ -0,0 +1,20 @@ +// dawnline.i18n: without LuCI's catalogs (this rootfs has no luci-base) every +// message stays English, whatever language is asked for; plural forms pick +// by the count. +import * as i18n from 'dawnline.i18n'; + +test('English without a catalog', () => { + i18n.use('ru'); + eq(i18n.current(), null, 'no Russian catalog here'); + eq(i18n._('Backup not found.'), 'Backup not found.', 'as written'); + eq(sprintf(i18n.N_(1, '%d device', '%d devices'), 1), '1 device', 'singular'); + eq(sprintf(i18n.N_(5, '%d device', '%d devices'), 5), '5 devices', 'plural'); + eq(i18n.N_(0, 'a', 'b'), 'b', 'zero takes the plural in English'); +}); + +test('only plain language codes', () => { + for (let l in [ null, '', 'en', 'ru; rm -rf /', '../../etc', 'russian', 42 ]) { + i18n.use(l); + eq(i18n.current(), null, `${l}`); + } +}); diff --git a/tests/ucode/loop.test.uc b/tests/ucode/loop.test.uc new file mode 100644 index 0000000..47da681 --- /dev/null +++ b/tests/ucode/loop.test.uc @@ -0,0 +1,12 @@ +// dawnline.loop: the "like a home device" link's errors, stored as codes and +// put into words when read. +import * as loop from 'dawnline.loop'; + +test('error_text', () => { + eq(loop.error_text(null), null, 'no error'); + eq(loop.error_text({ code: 'no_lan' }), 'No LAN detected.', 'no LAN'); + eq(loop.error_text({ code: 'not_bridge', dev: 'eth1' }), 'eth1 is not a bridge, so Dawnline cannot join the LAN as a device.', 'not a bridge'); + eq(loop.error_text({ code: 'no_address', net: 'lan' }), 'No free address on lan.', 'no address'); + eq(loop.error_text({ code: 'setup', detail: 'ip: RTNETLINK answers: File exists' }), 'Setup failed: ip: RTNETLINK answers: File exists', 'setup'); + eq(loop.error_text('an old message'), 'an old message', 'older files: as written'); +}); diff --git a/uninstall.sh b/uninstall.sh index 3198b69..751118a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -655,6 +655,8 @@ do_leftovers() { /usr/share/luci/menu.d/luci-app-dawnline.json /www/luci-static/resources/dawnline \ /www/luci-static/resources/view/dawnline for _r in /etc/rc.d/*dawnline; do [ -e "$_r" ] && set -- "$@" "$_r"; done + # The translations' catalogs (luci-i18n-dawnline- depends on the package, so it is gone too). + for _r in /usr/lib/lua/luci/i18n/dawnline.*.lmo; do [ -e "$_r" ] && set -- "$@" "$_r"; done fi if [ "$PURGE" -eq 1 ]; then set -- "$@" "$DATA_DIR" /etc/config/dawnline /etc/config/dawnline-opkg /etc/config/dawnline.apk-new diff --git a/web/i18n/extract.ts b/web/i18n/extract.ts new file mode 100644 index 0000000..78b5831 --- /dev/null +++ b/web/i18n/extract.ts @@ -0,0 +1,418 @@ +// Dawnline's string catalogs, collected from the code (run in web/): +// +// node i18n/extract.ts rewrite the .pot templates and merge the .po translations +// node i18n/extract.ts --check CI: fail when a catalog is out of date or a string is untranslated +// node i18n/extract.ts --import a.json … also take translations from drafts: [{ id, ctx?, plural?, str }], +// str a string or, for a plural, one per form +// node i18n/extract.ts --lint [--import a.json …] [--only src/admin/x.ts …] +// write nothing: report string problems, bad or stray drafts +// and, with --only, the strings of those files left untranslated +// +// Three catalogs (rules/i18n.md): +// dawnline — the admin UI, its shared code, the backend's messages and the +// LuCI menu: package/luci-app-dawnline/po (luci.mk builds +// luci-i18n-dawnline- from it) +// portal — the personal portal, the shared code and the messages of the +// backend modules the portal runs: src/portal/i18n, bundled into portal.js +// demo — what only the portal demo says: src/portal/demo/i18n +// +// A string is collected from _('…'), N_(n, '…', '…') and plural(n, '…', '…') +// with literal arguments, and from the backend's L_('…'): a service log line's +// words, written in English and put into the reader's language when shown (they +// also go into src/admin/events/log-templates.ts, the list the admin page +// matches log lines against). Anything else under those names is an error, as is +// a string LuCI could not find again (leading, trailing or doubled whitespace, +// newlines) and, in the portal and the shared code, a call at module level +// (the portal changes language in place, so text is made when it is drawn). +// The catalogs keep the files a string comes from, not lines: they change +// only when strings do. + +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import * as prettier from 'prettier'; +import ts from 'typescript'; +import { keyOf, parsePo, pluralForms, translated, writePo, type Entry, type Po } from './po.ts'; + +const WEB = path.resolve(import.meta.dirname, '..'); +const REPO = path.resolve(WEB, '..'); +const PKG = path.join(REPO, 'package/luci-app-dawnline'); + +/** The translations and their gettext plural rules (po2lmo hands the formula to LuCI's N_()). */ +const LANGS: Record = { + ru: { + team: 'Russian', + plural: 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);', + }, +}; + +const walk = (dir: string, keep: (f: string) => boolean): string[] => + !fs.existsSync(dir) + ? [] + : fs + .readdirSync(dir, { withFileTypes: true }) + .flatMap((d) => + d.isDirectory() ? walk(path.join(dir, d.name), keep) : keep(path.join(dir, d.name)) ? [path.join(dir, d.name)] : [], + ) + .sort(); + +const tsFiles = (dir: string, skip?: string) => + walk(path.join(WEB, dir), (f) => f.endsWith('.ts') && !f.endsWith('.d.ts') && !(skip && f.startsWith(path.join(WEB, skip) + path.sep))); + +/** The backend: ucode modules and the ucode programs (by their shebang) in the package. */ +const ucodeFiles = () => + walk(path.join(PKG, 'root'), (f) => f.endsWith('.uc') || (!path.extname(f) && fs.readFileSync(f, 'utf8').startsWith('#!/usr/bin/ucode'))); + +/** + * The backend modules whose messages reach the portal's visitors (its own + * refusals, what refuses a device change, the keys): the page translates them when + * the router sends them in English (no translation package installed). + */ +const PORTAL_UCODE = ['portal.uc', 'devices.uc', 'core.uc', 'awg.uc'].map((f) => path.join(PKG, 'root/usr/share/ucode/dawnline', f)); + +const menuFiles = () => walk(path.join(PKG, 'root/usr/share/luci/menu.d'), (f) => f.endsWith('.json')); + +interface CatalogSpec { + name: string; + pot: string; + po: (lang: string) => string; + sources: () => string[]; + menus?: () => string[]; + /** Strings here are made when the page is drawn (the portal switches language in place). */ + lazy: (file: string) => boolean; + /** The service log's words (L_) are in it: only the admin page shows the log. */ + logs?: boolean; +} + +const CATALOGS: CatalogSpec[] = [ + { + name: 'dawnline', + pot: path.join(PKG, 'po/templates/dawnline.pot'), + po: (l) => path.join(PKG, `po/${l}/dawnline.po`), + sources: () => [...tsFiles('src/admin'), ...tsFiles('src/shared'), ...ucodeFiles()], + menus: menuFiles, + logs: true, + // rpcd keeps the backend's modules loaded while the language changes per call. + lazy: (f) => f.startsWith(path.join(WEB, 'src/shared')) || f.startsWith(path.join(PKG, 'root')), + }, + { + name: 'portal', + pot: path.join(WEB, 'src/portal/i18n/portal.pot'), + po: (l) => path.join(WEB, `src/portal/i18n/${l}.po`), + sources: () => [...tsFiles('src/portal', 'src/portal/demo'), ...tsFiles('src/shared'), ...PORTAL_UCODE], + lazy: () => true, + }, + { + name: 'demo', + pot: path.join(WEB, 'src/portal/demo/i18n/demo.pot'), + po: (l) => path.join(WEB, `src/portal/demo/i18n/${l}.po`), + sources: () => tsFiles('src/portal/demo'), + lazy: () => true, + }, +]; + +/** Where the wrappers themselves pass strings on: not literals, by design. */ +const WRAPPERS = new Set([path.join(WEB, 'src/shared/i18n.ts'), path.join(WEB, 'src/portal/i18n.ts')]); + +/** The string arguments of each translation call: [msgid, msgid_plural?, msgctxt?]; `log`: a log line's words (L_). */ +const CALLS: Record = { + _: { id: 0, ctx: 1 }, + N_: { id: 1, plural: 2, ctx: 3 }, + plural: { id: 1, plural: 2 }, + L_: { id: 0, log: true }, +}; + +/** The generated list of log line templates (L_), for the admin page. */ +const LOG_TEMPLATES_FILE = path.join(WEB, 'src/admin/events/log-templates.ts'); +const logTemplates = new Set(); + +const rel = (f: string) => path.relative(REPO, f).split(path.sep).join('/'); + +/** Why LuCI would not find this string again, or null. Its lookup squeezes whitespace (cbi.js trimws). */ +export function badText(s: string): string | null { + if (!s) return 'is empty'; + if (/[\n\r\t]/.test(s)) return 'has a newline or a tab (po2lmo cannot carry them)'; + if (/^\s|\s$/.test(s)) return 'starts or ends with a space'; + if (/\s\s/.test(s)) return 'has two spaces in a row'; + return null; +} + +interface Found extends Entry { + files: Set; +} + +class Errors { + list: string[] = []; + add(where: string, msg: string) { + this.list.push(`${where}: ${msg}`); + } +} + +function isFunctionLike(n: ts.Node): boolean { + return ts.isFunctionLike(n) || ts.isPropertyDeclaration(n) || ts.isClassStaticBlockDeclaration(n); +} + +/** Every translation call in one file. */ +function scan(file: string, lazy: boolean, logs: boolean, errors: Errors, out: Found[]) { + const text = fs.readFileSync(file, 'utf8'); + const kind = file.endsWith('.ts') ? ts.ScriptKind.TS : ts.ScriptKind.JS; + const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, kind); + const wrapper = WRAPPERS.has(file); + const visit = (node: ts.Node) => { + if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && CALLS[node.expression.text] && !wrapper) { + const name = node.expression.text; + const spec = CALLS[name]; + const where = `${rel(file)}:${sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1}`; + const lit = (i: number | undefined): string | undefined | null => { + if (i === undefined) return undefined; + const a = node.arguments[i]; + if (!a) return undefined; + return ts.isStringLiteral(a) || ts.isNoSubstitutionTemplateLiteral(a) ? a.text : null; + }; + const id = lit(spec.id); + const pl = lit(spec.plural); + const ctx = lit(spec.ctx); + if (id == null || pl === null || (spec.plural !== undefined && pl === undefined) || ctx === null) { + errors.add( + where, + `${name}() needs string literals: a variable or a template with \${…} cannot be collected (fill placeholders with fmt())`, + ); + } else { + for (const [what, s] of [ + ['msgid', id], + ['plural', pl], + ['context', ctx], + ] as const) + if (s !== undefined) { + const why = badText(s); + if (why) errors.add(where, `the ${what} ${JSON.stringify(s)} ${why}`); + } + // A log line's words are not translated where they are written: anywhere goes. + if (spec.log) logTemplates.add(id); + else if (lazy && !wrapper) { + let p: ts.Node | undefined = node.parent; + while (p && !isFunctionLike(p)) p = p.parent; + if (!p) errors.add(where, `${name}() at module level: here text is made when it is drawn (the portal changes language in place)`); + } + const e: Found = { id, str: [], refs: [], files: new Set([rel(file)]) }; + if (spec.log && !logs) return; + if (pl !== undefined) e.plural = pl; + if (ctx !== undefined) e.ctx = ctx; + out.push(e); + } + } + ts.forEachChild(node, visit); + }; + visit(sf); +} + +/** LuCI's menu titles (translated by the theme's menu). */ +function scanMenu(file: string, out: Found[]) { + const menu = JSON.parse(fs.readFileSync(file, 'utf8')) as Record; + for (const node of Object.values(menu)) if (node.title) out.push({ id: node.title, str: [], refs: [], files: new Set([rel(file)]) }); +} + +/** One catalog's strings, deduplicated and sorted (by code unit: the same order on every machine). */ +function collect(spec: CatalogSpec, errors: Errors): Entry[] { + const found: Found[] = []; + for (const f of spec.sources()) scan(f, spec.lazy(f), !!spec.logs, errors, found); + for (const f of spec.menus?.() ?? []) scanMenu(f, found); + const byKey = new Map(); + for (const e of found) { + const k = keyOf(e); + const had = byKey.get(k); + if (!had) byKey.set(k, e); + else if (had.plural !== e.plural) + errors.add( + [...e.files][0], + `${JSON.stringify(e.id)} is used ${had.plural === undefined || e.plural === undefined ? 'both as a plural and as a plain string' : `with two plurals (${JSON.stringify(had.plural)}, ${JSON.stringify(e.plural)})`}: give one of them a context`, + ); + else e.files.forEach((f) => had.files.add(f)); + } + return [...byKey.values()] + .map(({ files, ...e }) => ({ ...e, refs: [...files].sort() })) + .sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : (a.ctx ?? '') < (b.ctx ?? '') ? -1 : (a.ctx ?? '') > (b.ctx ?? '') ? 1 : 0)); +} + +const HEADER: [string, string][] = [ + ['Project-Id-Version', 'Dawnline'], + ['MIME-Version', '1.0'], + ['Content-Type', 'text/plain; charset=UTF-8'], + ['Content-Transfer-Encoding', '8bit'], +]; + +const read = (f: string): Po | null => (fs.existsSync(f) ? parsePo(fs.readFileSync(f, 'utf8')) : null); + +interface Draft { + id: string; + ctx?: string; + plural?: string; + str: string | string[]; +} + +/** The placeholders of a string, in order: what a translation must keep. */ +export const holes = (s: string) => (s.match(/%[sd]/g) ?? []).join(' '); + +/** Problems in one translation, for --check and the summary. */ +export function badTranslation(e: Entry): string | null { + const want = holes(e.plural ?? e.id); + if (e.plural !== undefined && holes(e.id) !== want) return `the singular and the plural have different placeholders`; + for (const s of e.str) { + if (!s) continue; + if (s.includes('\\')) return `${JSON.stringify(s)} has a backslash (po2lmo would show it as written)`; + if (s.includes('—')) return `${JSON.stringify(s)} has an em dash: use a plain dash (rules/i18n.md)`; + const why = badText(s); + if (why) return `${JSON.stringify(s)} ${why}`; + if (holes(s) !== want) return `${JSON.stringify(s)} has the placeholders "${holes(s)}", the English "${want}"`; + } + return null; +} + +/** The command line: --check, --lint, and the files after --import and --only. */ +function options(argv: string[]) { + const o = { check: false, lint: false, imports: [] as string[], only: [] as string[] }; + let list: string[] | null = null; + for (const a of argv) { + if (a === '--check' || a === '--lint') { + o[a === '--check' ? 'check' : 'lint'] = true; + list = null; + } else if (a === '--import') list = o.imports; + else if (a === '--only') list = o.only; + else if (list) list.push(a); + else throw new Error(`unknown argument ${a} (see the top of i18n/extract.ts)`); + } + return o; +} + +const draftKey = (d: { ctx?: string; id: string; plural?: string }) => keyOf(d) + (d.plural !== undefined ? '\u0002' : ''); + +/** The list of log line templates as a module (formatted as the repo formats code). */ +async function logTemplatesModule(): Promise { + const list = [...logTemplates].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)); + const code = [ + "// Generated by web/i18n/extract.ts from the backend's L_() strings (npm run i18n): do not edit.", + '// The words of service log lines, as written; events/model.ts matches log lines against them.', + '', + `export const LOG_TEMPLATES: string[] = ${JSON.stringify(list)};`, + '', + ].join('\n'); + return prettier.format(code, { ...(await prettier.resolveConfig(LOG_TEMPLATES_FILE)), filepath: LOG_TEMPLATES_FILE }); +} + +async function main() { + const opt = options(process.argv.slice(2)); + const errors = new Errors(); + const problems: string[] = []; + + const drafts = new Map(); + for (const f of opt.imports) + for (const d of JSON.parse(fs.readFileSync(path.resolve(f), 'utf8')) as Draft[]) { + const had = drafts.get(draftKey(d)); + if (had && JSON.stringify(had.str) !== JSON.stringify(d.str)) + problems.push( + `drafts disagree on ${JSON.stringify(d.id)}: ${JSON.stringify(had.str)} (${had.from}), ${JSON.stringify(d.str)} (${f})`, + ); + drafts.set(draftKey(d), { ...d, from: f }); + } + const usedDrafts = new Set(); + + const collected = CATALOGS.map((spec) => ({ spec, entries: collect(spec, errors) })); + const only = opt.only.map((f) => rel(path.resolve(f))); + const under = (r: string) => only.some((o) => r === o || r.startsWith(`${o}/`)); + // Linting some files: the problems of those (other files may be half-way through a change). + if (opt.lint) problems.push(...errors.list.filter((e) => !only.length || under(e.replace(/:\d+: [\s\S]*$/, '')))); + else if (errors.list.length) { + console.error(errors.list.join('\n')); + console.error(`\n${errors.list.length} string problem(s): fix them in the code (rules/i18n.md).`); + process.exit(1); + } + + // What each language already has, across catalogs: a string translated in one is reused in the others. + const known = new Map>(); + for (const lang of Object.keys(LANGS)) { + const m = new Map(); + for (const { spec } of collected) + for (const e of read(spec.po(lang))?.entries ?? []) + if (translated(e)) m.set(keyOf(e) + (e.plural !== undefined ? `\u0002${e.plural}` : ''), e.str); + known.set(lang, m); + } + + const inOnly = (e: Entry) => e.refs.some(under); + const out = new Map(); + const report: string[] = []; + const missingOnly = new Set(); + for (const { spec, entries } of collected) { + out.set( + spec.pot, + writePo({ + header: [...HEADER, ['Plural-Forms', 'nplurals=2; plural=(n != 1);']], + entries: entries.map((e) => ({ ...e, str: e.plural !== undefined ? ['', ''] : [''] })), + }), + ); + for (const [lang, info] of Object.entries(LANGS)) { + const file = spec.po(lang); + const old = new Map((read(file)?.entries ?? []).map((e) => [draftKey(e), e])); + const header: [string, string][] = [...HEADER, ['Language', lang], ['Language-Team', info.team], ['Plural-Forms', info.plural]]; + const forms = pluralForms({ header, entries: [] }); + const merged = entries.map((e): Entry => { + const k = draftKey(e); + const blank = e.plural !== undefined ? Array(forms).fill('') : ['']; + const draft = drafts.get(k); + if (draft) { + usedDrafts.add(k); + const str = Array.isArray(draft.str) ? draft.str : [draft.str]; + if (str.length === blank.length) return { ...e, str }; + problems.push(`${spec.name}/${lang}: the draft for ${JSON.stringify(e.id)} has ${str.length} form(s), ${blank.length} needed`); + } + const was = old.get(k); + // A changed plural keeps its forms only when the English plural stayed the same. + if (was && translated(was) && was.plural === e.plural) return { ...e, str: was.str }; + const other = known.get(lang)!.get(keyOf(e) + (e.plural !== undefined ? `\u0002${e.plural}` : '')); + return { ...e, str: other && other.length === blank.length ? other : blank }; + }); + out.set(file, writePo({ header, entries: merged })); + const missing = merged.filter((e) => !translated(e)); + for (const e of merged) { + const why = badTranslation(e); + if (why && (!only.length || inOnly(e))) problems.push(`${rel(file)}: ${JSON.stringify(e.id)}: ${why}`); + } + report.push(`${spec.name}/${lang}: ${merged.length - missing.length} of ${merged.length} translated`); + if (opt.check) + for (const e of missing) problems.push(`${rel(file)}: untranslated ${JSON.stringify(e.id)}${e.ctx ? ` (${e.ctx})` : ''}`); + for (const e of missing) + if (inOnly(e)) + missingOnly.add( + `no translation for ${JSON.stringify(e.id)}${e.ctx ? ` (context ${e.ctx})` : ''}${e.plural !== undefined ? ` (plural ${JSON.stringify(e.plural)})` : ''} [${e.refs.filter(under).join(' ')}]`, + ); + } + } + for (const [k, d] of drafts) + if (!usedDrafts.has(k)) + problems.push(`draft ${JSON.stringify(d.id)}${d.plural !== undefined ? ' (plural)' : ''} is not in the code (${d.from})`); + problems.push(...missingOnly); + + out.set(LOG_TEMPLATES_FILE, await logTemplatesModule()); + + if (opt.check || opt.lint) { + if (opt.check) + for (const [f, text] of out) + if (!fs.existsSync(f) || fs.readFileSync(f, 'utf8') !== text) + problems.unshift(`${rel(f)} is out of date: run "npm run i18n" in web/ and commit the result`); + if (problems.length) { + console.error(problems.join('\n')); + process.exit(1); + } + console.log(opt.lint ? 'No problems.' : report.join('\n')); + return; + } + for (const [f, text] of out) { + if (fs.existsSync(f) && fs.readFileSync(f, 'utf8') === text) continue; + fs.mkdirSync(path.dirname(f), { recursive: true }); + fs.writeFileSync(f, text); + } + console.log(report.join('\n')); + if (problems.length) console.warn(`\n${problems.join('\n')}`); +} + +// Run as a program; imported (by the tests), only the checks above. +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) await main(); diff --git a/web/i18n/lmo.ts b/web/i18n/lmo.ts new file mode 100644 index 0000000..dda618e --- /dev/null +++ b/web/i18n/lmo.ts @@ -0,0 +1,110 @@ +// The LMO catalog LuCI loads (/usr/lib/lua/luci/i18n/..lmo), made +// from a .po byte for byte as LuCI's po2lmo makes it. The release packages are +// built by the SDK's own po2lmo (luci.mk); this one is for the dev deploy +// (scripts/build-release.sh), which has no SDK. +// +// Layout: the translations, each padded with zeros to 4 bytes, in the .po's +// order (the Plural-Forms formula first, under key 0); then an index entry per +// string, sorted by key: key hash, number of forms, offset, length (big-endian +// uint32s); then the index's offset. A key is the msgid, with "ctx\x01" before +// it and "\x02" after it for plural form n; its hash is Paul Hsieh's +// SuperFastHash seeded with the length (lmo.c sfh_hash, cbi.js sfh). +// +// node i18n/lmo.ts in.po out.lmo + +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { parsePo, type Po } from './po.ts'; + +/** SuperFastHash of the bytes, seeded with their length, as a uint32. */ +export function sfh(data: Uint8Array): number { + const get16 = (i: number) => data[i] | (data[i + 1] << 8); + const s8 = (i: number) => (data[i] << 24) >> 24; + let hash = data.length >>> 0; + if (!data.length) return 0; + let i = 0; + for (let n = data.length >>> 2; n > 0; n--, i += 4) { + hash = (hash + get16(i)) >>> 0; + const tmp = ((get16(i + 2) << 11) ^ hash) >>> 0; + hash = ((hash << 16) ^ tmp) >>> 0; + hash = (hash + (hash >>> 11)) >>> 0; + } + switch (data.length & 3) { + case 3: + hash = (hash + get16(i)) >>> 0; + hash = (hash ^ (hash << 16)) >>> 0; + hash = (hash ^ (s8(i + 2) << 18)) >>> 0; + hash = (hash + (hash >>> 11)) >>> 0; + break; + case 2: + hash = (hash + get16(i)) >>> 0; + hash = (hash ^ (hash << 11)) >>> 0; + hash = (hash + (hash >>> 17)) >>> 0; + break; + case 1: + hash = (hash + s8(i)) >>> 0; + hash = (hash ^ (hash << 10)) >>> 0; + hash = (hash + (hash >>> 1)) >>> 0; + } + hash = (hash ^ (hash << 3)) >>> 0; + hash = (hash + (hash >>> 5)) >>> 0; + hash = (hash ^ (hash << 4)) >>> 0; + hash = (hash + (hash >>> 17)) >>> 0; + hash = (hash ^ (hash << 25)) >>> 0; + hash = (hash + (hash >>> 6)) >>> 0; + return hash; +} + +const utf8 = (s: string) => new TextEncoder().encode(s); + +export function lmo(po: Po): Uint8Array { + const chunks: Uint8Array[] = []; + const index: { key: number; forms: number; offset: number; length: number }[] = []; + let offset = 0; + const add = (key: number, forms: number, value: Uint8Array) => { + const padded = new Uint8Array(value.length + ((4 - (value.length % 4)) % 4)); + padded.set(value); + index.push({ key, forms, offset, length: value.length }); + chunks.push(padded); + offset += padded.length; + }; + const pf = po.header.find(([k]) => k === 'Plural-Forms'); + if (pf) add(0, 0, utf8(pf[1])); + for (const e of po.entries) { + if (!e.str[0]) continue; + e.str.forEach((s, i) => { + if (!s) return; + const key = utf8(`${e.ctx !== undefined ? `${e.ctx}\u0001` : ''}${e.id}${e.plural !== undefined ? `\u0002${i}` : ''}`); + const value = utf8(s); + const k = sfh(key); + // An unchanged string is left out: LuCI shows the English anyway. + if (k !== sfh(value)) add(k, e.str.length, value); + }); + } + index.sort((a, b) => a.key - b.key); + const out = new Uint8Array(offset + index.length * 16 + (offset > 0 ? 4 : 0)); + const view = new DataView(out.buffer); + let at = 0; + for (const c of chunks) { + out.set(c, at); + at += c.length; + } + for (const x of index) { + for (const v of [x.key, x.forms, x.offset, x.length]) { + view.setUint32(at, v); + at += 4; + } + } + if (offset > 0) view.setUint32(at, offset); + return out; +} + +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { + const [src, dst] = process.argv.slice(2); + if (!src || !dst) { + console.error('usage: node i18n/lmo.ts in.po out.lmo'); + process.exit(2); + } + fs.writeFileSync(dst, lmo(parsePo(fs.readFileSync(src, 'utf8')))); +} diff --git a/web/i18n/po.ts b/web/i18n/po.ts new file mode 100644 index 0000000..3925241 --- /dev/null +++ b/web/i18n/po.ts @@ -0,0 +1,137 @@ +// Gettext catalogs (.pot / .po) as Dawnline writes them: the subset LuCI's +// po2lmo reads. Entries have an optional msgctxt, a msgid, an optional +// msgid_plural and the msgstr (or msgstr[n], one per plural form), with their +// "#:" source references. Strings are one line each and know two escapes, \" +// and \\: po2lmo copies any other escape as written ("\n" stays a backslash and +// an n), so extract.ts refuses newlines and tabs in strings, and backslashes in +// translations. No dates in the header: a catalog changes only when its strings do. +// +// Pure: no files. extract.ts reads and writes the catalogs; the portal's +// bundle turns a .po into a lookup table with catalogOf(). + +export interface Entry { + ctx?: string; + id: string; + plural?: string; + /** The translation: one string, or one per plural form. '' where there is none yet. */ + str: string[]; + /** Where the string is used: "src/admin/pages/people.ts:120". */ + refs: string[]; +} + +export interface Po { + /** Header fields in their order ("Language", "Plural-Forms", …). */ + header: [string, string][]; + entries: Entry[]; +} + +/** An entry's identity: its context and msgid (the plural form shares its msgid's). */ +export const keyOf = (e: { ctx?: string; id: string }) => (e.ctx ? `${e.ctx}\u0004${e.id}` : e.id); + +export const translated = (e: Entry) => e.str.length > 0 && e.str.every((s) => s !== ''); + +/** A quoted po string's content: \" and \\ read, any other escape kept as written (the header's \n). */ +function unquote(s: string, line: number): string { + const m = /^"((?:[^"\\]|\\.)*)"$/.exec(s); + if (!m) throw new Error(`po line ${line}: expected a quoted string, got ${s}`); + return m[1].replace(/\\(.)/g, (all, c: string) => (c === '"' || c === '\\' ? c : all)); +} + +const quote = (s: string) => `"${s.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; + +type Draft = { ctx?: string; id?: string; plural?: string; str: string[]; refs: string[] }; + +export function parsePo(text: string): Po { + const po: Po = { header: [], entries: [] }; + let cur: Draft = { str: [], refs: [] }; + // Where a continuation line ("…") goes: the field the last keyword opened. + let append: ((s: string) => void) | null = null; + const flush = () => { + if (cur.id === '' && cur.ctx === undefined) { + for (const f of (cur.str[0] ?? '').split('\\n')) { + const i = f.indexOf(':'); + if (i > 0) po.header.push([f.slice(0, i).trim(), f.slice(i + 1).trim()]); + } + } else if (cur.id !== undefined) { + const e: Entry = { id: cur.id, str: cur.str.map((s) => s ?? ''), refs: cur.refs }; + if (cur.ctx !== undefined) e.ctx = cur.ctx; + if (cur.plural !== undefined) e.plural = cur.plural; + po.entries.push(e); + } + cur = { str: [], refs: [] }; + }; + text.split(/\r?\n/).forEach((raw, n) => { + const line = raw.trim(); + if (!line) return void (append = null); + if (line.startsWith('#')) { + if (cur.id !== undefined) flush(); + if (line.startsWith('#:')) cur.refs.push(...line.slice(2).trim().split(/\s+/).filter(Boolean)); + append = null; + return; + } + if (line.startsWith('"')) { + if (!append) throw new Error(`po line ${n + 1}: a string outside an entry`); + return append(unquote(line, n + 1)); + } + const m = /^(msgctxt|msgid_plural|msgid|msgstr(?:\[(\d)\])?)\s+(".*")$/.exec(line); + if (!m) throw new Error(`po line ${n + 1}: cannot read ${line}`); + const [, kw, idx, val] = m; + const v = unquote(val, n + 1); + if ((kw === 'msgctxt' || kw === 'msgid') && cur.id !== undefined) flush(); + if (kw === 'msgctxt') { + cur.ctx = v; + append = (s) => (cur.ctx += s); + } else if (kw === 'msgid') { + cur.id = v; + append = (s) => (cur.id += s); + } else if (kw === 'msgid_plural') { + cur.plural = v; + append = (s) => (cur.plural += s); + } else { + const i = idx === undefined ? 0 : Number(idx); + cur.str[i] = v; + append = (s) => (cur.str[i] += s); + } + }); + flush(); + return po; +} + +export function writePo(po: Po): string { + const out = ['msgid ""', 'msgstr ""', ...po.header.map(([k, v]) => `${quote(`${k}: ${v}`).slice(0, -1)}\\n"`), '']; + for (const e of po.entries) { + for (const r of e.refs) out.push(`#: ${r}`); + if (e.ctx !== undefined) out.push(`msgctxt ${quote(e.ctx)}`); + out.push(`msgid ${quote(e.id)}`); + if (e.plural !== undefined) { + out.push(`msgid_plural ${quote(e.plural)}`); + e.str.forEach((s, i) => out.push(`msgstr[${i}] ${quote(s)}`)); + } else out.push(`msgstr ${quote(e.str[0] ?? '')}`); + out.push(''); + } + return out.join('\n'); +} + +/** The number of plural forms a catalog's header declares (2 when it says nothing). */ +export function pluralForms(po: Po): number { + const pf = po.header.find(([k]) => k === 'Plural-Forms')?.[1] ?? ''; + const m = /nplurals\s*=\s*(\d+)/.exec(pf); + return m ? Number(m[1]) : 2; +} + +/** What the portal looks strings up in: translated strings by key, plural forms by the singular's key. */ +export interface Catalog { + s: Record; + p: Record; +} + +/** A .po as a lookup table: translated entries only (an untranslated string stays English). */ +export function catalogOf(po: Po): Catalog { + const c: Catalog = { s: {}, p: {} }; + for (const e of po.entries) { + if (!translated(e)) continue; + if (e.plural !== undefined) c.p[keyOf(e)] = e.str; + else c.s[keyOf(e)] = e.str[0]; + } + return c; +} diff --git a/web/package-lock.json b/web/package-lock.json index b22464e..0aaaae5 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "dawnline-web", - "version": "0.10.0", + "version": "0.11.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dawnline-web", - "version": "0.10.0", + "version": "0.11.0", "license": "MIT", "dependencies": { "qrcode-generator": "1.4.4" diff --git a/web/package.json b/web/package.json index 35d79c3..8887b7d 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "dawnline-web", - "version": "0.10.0", + "version": "0.11.0", "private": true, "license": "MIT", "type": "module", @@ -12,7 +12,9 @@ "test": "vitest run", "format": "prettier --write .", "format:check": "prettier --check .", - "ci": "npm run format:check && npm run typecheck && npm run test && npm run build" + "ci": "npm run format:check && npm run typecheck && npm run i18n:check && npm run test && npm run build", + "i18n": "node i18n/extract.ts", + "i18n:check": "node i18n/extract.ts --check" }, "dependencies": { "qrcode-generator": "1.4.4" diff --git a/web/src/admin/access.ts b/web/src/admin/access.ts index 7b7a589..6350732 100644 --- a/web/src/admin/access.ts +++ b/web/src/admin/access.ts @@ -11,6 +11,7 @@ import { chipToggle, input } from './ui/controls'; import { firstBad, liveField } from './ui/layout'; import { circleNameHelp, ipv4Help, nameHelp, portsHelp } from './netcheck'; import { icon } from '../shared/icons'; +import { fmt, plural } from '../shared/i18n'; type Service = Status['services'][number]; @@ -26,23 +27,23 @@ export const homeAccess = (p: Person) => p.access === 'both' || (p.access === 'l /* ---------- Home services ---------- */ export function serviceDialog(sv: Service | null, prefill: Partial, onSaved: () => unknown) { - const name = input(sv?.name ?? prefill.name ?? '', { placeholder: 'NAS' }); + const name = input(sv?.name ?? prefill.name ?? '', { placeholder: _('NAS') }); const addr = input(sv?.address ?? prefill.address ?? '', { placeholder: '192.168.1.10', class: 'cbi-input-text dl-mono' }); const ports = input((sv?.ports ?? prefill.ports ?? []).join(', '), { - placeholder: 'All ports, or e.g. 445, 5000', + placeholder: _('All ports, or e.g. 445, 5000'), class: 'cbi-input-text dl-mono', }); - const nameRow = liveField('Name', name, () => nameHelp(name.value, [], 'Shown to people who may reach it.')); - const addrRow = liveField('Address', addr, () => ipv4Help(addr.value)); - const portsRow = liveField('Ports', ports, () => portsHelp(ports.value)); + const nameRow = liveField(_('Name', 'circle or service'), name, () => nameHelp(name.value, [], _('Shown to people who may reach it.'))); + const addrRow = liveField(_('Address'), addr, () => ipv4Help(addr.value)); + const portsRow = liveField(_('Ports'), ports, () => portsHelp(ports.value)); modal( - sv ? `Edit ${sv.name}` : 'Add service', + sv ? fmt(_('Edit %s'), sv.name) : _('Add service'), [nameRow, addrRow, portsRow], [ cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { const bad = firstBad([nameRow, addrRow, portsRow]); if (bad) { @@ -50,7 +51,7 @@ export function serviceDialog(sv: Service | null, prefill: Partial, onS return; } const list = ports.value.split(/[ ,]+/).filter(Boolean); - if (await attempt(() => api.serviceSet(sv?.id ?? '', name.value, addr.value, list), 'Saved')) { + if (await attempt(() => api.serviceSet(sv?.id ?? '', name.value, addr.value, list), _('Saved'))) { closeModal(); onSaved(); } @@ -61,41 +62,48 @@ export function serviceDialog(sv: Service | null, prefill: Partial, onS ); } -/** Port groups a device at home offers: what it announces over Bonjour, or the usual ones. */ -const MDNS_LABEL: Record = { - _smb: 'SMB', - _afpovertcp: 'AFP', - _http: 'Web', - _https: 'Web', - _ssh: 'SSH', - _sftp: 'SFTP', - '_sftp-ssh': 'SFTP', - _ipp: 'Printer', - _ipps: 'Printer', - _printer: 'Printer', - '_pdl-datastream': 'Printer', - _airplay: 'AirPlay', - _raop: 'AirPlay', - _rfb: 'Screen sharing', - _googlecast: 'Cast', - _hap: 'HomeKit', - _rdp: 'Remote desktop', - _ftp: 'FTP', -}; -const DEFAULT_PORTS: [string, string[]][] = [ - ['Web', ['80', '443']], - ['SMB', ['445']], - ['SSH', ['22']], -]; +/** The port group a Bonjour service type belongs to, by its name. */ +function mdnsLabels(): Record { + const web = _('Web'); + const printer = _('Printer'); + return { + _smb: 'SMB', + _afpovertcp: 'AFP', + _http: web, + _https: web, + _ssh: 'SSH', + _sftp: 'SFTP', + '_sftp-ssh': 'SFTP', + _ipp: printer, + _ipps: printer, + _printer: printer, + '_pdl-datastream': printer, + _airplay: 'AirPlay', + _raop: 'AirPlay', + _rfb: _('Screen sharing'), + _googlecast: 'Cast', + _hap: 'HomeKit', + _rdp: _('Remote desktop'), + _ftp: 'FTP', + }; +} +/** Port groups a device at home offers: what it announces over Bonjour, or the usual ones. */ function portGroups(h: HomeHost): [string, string[]][] { + const labels = mdnsLabels(); const by = new Map>(); for (const s of h.services) { - const label = MDNS_LABEL[s.type.split('.')[0]]; + const label = labels[s.type.split('.')[0]]; if (!label || !s.port) continue; (by.get(label) ?? by.set(label, new Set()).get(label)!).add(String(s.port)); } - return by.size ? [...by].map(([l, p]) => [l, [...p].sort((a, b) => +a - +b)]) : DEFAULT_PORTS; + return by.size + ? [...by].map(([l, p]) => [l, [...p].sort((a, b) => +a - +b)]) + : [ + [_('Web'), ['80', '443']], + ['SMB', ['445']], + ['SSH', ['22']], + ]; } /** Home services as a live part of Server → Access: `update` repaints it from a new status. */ @@ -118,7 +126,7 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr /** Devices with a change on its way: a second click would add the service twice. */ const busy = new Set(); const list = E('div', { class: 'dl-list' }); - const picker = E('div', { class: 'dl-stack gap8' }, E('span', { class: 'dl-sub' }, 'Looking for devices at home…')); + const picker = E('div', { class: 'dl-stack gap8' }, E('span', { class: 'dl-sub' }, _('Looking for devices at home…'))); const paintRows = () => { const services = st.services; @@ -133,25 +141,30 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr E( 'span', { class: 'dl-mono dl-faint' }, - `${sv.address}${sv.ports.length ? ` · ports ${sv.ports.join(', ')}` : ' · all ports'}`, + `${sv.address} · ${sv.ports.length ? fmt(_('ports %s'), sv.ports.join(', ')) : _('all ports')}`, ), ]), - button('Edit', () => serviceDialog(sv, {}, reload)), + button(_('Edit'), () => serviceDialog(sv, {}, reload)), button( [icon('trash')], async () => { if ( - (await confirmDialog(`Remove ${sv.name}?`, 'People limited to this service lose access to it.', 'Remove', true)) && - (await attempt(() => api.serviceDelete(sv.id), 'Removed')) + (await confirmDialog( + fmt(_('Remove %s?'), sv.name), + _('People limited to this service lose access to it.'), + _('Remove'), + true, + )) && + (await attempt(() => api.serviceDelete(sv.id), _('Removed'))) ) await reload(); }, 'neutral', - { title: 'Remove', 'aria-label': `Remove ${sv.name}` }, + { title: _('Remove'), 'aria-label': fmt(_('Remove %s'), sv.name) }, ), ]), ) - : [E('div', { class: 'dl-row dl-muted' }, 'No services yet: pick ports of a device below.')], + : [E('div', { class: 'dl-row dl-muted' }, _('No services yet: pick ports of a device below.'))], ); }; @@ -164,10 +177,10 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr const sv = st.services.find((s) => s.address === h.address); const ok = ports === null - ? sv && (await attempt(() => api.serviceDelete(sv.id), `${sv.name} removed`)) + ? sv && (await attempt(() => api.serviceDelete(sv.id), fmt(_('%s removed'), sv.name))) : await attempt( () => api.serviceSet(sv?.id ?? '', sv?.name ?? (h.name || h.address), h.address, ports), - sv ? `${sv.name} updated` : `${h.name || h.address} added`, + sv ? fmt(_('%s updated'), sv.name) : fmt(_('%s added'), h.name || h.address), ); if (ok) await reload(); } finally { @@ -187,7 +200,7 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr icon(h.services.some((s) => s.type.startsWith('_ipp') || s.type.startsWith('_printer')) ? 'file' : 'computer'), E('span', { class: 'dl-row-main dl-stack' }, [E('b', {}, h.name || h.address), E('span', { class: 'dl-mono dl-faint' }, h.address)]), E('div', { class: 'dl-chips-row dl-host-ports' }, [ - chip('All ports', all, () => choose(h, all ? null : [])), + chip(_('All ports'), all, () => choose(h, all ? null : [])), ...portGroups(h).map(([label, ports]) => { const on = !all && ports.every((p) => chosen.has(p)); return chip(`${label} ${ports.join(', ')}`, on, () => { @@ -204,15 +217,15 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr } function paintPicker() { - if (failed) return dom.content(picker, E('span', { class: 'dl-sub' }, "Couldn't read the devices at home.")); + if (failed) return dom.content(picker, E('span', { class: 'dl-sub' }, _("Couldn't read the devices at home."))); if (!hosts) return; const r = hosts; - if (!r.hosts.length) return dom.content(picker, E('span', { class: 'dl-sub' }, 'No devices found in the home network right now.')); + if (!r.hosts.length) return dom.content(picker, E('span', { class: 'dl-sub' }, _('No devices found in the home network right now.'))); // Open while there are no services yet (that is where they come from), then as left. const fold = E('details', { class: 'dl-params', open: (open ?? !st.services.length) ? '' : null }, [ E('summary', {}, [ icon('chevron'), - E('span', {}, 'Add from devices at home'), + E('span', {}, _('Add from devices at home')), E('span', { class: 'dl-pcount' }, String(r.hosts.length)), ]), E('div', { class: 'dl-params-body' }, [ @@ -220,8 +233,8 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr 'span', { class: 'dl-sub' }, r.mdns - ? 'Ports they announce over Bonjour. Pick what to open, or all ports.' - : 'Devices that got an address from this router. Pick the ports to open, or all ports.', + ? _('Ports they announce over Bonjour. Pick what to open, or all ports.') + : _('Devices that got an address from this router. Pick the ports to open, or all ports.'), ), E('div', { class: 'dl-list' }, r.hosts.map(hostRow)), ]), @@ -245,13 +258,13 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr const el = E('div', { class: 'dl-stack gap8' }, [ E('div', { class: 'dl-iflead' }, [ E('div', { class: 'dl-iflead-row' }, [ - E('b', {}, 'Home services'), - button([icon('plus'), ' Add service'], () => serviceDialog(null, {}, reload)), + E('b', {}, _('Home services')), + button([icon('plus'), ' ', _('Add service')], () => serviceDialog(null, {}, reload)), ]), E( 'span', { class: 'dl-sub' }, - 'Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers.', + _('Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers.'), ), ]), list, @@ -271,13 +284,13 @@ export function homeServices(initial: Status, serverId: string, reload: () => Pr export function circleDialog(st: Status, serverId: string, ci: Circle | null, onDone: () => unknown) { const used = new Set(st.circles.filter((c) => c.server === serverId).map((c) => c.color)); - let color = ci?.color ?? CIRCLE_COLORS.findIndex((_, i) => !used.has(i)); + let color = ci?.color ?? CIRCLE_COLORS.findIndex((_c, i) => !used.has(i)); if (color < 0) color = 0; - const name = input(ci?.name ?? '', { placeholder: 'Family' }); + const name = input(ci?.name ?? '', { placeholder: _('Family') }); const people = st.people.filter((p) => p.server === serverId).sort((a, b) => a.name.localeCompare(b.name)); const members = new Set(people.filter((p) => ci && p.circle === ci.id).map((p) => p.id)); - const swatches = E('div', { class: 'dl-swatches', role: 'radiogroup', 'aria-label': 'Colour' }); + const swatches = E('div', { class: 'dl-swatches', role: 'radiogroup', 'aria-label': _('Colour') }); const paintSwatches = () => dom.content( swatches, @@ -288,7 +301,7 @@ export function circleDialog(st: Status, serverId: string, ci: Circle | null, on class: `dl-swatch${i === color ? ' on' : ''}`, style: `--sw:${c}`, 'aria-checked': i === color ? 'true' : 'false', - 'aria-label': `Colour ${i + 1}`, + 'aria-label': fmt(_('Colour %s'), i + 1), click: () => { color = i; paintSwatches(); @@ -309,38 +322,38 @@ export function circleDialog(st: Status, serverId: string, ci: Circle | null, on type: 'button', class: `dl-chipbtn${members.has(p.id) ? ' on' : ''}`, title: !homeAccess(p) - ? `${p.name} has no home access: their devices aren't reachable anyway` + ? fmt(_("%s has no home access: their devices aren't reachable anyway"), p.name) : other - ? `Now in ${other.name}` + ? fmt(_('Now in %s'), other.name) : '', click: (ev: Event) => { if (!members.delete(p.id)) members.add(p.id); (ev.currentTarget as HTMLElement).classList.toggle('on', members.has(p.id)); }, }, - [p.name, !homeAccess(p) ? E('b', {}, 'internet') : other ? E('b', {}, other.name) : ''], + [p.name, !homeAccess(p) ? E('b', {}, _('internet')) : other ? E('b', {}, other.name) : ''], ); }), ); const field = (label: string, el: Node) => E('div', { class: 'cbi-value' }, [E('label', { class: 'cbi-value-title' }, label), E('div', { class: 'cbi-value-field' }, el)]); const others = st.circles.filter((c) => c.server === serverId && c.id !== ci?.id).map((c) => c.name); - const nameRow = liveField('Name', name, () => circleNameHelp(name.value, others)); + const nameRow = liveField(_('Name', 'circle or service'), name, () => circleNameHelp(name.value, others)); modal( - ci ? `Edit ${ci.name}` : 'New circle', + ci ? fmt(_('Edit %s'), ci.name) : _('New circle'), [ nameRow, - field('Colour', swatches), - field('People', chips), - E('p', { class: 'dl-sub' }, 'Devices of people in one circle reach each other. A person is in one circle at a time.'), + field(_('Colour'), swatches), + field(_('People'), chips), + E('p', { class: 'dl-sub' }, _('Devices of people in one circle reach each other. A person is in one circle at a time.')), ], [ ci ? button( - 'Delete', + _('Delete'), async () => { - if (await attempt(() => api.circleDelete(ci.id), `${ci.name} deleted`)) { + if (await attempt(() => api.circleDelete(ci.id), fmt(_('%s deleted'), ci.name))) { closeModal(); onDone(); } @@ -352,14 +365,14 @@ export function circleDialog(st: Status, serverId: string, ci: Circle | null, on cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { const h = nameRow.help(); if (h.bad) { notify(h.text, 'warning'); return; } - if (await attempt(() => api.circleSet(ci?.id ?? '', serverId, name.value, color, [...members]), 'Saved')) { + if (await attempt(() => api.circleSet(ci?.id ?? '', serverId, name.value, color, [...members]), _('Saved'))) { closeModal(); onDone(); } @@ -379,8 +392,8 @@ export function circleChips(st: Status, serverId: string, onDone: () => unknown) const who = st.people.filter((p) => p.circle === c.id).map((p) => p.name); return E( 'button', - { type: 'button', class: 'dl-chip', title: `Edit ${c.name}`, click: () => circleDialog(st, serverId, c, onDone) }, - [circleDot(c), E('b', {}, c.name), E('span', { class: 'dl-faint' }, who.length ? who.join(', ') : 'nobody yet')], + { type: 'button', class: 'dl-chip', title: fmt(_('Edit %s'), c.name), click: () => circleDialog(st, serverId, c, onDone) }, + [circleDot(c), E('b', {}, c.name), E('span', { class: 'dl-faint' }, who.length ? who.join(', ') : _('nobody yet'))], ); }), E( @@ -388,8 +401,8 @@ export function circleChips(st: Status, serverId: string, onDone: () => unknown) { type: 'button', class: 'dl-chip add', - title: 'New circle', - 'aria-label': 'New circle', + title: _('New circle'), + 'aria-label': _('New circle'), click: () => circleDialog(st, serverId, null, onDone), }, icon('plus'), @@ -406,22 +419,23 @@ export function whoReaches(st: Status, srv: Server): HTMLElement { const home = (list: Person[]) => { const kinds = new Set(list.map((p) => (p.access === 'lan' && p.services?.length ? 'services' : p.home_nets?.length ? 'some' : 'all'))); if (!kinds.size) kinds.add('all'); - return yes([...kinds].map((k) => ({ all: 'all networks', some: 'their networks', services: 'services' })[k]).join(' / ')); + const label = { all: _('all networks'), some: _('their networks'), services: _('services') }; + return yes([...kinds].map((k) => label[k]).join(' / ')); }; - const each = () => (srv.mesh === 'off' ? no() : srv.mesh === 'circles' ? yes('circle') : yes()); - const net = srv.lan_like ? 'like home' : 'direct'; + const each = () => (srv.mesh === 'off' ? no() : srv.mesh === 'circles' ? yes(_('circle')) : yes()); + const net = srv.lan_like ? _('like home') : _('direct'); const row = (label: string, list: Person[], cells: Node[]) => E('tr', {}, [ - E('td', {}, [E('b', {}, label), E('div', { class: 'dl-sub' }, `${list.length} ${list.length === 1 ? 'person' : 'people'}`)]), + E('td', {}, [E('b', {}, label), E('div', { class: 'dl-sub' }, plural(list.length, '%s person', '%s people'))]), ...cells.map((c) => E('td', {}, c)), ]); const by = (a: string) => people.filter((p) => p.access === a); return E('section', { class: 'dl-setsec' }, [ E('div', { class: 'dl-setsec-body' }, [ E('div', { class: 'dl-panel-head' }, [ - E('h3', {}, 'Who reaches what'), + E('h3', {}, _('Who reaches what')), E('span', { class: 'dl-spacer' }), - E('span', { class: 'dl-sub' }, 'From the rules on this server'), + E('span', { class: 'dl-sub' }, _('From the rules on this server')), ]), E( 'div', @@ -430,17 +444,19 @@ export function whoReaches(st: Status, srv: Server): HTMLElement { E( 'tr', {}, - ['', 'Internet', 'Home', 'This router', 'Each other'].map((t) => E('th', {}, t)), + ['', _('Internet'), _('Home'), _('This router'), _('Each other')].map((t) => E('th', {}, t)), ), - row('Internet', by('internet'), [yes(net), no(), E('span', { class: 'dl-faint' }, 'DNS'), no()]), - row('Home', by('lan'), [E('span', { class: 'dl-faint' }, 'their own'), home(by('lan')), yes(), each()]), - row('Both', by('both'), [yes(net), home(by('both')), yes(), each()]), + row(_('Internet'), by('internet'), [yes(net), no(), E('span', { class: 'dl-faint' }, 'DNS'), no()]), + row(_('Home'), by('lan'), [E('span', { class: 'dl-faint' }, _('their own')), home(by('lan')), yes(), each()]), + row(_('Both'), by('both'), [yes(net), home(by('both')), yes(), each()]), ]), ), E( 'p', { class: 'dl-sub' }, - 'Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing.', + _( + 'Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing.', + ), ), ]), ]); @@ -458,7 +474,7 @@ export function checkAccess(st: Status, srv: Server): HTMLElement { const end = (placeholder: string, initial: string) => { const sel = E('select', { class: 'cbi-input-select', 'aria-label': placeholder }, [ ...devs.map((d) => E('option', { value: d.id, selected: d.id === initial ? 'selected' : null }, d.label)), - E('option', { value: ADDR, selected: initial === ADDR ? 'selected' : null }, 'Address'), + E('option', { value: ADDR, selected: initial === ADDR ? 'selected' : null }, _('Address')), ]) as HTMLSelectElement; const addr = input('', { placeholder, class: 'cbi-input-text dl-mono' }); const wrap = E('div', { class: 'dl-check-end' }, [sel, addr]); @@ -476,8 +492,8 @@ export function checkAccess(st: Status, srv: Server): HTMLElement { const stop = r.steps.findIndex((s) => !s.ok); dom.content(out, [ E('div', { class: `dl-verdict ${r.ok ? 'ok' : 'bad'}` }, [ - E('b', {}, r.ok ? 'Allowed' : 'Blocked'), - E('span', { class: 'dl-sub' }, r.ok ? 'Every step lets it through' : `Stops at step ${stop + 1} of ${r.steps.length}`), + E('b', {}, r.ok ? _('Allowed') : _('Blocked')), + E('span', { class: 'dl-sub' }, r.ok ? _('Every step lets it through') : fmt(_('Stops at step %s of %s'), stop + 1, r.steps.length)), ]), E( 'ul', @@ -497,11 +513,11 @@ export function checkAccess(st: Status, srv: Server): HTMLElement { return E('section', { class: 'dl-setsec' }, [ E('div', { class: 'dl-setsec-body' }, [ E('div', { class: 'dl-panel-head' }, [ - E('h3', {}, 'Check access'), + E('h3', {}, _('Check access')), E('span', { class: 'dl-spacer' }), - E('span', { class: 'dl-sub' }, 'Why something does or does not connect'), + E('span', { class: 'dl-sub' }, _('Why something does or does not connect')), ]), - E('div', { class: 'dl-check-form' }, [from.el, E('span', { class: 'dl-faint' }, '→'), to.el, button('Check', run)]), + E('div', { class: 'dl-check-form' }, [from.el, E('span', { class: 'dl-faint' }, '→'), to.el, button(_('Check'), run)]), out, ]), ]); diff --git a/web/src/admin/api.ts b/web/src/admin/api.ts index 90360ff..e126b12 100644 --- a/web/src/admin/api.ts +++ b/web/src/admin/api.ts @@ -5,6 +5,7 @@ import type { Network, PortHold } from './netcheck'; import type { AwgCaps, AwgState, Circle, ClientConfig, DayUsage, HealthCheck, LogEvent, MeshMode, Person, Status } from '../shared/types'; import { notify } from './ui/toast'; +import { lang } from '../shared/i18n'; /** Throw a backend failure; show a warning the answer carries. */ function settle(r: any): T { @@ -15,9 +16,13 @@ function settle(r: any): T { return r as T; } +/** + * A method of luci.dawnline. The page's language goes last, after the + * method's own arguments: the router writes its messages in it. + */ function call(method: string, params: string[] = []) { - const fn = rpc.declare({ object: 'luci.dawnline', method, params }); - return async (...args: unknown[]): Promise => settle(await fn(...args)); + const fn = rpc.declare({ object: 'luci.dawnline', method, params: [...params, 'lang'] }); + return async (...args: unknown[]): Promise => settle(await fn(...params.map((_p, i) => args[i]), lang())); } export interface SetupDefaults { @@ -129,6 +134,8 @@ export interface UpdatesStatus { history: UpdateEvent[]; /** AmneziaWG interfaces (their Dawnline names): switching builds restarts them. */ tunnels: string[]; + /** The admin's translations installed (luci-i18n-dawnline-): "ru". */ + translations?: string[]; } export interface UpdateEvent { diff --git a/web/src/admin/cores/awg.ts b/web/src/admin/cores/awg.ts index 0cb21d6..67dc726 100644 --- a/web/src/admin/cores/awg.ts +++ b/web/src/admin/cores/awg.ts @@ -16,6 +16,7 @@ import { keepaliveHelp, mtuHelp, portHelp, type PortHold } from '../netcheck'; import { vpnKey } from '../../shared/vpnkey'; import { icon } from '../../shared/icons'; import { methodInfo, methodPicker, type Method, defaultMethod, legacyTitle } from '../disguise'; +import { fmt, fill, num, plural } from '../../shared/i18n'; import { coreHead, type Core, type CoreCtx } from './common'; /** `.conf` names of the disguise parameters, in file order. */ @@ -73,31 +74,38 @@ function paramsView(o: Record): HTMLElement | null { }; const jc = Number(o.jc || 0); const signature = (o.i1 ?? '').includes('0x8580') - ? 'A first packet shaped like a DNS answer.' - : 'Extra packets sent before the handshake.'; + ? _('A first packet shaped like a DNS answer.') + : _('Extra packets sent before the handshake.'); const conf = keys.map(([k, n]) => `${n} = ${o[k]}`).join('\n'); const body = E('div', { class: 'dl-pgrid' }, [ group( - 'Junk packets', + _('Junk packets'), 'zap', - jc ? `${jc} random packet${jc === 1 ? '' : 's'} of ${o.jmin}–${o.jmax} bytes before each handshake.` : 'No junk packets.', + jc + ? fmt( + N_(jc, '%s random packet of %s–%s bytes before each handshake.', '%s random packets of %s–%s bytes before each handshake.'), + num(jc), + o.jmin, + o.jmax, + ) + : _('No junk packets.'), ['jc', 'jmin', 'jmax'], ), - group('Padding', 'archive', 'Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.', [ - 's1', - 's2', - 's3', - 's4', - ]), - group('Packet types', 'key', 'The values that replace WireGuard’s recognisable message types.', ['h1', 'h2', 'h3', 'h4']), - group('Signatures', 'globe', signature, ['i1', 'i2', 'i3', 'i4', 'i5']), - group('Protection', 'lock', 'AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.', [ + group( + _('Padding'), + 'archive', + _('Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.'), + ['s1', 's2', 's3', 's4'], + ), + group(_('Packet types'), 'key', _('The values that replace WireGuard’s recognisable message types.'), ['h1', 'h2', 'h3', 'h4']), + group(_('Signatures'), 'globe', signature, ['i1', 'i2', 'i3', 'i4', 'i5']), + group(_('Protection'), 'lock', _('AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.'), [ 'header_protection_key', 'content_padding_addition', 'random_trailers', 'disable_cookies', ]), - group('Timing', 'clock', 'Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.', [ + group(_('Timing'), 'clock', _('Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.'), [ 'rekey_after_time', 'rekey_timeout', 'reject_after_time', @@ -108,7 +116,7 @@ function paramsView(o: Record): HTMLElement | null { return E('details', { class: 'dl-params' }, [ E('summary', {}, [ icon('chevron'), - E('span', {}, 'Current parameters'), + E('span', {}, _('Current parameters')), E('span', { class: 'dl-pcount' }, String(keys.length)), E('span', { class: 'dl-spacer' }), E( @@ -118,10 +126,10 @@ function paramsView(o: Record): HTMLElement | null { class: 'dl-linkbtn', click: (ev: Event) => { ev.preventDefault(); - copyText(conf, 'Parameters copied'); + copyText(conf, _('Parameters copied')); }, }, - 'Copy as config', + _('Copy as config'), ), ]), body, @@ -158,11 +166,11 @@ function fileCard(cfg: AwgConfig): HTMLElement { click: (ev: Event) => { ev.preventDefault(); reveal = !reveal; - dom.content(eye, [icon(reveal ? 'x' : 'key'), reveal ? 'Hide key' : 'Show key']); + dom.content(eye, [icon(reveal ? 'x' : 'key'), reveal ? _('Hide key') : _('Show key')]); paint(); }, }, - [icon('key'), 'Show key'], + [icon('key'), _('Show key')], ); paint(); const size = new Blob([cfg.conf]).size; @@ -171,14 +179,14 @@ function fileCard(cfg: AwgConfig): HTMLElement { E('span', { class: 'dl-filecard-ic' }, '.conf'), E('span', { class: 'dl-stack' }, [ E('span', { class: 'dl-mono dl-ellipsis' }, cfg.filename), - E('span', { class: 'dl-sub' }, `AmneziaWG · ${size} bytes`), + E('span', { class: 'dl-sub' }, `AmneziaWG · ${plural(size, '%s byte', '%s bytes')}`), ]), - button([icon('download'), ' Download'], () => downloadFile(cfg.filename, cfg.conf, 'application/octet-stream'), 'positive'), + button([icon('download'), ' ', _('Download')], () => downloadFile(cfg.filename, cfg.conf, 'application/octet-stream'), 'positive'), ]), E('details', { class: 'dl-params' }, [ E('summary', {}, [ icon('chevron'), - E('span', {}, 'Configuration'), + E('span', {}, _('Configuration')), E('span', { class: 'dl-spacer' }), eye, E( @@ -188,10 +196,10 @@ function fileCard(cfg: AwgConfig): HTMLElement { class: 'dl-chipbtn', click: (ev: Event) => { ev.preventDefault(); - copyText(cfg.conf, 'Configuration copied'); + copyText(cfg.conf, _('Configuration copied')); }, }, - [icon('copy'), 'Copy'], + [icon('copy'), _('Copy')], ), ]), pre, @@ -212,7 +220,7 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr return E( 'div', { class: 'dl-hint' }, - 'This device generated its own keys in the browser, so its full configuration only exists on that device.', + _('This device generated its own keys in the browser, so its full configuration only exists on that device.'), ); const key = await vpnKey(cfg, cfg.server); const panes: Record Node> = { @@ -222,13 +230,20 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr E( 'span', { class: 'dl-sub' }, - plainWg(cfg) ? 'Scan with AmneziaVPN or any WireGuard app on the device.' : 'Scan with AmneziaVPN or AmneziaWG on the device.', + plainWg(cfg) + ? _('Scan with AmneziaVPN or any WireGuard app on the device.') + : _('Scan with AmneziaVPN or AmneziaWG on the device.'), ), ]), key: () => E('div', { class: 'dl-stack gap8' }, [ - E('div', { class: 'dl-linkbox' }, [E('span', { class: 'dl-mono' }, key), button('Copy', () => copyText(key, 'Key copied'))]), - E('span', { class: 'dl-sub' }, 'AmneziaVPN → Add server → Insert key. Keep it private.'), + E('div', { class: 'dl-linkbox' }, [E('span', { class: 'dl-mono' }, key), button(_('Copy'), () => copyText(key, _('Key copied')))]), + // The app's own labels (portal/setup.ts has where they come from): + in its bottom bar, Insert, Continue. + E( + 'span', + { class: 'dl-sub' }, + fmt(_('AmneziaVPN → %s. Keep it private.'), ['+', _('Insert', 'AmneziaVPN app'), _('Continue', 'AmneziaVPN app')].join(' → ')), + ), ]), file: () => fileCard(cfg), }; @@ -239,9 +254,9 @@ export async function connectBlock(cfg: AwgConfig, initial: 'file' | 'key' | 'qr dom.content(body, panes[id]()); }; for (const [id, label] of [ - ['file', 'File'], - ['key', 'Key'], - ['qr', 'QR code'], + ['file', _('File')], + ['key', _('Key')], + ['qr', _('QR code')], ]) seg.appendChild(E('button', { type: 'button', 'data-id': id, click: () => show(id) }, label)); show(initial); @@ -254,14 +269,24 @@ async function applyDisguise(ctx: CoreCtx, srv: Server, m: Method, same: boolean const people = ctx.st.people.filter((p) => p.server === srv.id); const devices = people.reduce((n, p) => n + p.devices.length, 0); const ok = await confirmDialog( - same ? 'Generate new disguise values?' : `Switch to ${info.title}?`, - `${devices} AmneziaWG device${devices === 1 ? ' stops' : 's stop'} connecting until ${devices === 1 ? 'it imports its' : 'they import their'} configuration again (from their personal link or from you).${m === 'max' ? ' They need an app with AmneziaWG 3.1.' : m === 'balanced' ? ' They need an app with AmneziaWG 2.0 or newer.' : ''}${ctx.st.servers.length === 1 && devices ? ' To keep the old disguise for some people, add a second server and move them there.' : ''}`, - same ? 'Generate and apply' : 'Switch and apply', + same ? _('Generate new disguise values?') : fmt(_('Switch to %s?'), info.title), + [ + plural( + devices, + '%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).', + '%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you).', + ), + m === 'max' ? _('They need an app with AmneziaWG 3.1.') : m === 'balanced' ? _('They need an app with AmneziaWG 2.0 or newer.') : '', + ctx.st.servers.length === 1 && devices ? _('To keep the old disguise for some people, add a second server and move them there.') : '', + ] + .filter(Boolean) + .join(' '), + same ? _('Generate and apply') : _('Switch and apply'), true, ); if (!ok) return; - if (await attempt(() => api.serverObfuscation(srv.id, m), same ? 'New values applied' : `${info.title} applied`)) { - notify('Devices are marked “Update config” until they import again.', 'info', 6000); + if (await attempt(() => api.serverObfuscation(srv.id, m), same ? _('New values applied') : fmt(_('%s applied'), info.title))) { + notify(_('Devices are marked “Update config” until they import again.'), 'info', 6000); await ctx.refresh(); } } @@ -271,7 +296,7 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { const st: Status = ctx.st; const port = input(String(srv.port), { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }); const mtu = input(srv.mtu ? String(srv.mtu) : '', { - placeholder: 'Auto', + placeholder: _('Auto'), inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono', }); @@ -280,17 +305,25 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { let selected: Method = current ?? defaultMethod(st.awg); const apply = button('', () => applyDisguise(ctx, srv, selected, selected === current), 'neutral'); const label = () => - dom.content(apply, selected === current ? [icon('reset'), ' Generate new values'] : [`Switch to ${methodInfo(selected)!.title}`]); + dom.content( + apply, + selected === current ? [icon('reset'), ' ', _('Generate new values')] : [fmt(_('Switch to %s'), methodInfo(selected)!.title)], + ); label(); const tools = st.awg_state?.tools !== false; // Who holds which port arrives once the card is built (netstat on the // router); until then the port is only checked for its range. let holds: PortHold[] = []; - const portRow = liveRow('UDP port', port, () => + const portRow = liveRow(_('UDP port'), port, () => portHelp( Number(port.value), holds, - `Opened on the WAN firewall automatically.${Number(port.value) === 4500 ? ' 4500 is IPsec’s port: most networks let it through.' : ''}`, + [ + _('Opened on the WAN firewall automatically.'), + Number(port.value) === 4500 ? _('4500 is IPsec’s port: most networks let it through.') : '', + ] + .filter(Boolean) + .join(' '), ), ); api @@ -301,27 +334,30 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { }) .catch(() => {}); const mtuRow = liveRow('MTU', mtu, () => mtuHelp(mtu.value, srv.mtus)); - const kaRow = liveRow('Keep-alive', ka, () => keepaliveHelp(ka.value)); + const kaRow = liveRow(_('Keep-alive'), ka, () => keepaliveHelp(ka.value)); return card( '', [ coreHead('AmneziaWG', srv.ifname), - group('globe', 'Listening', 'Where devices reach this core from the internet', [portRow]), - group('file', 'In every device configuration', 'Changing these marks devices “Update config” until they import again', [ + group('globe', _('Listening'), _('Where devices reach this core from the internet'), [portRow]), + group('file', _('In every device configuration'), _('Changing these marks devices “Update config” until they import again'), [ mtuRow, kaRow, ]), - group('shield', 'Disguise', 'So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard', [ + group('shield', _('Disguise'), _('So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard'), [ // A server from before 0.8 on the old junk-only disguise: it runs, but is no longer offered. legacyTitle(srv.preset) - ? callout('warn', [ - E('b', {}, legacyTitle(srv.preset)!), - ' is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to ', - E('b', {}, 'Balanced'), - ' or ', - E('b', {}, 'Maximum'), - ': devices import their configuration again.', - ]) + ? callout( + 'warn', + fill( + _( + '%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again.', + ), + E('b', {}, legacyTitle(srv.preset)!), + E('b', {}, _('Balanced')), + E('b', {}, _('Maximum')), + ), + ) : '', methodPicker( st.awg, @@ -335,29 +371,31 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { ), // Only about an installed AmneziaWG: without one the server page says what to install. tools && !st.awg.v3 - ? callout('info', [ - 'This router runs an older AmneziaWG. ', - E('b', {}, 'Maximum'), - ' becomes available with kmod-amneziawg and amneziawg-tools 3.1.', - ]) + ? callout( + 'info', + fill( + _('This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1.'), + E('b', {}, _('Maximum')), + ), + ) : '', paramsView(srv.obf ?? {}) ?? '', E('div', { class: 'dl-row-end' }, [ - E('span', { class: 'dl-sub' }, 'Applies at once: every AmneziaWG device imports its configuration again.'), + E('span', { class: 'dl-sub' }, _('Applies at once: every AmneziaWG device imports its configuration again.')), apply, ]), ]), E('details', { class: 'dl-params' }, [ - E('summary', {}, [icon('chevron'), E('span', {}, 'Tunnel'), E('span', { class: 'dl-pcount' }, '3')]), + E('summary', {}, [icon('chevron'), E('span', {}, _('Tunnel')), E('span', { class: 'dl-pcount' }, '3')]), E('div', { class: 'dl-params-body' }, [ - row('Interface', E('span', { class: 'dl-mono' }, `${srv.ifname} · router ${srv.address}`)), - row('Tunnel subnet', E('span', { class: 'dl-mono' }, srv.subnet), 'Device addresses come from it.'), + row(_('Interface'), E('span', { class: 'dl-mono' }, `${srv.ifname} · ${fmt(_('router %s'), srv.address)}`)), + row(_('Tunnel subnet'), E('span', { class: 'dl-mono' }, srv.subnet), _('Device addresses come from it.')), row( - 'Server public key', + _('Server public key'), E('span', { class: 'dl-keyrow' }, [ E('code', { class: 'dl-mono' }, srv.public_key), - button([icon('copy')], () => copyText(srv.public_key, 'Public key copied'), 'neutral', { - title: 'Copy', + button([icon('copy')], () => copyText(srv.public_key, _('Public key copied')), 'neutral', { + title: _('Copy'), class: 'cbi-button cbi-button-neutral dl-icon-only sm', }), ]), @@ -366,9 +404,9 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { ]), ], [ - E('span', { class: 'dl-sub' }, 'Port, MTU and keep-alive apply at once.'), + E('span', { class: 'dl-sub' }, _('Port, MTU and keep-alive apply at once.')), button( - 'Save', + _('Save'), () => { // The help lines already say what is wrong: do not send it anyway. const bad = firstBad([portRow, mtuRow, kaRow]); @@ -376,7 +414,7 @@ export function settingsCard(ctx: CoreCtx, srv: Server): HTMLElement { notify(bad, 'warning'); return; } - return ctx.save({ port: port.value, mtu: mtu.value, keepalive: ka.value }, 'AmneziaWG saved'); + return ctx.save({ port: port.value, mtu: mtu.value, keepalive: ka.value }, _('AmneziaWG saved')); }, 'positive', ), @@ -395,30 +433,30 @@ function overviewTile(srv: Server): HTMLElement { [0, 1, 2, 3].map((i) => E('i', { class: i < n ? 'on' : '' })), ); const chips: string[] = []; - if (+o.jc) chips.push(`${o.jc} junk · ${o.jmin}–${o.jmax} B`); + if (+o.jc) chips.push(`${plural(+o.jc, '%s junk', '%s junk')} · ${o.jmin}–${o.jmax} ${_('B')}`); const pad = ['s1', 's2', 's3', 's4'].filter((k) => +o[k]).map((k) => `${k.toUpperCase()} ${o[k]}`); if (pad.length) chips.push(pad.slice(0, 2).join(' · ') + (pad.length > 2 ? ` +${pad.length - 2}` : '')); - if (['h1', 'h2', 'h3', 'h4'].some((k) => o[k] && o[k] !== String(['h1', 'h2', 'h3', 'h4'].indexOf(k) + 1))) chips.push('H1–H4 random'); - if (o.i1) chips.push(/0x(8580|0100)0001/.test(o.i1) ? 'DNS-like first packets' : 'Signature packets'); - if (o.header_protection_key) chips.push('Encrypted headers'); - if (!chips.length) chips.push(m?.id === 'off' ? 'Plain WireGuard' : 'No values yet'); + if (['h1', 'h2', 'h3', 'h4'].some((k) => o[k] && o[k] !== String(['h1', 'h2', 'h3', 'h4'].indexOf(k) + 1))) chips.push(_('H1–H4 random')); + if (o.i1) chips.push(/0x(8580|0100)0001/.test(o.i1) ? _('DNS-like first packets') : _('Signature packets')); + if (o.header_protection_key) chips.push(_('Encrypted headers')); + if (!chips.length) chips.push(m?.id === 'off' ? _('Plain WireGuard') : _('No values yet')); return E('div', { class: 'dl-bento-tile dl-disg' }, [ E('div', { class: 'dl-bento-head' }, [ - E('span', { class: 'dl-metric-label' }, 'Disguise'), - E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}§ion=awg` }, 'Change'), + E('span', { class: 'dl-metric-label' }, _('Disguise')), + E('a', { href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(srv.id)}§ion=awg` }, _('Change')), ]), E('div', { class: 'dl-disg-id' }, [ E('span', { class: `dl-disg-ic${m?.id === 'off' ? ' off' : ''}` }, icon(m?.ic ?? 'shield')), E('span', { class: 'dl-stack' }, [ - E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? 'Custom')), - E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? 'Switch to Balanced or Maximum' : 'Set by hand'), + E('b', {}, m ? m.title : (legacyTitle(srv.preset) ?? _('Custom', 'disguise'))), + E('span', { class: 'dl-sub' }, m ? m.short : legacyTitle(srv.preset) ? _('Switch to Balanced or Maximum') : _('Set by hand')), ]), ]), m ? E('div', { class: 'dl-disg-meters' }, [ - E('span', {}, 'Stealth'), + E('span', {}, _('Stealth')), segs(m.stealth, 'acc'), - E('span', {}, 'Speed'), + E('span', {}, _('Speed')), segs(m.speed, 'ok'), ]) : '', @@ -437,6 +475,17 @@ export const awg: Core = { overviewTile, connectBlock, qrText: (cfg) => cfg.conf, - appKey: { label: 'Copy AmneziaVPN config', make: (cfg) => vpnKey(cfg, cfg.server) }, - file: { label: 'Download AmneziaWG config', make: (cfg) => ({ name: cfg.filename, text: cfg.conf }) }, + // Labels are getters: the text is made when a menu is drawn. + appKey: { + get label() { + return _('Copy AmneziaVPN config'); + }, + make: (cfg) => vpnKey(cfg, cfg.server), + }, + file: { + get label() { + return _('Download AmneziaWG config'); + }, + make: (cfg) => ({ name: cfg.filename, text: cfg.conf }), + }, }; diff --git a/web/src/admin/device.ts b/web/src/admin/device.ts index f1c916a..2d9d28f 100644 --- a/web/src/admin/device.ts +++ b/web/src/admin/device.ts @@ -15,7 +15,8 @@ import { liveField } from './ui/layout'; import { qrCode } from './ui/qr'; import { nameHelp } from './netcheck'; import { deviceStatus } from './ui/badges'; -import { ago, bytes, isoDay, KIND_LABEL, KINDS, todayOf } from '../shared/format'; +import { ago, bytes, isoDay, kindLabel, KINDS, todayOf } from '../shared/format'; +import { fill, fmt, locale, num } from '../shared/i18n'; import { icon } from '../shared/icons'; import { eventBy } from './events/model'; import { spark } from './widgets/spark'; @@ -43,7 +44,7 @@ export interface DeviceOpts { function when(ts: number): string { return ts - ? new Date(ts * 1000).toLocaleString('en-GB', { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }) + ? new Date(ts * 1000).toLocaleString(locale(), { day: 'numeric', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' }) : '—'; } @@ -52,7 +53,12 @@ function copyRow(label: string, value: string, mono = false): HTMLElement { E('span', { class: 'dl-kvrow-k' }, label), E( 'button', - { type: 'button', class: `dl-kvrow-v copy${mono ? ' dl-mono' : ''}`, title: 'Copy', click: () => copyText(value, `${label} copied`) }, + { + type: 'button', + class: `dl-kvrow-v copy${mono ? ' dl-mono' : ''}`, + title: _('Copy'), + click: () => copyText(value, fmt(_('%s copied'), label)), + }, [E('span', {}, value), icon('copy')], ), ]); @@ -62,46 +68,55 @@ function row(label: string, value: Node | string): HTMLElement { return E('div', { class: 'dl-kvrow' }, [E('span', { class: 'dl-kvrow-k' }, label), E('span', { class: 'dl-kvrow-v' }, value)]); } -const DEV_EVENT: Record = { - connect: ['ok', 'Connected', 'plug'], - disconnect: ['', 'Went offline', 'plug'], - roam: ['', 'Changed network', 'network'], - device_added: ['ok', 'Added', 'plus'], - device_removed: ['', 'Removed', 'trash'], - device_keys: ['', 'New keys', 'reset'], +/** The device's own events: tone and icon (what they say is in eventText). */ +const DEV_EVENT: Record = { + connect: ['ok', 'plug'], + disconnect: ['', 'plug'], + roam: ['', 'network'], + device_added: ['ok', 'plus'], + device_removed: ['', 'trash'], + device_keys: ['', 'reset'], }; +/** What happened in the text colour, the details muted (as in the main log). */ +function eventText(e: LogEvent): (string | HTMLElement)[] { + const m = (t: string) => E('span', { class: 'dl-muted' }, t); + const by = eventBy(e) === 'portal' ? _('on the portal') : eventBy(e) === 'admin' ? _('by you') : ''; + switch (e.type) { + case 'connect': + return [...(e.detail ? fill(_('Connected from %s'), m(e.detail)) : [_('Connected')]), e.where ? m(` · ${e.where}`) : '']; + case 'disconnect': + return [_('Went offline')]; + case 'roam': + return [_('Changed network'), m(` · ${e.detail ?? ''}`)]; + case 'device_added': + return by ? fill(_('Added %s'), m(by)) : [_('Added')]; + case 'device_removed': + return by ? fill(_('Removed %s'), m(by)) : [_('Removed')]; + default: // device_keys + return by ? fill(_('New keys %s'), m(by)) : [_('New keys')]; + } +} + /** Activity of one device, newest first. */ function deviceEvents(events: LogEvent[], id: string, now?: number): HTMLElement { const mine = events .filter((e) => e.device === id && DEV_EVENT[e.type]) .reverse() .slice(0, 12); - if (!mine.length) return E('div', { class: 'dl-sub' }, 'No activity yet.'); + if (!mine.length) return E('div', { class: 'dl-sub' }, _('No activity yet.')); return E( 'div', { class: 'dl-dev-log' }, mine.map((e) => { - const [tone, label, ic] = DEV_EVENT[e.type]; - // As in the main log: what happened in the text colour, the details muted. - const extra = - e.type === 'connect' - ? [ - e.detail ? E('span', { class: 'dl-muted' }, ` from ${e.detail}`) : '', - e.where ? E('span', { class: 'dl-muted' }, ` · ${e.where}`) : '', - ] - : e.type === 'roam' - ? [E('span', { class: 'dl-muted' }, ` · ${e.detail ?? ''}`)] - : e.type === 'device_added' || e.type === 'device_removed' || e.type === 'device_keys' - ? [E('span', { class: 'dl-muted' }, eventBy(e) === 'portal' ? ' on the portal' : eventBy(e) === 'admin' ? ' by you' : '')] - : []; + const [tone, ic] = DEV_EVENT[e.type]; const t = new Date(e.ts * 1000); return E('div', { class: `dl-dev-log-row${eventBy(e) === 'admin' ? ' dl-ev-by-admin' : ''}` }, [ eventBy(e) === 'admin' - ? E('span', { class: 'dl-ev-tile', title: 'Done by you in LuCI' }, icon('admin')) + ? E('span', { class: 'dl-ev-tile', title: _('Done by you in LuCI') }, icon('admin')) : E('span', { class: `dl-ev-tile ev ${tone}` }, icon(ic)), - E('span', { class: 'dl-row-main' }, [E('span', {}, label), ...extra]), - E('span', { class: 'dl-faint dl-nowrap', title: t.toLocaleString() }, ago(e.ts, now)), + E('span', { class: 'dl-row-main' }, eventText(e)), + E('span', { class: 'dl-faint dl-nowrap', title: t.toLocaleString(locale()) }, ago(e.ts, now)), ]); }), ); @@ -131,7 +146,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { const titleEl = E('div', { class: 'dl-drawer-title' }); const stats = E('div', {}); const details = E('div', {}); - const log = E('div', {}, E('div', { class: 'dl-sub' }, 'Loading…')); + const log = E('div', {}, E('div', { class: 'dl-sub' }, _('Loading…'))); let logEvents: LogEvent[] = []; const showLog = (events: LogEvent[]) => { logEvents = events.filter((e) => e.device === d.id); @@ -157,9 +172,9 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { E('div', { class: 'dl-stack' }, [ E('div', { class: 'dl-title-row' }, [ E('h3', {}, d.name), - button([icon('edit')], () => rename(), 'neutral', { title: 'Rename', class: 'cbi-button cbi-button-neutral dl-icon-only sm' }), + button([icon('edit')], () => rename(), 'neutral', { title: _('Rename'), class: 'cbi-button cbi-button-neutral dl-icon-only sm' }), ]), - E('span', { class: 'dl-sub' }, `${p.name} · ${KIND_LABEL[d.kind]}`), + E('span', { class: 'dl-sub' }, `${p.name} · ${kindLabel(d.kind)}`), ]), ]); const week = d.spark.reduce((a, b) => a + b, 0); @@ -167,16 +182,16 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { stats, E('div', { class: 'dl-dstats' }, [ E('div', { class: 'dl-dstats-cell wide' }, [ - E('span', { class: 'dl-metric-label' }, 'Status'), - deviceStatus(d, now, 'Waiting for the first connection', p), + E('span', { class: 'dl-metric-label' }, _('Status')), + deviceStatus(d, now, _('Waiting for the first connection'), p), ]), E('div', { class: 'dl-dstats-cell' }, [ - E('span', { class: 'dl-metric-label' }, 'This month'), + E('span', { class: 'dl-metric-label' }, _('This month')), E('b', {}, bytes(d.month[0] + d.month[1])), E('span', { class: 'dl-sub dl-mono' }, `↓ ${bytes(d.month[1])} ↑ ${bytes(d.month[0])}`), ]), E('div', { class: 'dl-dstats-cell' }, [ - E('span', { class: 'dl-metric-label' }, 'Last 7 days'), + E('span', { class: 'dl-metric-label' }, _('Last 7 days')), E('b', {}, bytes(week)), spark(d.spark, 120, 22, today), ]), @@ -185,13 +200,13 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { dom.content( details, E('div', { class: 'dl-kv2' }, [ - copyRow('Tunnel address', d.address), - d.hostname && p.access !== 'internet' ? copyRow('Local address', d.hostname) : '', + copyRow(_('Tunnel address'), d.address), + d.hostname && p.access !== 'internet' ? copyRow(_('Local address'), d.hostname) : '', // Where it connects from is under Locations (with the place and network); from home // (not on the map) or without locations, here. - d.endpoint && !geo?.points.some((x) => x.device === d.id && x.ip === d.endpoint) ? row('Client IP', d.endpoint) : '', + d.endpoint && !geo?.points.some((x) => x.device === d.id && x.ip === d.endpoint) ? row(_('Client IP'), d.endpoint) : '', row( - 'Total', + _('Total'), E('span', { class: 'dl-kv-act' }, [ `↓ ${bytes(d.total[1])} · ↑ ${bytes(d.total[0])}`, E( @@ -201,36 +216,36 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { class: 'dl-linkbtn danger', click: () => resetUsageDialog('device', d.id, d.name, () => setTimeout(changed, 300)), }, - 'Reset', + _('Reset'), ), ]), ), - row('Added', `${when(d.created)} · ${d.created_by === 'portal' ? 'from the portal' : 'by you'}`), + row(_('Added'), `${when(d.created)} · ${d.created_by === 'portal' ? _('from the portal') : _('by you')}`), // The whole key, copyable: it is what another WireGuard server needs to add this device by hand. - cfg.amnezia.client_pub_key ? copyRow('Public key', cfg.amnezia.client_pub_key) : row('Public key', '—'), + cfg.amnezia.client_pub_key ? copyRow(_('Public key'), cfg.amnezia.client_pub_key) : row(_('Public key'), '—'), ]), ); dom.content(foot, [ button( - [icon(d.disabled ? 'play' : 'pause'), d.disabled ? ' Enable' : ' Disable'], + [icon(d.disabled ? 'play' : 'pause'), ' ', d.disabled ? _('Enable') : _('Disable')], async () => { - if (await attempt(() => api.deviceUpdate(d.id, undefined, !d.disabled), d.disabled ? 'Device enabled' : 'Device disabled')) + if (await attempt(() => api.deviceUpdate(d.id, undefined, !d.disabled), d.disabled ? _('Device enabled') : _('Device disabled'))) await changed(); }, 'neutral', d.disabled ? {} : { class: 'cbi-button cbi-button-neutral dl-btn-warn' }, ), - button([icon('key'), ' New keys'], async () => { + button([icon('key'), ' ', _('New keys')], async () => { if ( !(await confirmDialog( - 'Generate new keys?', - 'The current configuration on this device stops working until it is imported again.', - 'Generate', + _('Generate new keys?'), + _('The current configuration on this device stops working until it is imported again.'), + _('Generate'), true, )) ) return; - const c = await attempt(() => api.deviceRotate(d.id), 'New keys generated'); + const c = await attempt(() => api.deviceRotate(d.id), _('New keys generated')); if (c) { o.refresh(); handle.close(); @@ -239,18 +254,18 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { }), E('span', { class: 'dl-spacer' }), button( - [icon('trash'), ' Remove'], + [icon('trash'), ' ', _('Remove')], async () => { if ( !(await confirmDialog( - `Remove ${d.name}?`, - 'The device is disconnected immediately and its configuration stops working.', - 'Remove', + fmt(_('Remove %s?'), d.name), + _('The device is disconnected immediately and its configuration stops working.'), + _('Remove'), true, )) ) return; - if (await attempt(() => api.deviceDelete(d.id), 'Device removed')) { + if (await attempt(() => api.deviceDelete(d.id), _('Device removed'))) { handle.close(); o.refresh(); } @@ -283,22 +298,22 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { const rename = () => { const input = E('input', { type: 'text', class: 'cbi-input-text', value: d.name, maxlength: 48 }) as HTMLInputElement; const taken = p.devices.filter((x) => x.id !== d.id).map((x) => x.name); - const nameRow = liveField('Name', input, () => nameHelp(input.value, taken, 'Shown in the portal and in the app.')); + const nameRow = liveField(_('Name'), input, () => nameHelp(input.value, taken, _('Shown in the portal and in the app.'))); modal( - `Rename ${d.name}`, + fmt(_('Rename %s'), d.name), [nameRow], [ cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { const h = nameRow.help(); if (h.bad) { notify(h.text, 'warning'); return; } - if (await attempt(() => api.deviceUpdate(d.id, input.value, undefined), 'Renamed')) { + if (await attempt(() => api.deviceUpdate(d.id, input.value, undefined), _('Renamed'))) { closeModal(); await changed(); } @@ -313,14 +328,16 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { const foot = E('div', { class: 'dl-drawer-actions' }); const connectSec = E('section', { class: 'dl-dsec' }, [ // Whether it is connected (or still waiting) is in Status above. - E('div', { class: 'dl-dsec-head' }, [E('h4', {}, 'Connect')]), + E('div', { class: 'dl-dsec-head' }, [E('h4', {}, _('Connect', 'section'))]), d.config_stale ? E('div', { class: 'dl-note warn' }, [ icon('alert'), E( 'span', {}, - 'This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below.', + _( + 'This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below.', + ), ), ]) : '', @@ -328,28 +345,35 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { ]); const activitySec = E('section', { class: 'dl-dsec' }, [ E('div', { class: 'dl-dsec-head' }, [ - E('h4', {}, 'Activity'), + E('h4', {}, _('Activity')), E('div', { class: 'dl-dsec-actions' }, [ - E('button', { type: 'button', class: 'dl-linkbtn', click: () => exportEvents({ people: [p] }, logEvents, 'csv', d.id) }, 'Export'), + E( + 'button', + { type: 'button', class: 'dl-linkbtn', click: () => exportEvents({ people: [p] }, logEvents, 'csv', d.id) }, + _('Export'), + ), E( 'button', { type: 'button', class: 'dl-linkbtn danger', click: () => - clearLogDialog(`Clear ${d.name}'s activity`, `Removes events about ${d.name}.`, { device: d.id }, () => { + clearLogDialog(fmt(_("Clear %s's activity"), d.name), fmt(_('Removes events about %s.'), d.name), { device: d.id }, () => { void loadLog(true); o.refresh(); }), }, - 'Clear', + _('Clear'), ), - E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, 'All activity'), + E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All activity')), ]), ]), log, ]); - const detailsSec = E('section', { class: 'dl-dsec' }, [E('div', { class: 'dl-dsec-head' }, E('h4', {}, 'Details')), details]); + const detailsSec = E('section', { class: 'dl-dsec' }, [ + E('div', { class: 'dl-dsec-head' }, E('h4', {}, _('Details', 'section'))), + details, + ]); let locationsSec: HTMLElement | '' = ''; if (geo?.enabled) { map = new ConnectionMap( @@ -366,7 +390,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { })); locationsSec = E('section', { class: 'dl-dsec' }, [ E('div', { class: 'dl-dsec-head' }, [ - E('h4', {}, 'Locations'), + E('h4', {}, _('Locations')), rangeControl( range, (r) => { @@ -412,22 +436,24 @@ export function quickMenu(anchor: HTMLElement, p: Person, d: Device, o: DeviceOp const cfg = () => attempt(() => api.deviceConfig(d.id)); const items: (MenuItem | null)[] = [ { - label: 'Show QR code', + label: _('Show QR code'), icon: icon('qr'), run: async () => { const c = await cfg(); if (!c) return; modal( - `${d.name} · QR code`, + `${d.name} · ${_('QR code')}`, E('div', { class: 'dl-qr-pane' }, [ qrCode(core.qrText(c)), E( 'span', { class: 'dl-sub' }, - plainWg(c) ? 'Scan with AmneziaVPN or any WireGuard app on the device.' : 'Scan with AmneziaVPN or AmneziaWG on the device.', + plainWg(c) + ? _('Scan with AmneziaVPN or any WireGuard app on the device.') + : _('Scan with AmneziaVPN or AmneziaWG on the device.'), ), ]), - cancelButton('Close'), + cancelButton(_('Close')), ); }, }, @@ -447,50 +473,50 @@ export function quickMenu(anchor: HTMLElement, p: Person, d: Device, o: DeviceOp icon: icon('copy'), run: async () => { const c = await cfg(); - if (c) copyText(await core.appKey!.make(c), 'Key copied'); + if (c) copyText(await core.appKey!.make(c), _('Key copied')); }, } : null, null, - { label: 'Rename', icon: icon('edit'), run: () => openDevice(p, d, o) }, + { label: _('Rename'), icon: icon('edit'), run: () => openDevice(p, d, o) }, { - label: 'New keys', + label: _('New keys'), icon: icon('key'), run: async () => { if ( await confirmDialog( - 'Generate new keys?', - 'The current configuration on this device stops working until it is imported again.', - 'Generate', + _('Generate new keys?'), + _('The current configuration on this device stops working until it is imported again.'), + _('Generate'), true, ) ) - if (await attempt(() => api.deviceRotate(d.id), 'New keys generated')) o.refresh(); + if (await attempt(() => api.deviceRotate(d.id), _('New keys generated'))) o.refresh(); }, }, { - label: d.disabled ? 'Enable' : 'Disable', + label: d.disabled ? _('Enable') : _('Disable'), icon: icon(d.disabled ? 'play' : 'pause'), warn: !d.disabled, run: async () => { - if (await attempt(() => api.deviceUpdate(d.id, undefined, !d.disabled), d.disabled ? 'Device enabled' : 'Device disabled')) + if (await attempt(() => api.deviceUpdate(d.id, undefined, !d.disabled), d.disabled ? _('Device enabled') : _('Device disabled'))) o.refresh(); }, }, { - label: 'Delete', + label: _('Delete'), icon: icon('trash'), danger: true, run: async () => { if ( await confirmDialog( - `Remove ${d.name}?`, - 'The device is disconnected immediately and its configuration stops working.', - 'Remove', + fmt(_('Remove %s?'), d.name), + _('The device is disconnected immediately and its configuration stops working.'), + _('Remove'), true, ) ) - if (await attempt(() => api.deviceDelete(d.id), 'Device removed')) o.refresh(); + if (await attempt(() => api.deviceDelete(d.id), _('Device removed'))) o.refresh(); }, }, ]; @@ -502,7 +528,7 @@ export function addDevice(person: Person, o: DeviceOpts) { const taken = person.devices.map((x) => x.name); // The name a type gives when none is typed: "Phone", then "Phone 2" (as the portal does). const suggest = (k: Kind) => { - const base = KIND_LABEL[k]; + const base = kindLabel(k); let n = 1; let name = base; while (taken.some((t) => t.toLowerCase() === name.toLowerCase())) name = `${base} ${++n}`; @@ -510,14 +536,14 @@ export function addDevice(person: Person, o: DeviceOpts) { }; let kind: Kind = 'phone'; const nameInput = E('input', { type: 'text', class: 'cbi-input-text', placeholder: suggest(kind), maxlength: 48 }) as HTMLInputElement; - const nameRow = liveField('Name', nameInput, () => + const nameRow = liveField(_('Name'), nameInput, () => nameInput.value.trim() - ? nameHelp(nameInput.value, taken, 'Shown in the portal and in the app.') - : { text: `Named after its type: ${suggest(kind)}.`, bad: false }, + ? nameHelp(nameInput.value, taken, _('Shown in the portal and in the app.')) + : { text: fmt(_('Named after its type: %s.'), suggest(kind)), bad: false }, ); const kinds = E( 'div', - { class: 'dl-kinds', role: 'radiogroup', 'aria-label': 'Type' }, + { class: 'dl-kinds', role: 'radiogroup', 'aria-label': _('Type') }, KINDS.map((k) => E( 'button', @@ -538,29 +564,38 @@ export function addDevice(person: Person, o: DeviceOpts) { nameRow.refresh(); }, }, - [icon(k), E('span', {}, KIND_LABEL[k])], + [icon(k), E('span', {}, kindLabel(k))], ), ), ); const over = person.devices.length >= person.device_limit; modal( - `Add a device for ${person.name}`, + fmt(_('Add a device for %s'), person.name), [ over ? E( 'p', { class: 'dl-hint' }, - `${person.name} already has ${person.devices.length} of ${person.device_limit} devices. As admin you can still add one.`, + fmt( + N_( + person.device_limit, + '%s already has %s of %s device. As admin you can still add one.', + '%s already has %s of %s devices. As admin you can still add one.', + ), + person.name, + num(person.devices.length), + num(person.device_limit), + ), ) : '', - E('div', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, 'Type'), kinds]), + E('div', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, _('Type')), kinds]), nameRow, ], [ cancelButton(), ' ', button( - 'Add device', + _('Add device'), async () => { const h = nameRow.help(); if (h.bad) { @@ -571,7 +606,7 @@ export function addDevice(person: Person, o: DeviceOpts) { const r = await attempt(() => api.deviceCreate(person.id, name, kind)); if (!r) return; closeModal(); - notify(`${name} added`, 'success', 3000); + notify(fmt(_('%s added'), name), 'success', 3000); o.refresh(); await reopen(person.id, r.id, o); }, diff --git a/web/src/admin/disguise.ts b/web/src/admin/disguise.ts index dec2b20..ab9f02f 100644 --- a/web/src/admin/disguise.ts +++ b/web/src/admin/disguise.ts @@ -3,6 +3,7 @@ import type { AwgCaps } from '../shared/types'; import { E } from './e'; import { icon } from '../shared/icons'; +import { fmt } from '../shared/i18n'; export type Method = 'balanced' | 'max' | 'off'; /** The router features a method may need (the boolean ones of AwgCaps). */ @@ -24,42 +25,47 @@ export interface MethodInfo { needs?: AwgNeed; } -export const METHODS: MethodInfo[] = [ - { - id: 'off', - title: 'Off', - ic: 'zap', - stealth: 0, - speed: 4, - text: 'Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block.', - apps: 'Any WireGuard app', - short: 'Any WireGuard app', - }, - { - id: 'balanced', - title: 'Balanced', - ic: 'shield', - stealth: 3, - speed: 4, - needs: 'v2', - text: 'AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk.', - apps: 'AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps', - short: 'AmneziaWG 2.0+ apps', - }, - { - id: 'max', - title: 'Maximum', - ic: 'lock', - stealth: 4, - speed: 3, - needs: 'v3', - text: 'AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS.', - apps: 'Apps with AmneziaWG 3.1 (current AmneziaVPN)', - short: 'AmneziaWG 3.1 apps', - }, -]; +/** The methods in picker order, in the page's language. */ +export function methods(): MethodInfo[] { + return [ + { + id: 'off', + title: _('Off'), + ic: 'zap', + stealth: 0, + speed: 4, + text: _('Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block.'), + apps: _('Any WireGuard app'), + short: _('Any WireGuard app'), + }, + { + id: 'balanced', + title: _('Balanced'), + ic: 'shield', + stealth: 3, + speed: 4, + needs: 'v2', + text: _( + 'AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk.', + ), + apps: _('AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps'), + short: _('AmneziaWG 2.0+ apps'), + }, + { + id: 'max', + title: _('Maximum'), + ic: 'lock', + stealth: 4, + speed: 3, + needs: 'v3', + text: _('AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS.'), + apps: _('Apps with AmneziaWG 3.1 (current AmneziaVPN)'), + short: _('AmneziaWG 3.1 apps'), + }, + ]; +} -export const methodInfo = (id: string): MethodInfo | undefined => METHODS.find((x) => x.id === id); +export const methodInfo = (id: string): MethodInfo | undefined => methods().find((x) => x.id === id); /** The disguise a new server gets: the strongest this router can run. */ export const defaultMethod = (caps: AwgCaps): Method => (caps.v3 ? 'max' : caps.v2 ? 'balanced' : 'off'); @@ -70,21 +76,21 @@ export const defaultMethod = (caps: AwgCaps): Method => (caps.v3 ? 'max' : caps. * the picker offers Balanced or Maximum instead. The title for such a server, or null. */ export const legacyTitle = (preset: string): string | null => - preset === 'standard' ? 'Standard (old)' : preset === 'strong' ? 'Strong (old)' : null; + preset === 'standard' ? _('Standard (old)') : preset === 'strong' ? _('Strong (old)') : null; -const NEEDS: Record = { - v2: 'Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on).', - v3: 'Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1).', -}; - -/** The same while no AmneziaWG is installed at all ("newer" would be misleading). */ -const NEEDS_NONE: Record = { - v2: 'Needs AmneziaWG on the router.', - v3: 'Needs AmneziaWG 3.1 on the router: install it first.', -}; +/** + * Why a method is not available. `installed` is false while no AmneziaWG is + * installed at all ("newer" would be misleading then). + */ +function needsText(need: AwgNeed, installed: boolean): string { + if (!installed) return need === 'v2' ? _('Needs AmneziaWG on the router.') : _('Needs AmneziaWG 3.1 on the router: install it first.'); + return need === 'v2' + ? _('Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on).') + : _('Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1).'); +} function dots(n: number, label: string): HTMLElement { - return E('span', { class: 'dl-dots', title: `${label}: ${n} of 4` }, [ + return E('span', { class: 'dl-dots', title: fmt(_('%s: %s of 4'), label, n) }, [ E('span', { class: 'dl-dots-label' }, label), E( 'span', @@ -106,11 +112,11 @@ export function methodPicker( current?: string, installed = true, ): HTMLElement { - const el = E('div', { class: 'dl-methods', role: 'radiogroup', 'aria-label': 'Disguise method' }); + const el = E('div', { class: 'dl-methods', role: 'radiogroup', 'aria-label': _('Disguise method') }); const paint = () => dom.content( el, - METHODS.map((m) => { + methods().map((m) => { const ok = !m.needs || caps[m.needs]; const on = m.id === selected; return E( @@ -132,16 +138,16 @@ export function methodPicker( E('div', { class: 'dl-method-head' }, [ E('span', { class: 'dl-method-ic' }, icon(m.ic)), E('b', {}, m.title), - m.id === current ? E('span', { class: 'dl-pill ok' }, 'Current') : '', + m.id === current ? E('span', { class: 'dl-pill ok' }, _('Current')) : '', ]), E('p', {}, m.text), - E('div', { class: 'dl-method-meters' }, [dots(m.stealth, 'Stealth'), dots(m.speed, 'Speed')]), + E('div', { class: 'dl-method-meters' }, [dots(m.stealth, _('Stealth')), dots(m.speed, _('Speed'))]), E( 'div', { class: 'dl-method-foot' }, ok ? [icon(m.id === 'off' ? 'wireguard' : 'amneziawg'), E('span', {}, m.apps)] - : [icon('alert'), E('span', {}, (installed ? NEEDS : NEEDS_NONE)[m.needs!])], + : [icon('alert'), E('span', {}, needsText(m.needs!, installed))], ), ], ); diff --git a/web/src/admin/events/csv.ts b/web/src/admin/events/csv.ts index b5b06eb..ad91042 100644 --- a/web/src/admin/events/csv.ts +++ b/web/src/admin/events/csv.ts @@ -1,5 +1,6 @@ // CSV for the log export. Cells a spreadsheet would run as a formula (= + - @, // tab, CR) get a leading apostrophe; quotes, commas and line breaks are quoted. +// The header row is the column keys unless the caller names them (translated). export function csvCell(v: unknown): string { let s = v == null ? '' : String(v); @@ -7,6 +8,6 @@ export function csvCell(v: unknown): string { return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s; } -export function toCsv(cols: readonly K[], rows: Record[]): string { - return [cols.join(','), ...rows.map((r) => cols.map((c) => csvCell(r[c])).join(','))].join('\n'); +export function toCsv(cols: readonly K[], rows: Record[], head?: Record): string { + return [cols.map((c) => csvCell(head?.[c] ?? c)).join(','), ...rows.map((r) => cols.map((c) => csvCell(r[c])).join(','))].join('\n'); } diff --git a/web/src/admin/events/log-templates.ts b/web/src/admin/events/log-templates.ts new file mode 100644 index 0000000..ac88d5f --- /dev/null +++ b/web/src/admin/events/log-templates.ts @@ -0,0 +1,119 @@ +// Generated by web/i18n/extract.ts from the backend's L_() strings (npm run i18n): do not edit. +// The words of service log lines, as written; events/model.ts matches log lines against them. + +export const LOG_TEMPLATES: string[] = [ + '%d system package', + '%d system packages', + '%s (after %d repair)', + '%s (after %d repairs)', + "%s - %d repairs didn't help", + '%s - %s', + "%s - not repaired again (%d repairs didn't help)", + '%s has no IPv4 address.', + '%s is not a bridge, so Dawnline cannot join the LAN as a device.', + '%s needs a manual switch in Components', + '%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.', + '%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.', + '%s · restored', + 'Access rules', + 'Activity', + 'AmneziaWG is missing from the router', + 'AmneziaWG is running again', + 'AmneziaWG is running again · accepting connections on port %d', + "AmneziaWG isn't accepting connections on port %d", + "AmneziaWG isn't running", + 'Backup', + 'Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.', + 'Choose another interface name in the server settings.', + 'Components', + 'Connections', + 'DNS for Home-only devices', + "Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed.", + 'Firewall', + 'Install it in Dawnline → Components.', + 'Internet like a home device', + 'MTU is now automatic', + 'Missing: %s.', + 'No LAN detected.', + 'No free address on %s.', + 'No free link-local range for the internal link.', + 'No free routing table.', + 'People', + 'Personal links', + 'Personal portal', + 'Router', + 'Servers', + 'Speed', + 'System packages', + 'The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.', + 'Traffic', + 'Watchdog', + 'a new build needs a manual switch in Components', + 'answers again', + 'are loaded again', + 'are missing', + 'automatic update failed', + 'background check failed: %s', + "can't reach Dawnline (luci.dawnline is missing in rpcd)", + "can't use the network interface %s: it exists and isn't Dawnline's", + 'certificate expires %s', + 'certificate expires within 7 days', + 'certificate renewed · valid until %s', + "couldn't be repaired: %s", + "couldn't be updated - the previous rules stay, and changes to access wait until they load", + "couldn't load - no device is loaded into the tunnels until they do", + "couldn't load devices into the tunnel", + "couldn't start", + "couldn't start · %d failed attempts in %d min", + 'failed - internet goes out directly for now', + 'failed: %s', + 'has an invalid interface name "%s"', + 'installed the %s build', + 'installed the %s build · %s', + 'is kept down', + 'is kept down: its disguise needs AmneziaWG %s (installed: %s)', + 'is kept down: its disguise needs AmneziaWG %s (installed: none)', + 'is off', + 'is on · traffic enters %s as %s', + 'is ready again', + "isn't answering on port %d", + "isn't installed: no tunnel can run - install it in Dawnline → Components", + "isn't installed: tunnels were left as they are", + "isn't known to the network service - restart the network or reboot", + "isn't running", + "isn't running on this router (fw4): tunnels and the portal are closed", + "kernel module isn't installed: no tunnel can run - install it in Dawnline → Components", + "kernel module isn't loaded", + 'loading it', + 'loading them again', + 'moved to word codes', + 'netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.', + 'network changed - Dawnline set itself up again', + 'nightly backup failed: %s', + 'public address changed · %s → %s', + 'reaches Dawnline again', + 'reloading rpcd', + 'restarted · version %s', + 'restarting for the AmneziaWG update', + 'restarting it', + 'restoring them', + 'rules for Dawnline are in place again', + "rules for Dawnline aren't loaded", + 'rules for Dawnline were changed or removed', + 'runs again', + 'setting it up again', + 'started', + 'started with the router · version %s', + 'started · accepting connections on port %s', + 'started · version %s', + 'stopped unexpectedly', + 'stopped unexpectedly - started again', + 'update failed', + 'update to %s failed its check - rolled back to %s', + 'updated automatically · %s', + 'updated automatically · %s → %s', + 'updated · %s', + 'updated · %s → %s', + 'updates available · %s', + 'was broken - set up again (%s as %s)', +]; diff --git a/web/src/admin/events/model.ts b/web/src/admin/events/model.ts index 3365374..519d496 100644 --- a/web/src/admin/events/model.ts +++ b/web/src/admin/events/model.ts @@ -3,6 +3,8 @@ import type { LogEvent } from '../../shared/types'; import type { LogCategory, LogsInfo, ServiceLogEntry } from '../api'; +import { fmt, known, plural } from '../../shared/i18n'; +import { LOG_TEMPLATES } from './log-templates'; /** Mirrors CATEGORY in dawnline.live. */ const CATEGORY: Record = { @@ -27,21 +29,24 @@ const CATEGORY: Record = { export const CATEGORIES: LogCategory[] = ['connections', 'people', 'problems']; -export const CATEGORY_LABEL: Record = { - connections: 'Connections', - people: 'People', - problems: 'Problems', -}; +export function categoryLabel(c: LogCategory): string { + return { connections: _('Connections'), people: _('People'), problems: _('Problems') }[c]; +} -export const CATEGORY_HELP: Record = { - connections: 'Connects, disconnects and IP changes', - people: 'People and their devices added, changed, paused, removed', - problems: 'Blocked portal sign-ins (tunnels and services are in the service log)', -}; +export function categoryHelp(c: LogCategory): string { + return { + connections: _('Connects, disconnects and IP changes'), + people: _('People and their devices added, changed, paused, removed'), + problems: _('Blocked portal sign-ins (tunnels and services are in the service log)'), + }[c]; +} export const categoryOf = (type: string): LogCategory => CATEGORY[type] ?? 'problems'; -export const SYSTEM_SOURCE: Record = { awg: 'AmneziaWG', dawnline: 'Dawnline', portal: 'Portal' }; +/** What a service log source is called; unknown ones by their id. */ +export function sourceName(src: ServiceLogEntry['src']): string { + return { awg: 'AmneziaWG', dawnline: 'Dawnline', portal: _('Portal') }[src] ?? src; +} const ADMIN_TYPES = ['person_added', 'person_removed', 'person_changed']; @@ -65,10 +70,194 @@ export const isProblem = (x: LogItem) => x.sys ? ['error', 'repair', 'down'].includes(x.sys.level) : categoryOf(x.ev!.type) === 'problems'; export function retentionText(p: LogsInfo['policy']): string { - const age = p.keep_days > 0 ? `${p.keep_days} day${p.keep_days === 1 ? '' : 's'}` : 'no age limit'; + const age = p.keep_days > 0 ? plural(p.keep_days, '%s day', '%s days') : _('no age limit'); const where = p.persist === 'off' - ? 'kept in memory only (lost on reboot)' - : `saved to flash ${p.persist === '10min' ? 'every 10 minutes' : 'hourly'}`; - return `Kept for ${age}, up to ${p.max.toLocaleString('en-GB')} events, ${where}.`; + ? _('kept in memory only (lost on reboot)') + : p.persist === '10min' + ? _('saved to flash every 10 minutes') + : _('saved to flash hourly'); + return fmt(_('Kept for %s, %s, %s.'), age, plural(p.max, 'up to %s event', 'up to %s events'), where); +} + +/* ---------- the router's words, put into the page's language ---------- + * Events and service log lines are written once, in English, by whoever was + * running (the agent has no language) and read later in any language: the + * words below are their fixed vocabulary, translated when shown. Anything + * else stays as written. */ + +/** Why someone was paused or resumed (the agent's REASON words). */ +export function reasonText(detail: string): string { + const t: Record = { + 'paused by admin': _('paused by admin'), + 'end date reached': _('end date reached'), + 'data limit reached': _('data limit reached'), + 'outside allowed hours': _('outside allowed hours'), + 'no server': _('no server'), + 'server turned off': _('server turned off'), + }; + return t[detail] ?? detail; +} + +/** Days left in an "expiring" event's detail ("3 days"), or null. */ +export function daysOf(detail: string): number | null { + const m = /^(\d+) days?$/.exec(detail); + return m ? Number(m[1]) : null; +} + +/** The person's settings a person_changed event lists (option names, "moved to "). */ +export function changedText(detail: string): string { + const f: Record = { + name: _('name'), + access: _('access'), + device_limit: _('device limit'), + expires: _('end date'), + expire_action: _('what happens at the end'), + expire_warn: _('warning before the end'), + quota_gb: _('data limit'), + quota_period: _('data limit period'), + bonus_gb: _('extra data'), + hours: _('allowed hours'), + dns_mode: _('DNS'), + paused: _('pause'), + services: _('home services'), + circle: _('circle', 'setting'), + home_nets: _('home networks'), + server: _('server'), + }; + return detail + .split(', ') + .map((k) => { + const to = /^moved to (.+)$/.exec(k)?.[1]; + return to ? fmt(_('moved to %s'), to) : (f[k] ?? k.replace(/_/g, ' ')); + }) + .join(', '); +} + +/** + * The admin's own change in the service log ({ msg: 'changed', kind: + * 'server', who: 'Home' }), as one sentence: with %s for the name it names, + * or whole when the name is a fixed phrase ("the service log"); null for one + * this page does not know. + */ +export function adminSentence(msg: string, kind?: string | null, who?: string | null): { text: string; named: boolean } | null { + const fixed: Record = { + 'cleared|the service log': _('You cleared the service log'), + 'cleared|the activity log': _('You cleared the activity log'), + 'exported|all settings': _('You exported all settings'), + 'imported|settings from a file': _('You imported settings from a file'), + 'restored|from a file': _('You restored a backup from a file'), + 'turned on|the personal portal': _('You turned on the personal portal'), + 'turned off|the personal portal': _('You turned off the personal portal'), + 'changed|the personal portal': _('You changed the personal portal'), + 'turned on|the watchdog': _('You turned on the watchdog'), + 'turned off|the watchdog': _('You turned off the watchdog'), + 'reset traffic history|for everyone': _('You reset traffic history for everyone'), + }; + const whole = fixed[`${msg}|${who ?? ''}`]; + if (whole) return { text: whole, named: false }; + const named: Record = { + 'created|server': _('You created server %s'), + 'changed|server': _('You changed server %s'), + 'removed|server': _('You removed server %s'), + 'turned on|server': _('You turned on server %s'), + 'turned off|server': _('You turned off server %s'), + 'added|circle': _('You added circle %s'), + 'changed|circle': _('You changed circle %s'), + 'removed|circle': _('You removed circle %s'), + 'restored|backup': _('You restored backup %s'), + }; + const t = named[`${msg}|${kind ?? ''}`]; + if (t) return { text: t, named: true }; + // "reset traffic history" "for Anna": the name after "for". + const forWho = msg === 'reset traffic history' && /^for (.+)$/.exec(who ?? '')?.[1]; + return forWho ? { text: _('You reset traffic history for %s'), named: true } : null; +} + +/** The name in a sentence adminSentence() made with %s (its "for …" taken off). */ +export const adminName = (msg: string, who: string) => (msg === 'reset traffic history' ? who.replace(/^for /, '') : who); + +/** The note after an admin's change: its known pieces translated, the rest as written. */ +export function noteText(note: string): string { + const one = (p: string): string => { + const t: Record = { + 'other addresses': _('other addresses'), + certificate: _('certificate'), + redirect: _('redirect'), + 'devices kept apart': _('devices kept apart'), + 'devices reach each other': _('devices reach each other'), + 'devices reach each other in circles': _('devices reach each other in circles'), + 'home network and internet path': _('home network and internet path'), + 'the file holds private keys': _('the file holds private keys'), + 'problems are only logged, nothing is repaired': _('problems are only logged, nothing is repaired'), + name: _('name'), + 'public address': _('public address'), + 'AmneziaWG port': _('AmneziaWG port'), + 'tunnel network': _('tunnel network'), + connections: categoryLabel('connections'), + people: categoryLabel('people'), + problems: categoryLabel('problems'), + }; + if (t[p]) return t[p]; + let m: RegExpExecArray | null; + if ((m = /^port (\d+)$/.exec(p))) return fmt(_('port %s'), m[1]); + if ((m = /^address (.+)$/.exec(p))) return fmt(_('address %s'), m[1]); + if ((m = /^disguise: (.+)$/.exec(p))) return fmt(_('disguise: %s'), m[1]); + if ((m = /^(\d+) events?$/.exec(p))) return plural(Number(m[1]), '%s event', '%s events'); + if ((m = /^older than (\d+) days$/.exec(p))) return plural(Number(m[1]), 'older than %s day', 'older than %s days'); + if ((m = /^with (\d+) (person|people)$/.exec(p))) return plural(Number(m[1]), 'with %s person', 'with %s people'); + if ((m = /^(\d+) entr(y|ies)( older than (\d+) days)?$/.exec(p))) + return m[4] + ? `${plural(Number(m[1]), '%s entry', '%s entries')}, ${plural(Number(m[4]), 'older than %s day', 'older than %s days')}` + : plural(Number(m[1]), '%s entry', '%s entries'); + return p; + }; + return note + .split(' · ') + .map((part) => part.split(', ').map(one).join(', ')) + .join(' · '); +} + +/* ---------- the service log's lines ---------- + * The router writes them in English from its L_() templates (the generated + * list in ./log-templates); a line is put into the page's language by the + * template it matches, its values (versions, ports, names, or another + * template's words) put back in place. Lines written before the plain dash + * have "—" where the templates have "-". */ + +let patterns: { t: string; re: RegExp }[] | null = null; +const LOG_EXACT = new Set(LOG_TEMPLATES); + +/** The templates with values in them, the most specific (most fixed text) first. */ +function logPatterns() { + return (patterns ??= LOG_TEMPLATES.filter((t) => /%[sd]/.test(t) && t.replace(/%[sd]/g, '').trim()) + .map((t) => ({ + t, + fixed: t.replace(/%[sd]/g, '').length, + re: new RegExp( + `^${t + .split(/(%[sd])/) + .map((p) => (p === '%s' ? '(.+?)' : p === '%d' ? '(\\d+)' : p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))) + .join('')}$`, + ), + })) + .sort((a, b) => b.fixed - a.fixed)); +} + +/** A service log line (or its subject, or a line of its details) in the page's language; one it does not know as written. */ +export function logText(line: string, depth = 0): string { + const s = line.replace(/ — /g, ' - '); + if (LOG_EXACT.has(s)) return known(s); + if (depth > 2) return line; + for (const p of logPatterns()) { + const m = p.re.exec(s); + if (m) return fmt(known(p.t), ...m.slice(1).map((v) => logText(v, depth + 1))); + } + // A list ("Dawnline 0.3.3, 2 system packages"): each item on its own. + return s.includes(', ') + ? s + .split(', ') + .map((x) => logText(x, depth + 1)) + .join(', ') + : line; } diff --git a/web/src/admin/events/render.ts b/web/src/admin/events/render.ts index 94eb796..ced52ff 100644 --- a/web/src/admin/events/render.ts +++ b/web/src/admin/events/render.ts @@ -1,12 +1,14 @@ // Log rows: an activity event as a sentence ("You added device Phone for -// Myata"), its tile and time, and a service log line. +// Myata", one translated sentence per event with the names in it), its tile +// and time, and a service log line (its text comes from the router). import type { LogEvent, Status } from '../../shared/types'; import type { ServiceLogEntry } from '../api'; import { E } from '../e'; import { icon } from '../../shared/icons'; -import { ago } from '../../shared/format'; -import { SYSTEM_SOURCE, eventBy, plainDetail } from './model'; +import { ago, fmtDay } from '../../shared/format'; +import { fill, fmt, locale, num } from '../../shared/i18n'; +import { adminName, adminSentence, changedText, daysOf, eventBy, logText, noteText, plainDetail, reasonText, sourceName } from './model'; /** What the people and servers in the log are called now. */ export type Names = Pick; @@ -49,6 +51,9 @@ function eventIcon(st: Names, e: LogEvent): string { return EVENT_ICON[e.type] ?? 'activity'; } +/** A router day (YYYY-MM-DD) in the page's language; anything else as it came. */ +const routerDay = (s: string) => (/^\d{4}-\d{2}-\d{2}$/.test(s) ? fmtDay(s) : s); + export function eventText(st: Pick, e: LogEvent): Node[] { const person = st.people.find((p) => p.id === e.person); const who = person?.name ?? e.pname ?? e.person ?? ''; @@ -61,101 +66,97 @@ export function eventText(st: Pick, e: LogEvent): Node[] { e.hosts?.[ip] ? [E('span', { class: 'dl-ev-host' }, [E('b', {}, e.hosts[ip]), E('span', { class: 'dl-faint' }, ` (${ip})`)])] : [mono(ip)]; - // What the bold name is (a person, a device), said before it in grey. - const kind = (t: string) => E('span', { class: 'dl-ev-kind' }, `${t} `); - const wd = dev ? `${who} · ${dev}` : who; - const detail = plainDetail(e); - const devName = detail || dev || 'a device'; + // A sentence in grey around its bold names, people and devices. + const say = (s: string, ...args: Node[]): Node[] => fill(s, ...args).map((x) => (typeof x === 'string' ? m(x) : x)); // The admin's own actions start with an accent "You". - const you = (verb: string) => [E('span', { class: 'dl-you' }, 'You'), m(` ${verb} `)]; - if (eventBy(e) === 'admin') + const you = (s: string, ...args: Node[]): Node[] => { + const w = _('You'); + return s.startsWith(`${w} `) ? [E('span', { class: 'dl-you' }, w), ...say(s.slice(w.length), ...args)] : say(s, ...args); + }; + const wd = b(dev ? `${who} · ${dev}` : who); + const detail = plainDetail(e); + const devName = b(detail || dev || _('a device')); + const by = eventBy(e); + if (by === 'admin') switch (e.type) { case 'device_added': - return [...you('added'), kind('device'), b(devName), m(' for '), b(who)]; + return you(_('You added device %s for %s'), devName, b(who)); case 'device_removed': - return [...you('removed'), kind('device'), b(devName), m(' from '), b(who)]; + return you(_('You removed device %s from %s'), devName, b(who)); case 'paused': - return [...you('paused'), kind('person'), b(who)]; + return you(_('You paused person %s'), b(who)); case 'resumed': - return [...you('resumed'), kind('person'), b(who)]; + return you(_('You resumed person %s'), b(who)); case 'device_changed': { - const renamed = detail.startsWith('renamed from '); - return [ - ...you(renamed ? 'renamed' : detail), - kind('device'), - b(dev || 'a device'), - m(' of '), - b(who), - ...(renamed ? [m(` · was ${detail.slice(13)}`)] : []), - ]; + const d = b(dev || _('a device')); + if (detail.startsWith('renamed from ')) + return [...you(_('You renamed device %s of %s'), d, b(who)), m(` · ${fmt(_('was %s'), detail.slice(13))}`)]; + if (detail === 'turned off') return you(_('You turned off device %s of %s'), d, b(who)); + if (detail === 'turned on') return you(_('You turned on device %s of %s'), d, b(who)); + return [...you(_('You changed device %s of %s'), d, b(who)), ...(detail ? [m(` · ${detail}`)] : [])]; } case 'device_keys': - return [...you('issued new keys for'), kind('device'), b(devName), m(' of '), b(who), m(' · it needs its new configuration')]; + return [...you(_('You issued new keys for device %s of %s'), devName, b(who)), m(` · ${_('it needs its new configuration')}`)]; case 'link_changed': - return [...you('issued a new link for'), kind('person'), b(who), m(' · the old link stopped working')]; + return [...you(_('You issued a new link for person %s'), b(who)), m(` · ${_('the old link stopped working')}`)]; } switch (e.type) { case 'connect': return [ - kind('Device'), - b(wd), - m(' connected'), - ...(e.detail ? [m(' from '), ...addr(e.detail)] : []), + ...(e.detail ? say(_('Device %s connected from %s'), wd, E('span', {}, addr(e.detail))) : say(_('Device %s connected'), wd)), ...(e.where ? [m(` · ${e.where}`)] : []), ]; case 'disconnect': - return [kind('Device'), b(wd), m(' went offline')]; + return say(_('Device %s went offline'), wd); case 'roam': - return [ - kind('Device'), - b(wd), - m(' changed network '), - ...(e.detail ?? '').split(' → ').flatMap((ip, i) => (i ? [m(' → '), ...addr(ip)] : addr(ip))), - ]; + return say( + _('Device %s changed network %s'), + wd, + E( + 'span', + {}, + (e.detail ?? '').split(' → ').flatMap((ip, i) => (i ? [m(' → '), ...addr(ip)] : addr(ip))), + ), + ); case 'device_added': - return [ - kind('Person'), - b(who), - m(' added '), - kind('device'), - b(devName), - ...(eventBy(e) === 'portal' ? [m(' on their portal')] : []), - ]; + return by === 'portal' + ? say(_('Person %s added device %s on their portal'), b(who), devName) + : say(_('Person %s added device %s'), b(who), devName); case 'device_removed': - return [ - kind('Person'), - b(who), - m(' removed '), - kind('device'), - b(devName), - ...(eventBy(e) === 'portal' ? [m(' on their portal')] : []), - ]; + return by === 'portal' + ? say(_('Person %s removed device %s on their portal'), b(who), devName) + : say(_('Person %s removed device %s'), b(who), devName); case 'device_keys': - return [kind('Person'), b(who), m(' issued new keys for '), kind('device'), b(devName), m(' on their portal')]; + return say(_('Person %s issued new keys for device %s on their portal'), b(who), devName); case 'person_added': - return [...you('added'), kind('person'), b(e.detail ?? who)]; + return you(_('You added person %s'), b(e.detail ?? who)); case 'person_removed': - return [...you('removed'), kind('person'), b(e.detail ?? who)]; + return you(_('You removed person %s'), b(e.detail ?? who)); case 'person_changed': // The detail lists changed fields by their option names (device_limit, expire_action). - return [...you('changed'), kind('person'), b(who), ...(detail ? [m(` · ${detail.replace(/_/g, ' ')}`)] : [])]; - case 'expiring': - return [kind('Person'), b(who), m(`’s access ends in ${e.detail ?? 'a few days'}`)]; + return [...you(_('You changed person %s'), b(who)), ...(detail ? [m(` · ${changedText(detail)}`)] : [])]; + case 'expiring': { + const n = daysOf(e.detail ?? ''); + return n != null + ? say(N_(n, 'Person %s’s access ends in %s day', 'Person %s’s access ends in %s days'), b(who), m(num(n))) + : say(_('Person %s’s access ends in a few days'), b(who)); + } case 'expired_kept': - return [kind('Person'), b(who), m(`’s end date passed (${e.detail ?? ''}) · access kept`)]; + return say(_('Person %s’s end date passed (%s) · access kept'), b(who), m(routerDay(e.detail ?? ''))); case 'paused': - return [kind('Person'), b(who), m(` paused — ${e.detail ?? ''}`)]; + return e.detail ? say(_('Person %s paused - %s'), b(who), m(reasonText(e.detail))) : say(_('Person %s paused'), b(who)); case 'resumed': - return [kind('Person'), b(who), m(' resumed'), ...(e.detail && e.detail !== 'active' ? [m(` — ${e.detail}`)] : [])]; + return e.detail && e.detail !== 'active' + ? say(_('Person %s resumed - %s'), b(who), m(reasonText(e.detail))) + : say(_('Person %s resumed'), b(who)); case 'portal_blocked': - return [ - E('b', { class: 'dl-sys-src' }, 'Personal portal'), - m(' blocked '), - mono(e.detail ?? ''), - m(' for 15 min after too many wrong codes'), - ]; + return say( + _('%s blocked %s for 15 min after too many wrong codes'), + E('b', { class: 'dl-sys-src' }, _('Personal portal')), + e.detail === 'all Cloudflare visitors' ? m(_('all Cloudflare visitors')) : mono(e.detail ?? ''), + ); case 'devices_removed': - return [kind('Person'), b(who), m(' — all devices removed, end date reached')]; + return say(_('Person %s - all devices removed, end date reached'), b(who)); default: return [m(`${e.type}${e.detail ? `: ${e.detail}` : ''}`)]; } @@ -171,7 +172,7 @@ function serverPill(st: Names, e: LogEvent): HTMLElement | '' { if (st.servers.length < 2 || !e.person) return ''; const p = st.people.find((x) => x.id === e.person); const srv = p && st.servers.find((s) => s.id === p.server); - return srv ? E('span', { class: 'dl-ev-srv', title: 'Server' }, srv.name) : ''; + return srv ? E('span', { class: 'dl-ev-srv', title: _('Server') }, srv.name) : ''; } /** An activity event as a row; `time` replaces the "5 min ago" (`now` is the router's clock). */ @@ -180,13 +181,13 @@ export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { serv const by = eventBy(e); return E('div', { class: `dl-row${by === 'admin' ? ' dl-ev-by-admin' : sys ? ` dl-ev-by-system ${sys[1]}` : ''}` }, [ by === 'admin' - ? E('span', { class: 'dl-ev-tile', title: 'Done by you in LuCI' }, icon('admin')) + ? E('span', { class: 'dl-ev-tile', title: _('Done by you in LuCI') }, icon('admin')) : sys ? E('span', { class: 'dl-ev-tile sys' }, icon(sys[0])) : E('span', { class: `dl-ev-tile ev ${EVENT_TONE[e.type] ?? ''}` }, icon(eventIcon(st, e))), E('span', { class: 'dl-row-main' }, eventText(st, e)), opts.server === false ? '' : serverPill(st, e), - E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString() }, opts.time ?? ago(e.ts, st.now)), + E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, opts.time ?? ago(e.ts, st.now)), ]); } @@ -195,9 +196,47 @@ export function eventRow(st: Names & { now?: number }, e: LogEvent, opts: { serv const SYS_TONE: Record = { info: '', up: 'ok', down: 'warn', repair: 'warn', error: 'bad' }; const SYS_ICON: Record = { awg: 'tunnel', dawnline: 'sunrise', portal: 'globe' }; +/** A service log level as its tile's tooltip says it. */ +function levelLabel(l: ServiceLogEntry['level']): string { + return { info: _('info'), up: _('up'), down: _('down'), repair: _('repair'), error: _('error') }[l] ?? l; +} + +/** + * The admin's own change: "You changed server Home" as one sentence of the + * page's language, "You" in the accent; one this page does not know is put + * together from the router's words as before. + */ +function adminLine(e: ServiceLogEntry): (Node | string)[] { + const s = adminSentence(e.msg, e.kind, e.who); + const you = _('You'); + if (!s) + return [ + E('span', { class: 'dl-you' }, you), + E('span', { class: 'dl-muted' }, ` ${e.msg} `), + e.kind ? E('span', { class: 'dl-ev-kind' }, `${e.kind} `) : '', + e.who ? E('b', {}, e.who) : '', + ]; + const parts = (s.named ? fill(s.text, E('b', {}, adminName(e.msg, e.who ?? ''))) : [s.text]).map((x) => + typeof x === 'string' ? E('span', { class: 'dl-muted' }, x) : x, + ); + // The accent on "You" where the sentence starts with it. + const first = parts[0]?.textContent ?? ''; + return first.startsWith(`${you} `) + ? [E('span', { class: 'dl-you' }, you), E('span', { class: 'dl-muted' }, first.slice(you.length)), ...parts.slice(1)] + : parts; +} + +/** A log line's details: its sentences in the page's language, command output as it is. */ +const detailText = (d: string) => + d + .split('\n') + .map((l) => logText(l)) + .join('\n'); + /** A service log line: source, message, folded details; click to unfold. */ export function systemRow(e: ServiceLogEntry, open: boolean, toggle: () => void, time: string): HTMLElement { const admin = e.by === 'admin'; + const msg = logText(e.msg); const row = E( 'div', { @@ -205,32 +244,35 @@ export function systemRow(e: ServiceLogEntry, open: boolean, toggle: () => void, }, [ admin - ? E('span', { class: 'dl-ev-tile', title: 'Done by you in LuCI' }, icon('admin')) - : E('span', { class: 'dl-ev-tile sys', title: e.level }, icon(SYS_ICON[e.src] ?? 'zap')), + ? E('span', { class: 'dl-ev-tile', title: _('Done by you in LuCI') }, icon('admin')) + : E('span', { class: 'dl-ev-tile sys', title: levelLabel(e.level) }, icon(SYS_ICON[e.src] ?? 'zap')), E( 'span', { class: 'dl-row-main' }, admin ? [ - E('span', { class: 'dl-you' }, 'You'), - E('span', { class: 'dl-muted' }, ` ${e.msg} `), - e.kind ? E('span', { class: 'dl-ev-kind' }, `${e.kind} `) : '', - e.who ? E('b', {}, e.who) : '', - e.note ? E('span', { class: 'dl-muted' }, ` · ${e.note}`) : '', + ...adminLine(e), + e.note ? E('span', { class: 'dl-muted' }, ` · ${noteText(e.note)}`) : '', e.detail ? E('span', { class: `dl-slog-more${open ? ' open' : ''}` }, icon('chevron')) : '', - e.detail && open ? E('pre', { class: 'dl-slog-detail' }, e.detail) : '', + e.detail && open ? E('pre', { class: 'dl-slog-detail' }, detailText(e.detail)) : '', ] : [ // Servers have names people chose: say it is a server. Services name themselves. - e.src === 'awg' && e.who && e.who !== 'AmneziaWG' ? E('span', { class: 'dl-ev-kind' }, 'Server ') : '', - E('b', { class: 'dl-sys-src', title: SYSTEM_SOURCE[e.src] ?? e.src }, e.who ?? SYSTEM_SOURCE[e.src] ?? e.src), - ' ', - E('span', { class: 'dl-muted' }, e.msg), + e.src === 'awg' && e.who && e.who !== 'AmneziaWG' ? E('span', { class: 'dl-ev-kind' }, `${_('Server')} `) : '', + // A server's name as it is; Dawnline's own subjects ("Access rules") in the page's language. + E( + 'b', + { class: 'dl-sys-src', title: sourceName(e.src) }, + e.who ? (e.src === 'awg' ? e.who : logText(e.who)) : sourceName(e.src), + ), + // A translation may go on from the subject with a colon ("Home: AmneziaWG isn't running"). + /^[:,]/.test(msg) ? '' : ' ', + E('span', { class: 'dl-muted' }, msg), e.detail ? E('span', { class: `dl-slog-more${open ? ' open' : ''}` }, icon('chevron')) : '', - e.detail && open ? E('pre', { class: 'dl-slog-detail' }, e.detail) : '', + e.detail && open ? E('pre', { class: 'dl-slog-detail' }, detailText(e.detail)) : '', ], ), - E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString() }, time), + E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, time), ], ); if (e.detail) @@ -240,13 +282,14 @@ export function systemRow(e: ServiceLogEntry, open: boolean, toggle: () => void, return row; } -/** "Today", "Yesterday" or "Monday 12 October". */ +/** "Today", "Yesterday" or "Monday 12 October" (capitalised: Russian names weekdays in lower case). */ export function dayTitle(ts: number): string { const d = new Date(ts * 1000); const today = new Date(); const y = new Date(); y.setDate(today.getDate() - 1); - if (d.toDateString() === today.toDateString()) return 'Today'; - if (d.toDateString() === y.toDateString()) return 'Yesterday'; - return d.toLocaleDateString('en-GB', { weekday: 'long', day: 'numeric', month: 'long' }); + if (d.toDateString() === today.toDateString()) return _('Today'); + if (d.toDateString() === y.toDateString()) return _('Yesterday'); + const t = d.toLocaleDateString(locale(), { weekday: 'long', day: 'numeric', month: 'long' }); + return t.charAt(0).toLocaleUpperCase(locale()) + t.slice(1); } diff --git a/web/src/admin/interfaces.ts b/web/src/admin/interfaces.ts index baeafd2..18e8127 100644 --- a/web/src/admin/interfaces.ts +++ b/web/src/admin/interfaces.ts @@ -11,13 +11,15 @@ import { seg, sw } from './ui/controls'; import { attachTip } from './ui/tooltip'; import { installMissing } from './pkgs'; import { icon } from '../shared/icons'; +import { fill, fmt, locale, plural } from '../shared/i18n'; -const GROUPS: [IfaceCategory, string][] = [ +/** Groups of "Other interfaces", in order, with their headings. */ +const groups = (): [IfaceCategory, string][] => [ ['wan', 'WAN'], ['ethernet', 'Ethernet'], ['wifi', 'Wi-Fi'], - ['vpn', 'VPN & tunnels'], - ['other', 'Other'], + ['vpn', _('VPN & tunnels')], + ['other', _('Other')], ]; const ICON: Record = { @@ -48,7 +50,7 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise Promise 0 || sel || !!x.missing); const noZone = (sel || isAuto) && !x.zone && !x.missing; const sub = x.missing - ? 'Not present right now' + ? _('Not present right now') : x.own - ? 'This server' + ? _('This server') : x.master - ? `Port of ${x.master}` + ? fmt(_('Port of %s'), x.master) : isWan - ? `Internet${x.zone ? ` · zone ${x.zone}` : ''}` + ? `${_('Internet')}${x.zone ? ` · ${fmt(_('zone %s'), x.zone)}` : ''}` : x.nets.length ? x.nets.join(', ') - : 'No IPv4 network'; + : _('No IPv4 network'); const el = E( 'button', { @@ -140,19 +142,20 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise [ E('div', { class: 'dl-tip-title' }, x.name), E('div', { class: 'dl-muted' }, [ - x.logical ? `Interface ${x.logical}` : 'No netifd interface', - x.zone ? ` · zone ${x.zone}` : ' · no firewall zone', + x.logical ? fmt(_('Interface %s'), x.logical) : _('No netifd interface'), + ' · ', + x.zone ? fmt(_('zone %s'), x.zone) : _('no firewall zone'), ]), - x.members.length ? E('div', { class: 'dl-muted' }, `Ports: ${x.members.join(', ')}`) : '', + x.members.length ? E('div', { class: 'dl-muted' }, fmt(_('Ports: %s'), x.members.join(', '))) : '', x.nets.length ? E('div', { class: 'dl-mono' }, x.nets.join(', ')) : '', - noZone ? E('div', { class: 'dl-warn' }, 'Not in a firewall zone: the firewall rejects this traffic.') : '', - x.master ? E('div', { class: 'dl-muted' }, `Choose ${x.master} to include it.`) : '', + noZone ? E('div', { class: 'dl-warn' }, _('Not in a firewall zone: the firewall rejects this traffic.')) : '', + x.master ? E('div', { class: 'dl-muted' }, fmt(_('Choose %s to include it.'), x.master)) : '', ]); return el; } @@ -167,36 +170,39 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise = { - off: "Devices of different people never reach each other; a person's own devices don't either.", - all: 'Devices of people with home access reach each other, like home devices do. Internet-only people never.', - circles: 'Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never.', - }; + const meshText = (m: MeshMode): string => + ({ + off: _("Devices of different people never reach each other; a person's own devices don't either."), + all: _('Devices of people with home access reach each other, like home devices do. Internet-only people never.'), + circles: _('Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never.'), + })[m]; function setrow( ic: string, @@ -217,8 +223,12 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise { const mono = (t: string) => E('span', { class: 'dl-mono' }, t); - if (live) return E('span', {}, [' Now: ', mono(live), ...(saved && saved !== live ? [', was ', mono(saved)] : []), '.']); - return E('span', {}, saved ? [' Not found now: using ', mono(saved), '.'] : [' Not found.']); + if (live) + return E('span', {}, [ + ' ', + ...(saved && saved !== live ? fill(_('Now: %s, was %s.'), mono(live), mono(saved)) : fill(_('Now: %s.'), mono(live))), + ]); + return E('span', {}, [' ', ...(saved ? fill(_('Not found now: using %s.'), mono(saved)) : [_('Not found.')])]); }; function paint() { @@ -226,7 +236,7 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise { wanDev = (ev.target as HTMLSelectElement).value; paint(); @@ -234,7 +244,9 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise !x.own && !x.master && x.zone && !x.missing) - .map((x) => E('option', { value: x.name, selected: x.name === wanDev ? 'selected' : null }, `${x.name} · zone ${x.zone}`)), + .map((x) => + E('option', { value: x.name, selected: x.name === wanDev ? 'selected' : null }, `${x.name} · ${fmt(_('zone %s'), x.zone)}`), + ), ) as HTMLSelectElement; const home = homeDevs(); @@ -247,17 +259,21 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise button( - 'Save', + _('Save'), async () => { const r = await attempt( () => api.serverInterfaces(serverId, autoWan, autoWan ? '' : wanDev, autoLan, [...lans], lanLike, mesh !== 'off', mesh), - 'Access saved', + _('Access saved'), ); if (!r) return; take(r, true); if (r.nets_changed && r.lan_only) notify( - `${r.lan_only} ${r.lan_only === 1 ? 'person has' : 'people have'} Home-only access: their devices need the configuration again to reach the new networks.`, + plural( + r.lan_only, + '%s person has Home-only access: their devices need the configuration again to reach the new networks.', + '%s people have Home-only access: their devices need the configuration again to reach the new networks.', + ), 'warning', 10000, ); @@ -269,17 +285,17 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise installMissing('home', d.needs!, () => load(false)), 'positive') : '', - sw(lanLike, 'Internet like a home device', (v) => { + lanLike && d.needs?.length ? button(_('Install'), () => installMissing('home', d.needs!, () => load(false)), 'positive') : '', + sw(lanLike, _('Internet like a home device'), (v) => { lanLike = v; paint(); }), @@ -288,14 +304,14 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise { + sw(autoWan, _('Auto-detect WAN'), (v) => { autoWan = v; paint(); }), @@ -307,10 +323,13 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise Promise { - const t = { off: 'Off', all: 'Everyone', circles: 'Circles' }[v]; - if (!(await attempt(() => api.serverUpdate(serverId, { mesh: v }), `Devices reach each other: ${t}`))) return; + const t = { off: _('Off'), all: _('Everyone'), circles: _('Circles') }[v]; + if (!(await attempt(() => api.serverUpdate(serverId, { mesh: v }), fmt(_('Devices reach each other: %s'), t)))) return; mesh = v; d.config.mesh = v; paint(); @@ -342,23 +361,25 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise load(false), 'neutral', { title: 'Read the interfaces again' }), + E('span', { class: 'dl-sub' }, _('People with Home or Both')), + button([icon('reset'), ' ', _('Rescan')], () => load(false), 'neutral', { title: _('Read the interfaces again') }), ]), setrow( 'network', - 'Networks', - 'Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it.', + _('Networks'), + _( + 'Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it.', + ), '', '', netPicker(), ), setrow( 'link', - 'Devices reach each other', - MESH_TEXT[mesh], + _('Devices reach each other'), + meshText(mesh), meshSeg, '', mesh === 'circles' ? circleChips(st, serverId, refresh) : undefined, @@ -370,8 +391,15 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise [i ? ', ' : '', E('span', { class: 'dl-mono' }, n), ` (${dev})`])] - : 'No home network: Home access reaches nothing but this router.', + ? fill( + _('Home access reaches %s'), + E( + 'span', + {}, + nets.flatMap(([n, dev], i) => [i ? ', ' : '', E('span', { class: 'dl-mono' }, n), ` (${dev})`]), + ), + ) + : _('No home network: Home access reaches nothing but this router.'), ), save(homeDirty), ]), @@ -392,13 +420,13 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise { + sw(autoLan, _('Auto-detect LAN'), (v) => { autoLan = v; paint(); }), @@ -414,16 +442,16 @@ export function accessCards(srv: Server, first: Status, refresh: () => Promise { + ...groups().map(([cat, label]) => { const list = rest.filter((x) => x.category === cat); return list.length ? E('div', { class: 'dl-ifgroup' }, [E('h4', {}, label), E('div', { class: 'dl-ifgrid' }, list.map(tile))]) diff --git a/web/src/admin/invite.ts b/web/src/admin/invite.ts index 29aa555..2672c46 100644 --- a/web/src/admin/invite.ts +++ b/web/src/admin/invite.ts @@ -10,6 +10,7 @@ import { copyText, downloadFile } from './ui/files'; import { attempt, notify } from './ui/toast'; import { icon } from '../shared/icons'; import { qrSvg } from '../shared/qr'; +import { fill, fmt } from '../shared/i18n'; const W = 1080, H = 1512; @@ -23,8 +24,9 @@ const esc = (s: string) => s.replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '& function cardSvg(p: Pick, server: string, link: string): string { const url = new URL(link); const word = url.pathname.slice(1); + const hi = fmt(_('Hi, %s'), p.name); // Long names shrink to stay on one line (roughly 0.58 em per character). - const nameSize = Math.min(92, Math.floor((W - 2 * M) / (0.58 * (4 + p.name.length)))); + const nameSize = Math.min(92, Math.floor((W - 2 * M) / (0.58 * hi.length))); const tile = W - 2 * M, top = 392, pad = 40; @@ -39,8 +41,8 @@ function cardSvg(p: Pick, server: string, link: string): string `` + text(M + 82, M + 42, 36, '#a3a3a3', esc(server)) + // Greeting - text(M, 276, nameSize, '#ffffff', `Hi, ${esc(p.name)}`, 'font-weight="600"') + - text(M, 340, 40, '#8a8a8a', `Scan to connect to ${esc(server)}`) + + text(M, 276, nameSize, '#ffffff', esc(hi), 'font-weight="600"') + + text(M, 340, 40, '#8a8a8a', esc(fmt(_('Scan to connect to %s'), server))) + // Big QR on a white tile, edge to edge with the text above `` + qr + @@ -60,7 +62,7 @@ async function toPng(svg: string): Promise { canvas.height = H; canvas.getContext('2d')!.drawImage(img, 0, 0, W, H); return new Promise((resolve, reject) => - canvas.toBlob((b) => (b ? resolve(b) : reject(new Error('Could not draw the card'))), 'image/png'), + canvas.toBlob((b) => (b ? resolve(b) : reject(new Error(_('Could not draw the card')))), 'image/png'), ); } @@ -72,7 +74,7 @@ export async function personLinks(id: string): Promise<{ link: string; links: st const r = await attempt(() => api.personLinks(id)); if (!r) return null; if (!r.link) { - notify('The personal portal is off. Turn it on in Settings.', 'warning'); + notify(_('The personal portal is off. Turn it on in Settings.'), 'warning'); return null; } return { link: r.link, links: r.links ?? [] }; @@ -81,7 +83,7 @@ export async function personLinks(id: string): Promise<{ link: string; links: st /** Copy a person's personal link. */ export async function copyPersonLink(id: string) { const r = await personLinks(id); - if (r) await copyText(r.link, 'Personal link copied'); + if (r) await copyText(r.link, _('Personal link copied')); } /** @@ -98,7 +100,7 @@ export async function inviteCard(p: Invitee, server: string, opts: { title?: str links = r.links; } if (!link) { - notify('The personal portal is off. Turn it on in Settings.', 'warning'); + notify(_('The personal portal is off. Turn it on in Settings.'), 'warning'); return; } const href = link; @@ -123,49 +125,54 @@ export async function inviteCard(p: Invitee, server: string, opts: { title?: str } }; const share = canShareFile - ? button([icon('link'), ' Share card'], () => shareIt({ files: [file], title: `Invite ${p.name}` }), 'positive') + ? button([icon('link'), ' ', _('Share card')], () => shareIt({ files: [file], title: fmt(_('Invite %s'), p.name) }), 'positive') : canShareLink ? button( - [icon('link'), ' Share link'], - () => shareIt({ url: href, title: `Invite ${p.name}`, text: `Your personal VPN link` }), + [icon('link'), ' ', _('Share link')], + () => shareIt({ url: href, title: fmt(_('Invite %s'), p.name), text: _('Your personal VPN link') }), 'positive', ) - : button([icon('download'), ' Download card'], () => downloadFile(file.name, png), 'positive'); + : button([icon('download'), ' ', _('Download card')], () => downloadFile(file.name, png), 'positive'); modal( - opts.title ?? `Invite ${p.name}`, + opts.title ?? fmt(_('Invite %s'), p.name), E('div', { class: 'dl-invite' }, [ - E('img', { src: url, alt: `Invite card for ${p.name}` }), + E('img', { src: url, alt: fmt(_('Invite card for %s'), p.name) }), E('div', { class: 'dl-invite-side' }, [ E( 'p', { class: 'dl-muted' }, - opts.lead ?? `Send ${p.name} the card or the link. They open it, add their devices and connect — no account needed.`, + opts.lead ?? fmt(_('Send %s the card or the link. They open it, add their devices and connect - no account needed.'), p.name), + ), + E( + 'button', + { type: 'button', class: 'dl-invite-link', title: _('Copy link'), click: () => copyText(href, _('Personal link copied')) }, + [E('span', {}, href.replace(/^https:\/\//, '')), icon('copy')], ), - E('button', { type: 'button', class: 'dl-invite-link', title: 'Copy link', click: () => copyText(href, 'Personal link copied') }, [ - E('span', {}, href.replace(/^https:\/\//, '')), - icon('copy'), - ]), ...(links ?? []) .filter((l) => l !== href) .map((l) => - E('button', { type: 'button', class: 'dl-invite-link alt', title: 'Copy this link', click: () => copyText(l, 'Link copied') }, [ - E('span', {}, l.replace(/^https?:\/\//, '')), - E('span', { class: `dl-pill ${l.startsWith('http:') ? 'warn' : ''}` }, l.startsWith('http:') ? 'HTTP' : 'Also'), - icon('copy'), - ]), + E( + 'button', + { type: 'button', class: 'dl-invite-link alt', title: _('Copy this link'), click: () => copyText(l, _('Link copied')) }, + [ + E('span', {}, l.replace(/^https?:\/\//, '')), + E('span', { class: `dl-pill ${l.startsWith('http:') ? 'warn' : ''}` }, l.startsWith('http:') ? 'HTTP' : _('Also')), + icon('copy'), + ], + ), ), E('ol', { class: 'dl-invite-steps' }, [ - E('li', {}, ['Install ', E('b', {}, 'AmneziaVPN'), ' on the device']), - E('li', {}, 'Open the link or scan the code'), - E('li', {}, 'Add the device and connect'), + E('li', {}, fill(_('Install %s on the device'), E('b', {}, 'AmneziaVPN'))), + E('li', {}, _('Open the link or scan the code')), + E('li', {}, _('Add the device and connect')), ]), E('div', { class: 'dl-invite-actions' }, [ share, - button([icon('copy'), ' Copy link'], () => copyText(href, 'Personal link copied')), + button([icon('copy'), ' ', _('Copy link')], () => copyText(href, _('Personal link copied'))), ]), ]), ]), - [E('button', { class: 'cbi-button cbi-button-neutral', click: close }, 'Done')], + [E('button', { class: 'cbi-button cbi-button-neutral', click: close }, _('Done'))], 'wide', ); } diff --git a/web/src/admin/logs.ts b/web/src/admin/logs.ts index eb94b5b..9a4a2ff 100644 --- a/web/src/admin/logs.ts +++ b/web/src/admin/logs.ts @@ -8,8 +8,9 @@ import { button } from './ui/button'; import { cancelButton, closeModal, modal } from './ui/modal'; import { downloadFile } from './ui/files'; import { attempt, errorText, notify } from './ui/toast'; -import { CATEGORIES, CATEGORY_LABEL, SYSTEM_SOURCE, categoryOf, eventBy } from './events/model'; +import { CATEGORIES, categoryLabel, categoryOf, eventBy, sourceName } from './events/model'; import { toCsv } from './events/csv'; +import { fmt, plural } from '../shared/i18n'; function names(st: Pick) { const people = new Map(st.people.map((p) => [p.id, p.name])); @@ -44,7 +45,7 @@ export function exportEvents( person: '', device: '', detail: `${e.who ? `${e.who} ` : ''}${e.msg}${e.detail ? `\n${e.detail}` : ''}`, - where: SYSTEM_SOURCE[e.src] ?? e.src, + where: sourceName(e.src), by: '', })), ] @@ -57,17 +58,26 @@ export function exportEvents( return; } const cols = ['time', 'category', 'type', 'person', 'device', 'detail', 'where', 'by'] as const; - downloadFile(name, toCsv(cols, rows), 'text/csv'); + // The header row in the page's language; the cells are the log's ids, names and details. + const head = { + time: _('Time'), + category: _('Category'), + type: _('Type'), + person: _('Person'), + device: _('Device'), + detail: _('Detail'), + where: _('Where'), + by: _('By'), + }; + downloadFile(name, toCsv(cols, rows, head), 'text/csv'); } -const AGES: [string, string][] = [ - ['', 'Everything'], - ['7', 'Older than 7 days'], - ['30', 'Older than 30 days'], - ['90', 'Older than 90 days'], -]; +/** The ages the dialog offers, in days ('' = everything). */ +const AGES = ['', '7', '30', '90']; -const removed = (n: number) => (n ? `${n} event${n === 1 ? '' : 's'} removed` : 'Nothing matched'); +const ageLabel = (v: string) => (v ? plural(Number(v), 'Older than %s day', 'Older than %s days') : _('Everything')); + +const removed = (n: number) => (n ? plural(n, '%s event removed', '%s events removed') : _('Nothing matched')); /** * Ask what to clear and do it. `base` pins person/device; the dialog lets you @@ -82,27 +92,27 @@ export function clearLogDialog( withSystem = false, ) { const cat = E('select', { class: 'cbi-input-select' }, [ - E('option', { value: '' }, 'All categories'), - ...CATEGORIES.map((c) => E('option', { value: c, selected: c === category ? 'selected' : null }, CATEGORY_LABEL[c])), - withSystem ? E('option', { value: 'system', selected: category === 'system' ? 'selected' : null }, 'System') : '', + E('option', { value: '' }, _('All categories')), + ...CATEGORIES.map((c) => E('option', { value: c, selected: c === category ? 'selected' : null }, categoryLabel(c))), + withSystem ? E('option', { value: 'system', selected: category === 'system' ? 'selected' : null }, _('System')) : '', ]) as HTMLSelectElement; const age = E( 'select', { class: 'cbi-input-select' }, - AGES.map(([v, t]) => E('option', { value: v }, t)), + AGES.map((v) => E('option', { value: v }, ageLabel(v))), ) as HTMLSelectElement; modal( title, [ - E('p', { class: 'dl-muted' }, `${what} This cannot be undone; export first if you want a copy.`), - E('label', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, 'Category'), cat]), - E('label', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, 'Which events'), age]), + E('p', { class: 'dl-muted' }, `${what} ${_('This cannot be undone; export first if you want a copy.')}`), + E('label', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, _('Category')), cat]), + E('label', { class: 'dl-fld' }, [E('span', { class: 'dl-fld-label' }, _('Which events')), age]), ], [ cancelButton(), ' ', button( - 'Clear', + _('Clear'), async () => { // The activity log first, then the service log ("System"; "All categories" // clears it too where it is shown). Each result is reported on its own. @@ -120,11 +130,9 @@ export function clearLogDialog( n += (await api.serviceLogClear(age.value)).removed; } catch (e) { closeModal(); - notify( - `${cat.value === 'system' ? '' : `Activity: ${removed(n).toLowerCase()}. `}The service log was not cleared: ${errorText(e)}`, - 'error', - 10000, - ); + // The router's reason last, as it came. + const failed = fmt(_('The service log was not cleared: %s'), errorText(e)); + notify(cat.value === 'system' ? failed : `${fmt(_('Activity: %s.'), removed(n).toLowerCase())} ${failed}`, 'error', 10000); done(); return; } @@ -143,20 +151,20 @@ export function clearLogDialog( export function resetUsageDialog(scope: 'all' | 'person' | 'device', id: string, label: string, done: () => unknown) { const body = scope === 'device' - ? `Clears ${label}'s daily and monthly traffic history. Their person's totals and data limit are not changed.` + ? fmt(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."), label) : scope === 'person' - ? `Clears ${label}'s traffic history and that of their devices. Their data limit starts again from zero.` - : 'Clears traffic history for everyone. Data limits start again from zero.'; + ? fmt(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."), label) + : _('Clears traffic history for everyone. Data limits start again from zero.'); modal( - scope === 'all' ? 'Reset all traffic history?' : `Reset traffic history for ${label}?`, + scope === 'all' ? _('Reset all traffic history?') : fmt(_('Reset traffic history for %s?'), label), [E('p', { class: 'dl-muted' }, body)], [ cancelButton(), ' ', button( - 'Reset', + _('Reset'), async () => { - if (!(await attempt(() => api.usageClear(scope, id), 'Traffic history reset'))) return; + if (!(await attempt(() => api.usageClear(scope, id), _('Traffic history reset')))) return; closeModal(); done(); }, diff --git a/web/src/admin/luci.d.ts b/web/src/admin/luci.d.ts index 4e0d06e..a0dcb25 100644 --- a/web/src/admin/luci.d.ts +++ b/web/src/admin/luci.d.ts @@ -113,8 +113,6 @@ declare global { } const E: (tag: string, attrs?: ElementAttrs | Child, children?: Child) => HTMLElement; - const _: (msg: string, ctx?: string) => string; - const N_: (n: number, singular: string, plural: string, ctx?: string) => string; const L: LuciL; const ui: LuciUI; const rpc: LuciRpc; diff --git a/web/src/admin/map.ts b/web/src/admin/map.ts index f7090ac..d9de683 100644 --- a/web/src/admin/map.ts +++ b/web/src/admin/map.ts @@ -8,6 +8,7 @@ import type { Geo, GeoPoint, Person } from '../shared/types'; import { E } from './e'; import { ago, initials } from '../shared/format'; +import { fmt, num, plural } from '../shared/i18n'; import { icon, iconSvg } from '../shared/icons'; import { onNavigate } from './ui/nav'; import { isDark } from './ui/theme'; @@ -64,8 +65,8 @@ function loadMapLibre(host: HTMLElement): Promise { loading = null; throw new Error( e?.message === 'integrity' - ? 'The map library from the CDN is not the expected file: not loading it.' - : 'Could not load the map library (no internet access from this browser?)', + ? _('The map library from the CDN is not the expected file: not loading it.') + : _('Could not load the map library (no internet access from this browser?)'), ); }, ); @@ -416,11 +417,11 @@ export class ConnectionMap { this.dockKey = ''; const el = E( 'div', - { class: 'dl-mk-hub', title: `Home router${home.city ? ` · ${home.city}` : ''}${home.org ? ` · ${home.org}` : ''}` }, - [host, E('span', { class: 'dl-mk-label chip' }, home.city || 'Home')], + { class: 'dl-mk-hub', title: `${_('Home router')}${home.city ? ` · ${home.city}` : ''}${home.org ? ` · ${home.org}` : ''}` }, + [host, E('span', { class: 'dl-mk-label chip' }, home.city || _('Home'))], ); // Who is docked here: listed on hover; a click on the plate zooms to them (an avatar opens its card). - el.addEventListener('mouseenter', () => this.showMerged(home.city || 'the server')); + el.addEventListener('mouseenter', () => this.showMerged(home.city)); el.addEventListener('mouseleave', () => this.focus(this.focused)); el.addEventListener('click', () => this.zoomToMerged()); this.add(el, [home.lon, home.lat], true); @@ -448,7 +449,9 @@ export class ConnectionMap { { type: 'button', class: `dl-mk${g.online ? ' online' : ''}`, - 'aria-label': `${person?.name ?? 'Someone'}: ${n} device${n === 1 ? '' : 's'} in ${g.city || 'an unknown city'}`, + 'aria-label': g.city + ? fmt(N_(n, '%s: %s device in %s', '%s: %s devices in %s'), person?.name ?? _('Someone'), num(n), g.city) + : fmt(N_(n, '%s: %s device in an unknown city', '%s: %s devices in an unknown city'), person?.name ?? _('Someone'), num(n)), }, [ E('span', { class: 'dl-mk-av' }, [initials(person?.name ?? '?'), badge]), @@ -462,7 +465,15 @@ export class ConnectionMap { ev.stopPropagation(); this.openPopup(g, at, el); }); - this.add(el, at, false, person?.name ?? 'Someone', `${g.city || g.cc || '?'} · ${g.online ? 'now' : ago(g.ts, data.now)}`, g.key, g); + this.add( + el, + at, + false, + person?.name ?? _('Someone'), + `${g.city || g.cc || '?'} · ${g.online ? _('now') : ago(g.ts, data.now)}`, + g.key, + g, + ); } this.declutter(); @@ -488,7 +499,7 @@ export class ConnectionMap { this.fit(coords, animate); } } - this.status.textContent = placed.length || home ? '' : 'No locations yet'; + this.status.textContent = placed.length || home ? '' : _('No locations yet'); this.status.style.display = this.status.textContent ? '' : 'none'; this.focus(this.focused && this.people.some((x) => x.person === this.focused) ? this.focused : null); } @@ -605,11 +616,14 @@ export class ConnectionMap { this.popup = null; } - /** The people folded into the server, in the corner card. */ - private showMerged(place: string) { + /** The people folded into the server, in the corner card; `city` is the server's, when known. */ + private showMerged(city: string) { if (!this.merged.length) return; dom.content(this.card, [ - E('div', { class: 'dl-map-card-head' }, [E('b', {}, `Near ${place}`), ' · click to zoom in']), + E('div', { class: 'dl-map-card-head' }, [ + E('b', {}, city ? fmt(_('Near %s'), city) : _('Near the server')), + ` · ${_('click to zoom in')}`, + ]), ...this.merged.map((m) => E('div', { class: 'dl-map-card-row' }, [E('span', {}, m.who), E('span', { class: 'dl-faint' }, m.where)])), ]); this.card.classList.add('on'); @@ -682,7 +696,7 @@ export class ConnectionMap { const cities = [...new Set(slots.map((x) => x.g?.city || x.g?.cc || '?'))]; const el = E('div', { class: 'dl-mk-pile' }, [ box, - E('span', { class: 'dl-mk-label below' }, cities.length === 1 ? cities[0] : `${slots.length} people`), + E('span', { class: 'dl-mk-label below' }, cities.length === 1 ? cities[0] : plural(slots.length, '%s person', '%s people')), ]); pile = { marker: new this.gl.Marker({ element: el }).setLngLat(at).addTo(this.map), el, box, faces }; el.addEventListener('mouseleave', () => this.focus(this.focused)); @@ -796,14 +810,16 @@ export class ConnectionMap { const n = g.points.length; const tile = E('span', { class: 'dl-mk-tile' }); tile.innerHTML = iconSvg(kind, 'dl-mk-tile-ic') + (n > 1 ? `${n}` : ''); - const when = g.online ? 'now' : ago(g.ts, now); + const when = g.online ? _('now') : ago(g.ts, now); const el = E( 'button', { type: 'button', class: `dl-mk place${g.online ? ' online' : ''}`, style: g.online ? null : `--dl-mk-fade:${Math.max(0.4, 1 - (0.6 * (now - g.ts)) / (30 * 86400)).toFixed(2)}`, - 'aria-label': `${n} device${n === 1 ? '' : 's'} in ${g.city || 'an unknown city'}, ${when}`, + 'aria-label': g.city + ? fmt(N_(n, '%s device in %s, %s', '%s devices in %s, %s'), num(n), g.city, when) + : fmt(N_(n, '%s device in an unknown city, %s', '%s devices in an unknown city, %s'), num(n), when), }, [tile, E('span', { class: 'dl-mk-label below' }, [g.city || g.cc || '?', E('span', { class: 'dl-mk-when' }, when)])], ); @@ -850,11 +866,11 @@ export class ConnectionMap { x.when = null; if (on) { // In the replay the time goes on the city's line (two lines would run into a place below). - x.when = E('span', { class: `dl-mk-when${r ? ' inline' : ''}` }, r ? r.when : 'now'); + x.when = E('span', { class: `dl-mk-when${r ? ' inline' : ''}` }, r ? r.when : _('now')); x.label.replaceChildren(city, r ? ' · ' : '', x.when); - } else x.label.replaceChildren(`${city} · ${x.g.online ? 'now' : ago(x.g.ts, this.data!.now)}`); - const when = on ? (r ? r.when : 'now') : x.g.online ? 'now' : ago(x.g.ts, this.data!.now); - x.el.setAttribute('aria-label', `${x.n ? `${x.n}: ` : ''}${x.g.city || 'an unknown city'}, ${when}`); + } else x.label.replaceChildren(`${city} · ${x.g.online ? _('now') : ago(x.g.ts, this.data!.now)}`); + const when = on ? (r ? r.when : _('now')) : x.g.online ? _('now') : ago(x.g.ts, this.data!.now); + x.el.setAttribute('aria-label', `${x.n ? `${x.n}: ` : ''}${x.g.city || _('an unknown city')}, ${when}`); if (animate && on && !was) { x.el.classList.remove('arrive'); void x.el.offsetWidth; @@ -940,11 +956,11 @@ export class ConnectionMap { .filter((p) => p.person === person) .sort((a, b) => Number(b.online) - Number(a.online) || b.ts - a.ts); dom.content(this.card, [ - E('div', { class: 'dl-map-card-head' }, [E('b', {}, who?.name ?? person), ` · ${pts.length} device${pts.length === 1 ? '' : 's'}`]), + E('div', { class: 'dl-map-card-head' }, [E('b', {}, who?.name ?? person), ` · ${plural(pts.length, '%s device', '%s devices')}`]), ...pts.map((p) => E('div', { class: 'dl-map-card-row' }, [ - E('span', {}, who?.devices.find((d) => d.id === p.device)?.name ?? 'Device'), - E('span', { class: 'dl-faint' }, `${p.city || p.cc || '?'} · ${p.online ? 'now' : ago(p.ts, data.now)}`), + E('span', {}, who?.devices.find((d) => d.id === p.device)?.name ?? _('Device')), + E('span', { class: 'dl-faint' }, `${p.city || p.cc || '?'} · ${p.online ? _('now') : ago(p.ts, data.now)}`), ]), ), ]); @@ -1010,6 +1026,7 @@ export class ConnectionMap { const data = this.data!; const where = [g.city, g.cc || g.country].filter(Boolean).join(', '); const people = [...new Set(g.points.map((p) => p.person))]; + const owner = people.length === 1 ? data.people.find((x) => x.id === people[0])?.name : undefined; const rows = g.points .sort((a, b) => Number(b.online) - Number(a.online) || b.ts - a.ts) .map((p) => { @@ -1017,16 +1034,19 @@ export class ConnectionMap { const dev = person?.devices.find((d) => d.id === p.device); return E('button', { type: 'button', class: 'dl-pop-row', click: () => this.cb.openDevice(p.person, p.device) }, [ E('span', { class: `dl-pop-dot${p.online ? ' on' : ''}` }), - E('span', { class: 'dl-pop-name' }, [E('b', {}, person?.name ?? p.person), ` · ${dev?.name ?? 'device'}`]), - E('span', { class: 'dl-faint dl-nowrap' }, p.online ? 'now' : ago(p.ts, data.now)), + E('span', { class: 'dl-pop-name' }, [E('b', {}, person?.name ?? p.person), ` · ${dev?.name ?? _('device')}`]), + E('span', { class: 'dl-faint dl-nowrap' }, p.online ? _('now') : ago(p.ts, data.now)), ]); }); const body = E('div', { class: 'dl-pop' }, [ E('div', { class: 'dl-pop-head' }, [ E('span', { class: 'dl-pop-net' }, icon('globe')), E('div', { class: 'dl-stack' }, [ - E('strong', {}, g.org || 'Unknown network'), - E('span', { class: 'dl-faint' }, [g.asn ? `AS${g.asn} · ` : '', where ? `${where} · approximate` : 'approximate location']), + E('strong', {}, g.org || _('Unknown network')), + E('span', { class: 'dl-faint' }, [ + g.asn ? `AS${g.asn} · ` : '', + where ? `${where} · ${_('approximate')}` : _('approximate location'), + ]), ]), ]), E('div', { class: 'dl-pop-list' }, rows), @@ -1035,7 +1055,7 @@ export class ConnectionMap { E( 'button', { type: 'button', class: 'cbi-button cbi-button-positive important', click: () => this.cb.openPerson(people[0]) }, - `Open ${data.people.find((x) => x.id === people[0])?.name ?? 'person'}`, + owner ? fmt(_('Open %s'), owner) : _('Open person'), ), ]) : '', @@ -1198,7 +1218,7 @@ export interface Face { function face(slot: { el: HTMLElement; at: [number, number]; who?: string; where?: string; g?: Group }): Face { return { key: slot.el.dataset.key ?? '', - who: slot.who ?? 'Someone', + who: slot.who ?? _('Someone'), where: slot.where ?? '', online: !!slot.g?.online, at: slot.at, @@ -1350,10 +1370,10 @@ interface Group { /** Segmented range control for the map header. */ export function rangeControl(initial: Range, onChange: (r: Range) => void, online = true): HTMLElement { const opts: [Range, string][] = [ - ['online', 'Online now'], - ['24h', '24h'], - ['7d', '7 days'], - ['30d', '30 days'], + ['online', _('Online now')], + ['24h', _('24h')], + ['7d', _('7 days')], + ['30d', _('30 days')], ]; const el = E('div', { class: 'dl-seg', role: 'tablist' }); for (const [v, label] of opts) { diff --git a/web/src/admin/netcheck.ts b/web/src/admin/netcheck.ts index f53790d..577ee72 100644 --- a/web/src/admin/netcheck.ts +++ b/web/src/admin/netcheck.ts @@ -2,6 +2,8 @@ // them (rpc/servers.uc) and said in plain words for the setup wizard. The // addresses are three numbers ("10.77.0"): the tunnel is that /24. +import { fmt, locale, num, plural } from '../shared/i18n'; + /** A network on the router, by name: an interface ("lan") or a server ("Home"). */ export interface Network { name: string; @@ -56,19 +58,19 @@ export function subnetOf(range: string): string { export function rangeHelp(range: string, nets: Network[], suggest: string): Help { const r = range.trim(); const c = /^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r) ? parseCidr(subnetOf(r)) : null; - if (!c) return { text: 'Three numbers, like 10.77.0.', bad: true }; + if (!c) return { text: _('Three numbers, like 10.77.0.'), bad: true }; if (!PRIVATE.some((p) => c.net >= p.net && c.net + c.size <= p.net + p.size)) - return { text: 'Use a private range: 10.x.x, 172.16–31.x or 192.168.x.', bad: true }; + return { text: _('Use a private range: 10.x.x, 172.16–31.x or 192.168.x.'), bad: true }; const hit = nets.find((n) => { const o = parseCidr(n.cidr); return o != null && overlaps(c, o); }); if (hit) { const used = hit.cidr.endsWith('/24') ? `${rangeOf(hit.cidr)}.x` : hit.cidr; - const other = suggest && suggest !== r ? ` Try ${suggest}.` : ''; - return { text: `${hit.name} already uses ${used}.${other}`, bad: true }; + const uses = fmt(_('%s already uses %s.'), hit.name, used); + return { text: suggest && suggest !== r ? `${uses} ${fmt(_('Try %s.'), suggest)}` : uses, bad: true }; } - return { text: `Devices get ${r}.2 – ${r}.254, the router ${r}.1.`, bad: false }; + return { text: fmt(_('Devices get %s – %s, the router %s.'), `${r}.2`, `${r}.254`, `${r}.1`), bad: false }; } const holder = (port: number, taken: PortHold[]): string | null => taken.find((t) => t.from <= port && port <= t.to)?.who ?? null; @@ -77,19 +79,21 @@ const validPort = (port: number): boolean => Number.isInteger(port) && port >= 1 /** A port: `free` when nobody holds it, or who does. */ export function portHelp(port: number, taken: PortHold[], free: string): Help { - if (!validPort(port)) return { text: 'Use a port from 1 to 65535.', bad: true }; + if (!validPort(port)) return { text: _('Use a port from 1 to 65535.'), bad: true }; const who = holder(port, taken); - return who ? { text: `Used by ${who}. Choose another port.`, bad: true } : { text: free, bad: false }; + return who ? { text: fmt(_('Used by %s. Choose another port.'), who), bad: true } : { text: free, bad: false }; } /** The portal's TCP port; links on IP addresses (`ipLinks`) use plain HTTP on the next one too. */ export function portalPortHelp(port: number, taken: PortHold[], ipLinks: boolean): Help { - const free = ipLinks ? `HTTPS here, plain HTTP for links on IP addresses on ${port + 1}.` : 'HTTPS on this port, opened on WAN.'; + const free = ipLinks + ? fmt(_('HTTPS here, plain HTTP for links on IP addresses on %s.'), port + 1) + : _('HTTPS on this port, opened on WAN.'); const h = portHelp(port, taken, free); if (h.bad || !ipLinks) return h; - if (port === 65535) return { text: 'Links on IP addresses also need the next port: choose a lower one.', bad: true }; + if (port === 65535) return { text: _('Links on IP addresses also need the next port: choose a lower one.'), bad: true }; const who = holder(port + 1, taken); - return who ? { text: `Links on IP addresses also need ${port + 1}, used by ${who}. Choose another port.`, bad: true } : h; + return who ? { text: fmt(_('Links on IP addresses also need %s, used by %s. Choose another port.'), port + 1, who), bad: true } : h; } /* ---------- other fields, mirroring the router's rules (dawnline.util, schema, core) ---------- */ @@ -100,23 +104,28 @@ export const chars = (s: string): number => Array.from(s).length; const NAME_MAX = 48; const BAD_NAME = /[<>"\\\u0000-\u001f\u007f]/; +/** "Up to 48 characters (50 now).": a name over its limit. */ +const tooLong = (max: number, s: string): string => + fmt(N_(max, 'Up to %s character (%s now).', 'Up to %s characters (%s now).'), num(max), num(chars(s))); + /** * A name people see (util.valid_name): 1–48 characters, none of < > " \. * `taken` are names already used where it must be unique (case-insensitive). */ export function nameHelp(s: string, taken: string[] = [], good = ''): Help { const t = s.trim(); - if (!t) return { text: 'Enter a name.', bad: true }; - if (chars(s) > NAME_MAX) return { text: `Up to ${NAME_MAX} characters (${chars(s)} now).`, bad: true }; - if (BAD_NAME.test(s)) return { text: 'Names can’t contain < > " or \\.', bad: true }; - if (taken.some((x) => x.toLowerCase() === t.toLowerCase())) return { text: `“${t}” already exists — pick another name.`, bad: true }; + if (!t) return { text: _('Enter a name.'), bad: true }; + if (chars(s) > NAME_MAX) return { text: tooLong(NAME_MAX, s), bad: true }; + if (BAD_NAME.test(s)) return { text: _('Names can’t contain < > " or \\.'), bad: true }; + if (taken.some((x) => x.toLowerCase() === t.toLowerCase())) + return { text: fmt(_('“%s” already exists - pick another name.'), t), bad: true }; return { text: good, bad: false }; } /** A circle's name: like a name, up to 32 characters. */ export function circleNameHelp(s: string, taken: string[] = []): Help { - if (chars(s) > 32) return { text: `Up to 32 characters (${chars(s)} now).`, bad: true }; - return nameHelp(s, taken, 'Shown on the person cards.'); + if (chars(s) > 32) return { text: tooLong(32, s), bad: true }; + return nameHelp(s, taken, _('Shown on the person cards.')); } const HOSTNAME = /^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; @@ -138,24 +147,28 @@ export function isIpv6(s: string): boolean { */ export function hostHelp(s: string, port?: number, empty: string | null = null): Help { const t = s.trim(); - if (!t) return empty != null ? { text: empty, bad: false } : { text: 'Enter a hostname or IP address.', bad: true }; - if (/^[a-z]+:\/\//i.test(t)) return { text: 'Leave out https:// — just the name.', bad: true }; - if (/\/.*/.test(t)) return { text: 'Just the name, without a path.', bad: true }; - if (/^[^:\[]+:\d+$/.test(t)) return { text: 'Just the name, without a port (the port is on AmneziaWG).', bad: true }; - if (/\s/.test(t)) return { text: 'A hostname has no spaces.', bad: true }; - if (t.length > 253 || !(HOSTNAME.test(t) || isIpv4(t) || isIpv6(t))) return { text: 'Use a hostname or an IP address.', bad: true }; + if (!t) return empty != null ? { text: empty, bad: false } : { text: _('Enter a hostname or IP address.'), bad: true }; + if (/^[a-z]+:\/\//i.test(t)) return { text: _('Leave out https:// - just the name.'), bad: true }; + if (/\/.*/.test(t)) return { text: _('Just the name, without a path.'), bad: true }; + if (/^[^:\[]+:\d+$/.test(t)) return { text: _('Just the name, without a port (the port is on AmneziaWG).'), bad: true }; + if (/\s/.test(t)) return { text: _('A hostname has no spaces.'), bad: true }; + if (t.length > 253 || !(HOSTNAME.test(t) || isIpv4(t) || isIpv6(t))) return { text: _('Use a hostname or an IP address.'), bad: true }; const shown = isIpv6(t) ? `[${t}]` : t; - return { text: port ? `Devices connect to ${shown}:${port}.` : `Links use ${shown}.`, bad: false }; + return { text: port ? fmt(_('Devices connect to %s.'), `${shown}:${port}`) : fmt(_('Links use %s.'), shown), bad: false }; } /** The DNS list a server hands to devices (rpc/servers.uc dns_list): IPs, comma-separated; empty = this router. */ export function dnsHelp(s: string, routerAddr: string): Help { const items = s.split(/[ ,]+/).filter(Boolean); if (!items.length) - return { text: `This router (${routerAddr}): queries go where your home network sends them, and home names work.`, bad: false }; + return { + text: fmt(_('This router (%s): queries go where your home network sends them, and home names work.'), routerAddr), + bad: false, + }; const bad = items.find((x) => !isIpv4(x) && !isIpv6(x)); - if (bad) return { text: `“${bad}” is not an IP address. Separate several with commas.`, bad: true }; - return { text: `Devices use ${items.join(' and ')} — home names and your LAN’s DNS filters no longer apply to them.`, bad: false }; + if (bad) return { text: fmt(_('“%s” is not an IP address. Separate several with commas.'), bad), bad: true }; + const list = new Intl.ListFormat(locale(), { type: 'conjunction' }).format(items); + return { text: fmt(_('Devices use %s - home names and your LAN’s DNS filters no longer apply to them.'), list), bad: false }; } /** MTU (rpc/servers.uc check_mtu): empty = automatic, else 1280–1500. */ @@ -163,42 +176,66 @@ export function mtuHelp(s: string, mtus: { computer: number; phone: number }): H const t = s.trim(); if (!t) return { - text: `Automatic by device type and disguise: ${mtus.computer} for computers and routers, ${mtus.phone} for phones and tablets.`, + text: fmt( + _('Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets.'), + mtus.computer, + mtus.phone, + ), bad: false, }; if (!/^\d{1,4}$/.test(t) || Number(t) < 1280 || Number(t) > 1500) - return { text: 'MTU must be 1280–1500, or empty for automatic.', bad: true }; + return { text: _('MTU must be 1280–1500, or empty for automatic.'), bad: true }; const n = Number(t); - return { text: `Computers and routers get ${n}, phones and tablets ${Math.min(n, 1280)}.`, bad: false }; + return { text: fmt(_('Computers and routers get %s, phones and tablets %s.'), n, Math.min(n, 1280)), bad: false }; } /** Keep-alive (rpc/servers.uc): 0–600 s; empty = 25. */ export function keepaliveHelp(s: string): Help { const t = s.trim(); - if (!t) return { text: 'Default: a packet every 25 s keeps NAT open and “Connected” accurate.', bad: false }; - if (!/^\d{1,3}$/.test(t) || Number(t) > 600) return { text: 'Use 0–600 seconds.', bad: true }; - if (Number(t) === 0) return { text: 'Off: NAT may close the tunnel when idle, and “Connected” lags.', bad: false }; - return { text: `Devices send a packet every ${t} s to keep NAT open (a little battery on phones).`, bad: false }; + if (!t) return { text: _('Default: a packet every 25 s keeps NAT open and “Connected” accurate.'), bad: false }; + if (!/^\d{1,3}$/.test(t) || Number(t) > 600) return { text: _('Use 0–600 seconds.'), bad: true }; + if (Number(t) === 0) return { text: _('Off: NAT may close the tunnel when idle, and “Connected” lags.'), bad: false }; + return { text: fmt(_('Devices send a packet every %s s to keep NAT open (a little battery on phones).'), t), bad: false }; } /** Device limit (core.create_person): 1–32; `have` is how many they have now (an edit). */ export function limitHelp(s: string, have = 0): Help { const t = s.trim(); - if (!/^\d{1,2}$/.test(t) || Number(t) < 1 || Number(t) > 32) return { text: 'Use 1–32.', bad: true }; + if (!/^\d{1,2}$/.test(t) || Number(t) < 1 || Number(t) > 32) return { text: _('Use 1–32.'), bad: true }; const n = Number(t); if (have > n) - return { text: `Already has ${have} devices: remove ${have - n === 1 ? 'one' : `${have - n}`} first, or allow more.`, bad: true }; - return { text: `They can add ${n} device${n === 1 ? '' : 's'} themselves.`, bad: false }; + return { + text: + have - n === 1 + ? fmt( + N_( + have, + 'Already has %s device: remove one first, or allow more.', + 'Already has %s devices: remove one first, or allow more.', + ), + num(have), + ) + : fmt( + N_(have, 'Already has %s device: remove %s first, or allow more.', 'Already has %s devices: remove %s first, or allow more.'), + num(have), + num(have - n), + ), + bad: true, + }; + return { text: plural(n, 'They can add %s device themselves.', 'They can add %s devices themselves.'), bad: false }; } /** Monthly data in GB (core.create_person): empty = unlimited, else 0–100000. */ export function quotaHelp(s: string, monthly = true): Help { const t = s.trim(); - if (!t) return { text: 'Optional. No data limit.', bad: false }; + if (!t) return { text: _('Optional. No data limit.'), bad: false }; const n = Number(t); - if (!/^\d+(\.\d+)?$/.test(t) || n < 0 || n > 100000) return { text: 'A number of GB, up to 100000.', bad: true }; - if (n === 0) return { text: 'Optional. No data limit.', bad: false }; - return { text: monthly ? `Paused after ${t} GB this month, resumed on the 1st.` : `Paused after ${t} GB in total.`, bad: false }; + if (!/^\d+(\.\d+)?$/.test(t) || n < 0 || n > 100000) return { text: _('A number of GB, up to 100000.'), bad: true }; + if (n === 0) return { text: _('Optional. No data limit.'), bad: false }; + return { + text: fmt(monthly ? _('Paused after %s GB this month, resumed on the 1st.') : _('Paused after %s GB in total.'), num(n)), + bad: false, + }; } /** An end date (YYYY-MM-DD) against the router's day; empty = none. */ @@ -209,64 +246,70 @@ export function expiresHelp( date: (d: string) => string, ): Help { const t = s.trim(); - if (!t) return { text: 'Optional. No end date.', bad: false }; + if (!t) return { text: _('Optional. No end date.'), bad: false }; const left = daysLeft(t, today); - if (left == null) return { text: 'Use a date.', bad: true }; - if (left < 0) return { text: 'That date has passed: access would end at once.', bad: true }; - return { text: left === 1 ? `Access ends today (${date(t)}).` : `Access ends in ${left} days (${date(t)}).`, bad: false }; + if (left == null) return { text: _('Use a date.'), bad: true }; + if (left < 0) return { text: _('That date has passed: access would end at once.'), bad: true }; + return { + text: + left === 1 + ? fmt(_('Access ends today (%s).'), date(t)) + : fmt(N_(left, 'Access ends in %s day (%s).', 'Access ends in %s days (%s).'), num(left), date(t)), + bad: false, + }; } /** A home service's address (rpc/home.uc): IPv4; `homeNets` warn when it is outside every home network. */ export function ipv4Help(s: string, inHome: ((ip: string) => boolean) | null = null): Help { const t = s.trim(); - if (!t) return { text: 'The device’s address at home.', bad: true }; - if (!isIpv4(t)) return { text: 'Use an IPv4 address, like 192.168.1.10.', bad: true }; - if (inHome && !inHome(t)) return { text: `${t} is not in any home network of this server: nobody would reach it.`, bad: false }; + if (!t) return { text: _('The device’s address at home.'), bad: true }; + if (!isIpv4(t)) return { text: _('Use an IPv4 address, like 192.168.1.10.'), bad: true }; + if (inHome && !inHome(t)) return { text: fmt(_('%s is not in any home network of this server: nobody would reach it.'), t), bad: false }; return { text: '', bad: false }; } /** A service's ports: empty = all, else numbers 1–65535. */ export function portsHelp(s: string): Help { const items = s.split(/[ ,]+/).filter(Boolean); - if (!items.length) return { text: 'All ports.', bad: false }; + if (!items.length) return { text: _('All ports.'), bad: false }; const bad = items.find((x) => !/^\d{1,5}$/.test(x) || Number(x) < 1 || Number(x) > 65535); - if (bad) return { text: `“${bad}” is not a port (1–65535).`, bad: true }; - return { text: `Port${items.length === 1 ? '' : 's'} ${items.join(', ')}.`, bad: false }; + if (bad) return { text: fmt(_('“%s” is not a port (1–65535).'), bad), bad: true }; + return { text: fmt(N_(items.length, 'Port %s.', 'Ports %s.'), items.join(', ')), bad: false }; } /** The portal's redirect for unknown links (schema portal_redirect): a full http(s) URL, or empty. */ export function urlHelp(s: string): Help { const t = s.trim(); - if (!t) return { text: 'Wrong links get a bare “Not found”.', bad: false }; - if (!/^https?:\/\//i.test(t)) return { text: 'Must start with http:// or https://.', bad: true }; + if (!t) return { text: _('Wrong links get a bare “Not found”.'), bad: false }; + if (!/^https?:\/\//i.test(t)) return { text: _('Must start with http:// or https://.'), bad: true }; if (t.length > 300 || !/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(t)) - return { text: 'Not a usable address (no spaces or quotes).', bad: true }; - return { text: 'Wrong links are sent there instead of a “Not found”.', bad: false }; + return { text: _('Not a usable address (no spaces or quotes).'), bad: true }; + return { text: _('Wrong links are sent there instead of a “Not found”.'), bad: false }; } /** The home domain for device hostnames (schema domain): lowercase letters, digits, dashes, dots. */ export function domainHelp(s: string, example = 'phone.myata'): Help { const t = s.trim(); // Empty keeps the default (the router stores nothing then). - if (!t) return { text: `The default, lan: devices get names like ${example}.lan.`, bad: false }; + if (!t) return { text: fmt(_('The default, lan: devices get names like %s.'), `${example}.lan`), bad: false }; if (!/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(t)) - return { text: /[A-Z]/.test(t) ? 'Lowercase only.' : 'Lowercase letters, digits, dashes and dots.', bad: true }; - return { text: `Devices get names like ${example}.${t}.`, bad: false }; + return { text: /[A-Z]/.test(t) ? _('Lowercase only.') : _('Lowercase letters, digits, dashes and dots.'), bad: true }; + return { text: fmt(_('Devices get names like %s.'), `${example}.${t}`), bad: false }; } /** The fallback DNS for home-names devices: an IPv4 address, or empty for none. */ export function fallbackDnsHelp(s: string): Help { const t = s.trim(); - if (!t) return { text: 'None: without the tunnel those devices have no DNS.', bad: false }; - if (!isIpv4(t)) return { text: 'Use an IPv4 address, or leave it empty.', bad: true }; - return { text: `${t} takes over when the tunnel is down.`, bad: false }; + if (!t) return { text: _('None: without the tunnel those devices have no DNS.'), bad: false }; + if (!isIpv4(t)) return { text: _('Use an IPv4 address, or leave it empty.'), bad: true }; + return { text: fmt(_('%s takes over when the tunnel is down.'), t), bad: false }; } /** The daily update time (schema update_time): HH:MM. */ export function timeHelp(s: string): Help { const t = s.trim(); - if (!/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t)) return { text: 'Use HH:MM, 00:00–23:59.', bad: true }; - return { text: `Runs within an hour after ${t} (router time).`, bad: false }; + if (!/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t)) return { text: _('Use HH:MM, 00:00–23:59.'), bad: true }; + return { text: fmt(_('Runs within an hour after %s (router time).'), t), bad: false }; } /** @@ -310,7 +353,7 @@ export function endpointProbe( if (h.bad || !host.trim()) return h; if (result && result.host === host.trim()) return { text: result.text, bad: result.bad }; const idle = opts.idle?.(); - return { text: idle ? `${idle} Checking where it points…` : `${h.text} Checking where it points…`, bad: false }; + return { text: `${idle || h.text} ${_('Checking where it points…')}`, bad: false }; }; return { help, schedule }; } diff --git a/web/src/admin/pages/components/activity.ts b/web/src/admin/pages/components/activity.ts index 60cca4c..bc25fa3 100644 --- a/web/src/admin/pages/components/activity.ts +++ b/web/src/admin/pages/components/activity.ts @@ -4,47 +4,71 @@ import type { UpdateEvent } from '../../api'; import { E } from '../../e'; import { icon } from '../../../shared/icons'; import { ago, duration } from '../../../shared/format'; +import { fill, locale, plural } from '../../../shared/i18n'; import { jobComponent } from '../../updater/jobs'; +import { translationName } from './hero'; import type { ComponentsPage } from './index'; -const NAMES: Record = { app: 'Dawnline', amneziawg: 'AmneziaWG', pkgs: 'System packages', all: 'Components' }; +function compName(comp: string): string { + if (comp === 'app') return 'Dawnline'; + if (comp === 'amneziawg') return 'AmneziaWG'; + return comp === 'pkgs' ? _('System packages') : _('Components'); +} + +/** A finding as the history keeps it: a component and version, or "2 system packages". */ +function itemText(item: string): string { + const n = /^(\d+) system packages?$/.exec(item)?.[1]; + return n ? plural(Number(n), '%s system package', '%s system packages') : item; +} export function activity(page: ComponentsPage): HTMLElement { const st = page.st; const row = (e: UpdateEvent) => { const comp = jobComponent(e.component ?? 'app'); - const who = NAMES[comp] ?? 'Components'; - const how = e.auto ? 'automatically' : 'by you'; + const who = E('b', {}, compName(comp)); let tone = 'ok', ic = 'check', text: (Node | string)[]; if (e.kind === 'found') { tone = 'accent'; ic = 'download'; - text = [E('b', {}, (e.items ?? []).join(', ')), ` found by ${e.auto ? 'the automatic check' : 'a check'}`]; + // The items are the router's words, kept in the history ("Dawnline 0.3.3", "2 system packages"). + text = fill( + e.auto ? _('%s found by the automatic check') : _('%s found by a check'), + E('b', {}, (e.items ?? []).map(itemText).join(', ')), + ); } else if (e.state === 'failed') { tone = 'bad'; ic = 'x'; - text = [E('b', {}, who), ` ${e.kind === 'install' ? 'update' : 'check'} failed${e.error ? ` · ${e.error}` : ''}`]; + text = [...fill(e.kind === 'install' ? _('%s update failed') : _('%s check failed'), who), e.error ? ` · ${e.error}` : '']; + } else if (/^app:(lang:|nolang$)/.test(e.component ?? '')) { + // The admin's translation, added or removed in Components. + const lang = /^app:lang:(.+)$/.exec(e.component ?? '')?.[1]; + text = lang ? fill(_('%s added by you'), E('b', {}, translationName(lang))) : [_('Translation removed by you')]; } else { - const ver = e.from && e.to && e.from !== e.to ? ` ${e.from} → ${e.to}` : e.to ? ` ${e.to}` : ''; - text = [E('b', {}, who), `${ver} ${ver ? '' : 'updated '}${how}${e.took ? ` · ${duration(e.took)}` : ''}`.replace(/\s+/g, ' ')]; + const ver = e.from && e.to && e.from !== e.to ? `${e.from} → ${e.to}` : (e.to ?? ''); + text = [ + ...(ver + ? fill(e.auto ? _('%s %s automatically') : _('%s %s by you'), who, ver) + : fill(e.auto ? _('%s updated automatically') : _('%s updated by you'), who)), + e.took ? ` · ${duration(e.took)}` : '', + ]; } return E('div', { class: 'dl-row' }, [ E('span', { class: `dl-ev-tile ev ${tone}` }, icon(ic)), E('span', { class: 'dl-row-main' }, text), - E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString() }, ago(e.ts, st.now)), + E('span', { class: 'dl-faint dl-nowrap', title: new Date(e.ts * 1000).toLocaleString(locale()) }, ago(e.ts, st.now)), ]); }; const h = st.history ?? []; return E('section', { class: 'dl-panel flush' }, [ E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Activity'), + E('h3', {}, _('Activity')), E('span', { class: 'dl-spacer' }), - E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, 'All in Log →'), + E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('All in Log →')), ]), h.length ? E('div', {}, h.slice(0, 8).map(row)) - : E('p', { class: 'dl-sub dl-comp-empty' }, 'Updates, and checks that found something, show up here.'), + : E('p', { class: 'dl-sub dl-comp-empty' }, _('Updates, and checks that found something, show up here.')), ]); } diff --git a/web/src/admin/pages/components/awg.ts b/web/src/admin/pages/components/awg.ts index 95b480b..648af8c 100644 --- a/web/src/admin/pages/components/awg.ts +++ b/web/src/admin/pages/components/awg.ts @@ -8,6 +8,7 @@ import { confirmDialog } from '../../ui/modal'; import { sw } from '../../ui/controls'; import { pill } from '../../ui/badges'; import { icon } from '../../../shared/icons'; +import { fmt, num } from '../../../shared/i18n'; import { whatsNew } from '../../updater/notes'; import type { ComponentsPage, MenuEntry } from './index'; @@ -25,60 +26,72 @@ export function awgRows(page: ComponentsPage, w: UpdateComponent | undefined): N const actions: MenuEntry[] = []; if (cur && installed) actions.push({ - label: 'Reinstall this build', + label: _('Reinstall this build'), warn: true, ic: 'reset', - run: () => page.op(`amneziawg:${cur}${ru ? ':ru' : ''}`, 'Reinstalling AmneziaWG', installed), + run: () => page.op(`amneziawg:${cur}${ru ? ':ru' : ''}`, _('Reinstalling AmneziaWG'), installed), }); if (kept) actions.push({ - label: `Roll back to ${kept.version}`, + label: fmt(_('Roll back to %s'), kept.version), ic: 'archive', warn: true, run: async () => { if ( await confirmDialog( - `Roll back AmneziaWG to ${kept.version}?`, - 'The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds.', - 'Roll back', + fmt(_('Roll back AmneziaWG to %s?'), kept.version), + _('The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds.'), + _('Roll back'), ) ) - void page.op('amneziawg:rollback', 'Rolling back AmneziaWG', installed ?? undefined); + void page.op('amneziawg:rollback', _('Rolling back AmneziaWG'), installed ?? undefined); }, }); const menu: (MenuEntry | null)[] = [ w?.release ? { - label: 'What’s new', + label: _('What’s new'), ic: 'file', - run: () => whatsNew('amneziawg', w.release!, `What’s new in the ${curSrc?.label ?? 'AmneziaWG'} build`, cur ?? 'slava'), + run: () => whatsNew('amneziawg', w.release!, fmt(_('What’s new in the %s build'), curSrc?.label ?? 'AmneziaWG'), cur ?? 'slava'), } : null, { - label: 'Open on GitHub', + label: _('Open on GitHub'), ic: 'globe', run: () => window.open(`https://github.com/${curSrc?.repo ?? 'Slava-Shchipunov/awg-openwrt'}`, '_blank', 'noopener'), }, ...(actions.length ? [null, ...actions] : []), ].filter((x, k, a) => x !== null || (k > 0 && a[k - 1] !== null)); const tun = st.tunnels ?? []; - const restarts = tun.length - ? `Switching restarts ${tun.length === 1 ? 'the tunnel' : `${tun.length} tunnels`} for a few seconds: ${tun.join(', ')}. Devices keep their configurations.` - : 'Switching takes a few seconds. Devices keep their configurations.'; + const restarts = !tun.length + ? _('Switching takes a few seconds. Devices keep their configurations.') + : tun.length === 1 + ? fmt(_('Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations.'), tun[0]) + : fmt( + N_( + tun.length, + 'Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.', + 'Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations.', + ), + num(tun.length), + tun.join(', '), + ); // The notice under the builds: "Switching restarts Home and Family for a few seconds." - const names = tun.length > 1 ? `${tun.slice(0, -1).join(', ')} and ${tun[tun.length - 1]}` : tun[0]; - const notice = tun.length ? `Switching restarts ${names} for a few seconds.` : 'Switching takes a few seconds.'; + const names = tun.length > 1 ? fmt(_('%s and %s'), tun.slice(0, -1).join(', '), tun[tun.length - 1]) : tun[0]; + const notice = tun.length ? fmt(_('Switching restarts %s for a few seconds.'), names) : _('Switching takes a few seconds.'); const switchTo = async (id: AwgSource) => { const x = srcs[id]!; const ok = await confirmDialog( - installed ? `Switch to AmneziaWG ${x.gen}?` : `Install AmneziaWG ${x.gen}?`, - `The ${x.label} build, ${x.version}. ${restarts}${x.gen === '3.1' ? ' Devices need AmneziaVPN 3.1 or newer.' : ''}`, - installed ? 'Switch' : 'Install', + installed ? fmt(_('Switch to AmneziaWG %s?'), x.gen) : fmt(_('Install AmneziaWG %s?'), x.gen), + [fmt(_('The %s build, %s.'), x.label, x.version), restarts, x.gen === '3.1' ? _('Devices need AmneziaVPN 3.1 or newer.') : ''] + .filter(Boolean) + .join(' '), + installed ? _('Switch') : _('Install'), ); if (ok) void page.op( `amneziawg:${id}${ru ? ':ru' : ''}`, - installed ? `Switching to AmneziaWG ${x.gen}` : 'Installing AmneziaWG', + installed ? fmt(_('Switching to AmneziaWG %s'), x.gen) : _('Installing AmneziaWG'), installed ?? undefined, ); }; @@ -88,47 +101,51 @@ export function awgRows(page: ComponentsPage, w: UpdateComponent | undefined): N return E('div', { class: 'dl-row' }, [ E('span', { class: 'dl-row-main dl-stack' }, [ E('b', {}, x.gen ? `AmneziaWG ${x.gen}` : 'AmneziaWG'), - E('span', { class: 'dl-sub' }, `${x.label} · ${x.gen === '3.1' ? 'AmneziaVPN 3.1+' : 'every app'}`), + E('span', { class: 'dl-sub' }, `${x.label} · ${x.gen === '3.1' ? 'AmneziaVPN 3.1+' : _('every app')}`), ]), - E('span', { class: 'dl-mono dl-faint dl-comp-bver' }, x.version ?? 'none yet'), + E('span', { class: 'dl-mono dl-faint dl-comp-bver' }, x.version ?? _('none yet')), E( 'span', { class: 'dl-comp-bact' }, on - ? pill('ok', 'Active') + ? pill('ok', _('Active', 'build')) : x.version - ? button(installed ? 'Switch' : 'Install', () => switchTo(id), installed ? 'neutral' : 'positive', { disabled: page.busy }) - : pill('', 'No build'), + ? button(installed ? _('Switch') : _('Install'), () => switchTo(id), installed ? 'neutral' : 'positive', { + disabled: page.busy, + }) + : pill('', _('No build')), ), ]); }; const newer = ids .map((id) => - srcs[id]?.newer ? `${srcs[id]!.label} moves to ${srcs[id]!.newer!.gen} with OpenWrt ${srcs[id]!.newer!.tag.replace(/^v/, '')}.` : '', + srcs[id]?.newer + ? fmt(_('%s moves to %s with OpenWrt %s.'), srcs[id]!.label, srcs[id]!.newer!.gen, srcs[id]!.newer!.tag.replace(/^v/, '')) + : '', ) .filter(Boolean); - const ruSw = sw(ru, 'Russian translation', (v) => { + const ruSw = sw(ru, _('Russian translation'), (v) => { if (!cur) return; void page.op( `amneziawg:${cur}${v ? ':ru' : ''}`, - v ? 'Adding the Russian translation' : 'Removing the Russian translation', + v ? _('Adding the Russian translation') : _('Removing the Russian translation'), installed ?? undefined, ); }); ruSw.disabled = !cur || !installed || page.busy; const open = page.awgOpen ?? !installed; const fold = E('details', { class: 'dl-params dl-comp-fold', open: open ? 'open' : null }, [ - E('summary', {}, [icon('chevron'), E('span', {}, 'Build and translation')]), + E('summary', {}, [icon('chevron'), E('span', {}, _('Build and translation'))]), E('div', { class: 'dl-params-body' }, [ // The builds and the translation in one list. E('div', { class: 'dl-list' }, [ ...(ids.length ? ids.map(build) - : [E('div', { class: 'dl-row' }, E('span', { class: 'dl-sub' }, 'Check for updates to see the builds for this router.'))]), + : [E('div', { class: 'dl-row' }, E('span', { class: 'dl-sub' }, _('Check for updates to see the builds for this router.')))]), E('div', { class: 'dl-row' }, [ E('span', { class: 'dl-row-main dl-stack' }, [ - E('b', {}, 'Russian translation'), - E('span', { class: 'dl-sub' }, 'LuCI pages for AmneziaWG'), + E('b', {}, _('Russian translation')), + E('span', { class: 'dl-sub' }, _('LuCI pages for AmneziaWG')), ]), E('span', { class: 'dl-comp-bact' }, ruSw), ]), @@ -146,24 +163,29 @@ export function awgRows(page: ComponentsPage, w: UpdateComponent | undefined): N const right: Node[] = []; if (w?.update && installed && cur) right.push( - button(`Update to ${w.latest}`, () => page.op(`amneziawg:${cur}${ru ? ':ru' : ''}`, 'Updating AmneziaWG', installed), 'neutral', { - disabled: page.busy, - }), + button( + fmt(_('Update to %s'), w.latest), + () => page.op(`amneziawg:${cur}${ru ? ':ru' : ''}`, _('Updating AmneziaWG'), installed), + 'neutral', + { + disabled: page.busy, + }, + ), ); - else right.push((w || missing.length) && !installed ? pill('warn', 'Not installed') : page.state('amneziawg', w, w?.latest ?? '')); - right.push(page.round(() => page.op('check:amneziawg', 'Checking AmneziaWG', installed ?? undefined), menu)); + else right.push((w || missing.length) && !installed ? pill('warn', _('Not installed')) : page.state('amneziawg', w, w?.latest ?? '')); + right.push(page.round(() => page.op('check:amneziawg', _('Checking AmneziaWG'), installed ?? undefined), menu)); return [ page.row( 'shield', 'AmneziaWG', [ installed - ? `${installed}${w?.release ? ` · ${w.release} build` : ''}` + ? `${installed}${w?.release ? ` · ${fmt(_('%s build'), w.release)}` : ''}` : missing.length - ? `missing ${missing.join(', ')}` + ? fmt(_('missing %s'), missing.join(', ')) : w - ? 'not installed' - : 'version not checked', + ? _('not installed') + : _('version not checked'), ], right, ), diff --git a/web/src/admin/pages/components/hero.ts b/web/src/admin/pages/components/hero.ts index d9d6005..d49f416 100644 --- a/web/src/admin/pages/components/hero.ts +++ b/web/src/admin/pages/components/hero.ts @@ -1,19 +1,30 @@ // Components → the Dawnline block: version, what the update brings, its -// settings at a glance, and every release to install (Versions). +// settings at a glance, every release to install (Versions) and the admin's +// translation. import { E } from '../../e'; import { api, type UpdateComponent } from '../../api'; import { button, iconButton } from '../../ui/button'; import { confirmDialog } from '../../ui/modal'; import { errorText, notify } from '../../ui/toast'; -import { input } from '../../ui/controls'; +import { input, sw } from '../../ui/controls'; import { pill } from '../../ui/badges'; import { icon } from '../../../shared/icons'; import { ago, duration, fmtDay } from '../../../shared/format'; +import { fmt, plural } from '../../../shared/i18n'; import { whatsNew } from '../../updater/notes'; import type { ComponentsPage, MenuEntry } from './index'; -const EVERY: Record = { '6h': 'every 6 h', '12h': 'every 12 h', '1d': 'daily', '7d': 'weekly' }; +/** How often Settings → Updates checks, by its interval id. */ +function checksEvery(interval: string): string { + const t: Record = { + '6h': _('checks every 6 h'), + '12h': _('checks every 12 h'), + '1d': _('checks daily'), + '7d': _('checks weekly'), + }; + return t[interval] ?? t['1d']; +} /** A release date (GitHub gives a timestamp). */ const released = (d: string | null | undefined) => (d ? fmtDay(d) : ''); @@ -34,7 +45,7 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML const pol = st.policy; const kept = st.kept?.app; const tag = a?.update && a.tag ? a.tag : st.version; - const notesOf = (t: string) => () => whatsNew('app', t, `What’s new in Dawnline ${t.replace(/^v/, '')}`); + const notesOf = (t: string) => () => whatsNew('app', t, fmt(_('What’s new in Dawnline %s'), t.replace(/^v/, ''))); // What the offered release brings, or what the installed one brought when it is the latest. const items = a?.tag && (a.update || a.status === 'latest') ? bullets(page, a.tag, a.update ? st.version : '') : null; const ptag = a?.tag ?? tag; @@ -43,29 +54,29 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML const side = (label: string, value: (Node | string)[]) => E('div', { class: 'dl-stack gap4' }, [E('span', { class: 'dl-metric-label' }, label), E('span', { class: 'dl-comp-side-v' }, value)]); const menu: (MenuEntry | null)[] = [ - { label: 'What’s new', ic: 'file', run: notesOf(tag) }, - { label: 'Open on GitHub', ic: 'globe', run: () => window.open(`https://github.com/${st.repo}`, '_blank', 'noopener') }, + { label: _('What’s new'), ic: 'file', run: notesOf(tag) }, + { label: _('Open on GitHub'), ic: 'globe', run: () => window.open(`https://github.com/${st.repo}`, '_blank', 'noopener') }, null, { - label: `Reinstall ${st.version}`, + label: fmt(_('Reinstall %s'), st.version), ic: 'reset', warn: true, - run: () => page.op('app:reinstall', 'Reinstalling Dawnline', st.version), + run: () => page.op('app:reinstall', _('Reinstalling Dawnline'), st.version), }, kept ? { - label: `Roll back to ${kept.version}`, + label: fmt(_('Roll back to %s'), kept.version), ic: 'archive', warn: true, run: async () => { if ( await confirmDialog( - `Roll back to Dawnline ${kept.version}?`, - `The copy kept on the router replaces ${st.version}. A backup of the settings is made first.`, - 'Roll back', + fmt(_('Roll back to Dawnline %s?'), kept.version), + fmt(_('The copy kept on the router replaces %s. A backup of the settings is made first.'), st.version), + _('Roll back'), ) ) - void page.op('app:rollback', 'Rolling back Dawnline', st.version); + void page.op('app:rollback', _('Rolling back Dawnline'), st.version); }, } : null, @@ -77,7 +88,7 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML E('b', { class: 'dl-comp-name' }, 'Dawnline'), page.state('app', a, a?.latest ?? ''), E('span', { class: 'dl-spacer' }), - page.round(() => page.op('check:app', 'Checking Dawnline', st.version), menu, true), + page.round(() => page.op('check:app', _('Checking Dawnline'), st.version), menu, true), ]), // Version, what it is, and the update: one line. E('div', { class: 'dl-comp-verrow' }, [ @@ -87,7 +98,7 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML a?.update ? E('small', {}, `→ ${a.latest}`) : a?.status === 'dev' && a.latest - ? E('small', { class: 'dl-faint' }, `release ${a.latest}`) + ? E('small', { class: 'dl-faint' }, fmt(_('release %s'), a.latest)) : '', ]), E( @@ -97,13 +108,13 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML ? '' : a?.update ? a.published - ? `released ${released(a.published)}` + ? fmt(_('released %s'), released(a.published)) : '' : a?.status === 'dev' - ? 'ahead of the latest release' + ? _('ahead of the latest release') : a - ? `latest release${a.published ? ` · released ${released(a.published)}` : ''}` - : 'not checked yet', + ? [_('latest release'), a.published ? fmt(_('released %s'), released(a.published)) : ''].filter(Boolean).join(' · ') + : _('not checked yet'), ), ]), ]), @@ -119,7 +130,7 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML ? E( 'button', { type: 'button', class: 'dl-linkbtn dl-comp-more', click: notesOf(ptag) }, - `+${items.total - items.items.length} more in What’s new`, + plural(items.total - items.items.length, '+%s more in What’s new', '+%s more in What’s new'), ) : '', ]) @@ -128,42 +139,43 @@ export function hero(page: ComponentsPage, a: UpdateComponent | undefined): HTML // The update and its notes; without an update What's new stays in ⋯. a?.update ? E('div', { class: 'dl-comp-btns' }, [ - button('Update now', () => page.op('app', 'Updating Dawnline', st.version), 'positive', { disabled: page.busy }), - button('What’s new', notesOf(tag)), + button(_('Update now'), () => page.op('app', _('Updating Dawnline'), st.version), 'positive', { disabled: page.busy }), + button(_('What’s new'), notesOf(tag)), ]) : '', versions(page), + translation(page), ]), E('div', { class: 'dl-comp-hero-side' }, [ - side('Source', [icon('globe'), E('a', { href: `https://github.com/${st.repo}`, target: '_blank', rel: 'noopener' }, st.repo)]), - side('Auto-update', [ - pol.auto ? pill('ok', 'On') : pill('', 'Off'), + side(_('Source'), [icon('globe'), E('a', { href: `https://github.com/${st.repo}`, target: '_blank', rel: 'noopener' }, st.repo)]), + side(_('Auto-update'), [ + pol.auto ? pill('ok', _('On')) : pill('', _('Off')), E( 'span', { class: 'dl-muted' }, pol.auto ? pol.mode === 'immediate' - ? 'as soon as found' - : `${EVERY[pol.interval] === 'weekly' ? 'weekly' : 'daily'} at ${pol.time}` + ? _('as soon as found') + : fmt(pol.interval === '7d' ? _('weekly at %s') : _('daily at %s'), pol.time) : pol.check - ? `checks ${EVERY[pol.interval]}` - : 'checks off', + ? checksEvery(pol.interval) + : _('checks off'), ), ]), side( - 'Last check', + _('Last check'), st.check ? [ ago(st.check.time, st.now), - nextCheck > st.now ? E('span', { class: 'dl-faint' }, `· next in ${duration(nextCheck - st.now)}`) : '', + nextCheck > st.now ? E('span', { class: 'dl-faint' }, `· ${fmt(_('next in %s'), duration(nextCheck - st.now))}`) : '', ] - : ['Never'], + : [_('Never')], ), side( - 'Rollback', + _('Rollback'), kept - ? [E('span', { class: 'dl-mono' }, kept.version), E('span', { class: 'dl-faint' }, 'kept on flash')] - : [E('span', { class: 'dl-muted' }, pol.keep ? 'Kept after the next update' : 'Off')], + ? [E('span', { class: 'dl-mono' }, kept.version), E('span', { class: 'dl-faint' }, _('kept on flash'))] + : [E('span', { class: 'dl-muted' }, pol.keep ? _('Kept after the next update') : _('Off'))], ), ]), ]); @@ -191,10 +203,52 @@ function bullets(page: ComponentsPage, tag: string, from: string): { items: stri return null; } +/** A translation's name, by its language code. */ +export function translationName(lang: string): string { + return lang === 'ru' ? _('Russian translation') : lang; +} + +/** + * The admin's translation, switched like AmneziaWG's: luci-i18n-dawnline-ru + * from the release of the installed version (the updater installs and + * removes it, then LuCI's web server restarts to read it). + */ +function translation(page: ComponentsPage): HTMLElement { + const ru = (page.st.translations ?? []).includes('ru'); + const s = sw(ru, translationName('ru'), (v) => { + void page.op( + v ? 'app:lang:ru' : 'app:nolang', + v ? _('Adding the Russian translation') : _('Removing the Russian translation'), + page.st.version, + ); + }); + s.disabled = page.busy; + const fold = E('details', { class: 'dl-params dl-comp-fold', open: page.langOpen ? 'open' : null }, [ + E('summary', {}, [ + icon('chevron'), + E('span', {}, _('Translation')), + E('span', { class: 'dl-sub' }, ru ? _('Russian') : _('English only')), + ]), + E('div', { class: 'dl-params-body' }, [ + E('div', { class: 'dl-list' }, [ + E('div', { class: 'dl-row' }, [ + E('span', { class: 'dl-row-main dl-stack' }, [ + E('b', {}, translationName('ru')), + E('span', { class: 'dl-sub' }, _('LuCI pages for Dawnline')), + ]), + E('span', { class: 'dl-comp-bact' }, s), + ]), + ]), + ]), + ]); + fold.addEventListener('toggle', () => (page.langOpen = (fold as HTMLDetailsElement).open)); + return fold; +} + function versions(page: ComponentsPage): HTMLElement { const body = E('div', { class: 'dl-params-body' }); const fold = E('details', { class: 'dl-params dl-comp-vers', open: page.versOpen ? 'open' : null }, [ - E('summary', {}, [icon('chevron'), E('span', {}, 'Versions'), E('span', { class: 'dl-sub' }, 'install any release')]), + E('summary', {}, [icon('chevron'), E('span', {}, _('Versions')), E('span', { class: 'dl-sub' }, _('install any release'))]), body, ]); fold.addEventListener('toggle', () => { @@ -206,10 +260,10 @@ function versions(page: ComponentsPage): HTMLElement { } async function paintVersions(page: ComponentsPage, body: HTMLElement) { - const tag = input('', { placeholder: 'Tag, e.g. 0.3.1', class: 'cbi-input-text dl-mono', 'aria-label': 'Release tag' }); + const tag = input('', { placeholder: _('Tag, e.g. 0.3.1'), class: 'cbi-input-text dl-mono', 'aria-label': _('Release tag') }); const installTag = (t: string) => { t = t.trim(); - if (!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(t)) return notify('Enter a release tag like 0.3.1', 'warning'); + if (!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(t)) return notify(_('Enter a release tag like 0.3.1'), 'warning'); void install(page, t); }; tag.addEventListener('keydown', (ev: KeyboardEvent) => { @@ -220,7 +274,7 @@ async function paintVersions(page: ComponentsPage, body: HTMLElement) { }); const head = E('div', { class: 'dl-comp-tag' }, [ tag, - button('Install', () => installTag(tag.value), 'neutral', { disabled: page.busy }), + button(_('Install'), () => installTag(tag.value), 'neutral', { disabled: page.busy }), ]); const pageNo = page.versPage; const turn = (d: number) => { @@ -229,13 +283,13 @@ async function paintVersions(page: ComponentsPage, body: HTMLElement) { }; const pager = (more: boolean) => E('div', { class: 'dl-comp-pager' }, [ - E('button', { type: 'button', class: 'dl-linkbtn', disabled: pageNo <= 1 ? 'disabled' : null, click: () => turn(-1) }, '← Newer'), - E('span', { class: 'dl-faint' }, `Page ${pageNo}`), - E('button', { type: 'button', class: 'dl-linkbtn', disabled: more ? null : 'disabled', click: () => turn(1) }, 'Older →'), + E('button', { type: 'button', class: 'dl-linkbtn', disabled: pageNo <= 1 ? 'disabled' : null, click: () => turn(-1) }, _('← Newer')), + E('span', { class: 'dl-faint' }, fmt(_('Page %s'), pageNo)), + E('button', { type: 'button', class: 'dl-linkbtn', disabled: more ? null : 'disabled', click: () => turn(1) }, _('Older →')), ]); let rows = page.versCache.get(pageNo); if (!rows) { - dom.content(body, [head, E('p', { class: 'dl-muted dl-loading' }, 'Loading versions…')]); + dom.content(body, [head, E('p', { class: 'dl-muted dl-loading' }, _('Loading versions…'))]); try { rows = (await api.updatesReleases(pageNo)).releases; } catch (e) { @@ -244,8 +298,8 @@ async function paintVersions(page: ComponentsPage, body: HTMLElement) { dom.content(body, [ head, E('div', { class: 'dl-row-actions' }, [ - E('span', { class: 'dl-muted' }, `Failed to load versions: ${errorText(e)}`), - button('Try again', () => paintVersions(page, body)), + E('span', { class: 'dl-muted' }, fmt(_('Failed to load versions: %s'), errorText(e))), + button(_('Try again'), () => paintVersions(page, body)), ]), pager(false), ]); @@ -255,7 +309,11 @@ async function paintVersions(page: ComponentsPage, body: HTMLElement) { if (pageNo !== page.versPage || !body.isConnected) return; } if (!rows.length) - return dom.content(body, [head, E('p', { class: 'dl-muted' }, pageNo > 1 ? 'No more versions.' : 'No versions found.'), pager(false)]); + return dom.content(body, [ + head, + E('p', { class: 'dl-muted' }, pageNo > 1 ? _('No more versions.') : _('No versions found.')), + pager(false), + ]); const cur = page.st.version; dom.content(body, [ head, @@ -264,13 +322,13 @@ async function paintVersions(page: ComponentsPage, body: HTMLElement) { return E('div', { class: 'dl-comp-ver' }, [ E('span', { class: 'dl-mono' }, v), E('span', { class: 'dl-sub' }, released(r.published)), - r.prerelease ? pill('warn', 'Pre-release') : '', + r.prerelease ? pill('warn', _('Pre-release')) : '', E( 'span', { class: 'dl-comp-ic' }, - iconButton('file', 'What’s new', () => whatsNew('app', r.tag, `What’s new in Dawnline ${v}`)), + iconButton('file', _('What’s new'), () => whatsNew('app', r.tag, fmt(_('What’s new in Dawnline %s'), v))), ), - v === cur ? pill('ok', 'Installed') : button('Install', () => install(page, r.tag), 'neutral', { disabled: page.busy }), + v === cur ? pill('ok', _('Installed')) : button(_('Install'), () => install(page, r.tag), 'neutral', { disabled: page.busy }), ]); }), pager(rows.length >= 5), @@ -284,11 +342,14 @@ async function install(page: ComponentsPage, tag: string) { if ( older && !(await confirmDialog( - `Install Dawnline ${v}?`, - `It is older than ${page.st.version}. A backup of the settings is made first; restore it from Settings if something looks wrong.`, - 'Install', + fmt(_('Install Dawnline %s?'), v), + fmt( + _('It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong.'), + page.st.version, + ), + _('Install'), )) ) return; - void page.op(`app@${tag}`, `Installing Dawnline ${v}`, page.st.version); + void page.op(`app@${tag}`, fmt(_('Installing Dawnline %s'), v), page.st.version); } diff --git a/web/src/admin/pages/components/index.ts b/web/src/admin/pages/components/index.ts index a3412a0..8b5c173 100644 --- a/web/src/admin/pages/components/index.ts +++ b/web/src/admin/pages/components/index.ts @@ -13,6 +13,7 @@ import { attachTip } from '../../ui/tooltip'; import { pill } from '../../ui/badges'; import { icon } from '../../../shared/icons'; import { ago } from '../../../shared/format'; +import { fmt, num, plural } from '../../../shared/i18n'; import { runOperation } from '../../updater/operation'; import { jobComponent, runningComponent } from '../../updater/jobs'; import { hero } from './hero'; @@ -44,6 +45,8 @@ export class ComponentsPage { notes = new Map(); /** The AmneziaWG "Build and translation" fold, once opened or closed by hand. */ awgOpen: boolean | null = null; + /** Dawnline's Translation fold. */ + langOpen = false; load() { return api.updatesStatus(); @@ -85,7 +88,7 @@ export class ComponentsPage { /** Run `what` in the operation modal; the cards refresh when it ends. */ async op(what: string, title: string, version?: string) { if (this.busy || this.following === 'starting') { - notify('Another component action is already running', 'warning'); + notify(_('Another component action is already running'), 'warning'); return; } this.following = 'starting'; @@ -101,10 +104,10 @@ export class ComponentsPage { if (comp === 'amneziawg' && c.amneziawg?.current) void this.op( `amneziawg:${c.amneziawg.current}${c.amneziawg.ru ? ':ru' : ''}`, - 'Updating AmneziaWG', + _('Updating AmneziaWG'), c.amneziawg.installed ?? undefined, ); - else void this.op('app', 'Updating Dawnline', this.st.version); + else void this.op('app', _('Updating Dawnline'), this.st.version); }, }); if (this.following === 'starting') this.following = job?.id ?? null; @@ -113,14 +116,17 @@ export class ComponentsPage { async follow(job: UpdateJob) { this.following = job.id; - const comp = runningComponent(job); - const what = - ({ app: 'Dawnline', amneziawg: 'AmneziaWG', pkgs: 'system packages', all: 'components' } as Record)[comp] ?? - 'components'; + // [check, automatic update, update] per component. + const titles: Record = { + app: [_('Checking Dawnline'), _('Automatic update: Dawnline'), _('Updating Dawnline')], + amneziawg: [_('Checking AmneziaWG'), _('Automatic update: AmneziaWG'), _('Updating AmneziaWG')], + pkgs: [_('Checking system packages'), _('Automatic update: system packages'), _('Updating system packages')], + all: [_('Checking components'), _('Automatic update: components'), _('Updating components')], + }; await runOperation( null, { - title: `${job.action === 'check' ? 'Checking' : job.auto ? 'Automatic update:' : 'Updating'} ${what}`, + title: (titles[runningComponent(job)] ?? titles.all)[job.action === 'check' ? 0 : job.auto ? 1 : 2], onDone: (s) => this.refresh(s), }, job, @@ -139,13 +145,13 @@ export class ComponentsPage { dom.content(this.root, [ E('div', { class: 'dl-pagehead' }, [ E('div', { class: 'dl-stack' }, [ - E('h2', { class: 'dl-h1' }, 'Components'), + E('h2', { class: 'dl-h1' }, _('Components')), E( 'span', { class: 'dl-faint' }, [ fw?.version ? `OpenWrt ${fw.version} · ${fw.target}` : '', - st.check ? `checked ${ago(st.check.time, st.now)}` : 'not checked yet', + st.check ? fmt(_('checked %s'), ago(st.check.time, st.now)) : _('not checked yet'), ] .filter(Boolean) .join(' · '), @@ -155,29 +161,31 @@ export class ComponentsPage { E( 'a', { class: 'cbi-button cbi-button-neutral dl-icon-btn', href: `${L.url('admin/network/dawnline/settings')}?section=updates` }, - [icon('edit'), ' Settings'], + [icon('edit'), ' ', _('Settings')], ), - button([icon('refresh'), ' Check all'], () => this.op('check', 'Checking all components'), 'neutral', { disabled: this.busy }), + button([icon('refresh'), ' ', _('Check all')], () => this.op('check', _('Checking all components')), 'neutral', { + disabled: this.busy, + }), ]), ]), hero(this, c.app), E('div', { class: 'dl-comp-cols' }, [ E('section', { class: 'dl-panel flush' }, [ E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Components'), + E('h3', {}, _('Components')), E('span', { class: 'dl-spacer' }), E( 'span', { class: 'dl-faint dl-comp-count' }, awgMissing ? n - ? `AmneziaWG not installed · ${n} update${n === 1 ? '' : 's'}` - : 'AmneziaWG not installed' + ? `${_('AmneziaWG not installed')} · ${plural(n, '%s update', '%s updates')}` + : _('AmneziaWG not installed') : !c.amneziawg && !c.packages ? '' : n - ? `${n} of ${1 + pk.total} need${n === 1 ? 's' : ''} an update` - : 'Everything is up to date', + ? fmt(N_(n, '%s of %s needs an update', '%s of %s need an update'), num(n), num(1 + pk.total)) + : _('Everything is up to date'), ), ]), E('div', {}, [...awgRows(this, c.amneziawg), ...pk.rows]), @@ -194,16 +202,15 @@ export class ComponentsPage { const norm = (v: string) => (v === 'packages' ? 'pkgs' : v); const comps = j.action === 'check' ? [norm(j.component || 'all')] : (j.component ?? '').split(' ').map((v) => norm(jobComponent(v))); if (comps.includes(comp) || comps.includes('all')) - return E('button', { type: 'button', class: 'dl-pill info dl-comp-run', title: 'Show progress', click: () => this.follow(j) }, [ - j.action === 'check' ? 'Checking' : 'Updating', - '…', + return E('button', { type: 'button', class: 'dl-pill info dl-comp-run', title: _('Show progress'), click: () => this.follow(j) }, [ + j.action === 'check' ? _('Checking…') : _('Updating…'), ]); } - if (!x) return pill('', 'Not checked'); - if (x.error) return pill('warn', 'Check failed', x.error); - if (x.update) return pill('info', 'Update available'); - if (x.status === 'dev') return pill('info', 'Newer than release', `The latest release is ${latest}`); - return pill('ok', 'Up to date'); + if (!x) return pill('', _('Not checked')); + if (x.error) return pill('warn', _('Check failed'), x.error); + if (x.update) return pill('info', _('Update available')); + if (x.status === 'dev') return pill('info', _('Newer than release'), fmt(_('The latest release is %s'), latest)); + return pill('ok', _('Up to date')); } /** ⋯ menu; null is a separator. Actions refuse to start while a job runs (see op). */ @@ -219,7 +226,7 @@ export class ComponentsPage { .map((x) => (x ? { label: x.label, icon: icon(x.ic), warn: x.warn, run: x.run } : null)), ), 'neutral', - { title: 'More', 'aria-label': 'More' }, + { title: _('More'), 'aria-label': _('More') }, ); return b; } @@ -229,16 +236,16 @@ export class ComponentsPage { const busy = this.busy ? ' is-busy' : ''; let btn: HTMLButtonElement; if (label) - btn = button([icon('refresh'), ' Check'], check, 'neutral', { + btn = button([icon('refresh'), ' ', _('Check')], check, 'neutral', { class: `cbi-button cbi-button-neutral dl-comp-check${busy}`, - 'aria-label': 'Check for updates', + 'aria-label': _('Check for updates'), }); else { - btn = iconButton('refresh', 'Check for updates', check, 'neutral', busy.trim()); + btn = iconButton('refresh', _('Check for updates'), check, 'neutral', busy.trim()); // Dawnline's own tooltip (the browser's title tip is slow and plain). btn.removeAttribute('title'); - btn.setAttribute('aria-label', 'Check for updates'); - attachTip(btn, () => ['Check for updates']); + btn.setAttribute('aria-label', _('Check for updates')); + attachTip(btn, () => [_('Check for updates')]); } return E('span', { class: 'dl-comp-ic' }, [btn, this.more(menu)]); } diff --git a/web/src/admin/pages/components/packages.ts b/web/src/admin/pages/components/packages.ts index 28fb0e5..1747592 100644 --- a/web/src/admin/pages/components/packages.ts +++ b/web/src/admin/pages/components/packages.ts @@ -5,38 +5,49 @@ import type { UpdateComponent } from '../../api'; import { button } from '../../ui/button'; import { confirmDialog } from '../../ui/modal'; import { E } from '../../e'; +import { fmt } from '../../../shared/i18n'; import type { ComponentsPage, MenuEntry } from './index'; -const SYS_ITEMS: { title: string; sub: string; pkgs: string[]; feature: 'home' | 'https' | 'acme'; optional?: boolean }[] = [ - { title: 'Home-like link', sub: 'Policy routing and the veth pair', pkgs: ['ip-full', 'kmod-veth'], feature: 'home' }, - { title: 'HTTPS for the portal', sub: 'OpenSSL for uhttpd', pkgs: ['libustream-openssl', 'openssl-util'], feature: 'https' }, - { - title: 'Certificates (ACME)', - sub: 'Let’s Encrypt certificate for the portal', - pkgs: ['acme', 'acme-acmesh-dnsapi'], - feature: 'acme', - optional: true, - }, -]; +interface SysItem { + title: string; + sub: string; + pkgs: string[]; + feature: 'home' | 'https' | 'acme'; + optional?: boolean; +} + +function sysItems(): SysItem[] { + return [ + { title: _('Home-like link'), sub: _('Policy routing and the veth pair'), pkgs: ['ip-full', 'kmod-veth'], feature: 'home' }, + { title: _('HTTPS for the portal'), sub: _('OpenSSL for uhttpd'), pkgs: ['libustream-openssl', 'openssl-util'], feature: 'https' }, + { + title: _('Certificates (ACME)'), + sub: _('Let’s Encrypt certificate for the portal'), + pkgs: ['acme', 'acme-acmesh-dnsapi'], + feature: 'acme', + optional: true, + }, + ]; +} const ICONS: Record = { home: 'network', https: 'lock', acme: 'file' }; export function packageRows(page: ComponentsPage, p: UpdateComponent | undefined): { rows: Node[]; updates: number; total: number } { const st = page.st; const pkgs = p?.pkgs ?? {}; - const items = SYS_ITEMS.filter((it) => (it.feature === 'home' ? st.home : st.portal)); + const items = sysItems().filter((it) => (it.feature === 'home' ? st.home : st.portal)); const runPkgs = async (names: string[], what: string, shown = names) => { const ok = await confirmDialog( - `Update ${what}?`, - `${shown.join(', ')} from the OpenWrt feeds. Services that use them restart for a moment.`, - 'Update', + fmt(_('Update %s?'), what), + fmt(_('%s from the OpenWrt feeds. Services that use them restart for a moment.'), shown.join(', ')), + _('Update'), ); - if (ok) void page.op(`pkgs:${names.join(',')}`, `Updating ${what}`); + if (ok) void page.op(`pkgs:${names.join(',')}`, fmt(_('Updating %s'), what)); }; const menu: (MenuEntry | null)[] = [ - { label: 'Check system packages', ic: 'refresh', run: () => page.op('check:packages', 'Checking system packages') }, + { label: _('Check system packages'), ic: 'refresh', run: () => page.op('check:packages', _('Checking system packages')) }, { - label: 'Open the OpenWrt package list', + label: _('Open the OpenWrt package list'), ic: 'globe', run: () => window.open('https://openwrt.org/packages/start', '_blank', 'noopener'), }, @@ -52,11 +63,16 @@ export function packageRows(page: ComponentsPage, p: UpdateComponent | undefined return page.row( ICONS[it.feature], it.title, - [`${it.optional ? 'not installed' : `missing ${lacks.join(', ')}`}`], + [it.optional ? _('not installed') : fmt(_('missing %s'), lacks.join(', '))], [ - button('Install', () => page.op(`pkgs:${lacks.join(',')}`, `Installing ${it.title}`), it.optional ? 'neutral' : 'positive', { - disabled: page.busy, - }), + button( + _('Install'), + () => page.op(`pkgs:${lacks.join(',')}`, fmt(_('Installing %s'), it.title)), + it.optional ? 'neutral' : 'positive', + { + disabled: page.busy, + }, + ), E('span', { class: 'dl-comp-ic' }, page.more(menu)), ], ); @@ -68,7 +84,7 @@ export function packageRows(page: ComponentsPage, p: UpdateComponent | undefined main ? [`${pkgs[main]!.installed} → ${pkgs[main]!.latest}`, upd.length > 1 ? ` · +${upd.length - 1}` : ''] : [upd.join(', ')], [ button( - 'Update', + _('Update'), () => runPkgs( present.filter((x) => pkgs[x]?.latest || pkgs[x]?.with?.length), diff --git a/web/src/admin/pages/diagnostics/health.ts b/web/src/admin/pages/diagnostics/health.ts index 5cd2f79..9255e5f 100644 --- a/web/src/admin/pages/diagnostics/health.ts +++ b/web/src/admin/pages/diagnostics/health.ts @@ -9,6 +9,7 @@ import { sw, setSwitch } from '../../ui/controls'; import { callout } from '../../ui/layout'; import { icon } from '../../../shared/icons'; import { ago, clock } from '../../../shared/format'; +import { fmt, num, plural } from '../../../shared/i18n'; import { isProblem, type LogItem } from '../../events/model'; import { eventRow, systemRow } from '../../events/render'; import { fixAction, runFix } from '../../widgets/health'; @@ -59,8 +60,8 @@ export class HealthTab { if (!checks) { dom.content(this.summary, ''); dom.content(this.checksEl, [ - E('div', { class: 'dl-panel-head' }, [E('h3', {}, 'Checks')]), - E('p', { class: 'dl-muted dl-loading' }, 'Running checks…'), + E('div', { class: 'dl-panel-head' }, [E('h3', {}, _('Checks'))]), + E('p', { class: 'dl-muted dl-loading' }, _('Running checks…')), ]); return; } @@ -69,16 +70,16 @@ export class HealthTab { dom.content( this.summary, bad - ? callout('error', `${bad} problem${bad > 1 ? 's' : ''} need attention.`) + ? callout('error', plural(bad, '%s problem needs attention.', '%s problems need attention.')) : warn - ? callout('warn', `${warn} warning${warn > 1 ? 's' : ''}.`) - : callout('ok', 'All checks passed.'), + ? callout('warn', plural(warn, '%s warning.', '%s warnings.')) + : callout('ok', _('All checks passed.')), ); const repaired = new Map(); for (const x of this.sl.watchdog.repairs) repaired.set(x.id, Math.max(repaired.get(x.id) ?? 0, x.ts)); const refresh = () => this.run(); dom.content(this.checksEl, [ - E('div', { class: 'dl-panel-head' }, [E('h3', {}, 'Checks'), E('span', { class: 'dl-spacer' }), button('Run again', refresh)]), + E('div', { class: 'dl-panel-head' }, [E('h3', {}, _('Checks')), E('span', { class: 'dl-spacer' }), button(_('Run again'), refresh)]), E( 'ul', { class: 'dl-checks' }, @@ -86,10 +87,11 @@ export class HealthTab { E('li', {}, [ E('span', { class: `dl-check-icon ${c.status}` }, icon(ICON[c.status])), E('div', { class: 'dl-check-body' }, [ + // The check's title and detail come from the router. E('div', { class: 'dl-check-title' }, c.title), E('div', { class: 'dl-check-detail' }, c.detail), repaired.has(c.id) - ? E('div', { class: 'dl-check-repaired' }, `Repaired by the watchdog at ${clock(repaired.get(c.id)!)}`) + ? E('div', { class: 'dl-check-repaired' }, fmt(_('Repaired by the watchdog at %s'), clock(repaired.get(c.id)!))) : '', ]), fixAction(c, (fix) => void this.run(fix), refresh), @@ -107,8 +109,8 @@ export class HealthTab { const stale = wd.beat != null && wd.now - wd.beat > 180; const today = wd.repairs.filter((x) => wd.now - x.ts < 86400); const lastRep = today[today.length - 1]; - const toggle = sw(wd.enabled, 'Watchdog repairs', async (v) => { - const ok = await attempt(() => api.settingsUpdate({ watchdog: v ? '1' : '0' }), v ? 'Watchdog on' : 'Watchdog off'); + const toggle = sw(wd.enabled, _('Watchdog repairs'), async (v) => { + const ok = await attempt(() => api.settingsUpdate({ watchdog: v ? '1' : '0' }), v ? _('Watchdog on') : _('Watchdog off')); if (!ok) setSwitch(toggle, !v); const n = await api.serviceLog().catch(() => null); if (n) this.paintLive(n, this.events); @@ -119,13 +121,13 @@ export class HealthTab { E('div', { class: 'dl-wd-head' }, [ E('span', { class: `dl-wd-tile${wd.enabled ? '' : ' off'}` }, icon('shield')), E('div', { class: 'dl-stack' }, [ - E('span', { class: 'dl-wd-title' }, 'Watchdog'), + E('span', { class: 'dl-wd-title' }, _('Watchdog')), E( 'span', { class: 'dl-sub' }, wd.enabled - ? 'Every minute it checks the tunnels and services and repairs what it can on its own.' - : 'Off: problems are only written to the log. Nothing is repaired on its own.', + ? _('Every minute it checks the tunnels and services and repairs what it can on its own.') + : _('Off: problems are only written to the log. Nothing is repaired on its own.'), ), ]), E('span', { class: 'dl-spacer' }), @@ -140,8 +142,13 @@ export class HealthTab { 'span', { class: `dl-check-chip${t.ok ? '' : ' error'}`, - title: t.ok ? 'OK' : `Not working${t.tries ? ` · ${t.tries} repair${t.tries > 1 ? 's' : ''}` : ''}`, + title: t.ok + ? _('OK') + : t.tries + ? `${_('Not working')} · ${plural(t.tries, '%s repair', '%s repairs')}` + : _('Not working'), }, + // The target's name comes from the router. [icon(t.ok ? 'check' : 'x'), t.name], ), ), @@ -150,13 +157,18 @@ export class HealthTab { 'span', { class: `dl-sub${stale ? ' dl-warn-text' : ''}` }, stale - ? `The agent has not checked in for ${Math.round((wd.now - wd.beat!) / 60)} min; cron restarts it after 5.` + ? fmt(_('The agent has not checked in for %s min; cron restarts it after 5.'), num(Math.round((wd.now - wd.beat!) / 60))) : [ - wd.last ? `Looked ${ago(wd.last, wd.now)}` : 'Starts within a minute', + wd.last ? fmt(_('Looked %s'), ago(wd.last, wd.now)) : _('Starts within a minute'), ' · ', today.length - ? `${today.length} repair${today.length > 1 ? 's' : ''} today, last ${lastRep.name} at ${clock(lastRep.ts)}` - : 'no repairs today', + ? fmt( + N_(today.length, '%s repair today, last %s at %s', '%s repairs today, last %s at %s'), + num(today.length), + lastRep.name, + clock(lastRep.ts), + ) + : _('no repairs today'), ], ), ]), @@ -172,16 +184,16 @@ export class HealthTab { .filter((x) => x.ts >= since && isProblem(x)) .sort((a, b) => b.ts - a.ts); const head = E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Recent problems'), + E('h3', {}, _('Recent problems')), E('span', { class: 'dl-spacer' }), - items.length ? E('a', { href: '#', click: (e: Event) => (e.preventDefault(), this.toLog()) }, 'All in Log →') : '', + items.length ? E('a', { href: '#', click: (e: Event) => (e.preventDefault(), this.toLog()) }, `${_('All in Log')} →`) : '', ]); if (!items.length) { dom.content(this.recentEl, [ head, E('div', { class: 'dl-recent-empty' }, [ E('span', { class: 'dl-check-icon ok' }, icon('check')), - 'No problems in the last 7 days.', + _('No problems in the last 7 days.'), ]), ]); return; diff --git a/web/src/admin/pages/diagnostics/index.ts b/web/src/admin/pages/diagnostics/index.ts index 6d1ea6f..ee965b9 100644 --- a/web/src/admin/pages/diagnostics/index.ts +++ b/web/src/admin/pages/diagnostics/index.ts @@ -13,10 +13,9 @@ type Tab = 'health' | 'log'; type Events = Awaited>; type Loaded = [Status, Events, ServiceLog]; -const TABS: [Tab, string][] = [ - ['health', 'Health'], - ['log', 'Log'], -]; +const TABS: Tab[] = ['health', 'log']; + +const tabLabel = (t: Tab) => (t === 'log' ? _('Log') : _('Health')); /** The whole log is large (up to 20,000 events): fetched only for the Log tab. A "since" cursor on the router would make it cheap. */ const LOG_LIMIT = 20000; @@ -25,7 +24,7 @@ export class DiagnosticsPage { tab: Tab = new URLSearchParams(location.search).get('tab') === 'log' ? 'log' : 'health'; health!: HealthTab; log!: LogTab; - segEl = E('div', { class: 'dl-seg dl-srvsections dl-diag-tabs', role: 'tablist', 'aria-label': 'Diagnostics' }); + segEl = E('div', { class: 'dl-seg dl-srvsections dl-diag-tabs', role: 'tablist', 'aria-label': _('Diagnostics') }); subEl = E('span', { class: 'dl-muted' }); actionsEl = E('div', { class: 'dl-row-actions' }); bodyEl = E('div', {}); @@ -61,7 +60,7 @@ export class DiagnosticsPage { }); return E('div', {}, [ E('div', { class: 'dl-pagehead' }, [ - E('div', { class: 'dl-stack' }, [E('h2', { class: 'dl-h1' }, 'Diagnostics'), this.subEl]), + E('div', { class: 'dl-stack' }, [E('h2', { class: 'dl-h1' }, _('Diagnostics')), this.subEl]), this.actionsEl, ]), this.segEl, @@ -87,7 +86,7 @@ export class DiagnosticsPage { this.tab = tab; dom.content( this.segEl, - TABS.map(([k, t]) => + TABS.map((k) => E( 'button', { @@ -97,14 +96,14 @@ export class DiagnosticsPage { 'aria-selected': k === tab ? 'true' : 'false', click: () => k !== this.tab && this.show(k), }, - t, + tabLabel(k), ), ), ); // Both tabs stay alive; only the visible one is in the page. this.bodyEl.replaceChildren(tab === 'log' ? this.log.el : this.health.el); this.subEl.textContent = - tab === 'log' ? this.log.sub : 'Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own.'; + tab === 'log' ? this.log.sub : _('Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own.'); dom.content(this.actionsEl, tab === 'log' ? this.log.actions() : ''); if (tab === 'log') { this.log.paint(); diff --git a/web/src/admin/pages/diagnostics/log.ts b/web/src/admin/pages/diagnostics/log.ts index e02dc19..8a4ee14 100644 --- a/web/src/admin/pages/diagnostics/log.ts +++ b/web/src/admin/pages/diagnostics/log.ts @@ -8,9 +8,10 @@ import { api, type LogCategory, type LogsInfo, type ServiceLogEntry } from '../. import { button } from '../../ui/button'; import { dropdown } from '../../ui/menu'; import { icon } from '../../../shared/icons'; -import { CATEGORIES, CATEGORY_LABEL, categoryOf, isProblem, retentionText, type LogItem } from '../../events/model'; +import { CATEGORIES, categoryLabel, categoryOf, isProblem, retentionText, type LogItem } from '../../events/model'; import { dayTitle, eventRow, systemRow } from '../../events/render'; import { clearLogDialog, exportEvents } from '../../logs'; +import { fmt, locale, num } from '../../../shared/i18n'; export type LogKind = 'all' | LogCategory | 'system'; type Events = Awaited>; @@ -54,16 +55,16 @@ export class LogTab { items.filter((x) => x.sys).map((x) => x.sys!), ); }; - const exp = button([icon('download'), ' Export'], () => + const exp = button([icon('download'), ` ${_('Export')}`], () => dropdown(exp, [ - { label: 'CSV (spreadsheet)', icon: icon('download'), run: run('csv') }, + { label: _('CSV (spreadsheet)'), icon: icon('download'), run: run('csv') }, { label: 'JSON', icon: icon('download'), run: run('json') }, ]), ); - const clear = button([icon('trash'), ' Clear'], () => + const clear = button([icon('trash'), ` ${_('Clear')}`], () => clearLogDialog( - 'Clear the log', - 'Removes events from the log on the router.', + _('Clear the log'), + _('Removes events from the log on the router.'), {}, () => this.reload(), this.kind === 'all' ? undefined : this.kind, @@ -77,7 +78,8 @@ export class LogTab { this.events = r.events; this.policy = r.policy; const off = CATEGORIES.filter((c) => !r.policy.categories.includes(c)); - this.sub = `${retentionText(r.policy)}${off.length ? ` Not recorded: ${off.map((c) => CATEGORY_LABEL[c].toLowerCase()).join(', ')}.` : ''}`; + const kept = retentionText(r.policy); + this.sub = off.length ? `${kept} ${fmt(_('Not recorded: %s.'), off.map((c) => categoryLabel(c).toLowerCase()).join(', '))}` : kept; } async reload() { @@ -119,7 +121,7 @@ export class LogTab { click: () => this.show(k), }, [ - k === 'all' ? 'All' : k === 'system' ? 'System' : CATEGORY_LABEL[k], + k === 'all' ? _('All') : k === 'system' ? _('System') : categoryLabel(k), E('b', {}, String(all.filter((x) => this.matches(x, k)).length)), ], ), @@ -139,7 +141,9 @@ export class LogTab { if (!items.length) { dom.content( this.list, - E('div', { class: 'dl-empty' }, [E('p', {}, this.events.length || this.system.length ? 'No events match.' : 'The log is empty.')]), + E('div', { class: 'dl-empty' }, [ + E('p', {}, this.events.length || this.system.length ? _('No events match.') : _('The log is empty.')), + ]), ); return; } @@ -153,7 +157,7 @@ export class LogTab { panel = E('div', { class: 'dl-panel flush' }, E('div', { class: 'dl-panel-head pad' }, E('h3', {}, t))); groups.push(panel); } - const time = new Date(x.ts * 1000).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' }); + const time = new Date(x.ts * 1000).toLocaleTimeString(locale(), { hour: '2-digit', minute: '2-digit' }); if (x.sys) { const key = `${x.sys.ts}|${x.sys.msg}`; panel!.appendChild( @@ -176,7 +180,7 @@ export class LogTab { E( 'div', { class: 'dl-more-row' }, - button(`Show ${Math.min(PAGE, items.length - this.shown)} more of ${items.length - this.shown}`, () => { + button(fmt(_('Show %s more of %s'), num(Math.min(PAGE, items.length - this.shown)), num(items.length - this.shown)), () => { this.shown += PAGE; this.paint(); }), diff --git a/web/src/admin/pages/overview.ts b/web/src/admin/pages/overview.ts index d0e749a..d37f3ff 100644 --- a/web/src/admin/pages/overview.ts +++ b/web/src/admin/pages/overview.ts @@ -8,7 +8,8 @@ import { api } from '../api'; import { svg } from '../ui/layout'; import { attachTip } from '../ui/tooltip'; import { icon } from '../../shared/icons'; -import { ago, bits, bytes, date, daysLeft, endsIn, endsSoon, initials, todayOf } from '../../shared/format'; +import { ago, bits, bytes, date, daysLeft, duration, endsIn, endsSoon, initials, todayOf } from '../../shared/format'; +import { fill, fmt, plural } from '../../shared/i18n'; import { ConnectionMap, rangeControl, type Range } from '../map'; import { personUrl } from '../urls'; import { eventRow } from '../events/render'; @@ -32,29 +33,27 @@ interface Attention { function attention(st: Status): Attention[] { const out: Attention[] = []; const link = (href: string, t: string) => E('a', { href }, t); + const diagnostics = () => link(L.url('admin/network/dawnline/diagnostics'), _('Open Diagnostics')); const today = todayOf(st.series); // AmneziaWG itself can't run: the health notice says so once, not "Tunnel down" for every server. const awg = !!st.awg_state && !st.awg_state.ok; for (const s of st.servers) if (s.enabled && s.blocked) - // The reason, not just "down": its interface name is taken by a network section Dawnline didn't make. - out.push({ tone: 'bad', text: [`${s.name} ${s.blocked}. `, link(L.url('admin/network/dawnline/diagnostics'), 'Open Diagnostics')] }); - else if (s.enabled && !s.up && !awg) - out.push({ - tone: 'bad', - text: [`Tunnel ${s.ifname} is down. `, link(L.url('admin/network/dawnline/diagnostics'), 'Open Diagnostics')], - }); + // The reason (the router's words), not just "down": its interface name is taken by a network section Dawnline didn't make. + out.push({ tone: 'bad', text: [s.blocked, ' ', diagnostics()] }); + else if (s.enabled && !s.up && !awg) out.push({ tone: 'bad', text: [fmt(_('Tunnel %s is down.'), s.ifname), ' ', diagnostics()] }); for (const p of st.people) { - if (p.state === 'quota') out.push({ tone: 'warn', text: [link(personUrl(p.id), p.name), ' reached the data limit.'] }); - else if (p.state === 'expired') out.push({ tone: 'warn', text: [link(personUrl(p.id), p.name), '’s access has ended.'] }); + const who = () => link(personUrl(p.id), p.name); + if (p.state === 'quota') out.push({ tone: 'warn', text: fill(_('%s reached the data limit.'), who()) }); + else if (p.state === 'expired') out.push({ tone: 'warn', text: fill(_('%s’s access has ended.'), who()) }); else { const left = daysLeft(p.expires, today); - if (endsSoon(p, left)) out.push({ tone: '', text: [link(personUrl(p.id), p.name), `’s access ${endsIn(left as number)}.`] }); + if (endsSoon(p, left)) out.push({ tone: '', text: fill(_('%s’s access %s.'), who(), endsIn(left as number)) }); // "Keep access" at the end date: nothing changes on its own, so it is said here. else if (left != null && left < 0 && p.expire_action === 'notify') - out.push({ tone: '', text: [link(personUrl(p.id), p.name), `’s end date passed (${date(p.expires)}) · access kept.`] }); + out.push({ tone: '', text: fill(_('%s’s end date passed (%s) · access kept.'), who(), date(p.expires)) }); if (p.quota_limit && p.quota_used >= p.quota_limit * 0.9) - out.push({ tone: '', text: [link(personUrl(p.id), p.name), ' has used 90% of the data limit.'] }); + out.push({ tone: '', text: fill(_('%s has used 90% of the data limit.'), who()) }); } } const stale = st.people.flatMap((p) => p.devices.filter((d) => d.config_stale).map((d) => [p, d] as const)); @@ -63,11 +62,17 @@ function attention(st: Status): Attention[] { tone: 'warn', text: stale.length === 1 - ? [ + ? fill( + _('%s needs its configuration again.'), link(personUrl(stale[0][0].id, stale[0][1].id), `${stale[0][0].name} · ${stale[0][1].name}`), - ' needs its configuration again.', - ] - : [`${stale.length} devices need their configuration again (networks or DNS changed).`], + ) + : [ + plural( + stale.length, + '%s device needs its configuration again (networks or DNS changed).', + '%s devices need their configuration again (networks or DNS changed).', + ), + ], }); // A server that gives devices an IPv4 that is no longer the router's: one click puts the new one in. for (const s of st.servers) @@ -75,7 +80,8 @@ function attention(st: Status): Attention[] { out.push({ tone: 'warn', text: [ - `Public address changed: ${s.name} still gives devices ${s.endpoint}, the router is ${st.wan} now. `, + fmt(_('Public address changed: %s still gives devices %s, the router is %s now.'), s.name, s.endpoint, st.wan), + ' ', E( 'button', { @@ -86,24 +92,30 @@ function attention(st: Status): Attention[] { b.disabled = true; await attempt( () => api.serverUpdate(s.id, { endpoint: st.wan }), - `${s.name} uses ${st.wan} now — devices need their configuration again`, + fmt(_('%s uses %s now - devices need their configuration again'), s.name, st.wan), ); b.disabled = false; }, }, - 'Use the new address', + _('Use the new address'), ), - ' A DDNS name would follow it by itself.', + ' ', + _('A DDNS name would follow it by itself.'), ], }); if (st.servers.some((s) => s.lan_like) && st.like_home.error) out.push({ tone: 'warn', - text: [`Internet through the LAN is off: ${st.like_home.error} `, link(L.url('admin/network/dawnline/diagnostics'), 'Details')], + // The reason is the router's. + text: [ + fmt(_('Internet through the LAN is off: %s'), st.like_home.error), + ' ', + link(L.url('admin/network/dawnline/diagnostics'), _('Details')), + ], }); // Only while setting up: an admin who keeps the portal off has decided so. if (!st.settings.portal_enabled && !st.people.length) - out.push({ tone: '', text: ['The personal portal is off. ', link(L.url('admin/network/dawnline/settings'), 'Turn on')] }); + out.push({ tone: '', text: [_('The personal portal is off.'), ' ', link(L.url('admin/network/dawnline/settings'), _('Turn on'))] }); return out; } @@ -188,8 +200,8 @@ export class ServerOverview { const st = this.st; const head = E('div', { class: 'dl-panel-head pad' }, [ E('div', { class: 'dl-stack' }, [ - E('h3', {}, 'Where people connect from'), - E('span', { class: 'dl-sub' }, 'City-level, from the client IP · locations cached on the router'), + E('h3', {}, _('Where people connect from')), + E('span', { class: 'dl-sub' }, _('City-level, from the client IP · locations cached on the router')), ]), E('span', { class: 'dl-spacer' }), rangeControl(this.range, (r) => { @@ -202,11 +214,11 @@ export class ServerOverview { if (!st.geo.enabled) return E('div', { class: 'dl-panel flush' }, [ head, - E('div', { class: 'dl-map-off' }, [ - 'Locations are off. ', - E('a', { href: L.url('admin/network/dawnline/settings') }, 'Turn them on in Settings'), - '.', - ]), + E( + 'div', + { class: 'dl-map-off' }, + fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))), + ), ]); const map = (this.map = new ConnectionMap( { @@ -224,8 +236,8 @@ export class ServerOverview { if (this.map === map) this.map = null; }); const legend = E('div', { class: 'dl-map-legend' }, [ - E('span', {}, [E('i', { class: 'line live' }), 'Live tunnel']), - E('span', {}, [E('i', { class: 'line' }), 'Seen recently']), + E('span', {}, [E('i', { class: 'line live' }), _('Live tunnel')]), + E('span', {}, [E('i', { class: 'line' }), _('Seen recently')]), ]); const wrap = E('div', { class: 'dl-map-wrap' }, [map.el, legend]); requestAnimationFrame(() => map.mount(this.mapData())); @@ -248,9 +260,9 @@ export class ServerOverview { this.parts.side, E('div', { class: 'dl-panel flush' }, [ E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Needs attention'), + E('h3', {}, _('Needs attention')), E('span', { class: 'dl-spacer' }), - E('a', { href: L.url('admin/network/dawnline/diagnostics') }, 'Health'), + E('a', { href: L.url('admin/network/dawnline/diagnostics') }, _('Health')), ]), att.length ? att @@ -262,7 +274,7 @@ export class ServerOverview { a.action ?? '', ]), ) - : E('div', { class: 'dl-row dl-muted' }, [icon('check'), 'All good. Nothing needs you right now.']), + : E('div', { class: 'dl-row dl-muted' }, [icon('check'), _('All good. Nothing needs you right now.')]), ]), quiet, ); @@ -272,13 +284,13 @@ export class ServerOverview { this.parts.activity, E('div', { class: 'dl-panel flush' }, [ E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Activity'), + E('h3', {}, _('Activity')), E('span', { class: 'dl-spacer' }), - E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, 'View all'), + E('a', { href: `${L.url('admin/network/dawnline/diagnostics')}?tab=log` }, _('View all')), ]), events.length ? events.map((e) => eventRow(st, e)) - : E('div', { class: 'dl-row dl-muted' }, 'Nothing yet. Connections, new devices and pauses appear here.'), + : E('div', { class: 'dl-row dl-muted' }, _('Nothing yet. Connections, new devices and pauses appear here.')), ]), quiet, ); @@ -332,7 +344,7 @@ export class ServerOverview { E('span', { class: 'dl-onl-av sm' }, initials(p.name)), E('span', { class: 'dl-stack' }, [ E('b', {}, p.name), - E('span', { class: 'dl-hc-since' }, since ? `online for ${ago(since, st.now).replace(' ago', '')}` : 'online'), + E('span', { class: 'dl-hc-since' }, since ? fmt(_('online for %s'), duration(Math.max(60, st.now - since))) : _('online')), ]), E( 'span', @@ -345,12 +357,12 @@ export class ServerOverview { 'div', { class: 'dl-hc-speed-row' }, idle - ? [E('span', { class: 'dl-faint' }, 'Idle right now')] + ? [E('span', { class: 'dl-faint' }, _('Idle right now'))] : [ E('span', {}, [E('span', { class: 'dl-dn' }, '↓'), ` ${bits(fresh![2])}`]), E('span', {}, [E('span', { class: 'dl-up' }, '↑'), ` ${bits(fresh![1])}`]), E('span', { class: 'dl-spacer' }), - E('span', { class: 'dl-faint' }, '15 min'), + E('span', { class: 'dl-faint' }, _('15 min')), ], ), chart, @@ -364,7 +376,7 @@ export class ServerOverview { E( 'span', { class: 'dl-faint' }, - `${bytes(devs.reduce((n, d) => n + today(d), 0))} today · ${bytes(p.month[0] + p.month[1])} this month`, + `${fmt(_('%s today'), bytes(devs.reduce((n, d) => n + today(d), 0)))} · ${fmt(_('%s this month'), bytes(p.month[0] + p.month[1]))}`, ), ]), ]), @@ -374,7 +386,7 @@ export class ServerOverview { const person = (x: { p: Person; devs: Device[] }) => { const { p, devs } = x; const badge = E('span', { class: 'dl-onl-dev' }, devs.length > 1 ? String(devs.length) : icon(devs[0].kind)); - const el = E('a', { class: `dl-onl-p${big ? '' : ' sm'}`, href: personUrl(p.id), 'aria-label': `${p.name}, online` }, [ + const el = E('a', { class: `dl-onl-p${big ? '' : ' sm'}`, href: personUrl(p.id), 'aria-label': fmt(_('%s, online'), p.name) }, [ E('span', { class: 'dl-onl-av' }, [initials(p.name), badge]), big ? E('span', { class: 'dl-onl-name' }, p.name) : '', big @@ -391,15 +403,14 @@ export class ServerOverview { const count = E('b', { class: `dl-onl-count${on.length ? '' : ' none'}` }, String(on.length)); const ndev = on.reduce((n, x) => n + x.devs.length, 0); - if (on.length) - attachTip(count, () => [`${on.length} ${on.length === 1 ? 'person' : 'people'} · ${ndev} device${ndev === 1 ? '' : 's'}`]); + if (on.length) attachTip(count, () => [`${plural(on.length, '%s person', '%s people')} · ${plural(ndev, '%s device', '%s devices')}`]); const shown = on.length > CAP ? on.slice(0, CAP - 1) : on; const last = st.people .flatMap((p) => p.devices.map((d) => ({ p, d }))) .filter((x) => x.d.handshake) .sort((a, b) => b.d.handshake - a.d.handshake)[0]; return E('div', { class: 'dl-bento-tile online' }, [ - E('div', { class: 'dl-bento-head' }, [E('span', { class: 'dl-metric-label' }, 'Online'), count]), + E('div', { class: 'dl-bento-head' }, [E('span', { class: 'dl-metric-label' }, _('Online')), count]), on.length ? E('div', { class: `dl-onl-row${big ? '' : ' grid'}` }, [ ...shown.map(person), @@ -409,7 +420,7 @@ export class ServerOverview { { class: 'dl-onl-p sm more', href: `${L.url('admin/network/dawnline/server')}?server=${encodeURIComponent(this.srvId)}§ion=people&filter=online`, - title: 'Everyone online', + title: _('Everyone online'), click: (ev: Event) => { if (this.go) { ev.preventDefault(); @@ -423,10 +434,10 @@ export class ServerOverview { ]) : E('div', { class: 'dl-onl-empty' }, [ // A server that is off takes no connections: say so rather than "nobody". - E('span', {}, off ? 'The server is turned off' : 'Nobody is connected'), + E('span', {}, off ? _('The server is turned off') : _('Nobody is connected')), last - ? E('span', { class: 'dl-sub' }, `Last: ${last.p.name}, ${ago(last.d.handshake, st.now)}`) - : E('span', { class: 'dl-sub' }, off ? 'Devices connect once it is on' : 'No device has connected yet'), + ? E('span', { class: 'dl-sub' }, fmt(_('Last: %s, %s'), last.p.name, ago(last.d.handshake, st.now))) + : E('span', { class: 'dl-sub' }, off ? _('Devices connect once it is on') : _('No device has connected yet')), ]), ]); } @@ -448,6 +459,6 @@ export class ServerOverview { .filter(([, n]) => n > 0) .sort((a, b) => b[1] - a[1]) .slice(0, 2); - return daysTile(this.st.series, top.length ? `Most: ${top.map(([p, n]) => `${p.name} ${bytes(n)}`).join(' · ')}` : ''); + return daysTile(this.st.series, top.length ? fmt(_('Most: %s'), top.map(([p, n]) => `${p.name} ${bytes(n)}`).join(' · ')) : ''); } } diff --git a/web/src/admin/pages/people.ts b/web/src/admin/pages/people.ts index 44cba98..c36b6de 100644 --- a/web/src/admin/pages/people.ts +++ b/web/src/admin/pages/people.ts @@ -24,7 +24,7 @@ import { expiresHelp, limitHelp, nameHelp, quotaHelp } from '../netcheck'; import { coreFor } from '../cores'; import { icon } from '../../shared/icons'; import { - KIND_LABEL, + kindLabel, addMonthsClamped, ago, bits, @@ -38,6 +38,7 @@ import { initials, todayOf, } from '../../shared/format'; +import { fill, fmt, num, plural } from '../../shared/i18n'; type Sid = string; @@ -64,13 +65,13 @@ function slotBar(p: Person): HTMLElement { const n = Math.max(1, p.device_limit, used); // 22px a segment until the bar is 160px long; past that the segments get thinner, so the count stays close. const width = Math.min(160, n * 22 + (n - 1) * 3); - return E('div', { class: 'dl-slotbar', title: `${used} of ${p.device_limit} devices` }, [ + return E('div', { class: 'dl-slotbar', title: fmt(N_(p.device_limit, '%s of %s device', '%s of %s devices'), used, p.device_limit) }, [ E( 'span', { class: 'dl-slotbar-segs', style: `width: ${width}px` }, - Array.from({ length: n }, (_, i) => E('i', { class: i >= p.device_limit ? 'over' : i < used ? 'used' : '' })), + Array.from({ length: n }, (_x, i) => E('i', { class: i >= p.device_limit ? 'over' : i < used ? 'used' : '' })), ), - E('span', { class: 'dl-slotbar-text' }, `${used} of ${p.device_limit}`), + E('span', { class: 'dl-slotbar-text' }, fmt(_('%s of %s'), used, p.device_limit)), ]); } @@ -201,8 +202,8 @@ export class PeoplePage { 'div', { class: 'dl-plist-none' }, this.st.servers.length - ? 'No people yet. Add someone and send them their personal link.' - : 'Set up the server first, then add people.', + ? _('No people yet. Add someone and send them their personal link.') + : _('Set up the server first, then add people.'), ), ); this.decorate(); @@ -229,7 +230,7 @@ export class PeoplePage { 'select', { class: 'dl-select', - 'aria-label': 'Sort', + 'aria-label': _('Sort'), change: (ev: Event) => { page.sort = (ev.target as HTMLSelectElement).value as SortBy; remember('dl.people.sort', page.sort); @@ -237,17 +238,17 @@ export class PeoplePage { }, }, [ - E('option', { value: 'seen', selected: page.sort === 'seen' ? 'selected' : null }, 'Last seen'), - E('option', { value: 'name', selected: page.sort === 'name' ? 'selected' : null }, 'Name'), - E('option', { value: 'usage', selected: page.sort === 'usage' ? 'selected' : null }, 'Usage'), + E('option', { value: 'seen', selected: page.sort === 'seen' ? 'selected' : null }, _('Last seen', 'sort')), + E('option', { value: 'name', selected: page.sort === 'name' ? 'selected' : null }, _('Name', 'sort')), + E('option', { value: 'usage', selected: page.sort === 'usage' ? 'selected' : null }, _('Usage', 'sort')), ], ); // Find, once the list is long enough to need it; "/" focuses it. const find = E('input', { type: 'search', class: 'cbi-input-text dl-people-find', - placeholder: 'Find…', - 'aria-label': 'Find a person or device', + placeholder: _('Find…'), + 'aria-label': _('Find a person or device'), hidden: st.people.length > 8 ? null : 'hidden', input: (ev: Event) => { page.query = (ev.target as HTMLInputElement).value.trim().toLowerCase(); @@ -268,25 +269,28 @@ export class PeoplePage { ? '' : E('div', { class: 'dl-pagehead' }, [ E('div', { class: 'dl-stack' }, [ - E('h2', { class: 'dl-h1' }, 'People'), + E('h2', { class: 'dl-h1' }, _('People')), E('span', { class: 'dl-muted dl-people-count' }, this.countText()), ]), - st.servers.length ? button([icon('plus'), ' Add person'], () => page.openCreate(), 'add') : '', + st.servers.length ? button([icon('plus'), ` ${_('Add person')}`], () => page.openCreate(), 'add') : '', ]), st.servers.length ? '' - : E('div', { class: 'alert-message warning' }, [ - 'No server yet. ', - E('a', { href: L.url('admin/network/dawnline/server') }, 'Run the setup wizard'), - ' before adding people.', - ]), + : E( + 'div', + { class: 'alert-message warning' }, + fill( + _('No server yet. %s before adding people.'), + E('a', { href: L.url('admin/network/dawnline/server') }, _('Run the setup wizard')), + ), + ), E('div', { class: 'dl-toolbar' }, [ E('div', { class: 'dl-seg dl-people-tabs', role: 'tablist' }), // Sort and add stay together on the right, wrapping as one group. E('div', { class: 'dl-toolbar-end' }, [ find, sort, - page.serverId ? button([icon('plus'), ' Add person'], () => page.openCreate(), 'add') : '', + page.serverId ? button([icon('plus'), ` ${_('Add person')}`], () => page.openCreate(), 'add') : '', ]), ]), this.list, @@ -311,7 +315,11 @@ export class PeoplePage { countText(): string { const t = this.st.totals; - return `${t.people} ${t.people === 1 ? 'person' : 'people'} · ${t.devices} device${t.devices === 1 ? '' : 's'} · ${t.online} online`; + return [ + plural(t.people, '%s person', '%s people'), + plural(t.devices, '%s device', '%s devices'), + fmt(_('%s online'), num(t.online)), + ].join(' · '); } /** Row classes, counters, filter tabs and sort order; a `quiet` repaint keeps focused tabs. */ @@ -329,7 +337,7 @@ export class PeoplePage { }; const tabs = this.el?.querySelector('.dl-people-tabs'); if (tabs && !(quiet && focusInside(tabs))) { - const label: Record = { all: 'All', online: 'Online', attention: 'Needs attention', paused: 'Paused' }; + const label: Record = { all: _('All'), online: _('Online'), attention: _('Needs attention'), paused: _('Paused') }; dom.content( tabs, (Object.keys(label) as Filter[]).map((f) => @@ -385,7 +393,7 @@ export class PeoplePage { // Say so when the filter leaves nobody. let none = this.el?.querySelector('.dl-people-none') ?? null; if (people.length && !shown) { - none ??= E('div', { class: 'dl-empty dl-people-none' }, E('p', {}, 'No one here right now.')); + none ??= E('div', { class: 'dl-empty dl-people-none' }, E('p', {}, _('No one here right now.'))); if (none.previousElementSibling !== this.list) this.list.after(none); } else none?.remove(); } @@ -397,7 +405,7 @@ export class PeoplePage { renderCard(node: HTMLElement, sid: Sid): HTMLElement { const p = this.person(sid); if (!p) { - dom.content(node, E('em', {}, 'This person was just removed.')); + dom.content(node, E('em', {}, _('This person was just removed.'))); return node; } const today = this.today; @@ -413,14 +421,14 @@ export class PeoplePage { const soon = endsSoon(p, left); const over = left != null && left < 0; pills.push( - E('span', { class: `dl-pill-ic${over ? ' bad' : soon ? ' warn' : ''}`, title: `Access ends ${date(p.expires)}` }, [ + E('span', { class: `dl-pill-ic${over ? ' bad' : soon ? ' warn' : ''}`, title: fmt(_('Access ends %s'), date(p.expires)) }, [ icon('calendar'), - over ? `ended ${date(p.expires)}` : soon ? endsIn(left as number) : `until ${date(p.expires)}`, + over ? fmt(_('ended %s'), date(p.expires)) : soon ? endsIn(left as number) : fmt(_('until %s'), date(p.expires)), ]), ); } if (p.hours && why !== 'hours') - pills.push(E('span', { class: 'dl-pill-ic', title: 'Allowed hours' }, [icon('clock'), p.hours.replace('-', '–')])); + pills.push(E('span', { class: 'dl-pill-ic', title: _('Allowed hours') }, [icon('clock'), p.hours.replace('-', '–')])); const chips = byDeviceState(p.devices).map((d) => { return E( @@ -428,7 +436,13 @@ export class PeoplePage { { type: 'button', class: `dl-chip${d.disabled ? ' disabled' : ''}${d.online ? ' live' : ''}`, - title: `${KIND_LABEL[d.kind]} · ${d.address}${d.online ? ` · online from ${d.endpoint}` : d.handshake ? ` · seen ${ago(d.handshake, this.st.now)}` : ''}`, + title: [ + kindLabel(d.kind), + d.address, + d.online ? fmt(_('online from %s'), d.endpoint) : d.handshake ? fmt(_('seen %s'), ago(d.handshake, this.st.now)) : '', + ] + .filter(Boolean) + .join(' · '), click: (ev: Event) => { ev.preventDefault(); void openDevice(p, d, this.deviceOpts(p)); @@ -437,7 +451,7 @@ export class PeoplePage { [ icon(d.kind), E('span', { class: 'dl-chip-name' }, d.name), - !d.handshake && !d.disabled ? E('span', { class: 'dl-chip-tag' }, 'not set up') : '', + !d.handshake && !d.disabled ? E('span', { class: 'dl-chip-tag' }, _('not set up')) : '', // Online shows as the green chip (.dl-chip.live); no dots. ], ); @@ -449,13 +463,13 @@ export class PeoplePage { { type: 'button', class: 'dl-chip add', - title: free > 0 ? 'Add device' : 'Over the limit: admins can still add', + title: free > 0 ? _('Add device') : _('Over the limit: admins can still add'), click: (ev: Event) => { ev.preventDefault(); addDevice(p, this.deviceOpts(p)); }, }, - [icon('plus'), 'Add device'], + [icon('plus'), _('Add device')], ), ); @@ -465,20 +479,24 @@ export class PeoplePage { fixes.push( E( 'button', - { type: 'button', class: 'dl-fix', click: () => this.quick(p, { expires: addMonth(p.expires, today) }, 'Extended by 1 month') }, - 'Extend 1 month', + { + type: 'button', + class: 'dl-fix', + click: () => this.quick(p, { expires: addMonth(p.expires, today) }, _('Extended by 1 month')), + }, + _('Extend 1 month'), ), ); const more = iconButton( 'more', - 'More', + _('More'), (ev: MouseEvent) => dropdown( ev.currentTarget as HTMLElement, [ { - label: 'Open', + label: _('Open'), icon: icon('open'), run: () => { location.href = personUrl(p.id); @@ -486,27 +504,27 @@ export class PeoplePage { }, portal ? { - label: 'Invite card', + label: _('Invite card'), icon: icon('qr'), - run: () => inviteCard(p, this.st.servers.find((s) => s.id === p.server)?.name ?? 'Home'), + run: () => inviteCard(p, this.st.servers.find((s) => s.id === p.server)?.name ?? _('Home')), } : null, - free > 0 ? { label: 'Add device', icon: icon('plus'), run: () => addDevice(p, this.deviceOpts(p)) } : null, + free > 0 ? { label: _('Add device'), icon: icon('plus'), run: () => addDevice(p, this.deviceOpts(p)) } : null, null, { - label: p.paused ? 'Resume' : 'Pause', + label: p.paused ? _('Resume') : _('Pause'), icon: icon(p.paused ? 'play' : 'pause'), warn: !p.paused, run: () => this.togglePause(p), }, - { label: 'Delete', icon: icon('trash'), danger: true, run: () => this.remove(p.id) }, + { label: _('Delete'), icon: icon('trash'), danger: true, run: () => this.remove(p.id) }, ].filter((x, i, a) => x || (i > 0 && a[i - 1])) as MenuItem[], ), 'neutral', 'dl-icon-only', ); const actions = E('div', { class: 'dl-pcard-actions' }, [ - portal ? iconButton('link', 'Copy link', () => copyPersonLink(p.id), 'neutral', 'dl-icon-only') : '', + portal ? iconButton('link', _('Copy link'), () => copyPersonLink(p.id), 'neutral', 'dl-icon-only') : '', more, ]); @@ -541,28 +559,34 @@ export class PeoplePage { const today = this.today; // The month's data resets on the 1st (router time). const reset = addMonthsClamped(`${today.slice(0, 8)}01`, 1); - const extra = () => this.quick(p, { bonus_gb: String((p.bonus_gb || 0) + 10) }, '+10 GB this month'); + const extra = () => this.quick(p, { bonus_gb: String((p.bonus_gb || 0) + 10) }, _('+10 GB this month')); const what: Record unknown] | null]> = { - paused: ['pause', 'warn', 'Paused', 'Devices can’t connect until you resume', ['play', 'Resume', () => this.togglePause(p)]], + paused: ['pause', 'warn', _('Paused'), _('Devices can’t connect until you resume'), ['play', _('Resume'), () => this.togglePause(p)]], quota: p.quota_period === 'month' - ? ['chart', 'bad', 'Data limit reached', `Paused until it resets on ${date(reset)}`, ['plus', '+10 GB this month', extra]] + ? [ + 'chart', + 'bad', + _('Data limit reached'), + fmt(_('Paused until it resets on %s'), date(reset)), + ['plus', _('+10 GB this month'), extra], + ] : [ 'chart', 'bad', - 'Data limit reached', - 'Paused until the limit is raised', - ['edit', 'Change limit', () => (location.href = personUrl(p.id))], + _('Data limit reached'), + _('Paused until the limit is raised'), + ['edit', _('Change limit'), () => (location.href = personUrl(p.id))], ], expired: [ 'calendar', 'bad', - `Access ended ${date(p.expires)}`, - 'Devices can’t connect', - ['calendar', 'Extend 1 month', () => this.quick(p, { expires: addMonth(p.expires, today) }, 'Extended by 1 month')], + fmt(_('Access ended %s'), date(p.expires)), + _('Devices can’t connect'), + ['calendar', _('Extend 1 month'), () => this.quick(p, { expires: addMonth(p.expires, today) }, _('Extended by 1 month'))], ], - hours: ['clock', 'warn', 'Outside allowed hours', `Access ${p.hours.replace('-', '–')} (router time)`, null], - no_server: ['alert', 'warn', 'No server', 'Choose a server on their page', null], + hours: ['clock', 'warn', _('Outside allowed hours'), fmt(_('Access %s (router time)'), p.hours.replace('-', '–')), null], + no_server: ['alert', 'warn', _('No server'), _('Choose a server on their page'), null], }; const [ic, tone, title, sub, act] = what[why]; return E('div', { class: `dl-pstrip ${tone}` }, [ @@ -586,16 +610,18 @@ export class PeoplePage { fill.style.width = `${pct}%`; bar.appendChild(fill); attachTip(bar, () => [ - E('div', { class: 'dl-tip-title' }, `${pct.toFixed(1)}% used`), + E('div', { class: 'dl-tip-title' }, fmt(_('%s%% used'), num(pct, 1))), E( 'div', { class: 'dl-muted' }, - `${bytes(p.quota_used)} of ${bytes(p.quota_limit)} · ${bytes(Math.max(0, p.quota_limit - p.quota_used))} left`, + `${fmt(_('%s of %s'), bytes(p.quota_used), bytes(p.quota_limit))} · ${fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - p.quota_used)))}`, ), E( 'div', { class: 'dl-faint' }, - p.quota_period === 'total' ? 'In total' : `This month${p.bonus_gb ? ` · includes +${p.bonus_gb} GB extra` : ''}`, + p.quota_period === 'total' + ? _('In total') + : [_('This month'), p.bonus_gb ? fmt(_('includes +%s GB extra'), num(p.bonus_gb)) : ''].filter(Boolean).join(' · '), ), ]); } else { @@ -610,7 +636,7 @@ export class PeoplePage { }); if (devs.length) attachTip(bar, () => [ - E('div', { class: 'dl-tip-title' }, 'This month by device'), + E('div', { class: 'dl-tip-title' }, _('This month by device')), ...devs.map((x, i) => E('div', { class: 'dl-tip-row' }, [ E('span', { class: `dl-swatch c${Math.min(i, 4)}` }), @@ -621,12 +647,12 @@ export class PeoplePage { ]); } - const limitText = p.quota_limit ? `${bytes(Math.max(0, p.quota_limit - p.quota_used))} left` : 'no limit'; + const limitText = p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - p.quota_used))) : _('no limit'); return E('div', { class: 'dl-pside' }, [ E('div', { class: 'dl-pside-top' }, [ live - ? E('span', { class: 'dl-pside-state live' }, 'Online') - : E('span', { class: 'dl-pside-state' }, p.online ? 'Online' : p.last_seen ? 'Offline' : 'Never connected'), + ? E('span', { class: 'dl-pside-state live' }, _('Online')) + : E('span', { class: 'dl-pside-state' }, p.online ? _('Online') : p.last_seen ? _('Offline') : _('Never connected')), actions, ]), E('div', { class: 'dl-use-num' }, [ @@ -634,38 +660,50 @@ export class PeoplePage { E( 'span', { class: 'dl-faint' }, - p.quota_limit ? `of ${bytes(p.quota_limit)}` : p.quota_period === 'total' && p.quota_gb ? 'in total' : 'this month', + p.quota_limit + ? fmt(_('of %s'), bytes(p.quota_limit)) + : p.quota_period === 'total' && p.quota_gb + ? _('in total') + : _('this month'), ), ]), bar, live - ? E('div', { class: 'dl-use-live', title: 'Right now' }, [`↓ ${bits(r![2])}`, E('span', { class: 'dl-faint' }, `↑ ${bits(r![1])}`)]) - : E('div', { class: 'dl-faint dl-pside-foot' }, today ? `today ${bytes(today)} · ${limitText}` : limitText), + ? E('div', { class: 'dl-use-live', title: _('Right now') }, [ + `↓ ${bits(r![2])}`, + E('span', { class: 'dl-faint' }, `↑ ${bits(r![1])}`), + ]) + : E('div', { class: 'dl-faint dl-pside-foot' }, today ? `${fmt(_('today %s'), bytes(today))} · ${limitText}` : limitText), ]); } async togglePause(p: Person) { - if (await attempt(() => api.personPause(p.id, !p.paused), p.paused ? `${p.name} resumed` : `${p.name} paused`)) await this.refresh(); + if (await attempt(() => api.personPause(p.id, !p.paused), fmt(p.paused ? _('%s resumed') : _('%s paused'), p.name))) + await this.refresh(); } async remove(sid: Sid) { const p = this.person(sid); const ok = await confirmDialog( - `Remove ${p?.name ?? sid}?`, - `All ${p?.devices.length ?? 0} devices are disconnected immediately and the personal link stops working. Usage history is kept in backups.`, - 'Remove', + fmt(_('Remove %s?'), p?.name ?? sid), + plural( + p?.devices.length ?? 0, + '%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups.', + 'All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups.', + ), + _('Remove'), true, ); - if (ok && (await attempt(() => api.personDelete(sid), 'Person removed'))) await this.refresh(); + if (ok && (await attempt(() => api.personDelete(sid), _('Person removed')))) await this.refresh(); } openCreate() { const st = this.st; if (!st.servers.length) { - notify('Set up the server first.', 'warning'); + notify(_('Set up the server first.'), 'warning'); return; } - const name = E('input', { type: 'text', class: 'cbi-input-text', placeholder: 'e.g. Myata', maxlength: 48 }) as HTMLInputElement; + const name = E('input', { type: 'text', class: 'cbi-input-text', placeholder: _('e.g. Myata'), maxlength: 48 }) as HTMLInputElement; // The last person's access and data limit come back pre-filled (most are alike). const last = (() => { try { @@ -688,7 +726,7 @@ export class PeoplePage { class: 'cbi-input-text', min: 0, step: 'any', - placeholder: 'Unlimited', + placeholder: _('Unlimited'), value: last.quota ?? '', }) as HTMLInputElement; const quick = (label: string, months: number) => @@ -721,26 +759,32 @@ export class PeoplePage { ]); // Each field says what its value means, or what is wrong, as it is typed; Create refuses what the router would. const today = todayOf(st.series); - const nameRow = liveField('Name', name, () => nameHelp(name.value, [], 'Shown in their portal and apps.')); - const limitRow = liveField('Devices', limit, () => limitHelp(limit.value)); + const nameRow = liveField(_('Name', 'person'), name, () => nameHelp(name.value, [], _('Shown in their portal and apps.'))); + const limitRow = liveField(_('Devices'), limit, () => limitHelp(limit.value)); const expRow = liveField( - 'End date', + _('End date'), expires, () => expiresHelp(expires.value, today, daysLeft, date), - E('div', { class: 'dl-actions' }, [expires, quick('1 month', 1), quick('3 months', 3), quick('1 year', 12), quick('None', 0)]), + E('div', { class: 'dl-actions' }, [ + expires, + quick(_('1 month'), 1), + quick(_('3 months'), 3), + quick(_('1 year'), 12), + quick(_('None', 'end date'), 0), + ]), ); - const quotaRow = liveField('Monthly data (GB)', quota, () => quotaHelp(quota.value)); + const quotaRow = liveField(_('Monthly data (GB)'), quota, () => quotaHelp(quota.value)); // The quick buttons set the date without an input event. expires.addEventListener('change', () => expRow.refresh()); const portalOn = st.settings.portal_enabled; modal( - 'Add person', + _('Add person'), [ nameRow, - server ? row('Server', server) : '', + server ? row(_('Server'), server) : '', E('div', { class: 'cbi-value dl-block' }, [ - E('label', { class: 'cbi-value-title' }, 'Access'), + E('label', { class: 'cbi-value-title' }, _('Access')), E('div', { class: 'cbi-value-field' }, access.el), ]), limitRow, @@ -752,7 +796,7 @@ export class PeoplePage { ' ', button( // Without the portal there is no link to copy. - portalOn ? 'Create and copy link' : 'Create', + portalOn ? _('Create and copy link') : _('Create'), async () => { const bad = firstBad([nameRow, limitRow, expRow, quotaRow]); if (bad) { @@ -774,7 +818,7 @@ export class PeoplePage { if (!r) return; remember('dl.person.last', JSON.stringify({ access: access.get(), quota: quota.value.trim() })); // After the await some browsers refuse the clipboard: the card has its own Copy. - if (r.link) await copyText(r.link, 'Personal link copied', true); + if (r.link) await copyText(r.link, _('Personal link copied'), true); this.showCreated(r.id, name.value.trim(), r.link, st.servers.find((x) => x.id === (server?.value ?? srv.id))?.name ?? srv.name); await this.refresh(); }, @@ -788,28 +832,28 @@ export class PeoplePage { showCreated(id: string, name: string, link: string | null, server: string) { if (link) { inviteCard({ id, name, link }, server, { - title: `${name} is ready`, - lead: `Send ${name} the card or the link. They open it, add their devices and connect — no account needed.`, + title: fmt(_('%s is ready'), name), + lead: fmt(_('Send %s the card or the link. They open it, add their devices and connect - no account needed.'), name), }); return; } // No portal, no link: the two ways on from here, as buttons. const p = this.person(id); modal( - `${name} is ready`, - [E('p', {}, 'Created. Turn on the personal portal in Settings to get a link, or add devices for them here.')], + fmt(_('%s is ready'), name), + [E('p', {}, _('Created. Turn on the personal portal in Settings to get a link, or add devices for them here.'))], [ - E('button', { class: 'cbi-button cbi-button-neutral', click: closeModal }, 'Done'), + E('button', { class: 'cbi-button cbi-button-neutral', click: closeModal }, _('Done')), ' ', E( 'a', { class: 'cbi-button cbi-button-neutral', href: `${L.url('admin/network/dawnline/settings')}?section=portal` }, - 'Open Settings', + _('Open Settings'), ), ' ', p ? button( - 'Add device', + _('Add device'), () => { closeModal(); addDevice(p, this.deviceOpts(p)); diff --git a/web/src/admin/pages/person/activity.ts b/web/src/admin/pages/person/activity.ts index 367ff6a..b18a6e7 100644 --- a/web/src/admin/pages/person/activity.ts +++ b/web/src/admin/pages/person/activity.ts @@ -4,6 +4,7 @@ import { E } from '../../e'; import { button } from '../../ui/button'; import { dropdown } from '../../ui/menu'; import { icon } from '../../../shared/icons'; +import { fill, fmt, num, plural } from '../../../shared/i18n'; import { ConnectionMap, rangeControl } from '../../map'; import { eventRow, eventText } from '../../events/render'; import { clearLogDialog, exportEvents } from '../../logs'; @@ -13,11 +14,11 @@ import type { PersonPage } from './index'; function mapCard(page: PersonPage): HTMLElement { const st = page.st; const head = E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Locations'), + E('h3', {}, _('Locations')), E('span', { class: 'dl-spacer' }), st.geo.enabled ? rangeControl('30d', (r) => page.map?.setRange(r), false) : '', button( - 'Hide', + _('Hide'), () => { page.mapOpen = false; page.map?.destroy(); @@ -30,11 +31,11 @@ function mapCard(page: PersonPage): HTMLElement { if (!st.geo.enabled) return E('div', { class: 'dl-panel flush' }, [ head, - E('div', { class: 'dl-map-off' }, [ - 'Locations are off. ', - E('a', { href: L.url('admin/network/dawnline/settings') }, 'Turn them on in Settings'), - '.', - ]), + E( + 'div', + { class: 'dl-map-off' }, + fill(_('Locations are off. %s.'), E('a', { href: L.url('admin/network/dawnline/settings') }, _('Turn them on in Settings'))), + ), ]); const map = new ConnectionMap( { @@ -59,11 +60,11 @@ export function placesPart(page: PersonPage): HTMLElement | null { return E('div', { class: 'dl-places' }, [ icon('pin'), E('div', { class: 'dl-stack' }, [ - E('span', {}, 'Locations are off'), - E('span', { class: 'dl-sub' }, 'City-level, from the client IP'), + E('span', {}, _('Locations are off')), + E('span', { class: 'dl-sub' }, _('City-level, from the client IP')), ]), E('span', { class: 'dl-spacer' }), - E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/settings') }, 'Turn on'), + E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/settings') }, _('Turn on')), ]); if (page.mapOpen) return page.map && page.parts.places.contains(page.map.el) ? null : mapCard(page); const since = st.now - 30 * 86400; @@ -73,19 +74,19 @@ export function placesPart(page: PersonPage): HTMLElement | null { return E('div', { class: 'dl-places' }, [ icon('pin'), E('div', { class: 'dl-stack' }, [ - E('span', {}, last ? last.city || last.country : 'No locations yet'), + E('span', {}, last ? last.city || last.country : _('No locations yet')), E( 'span', { class: 'dl-sub' }, last - ? `${places.length} place${places.length === 1 ? '' : 's'} in 30 days${last.org ? ` · ${last.org}` : ''}` - : 'Shown after a device connects', + ? [plural(places.length, '%s place in 30 days', '%s places in 30 days'), last.org].filter(Boolean).join(' · ') + : _('Shown after a device connects'), ), ]), E('span', { class: 'dl-spacer' }), pts.length ? button( - 'Show map', + _('Show map'), () => { page.mapOpen = true; page.paintPlaces(); @@ -110,7 +111,7 @@ export function activityPart(page: PersonPage): HTMLElement { const row = eventRow(st, e, { server: false }); if (n > 1) { const main = row.querySelector('.dl-row-main') as HTMLElement; - dom.content(main, [...eventText(st, e).slice(0, 3), E('span', { class: 'dl-muted' }, `${n} times`)]); + dom.content(main, [...eventText(st, e).slice(0, 3), E('span', { class: 'dl-muted' }, plural(n, '%s time', '%s times'))]); main.title = latest .slice(i, i + n) .map((x) => x.detail ?? '') @@ -123,29 +124,32 @@ export function activityPart(page: PersonPage): HTMLElement { [icon('more')], () => dropdown(more, [ - { label: 'Export CSV', icon: icon('download'), run: () => exportEvents(st, all, 'csv', p.id) }, - { label: 'Export JSON', icon: icon('download'), run: () => exportEvents(st, all, 'json', p.id) }, + { label: _('Export CSV'), icon: icon('download'), run: () => exportEvents(st, all, 'csv', p.id) }, + { label: _('Export JSON'), icon: icon('download'), run: () => exportEvents(st, all, 'json', p.id) }, null, { - label: `Clear ${p.name}'s activity`, + label: fmt(_("Clear %s's activity"), p.name), icon: icon('trash'), danger: true, run: () => - clearLogDialog(`Clear ${p.name}'s activity`, `Removes events about ${p.name} and their devices.`, { person: p.id }, () => - page.refresh(), + clearLogDialog( + fmt(_("Clear %s's activity"), p.name), + fmt(_('Removes events about %s and their devices.'), p.name), + { person: p.id }, + () => page.refresh(), ), }, ]), 'neutral', - { title: 'Export or clear', class: 'cbi-button cbi-button-neutral dl-icon-only' }, + { title: _('Export or clear'), class: 'cbi-button cbi-button-neutral dl-icon-only' }, ); return E('div', { class: 'dl-panel flush' }, [ E('div', { class: 'dl-panel-head pad' }, [ - E('h3', {}, 'Activity'), - E('span', { class: 'dl-sub' }, all.length > 10 ? `latest 10 of ${all.length}` : ''), + E('h3', {}, _('Activity')), + E('span', { class: 'dl-sub' }, all.length > 10 ? fmt(_('latest 10 of %s'), num(all.length)) : ''), E('span', { class: 'dl-spacer' }), more, ]), - rows.length ? rows : E('div', { class: 'dl-row dl-muted' }, 'Nothing yet.'), + rows.length ? rows : E('div', { class: 'dl-row dl-muted' }, _('Nothing yet.')), ]); } diff --git a/web/src/admin/pages/person/devices.ts b/web/src/admin/pages/person/devices.ts index 6fb4144..22ceb8e 100644 --- a/web/src/admin/pages/person/devices.ts +++ b/web/src/admin/pages/person/devices.ts @@ -9,7 +9,8 @@ import { downloadFile } from '../../ui/files'; import { attempt, notify } from '../../ui/toast'; import { deviceStatus } from '../../ui/badges'; import { icon } from '../../../shared/icons'; -import { KIND_LABEL, ago, byDeviceState, bytes } from '../../../shared/format'; +import { kindLabel, ago, byDeviceState, bytes } from '../../../shared/format'; +import { fmt, num } from '../../../shared/i18n'; import { addDevice, openDevice, quickMenu } from '../../device'; import { dayBars } from '../../widgets/tiles'; import type { PersonPage } from './index'; @@ -18,14 +19,14 @@ import type { PersonPage } from './index'; async function showDeviceQr(page: PersonPage, d: Device) { const cfg = await attempt(() => api.deviceConfig(d.id)); if (!cfg) return; - modal(`Set up ${d.name}`, [await page.core.connectBlock(cfg, 'qr')], [cancelButton('Close')]); + modal(fmt(_('Set up %s'), d.name), [await page.core.connectBlock(cfg, 'qr')], [cancelButton(_('Close'))]); } async function downloadConfig(page: PersonPage, d: Device) { const cfg = await attempt(() => api.deviceConfig(d.id)); if (!cfg) return; if (!cfg.has_private_key) { - notify('This device made its own keys in the browser; its configuration only exists there.', 'warning'); + notify(_('This device made its own keys in the browser; its configuration only exists there.'), 'warning'); return; } const f = page.core.file.make(cfg); @@ -42,7 +43,7 @@ export function devicesPart(page: PersonPage): HTMLElement { }; const more = (d: Device) => button([icon('more')], (ev: MouseEvent) => quickMenu(ev.currentTarget as HTMLElement, p, d, page.deviceOpts()), 'neutral', { - title: 'QR, file, key, rename, new keys, remove', + title: _('QR, file, key, rename, new keys, remove'), class: 'cbi-button cbi-button-neutral dl-icon-only', }); const cards = byDeviceState(p.devices).map((d) => { @@ -51,12 +52,12 @@ export function devicesPart(page: PersonPage): HTMLElement { E('button', { type: 'button', class: 'dl-dcard-title', click: () => open(d) }, [ E('b', {}, d.name), deviceStatus(d, now, undefined, p), - d.config_stale ? E('span', { class: 'dl-pill warn dl-stale' }, 'Update config') : '', + d.config_stale ? E('span', { class: 'dl-pill warn dl-stale' }, _('Update config')) : '', ]), more(d), ]); const trend = E('div', { class: 'dl-dcard-trend' }, [ - E('div', { class: 'dl-stack' }, [E('b', {}, bytes(d.month[0] + d.month[1])), E('span', { class: 'dl-sub' }, 'this month')]), + E('div', { class: 'dl-stack' }, [E('b', {}, bytes(d.month[0] + d.month[1])), E('span', { class: 'dl-sub' }, _('this month'))]), dayBars(page.devSeries[d.id] ?? []), ]); return E('article', { class: `dl-dcard clickable${d.online ? ' online' : ''}${d.disabled ? ' off' : ''}`, click: clickCard(d) }, [ @@ -67,11 +68,11 @@ export function devicesPart(page: PersonPage): HTMLElement { ? E( 'div', { class: 'dl-sub' }, - `${KIND_LABEL[d.kind]} · created ${ago(d.created, now)} ${d.created_by === 'portal' ? 'in the portal' : 'by you'}.`, + `${kindLabel(d.kind)} · ${fmt(d.created_by === 'portal' ? _('created %s in the portal.') : _('created %s by you.'), ago(d.created, now))}`, ) : E('div', { class: 'dl-chips-row' }, [ - E('button', { type: 'button', class: 'dl-chipbtn', click: () => showDeviceQr(page, d) }, [icon('qr'), 'Show QR']), - E('button', { type: 'button', class: 'dl-chipbtn', click: () => downloadConfig(page, d) }, [icon('download'), 'Config']), + E('button', { type: 'button', class: 'dl-chipbtn', click: () => showDeviceQr(page, d) }, [icon('qr'), _('Show QR')]), + E('button', { type: 'button', class: 'dl-chipbtn', click: () => downloadConfig(page, d) }, [icon('download'), _('Config')]), ]), ]); }); @@ -81,17 +82,19 @@ export function devicesPart(page: PersonPage): HTMLElement { E('button', { type: 'button', class: 'dl-dslot add', click: () => addDevice(p, page.deviceOpts()) }, [ E('span', { class: 'dl-dslot-ic' }, icon('plus')), E('span', { class: 'dl-stack' }, [ - E('b', {}, 'Add device'), + E('b', {}, _('Add device')), E( 'span', { class: 'dl-sub' }, - over ? `Over the limit · ${p.devices.length} of ${p.device_limit}` : `${p.devices.length} of ${p.device_limit}`, + over + ? `${_('Over the limit')} · ${fmt(_('%s of %s'), p.devices.length, p.device_limit)}` + : fmt(_('%s of %s'), p.devices.length, p.device_limit), ), ]), ]), ); return E('section', { class: 'dl-devsec' }, [ - E('div', { class: 'dl-panel-head' }, [E('h3', {}, 'Devices'), E('span', { class: 'dl-sub' }, `${p.online} online`)]), + E('div', { class: 'dl-panel-head' }, [E('h3', {}, _('Devices')), E('span', { class: 'dl-sub' }, fmt(_('%s online'), num(p.online)))]), E('div', { class: 'dl-dgrid' }, cards), ]); } diff --git a/web/src/admin/pages/person/dialogs.ts b/web/src/admin/pages/person/dialogs.ts index e1f7f82..7170c77 100644 --- a/web/src/admin/pages/person/dialogs.ts +++ b/web/src/admin/pages/person/dialogs.ts @@ -10,13 +10,14 @@ import { liveField } from '../../ui/layout'; import { nameHelp } from '../../netcheck'; import { inviteCard } from '../../invite'; import { peopleUrl } from '../../urls'; +import { fmt, plural } from '../../../shared/i18n'; import type { PersonPage } from './index'; const field = (label: string, el: Node) => E('div', { class: 'cbi-value' }, [E('label', { class: 'cbi-value-title' }, label), E('div', { class: 'cbi-value-field' }, el)]); export function invite(page: PersonPage) { - const server = page.st.servers.find((s) => s.id === page.p.server)?.name ?? 'Home'; + const server = page.st.servers.find((s) => s.id === page.p.server)?.name ?? _('Home'); void inviteCard(page.p, server); } @@ -32,10 +33,10 @@ export async function newLink(page: PersonPage) { const boxes = suspect.map( (d) => E('input', { type: 'checkbox', id: `dl-rm-${d.id}`, checked: 'checked', 'data-id': d.id }) as HTMLInputElement, ); - const body: Node[] = [E('p', {}, 'The old link stops working right away.')]; + const body: Node[] = [E('p', {}, _('The old link stops working right away.'))]; if (suspect.length) body.push( - E('p', {}, 'Devices added through the old link keep working until they are removed. Remove them too:'), + E('p', {}, _('Devices added through the old link keep working until they are removed. Remove them too:')), E( 'div', { class: 'dl-checklist' }, @@ -46,33 +47,35 @@ export async function newLink(page: PersonPage) { const remove = boxes.filter((b) => b.checked).map((b) => b.dataset.id as string); const r = await attempt( () => api.personRegen(p.id, remove), - remove.length ? `New link created, ${remove.length} device${remove.length === 1 ? '' : 's'} removed` : 'New link created', + remove.length + ? plural(remove.length, 'New link created, %s device removed', 'New link created, %s devices removed') + : _('New link created'), ); if (!r) return; closeModal(); if (remove.length) await page.refresh(); - if (r.link) await copyText(r.link, 'New link copied'); + if (r.link) await copyText(r.link, _('New link copied')); }; - modal('Create a new link?', body, [cancelButton(), ' ', button('Create new link', go, 'negative')]); + modal(_('Create a new link?'), body, [cancelButton(), ' ', button(_('Create new link'), go, 'negative')]); } export function editNote(page: PersonPage) { const input = E( 'textarea', - { class: 'cbi-input-textarea dl-note-input', rows: 3, maxlength: 500, placeholder: 'Only you see this' }, + { class: 'cbi-input-textarea dl-note-input', rows: 3, maxlength: 500, placeholder: _('Only you see this') }, page.p.note ?? '', ) as HTMLTextAreaElement; modal( - 'Note', + _('Note'), [input], [ cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { closeModal(); - await page.patch({ note: input.value.trim() }, input.value.trim() ? 'Note saved' : 'Note removed'); + await page.patch({ note: input.value.trim() }, input.value.trim() ? _('Note saved') : _('Note removed')); }, 'positive', ), @@ -84,9 +87,9 @@ export function editNote(page: PersonPage) { export function endSettings(page: PersonPage) { const p = page.p; const act = E('select', { class: 'cbi-input-select' }, [ - E('option', { value: 'pause', selected: p.expire_action === 'pause' ? 'selected' : null }, 'Pause access'), - E('option', { value: 'notify', selected: p.expire_action === 'notify' ? 'selected' : null }, 'Keep access'), - E('option', { value: 'remove', selected: p.expire_action === 'remove' ? 'selected' : null }, 'Remove their devices'), + E('option', { value: 'pause', selected: p.expire_action === 'pause' ? 'selected' : null }, _('Pause access')), + E('option', { value: 'notify', selected: p.expire_action === 'notify' ? 'selected' : null }, _('Keep access')), + E('option', { value: 'remove', selected: p.expire_action === 'remove' ? 'selected' : null }, _('Remove their devices')), ]) as HTMLSelectElement; const warn = E( 'select', @@ -95,19 +98,19 @@ export function endSettings(page: PersonPage) { E( 'option', { value: n, selected: p.expire_warn === n ? 'selected' : null }, - n ? `${n} day${n === 1 ? '' : 's'} before` : 'Don’t warn', + n ? plural(n, '%s day before', '%s days before') : _('Don’t warn'), ), ), ) as HTMLSelectElement; modal( - 'When access ends', + _('When access ends'), [ - field('Then', act), + field(_('Then'), act), E('div', { class: 'cbi-value' }, [ - E('label', { class: 'cbi-value-title' }, 'Warn'), + E('label', { class: 'cbi-value-title' }, _('Warn')), E('div', { class: 'cbi-value-field' }, [ warn, - E('div', { class: 'cbi-value-description' }, 'Shown in their portal and on the Overview.'), + E('div', { class: 'cbi-value-description' }, _('Shown in their portal and on the Overview.')), ]), ]), ], @@ -115,10 +118,10 @@ export function endSettings(page: PersonPage) { cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { closeModal(); - await page.patch({ expire_action: act.value, expire_warn: warn.value }, 'Saved'); + await page.patch({ expire_action: act.value, expire_warn: warn.value }, _('Saved')); }, 'positive', ), @@ -128,15 +131,15 @@ export function endSettings(page: PersonPage) { export function rename(page: PersonPage) { const input = E('input', { type: 'text', class: 'cbi-input-text', value: page.p.name, maxlength: 48 }) as HTMLInputElement; - const nameRow = liveField('Name', input, () => nameHelp(input.value, [], 'Shown in their portal and apps.')); + const nameRow = liveField(_('Name', 'person'), input, () => nameHelp(input.value, [], _('Shown in their portal and apps.'))); modal( - 'Rename', + _('Rename'), [nameRow], [ cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { const h = nameRow.help(); if (h.bad) { @@ -144,7 +147,7 @@ export function rename(page: PersonPage) { return; } // The dialog stays open on a refusal, with the name still typed. - if (await page.patch({ name: input.value.trim() }, 'Renamed')) closeModal(); + if (await page.patch({ name: input.value.trim() }, _('Renamed'))) closeModal(); }, 'positive', ), @@ -160,30 +163,36 @@ export function moveToServer(page: PersonPage) { const sel = E( 'select', { class: 'cbi-input-select' }, - others.map((s) => E('option', { value: s.id }, `${s.name} · ${s.endpoint || 'no address'}:${s.port}`)), + others.map((s) => E('option', { value: s.id }, `${s.name} · ${s.endpoint || _('no address')}:${s.port}`)), ) as HTMLSelectElement; const n = p.devices.length; modal( - `Move ${p.name} to another server`, + fmt(_('Move %s to another server'), p.name), [ - field('Server', sel), + field(_('Server'), sel), E( 'p', { class: 'dl-muted' }, n - ? `${n} device${n === 1 ? ' gets a new address and stops' : 's get new addresses and stop'} connecting until ${n === 1 ? 'it imports its' : 'they import their'} configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.` - : 'They have no devices yet: nothing else changes.', + ? plural( + n, + '%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.', + '%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.', + ) + : _('They have no devices yet: nothing else changes.'), ), ], [ cancelButton(), ' ', button( - 'Move', + _('Move'), async () => { - if (await page.patch({ server: sel.value }, `Moved to ${others.find((s) => s.id === sel.value)?.name ?? 'the server'}`)) { + if ( + await page.patch({ server: sel.value }, fmt(_('Moved to %s'), others.find((s) => s.id === sel.value)?.name ?? _('the server'))) + ) { closeModal(); - if (n) notify('Devices are marked “Update config” until they import again.', 'info', 6000); + if (n) notify(_('Devices are marked “Update config” until they import again.'), 'info', 6000); } }, 'positive', @@ -195,10 +204,14 @@ export function moveToServer(page: PersonPage) { export async function remove(page: PersonPage) { const p = page.p; const ok = await confirmDialog( - `Delete ${p.name}?`, - `All ${p.devices.length} devices are disconnected immediately and the personal link stops working.`, - 'Delete', + fmt(_('Delete %s?'), p.name), + plural( + p.devices.length, + '%s device is disconnected immediately and the personal link stops working.', + 'All %s devices are disconnected immediately and the personal link stops working.', + ), + _('Delete'), true, ); - if (ok && (await attempt(() => api.personDelete(p.id), 'Deleted'))) location.href = peopleUrl(p.server); + if (ok && (await attempt(() => api.personDelete(p.id), _('Deleted')))) location.href = peopleUrl(p.server); } diff --git a/web/src/admin/pages/person/header.ts b/web/src/admin/pages/person/header.ts index 8b64ed5..413908a 100644 --- a/web/src/admin/pages/person/header.ts +++ b/web/src/admin/pages/person/header.ts @@ -6,6 +6,7 @@ import { dropdown, type MenuItem } from '../../ui/menu'; import { statePill } from '../../ui/badges'; import { icon } from '../../../shared/icons'; import { ago, bytes, date, initials, isoDay } from '../../../shared/format'; +import { fmt } from '../../../shared/i18n'; import { copyPersonLink } from '../../invite'; import { daysTile, speedTile } from '../../widgets/tiles'; import { editNote, invite, moveToServer, newLink, remove, rename } from './dialogs'; @@ -14,26 +15,26 @@ import type { PersonPage } from './index'; export function headPart(page: PersonPage): HTMLElement { const p = page.p; const st = page.st; - const lastSeen = p.online ? 'online now' : p.last_seen ? `last seen ${ago(p.last_seen, st.now)}` : 'never connected'; - const added = p.created ? `Added ${date(isoDay(new Date(p.created * 1000)))}` : ''; + const lastSeen = p.online ? _('online now') : p.last_seen ? fmt(_('last seen %s'), ago(p.last_seen, st.now)) : _('never connected'); + const added = p.created ? fmt(_('Added %s', 'date'), date(isoDay(new Date(p.created * 1000)))) : ''; // The personal link is not in the status: its actions ask for it while there is one. const portal = p.has_link ?? st.settings.portal_enabled; const menu: (MenuItem | null)[] = [ - { label: 'Rename', icon: icon('edit'), run: () => rename(page) }, - { label: p.note ? 'Edit note' : 'Add note', icon: icon('file'), run: () => editNote(page) }, + { label: _('Rename'), icon: icon('edit'), run: () => rename(page) }, + { label: p.note ? _('Edit note') : _('Add note'), icon: icon('file'), run: () => editNote(page) }, // With one server there is nowhere to move to. - ...(st.servers.length > 1 ? [{ label: 'Move to server…', icon: icon('server'), run: () => moveToServer(page) }] : []), + ...(st.servers.length > 1 ? [{ label: _('Move to server…'), icon: icon('server'), run: () => moveToServer(page) }] : []), ...(portal ? [ null, - { label: 'Invite card', icon: icon('qr'), run: () => invite(page) }, - { label: 'New link', icon: icon('key'), run: () => newLink(page) }, + { label: _('Invite card'), icon: icon('qr'), run: () => invite(page) }, + { label: _('New link'), icon: icon('key'), run: () => newLink(page) }, ] : []), null, // While paused, Resume is the page's own button (as the server's Turn on). - ...(p.paused ? [] : [{ label: 'Pause', icon: icon('pause'), warn: true, run: () => page.patch({ paused: true }, 'Paused') }]), - { label: 'Delete', icon: icon('trash'), danger: true, run: () => remove(page) }, + ...(p.paused ? [] : [{ label: _('Pause'), icon: icon('pause'), warn: true, run: () => page.patch({ paused: true }, _('Paused')) }]), + { label: _('Delete'), icon: icon('trash'), danger: true, run: () => remove(page) }, ]; return E('div', { class: 'dl-person-head' }, [ E('div', { class: 'dl-pagehead' }, [ @@ -41,19 +42,23 @@ export function headPart(page: PersonPage): HTMLElement { E('span', { class: `dl-avatar lg${p.online ? ' online' : ''}` }, initials(p.name)), E('div', { class: 'dl-stack' }, [ E('div', { class: 'dl-title-row' }, [E('h2', { class: 'dl-h1' }, p.name), statePill(p)]), - E('span', { class: 'dl-faint', title: added }, `${p.devices.length} of ${p.device_limit} devices · ${lastSeen}`), + E( + 'span', + { class: 'dl-faint', title: added }, + `${fmt(N_(p.device_limit, '%s of %s device', '%s of %s devices'), p.devices.length, p.device_limit)} · ${lastSeen}`, + ), ]), ]), E('div', { class: 'dl-pcard-actions' }, [ // White, as the server's Turn on. - p.paused ? button([icon('play'), ' Resume'], () => page.patch({ paused: false }, 'Resumed'), 'add') : '', - portal ? iconButton('link', 'Copy link', () => copyPersonLink(p.id), 'neutral', 'dl-icon-only') : '', - iconButton('more', 'More', (ev: MouseEvent) => dropdown(ev.currentTarget as HTMLElement, menu), 'neutral', 'dl-icon-only'), + p.paused ? button([icon('play'), ` ${_('Resume')}`], () => page.patch({ paused: false }, _('Resumed')), 'add') : '', + portal ? iconButton('link', _('Copy link'), () => copyPersonLink(p.id), 'neutral', 'dl-icon-only') : '', + iconButton('more', _('More'), (ev: MouseEvent) => dropdown(ev.currentTarget as HTMLElement, menu), 'neutral', 'dl-icon-only'), ]), ]), // Under the name block, not inside it, so the avatar centres on name + status; indented to the name. p.note - ? E('button', { type: 'button', class: 'dl-pnote', title: 'Edit note', click: () => editNote(page) }, [ + ? E('button', { type: 'button', class: 'dl-pnote', title: _('Edit note'), click: () => editNote(page) }, [ icon('file'), E('span', {}, p.note), ]) @@ -68,6 +73,6 @@ export function trafficPart(page: PersonPage): HTMLElement { const todayUse = page.series[page.series.length - 1]; return E('div', { class: `dl-person-live${p.online ? '' : ' solo'}` }, [ p.online ? speedTile(p.rate ?? [], page.st.now, todayUse ? [todayUse.rx, todayUse.tx] : [0, 0]) : '', - daysTile(page.series, `${bytes(p.month[0] + p.month[1])} this month`), + daysTile(page.series, fmt(_('%s this month'), bytes(p.month[0] + p.month[1]))), ]); } diff --git a/web/src/admin/pages/person/index.ts b/web/src/admin/pages/person/index.ts index b0eb614..89de5dd 100644 --- a/web/src/admin/pages/person/index.ts +++ b/web/src/admin/pages/person/index.ts @@ -64,9 +64,9 @@ export class PersonPage { const p = this.st.people.find((x) => x.id === this.id); if (!p) return E('div', { class: 'dl-empty' }, [ - E('h3', {}, 'Person not found'), - E('p', {}, 'They may have been removed.'), - E('a', { class: 'cbi-button', href: L.url('admin/network/dawnline/server') }, 'Back to Servers'), + E('h3', {}, _('Person not found')), + E('p', {}, _('They may have been removed.')), + E('a', { class: 'cbi-button', href: L.url('admin/network/dawnline/server') }, _('Back to Servers')), ]); this.p = p; for (const k of ['crumbs', 'head', 'devices', 'traffic', 'places', 'activity', 'limits'] as Part[]) this.parts[k] = E('div', {}); @@ -173,10 +173,10 @@ export class PersonPage { /** Server / People / name: the server changes when the person is moved. */ private crumbs(): HTMLElement { const p = this.p; - return E('nav', { class: 'dl-crumbs', 'aria-label': 'Breadcrumb' }, [ - E('a', { href: peopleUrl(p.server) }, this.st.servers.find((x) => x.id === p.server)?.name ?? 'Servers'), + return E('nav', { class: 'dl-crumbs', 'aria-label': _('Breadcrumb') }, [ + E('a', { href: peopleUrl(p.server) }, this.st.servers.find((x) => x.id === p.server)?.name ?? _('Servers')), E('span', {}, '/'), - E('a', { href: peopleUrl(p.server) }, 'People'), + E('a', { href: peopleUrl(p.server) }, _('People')), E('span', {}, '/'), E('span', {}, p.name), ]); diff --git a/web/src/admin/pages/person/limits.ts b/web/src/admin/pages/person/limits.ts index fb9cdbf..a0e088c 100644 --- a/web/src/admin/pages/person/limits.ts +++ b/web/src/admin/pages/person/limits.ts @@ -11,18 +11,21 @@ import { liveField } from '../../ui/layout'; import { quotaHelp } from '../../netcheck'; import { attachTip } from '../../ui/tooltip'; import { icon } from '../../../shared/icons'; -import { ACCESS_LABEL, bytes, date, daysLeft, endsSoon, shiftDay } from '../../../shared/format'; +import { accessLabel, bytes, date, daysLeft, endsSoon, shiftDay } from '../../../shared/format'; +import { fmt, num, plural } from '../../../shared/i18n'; import { resetUsageDialog } from '../../logs'; import { homeAccess } from '../../access'; import { endSettings } from './dialogs'; import { circleTile, devTile, dnsPicker, netsPicker, servicesPicker } from './pickers'; import type { PersonPage } from './index'; -const ACCESS_TEXT: Record = { - internet: 'Browse the internet through your router. No access to devices at home, and home cannot reach theirs.', - lan: 'Reach devices at home, and home reaches theirs. Internet stays on their own connection.', - both: 'Home devices and the internet, all through your router. Home reaches their devices too.', -}; +function accessText(a: Person['access']): string { + return { + internet: _('Browse the internet through your router. No access to devices at home, and home cannot reach theirs.'), + lan: _('Reach devices at home, and home reaches theirs. Internet stays on their own connection.'), + both: _('Home devices and the internet, all through your router. Home reaches their devices too.'), + }[a]; +} const TIME = /^([01]\d|2[0-3]):[0-5]\d$/; @@ -39,19 +42,19 @@ function endTile(page: PersonPage): HTMLElement { }) as HTMLInputElement; dateInput.addEventListener( 'change', - () => dateInput.value && page.patch({ expires: dateInput.value }, `Access until ${date(dateInput.value)}`), + () => dateInput.value && page.patch({ expires: dateInput.value }, fmt(_('Access until %s'), date(dateInput.value))), ); // Extend from the current end, or from today when there is none or it has passed. const extend = (step: 'week' | 'month' | 'year', n: number) => { const next = shiftDay(p.expires && (left ?? -1) >= 0 ? p.expires : '', step, n, today); - void page.patch({ expires: next }, `Access until ${date(next)}`); + void page.patch({ expires: next }, fmt(_('Access until %s'), date(next))); }; const ext = ( [ - ['week', 1, '+1 week'], - ['month', 1, '+1 month'], - ['month', 3, '+3 months'], - ['year', 1, '+1 year'], + ['week', 1, _('+1 week')], + ['month', 1, _('+1 month')], + ['month', 3, _('+3 months')], + ['year', 1, _('+1 year')], ] as const ).map(([step, n, label]) => E('button', { type: 'button', class: 'dl-chipbtn', click: () => extend(step, n) }, label)); // The native date input stays hidden behind the chip and only opens its picker. It takes the @@ -71,34 +74,40 @@ function endTile(page: PersonPage): HTMLElement { } }, }, - [icon('calendar'), p.expires ? date(p.expires) : 'Date'], + [icon('calendar'), p.expires ? date(p.expires) : _('Date')], ), dateInput, ]); - const action = { pause: 'pause access', notify: 'keep access', remove: 'remove their devices' }[p.expire_action]; + const action = { pause: _('pause access'), notify: _('keep access'), remove: _('remove their devices') }[p.expire_action]; return E('div', { class: 'dl-tile2' }, [ E('div', { class: 'dl-tile2-label' }, [ - E('span', {}, 'Access ends'), + E('span', {}, _('Access ends')), p.expires ? E( 'span', { class: left != null && left < 0 ? 'dl-bad' : endsSoon(p, left) ? 'dl-warn' : 'dl-ok' }, - left != null && left < 0 ? 'ended' : `${left} day${left === 1 ? '' : 's'} left`, + left != null && left < 0 ? _('ended') : plural(left ?? 0, '%s day left', '%s days left'), ) - : E('span', { class: 'dl-faint' }, 'no end date'), + : E('span', { class: 'dl-faint' }, _('no end date')), ]), E('div', { class: 'dl-chips-row' }, [ ...ext, pick, p.expires - ? E('button', { type: 'button', class: 'dl-chipbtn', click: () => page.patch({ expires: '' }, 'No end date') }, 'No end') + ? E('button', { type: 'button', class: 'dl-chipbtn', click: () => page.patch({ expires: '' }, _('No end date')) }, _('No end')) : '', ]), E('div', { class: 'dl-tile2-foot' }, [ E( 'span', { class: 'dl-muted' }, - `When it ends: ${action}${p.expire_warn ? `, warn ${p.expire_warn} day${p.expire_warn === 1 ? '' : 's'} before` : ''}`, + p.expire_warn + ? fmt( + N_(p.expire_warn, 'When it ends: %s, warn %s day before', 'When it ends: %s, warn %s days before'), + action, + num(p.expire_warn), + ) + : fmt(_('When it ends: %s'), action), ), E( 'a', @@ -109,7 +118,7 @@ function endTile(page: PersonPage): HTMLElement { endSettings(page); }, }, - 'Change', + _('Change'), ), ]), ]); @@ -121,26 +130,26 @@ function dataTile(page: PersonPage): HTMLElement { const pct = p.quota_limit ? Math.min(100, (p.quota_used / p.quota_limit) * 100) : 0; const bar = E('div', { class: `dl-meter${pct >= 100 ? ' bad' : pct >= 90 ? ' warn' : ''}` }, [ E('i'), - p.quota_limit ? E('span', { class: 'mark', title: 'Alert at 90%' }) : '', + p.quota_limit ? E('span', { class: 'mark', title: _('Alert at 90%') }) : '', ]); (bar.firstChild as HTMLElement).style.width = `${pct}%`; if (p.quota_limit) attachTip(bar, () => [ - E('div', { class: 'dl-tip-title' }, `${pct.toFixed(1)}% used`), + E('div', { class: 'dl-tip-title' }, fmt(_('%s%% used'), num(pct, 1))), E( 'div', { class: 'dl-muted' }, - `${bytes(p.quota_used)} of ${bytes(p.quota_limit)} · ${bytes(Math.max(0, p.quota_limit - p.quota_used))} left`, + `${fmt(_('%s of %s'), bytes(p.quota_used), bytes(p.quota_limit))} · ${fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - p.quota_used)))}`, ), - E('div', { class: 'dl-faint' }, 'Alert at 90%'), + E('div', { class: 'dl-faint' }, _('Alert at 90%')), ]); const period = seg( [ - ['month', 'Monthly'], - ['total', 'Total'], + ['month', _('Monthly')], + ['total', _('Total')], ], p.quota_period, - { label: 'Data limit period', cls: 'sm', optimistic: false, onChange: (v) => page.patch({ quota_period: v }) }, + { label: _('Data limit period'), cls: 'sm', optimistic: false, onChange: (v) => page.patch({ quota_period: v }) }, ); const presets = [10, 50, 100].map((gb) => E( @@ -148,16 +157,16 @@ function dataTile(page: PersonPage): HTMLElement { { type: 'button', class: `dl-chipbtn${p.quota_gb === gb ? ' on' : ''}`, - click: () => page.patch({ quota_gb: String(gb) }, `Data limit ${gb} GB`), + click: () => page.patch({ quota_gb: String(gb) }, fmt(_('Data limit %s GB'), num(gb))), }, - `${gb} GB`, + `${num(gb)} ${_('GB')}`, ), ); presets.push( E( 'button', - { type: 'button', class: `dl-chipbtn${!p.quota_gb ? ' on' : ''}`, click: () => page.patch({ quota_gb: '' }, 'No data limit') }, - 'Unlimited', + { type: 'button', class: `dl-chipbtn${!p.quota_gb ? ' on' : ''}`, click: () => page.patch({ quota_gb: '' }, _('No data limit')) }, + _('Unlimited'), ), ); presets.push( @@ -174,15 +183,15 @@ function dataTile(page: PersonPage): HTMLElement { step: 'any', value: p.quota_gb ? String(p.quota_gb) : '', }) as HTMLInputElement; - const row = liveField('Data limit (GB)', inp, () => quotaHelp(inp.value, p.quota_period === 'month')); + const row = liveField(_('Data limit (GB)'), inp, () => quotaHelp(inp.value, p.quota_period === 'month')); modal( - 'Data limit', + _('Data limit'), [row], [ cancelButton(), ' ', button( - 'Save', + _('Save'), async () => { const h = row.help(); if (h.bad) { @@ -190,7 +199,10 @@ function dataTile(page: PersonPage): HTMLElement { return; } const v = inp.value.trim(); - if (await page.patch({ quota_gb: v }, v && Number(v) > 0 ? `Data limit ${v} GB` : 'No data limit')) closeModal(); + if ( + await page.patch({ quota_gb: v }, v && Number(v) > 0 ? fmt(_('Data limit %s GB'), num(Number(v))) : _('No data limit')) + ) + closeModal(); }, 'positive', ), @@ -199,38 +211,44 @@ function dataTile(page: PersonPage): HTMLElement { setTimeout(() => inp.select(), 50); }, }, - 'Custom', + _('Custom'), ), ); return E('div', { class: 'dl-tile2' }, [ - E('div', { class: 'dl-tile2-label' }, [E('span', {}, 'Data'), period]), + E('div', { class: 'dl-tile2-label' }, [E('span', {}, _('Data')), period]), E('div', { class: 'dl-tile2-row' }, [ E('span', { class: 'dl-tile2-value' }, [ bytes(used), - p.quota_limit ? E('span', { class: 'dl-faint' }, ` of ${bytes(p.quota_limit)}`) : E('span', { class: 'dl-faint' }, ' · no limit'), + p.quota_limit + ? E('span', { class: 'dl-faint' }, ` ${fmt(_('of %s'), bytes(p.quota_limit))}`) + : E('span', { class: 'dl-faint' }, ` · ${_('no limit')}`), ]), - p.quota_period === 'month' ? E('span', { class: 'dl-sub' }, 'resets on the 1st') : '', + p.quota_period === 'month' ? E('span', { class: 'dl-sub' }, _('resets on the 1st')) : '', ]), p.quota_limit ? bar : '', E('div', { class: 'dl-chips-row' }, presets), p.quota_gb && p.quota_period === 'month' ? E('div', { class: 'dl-tile2-foot' }, [ - E('span', { class: 'dl-muted' }, p.bonus_gb ? `Includes +${p.bonus_gb} GB extra this month` : 'Need a little more this month?'), + E( + 'span', + { class: 'dl-muted' }, + p.bonus_gb ? fmt(_('Includes +%s GB extra this month'), num(p.bonus_gb)) : _('Need a little more this month?'), + ), E( 'a', { href: '#', click: (ev: Event) => { ev.preventDefault(); - void page.patch({ bonus_gb: String((p.bonus_gb || 0) + 10) }, '+10 GB this month'); + void page.patch({ bonus_gb: String((p.bonus_gb || 0) + 10) }, _('+10 GB this month')); }, }, - '+10 GB this month', + _('+10 GB this month'), ), ]) : '', E('div', { class: 'dl-tile2-foot' }, [ - E('span', { class: 'dl-muted' }, `${bytes(p.total[0] + p.total[1])} in total`), + E('span', { class: 'dl-muted' }, fmt(_('%s in total'), bytes(p.total[0] + p.total[1]))), E( 'button', { @@ -238,7 +256,7 @@ function dataTile(page: PersonPage): HTMLElement { class: 'dl-linkbtn danger', click: () => resetUsageDialog('person', p.id, p.name, () => setTimeout(() => page.refresh(), 300)), }, - 'Reset usage', + _('Reset usage'), ), ]), ]); @@ -253,15 +271,15 @@ function hoursTile(page: PersonPage): HTMLElement { const p = page.p; const hoursOn = !!p.hours; const [h1, h2] = (p.hours || '07:00-23:00').split('-'); - const from = E('input', { type: 'time', class: 'cbi-input-text', value: h1, 'aria-label': 'From' }) as HTMLInputElement; - const to = E('input', { type: 'time', class: 'cbi-input-text', value: h2, 'aria-label': 'To' }) as HTMLInputElement; - const times = E('div', { class: 'dl-tile2-row' }, [from, E('span', { class: 'dl-faint' }, 'to'), to]); + const from = E('input', { type: 'time', class: 'cbi-input-text', value: h1, 'aria-label': _('From') }) as HTMLInputElement; + const to = E('input', { type: 'time', class: 'cbi-input-text', value: h2, 'aria-label': _('To') }) as HTMLInputElement; + const times = E('div', { class: 'dl-tile2-row' }, [from, E('span', { class: 'dl-faint' }, _('to', 'time range')), to]); const commit = () => { const v = `${from.value}-${to.value}`; if (v === p.hours) return; - if (!TIME.test(from.value) || !TIME.test(to.value)) return notify('Enter both times, like 07:00 and 23:00.', 'warning'); - if (from.value === to.value) return notify('The start and the end must differ.', 'warning'); - void page.patch({ hours: v }, `Allowed ${from.value}–${to.value}`); + if (!TIME.test(from.value) || !TIME.test(to.value)) return notify(_('Enter both times, like 07:00 and 23:00.'), 'warning'); + if (from.value === to.value) return notify(_('The start and the end must differ.'), 'warning'); + void page.patch({ hours: v }, fmt(_('Allowed %s–%s'), from.value, to.value)); }; times.addEventListener('focusout', (ev: FocusEvent) => { if (!times.contains(ev.relatedTarget as Node | null)) commit(); @@ -280,23 +298,23 @@ function hoursTile(page: PersonPage): HTMLElement { role: 'switch', 'aria-checked': hoursOn ? 'true' : 'false', class: `dl-switch${hoursOn ? ' on' : ''}`, - 'aria-label': 'Limit hours', + 'aria-label': _('Limit hours'), // Turning on shows the times to set; nothing is enforced until they are saved. click: () => { - if (hoursOn) return page.patch({ hours: '' }, 'Any time'); + if (hoursOn) return page.patch({ hours: '' }, _('Any time')); sw.classList.add('on'); sw.setAttribute('aria-checked', 'true'); - label.textContent = 'Set the hours, then press Enter'; + label.textContent = _('Set the hours, then press Enter'); tile.appendChild(times); from.focus(); }, }, E('i'), ); - const label = E('span', {}, hoursOn ? `${h1} – ${h2} (router time)` : 'Any time'); + const label = E('span', {}, hoursOn ? fmt(_('%s – %s (router time)'), h1, h2) : _('Any time')); const tile = E('div', { class: 'dl-tile2' }, [ E('div', { class: 'dl-tile2-row' }, [ - E('div', { class: 'dl-stack' }, [E('span', { class: 'dl-tile2-label' }, 'Allowed hours'), label]), + E('div', { class: 'dl-stack' }, [E('span', { class: 'dl-tile2-label' }, _('Allowed hours')), label]), sw, ]), hoursOn ? times : '', @@ -309,19 +327,27 @@ export function limitsPart(page: PersonPage): HTMLElement { const access = seg( (['internet', 'lan', 'both'] as const).map((a) => [ a, - [icon(a === 'internet' ? 'globe' : a === 'lan' ? 'home' : 'shield'), a === 'internet' ? 'Internet' : a === 'lan' ? 'Home' : 'Both'], + [ + icon(a === 'internet' ? 'globe' : a === 'lan' ? 'home' : 'shield'), + a === 'internet' ? _('Internet') : a === 'lan' ? _('Home') : _('Both'), + ], ]), p.access, - { label: 'Access', cls: 'wide', optimistic: false, onChange: (a) => page.patch({ access: a }, `Access: ${ACCESS_LABEL[a]}`) }, + { + label: _('Access'), + cls: 'wide', + optimistic: false, + onChange: (a) => page.patch({ access: a }, fmt(_('Access: %s'), accessLabel(a))), + }, ); // Heading above the card, like "Devices", so both columns line up (as on the portal). - return E('section', { class: 'dl-devsec', 'aria-label': 'Access and limits' }, [ - E('div', { class: 'dl-panel-head' }, [E('h3', {}, 'Access & limits')]), + return E('section', { class: 'dl-devsec', 'aria-label': _('Access and limits') }, [ + E('div', { class: 'dl-panel-head' }, [E('h3', {}, _('Access & limits'))]), E('div', { class: 'dl-panel' }, [ E('div', { class: 'dl-stack gap8' }, [ - E('span', { class: 'dl-tile2-label' }, 'Can reach'), + E('span', { class: 'dl-tile2-label' }, _('Can reach')), access, - E('span', { class: 'dl-sub' }, ACCESS_TEXT[p.access]), + E('span', { class: 'dl-sub' }, accessText(p.access)), p.access === 'lan' && page.st.services.length ? servicesPicker(page) : '', homeAccess(p) ? netsPicker(page) : '', p.access === 'lan' ? dnsPicker(page) : '', diff --git a/web/src/admin/pages/person/pickers.ts b/web/src/admin/pages/person/pickers.ts index 87a4373..6fc1764 100644 --- a/web/src/admin/pages/person/pickers.ts +++ b/web/src/admin/pages/person/pickers.ts @@ -8,6 +8,7 @@ import { dropdown } from '../../ui/menu'; import { attachTip } from '../../ui/tooltip'; import { icon } from '../../../shared/icons'; import { ago, initials } from '../../../shared/format'; +import { fill, fmt, plural } from '../../../shared/i18n'; import { circleDialog, circleDot, homeAccess } from '../../access'; import type { PersonPage } from './index'; @@ -19,8 +20,8 @@ export function dnsPicker(page: PersonPage): HTMLElement { const p = page.p; const choice = seg( [ - ['device', 'Device’s own DNS'], - ['home', 'Home names'], + ['device', _('Device’s own DNS')], + ['home', _('Home names')], ], p.dns_mode, { @@ -30,7 +31,9 @@ export function dnsPicker(page: PersonPage): HTMLElement { onChange: (v) => page.patch( { dns_mode: v }, - v === 'home' ? 'Home names on — devices need their configuration again' : 'Device DNS — devices need their configuration again', + v === 'home' + ? _('Home names on - devices need their configuration again') + : _('Device DNS - devices need their configuration again'), ), }, ); @@ -41,15 +44,19 @@ export function dnsPicker(page: PersonPage): HTMLElement { 'span', { class: 'dl-sub' }, p.dns_mode === 'home' - ? [ - 'Names like ', - E('span', { class: 'dl-mono' }, `nas.${page.st.settings.domain}`), - ' work. Internet names are resolved at home, so they depend on the tunnel', - fb - ? [' (', E('span', { class: 'dl-mono' }, fb), ' takes over when it is down).'] - : ' — with no fallback set, they stop when it is down.', - ] - : 'Internet keeps working exactly as without the VPN. Reach home devices by IP address.', + ? fb + ? fill( + _('Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down).'), + E('span', { class: 'dl-mono' }, `nas.${page.st.settings.domain}`), + E('span', { class: 'dl-mono' }, fb), + ) + : fill( + _( + 'Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down.', + ), + E('span', { class: 'dl-mono' }, `nas.${page.st.settings.domain}`), + ) + : _('Internet keeps working exactly as without the VPN. Reach home devices by IP address.'), ), ]); } @@ -72,11 +79,11 @@ export function netsPicker(page: PersonPage): HTMLElement | '' { () => { const next = new Set(picked); if (!next.delete(h.dev)) next.add(h.dev); - if (!next.size) return notify('Keep at least one network, or choose Internet only.', 'warning', 5000); + if (!next.size) return notify(_('Keep at least one network, or choose Internet only.'), 'warning', 5000); const list = next.size === all.length ? [] : [...next]; void page.patch( { home_nets: list }, - list.length ? `${p.name} reaches ${list.join(', ')}` : `${p.name} reaches every home network`, + list.length ? fmt(_('%s reaches %s'), p.name, list.join(', ')) : fmt(_('%s reaches every home network'), p.name), ); }, { title: h.nets.join(', ') }, @@ -87,8 +94,8 @@ export function netsPicker(page: PersonPage): HTMLElement | '' { 'span', { class: 'dl-sub' }, p.home_nets?.length - ? `Home networks ${p.name} reaches. Networks added to the server later stay out.` - : `Home networks ${p.name} reaches: all of them. Untick one to keep ${p.name} out of it.`, + ? fmt(_('Home networks %s reaches. Networks added to the server later stay out.'), p.name) + : fmt(_('Home networks %s reaches: all of them. Untick one to keep %s out of it.'), p.name, p.name), ), ]); } @@ -108,7 +115,7 @@ export function servicesPicker(page: PersonPage): HTMLElement { // A copy: the chips show the saved choice until the router has it (a failed save changes nothing). const next = new Set(chosen); if (!next.delete(sv.id)) next.add(sv.id); - void page.patch({ services: [...next] }, next.size ? 'Home services updated' : 'Whole home network'); + void page.patch({ services: [...next] }, next.size ? _('Home services updated') : _('Whole home network')); }, { title: `${sv.address}${sv.ports.length ? ` · ${sv.ports.join(', ')}` : ''}` }, ), @@ -117,7 +124,7 @@ export function servicesPicker(page: PersonPage): HTMLElement { E( 'span', { class: 'dl-sub' }, - chosen.size ? 'Only the selected services at home.' : 'Whole home network. Pick services to narrow it down.', + chosen.size ? _('Only the selected services at home.') : _('Whole home network. Pick services to narrow it down.'), ), ]); } @@ -141,20 +148,22 @@ export function circleTile(page: PersonPage): HTMLElement | '' { ...circles.map((c) => ({ label: c.name, icon: circleDot(c), - run: () => c.id !== p.circle && page.patch({ circle: c.id }, `${p.name} is in ${c.name}`), + run: () => c.id !== p.circle && page.patch({ circle: c.id }, fmt(_('%s is in %s'), p.name, c.name)), })), - p.circle ? { label: 'No circle', icon: icon('x'), run: () => page.patch({ circle: '' }, `${p.name} is in no circle`) } : null, - { label: 'New circle', icon: icon('plus'), run: () => circleDialog(st, p.server, null, () => page.refresh()) }, + p.circle + ? { label: _('No circle'), icon: icon('x'), run: () => page.patch({ circle: '' }, fmt(_('%s is in no circle'), p.name)) } + : null, + { label: _('New circle'), icon: icon('plus'), run: () => circleDialog(st, p.server, null, () => page.refresh()) }, ]), }, - 'Change', + _('Change'), ); // As the other tiles: the name is the value; who is in it as avatars. const people = ci ? st.people.filter((x) => x.circle === ci.id && homeAccess(x)) : [p]; return E('div', { class: 'dl-tile2' }, [ - E('div', { class: 'dl-tile2-label' }, [E('span', {}, 'Devices see each other'), change]), + E('div', { class: 'dl-tile2-label' }, [E('span', {}, _('Devices see each other')), change]), E('div', { class: 'dl-tile2-row' }, [ - E('span', { class: 'dl-tile2-value' }, ci ? ci.name : 'No circle'), + E('span', { class: 'dl-tile2-value' }, ci ? ci.name : _('No circle')), E( 'span', { class: 'dl-avstack', title: people.map((x) => x.name).join(', ') }, @@ -164,7 +173,11 @@ export function circleTile(page: PersonPage): HTMLElement | '' { E( 'span', { class: 'dl-sub' }, - !ci ? `Only ${p.name}'s own devices` : mates.length ? [p.name, ...mates].join(', ') : `Nobody else in ${ci.name} yet`, + !ci + ? fmt(_("Only %s's own devices"), p.name) + : mates.length + ? [p.name, ...mates].join(', ') + : fmt(_('Nobody else in %s yet'), ci.name), ), ]); } @@ -180,11 +193,17 @@ export function devTile(page: PersonPage): HTMLElement { const over = i >= p.device_limit; const slot = E('i', { class: over ? 'over' : d ? 'used' : '' }); attachTip(slot, () => [ - E('div', { class: 'dl-tip-title' }, d ? `${d.name}${over ? ' · over the limit' : ''}` : 'Free slot'), + E('div', { class: 'dl-tip-title' }, d ? `${d.name}${over ? ` · ${_('over the limit')}` : ''}` : _('Free slot')), E( 'div', { class: 'dl-muted' }, - d ? (d.online ? 'Connected' : d.handshake ? `Last seen ${ago(d.handshake, now)}` : 'Not set up yet') : 'They can add a device here', + d + ? d.online + ? _('Connected') + : d.handshake + ? fmt(_('Last seen %s'), ago(d.handshake, now)) + : _('Not set up yet') + : _('They can add a device here'), ), ]); slots.appendChild(slot); @@ -194,7 +213,7 @@ export function devTile(page: PersonPage): HTMLElement { 'button', { type: 'button', - 'aria-label': 'Allow fewer devices', + 'aria-label': _('Allow fewer devices'), disabled: p.device_limit <= floor ? 'disabled' : null, click: () => page.patch({ device_limit: String(p.device_limit - 1) }), }, @@ -202,11 +221,11 @@ export function devTile(page: PersonPage): HTMLElement { ); if (p.device_limit <= floor && p.devices.length > 1) attachTip(minus, () => [ - E('div', { class: 'dl-tip-title' }, `${p.devices.length} devices in use`), - E('div', { class: 'dl-muted' }, 'Remove a device first to lower the limit'), + E('div', { class: 'dl-tip-title' }, plural(p.devices.length, '%s device in use', '%s devices in use')), + E('div', { class: 'dl-muted' }, _('Remove a device first to lower the limit')), ]); return E('div', { class: 'dl-tile2' }, [ - E('div', { class: 'dl-tile2-label' }, 'Devices'), + E('div', { class: 'dl-tile2-label' }, _('Devices')), E('div', { class: 'dl-tile2-row' }, [ E('span', { class: 'dl-tile2-value' }, [String(p.devices.length), E('span', { class: 'dl-faint' }, ` / ${p.device_limit}`)]), E('div', { class: 'dl-stepper' }, [ @@ -215,7 +234,7 @@ export function devTile(page: PersonPage): HTMLElement { 'button', { type: 'button', - 'aria-label': 'Allow more devices', + 'aria-label': _('Allow more devices'), disabled: p.device_limit >= 32 ? 'disabled' : null, click: () => page.patch({ device_limit: String(p.device_limit + 1) }), }, diff --git a/web/src/admin/pages/server.ts b/web/src/admin/pages/server.ts index 2740d03..02b3ddb 100644 --- a/web/src/admin/pages/server.ts +++ b/web/src/admin/pages/server.ts @@ -16,6 +16,7 @@ import { card, firstBad, group, liveRow, needRow, row } from '../ui/layout'; import { dnsHelp, endpointProbe, hostHelp, nameHelp, portalPortHelp, portHelp, rangeHelp, rangeOf, subnetOf } from '../netcheck'; import { icon } from '../../shared/icons'; import { ago, duration } from '../../shared/format'; +import { fmt, locale, plural } from '../../shared/i18n'; import { accessCards } from '../interfaces'; import { checkAccess, whoReaches } from '../access'; import { defaultMethod, methodPicker } from '../disguise'; @@ -27,13 +28,10 @@ import { PeoplePage } from './people'; /** `awg` is the server's core section (named after its core; the key stays for old links). */ type Section = 'overview' | 'people' | 'connection' | 'access' | 'awg'; -const SECTIONS: [Section, string][] = [ - ['overview', 'Overview'], - ['people', 'People'], - ['connection', 'Connection'], - ['access', 'Access'], - ['awg', ''], -]; +const SECTIONS: Section[] = ['overview', 'people', 'connection', 'access', 'awg']; +/** A section's tab; the core's own is named after the core. */ +const sectionLabel = (k: Exclude): string => + ({ overview: _('Overview'), people: _('People'), connection: _('Connection'), access: _('Access') })[k]; /** Section names from before the regrouping, for old links. */ const OLD_SECTIONS: Record = { general: 'connection', @@ -82,7 +80,7 @@ export class ServerPage { const q = new URLSearchParams(location.search); const raw = q.get('section') ?? ''; const want = (OLD_SECTIONS[raw] ?? raw) as Section; - if (SECTIONS.some(([k]) => k === want)) this.section = want; + if (SECTIONS.includes(want)) this.section = want; this.srvId = (st.servers.find((x) => x.id === q.get('server')) ?? st.servers[0]).id; dom.content(this.root, [this.tabsEl, this.headEl, this.secEl, this.bodyEl]); this.paint(); @@ -146,7 +144,7 @@ export class ServerPage { const srv = this.current(); dom.content( this.tabsEl, - E('div', { class: 'dl-srvtabs', role: 'tablist', 'aria-label': 'Servers' }, [ + E('div', { class: 'dl-srvtabs', role: 'tablist', 'aria-label': _('Servers') }, [ ...this.st.servers.map((x) => E( 'button', @@ -164,7 +162,7 @@ export class ServerPage { [E('i', { class: `dot ${!x.enabled ? 'warn' : x.up ? 'ok' : 'bad'}` }), E('b', {}, x.name)], ), ), - E('button', { type: 'button', class: 'dl-srvtab add', click: () => this.addServer() }, [icon('plus'), 'Add server']), + E('button', { type: 'button', class: 'dl-srvtab add', click: () => this.addServer() }, [icon('plus'), _('Add server')]), ]), ); } @@ -175,8 +173,8 @@ export class ServerPage { this.secEl, E( 'div', - { class: 'dl-seg dl-srvsections', role: 'tablist', 'aria-label': 'Server' }, - SECTIONS.map(([k, t]) => + { class: 'dl-seg dl-srvsections', role: 'tablist', 'aria-label': _('Server') }, + SECTIONS.map((k) => E( 'button', { @@ -187,7 +185,7 @@ export class ServerPage { 'aria-selected': k === this.section ? 'true' : 'false', click: () => this.showSection(k), }, - k === 'awg' ? core.label : t, + k === 'awg' ? core.label : sectionLabel(k), ), ), ), @@ -241,7 +239,7 @@ export class ServerPage { void pp.update(); return pp.el; } - const holder = E('div', {}, E('p', { class: 'dl-muted' }, 'Loading people…')); + const holder = E('div', {}, E('p', { class: 'dl-muted' }, _('Loading people…'))); const page = (this.pp[srv.id] ??= new PeoplePage()); page .embed(st, srv.id) @@ -252,7 +250,7 @@ export class ServerPage { .catch((e) => { // Try again on the next visit instead of keeping a broken page. delete this.pp[srv.id]; - dom.content(holder, E('p', { class: 'dl-muted' }, `Couldn't show people: ${errorText(e)}`)); + dom.content(holder, E('p', { class: 'dl-muted' }, fmt(_("Couldn't show people: %s"), errorText(e)))); }); return holder; }, @@ -273,8 +271,8 @@ export class ServerPage { const actions = E('div', { class: 'dl-actions' }, [ !srv.enabled ? button( - [icon('play'), ' Turn on'], - () => this.save(srv, { enabled: '1' }, 'Server turned on'), + [icon('play'), ` ${_('Turn on')}`], + () => this.save(srv, { enabled: '1' }, _('Server turned on')), // White, as the other main actions (Add person). 'add', ) @@ -288,7 +286,7 @@ export class ServerPage { 'span', // Off on purpose is a warning (yellow), not a failure (red). { class: `dl-pill ${!srv.enabled ? 'warn' : srv.up ? 'ok' : 'bad'}` }, - !srv.enabled ? 'Turned off' : srv.up ? 'Running' : srv.blocked ? 'Can’t start' : 'Not running', + !srv.enabled ? _('Turned off') : srv.up ? _('Running') : srv.blocked ? _('Can’t start') : _('Not running'), ), E('span', { class: 'dl-spacer' }), actions, @@ -296,78 +294,82 @@ export class ServerPage { E('div', { class: 'dl-addrbar' }, [ E( 'button', - { type: 'button', class: 'dl-addrbar-seg main', title: 'Copy address', click: () => copyText(addr, 'Address copied') }, + { type: 'button', class: 'dl-addrbar-seg main', title: _('Copy address'), click: () => copyText(addr, _('Address copied')) }, [icon('globe'), E('span', { class: 'dl-mono' }, addr), icon('copy')], ), part(coreOf(srv).id === 'awg' ? 'amneziawg' : 'tunnel', [E('span', { class: 'dl-mono' }, `${coreOf(srv).label} :${srv.port}`)]), - srv.up ? part('clock', [`up ${duration(srv.uptime)}`]) : '', + srv.up ? part('clock', [fmt(_('up %s'), duration(srv.uptime))]) : '', ]), // The reason the tunnel can't run at all ("can't use the network interface awg0: it exists and isn't Dawnline's"). - srv.blocked ? E('div', { class: 'dl-note warn' }, [icon('alert'), E('span', {}, `${srv.name} ${srv.blocked}.`)]) : '', + srv.blocked ? E('div', { class: 'dl-note warn' }, [icon('alert'), E('span', {}, srv.blocked)]) : '', ]); } - async save(srv: Server, values: Record, ok = 'Saved') { + async save(srv: Server, values: Record, ok = _('Saved')) { if (await attempt(() => api.serverUpdate(srv.id, values), ok)) await this.refresh(); } /** The name, where devices find the router, DNS; then the danger zone. */ connection(srv: Server): HTMLElement { - const name = input(srv.name, { placeholder: 'Home' }); + const name = input(srv.name, { placeholder: _('Home') }); const endpoint = input(srv.endpoint, { placeholder: 'vpn.example.com', class: 'cbi-input-text dl-mono' }); - const dns = input(srv.dns.join(', '), { placeholder: 'This router (recommended)', class: 'cbi-input-text dl-mono' }); + const dns = input(srv.dns.join(', '), { placeholder: _('This router (recommended)'), class: 'cbi-input-text dl-mono' }); const people = this.st.people.filter((p) => p.server === srv.id).length; const toggle = button( - [icon(srv.enabled ? 'pause' : 'play'), srv.enabled ? ' Turn off' : ' Turn on'], + [icon(srv.enabled ? 'pause' : 'play'), ` ${srv.enabled ? _('Turn off') : _('Turn on')}`], async () => { if ( srv.enabled && !(await confirmDialog( - `Turn off ${srv.name}?`, - `The tunnel stops and ${people} ${people === 1 ? 'person is' : 'people are'} disconnected until you turn it back on. Nothing is deleted.`, - 'Turn off', + fmt(_('Turn off %s?'), srv.name), + plural( + people, + 'The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted.', + 'The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted.', + ), + _('Turn off'), true, )) ) return; - await this.save(srv, { enabled: srv.enabled ? '0' : '1' }, srv.enabled ? 'Server turned off' : 'Server turned on'); + await this.save(srv, { enabled: srv.enabled ? '0' : '1' }, srv.enabled ? _('Server turned off') : _('Server turned on')); }, srv.enabled ? 'negative' : 'positive', ); const portalHost = this.st.settings.portal_host; - const nameRow = liveRow('Name', name, () => nameHelp(name.value, [], 'Shown to people in their portal and apps.')); + const nameRow = liveRow(_('Name'), name, () => nameHelp(name.value, [], _('Shown to people in their portal and apps.'))); // Where the address points is checked on the router as it is typed (debounced). const ep = endpointProbe( () => ({ host: endpoint.value, port: srv.port, id: srv.id }), (h, id, port) => api.endpointProbe(h, id, port), () => epRow.refresh(), - { empty: portalHost ? `Empty = the portal’s address (${portalHost}).` : 'Empty = the portal’s address.' }, + { empty: portalHost ? fmt(_('Empty = the portal’s address (%s).'), portalHost) : _('Empty = the portal’s address.') }, ); - const epRow = liveRow('Public address', endpoint, ep.help); + const epRow = liveRow(_('Public address'), endpoint, ep.help); endpoint.addEventListener('input', ep.schedule); ep.schedule(); const reached = srv.reached - ? `Reached from the internet ${ago(srv.reached, this.st.now)}.` - : 'Never reached from the internet yet — test with a phone on mobile data.'; - const dnsRow = liveRow('DNS for devices', dns, () => dnsHelp(dns.value, srv.address)); + ? fmt(_('Reached from the internet %s.'), ago(srv.reached, this.st.now)) + : _('Never reached from the internet yet - test with a phone on mobile data.'); + const dnsRow = liveRow(_('DNS for devices'), dns, () => dnsHelp(dns.value, srv.address)); return E('div', { class: 'dl-stack gap16' }, [ card( - 'Connection', + _('Connection'), [ - E('p', { class: 'dl-muted' }, 'The name people see, where devices find the router, and DNS. The port is on AmneziaWG.'), - group('router', 'Server', 'What people see', [nameRow]), + E('p', { class: 'dl-muted' }, _('The name people see, where devices find the router, and DNS. The port is on AmneziaWG.')), + group('router', _('Server'), _('What people see'), [nameRow]), group( 'globe', - 'Devices connect to', - 'A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)', + _('Devices connect to'), + _('A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)'), [epRow, E('div', { class: `dl-sub ${srv.reached ? 'ok' : 'warn'}` }, reached)], ), - group('file', 'For every device', 'Changing it marks devices “Update config” until they import again', [dnsRow]), + group('file', _('For every device'), _('Changing it marks devices “Update config” until they import again'), [dnsRow]), ], [ E('span'), button( - 'Save', + _('Save'), () => { const bad = firstBad([nameRow, epRow, dnsRow]); if (bad) { @@ -381,49 +383,58 @@ export class ServerPage { ], ), card( - 'Danger zone', + _('Danger zone'), [ E('div', { class: 'dl-setrow' }, [ E('div', { class: 'dl-stack' }, [ - E('span', { class: 'dl-setrow-label' }, srv.enabled ? 'Turn off this server' : 'This server is off'), + E('span', { class: 'dl-setrow-label' }, srv.enabled ? _('Turn off this server') : _('This server is off')), E( 'span', { class: 'dl-sub' }, srv.enabled - ? 'Stops the tunnel and disconnects everyone on it. Settings and people are kept.' - : 'Nobody can connect. Turn it on to bring the tunnel back.', + ? _('Stops the tunnel and disconnects everyone on it. Settings and people are kept.') + : _('Nobody can connect. Turn it on to bring the tunnel back.'), ), ]), E('div', { class: 'dl-setrow-ctl' }, toggle), ]), E('div', { class: 'dl-setrow' }, [ E('div', { class: 'dl-stack' }, [ - E('span', { class: 'dl-setrow-label' }, 'Change the tunnel network'), + E('span', { class: 'dl-setrow-label' }, _('Change the tunnel network')), E( 'span', { class: 'dl-sub' }, - `Devices have ${rangeOf(srv.subnet)}.x addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again.`, + fmt( + _( + 'Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again.', + ), + `${rangeOf(srv.subnet)}.x`, + ), ), ]), E( 'div', { class: 'dl-setrow-ctl' }, - button([icon('edit'), ' Change'], () => this.changeSubnet(srv), 'negative'), + button([icon('edit'), ` ${_('Change')}`], () => this.changeSubnet(srv), 'negative'), ), ]), E('div', { class: 'dl-setrow' }, [ E('div', { class: 'dl-stack' }, [ - E('span', { class: 'dl-setrow-label' }, 'Remove server'), + E('span', { class: 'dl-setrow-label' }, _('Remove server')), E( 'span', { class: 'dl-sub' }, - `Removes the tunnel, its firewall rules and ${people} ${people === 1 ? 'person' : 'people'} with all their devices. A backup is made first.`, + plural( + people, + 'Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.', + 'Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first.', + ), ), ]), E( 'div', { class: 'dl-setrow-ctl' }, - button([icon('trash'), ' Remove'], () => this.remove(srv), 'negative'), + button([icon('trash'), ` ${_('Remove')}`], () => this.remove(srv), 'negative'), ), ]), ], @@ -483,24 +494,28 @@ export class ServerPage { const nets = taken.networks ?? []; const devices = this.st.people.filter((p) => p.server === srv.id).reduce((n, p) => n + p.devices.length, 0); const range = input(rangeOf(srv.subnet), { class: 'cbi-input-text dl-mono dl-w-range' }); - const rangeRow = liveRow('Address range', range, () => rangeHelp(range.value, nets, '')); + const rangeRow = liveRow(_('Address range'), range, () => rangeHelp(range.value, nets, '')); modal( - 'Change the tunnel network', + _('Change the tunnel network'), [ rangeRow, E( 'p', { class: 'dl-muted' }, devices - ? `${devices} device${devices === 1 ? ' gets a new address and stops' : 's get new addresses and stop'} connecting until ${devices === 1 ? 'it imports its' : 'they import their'} configuration again (from their personal link or from you).` - : 'No devices on this server yet: nothing else changes.', + ? plural( + devices, + '%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you).', + '%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you).', + ) + : _('No devices on this server yet: nothing else changes.'), ), ], [ cancelButton(), ' ', button( - 'Change', + _('Change'), async () => { const h = rangeRow.help(); if (h.bad) { @@ -512,9 +527,9 @@ export class ServerPage { closeModal(); return; } - if (await attempt(() => api.serverUpdate(srv.id, { subnet }), 'Tunnel network changed')) { + if (await attempt(() => api.serverUpdate(srv.id, { subnet }), _('Tunnel network changed'))) { closeModal(); - if (devices) notify('Devices are marked “Update config” until they import again.', 'info', 6000); + if (devices) notify(_('Devices are marked “Update config” until they import again.'), 'info', 6000); await this.refresh(); } }, @@ -528,22 +543,26 @@ export class ServerPage { async remove(srv: Server) { const people = this.st.people.filter((p) => p.server === srv.id); modal( - `Remove ${srv.name}?`, + fmt(_('Remove %s?'), srv.name), [ E( 'p', {}, - `This removes the tunnel, its firewall rules and ${people.length} ${people.length === 1 ? 'person' : 'people'} with all their devices. A backup is made first.`, + plural( + people.length, + 'This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.', + 'This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first.', + ), ), ], [ cancelButton(), ' ', button( - 'Remove', + _('Remove'), async () => { closeModal(); - if (await attempt(() => api.serverDelete(srv.id), 'Server removed')) + if (await attempt(() => api.serverDelete(srv.id), _('Server removed'))) setTimeout(() => { location.href = url(); }, 800); @@ -584,13 +603,15 @@ export class ServerPage { portHelp( state.port, d.udp_taken ?? [], - `Opened on the WAN firewall automatically.${state.port === 4500 ? ' 4500 is IPsec’s port: most networks let it through.' : ''}`, + state.port === 4500 + ? `${_('Opened on the WAN firewall automatically.')} ${_('4500 is IPsec’s port: most networks let it through.')}` + : _('Opened on the WAN firewall automatically.'), ); const FROM: Record = { - ddns: 'From your DDNS name.', - cert: 'From your Let’s Encrypt certificate.', - wan: 'Your WAN address now — it may change; a DDNS name is better.', - portal: 'The portal’s address.', + ddns: _('From your DDNS name.'), + cert: _('From your Let’s Encrypt certificate.'), + wan: _('Your WAN address now - it may change; a DDNS name is better.'), + portal: _('The portal’s address.'), }; const ep = endpointProbe( () => ({ host: state.endpoint, port: state.port }), @@ -605,10 +626,14 @@ export class ServerPage { ? needRow( 'alert', 'warn', - d.wan_kind === 'cgnat' ? 'Your router has no public address (CGNAT)' : `Your router is behind another router (WAN ${d.wan_ip})`, d.wan_kind === 'cgnat' - ? 'The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address.' - : 'Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here.', + ? _('Your router has no public address (CGNAT)') + : fmt(_('Your router is behind another router (WAN %s)'), d.wan_ip), + d.wan_kind === 'cgnat' + ? _( + 'The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address.', + ) + : _('Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here.'), '', ) : ''; @@ -616,7 +641,11 @@ export class ServerPage { d.awg_state?.tools && d.awg_state.handler === false ? E('div', { class: 'dl-note warn' }, [ icon('alert'), - E('span', {}, 'Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started.'), + E( + 'span', + {}, + _('Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started.'), + ), ]) : ''; const rangeHelpNow = () => rangeHelp(state.range, d.networks ?? [], rangeOf(d.subnet)); @@ -636,27 +665,33 @@ export class ServerPage { type Page = { id: string; title: string; render: () => Node; check?: () => string | null }; const serverPage: Page = { id: 'server', - title: 'Server', + title: _('Server'), render: () => E('div', { class: 'dl-wizard-groups' }, [ E( 'p', { class: 'dl-muted' }, extra - ? 'One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page.' - : 'Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.', + ? _( + 'One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page.', + ) + : _( + 'Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.', + ), ), - group('router', 'Server', 'What people see', [ - liveRow('Name', field('name'), () => nameHelp(state.name, [], 'Shown to people in their portal and apps.')), + group('router', _('Server'), _('What people see'), [ + liveRow(_('Name'), field('name'), () => nameHelp(state.name, [], _('Shown to people in their portal and apps.'))), ]), group( 'globe', - 'Devices connect to', - 'A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT', + _('Devices connect to'), + _( + 'A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT', + ), [ (() => { const el = field('endpoint', { placeholder: 'vpn.example.com', class: 'cbi-input-text dl-mono' }); - epRow = liveRow('Public address', el, ep.help); + epRow = liveRow(_('Public address'), el, ep.help); el.addEventListener('input', ep.schedule); ep.schedule(); return epRow; @@ -668,9 +703,9 @@ export class ServerPage { ]), check: () => { const n = nameHelp(state.name); - if (n.bad) return `Name: ${n.text}`; + if (n.bad) return fmt(_('Name: %s'), n.text); const h = hostHelp(state.endpoint, state.port); - return h.bad ? `Public address: ${h.text}` : null; + return h.bad ? fmt(_('Public address: %s'), h.text) : null; }, }; const awgPage: Page = { @@ -678,50 +713,50 @@ export class ServerPage { title: 'AmneziaWG', render: () => E('div', { class: 'dl-wizard-groups' }, [ - group('globe', 'Listening', 'Where devices reach AmneziaWG from the internet', [ - liveRow('UDP port', field('port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }), portHelpNow), + group('globe', _('Listening'), _('Where devices reach AmneziaWG from the internet'), [ + liveRow(_('UDP port'), field('port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }), portHelpNow), ]), - group('network', 'Tunnel network', 'Addresses devices get inside the tunnel', [ + group('network', _('Tunnel network'), _('Addresses devices get inside the tunnel'), [ (() => { const el = field('range', { class: 'cbi-input-text dl-w-range dl-mono', - 'aria-label': 'First three numbers of the device addresses', + 'aria-label': _('First three numbers of the device addresses'), }); return liveRow( - 'Device addresses', + _('Device addresses'), el, rangeHelpNow, E('span', { class: 'dl-suffixed' }, [el, E('span', { class: 'dl-mono' }, '.x')]), ); })(), ]), - group('shield', 'Disguise', 'So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard', [ + group('shield', _('Disguise'), _('So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard'), [ methodPicker(d.awg, state.preset, (m) => (state.preset = m), undefined, d.awg_state?.tools !== false), ]), ]), check: () => { const p = portHelpNow(); - if (p.bad) return `UDP port: ${p.text}`; + if (p.bad) return fmt(_('UDP port: %s'), p.text); const r = rangeHelpNow(); - return r.bad ? `Device addresses: ${r.text}` : null; + return r.bad ? fmt(_('Device addresses: %s'), r.text) : null; }, }; const portalPage: Page = { id: 'portal', - title: 'Portal', + title: _('Portal'), render: () => { const portalPort = field('portal_port', { inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono' }); - const portRow = liveRow('Listening port', portalPort, portalHelpNow); + const portRow = liveRow(_('Listening port'), portalPort, portalHelpNow); portRow.hidden = !state.portal; // Off | On, Off first: the same segmented control as in Settings. const onOff = seg( [ - ['off', 'Off'], - ['on', 'On'], + ['off', _('Off')], + ['on', _('On')], ], state.portal ? 'on' : 'off', { - label: 'Personal portal', + label: _('Personal portal'), onChange: (v) => { state.portal = v === 'on'; portRow.hidden = !state.portal; @@ -729,15 +764,17 @@ export class ServerPage { }, ); return E('div', { class: 'dl-wizard-groups' }, [ - group('home', 'Internet like a home device', 'How devices reach the internet', [ + group('home', _('Internet like a home device'), _('How devices reach the internet'), [ row( - 'Through the home network', - sw(state.lan_like, 'Internet like a home device', (v) => (state.lan_like = v)), - 'Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access.', + _('Through the home network'), + sw(state.lan_like, _('Internet like a home device'), (v) => (state.lan_like = v)), + _( + 'Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access.', + ), ), ]), - group('link', 'Personal portal', 'A page where each person adds their own devices with their personal link', [ - row('Portal', onOff, 'Off: only you add devices, from LuCI. On: people manage their devices within the limits you set.'), + group('link', _('Personal portal'), _('A page where each person adds their own devices with their personal link'), [ + row(_('Portal'), onOff, _('Off: only you add devices, from LuCI. On: people manage their devices within the limits you set.')), portRow, ]), ]); @@ -745,7 +782,7 @@ export class ServerPage { check: () => { if (!state.portal) return null; const h = portalHelpNow(); - return h.bad ? `Portal port: ${h.text}` : null; + return h.bad ? fmt(_('Portal port: %s'), h.text) : null; }, }; const pages = (): Page[] => [serverPage, awgPage, extra ? null : portalPage].filter((x): x is Page => x != null); @@ -757,9 +794,12 @@ export class ServerPage { needRow( 'shield', 'bad', - 'AmneziaWG isn’t installed', - `The tunnel needs ${missing.join(' and ')}. Install the build made for this firmware, then create the server.`, - button('Install', () => installAwg(() => location.reload()), 'positive'), + _('AmneziaWG isn’t installed'), + fmt( + _('The tunnel needs %s. Install the build made for this firmware, then create the server.'), + new Intl.ListFormat(locale(), { type: 'conjunction' }).format(missing), + ), + button(_('Install'), () => installAwg(() => location.reload()), 'positive'), ), ]) : aw && !aw.loaded @@ -767,9 +807,9 @@ export class ServerPage { needRow( 'shield', 'warn', - 'AmneziaWG’s kernel module doesn’t load on this firmware', - 'Try another build in Components, or update OpenWrt. The server can’t start until it loads.', - E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/updates') }, 'Open Components'), + _('AmneziaWG’s kernel module doesn’t load on this firmware'), + _('Try another build in Components, or update OpenWrt. The server can’t start until it loads.'), + E('a', { class: 'cbi-button cbi-button-neutral', href: L.url('admin/network/dawnline/updates') }, _('Open Components')), ), ]) : ''; @@ -778,7 +818,7 @@ export class ServerPage { const ps = pages(); if (step >= ps.length) step = ps.length - 1; dom.content(root, [ - E('h2', {}, extra ? 'Add a server' : 'Set up Dawnline'), + E('h2', {}, extra ? _('Add a server') : _('Set up Dawnline')), awgNotice, E( 'div', @@ -793,17 +833,17 @@ export class ServerPage { E('div', { class: 'dl-panel' }, ps[step].render()), E('div', { class: 'dl-actions' }, [ step > 0 - ? button('Back', () => { + ? button(_('Back'), () => { step--; paint(); }) : onCancel - ? button('Cancel', onCancel) + ? button(_('Cancel'), onCancel) : '', E('span', { class: 'dl-spacer' }), step < ps.length - 1 ? button( - 'Next', + _('Next'), () => { const err = ps[step].check?.(); if (err) { @@ -816,7 +856,7 @@ export class ServerPage { 'positive', ) : button( - 'Create server', + _('Create server'), async () => { for (const pg of ps) { const err = pg.check?.(); @@ -843,11 +883,11 @@ export class ServerPage { extra ? undefined : state.portal, extra ? undefined : state.portal_port, ), - 'Server created', + _('Server created'), ); if (!r) return; // A network restart drops the connection to LuCI for a few seconds. - if (r.network_restart) notify('Restarting the network so it knows AmneziaWG: back in a few seconds'); + if (r.network_restart) notify(_('Restarting the network so it knows AmneziaWG: back in a few seconds')); setTimeout( () => { location.href = url(r.id); @@ -856,7 +896,7 @@ export class ServerPage { ); }, 'positive', - { disabled: missing.length > 0, title: missing.length ? 'Install AmneziaWG first' : null }, + { disabled: missing.length > 0, title: missing.length ? _('Install AmneziaWG first') : null }, ), ]), ]); diff --git a/web/src/admin/pages/settings/backups.ts b/web/src/admin/pages/settings/backups.ts index c0031e5..f40575f 100644 --- a/web/src/admin/pages/settings/backups.ts +++ b/web/src/admin/pages/settings/backups.ts @@ -10,26 +10,33 @@ import { dropdown } from '../../ui/menu'; import { attempt, notify } from '../../ui/toast'; import { icon } from '../../../shared/icons'; import { bytes } from '../../../shared/format'; +import { fmt, locale, plural } from '../../../shared/i18n'; /** After a change: `true` when everything changed (restore, import), else only the list. */ type Done = (all?: boolean) => void; -const REASON: Record = { - manual: 'Manual', - auto: 'Nightly', - 'pre-restore': 'Before restore', - 'pre-import': 'Before import', - 'pre-delete': 'Before removing a server', - 'pre-update': 'Before update', -}; +/** Why a backup was made, from its reason id; an unknown id as it is. */ +function reasonLabel(r: string): string { + const label: Record = { + manual: _('Manual'), + auto: _('Nightly'), + 'pre-restore': _('Before restore'), + 'pre-import': _('Before import'), + 'pre-delete': _('Before removing a server'), + 'pre-update': _('Before update'), + }; + return label[r] ?? r; +} const SHOWN = 3; /** "Today, 03:00", "Yesterday, 03:00" or "12 Oct, 03:00". */ function when(ts: number): string { const d = new Date(ts * 1000); - const t = d.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' }); + const t = d.toLocaleTimeString(locale(), { hour: '2-digit', minute: '2-digit' }); const days = Math.round((new Date(new Date().toDateString()).getTime() - new Date(d.toDateString()).getTime()) / 86400000); - return `${days === 0 ? 'Today' : days === 1 ? 'Yesterday' : d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })}, ${t}`; + if (days === 0) return fmt(_('Today, %s'), t); + if (days === 1) return fmt(_('Yesterday, %s'), t); + return `${d.toLocaleDateString(locale(), { day: 'numeric', month: 'short' })}, ${t}`; } async function download(b: Backup) { @@ -47,43 +54,43 @@ function backupRow(b: Backup, done: Done): HTMLElement { E('span', { class: 'dl-group-ic' }, icon('archive')), E('span', { class: 'dl-row-main dl-stack' }, [ E('b', {}, when(b.created)), - E('span', { class: 'dl-sub' }, `${REASON[b.reason] ?? b.reason} · ${bytes(b.size)}`), + E('span', { class: 'dl-sub' }, `${reasonLabel(b.reason)} · ${bytes(b.size)}`), ]), E('span', { class: 'dl-pcard-actions' }, [ - iconButton('download', 'Download', () => download(b), 'neutral', 'dl-icon-only'), + iconButton('download', _('Download'), () => download(b), 'neutral', 'dl-icon-only'), iconButton( 'more', - 'More', + _('More'), (ev: MouseEvent) => dropdown(ev.currentTarget as HTMLElement, [ { - label: 'Restore', + label: _('Restore'), icon: icon('reset'), run: async () => { const ok = await confirmDialog( - 'Restore this backup?', - `Everything returns to ${when(b.created)}. The current state is backed up first.`, - 'Restore', + _('Restore this backup?'), + fmt(_('Everything returns to %s. The current state is backed up first.'), when(b.created)), + _('Restore'), true, ); - if (ok && (await attempt(() => api.backupRestore(b.name), 'Restored'))) done(true); + if (ok && (await attempt(() => api.backupRestore(b.name), _('Restored')))) done(true); }, }, { - label: 'Delete', + label: _('Delete'), icon: icon('trash'), danger: true, run: async () => { if ( !(await confirmDialog( - 'Delete this backup?', - `The backup from ${when(b.created)} is removed from the router.`, - 'Delete', + _('Delete this backup?'), + fmt(_('The backup from %s is removed from the router.'), when(b.created)), + _('Delete'), true, )) ) return; - if (await attempt(() => api.backupDelete(b.name), 'Backup deleted')) done(); + if (await attempt(() => api.backupDelete(b.name), _('Backup deleted'))) done(); }, }, ]), @@ -103,63 +110,63 @@ export function backupsSection(list: Backup[], done: Done): HTMLElement { ...rows, older.length ? E('details', { class: 'dl-bk-older' }, [ - E('summary', {}, [icon('chevron'), `${older.length} older backup${older.length === 1 ? '' : 's'}`]), + E('summary', {}, [icon('chevron'), plural(older.length, '%s older backup', '%s older backups')]), ...older.map((b) => backupRow(b, done)), ]) : '', ]) - : E('div', { class: 'dl-list' }, [E('div', { class: 'dl-row dl-muted' }, 'No backups yet.')]); + : E('div', { class: 'dl-list' }, [E('div', { class: 'dl-row dl-muted' }, _('No backups yet.'))]); - const restoreFile = button('Restore from file', async () => { + const restoreFile = button(_('Restore from file'), async () => { const f = await pickFile('.tar.gz,.tgz,application/gzip', 'base64'); if (!f) return; const ok = await confirmDialog( - 'Restore from file?', - `Replace the current Dawnline configuration with ${f.name}? The current state is backed up first.`, - 'Restore', + _('Restore from file?'), + fmt(_('Replace the current Dawnline configuration with %s? The current state is backed up first.'), f.name), + _('Restore'), true, ); - if (ok && (await attempt(() => api.backupUpload(f.data), 'Restored'))) done(true); + if (ok && (await attempt(() => api.backupUpload(f.data), _('Restored')))) done(true); }); - const exportJson = button('Export JSON', async () => { + const exportJson = button(_('Export JSON'), async () => { const r = await attempt(() => api.exportJson()); if (r) downloadFile(`dawnline-export-${new Date().toISOString().slice(0, 10)}.json`, JSON.stringify(r, null, 2), 'application/json'); }); - const importJson = button('Import JSON', async () => { + const importJson = button(_('Import JSON'), async () => { const f = await pickFile('.json,application/json', 'text'); if (!f) return; let data: unknown; try { data = JSON.parse(f.data); } catch { - notify('Not a JSON file.', 'error'); + notify(_('Not a JSON file.'), 'error'); return; } const ok = await confirmDialog( - 'Import?', - 'This replaces the whole Dawnline configuration on this router. The current state is backed up first.', - 'Import', + _('Import?'), + _('This replaces the whole Dawnline configuration on this router. The current state is backed up first.'), + _('Import'), true, ); - if (ok && (await attempt(() => api.importJson(data), 'Imported'))) done(true); + if (ok && (await attempt(() => api.importJson(data), _('Imported')))) done(true); }); return E('section', { class: 'dl-setsec', id: 'dl-set-backups' }, [ E('div', { class: 'dl-setsec-body' }, [ E('div', { class: 'dl-setsec-head' }, [ E('div', { class: 'dl-stack' }, [ - E('h3', {}, 'Backups'), + E('h3', {}, _('Backups')), E( 'span', { class: 'dl-sub' }, - 'Nightly when something changed, and before every restore, import or update. The last 10 are kept.', + _('Nightly when something changed, and before every restore, import or update. The last 10 are kept.'), ), ]), E('span', { class: 'dl-spacer' }), button( - [icon('plus'), ' Back up now'], + [icon('plus'), ' ', _('Back up now')], async () => { - if (await attempt(() => api.backupCreate(), 'Backup created')) done(); + if (await attempt(() => api.backupCreate(), _('Backup created'))) done(); }, 'positive', ), @@ -170,7 +177,7 @@ export function backupsSection(list: Backup[], done: Done): HTMLElement { E( 'span', { class: 'dl-sub' }, - 'Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router.', + _('Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router.'), ), E('span', { class: 'dl-row-actions dl-bk-actions' }, [restoreFile, exportJson, importJson]), ]), diff --git a/web/src/admin/pages/settings/danger.ts b/web/src/admin/pages/settings/danger.ts index 8a8049d..70393ef 100644 --- a/web/src/admin/pages/settings/danger.ts +++ b/web/src/admin/pages/settings/danger.ts @@ -6,15 +6,19 @@ import { button } from '../../ui/button'; import { cancelButton, closeModal, modal } from '../../ui/modal'; import { attempt } from '../../ui/toast'; import { input } from '../../ui/controls'; +import { fmt } from '../../../shared/i18n'; import { section } from './common'; +/** The word the router demands to remove Dawnline: the same in every language. */ +const WORD = 'remove'; + function uninstall() { - const confirmInput = input('', { placeholder: 'remove' }); + const confirmInput = input('', { placeholder: WORD }); // Live only once the word is typed, as the router itself demands. const go = button( - 'Remove Dawnline', + _('Remove Dawnline'), async () => { - if (await attempt(() => api.uninstall(confirmInput.value.trim()), 'Dawnline removed')) { + if (await attempt(() => api.uninstall(confirmInput.value.trim()), _('Dawnline removed'))) { closeModal(); setTimeout(() => location.reload(), 800); } @@ -23,15 +27,20 @@ function uninstall() { { disabled: true }, ); confirmInput.addEventListener('input', () => { - go.disabled = confirmInput.value.trim() !== 'remove'; + go.disabled = confirmInput.value.trim() !== WORD; }); modal( - 'Remove Dawnline?', + _('Remove Dawnline?'), [ E( 'p', {}, - 'Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “remove” to confirm.', + fmt( + _( + 'Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm.', + ), + WORD, + ), ), confirmInput, ], @@ -42,15 +51,17 @@ function uninstall() { export function dangerCard(): HTMLElement { return section( 'danger', - 'Remove Dawnline from this router', + _('Remove Dawnline from this router'), [ E( 'p', { class: 'dl-muted' }, - 'Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup.', + _( + 'Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup.', + ), ), ], - [E('span'), button('Remove', () => uninstall(), 'negative')], + [E('span'), button(_('Remove'), () => uninstall(), 'negative')], 'danger', ); } diff --git a/web/src/admin/pages/settings/defaults.ts b/web/src/admin/pages/settings/defaults.ts index 23a8d20..95aee78 100644 --- a/web/src/admin/pages/settings/defaults.ts +++ b/web/src/admin/pages/settings/defaults.ts @@ -6,43 +6,44 @@ import { input, isOn, sw } from '../../ui/controls'; import { firstBad, liveRow } from '../../ui/layout'; import { notify } from '../../ui/toast'; import { domainHelp, fallbackDnsHelp, limitHelp } from '../../netcheck'; +import { fmt } from '../../../shared/i18n'; import { section, type SettingsHost } from './common'; export function defaultsCard(host: SettingsHost): HTMLElement { const s = host.d.settings; const eff = host.d.effective as Record; const limit = input(s.default_device_limit, { placeholder: '3', inputmode: 'numeric', class: 'cbi-input-text dl-w-port' }); - const hn = sw(eff.hostnames, 'Device hostnames'); + const hn = sw(eff.hostnames, _('Device hostnames')); const domain = input(s.domain, { placeholder: 'lan', class: 'cbi-input-text dl-w-port' }); const fallback = input(s.home_dns_fallback === 'none' ? '' : s.home_dns_fallback || eff.home_dns_fallback || '', { - placeholder: 'None', + placeholder: _('None'), inputmode: 'decimal', class: 'cbi-input-text dl-w-ip dl-mono', }); - const limitRow = liveRow('Devices per person', limit, () => { + const limitRow = liveRow(_('Devices per person'), limit, () => { // Empty keeps the default (the router stores nothing then). - if (!limit.value.trim()) return { text: 'The default, 3. Pre-filled when you add someone.', bad: false }; + if (!limit.value.trim()) return { text: _('The default, 3. Pre-filled when you add someone.'), bad: false }; const h = limitHelp(limit.value); - return h.bad ? h : { text: 'Pre-filled when you add someone.', bad: false }; + return h.bad ? h : { text: _('Pre-filled when you add someone.'), bad: false }; }); const domainRow = liveRow( - 'Device hostnames', + _('Device hostnames'), domain, () => domainHelp(domain.value), E('div', { class: 'dl-hostport' }, [hn, E('span', { class: 'dl-faint dl-mono' }, 'phone.myata.'), domain]), ); - const fallbackRow = liveRow('Fallback DNS', fallback, () => { + const fallbackRow = liveRow(_('Fallback DNS'), fallback, () => { const h = fallbackDnsHelp(fallback.value); - return h.bad ? h : { text: `For Home-only devices using home names: ${h.text}`, bad: false }; + return h.bad ? h : { text: fmt(_('For Home-only devices using home names: %s'), h.text), bad: false }; }); return section( 'defaults', - 'New people', + _('New people'), [limitRow, domainRow, fallbackRow], [ E('span'), button( - 'Save', + _('Save'), () => { const bad = firstBad([limitRow, domainRow, fallbackRow]); if (bad) { @@ -56,7 +57,7 @@ export function defaultsCard(host: SettingsHost): HTMLElement { domain: domain.value, home_dns_fallback: fallback.value, }, - 'Saved', + _('Saved'), 'defaults', ); }, diff --git a/web/src/admin/pages/settings/index.ts b/web/src/admin/pages/settings/index.ts index 863db6e..da4d70e 100644 --- a/web/src/admin/pages/settings/index.ts +++ b/web/src/admin/pages/settings/index.ts @@ -51,7 +51,7 @@ export class SettingsPage implements SettingsHost { // ?section=updates (from Components) and the like: open at that card. const sec = new URLSearchParams(location.search).get('section'); if (sec && sec !== 'backups') requestAnimationFrame(() => document.getElementById(`dl-set-${sec}`)?.scrollIntoView({ block: 'start' })); - return E('div', {}, [E('div', { class: 'dl-pagehead' }, [E('h2', { class: 'dl-h1' }, 'Settings')]), this.root]); + return E('div', {}, [E('div', { class: 'dl-pagehead' }, [E('h2', { class: 'dl-h1' }, _('Settings'))]), this.root]); } async save(values: Record, ok: string, card: CardId) { diff --git a/web/src/admin/pages/settings/logs.ts b/web/src/admin/pages/settings/logs.ts index f85d15b..fd3f85a 100644 --- a/web/src/admin/pages/settings/logs.ts +++ b/web/src/admin/pages/settings/logs.ts @@ -7,8 +7,9 @@ import { attempt } from '../../ui/toast'; import { chipToggle, seg, setChip } from '../../ui/controls'; import { row } from '../../ui/layout'; import { icon } from '../../../shared/icons'; -import { fmtDay, kb, plural } from '../../../shared/format'; -import { CATEGORIES, CATEGORY_HELP, CATEGORY_LABEL, retentionText } from '../../events/model'; +import { fmtDay, kb } from '../../../shared/format'; +import { fmt, num, plural } from '../../../shared/i18n'; +import { CATEGORIES, categoryHelp, categoryLabel, retentionText } from '../../events/model'; import { clearLogDialog, exportEvents, resetUsageDialog } from '../../logs'; import { section, type SettingsHost } from './common'; @@ -17,54 +18,54 @@ export function logsCard(host: SettingsHost): HTMLElement { const p = L.policy; const keep = seg( [ - ['7', '7 days'], - ['30', '30 days'], - ['90', '90 days'], - ['365', '1 year'], - ['0', 'No limit'], + ['7', plural(7, '%s day', '%s days')], + ['30', plural(30, '%s day', '%s days')], + ['90', plural(90, '%s day', '%s days')], + ['365', plural(1, '%s year', '%s years')], + ['0', _('No limit', 'retention')], ], String(p.keep_days), - { label: 'Keep activity', cls: 'sm' }, + { label: _('Keep activity'), cls: 'sm' }, ); const size = seg( [ - ['500', '500'], - ['2000', '2,000'], - ['5000', '5,000'], - ['20000', '20,000'], + ['500', num(500)], + ['2000', num(2000)], + ['5000', num(5000)], + ['20000', num(20000)], ], String(p.max), - { label: 'Maximum events', cls: 'sm' }, + { label: _('Maximum events'), cls: 'sm' }, ); const persist = seg( [ - ['10min', 'Every 10 min'], - ['hourly', 'Hourly'], - ['off', 'Memory only'], + ['10min', _('Every 10 min')], + ['hourly', _('Hourly')], + ['off', _('Memory only')], ], p.persist, - { label: 'Save to flash', cls: 'sm' }, + { label: _('Save to flash'), cls: 'sm' }, ); const days = seg( [ - ['31', '1 month'], - ['62', '2 months'], - ['180', '6 months'], - ['365', '1 year'], - ['730', '2 years'], + ['31', plural(1, '%s month', '%s months')], + ['62', plural(2, '%s month', '%s months')], + ['180', plural(6, '%s month', '%s months')], + ['365', plural(1, '%s year', '%s years')], + ['730', plural(2, '%s year', '%s years')], ], String(p.usage_days), - { label: 'Daily traffic', cls: 'sm' }, + { label: _('Daily traffic'), cls: 'sm' }, ); const months = seg( [ - ['12', '1 year'], - ['24', '2 years'], - ['60', '5 years'], - ['120', '10 years'], + ['12', plural(1, '%s year', '%s years')], + ['24', plural(2, '%s year', '%s years')], + ['60', plural(5, '%s year', '%s years')], + ['120', plural(10, '%s year', '%s years')], ], String(p.usage_months), - { label: 'Monthly traffic', cls: 'sm' }, + { label: _('Monthly traffic'), cls: 'sm' }, ); const chosen = new Set(p.categories); const cats = E( @@ -72,13 +73,13 @@ export function logsCard(host: SettingsHost): HTMLElement { { class: 'dl-chips-row' }, CATEGORIES.map((c) => { const b = chipToggle( - [CATEGORY_LABEL[c], E('b', {}, String(L.by_category[c] ?? 0))], + [categoryLabel(c), E('b', {}, num(L.by_category[c] ?? 0))], chosen.has(c), () => { if (!chosen.delete(c)) chosen.add(c); setChip(b, chosen.has(c)); }, - { title: CATEGORY_HELP[c] }, + { title: categoryHelp(c) }, ); return b; }), @@ -91,72 +92,83 @@ export function logsCard(host: SettingsHost): HTMLElement { E('span', { class: 'dl-row-main dl-stack' }, [E('b', {}, title), E('span', { class: 'dl-sub' }, detail)]), ...actions, ]); - const exportBtn = (fmt: 'csv' | 'json') => + const exportBtn = (kind: 'csv' | 'json') => button( - fmt.toUpperCase(), + kind.toUpperCase(), async () => { const [st, ev] = await Promise.all([api.status(1), api.events(20000)]); - exportEvents(st, ev.events, fmt); + exportEvents(st, ev.events, kind); }, 'neutral', - { title: `Download the log as ${fmt.toUpperCase()}` }, + { title: fmt(_('Download the log as %s'), kind.toUpperCase()) }, ); return section( 'logs', - 'Logs & history', + _('Logs & history'), [ E('p', { class: 'dl-muted' }, retentionText(p)), - row('Keep activity', keep, 'Older events are removed automatically.'), - row('Maximum size', size, 'Newest events are kept when the log is full.'), - row('Record', cats, 'Switched-off categories are not logged from now on.'), + row(_('Keep activity'), keep, _('Older events are removed automatically.')), + row(_('Maximum size'), size, _('Newest events are kept when the log is full.')), + row(_('Record'), cats, _('Switched-off categories are not logged from now on.')), row( - 'Save to flash', + _('Save to flash'), persist, - 'The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot.', + _('The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot.'), ), - row('Daily traffic', days, 'Per-day history behind the charts.'), - row('Monthly traffic', months, 'Per-month totals; data limits use the current month.'), - E('h4', { class: 'dl-setsub' }, 'Stored data'), + row(_('Daily traffic'), days, _('Per-day history behind the charts.')), + row(_('Monthly traffic'), months, _('Per-month totals; data limits use the current month.')), + E('h4', { class: 'dl-setsub' }, _('Stored data')), E('div', { class: 'dl-list' }, [ stored( 'activity', - 'Activity log', + _('Activity log'), L.events - ? `${plural(L.events, 'event')} since ${since} · ${kb(L.log_ram)} in memory${p.persist === 'off' ? '' : `, ${kb(L.log_flash)} on flash`}` - : 'Empty', + ? `${fmt(_('%s since %s'), plural(L.events, '%s event', '%s events'), since)} · ${ + p.persist === 'off' + ? fmt(_('%s in memory'), kb(L.log_ram)) + : fmt(_('%s in memory, %s on flash'), kb(L.log_ram), kb(L.log_flash)) + }` + : _('Empty'), [ exportBtn('csv'), exportBtn('json'), button( - 'Clear', - () => clearLogDialog('Clear activity', 'Removes events from the log on the router.', {}, () => host.reload('logs')), + _('Clear'), + () => clearLogDialog(_('Clear activity'), _('Removes events from the log on the router.'), {}, () => host.reload('logs')), 'negative', ), ], ), stored( 'chart', - 'Traffic history', + _('Traffic history'), // usage_since is a router day (YYYY-MM-DD): shown as that day in any time zone. - L.usage_days ? `${plural(L.usage_days, 'day')} since ${fmtDay(L.usage_since)} · ${kb(L.usage_flash)} on flash` : 'Empty', - [button('Reset', () => resetUsageDialog('all', '', '', () => setTimeout(() => host.reload('logs'), 300)), 'negative')], + L.usage_days + ? `${fmt(_('%s since %s'), plural(L.usage_days, '%s day', '%s days'), fmtDay(L.usage_since))} · ${fmt(_('%s on flash'), kb(L.usage_flash))}` + : _('Empty'), + [button(_('Reset'), () => resetUsageDialog('all', '', '', () => setTimeout(() => host.reload('logs'), 300)), 'negative')], + ), + stored( + 'pin', + _('Location cache'), + `${plural(host.d.geo_cached, '%s address', '%s addresses')} · ${fmt(_('%s on flash'), kb(L.geo_flash))}`, + [ + button( + _('Clear'), + async () => { + if (await attempt(() => api.geoClear(), _('Location cache cleared'))) await host.reload('logs'); + }, + 'negative', + ), + ], ), - stored('pin', 'Location cache', `${plural(host.d.geo_cached, 'address', 'addresses')} · ${kb(L.geo_flash)} on flash`, [ - button( - 'Clear', - async () => { - if (await attempt(() => api.geoClear(), 'Location cache cleared')) await host.reload('logs'); - }, - 'negative', - ), - ]), ]), ], [ - E('span', { class: 'dl-sub' }, 'Clear one person or device from their own page.'), + E('span', { class: 'dl-sub' }, _('Clear one person or device from their own page.')), button( - 'Save', + _('Save'), () => host.save( { @@ -167,7 +179,7 @@ export function logsCard(host: SettingsHost): HTMLElement { usage_keep_months: months.dataset.value!, log_category: [...chosen], }, - 'Saved', + _('Saved'), 'logs', ), 'positive', diff --git a/web/src/admin/pages/settings/map.ts b/web/src/admin/pages/settings/map.ts index ab20edb..94cc801 100644 --- a/web/src/admin/pages/settings/map.ts +++ b/web/src/admin/pages/settings/map.ts @@ -4,32 +4,43 @@ import { E } from '../../e'; import { button } from '../../ui/button'; import { isOn, sw } from '../../ui/controls'; import { row } from '../../ui/layout'; +import { fmt } from '../../../shared/i18n'; import { section, type SettingsHost } from './common'; export function mapCard(host: SettingsHost): HTMLElement { const eff = host.d.effective as Record; - const gOn = sw(eff.geo_enabled, 'Locations'); + const gOn = sw(eff.geo_enabled, _('Locations')); const prov = E('select', { class: 'cbi-input-select' }, [ - E('option', { value: 'ipwho.is', selected: eff.geo_provider !== 'ipapi.co' ? 'selected' : null }, 'ipwho.is (fallback: ipapi.co)'), - E('option', { value: 'ipapi.co', selected: eff.geo_provider === 'ipapi.co' ? 'selected' : null }, 'ipapi.co (fallback: ipwho.is)'), + E( + 'option', + { value: 'ipwho.is', selected: eff.geo_provider !== 'ipapi.co' ? 'selected' : null }, + fmt(_('%s (fallback: %s)'), 'ipwho.is', 'ipapi.co'), + ), + E( + 'option', + { value: 'ipapi.co', selected: eff.geo_provider === 'ipapi.co' ? 'selected' : null }, + fmt(_('%s (fallback: %s)'), 'ipapi.co', 'ipwho.is'), + ), ]) as HTMLSelectElement; return section( 'map', - 'Map & locations', + _('Map & locations'), [ E('div', { class: 'dl-setrow head' }, [ - E('span', { class: 'dl-muted' }, 'Show where people connect from on the Overview and person pages, at city level.'), + E('span', { class: 'dl-muted' }, _('Show where people connect from on the Overview and person pages, at city level.')), gOn, ]), - row('Provider', prov), + row(_('Provider'), prov), ], [ E( 'span', { class: 'dl-sub' }, - 'The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map.', + _( + 'The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map.', + ), ), - button('Save', () => host.save({ geo_enabled: isOn(gOn) ? '1' : '0', geo_provider: prov.value }, 'Saved', 'map'), 'positive'), + button(_('Save'), () => host.save({ geo_enabled: isOn(gOn) ? '1' : '0', geo_provider: prov.value }, _('Saved'), 'map'), 'positive'), ], ); } diff --git a/web/src/admin/pages/settings/portal.ts b/web/src/admin/pages/settings/portal.ts index 417ea3f..4ab2b5e 100644 --- a/web/src/admin/pages/settings/portal.ts +++ b/web/src/admin/pages/settings/portal.ts @@ -10,6 +10,7 @@ import { firstBad, group, liveRow, needRow, row } from '../../ui/layout'; import { hostHelp, portalPortHelp, urlHelp } from '../../netcheck'; import { icon } from '../../../shared/icons'; import { fmtDay } from '../../../shared/format'; +import { fmt, locale, num, plural } from '../../../shared/i18n'; import { installMissing } from '../../pkgs'; import { notify } from '../../ui/toast'; import { section, type SettingsHost } from './common'; @@ -27,10 +28,10 @@ export function portalCard(host: SettingsHost): HTMLElement { const s = host.d.settings; const eff = host.d.effective as Record; const c = host.d.cert; - const pOn = sw(eff.portal_enabled, 'Enable portal'); + const pOn = sw(eff.portal_enabled, _('Enable portal')); const port = input(s.portal_port, { placeholder: '8443', inputmode: 'numeric', class: 'cbi-input-text dl-w-port' }); - const redirect = input(s.portal_redirect, { placeholder: 'Show “Not found”', class: 'cbi-input-text dl-mono' }); - const other = input('', { placeholder: 'vpn.example.com or an IP', 'aria-label': 'Other address' }); + const redirect = input(s.portal_redirect, { placeholder: _('Show “Not found”'), class: 'cbi-input-text dl-mono' }); + const other = input('', { placeholder: _('vpn.example.com or an IP'), 'aria-label': _('Other address') }); const isIp = (h: string) => /^\d{1,3}(\.\d{1,3}){3}$/.test(h); // Chosen addresses, the main one first; custom ones join the list of options. let picked: string[] = [eff.portal_host, ...(eff.portal_alt ?? [])].filter( @@ -53,21 +54,23 @@ export function portalCard(host: SettingsHost): HTMLElement { const note = (x: PortalInfo['candidates'][number]): Node => x.kind === 'ip' - ? E('span', { class: 'dl-addr-warn' }, [icon('alert'), 'Plain HTTP: the link and VPN keys travel unencrypted']) + ? E('span', { class: 'dl-addr-warn' }, [icon('alert'), _('Plain HTTP: the link and VPN keys travel unencrypted')]) : E( 'span', { class: 'dl-sub' }, x.cloudflare - ? 'Behind Cloudflare · often stalls in Russia' + ? _('Behind Cloudflare · often stalls in Russia') : !x.ips.length ? found - ? 'Your address' - : 'Checking where it points…' + ? _('Your address') + : _('Checking where it points…') : x.here - ? `Points at this router${x.cert ? ' · Let’s Encrypt certificate' : ' · no certificate yet'}` - : `Points at ${x.ips.join(', ')}, not this router`, + ? x.cert + ? _('Points at this router · Let’s Encrypt certificate') + : _('Points at this router · no certificate yet') + : fmt(_('Points at %s, not this router'), x.ips.join(', ')), ); - const opts = E('div', { class: 'dl-addr-opts', role: 'group', 'aria-label': 'Portal addresses' }); + const opts = E('div', { class: 'dl-addr-opts', role: 'group', 'aria-label': _('Portal addresses') }); const toggle = (h: string) => { if (picked.includes(h)) { if (picked.length > 1) picked = picked.filter((x) => x !== h); @@ -99,7 +102,7 @@ export function portalCard(host: SettingsHost): HTMLElement { E('i', { class: 'dl-addr-check' }, on ? icon('check') : ''), E('span', { class: 'dl-stack' }, [E('span', { class: 'dl-mono' }, x.host), note(x)]), main - ? E('span', { class: 'dl-pill info' }, 'Main') + ? E('span', { class: 'dl-pill info' }, _('Main')) : on ? E( 'button', @@ -113,14 +116,14 @@ export function portalCard(host: SettingsHost): HTMLElement { paintLinks(); }, }, - 'Make main', + _('Make main'), ) : x.cloudflare ? E('span', { class: 'dl-pill warn' }, 'Cloudflare') : x.kind === 'ip' ? E('span', { class: 'dl-pill' }, 'IP') : x.here && x.cert - ? E('span', { class: 'dl-pill ok' }, 'Recommended') + ? E('span', { class: 'dl-pill ok' }, _('Recommended')) : '', ], ); @@ -128,7 +131,7 @@ export function portalCard(host: SettingsHost): HTMLElement { E('div', { class: 'dl-addr-opt other' }, [ E('i', { class: 'dl-addr-check' }, icon('plus')), other, - button('Add', () => { + button(_('Add'), () => { const h = other.value.trim().toLowerCase(); if (!h) return; // The router would refuse it on Save: say so here. @@ -169,7 +172,7 @@ export function portalCard(host: SettingsHost): HTMLElement { return E('div', { class: 'dl-link-row' }, [ E('span', { class: `dl-link-ic ${ip ? 'warn' : 'ok'}` }, icon(ip ? 'alert' : 'lock')), E('span', { class: 'dl-mono dl-link-url' }, [base, E('b', {}, 'kamiro-telosu-bavine')]), - i === 0 ? E('span', { class: 'dl-pill info' }, 'Main') : ip ? E('span', { class: 'dl-pill warn' }, 'HTTP') : '', + i === 0 ? E('span', { class: 'dl-pill info' }, _('Main')) : ip ? E('span', { class: 'dl-pill warn' }, 'HTTP') : '', ]); }), ); @@ -180,18 +183,18 @@ export function portalCard(host: SettingsHost): HTMLElement { // Readiness: one summary line, the checks as chips, details on demand. const SHORT: Record = { - portal: 'Portal running', - portal_dns: 'Points here', - portal_reply: 'Answers reach visitors', - portal_http: 'Plain HTTP', - cert: 'Certificate', + portal: _('Portal running'), + portal_dns: _('Points here'), + portal_reply: _('Answers reach visitors'), + portal_http: _('Plain HTTP'), + cert: _('Certificate'), }; const need = host.d.needs ?? { https: [], acme: [], home: [] }; const readyGroup = (checks: PortalInfo['checks'] | null): HTMLElement => { if (!eff.portal_enabled) return E('div', { hidden: true }); if (!checks) - return group('check', 'Ready to share', 'The portal’s checks from Health', [ - E('p', { class: 'dl-muted dl-loading' }, 'Running checks…'), + return group('check', _('Ready to share'), _('The portal’s checks from Health'), [ + E('p', { class: 'dl-muted dl-loading' }, _('Running checks…')), ]); const shown = checks.filter((x) => x.status !== 'skip'); if (!shown.length) return E('div', { hidden: true }); @@ -213,11 +216,13 @@ export function portalCard(host: SettingsHost): HTMLElement { E( 'b', {}, - worst === 'ok' ? `All ${shown.length} checks passed` : `${shown.length - bad.length} of ${shown.length} checks passed`, + worst === 'ok' + ? plural(shown.length, 'All %s check passed', 'All %s checks passed') + : fmt(N_(shown.length, '%s of %s check passed', '%s of %s checks passed'), num(shown.length - bad.length), num(shown.length)), ), bad.length ? E('span', { class: 'dl-sub' }, bad.map((x) => x.detail).join(' ')) - : E('span', { class: 'dl-sub' }, 'Links will open for the people you send them to.'), + : E('span', { class: 'dl-sub' }, _('Links will open for the people you send them to.')), ]), E( 'button', @@ -226,10 +231,10 @@ export function portalCard(host: SettingsHost): HTMLElement { class: 'dl-linkbtn', click: (ev: Event) => { details.hidden = !details.hidden; - (ev.currentTarget as HTMLElement).textContent = details.hidden ? 'Details' : 'Hide'; + (ev.currentTarget as HTMLElement).textContent = details.hidden ? _('Details') : _('Hide'); }, }, - 'Details', + _('Details'), ), ]), E( @@ -244,17 +249,17 @@ export function portalCard(host: SettingsHost): HTMLElement { ), details, ]); - return group('check', 'Ready to share', 'The portal’s checks from Health', [ready]); + return group('check', _('Ready to share'), _('The portal’s checks from Health'), [ready]); }; // The state pill next to the switch: none until the checks are in. const readyPill = (checks: PortalInfo['checks'] | null): HTMLElement => { if (!eff.portal_enabled || (!checks && !need.https.length)) return E('span', { hidden: true }); - if (need.https.length) return E('span', { class: 'dl-pill bad' }, 'Can’t start'); + if (need.https.length) return E('span', { class: 'dl-pill bad' }, _('Can’t start')); const { worst } = verdict(checks!); return E( 'span', { class: `dl-pill ${worst === 'ok' ? 'ok' : worst === 'error' ? 'bad' : 'warn'}` }, - worst === 'error' ? 'Needs attention' : 'Ready', + worst === 'error' ? _('Needs attention') : _('Ready'), ); }; let readyEl = readyGroup(host.portal?.checks ?? null); @@ -274,31 +279,31 @@ export function portalCard(host: SettingsHost): HTMLElement { const until = c && !c.self_signed && c.expires ? fmtDay(c.expires) : ''; // Who holds the port (our own portal doesn't count), and the next one while links use an IP address. - const listenRow = liveRow('Listening port', port, () => + const listenRow = liveRow(_('Listening port'), port, () => portalPortHelp(port.value.trim() === '' ? eff.portal_port : Number(port.value), host.d.tcp_taken ?? [], picked.some(isIp)), ); refreshPort = listenRow.refresh; - const redirectRow = liveRow('Unknown links', redirect, () => urlHelp(redirect.value)); + const redirectRow = liveRow(_('Unknown links'), redirect, () => urlHelp(redirect.value)); const custom = !!(s.portal_cert && s.portal_key); - const kind = !c ? 'Portal is off' : custom ? 'Your files' : c.self_signed ? 'Self-signed' : 'Let’s Encrypt'; + const kind = !c ? _('Portal is off') : custom ? _('Your files') : c.self_signed ? _('Self-signed') : 'Let’s Encrypt'; const certFiles = () => { const fc = input(s.portal_cert, { placeholder: '/etc/ssl/…/fullchain.crt' }); const fk = input(s.portal_key, { placeholder: '/etc/ssl/…/key' }); modal( - 'Use your own certificate', + _('Use your own certificate'), [ - E('p', { class: 'dl-muted' }, 'Paths on the router. Leave both empty to pick a certificate automatically.'), - row('Certificate file', fc), - row('Key file', fk), + E('p', { class: 'dl-muted' }, _('Paths on the router. Leave both empty to pick a certificate automatically.')), + row(_('Certificate file'), fc), + row(_('Key file'), fk), ], [ cancelButton(), ' ', button( - 'Save', + _('Save'), () => { closeModal(); - void host.save({ portal_cert: fc.value.trim(), portal_key: fk.value.trim() }, 'Certificate saved', 'portal'); + void host.save({ portal_cert: fc.value.trim(), portal_key: fk.value.trim() }, _('Certificate saved'), 'portal'); }, 'positive', ), @@ -317,10 +322,13 @@ export function portalCard(host: SettingsHost): HTMLElement { ? missingRow( 'lock', 'bad', - 'HTTPS isn’t available on this router', - `The portal needs ${need.https.join(' and ')}. It can’t start without them.`, + _('HTTPS isn’t available on this router'), + fmt( + _('The portal needs %s. It can’t start without them.'), + new Intl.ListFormat(locale(), { type: 'conjunction' }).format(need.https), + ), 'https', - 'Install', + _('Install'), ) : ''; const acmeRow = @@ -328,62 +336,70 @@ export function portalCard(host: SettingsHost): HTMLElement { ? missingRow( 'lock', '', - 'Free certificate from Let’s Encrypt', - `ACME isn’t installed. With it the router gets a certificate${s.portal_host ? ` for ${s.portal_host}` : ''} and browsers stop warning.`, + _('Free certificate from Let’s Encrypt'), + s.portal_host + ? fmt(_('ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning.'), s.portal_host) + : _('ACME isn’t installed. With it the router gets a certificate and browsers stop warning.'), 'acme', - 'Install ACME', + _('Install ACME'), ) : ''; const certRows = [ E('div', { class: 'dl-row' }, [ icon('lock'), E('span', { class: 'dl-row-main dl-stack' }, [ - E('b', {}, [kind, until ? E('span', { class: 'dl-faint' }, ` · until ${until}`) : '']), + E('b', {}, [kind, until ? E('span', { class: 'dl-faint' }, ` · ${fmt(_('until %s'), until)}`) : '']), E( 'span', { class: 'dl-sub dl-ellipsis', title: c?.path ?? '' }, !c - ? 'Turn the portal on to see its certificate.' + ? _('Turn the portal on to see its certificate.') : c.self_signed - ? 'Made by the router: browsers warn until a certificate covers the address.' - : `${custom ? 'Your files' : 'Found automatically'} · ${c.path}`, + ? _('Made by the router: browsers warn until a certificate covers the address.') + : `${custom ? _('Your files') : _('Found automatically')} · ${c.path}`, ), ]), ]), E('div', { class: 'dl-row' }, [ icon('file'), E('span', { class: 'dl-row-main dl-stack' }, [ - E('b', {}, 'Your own files'), - E('span', { class: 'dl-sub' }, custom ? `${s.portal_cert} · ${s.portal_key}` : 'Not set: the certificate is picked automatically.'), + E('b', {}, _('Your own files')), + E( + 'span', + { class: 'dl-sub' }, + custom ? `${s.portal_cert} · ${s.portal_key}` : _('Not set: the certificate is picked automatically.'), + ), ]), - custom ? button('Reset', () => host.save({ portal_cert: '', portal_key: '' }, 'Automatic certificate', 'portal'), 'negative') : '', - button(custom ? 'Change' : 'Use files', certFiles), + custom + ? button(_('Reset'), () => host.save({ portal_cert: '', portal_key: '' }, _('Automatic certificate'), 'portal'), 'negative') + : '', + button(custom ? _('Change') : _('Use files'), certFiles), ]), acmeRow, ]; return section( 'portal', - 'Personal portal', + _('Personal portal'), [ - E('span', { class: 'dl-muted' }, 'A page where each person adds and manages their devices with their personal link.'), + E('span', { class: 'dl-muted' }, _('A page where each person adds and manages their devices with their personal link.')), httpsRow ? E('div', { class: 'dl-list' }, [httpsRow]) : '', - group('network', 'Port', 'How the portal listens (80 and 443 stay free)', [listenRow]), - group('edit', 'Appearance', 'What people see', [redirectRow]), - group('link', 'Addresses', 'Pick one or more; the first is the main link', [ + group('network', _('Port'), _('How the portal listens (80 and 443 stay free)'), [listenRow]), + group('edit', _('Appearance'), _('What people see'), [redirectRow]), + group('link', _('Addresses'), _('Pick one or more; the first is the main link'), [ opts, E('div', { class: 'dl-stack gap8' }, [ links, - E('span', { class: 'dl-sub' }, 'Example code; each person gets their own three words.'), + E('span', { class: 'dl-sub' }, _('Example code; each person gets their own three words.')), ]), ]), - group('lock', 'Certificate', 'Used for HTTPS links', certRows), + group('lock', _('Certificate'), _('Used for HTTPS links'), certRows), readyEl, ], [ E('span'), button( - 'Save', + _('Save'), () => { // The help lines already say what is wrong: do not send it anyway. const bad = firstBad([listenRow, redirectRow]); @@ -399,7 +415,7 @@ export function portalCard(host: SettingsHost): HTMLElement { portal_port: port.value, portal_redirect: redirect.value.trim(), }, - 'Saved', + _('Saved'), 'portal', ); }, diff --git a/web/src/admin/pages/settings/updates.ts b/web/src/admin/pages/settings/updates.ts index 8c72e51..ce7be15 100644 --- a/web/src/admin/pages/settings/updates.ts +++ b/web/src/admin/pages/settings/updates.ts @@ -8,48 +8,50 @@ import { chipToggle, input, isOn, seg, setChip, sw } from '../../ui/controls'; import { row } from '../../ui/layout'; import { notify } from '../../ui/toast'; import { timeHelp } from '../../netcheck'; +import { fmt } from '../../../shared/i18n'; import { section, type SettingsHost } from './common'; -const TARGET: [string, string][] = [ +/** The components automatic updates may install: id and chip label. */ +const targetChoices = (): [string, string][] => [ ['app', 'Dawnline'], ['amneziawg', 'AmneziaWG'], - ['packages', 'System packages'], + ['packages', _('System packages')], ]; export function updatesCard(host: SettingsHost): HTMLElement { const u = (host.d.effective as Record).updates as UpdatePolicy; - const check = sw(u.check, 'Check automatically', (v) => show(v, isOn(auto))); + const check = sw(u.check, _('Check automatically'), (v) => show(v, isOn(auto))); const every = seg( [ - ['6h', 'Every 6 h'], - ['12h', 'Every 12 h'], - ['1d', 'Daily'], - ['7d', 'Weekly'], + ['6h', _('Every 6 h')], + ['12h', _('Every 12 h')], + ['1d', _('Daily')], + ['7d', _('Weekly')], ], u.interval, - { label: 'How often', cls: 'sm' }, + { label: _('How often'), cls: 'sm' }, ); - const auto = sw(u.auto, 'Install automatically', (v) => show(isOn(check), v)); + const auto = sw(u.auto, _('Install automatically'), (v) => show(isOn(check), v)); const at = input(u.time, { placeholder: '04:00', inputmode: 'numeric', class: 'cbi-input-text dl-w-port dl-mono', - 'aria-label': 'Time', + 'aria-label': _('Time'), }); const mode = seg( [ - ['scheduled', 'At a set time'], - ['immediate', 'As soon as found'], + ['scheduled', _('At a set time')], + ['immediate', _('As soon as found')], ], u.mode, - { label: 'When', cls: 'sm', onChange: (v) => (at.hidden = v !== 'scheduled') }, + { label: _('When'), cls: 'sm', onChange: (v) => (at.hidden = v !== 'scheduled') }, ); at.hidden = u.mode !== 'scheduled'; const chosen = new Set(u.targets); const targets = E( 'div', { class: 'dl-chips-row' }, - TARGET.map(([k, t]) => { + targetChoices().map(([k, t]) => { const b = chipToggle(t, chosen.has(k), () => { if (!chosen.delete(k)) chosen.add(k); setChip(b, chosen.has(k)); @@ -57,16 +59,16 @@ export function updatesCard(host: SettingsHost): HTMLElement { return b; }), ); - const keep = sw(u.keep, 'Keep the previous version'); - const mirrors = sw(u.mirrors, 'GitHub mirrors'); - const everyRow = row('How often', every); + const keep = sw(u.keep, _('Keep the previous version')); + const mirrors = sw(u.mirrors, _('GitHub mirrors')); + const everyRow = row(_('How often'), every); const autoRows = [ row( - 'When', + _('When'), E('div', { class: 'dl-hostport' }, [mode, at]), - 'A set time keeps tunnel restarts out of the evening; the run happens within an hour of it.', + _('A set time keeps tunnel restarts out of the evening; the run happens within an hour of it.'), ), - row('Components', targets, 'AmneziaWG is off by default: a new kernel module restarts every tunnel.'), + row(_('Components'), targets, _('AmneziaWG is off by default: a new kernel module restarts every tunnel.')), ]; const show = (c: boolean, a: boolean) => { everyRow.hidden = !c; @@ -75,37 +77,37 @@ export function updatesCard(host: SettingsHost): HTMLElement { show(u.check, u.auto); return section( 'updates', - 'Updates', + _('Updates'), [ E( 'span', { class: 'dl-muted' }, - 'How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first.', + _('How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first.'), ), row( - 'Check automatically', + _('Check automatically'), check, - 'Looks for new versions in the background; Components shows what it found and the service log names it.', + _('Looks for new versions in the background; Components shows what it found and the service log names it.'), ), everyRow, - row('Install automatically', auto, 'Downloads and installs new versions of the components below.'), + row(_('Install automatically'), auto, _('Downloads and installs new versions of the components below.')), ...autoRows, row( - 'Keep the previous version', + _('Keep the previous version'), keep, - 'Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB.', + _('Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB.'), ), - row('GitHub mirrors', mirrors, 'When GitHub is unreachable, download through mirrors. Checksums are still verified.'), + row(_('GitHub mirrors'), mirrors, _('When GitHub is unreachable, download through mirrors. Checksums are still verified.')), ], [ - E('span', { class: 'dl-sub' }, 'Run a check or an update by hand in Components.'), + E('span', { class: 'dl-sub' }, _('Run a check or an update by hand in Components.')), button( - 'Save', + _('Save'), () => { if (mode.dataset.value === 'scheduled') { const h = timeHelp(at.value); if (h.bad) { - notify(`Time: ${h.text}`, 'warning'); + notify(fmt(_('Time: %s'), h.text), 'warning'); return; } } @@ -120,7 +122,7 @@ export function updatesCard(host: SettingsHost): HTMLElement { update_keep: isOn(keep) ? '1' : '0', update_mirrors: isOn(mirrors) ? '1' : '0', }, - 'Saved', + _('Saved'), 'updates', ); }, diff --git a/web/src/admin/pkgs.ts b/web/src/admin/pkgs.ts index 5a1ff06..086b99d 100644 --- a/web/src/admin/pkgs.ts +++ b/web/src/admin/pkgs.ts @@ -5,18 +5,24 @@ import { api, type Needs } from './api'; import { attempt } from './ui/toast'; import { confirmDialog } from './ui/modal'; import { runOperation } from './updater/operation'; +import { fmt } from '../shared/i18n'; -const WHAT: Record = { - https: 'HTTPS for the portal', - acme: 'ACME certificates', - home: 'the home-like link', - awg: 'AmneziaWG', -}; +/** What installing a feature's packages is called: the question, then the operation's title. */ +function texts(feature: keyof Needs): [string, string] { + const t: Record = { + https: [_('Install HTTPS for the portal?'), _('Installing HTTPS for the portal')], + acme: [_('Install ACME certificates?'), _('Installing ACME certificates')], + home: [_('Install the home-like link?'), _('Installing the home-like link')], + awg: [_('Install AmneziaWG?'), _('Installing AmneziaWG')], + }; + return t[feature]; +} /** Ask, then wait for the job; after it `done` runs once the service had a moment to pick the packages up. */ -async function install(what: string, label: string, body: string, done?: () => void): Promise { - if (!(await confirmDialog(`Install ${label}?`, body, 'Install'))) return false; - const job = await runOperation(what, { title: `Installing ${label}` }); +async function install(what: string, feature: keyof Needs, body: string, done?: () => void): Promise { + const [ask, title] = texts(feature); + if (!(await confirmDialog(ask, body, _('Install')))) return false; + const job = await runOperation(what, { title }); if (job?.state !== 'done') return false; // The service restarts to pick them up; give it a moment before reloading. setTimeout(() => done?.(), 4000); @@ -31,8 +37,10 @@ async function install(what: string, label: string, body: string, done?: () => v export function installAwg(done?: () => void): Promise { return install( 'amneziawg:auto', - 'AmneziaWG', - 'Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds.', + 'awg', + _( + 'Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds.', + ), done, ); } @@ -43,8 +51,8 @@ export async function installMissing(feature: keyof Needs, names: string[], done if (!names.length) return true; return install( `pkgs:${names.join(',')}`, - WHAT[feature], - `${names.join(', ')} from the OpenWrt feeds. Dawnline sets the rest up when they arrive.`, + feature, + fmt(_('%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive.'), names.join(', ')), done, ); } diff --git a/web/src/admin/places/model.ts b/web/src/admin/places/model.ts index 4578f3c..92f2383 100644 --- a/web/src/admin/places/model.ts +++ b/web/src/admin/places/model.ts @@ -3,6 +3,7 @@ // stays for the replay, and the replay's timeline and shimmer. No DOM here (see ./render). import type { GeoPoint, LogEvent } from '../../shared/types'; +import { locale } from '../../shared/i18n'; /** On one client address: from a connect or a roam to the next one, a disconnect or now. */ export interface Stretch { @@ -219,14 +220,14 @@ export function ticks(range: '24h' | '7d' | '30d', now: number): [number, string } else if (range === '7d') { d.setHours(12, 0, 0, 0); for (; d.getTime() / 1000 <= now; d.setDate(d.getDate() + 1)) - put(d.getTime() / 1000, d.toLocaleDateString('en-GB', { weekday: 'short' })); + put(d.getTime() / 1000, d.toLocaleDateString(locale(), { weekday: 'short' })); } else { const end = new Date(now * 1000); end.setHours(0, 0, 0, 0); for (let i = 0; i < 5; i++) { const w = new Date(end); w.setDate(end.getDate() - 7 * i); - put(w.getTime() / 1000, w.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })); + put(w.getTime() / 1000, w.toLocaleDateString(locale(), { day: 'numeric', month: 'short' })); } out.reverse(); } @@ -234,12 +235,12 @@ export function ticks(range: '24h' | '7d' | '30d', now: number): [number, string } /** "14:05", local. */ -export const clock = (ts: number) => new Date(ts * 1000).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' }); +export const clock = (ts: number) => new Date(ts * 1000).toLocaleTimeString(locale(), { hour: '2-digit', minute: '2-digit' }); /** "Today", "Yesterday" or "Wed 14 Oct" for a moment, against the router's `now`. */ export function dayName(ts: number, now: number): string { const day = (x: number) => new Date(x * 1000).toDateString(); - if (day(ts) === day(now)) return 'Today'; - if (day(ts) === day(now - 86400)) return 'Yesterday'; - return new Date(ts * 1000).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' }); + if (day(ts) === day(now)) return _('Today'); + if (day(ts) === day(now - 86400)) return _('Yesterday'); + return new Date(ts * 1000).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }); } diff --git a/web/src/admin/places/render.ts b/web/src/admin/places/render.ts index cc72dee..05f2e0b 100644 --- a/web/src/admin/places/render.ts +++ b/web/src/admin/places/render.ts @@ -7,6 +7,7 @@ import type { Device, Geo, LogEvent, Person } from '../../shared/types'; import { E } from '../e'; import { icon } from '../../shared/icons'; import { ago } from '../../shared/format'; +import { fmt } from '../../shared/i18n'; import { devicePlaces, type ConnectionMap, type MapData, type Range } from '../map'; import { MOVE_MS, @@ -63,7 +64,7 @@ export class PlacesView { private endTimer = 0; private play = E('button', { type: 'button', class: 'dl-map-btn' }); private chip = E('span', { class: 'dl-map-chip' }); - private stop = E('button', { type: 'button', class: 'dl-map-btn', title: 'Back to now', 'aria-label': 'Back to now' }, icon('x')); + private stop = E('button', { type: 'button', class: 'dl-map-btn', title: _('Back to now'), 'aria-label': _('Back to now') }, icon('x')); private reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false; constructor( @@ -137,13 +138,13 @@ export class PlacesView { const row = E('div', { class: 'dl-dplace-row' }, [ E('span', { class: `dl-dplace-n${x.online ? ' live' : ''}` }, x.online ? icon(d.device.kind) : String(x.n)), E('span', { class: 'dl-row-main dl-stack' }, [ - E('span', {}, [x.city || x.cc || 'Unknown city', x.org ? E('span', { class: 'dl-muted' }, ` · ${x.org}`) : '']), + E('span', {}, [x.city || x.cc || _('Unknown city'), x.org ? E('span', { class: 'dl-muted' }, ` · ${x.org}`) : '']), E('span', { class: 'dl-faint' }, [ E('span', { class: 'dl-mono' }, x.ip), - sh != null ? ` · ${sh > 0 && sh < 0.005 ? '<1' : Math.round(sh * 100)}% of the time` : '', + sh != null ? ` · ${fmt(_('%s%% of the time'), sh > 0 && sh < 0.005 ? '<1' : Math.round(sh * 100))}` : '', ]), ]), - E('span', { class: x.online ? 'dl-dplace-now' : 'dl-faint dl-nowrap' }, x.online ? 'now' : ago(x.ts, d.now)), + E('span', { class: x.online ? 'dl-dplace-now' : 'dl-faint dl-nowrap' }, x.online ? _('now') : ago(x.ts, d.now)), strip, ]); row.addEventListener('mouseenter', () => this.map.hoverPlace(key)); @@ -173,14 +174,14 @@ export class PlacesView { ) : '', ] - : E('div', { class: 'dl-sub' }, 'No locations in this period.'), + : E('div', { class: 'dl-sub' }, _('No locations in this period.')), ); this.paintControls(); } private paintControls() { dom.content(this.play, icon(this.playing ? 'pause' : 'play')); - this.play.title = this.playing ? 'Pause' : 'Replay this period'; + this.play.title = this.playing ? _('Pause', 'replay') : _('Replay this period'); this.play.setAttribute('aria-label', this.play.title); // LuCI's dom.content takes one level of children: no nested arrays. dom.content(this.controls, this.on ? [this.play, this.chip, this.stop] : this.st.length > 1 ? [this.play] : []); diff --git a/web/src/admin/state/live.ts b/web/src/admin/state/live.ts index f75b97e..a9f4757 100644 --- a/web/src/admin/state/live.ts +++ b/web/src/admin/state/live.ts @@ -5,6 +5,7 @@ import { api } from '../api'; import { notify } from '../ui/toast'; +import { fmt } from '../../shared/i18n'; const EVERY = 2; @@ -22,7 +23,7 @@ async function tick(): Promise { // and RPC shapes may not match any more. if (r.version) { if (version && r.version !== version) { - notify(`Dawnline was updated to ${r.version}: reload the page.`, 'warning', 15000); + notify(fmt(_('Dawnline was updated to %s: reload the page.'), r.version), 'warning', 15000); version = null; } else version ??= r.version; } diff --git a/web/src/admin/state/poller.ts b/web/src/admin/state/poller.ts index c32abc6..9cc146d 100644 --- a/web/src/admin/state/poller.ts +++ b/web/src/admin/state/poller.ts @@ -64,10 +64,10 @@ export function createPoller(o: PollerOptions): Poller { let d: T | null = null; try { d = await o.fetch(live); - if (failed >= LOST_AFTER) notify('The router answers again.', 'success', 3000); + if (failed >= LOST_AFTER) notify(_('The router answers again.'), 'success', 3000); failed = 0; } catch { - if (++failed === LOST_AFTER) notify('The router is not answering: what you see may be out of date.', 'warning', 8000); + if (++failed === LOST_AFTER) notify(_('The router is not answering: what you see may be out of date.'), 'warning', 8000); return null; } if (d == null || !seq.take(t)) return null; diff --git a/web/src/admin/ui/badges.ts b/web/src/admin/ui/badges.ts index ed44721..dda5ce8 100644 --- a/web/src/admin/ui/badges.ts +++ b/web/src/admin/ui/badges.ts @@ -3,7 +3,8 @@ import type { Device, Person } from '../../shared/types'; import { E } from '../e'; import { icon } from '../../shared/icons'; -import { ACCESS_LABEL, STATE_LABEL, ago } from '../../shared/format'; +import { accessLabel, stateLabel, ago } from '../../shared/format'; +import { fmt, locale, plural } from '../../shared/i18n'; import { attachTip } from './tooltip'; export function pill(tone: string, text: string, title?: string): HTMLElement { @@ -29,7 +30,7 @@ function ownState(p: Person): Person['state'] { export function statePill(p: Person): HTMLElement | '' { const s = ownState(p); if (s === 'active' || s === 'server_off') return ''; - return pill(stateTone({ ...p, state: s }), STATE_LABEL[s]); + return pill(stateTone({ ...p, state: s }), stateLabel(s)); } /** What the person can reach, as icons: home network, internet, or both. */ @@ -37,27 +38,30 @@ export function accessBadge(p: Person): HTMLElement { const kinds = p.access === 'both' ? ['lan', 'inet'] : p.access === 'lan' ? ['lan'] : ['inet']; const el = E( 'span', - { class: 'dl-access', 'aria-label': ACCESS_LABEL[p.access] }, + { class: 'dl-access', 'aria-label': accessLabel(p.access) }, kinds.map((k) => E('span', { class: `dl-ibadge ${k}` }, icon(k === 'lan' ? 'home' : 'globe'))), ); attachTip(el, () => [ - E('div', { class: 'dl-tip-title' }, ACCESS_LABEL[p.access]), + E('div', { class: 'dl-tip-title' }, accessLabel(p.access)), p.access === 'lan' && p.services?.length - ? E('div', { class: 'dl-muted' }, `${p.services.length} home service${p.services.length === 1 ? '' : 's'} only`) + ? E('div', { class: 'dl-muted' }, plural(p.services.length, '%s home service only', '%s home services only')) : '', ]); return el; } -/** Why a person's devices cannot connect right now, in two words. */ -const STOPPED: Partial> = { - paused: 'Paused', - expired: 'Access ended', - quota: 'Data limit', - hours: 'Outside hours', - server_off: 'Server off', - no_server: 'No server', -}; +/** Why a person's devices cannot connect right now, in two words; null while they can. */ +function stoppedLabel(s: Person['state']): string | null { + return { + active: null, + paused: _('Paused'), + expired: _('Access ended'), + quota: _('Data limit'), + hours: _('Outside hours'), + server_off: _('Server off'), + no_server: _('No server'), + }[s]; +} /** * A device's status as coloured text, no dots (only avatars carry one). `now` @@ -65,12 +69,13 @@ const STOPPED: Partial> = { * With the person, a device that cannot come back says why ("Paused", * "Data limit") instead of a "Last seen" that reads like it might. */ -export function deviceStatus(d: Device, now?: number, waiting = 'Not set up yet', p?: Person): HTMLElement { - const seen = d.handshake ? `Last seen ${ago(d.handshake, now)} · ${new Date(d.handshake * 1000).toLocaleString()}` : ''; - if (d.disabled) return E('span', { class: 'dl-dstat', title: seen }, 'Disabled'); - if (d.online) return E('span', { class: 'dl-dstat ok' }, 'Connected'); - const why = p && STOPPED[p.state]; - if (why) return E('span', { class: 'dl-dstat warn', title: seen || 'Not connected yet' }, why); - if (!d.handshake) return E('span', { class: 'dl-dstat warn', title: 'Waiting for the first connection' }, waiting); - return E('span', { class: 'dl-dstat', title: new Date(d.handshake * 1000).toLocaleString() }, `Last seen ${ago(d.handshake, now)}`); +export function deviceStatus(d: Device, now?: number, waiting = _('Not set up yet'), p?: Person): HTMLElement { + const at = new Date(d.handshake * 1000).toLocaleString(locale()); + const seen = d.handshake ? `${fmt(_('Last seen %s'), ago(d.handshake, now))} · ${at}` : ''; + if (d.disabled) return E('span', { class: 'dl-dstat', title: seen }, _('Disabled')); + if (d.online) return E('span', { class: 'dl-dstat ok' }, _('Connected')); + const why = p && stoppedLabel(p.state); + if (why) return E('span', { class: 'dl-dstat warn', title: seen || _('Not connected yet') }, why); + if (!d.handshake) return E('span', { class: 'dl-dstat warn', title: _('Waiting for the first connection') }, waiting); + return E('span', { class: 'dl-dstat', title: at }, fmt(_('Last seen %s'), ago(d.handshake, now))); } diff --git a/web/src/admin/ui/drawer.ts b/web/src/admin/ui/drawer.ts index 9255ff7..7a4ea3e 100644 --- a/web/src/admin/ui/drawer.ts +++ b/web/src/admin/ui/drawer.ts @@ -17,7 +17,7 @@ export function drawer(title: Node, body: Node, foot: Node | null, onClose: () = const panel = E('aside', { class: 'dl-drawer', role: 'dialog', 'aria-modal': 'true' }, [ E('div', { class: 'dl-drawer-head' }, [ title, - E('button', { type: 'button', class: 'dl-drawer-x', 'aria-label': 'Close', click: () => close() }, icon('x')), + E('button', { type: 'button', class: 'dl-drawer-x', 'aria-label': _('Close'), click: () => close() }, icon('x')), ]), E('div', { class: 'dl-drawer-body' }, body), foot ? E('div', { class: 'dl-drawer-foot' }, foot) : '', diff --git a/web/src/admin/ui/files.ts b/web/src/admin/ui/files.ts index c194431..65c6f9c 100644 --- a/web/src/admin/ui/files.ts +++ b/web/src/admin/ui/files.ts @@ -9,7 +9,7 @@ import { errorText, notify } from './toast'; * refuse a write outside the click that started it (Safari after an await), * and then nothing is said — the link is on screen with its own Copy button. */ -export async function copyText(text: string, what = 'Copied to clipboard', quiet = false): Promise { +export async function copyText(text: string, what = _('Copied to clipboard'), quiet = false): Promise { try { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(text); @@ -19,7 +19,7 @@ export async function copyText(text: string, what = 'Copied to clipboard', quiet ta.select(); const ok = document.execCommand('copy'); ta.remove(); - if (!ok) throw new Error('Copying is blocked here. Select the text and copy it by hand.'); + if (!ok) throw new Error(_('Copying is blocked here. Select the text and copy it by hand.')); } notify(what, 'success', 2500); return true; diff --git a/web/src/admin/ui/modal.ts b/web/src/admin/ui/modal.ts index 19bce67..6f79fbf 100644 --- a/web/src/admin/ui/modal.ts +++ b/web/src/admin/ui/modal.ts @@ -46,7 +46,7 @@ export function closeModal() { } /** "Cancel" (or another label) that closes the modal. */ -export function cancelButton(label = 'Cancel', danger = false): HTMLElement { +export function cancelButton(label = _('Cancel'), danger = false): HTMLElement { return E( 'button', { class: `cbi-button ${danger ? 'cbi-button-negative' : 'cbi-button-neutral'}`, type: 'button', click: closeModal }, @@ -54,7 +54,7 @@ export function cancelButton(label = 'Cancel', danger = false): HTMLElement { ); } -export function confirmDialog(title: string, body: Child, confirmLabel = 'Confirm', danger = false): Promise { +export function confirmDialog(title: string, body: Child, confirmLabel = _('Confirm'), danger = false): Promise { return new Promise((resolve) => { modal(title, body, [ cancelButton(), diff --git a/web/src/admin/ui/toast.ts b/web/src/admin/ui/toast.ts index 4c2b7f1..eec10df 100644 --- a/web/src/admin/ui/toast.ts +++ b/web/src/admin/ui/toast.ts @@ -22,13 +22,14 @@ export function notify(message: Child, tone: Tone = 'info', timeout = 0) { const t = E('div', { class: `dl-toast ${tone}` }, [ ic ? icon(ic) : '', E('span', {}, message), - tone === 'error' ? E('button', { type: 'button', 'aria-label': 'Close', click: close }, icon('x')) : '', + tone === 'error' ? E('button', { type: 'button', 'aria-label': _('Close'), click: close }, icon('x')) : '', ]); stack.appendChild(t); requestAnimationFrame(() => t.classList.add('show')); setTimeout(close, timeout || (tone === 'error' ? 8000 : tone === 'warning' ? 5000 : 2600)); } +/** A failure's message as it came: the router's own text for RPC failures. */ export function errorText(e: unknown): string { return e instanceof Error ? e.message : String(e); } diff --git a/web/src/admin/updater/jobs.ts b/web/src/admin/updater/jobs.ts index d9e8b90..2b0fc10 100644 --- a/web/src/admin/updater/jobs.ts +++ b/web/src/admin/updater/jobs.ts @@ -2,13 +2,14 @@ // timer and what a finished check found. Pure (no DOM, no RPC). import type { UpdateJob, UpdatesStatus } from '../api'; +import { fmt, plural } from '../../shared/i18n'; -export const NAME: Record = { - app: 'Dawnline', - amneziawg: 'AmneziaWG', - packages: 'System packages', - pkgs: 'System packages', -}; +/** A component's name in words; undefined for "all" and unknown ones. */ +export function componentName(comp: string): string | undefined { + if (comp === 'app') return 'Dawnline'; + if (comp === 'amneziawg') return 'AmneziaWG'; + return comp === 'packages' || comp === 'pkgs' ? _('System packages') : undefined; +} /** "app@0.3.1" → "app"; "check:amneziawg" → "amneziawg"; "check" → "all"; "pkgs:a,b" → "pkgs". */ export function jobComponent(what: string): string { @@ -49,17 +50,17 @@ export function checkVerdict(st: Pick, comp: string): Ve const c = all[k]; if (!c) continue; if (c.error) return { tone: 'warn', text: c.error }; - if (k === 'packages' && c.updates) found.push(`${c.updates} system package${c.updates === 1 ? '' : 's'}`); + if (k === 'packages' && c.updates) found.push(plural(c.updates, '%s system package', '%s system packages')); else if (k !== 'packages' && c.update && c.installed && c.latest) { - found.push(`${NAME[k]} ${c.latest}`); + found.push(`${componentName(k)} ${c.latest}`); if (comp !== 'all') update = c.latest; } } - if (found.length) return { tone: 'acc', text: `Update available: ${found.join(', ')}`, update }; + if (found.length) return { tone: 'acc', text: fmt(_('Update available: %s'), found.join(', ')), update }; const one = list.length === 1 ? all[list[0]] : null; - if (one?.status === 'dev') return { tone: 'acc', text: `Installed version is newer than the release (${one.latest})` }; + if (one?.status === 'dev') return { tone: 'acc', text: fmt(_('Installed version is newer than the release (%s)'), one.latest) }; if (one?.note) return { tone: 'warn', text: one.note }; - return { tone: 'ok', text: list.length > 1 ? 'Everything is up to date' : 'Latest version is installed' }; + return { tone: 'ok', text: list.length > 1 ? _('Everything is up to date') : _('Latest version is installed') }; } /** diff --git a/web/src/admin/updater/notes.ts b/web/src/admin/updater/notes.ts index 1be16e2..9e7d6f8 100644 --- a/web/src/admin/updater/notes.ts +++ b/web/src/admin/updater/notes.ts @@ -11,13 +11,13 @@ import { errorText } from '../ui/toast'; import { forRouter, markdown, safeHref } from './markdown'; export async function whatsNew(component: 'app' | 'amneziawg', tag: string, title: string, build?: string) { - const body = E('div', { class: 'dl-notes' }, E('p', { class: 'dl-muted dl-loading' }, 'Loading release notes…')); + const body = E('div', { class: 'dl-notes' }, E('p', { class: 'dl-muted dl-loading' }, _('Loading release notes…'))); const meta = E('div', { class: 'dl-op-head' }); let text = ''; modal( title, [meta, body], - [button([icon('copy'), ' Copy'], () => copyText(text, 'Release notes copied')), ' ', cancelButton('Close')], + [button([icon('copy'), ' ', _('Copy')], () => copyText(text, _('Release notes copied'))), ' ', cancelButton(_('Close'))], 'wide', ); try { @@ -26,11 +26,11 @@ export async function whatsNew(component: 'app' | 'amneziawg', tag: string, titl const href = safeHref(r.url); dom.content(meta, [ r.published ? E('span', { class: 'dl-pill' }, fmtDay(r.published)) : '', - r.prerelease ? E('span', { class: 'dl-pill warn' }, 'Pre-release') : '', + r.prerelease ? E('span', { class: 'dl-pill warn' }, _('Pre-release')) : '', E('span', { class: 'dl-spacer' }), - href ? E('a', { href, target: '_blank', rel: 'noopener', class: 'dl-linkbtn' }, ['On GitHub ', icon('open')]) : '', + href ? E('a', { href, target: '_blank', rel: 'noopener', class: 'dl-linkbtn' }, [_('On GitHub'), ' ', icon('open')]) : '', ]); - dom.content(body, text.trim() ? markdown(text) : E('p', { class: 'dl-muted' }, 'This release has no notes.')); + dom.content(body, text.trim() ? markdown(text) : E('p', { class: 'dl-muted' }, _('This release has no notes.'))); } catch (e) { dom.content(body, E('p', { class: 'dl-muted' }, errorText(e))); } diff --git a/web/src/admin/updater/operation.ts b/web/src/admin/updater/operation.ts index c305efd..6760018 100644 --- a/web/src/admin/updater/operation.ts +++ b/web/src/admin/updater/operation.ts @@ -9,7 +9,8 @@ import { button, iconButton } from '../ui/button'; import { cancelButton, closeModal, modal } from '../ui/modal'; import { copyText } from '../ui/files'; import { errorText, notify } from '../ui/toast'; -import { NAME, checkVerdict, isOurJob, jobComponent, mmss, runningComponent, verText } from './jobs'; +import { fmt } from '../../shared/i18n'; +import { checkVerdict, componentName, isOurJob, jobComponent, mmss, runningComponent, verText } from './jobs'; export interface OpOptions { /** Modal title, e.g. "Updating Dawnline". */ @@ -35,16 +36,16 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U const comp = follow ? runningComponent(follow) : jobComponent(what!); const isCheck = follow ? follow.action === 'check' : what!.startsWith('check'); const opened = Date.now(); - const name = E('b', {}, NAME[comp] ?? (comp === 'all' ? 'All components' : 'Dawnline')); + const name = E('b', {}, componentName(comp) ?? (comp === 'all' ? _('All components') : 'Dawnline')); const ver = E('span', { class: 'dl-pill dl-mono' }, o.version ?? ''); const phase = E('span', { class: 'dl-pill info', hidden: true }); const timer = E('span', {}, '0:00'); - const log = E('pre', { class: 'dl-log' }, 'Operation started. Waiting for log output…'); + const log = E('pre', { class: 'dl-log' }, _('Operation started. Waiting for log output…')); const result = E('div', {}); const actions = E('div', { class: 'dl-op-actions' }); let lines: string[] = []; const setActions = (nodes: Node[]) => dom.content(actions, nodes); - const closeBtn = (danger = false) => cancelButton('Close', danger); + const closeBtn = (danger = false) => cancelButton(_('Close'), danger); modal( o.title, @@ -57,8 +58,8 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U E('span', { class: 'dl-faint dl-op-timer' }, [icon('clock'), timer]), ]), E('div', { class: 'dl-op-loghead' }, [ - E('b', {}, 'Operation log'), - iconButton('copy', 'Copy log', () => copyText(lines.join('\n'), 'Log copied')), + E('b', {}, _('Operation log')), + iconButton('copy', _('Copy log'), () => copyText(lines.join('\n'), _('Log copied'))), ]), log, result, @@ -70,7 +71,7 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U E( 'button', { class: 'cbi-button cbi-button-neutral spinning', type: 'button', disabled: 'disabled' }, - isCheck ? 'Checking…' : 'Working…', + isCheck ? _('Checking…') : _('Working…'), ), ]); @@ -144,12 +145,12 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U phase.hidden = false; if (!job || job.state === 'running') { phase.className = 'dl-pill warn'; - phase.textContent = 'No answer'; + phase.textContent = _('No answer'); dom.content( result, E('div', { class: 'dl-comp-status warn' }, [ icon('alert'), - E('span', {}, 'The router stopped answering. The job may still finish: reopen Components in a minute.'), + E('span', {}, _('The router stopped answering. The job may still finish: reopen Components in a minute.')), ]), ); setActions([closeBtn()]); @@ -158,21 +159,25 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U } if (job.state === 'failed') { phase.className = 'dl-pill bad'; - phase.textContent = 'Failed'; + phase.textContent = _('Failed'); dom.content( result, E('div', { class: 'dl-comp-status bad' }, [ icon('x'), - E('span', {}, [E('b', {}, job.error ?? 'Operation failed'), isCheck ? '' : '. Nothing else was changed.']), + // The router's error may end its own sentence: one full stop either way. + E('span', {}, [ + E('b', {}, (job.error ?? _('Operation failed')).replace(/\.$/, '')), + isCheck ? '' : `. ${_('Nothing else was changed.')}`, + ]), ]), ); - setActions([button('Copy log', () => copyText(lines.join('\n'), 'Log copied')), closeBtn(true)]); - notify(`${NAME[comp] ?? 'Update'}: ${job.error ?? 'failed'}`, 'error'); + setActions([button(_('Copy log'), () => copyText(lines.join('\n'), _('Log copied'))), closeBtn(true)]); + notify(`${componentName(comp) ?? _('Update', 'noun')}: ${job.error ?? _('failed')}`, 'error'); o.onDone?.(st); return job; } phase.className = 'dl-pill ok'; - phase.textContent = 'Finished'; + phase.textContent = _('Finished'); if (isCheck && st) { const v = checkVerdict(st, comp); dom.content( @@ -186,7 +191,7 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U o.onDone?.(st); if (v.update && o.onUpdate) { const s = st; - setActions([closeBtn(), button(`Update to ${v.update}`, () => o.onUpdate!(s), 'positive')]); + setActions([closeBtn(), button(fmt(_('Update to %s'), v.update), () => o.onUpdate!(s), 'positive')]); } else { setActions([closeBtn()]); // Nothing to do: the modal goes away on its own (as in the check toast). @@ -194,39 +199,71 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U } return job; } + // The admin's translation: LuCI's web server restarts two seconds after the + // job to read it (or forget it); the page then reloads in its new language. + const lang = /^app:(lang:|nolang$)/.exec(job.component ?? ''); + if (lang) { + const reload = () => { + ui.menu?.flushCache(); + location.reload(); + }; + dom.content( + result, + E('div', { class: 'dl-comp-status ok' }, [ + icon('check'), + E('span', {}, [ + E('b', {}, lang[1] === 'nolang' ? _('The translation is removed.') : _('The translation is installed.')), + ' ', + _('Reloading the page…'), + ]), + ]), + ); + setActions([closeBtn(), button(_('Reload now'), reload, 'positive')]); + await sleep(4000); + if (result.isConnected) reload(); + return job; + } // Dawnline itself: rpcd and the service restart; reload the page once they answer with the new version. if (comp === 'app' && job.to) { const target = job.to; - const msg = E('span', {}, 'Waiting for the router to restart its services…'); + const msg = E('span', {}, _('Waiting for the router to restart its services…')); dom.content( result, - E('div', { class: 'dl-comp-status ok' }, [icon('check'), E('span', {}, [E('b', {}, `Dawnline ${target} is installed. `), msg])]), + E('div', { class: 'dl-comp-status ok' }, [ + icon('check'), + E('span', {}, [E('b', {}, fmt(_('Dawnline %s is installed.'), target)), ' ', msg]), + ]), ); const reload = () => { ui.menu?.flushCache(); location.reload(); }; - setActions([closeBtn(), button('Reload now', reload, 'positive')]); - notify(`Dawnline updated to ${target}`, 'success', 6000); + setActions([closeBtn(), button(_('Reload now'), reload, 'positive')]); + notify(fmt(_('Dawnline updated to %s'), target), 'success', 6000); for (let n = 1; n <= 30; n++) { - msg.textContent = `Waiting for the router to restart its services (${n} of 30)…`; + msg.textContent = fmt(_('Waiting for the router to restart its services (%s of 30)…'), n); await sleep(1500); const s = await api.updatesStatus().catch(() => null); if (s?.version === target) { - msg.textContent = 'Services are back. Reloading…'; + msg.textContent = _('Services are back. Reloading…'); setTimeout(reload, 800); return job; } } - msg.textContent = 'Services restarted. Reload the page to use the new version.'; + msg.textContent = _('Services restarted. Reload the page to use the new version.'); return job; } + const changed = [...((job.result?.pkgs?.updated as string[]) ?? []), ...((job.result?.pkgs?.installed as string[]) ?? [])]; const done = comp === 'pkgs' - ? `Updated ${[...((job.result?.pkgs?.updated as string[]) ?? []), ...((job.result?.pkgs?.installed as string[]) ?? [])].join(', ') || 'system packages'}` + ? changed.length + ? fmt(_('Updated %s'), changed.join(', ')) + : _('Updated system packages') : comp === 'amneziawg' - ? `AmneziaWG${job.to ? ` ${job.to}` : ''} is installed` - : 'Operation completed'; + ? job.to + ? fmt(_('AmneziaWG %s is installed'), job.to) + : _('AmneziaWG is installed') + : _('Operation completed'); dom.content(result, E('div', { class: 'dl-comp-status ok' }, [icon('check'), E('span', {}, done)])); setActions([closeBtn()]); notify(done, 'success'); diff --git a/web/src/admin/widgets/access-picker.ts b/web/src/admin/widgets/access-picker.ts index 5d52bde..aa860af 100644 --- a/web/src/admin/widgets/access-picker.ts +++ b/web/src/admin/widgets/access-picker.ts @@ -3,15 +3,15 @@ import type { Person } from '../../shared/types'; import { E } from '../e'; import { icon } from '../../shared/icons'; -import { ACCESS_LABEL } from '../../shared/format'; +import { accessLabel } from '../../shared/format'; /** Returns the element and a getter. */ export function accessPicker(initial: Person['access'], onChange?: (v: Person['access']) => void) { let value = initial; const opts: { v: Person['access']; ic: string; text: string }[] = [ - { v: 'internet', ic: 'globe', text: 'Browse the internet through your router. No access to devices at home.' }, - { v: 'lan', ic: 'home', text: 'Reach devices at home (NAS, printer, cameras). Internet stays on their own connection.' }, - { v: 'both', ic: 'shield', text: 'Home devices and the internet, all through your router.' }, + { v: 'internet', ic: 'globe', text: _('Browse the internet through your router. No access to devices at home.') }, + { v: 'lan', ic: 'home', text: _('Reach devices at home (NAS, printer, cameras). Internet stays on their own connection.') }, + { v: 'both', ic: 'shield', text: _('Home devices and the internet, all through your router.') }, ]; const el = E( 'div', @@ -29,7 +29,7 @@ export function accessPicker(initial: Person['access'], onChange?: (v: Person['a onChange?.(o.v); }, }, - [E('span', { class: 'dl-choice-title' }, [icon(o.ic), ACCESS_LABEL[o.v]]), E('span', { class: 'dl-choice-text' }, o.text)], + [E('span', { class: 'dl-choice-title' }, [icon(o.ic), accessLabel(o.v)]), E('span', { class: 'dl-choice-text' }, o.text)], ), ), ); diff --git a/web/src/admin/widgets/health.ts b/web/src/admin/widgets/health.ts index bce8d62..dfe06ef 100644 --- a/web/src/admin/widgets/health.ts +++ b/web/src/admin/widgets/health.ts @@ -10,23 +10,32 @@ import { button, type ButtonKind } from '../ui/button'; import { confirmDialog } from '../ui/modal'; import { attempt } from '../ui/toast'; import { needRow } from '../ui/layout'; +import { fmt, num } from '../../shared/i18n'; -const FIX_LABEL: Record = { - apply: 'Repair', - sync: 'Reload devices', - restart: 'Restart service', - netrestart: 'Restart network', - updates: 'Open Components', -}; +/** The button of a backend fix, by its id. */ +function fixLabel(fix: string): string { + const labels: Record = { + apply: _('Repair'), + sync: _('Reload devices'), + restart: _('Restart service'), + netrestart: _('Restart network'), + updates: _('Open Components'), + }; + return labels[fix] ?? _('Fix'); +} /** Run a backend fix (a network restart asks first); the checks again, or null. */ export async function runFix(fix: string): Promise { if ( fix === 'netrestart' && - !(await confirmDialog('Restart the network?', 'Every interface restarts. Connections drop for a few seconds.', 'Restart network')) + !(await confirmDialog( + _('Restart the network?'), + _('Every interface restarts. Connections drop for a few seconds.'), + _('Restart network'), + )) ) return null; - return (await attempt(() => api.healthFix(fix), 'Done')) ?? null; + return (await attempt(() => api.healthFix(fix), _('Done'))) ?? null; } /** @@ -37,10 +46,10 @@ export function fixAction(c: HealthCheck, run: (fix: string) => void, refresh: ( const fix = c.fix; if (!fix) return ''; // install:awg installs AmneziaWG itself (the build for this firmware), the rest come from the feeds. - if (fix.startsWith('install:')) return button('Install', () => installFeature(fix.slice(8) as keyof Needs, refresh), kind); + if (fix.startsWith('install:')) return button(_('Install'), () => installFeature(fix.slice(8) as keyof Needs, refresh), kind); if (fix === 'updates') - return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/network/dawnline/updates') }, FIX_LABEL.updates); - return button(FIX_LABEL[fix] ?? 'Fix', () => run(fix), kind); + return E('a', { class: `cbi-button cbi-button-${kind}`, href: L.url('admin/network/dawnline/updates') }, fixLabel(fix)); + return button(fixLabel(fix), () => run(fix), kind); } /** The icon tile of a check's notice, by what it is about. */ @@ -69,6 +78,7 @@ export function healthNotices(checks: HealthCheck[], run: (fix: string) => void, return E('div', { class: 'dl-list dl-notices' }, [ ...bad .slice(0, max) + // The check's problem, title and detail come from the router. .map((c) => needRow( checkIcon(c.id), @@ -80,7 +90,7 @@ export function healthNotices(checks: HealthCheck[], run: (fix: string) => void, ), rest > 0 ? E('a', { class: 'dl-row dl-notices-more', href: L.url('admin/network/dawnline/diagnostics') }, [ - `${rest} more in Diagnostics`, + fmt(_('%s more in Diagnostics'), num(rest)), E('span', { class: 'dl-spacer' }), '→', ]) diff --git a/web/src/admin/widgets/spark.ts b/web/src/admin/widgets/spark.ts index cb10d47..157168c 100644 --- a/web/src/admin/widgets/spark.ts +++ b/web/src/admin/widgets/spark.ts @@ -3,6 +3,7 @@ import { E } from '../e'; import { addDays, bytes, isoDay, parseDay } from '../../shared/format'; import { attachTip } from '../ui/tooltip'; +import { locale } from '../../shared/i18n'; /** `today` is the router's day (YYYY-MM-DD), so the labels follow its calendar. */ export function spark(values: number[], width = 120, height = 26, today = isoDay(new Date())): HTMLElement { @@ -20,10 +21,10 @@ export function spark(values: number[], width = 120, height = 26, today = isoDay 'div', { class: 'dl-tip-title' }, back === 0 - ? 'Today' + ? _('Today') : back === 1 - ? 'Yesterday' - : parseDay(addDays(today, -back)).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' }), + ? _('Yesterday') + : parseDay(addDays(today, -back)).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }), ), E('div', { class: 'dl-muted' }, bytes(v)), ]); diff --git a/web/src/admin/widgets/tiles.ts b/web/src/admin/widgets/tiles.ts index 6d08162..05ae7ab 100644 --- a/web/src/admin/widgets/tiles.ts +++ b/web/src/admin/widgets/tiles.ts @@ -4,10 +4,11 @@ import type { DayUsage } from '../../shared/types'; import { E } from '../e'; import { bits, bytes, parseDay } from '../../shared/format'; +import { fill, fmt, locale } from '../../shared/i18n'; import { attachTip } from '../ui/tooltip'; import { svg } from '../ui/layout'; -const dayLabel = (day: string) => parseDay(day).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }); +const dayLabel = (day: string) => parseDay(day).toLocaleDateString(locale(), { day: 'numeric', month: 'short' }); /** * Throughput over the last 15 minutes plus today's total. `off`: the server is @@ -33,7 +34,7 @@ export function speedTile(rate: [number, number, number][], now: number, today: `` + ``, ) - : E('div', { class: 'dl-speed-wait' }, [E('i'), off ? '' : E('span', {}, 'Collecting… 1 point a minute')]); + : E('div', { class: 'dl-speed-wait' }, [E('i'), off ? '' : E('span', {}, _('Collecting… 1 point a minute'))]); const col = (label: string, ic: string, cls: string, v: number) => E('div', { class: 'dl-speed-col' }, [ E('span', { class: 'dl-sub' }, [E('span', { class: cls }, ic), ` ${label}`]), @@ -43,19 +44,19 @@ export function speedTile(rate: [number, number, number][], now: number, today: attachTip(chart, () => { const p = pts[pts.length - 1]; return [ - E('div', { class: 'dl-tip-title' }, new Date(p[0] * 1000).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' })), + E('div', { class: 'dl-tip-title' }, new Date(p[0] * 1000).toLocaleTimeString(locale(), { hour: '2-digit', minute: '2-digit' })), E('div', {}, `↓ ${bits(p[2])} · ↑ ${bits(p[1])}`), ]; }); return E('div', { class: 'dl-bento-tile' }, [ E('div', { class: 'dl-bento-head' }, [ - E('span', { class: 'dl-metric-label' }, 'Speed now'), - off ? '' : E('span', { class: 'dl-sub' }, 'last 15 min'), + E('span', { class: 'dl-metric-label' }, _('Speed now')), + off ? '' : E('span', { class: 'dl-sub' }, _('last 15 min')), ]), - E('div', { class: 'dl-speed-cols' }, [col('Download', '↓', 'dl-dn', down), col('Upload', '↑', 'dl-up', up)]), + E('div', { class: 'dl-speed-cols' }, [col(_('Download', 'speed'), '↓', 'dl-dn', down), col(_('Upload', 'speed'), '↑', 'dl-up', up)]), chart, E('div', { class: 'dl-speed-today' }, [ - E('span', {}, ['Today ', E('b', {}, bytes(rx + tx))]), + E('span', {}, fill(_('Today %s'), E('b', {}, bytes(rx + tx)))), E('span', {}, [E('span', { class: 'dl-dn' }, '↓'), ` ${bytes(tx)} `, E('span', { class: 'dl-up' }, '↑'), ` ${bytes(rx)}`]), ]), ]); @@ -75,7 +76,7 @@ export function daysTile(series: DayUsage[], note: string): HTMLElement { const v = vals[i]; const bar = E('i', { class: i === days.length - 1 ? 'hi' : '', style: `height:${Math.max(4, (v / max) * 100)}%` }); attachTip(bar, () => [ - E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `Today · ${dayLabel(d.day)}` : dayLabel(d.day)), + E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(d.day)}` : dayLabel(d.day)), E('div', {}, bytes(v)), E('div', { class: 'dl-muted dl-mono' }, `↓ ${bytes(d.tx)} ↑ ${bytes(d.rx)}`), ]); @@ -84,14 +85,14 @@ export function daysTile(series: DayUsage[], note: string): HTMLElement { ); return E('div', { class: 'dl-bento-tile month' }, [ E('div', { class: 'dl-bento-head' }, [ - E('span', {}, [E('span', { class: 'dl-metric-label' }, 'Last 30 days'), E('b', { class: 'dl-bento-total' }, bytes(total))]), - vals[peakI] > 0 ? E('span', { class: 'dl-sub' }, `peak ${bytes(vals[peakI])} · ${dayLabel(days[peakI].day)}`) : '', + E('span', {}, [E('span', { class: 'dl-metric-label' }, _('Last 30 days')), E('b', { class: 'dl-bento-total' }, bytes(total))]), + vals[peakI] > 0 ? E('span', { class: 'dl-sub' }, `${fmt(_('peak %s'), bytes(vals[peakI]))} · ${dayLabel(days[peakI].day)}`) : '', ]), - days.length ? bars : E('p', { class: 'dl-muted' }, 'No traffic yet.'), + days.length ? bars : E('p', { class: 'dl-muted' }, _('No traffic yet.')), E('div', { class: 'dl-bento-head' }, [ E('span', { class: 'dl-sub' }, days.length ? dayLabel(days[0].day) : ''), E('span', { class: 'dl-sub' }, note), - E('span', { class: 'dl-sub' }, 'today'), + E('span', { class: 'dl-sub' }, _('today')), ]), ]); } @@ -108,7 +109,7 @@ export function dayBars(series: DayUsage[]): HTMLElement { const bar = E('i', { class: `${vals[i] ? '' : 'zero'}${i === days.length - 1 ? ' hi' : ''}` }); bar.style.height = `${Math.max(8, (vals[i] / max) * 100)}%`; attachTip(bar, () => [ - E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `Today · ${dayLabel(x.day)}` : dayLabel(x.day)), + E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(x.day)}` : dayLabel(x.day)), E('div', {}, bytes(vals[i])), ]); return bar; diff --git a/web/src/portal/api.ts b/web/src/portal/api.ts index 02ddd63..a3df0e0 100644 --- a/web/src/portal/api.ts +++ b/web/src/portal/api.ts @@ -3,7 +3,9 @@ // throws an ApiError carrying the status and, for a plain-HTTP visitor, the // HTTPS twin of the link. +import { fmt } from '../shared/i18n'; import { base } from './state'; +import { lang, routerText } from './i18n'; export class ApiError extends Error { constructor( @@ -20,7 +22,8 @@ export async function call(path: string, body?: unknown): Promise { const res = await fetch(`${base}/api/${path}`, { method: body === undefined ? 'GET' : 'POST', credentials: 'omit', - headers: body === undefined ? {} : { 'Content-Type': 'application/json' }, + // The page's language: the router writes its messages in it when it has the translation. + headers: body === undefined ? { 'Accept-Language': lang() } : { 'Content-Type': 'application/json', 'Accept-Language': lang() }, body: body === undefined ? undefined : JSON.stringify(body), cache: 'no-store', }); @@ -31,7 +34,12 @@ export async function call(path: string, body?: unknown): Promise { } catch { /* empty */ } - if (!res.ok) throw new ApiError(res.status, data?.error ?? `Request failed (${res.status})`, data?.https_url || undefined); + if (!res.ok) + throw new ApiError( + res.status, + data?.error ? routerText(data.error) : fmt(_('Request failed (%s)'), res.status), + data?.https_url || undefined, + ); return data as T; } diff --git a/web/src/portal/demo/crumbs.ts b/web/src/portal/demo/crumbs.ts index d637b2d..adb8963 100644 --- a/web/src/portal/demo/crumbs.ts +++ b/web/src/portal/demo/crumbs.ts @@ -1,34 +1,44 @@ // What the demo adds to the breadcrumb: the scenario chip right after the path, -// and a GitHub pill just before the page's QR knob (at the end where there is -// none: a card alone). On a phone the pill would crowd out the names, so it +// and a GitHub pill just before the page's language picker (none over a card +// alone, which has no picker either). On a phone the pill would crowd out the names, so it // gives way to a button in the scenario drawer (demo.css). The portal redraws // the breadcrumb with the page and knows nothing of either, so both go back in -// place after each redraw. +// place after each redraw; a language change makes both again in it. import { h, ic } from '../dom'; +import { onLang } from '../i18n'; import { REPO } from './data'; import { scenarioChip } from './picker'; import type { DemoRouter } from './router'; export function mountCrumbs(router: DemoRouter) { const app = document.getElementById('app')!; - const chip = scenarioChip(router); - const gh = h( - 'a', - { class: 'dm-gh', href: REPO, target: '_blank', rel: 'noopener', 'aria-label': 'Dawnline on GitHub' }, - ic('github'), - h('span', {}, 'GitHub'), - ); + const make = () => ({ + chip: scenarioChip(router), + gh: h( + 'a', + { class: 'dm-gh', href: REPO, target: '_blank', rel: 'noopener', 'aria-label': _('Dawnline on GitHub') }, + ic('github'), + h('span', {}, 'GitHub'), + ), + }); + let { chip, gh } = make(); // Our own insertions call this again: by then both are in place and nothing moves. const keep = () => { const crumbs = app.querySelector('.crumbs'); const path = crumbs?.querySelector('.cr-path'); if (!crumbs || !path) return; if (path.nextElementSibling !== chip) path.after(chip); - const qr = crumbs.querySelector('.cr-qr'); - if (qr && qr.previousElementSibling !== gh) qr.before(gh); - else if (!qr && crumbs.lastElementChild !== gh) crumbs.append(gh); + const lang = crumbs.querySelector('.cr-lang'); + if (lang && lang.previousElementSibling !== gh) lang.before(gh); }; new MutationObserver(keep).observe(app, { childList: true, subtree: true }); keep(); + // The page has redrawn its breadcrumb in the new language by now (main.ts listens first). + onLang(() => { + chip.remove(); + gh.remove(); + ({ chip, gh } = make()); + keep(); + }); } diff --git a/web/src/portal/demo/data.ts b/web/src/portal/demo/data.ts index bb574da..bf16ebf 100644 --- a/web/src/portal/demo/data.ts +++ b/web/src/portal/demo/data.ts @@ -19,35 +19,31 @@ export interface Scenario { about: string; } -/** What can be tried, in the picker's groups. */ -export const GROUPS: { title: string; items: Scenario[] }[] = [ - { - title: 'Your page', - items: [ - { id: 'normal', label: 'Everything works', about: 'Three devices: one online, one waiting to be set up.' }, - { id: 'first', label: 'First visit', about: 'A fresh link with no devices yet.' }, - { id: 'stale', label: 'Settings changed', about: 'The admin changed something: a device needs an update.' }, - ], - }, - { - title: 'Stopped by the admin', - items: [ - { id: 'quota', label: 'Out of data', about: 'The month’s limit is used up.' }, - { id: 'hours', label: 'Outside allowed hours', about: 'Access only at certain hours of the day.' }, - { id: 'paused', label: 'Paused by the admin', about: 'The page turns into one card.' }, - { id: 'expired', label: 'Access ended', about: 'The end date has passed.' }, - ], - }, - { - title: 'Other cases', - items: [ - { id: 'http', label: 'Opened over plain HTTP', about: 'Settings only travel over HTTPS.' }, - { id: 'plain', label: 'Plain WireGuard', about: 'Disguise off: any WireGuard app connects.' }, - { id: 'full', label: 'No free slots', about: 'Every device slot is taken.' }, - ], - }, +/** What can be tried, in the picker's groups (their words are groups()). */ +const GROUPS: ScenarioId[][] = [ + ['normal', 'first', 'stale'], + ['quota', 'hours', 'paused', 'expired'], + ['http', 'plain', 'full'], ]; -export const SCENARIOS: Scenario[] = GROUPS.flatMap((g) => g.items); +export const SCENARIOS: { id: ScenarioId }[] = GROUPS.flat().map((id) => ({ id })); + +/** The picker's groups in the page's language: made when it draws (the language changes in place). */ +export function groups(): { title: string; items: Scenario[] }[] { + const titles = [_('Your page'), _('Stopped by the admin'), _('Other cases')]; + const words: Record = { + normal: [_('Everything works'), _('Three devices: one online, one waiting to be set up.')], + first: [_('First visit'), _('A fresh link with no devices yet.')], + stale: [_('Settings changed'), _('The admin changed something: a device needs an update.')], + quota: [_('Out of data'), _('The month’s limit is used up.')], + hours: [_('Outside allowed hours'), _('Access only at certain hours of the day.')], + paused: [_('Paused by the admin'), _('The page turns into one card.')], + expired: [_('Access ended'), _('The end date has passed.')], + http: [_('Opened over plain HTTP'), _('Settings only travel over HTTPS.')], + plain: [_('Plain WireGuard'), _('Disguise off: any WireGuard app connects.')], + full: [_('No free slots'), _('Every device slot is taken.')], + }; + return GROUPS.map((ids, i) => ({ title: titles[i], items: ids.map((id) => ({ id, label: words[id][0], about: words[id][1] })) })); +} export const isScenario = (id: unknown): id is ScenarioId => SCENARIOS.some((s) => s.id === id); /** A device as the demo keeps it; the page's Device is made from it on every answer. */ diff --git a/web/src/portal/demo/i18n/demo.pot b/web/src/portal/demo/i18n/demo.pot new file mode 100644 index 0000000..b0a00c1 --- /dev/null +++ b/web/src/portal/demo/i18n/demo.pot @@ -0,0 +1,127 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: web/src/portal/demo/data.ts +msgid "A fresh link with no devices yet." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Access ended" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Access only at certain hours of the day." +msgstr "" + +#: web/src/portal/demo/crumbs.ts +msgid "Dawnline on GitHub" +msgstr "" + +#: web/src/portal/demo/picker.ts +msgid "Demo" +msgstr "" + +#: web/src/portal/demo/main.ts +msgid "Demo keys connect nowhere" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Disguise off: any WireGuard app connects." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Every device slot is taken." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Everything works" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "First visit" +msgstr "" + +#: web/src/portal/demo/picker.ts +msgid "How the page looks in each case. Nothing here connects." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "No free slots" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Opened over plain HTTP" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Other cases" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Out of data" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Outside allowed hours" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Paused by the admin" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Plain WireGuard" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Settings changed" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Settings only travel over HTTPS." +msgstr "" + +#: web/src/portal/demo/picker.ts +msgid "Start over" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Stopped by the admin" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "The admin changed something: a device needs an update." +msgstr "" + +#: web/src/portal/demo/picker.ts +msgid "The demo started over" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "The end date has passed." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "The month’s limit is used up." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "The page turns into one card." +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Three devices: one online, one waiting to be set up." +msgstr "" + +#: web/src/portal/demo/picker.ts +msgid "Try a scenario" +msgstr "" + +#: web/src/portal/demo/data.ts +msgid "Your page" +msgstr "" diff --git a/web/src/portal/demo/i18n/ru.po b/web/src/portal/demo/i18n/ru.po new file mode 100644 index 0000000..78cc388 --- /dev/null +++ b/web/src/portal/demo/i18n/ru.po @@ -0,0 +1,129 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Language-Team: Russian\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: web/src/portal/demo/data.ts +msgid "A fresh link with no devices yet." +msgstr "Новая ссылка, устройств пока нет." + +#: web/src/portal/demo/data.ts +msgid "Access ended" +msgstr "Доступ закончился" + +#: web/src/portal/demo/data.ts +msgid "Access only at certain hours of the day." +msgstr "Доступ только в определённые часы." + +#: web/src/portal/demo/crumbs.ts +msgid "Dawnline on GitHub" +msgstr "Dawnline на GitHub" + +#: web/src/portal/demo/picker.ts +msgid "Demo" +msgstr "Демо" + +#: web/src/portal/demo/main.ts +msgid "Demo keys connect nowhere" +msgstr "Демо-ключи никуда не подключаются" + +#: web/src/portal/demo/data.ts +msgid "Disguise off: any WireGuard app connects." +msgstr "Маскировка выключена: подойдёт любое приложение WireGuard." + +#: web/src/portal/demo/data.ts +msgid "Every device slot is taken." +msgstr "Все места для устройств заняты." + +#: web/src/portal/demo/data.ts +msgid "Everything works" +msgstr "Всё работает" + +#: web/src/portal/demo/data.ts +msgid "First visit" +msgstr "Первый визит" + +#: web/src/portal/demo/picker.ts +msgid "How the page looks in each case. Nothing here connects." +msgstr "Как выглядит страница в каждом случае. Ничего не подключается по-настоящему." + +#: web/src/portal/demo/data.ts +msgid "No free slots" +msgstr "Нет свободных мест" + +#: web/src/portal/demo/data.ts +msgid "Opened over plain HTTP" +msgstr "Открыто по обычному HTTP" + +#: web/src/portal/demo/data.ts +msgid "Other cases" +msgstr "Другие случаи" + +#: web/src/portal/demo/data.ts +msgid "Out of data" +msgstr "Трафик закончился" + +#: web/src/portal/demo/data.ts +msgid "Outside allowed hours" +msgstr "Вне часов доступа" + +#: web/src/portal/demo/data.ts +msgid "Paused by the admin" +msgstr "Доступ на паузе" + +#: web/src/portal/demo/data.ts +msgid "Plain WireGuard" +msgstr "Обычный WireGuard" + +#: web/src/portal/demo/data.ts +msgid "Settings changed" +msgstr "Настройки изменились" + +#: web/src/portal/demo/data.ts +msgid "Settings only travel over HTTPS." +msgstr "Настройки передаются только по HTTPS." + +#: web/src/portal/demo/picker.ts +msgid "Start over" +msgstr "Начать заново" + +#: web/src/portal/demo/data.ts +msgid "Stopped by the admin" +msgstr "Ограничения администратора" + +#: web/src/portal/demo/data.ts +msgid "The admin changed something: a device needs an update." +msgstr "Администратор что-то поменял: устройство нужно обновить." + +#: web/src/portal/demo/picker.ts +msgid "The demo started over" +msgstr "Демо началось заново" + +#: web/src/portal/demo/data.ts +msgid "The end date has passed." +msgstr "Дата окончания прошла." + +#: web/src/portal/demo/data.ts +msgid "The month’s limit is used up." +msgstr "Месячный лимит исчерпан." + +#: web/src/portal/demo/data.ts +msgid "The page turns into one card." +msgstr "Страница сворачивается в одну карточку." + +#: web/src/portal/demo/data.ts +msgid "Three devices: one online, one waiting to be set up." +msgstr "Три устройства: одно в сети, одно ждёт настройки." + +#: web/src/portal/demo/picker.ts +msgid "Try a scenario" +msgstr "Выберите сценарий" + +#: web/src/portal/demo/data.ts +msgid "Your page" +msgstr "Ваша страница" diff --git a/web/src/portal/demo/main.ts b/web/src/portal/demo/main.ts index 73bb4f1..0104136 100644 --- a/web/src/portal/demo/main.ts +++ b/web/src/portal/demo/main.ts @@ -4,11 +4,16 @@ // picker.ts). The order of the imports is the boot order: the router owns // fetch before the portal loads. +// First: the translation globals, before anything draws. +import { addCatalog } from '../i18n'; +import ru from './i18n/ru.po'; import { router } from './serve'; import '../main'; import { toast } from '../ui/feedback'; import { mountCrumbs } from './crumbs'; +// The demo's own words (the scenarios, its chip and toasts), beside the portal's. +addCatalog('ru', ru); mountCrumbs(router); // An AmneziaVPN key would add a server that connects nowhere to the visitor's app: the demo keeps it on the page. @@ -18,7 +23,7 @@ document.addEventListener( if (!(e.target as Element).closest?.('a[href^="vpn:"]')) return; e.preventDefault(); e.stopPropagation(); - toast('Demo keys connect nowhere', true); + toast(_('Demo keys connect nowhere'), true); }, true, ); diff --git a/web/src/portal/demo/picker.ts b/web/src/portal/demo/picker.ts index d5a7543..c94d663 100644 --- a/web/src/portal/demo/picker.ts +++ b/web/src/portal/demo/picker.ts @@ -11,7 +11,7 @@ import { closeSheet, head, openSheet, sub, type View } from '../ui/sheet'; import { glass, type Tone } from '../ui/glass'; import { toast } from '../ui/feedback'; import { EASE_OUT, play } from '../motion'; -import { GROUPS, REPO, type Scenario, type ScenarioId } from './data'; +import { REPO, groups, type Scenario, type ScenarioId } from './data'; import type { DemoRouter } from './router'; /** Each scenario's glass icon and tone (the glass set is smaller than the line icons). */ @@ -75,9 +75,9 @@ export function scenarioChip(router: DemoRouter): HTMLElement { const el = h( 'div', { class: 'view' }, - head('Try a scenario'), - sub('How the page looks in each case. Nothing here connects.'), - ...GROUPS.map((g) => + head(_('Try a scenario')), + sub(_('How the page looks in each case. Nothing here connects.')), + ...groups().map((g) => h('div', { class: 'dm-group' }, h('div', { class: 'lbl-s' }, g.title), h('div', { class: 'dm-list' }, ...g.items.map(row))), ), h( @@ -85,20 +85,20 @@ export function scenarioChip(router: DemoRouter): HTMLElement { { class: 'dm-foot' }, h( 'button', - { type: 'button', class: 'btn soft', onclick: () => pick(router.scenario(), 'The demo started over') }, + { type: 'button', class: 'btn soft', onclick: () => pick(router.scenario(), _('The demo started over')) }, ic('reset'), - h('span', {}, 'Start over'), + h('span', {}, _('Start over')), ), h('a', { class: 'btn soft dm-gh-alt', href: REPO, target: '_blank', rel: 'noopener' }, ic('github'), h('span', {}, 'GitHub')), ), ); - return { el, label: 'Try a scenario' }; + return { el, label: _('Try a scenario') }; } return h( 'button', { type: 'button', class: 'dm-chip', 'aria-haspopup': 'dialog', onclick: () => openSheet(scenarios) }, - h('span', {}, 'Demo'), + h('span', {}, _('Demo')), ic('chevron', 'i'), ); } diff --git a/web/src/portal/flows/add.ts b/web/src/portal/flows/add.ts index 8942931..310865c 100644 --- a/web/src/portal/flows/add.ts +++ b/web/src/portal/flows/add.ts @@ -4,7 +4,8 @@ // opens on the device itself, from a code, ready to add it there. import type { ClientConfig, Kind } from '../../shared/types'; -import { KIND_LABEL } from '../../shared/format'; +import { kindLabel } from '../../shared/format'; +import { fmt, num, plural } from '../../shared/i18n'; import { ApiError, call } from '../api'; import { h, ic } from '../dom'; import { EASE_OUT, play } from '../motion'; @@ -62,12 +63,12 @@ const modelReady: Promise = (async () => { function guessName(kind: Kind): string { if (/iPhone/.test(UA)) return 'iPhone'; if (IPAD) return 'iPad'; - if (/Android/.test(UA)) return MODEL || (kind === 'tablet' ? 'Android tablet' : 'Android phone'); + if (/Android/.test(UA)) return MODEL || (kind === 'tablet' ? _('Android tablet') : _('Android phone')); if (/CrOS/.test(UA)) return 'Chromebook'; if (/Mac OS X/.test(UA)) return 'Mac'; - if (/Windows/.test(UA)) return 'Windows PC'; - if (/Linux/.test(UA)) return 'Linux PC'; - return KIND_LABEL[kind]; + if (/Windows/.test(UA)) return _('Windows PC'); + if (/Linux/.test(UA)) return _('Linux PC'); + return kindLabel(kind); } /* @@ -76,14 +77,18 @@ function guessName(kind: Kind): string { * which; picked from elsewhere it is a phone. */ type Pick = 'computer' | 'mobile' | 'router' | 'other'; -const PICK_LABEL: Record = { computer: 'PC', mobile: 'Mobile', router: 'Router', other: 'Other' }; +const pickLabel = (p: Pick): string => (p === 'mobile' ? _('Mobile') : kindLabel(p)); const pickOf = (k: Kind): Pick => (k === 'phone' || k === 'tablet' ? 'mobile' : k); const kindOf = (p: Pick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet' ? 'tablet' : 'phone'); export function startAdd() { const st = state(); if (!st || st.locked) return; - if (!st.can_add) return toast(`You have reached your limit of ${st.person.device_limit} devices`, true); + if (!st.can_add) + return toast( + plural(st.person.device_limit, 'You have reached your limit of %s device', 'You have reached your limit of %s devices'), + true, + ); if (secureFirst()) return; openSheet(vAdd); } @@ -97,26 +102,32 @@ function vAdd(): View { let edited = false; const taken = new Set(p.devices.map((d) => d.name.toLowerCase())); const suggest = (k: Pick) => { - const n = k === pickOf(guessKind()) ? guessName(kindOf(k)) : k === 'mobile' ? 'Phone' : KIND_LABEL[k]; + const n = k === pickOf(guessKind()) ? guessName(kindOf(k)) : kindLabel(k === 'mobile' ? 'phone' : k); if (!taken.has(n.toLowerCase())) return n; for (let i = 2; i < 20; i++) if (!taken.has(`${n} ${i}`.toLowerCase())) return `${n} ${i}`; return n; }; - const kinds = h('div', { class: 'kinds', role: 'radiogroup', 'aria-label': 'What is it?' }); + const kinds = h('div', { class: 'kinds', role: 'radiogroup', 'aria-label': _('What is it?') }); kinds.style.setProperty('--n', String(picks.length)); const tiles = picks.map((k) => { const t = h( 'button', - { type: 'button', class: 'kind', role: 'radio', 'aria-label': PICK_LABEL[k], onclick: () => choose(k) }, + { type: 'button', class: 'kind', role: 'radio', 'aria-label': pickLabel(k), onclick: () => choose(k) }, h('span', { class: 'kind-tile' }, glass(k, 'blue')), - h('span', { class: 'kind-lbl' }, PICK_LABEL[k]), + h('span', { class: 'kind-lbl' }, pickLabel(k)), ); kinds.appendChild(t); return t; }); - const input = h('input', { type: 'text', maxlength: 48, required: true, 'aria-label': 'Name', autocomplete: 'off' }) as HTMLInputElement; - const goBtn = h('button', { class: 'go ready', type: 'submit', 'aria-label': 'Create connection' }, ic('arrow')) as HTMLButtonElement; + const input = h('input', { + type: 'text', + maxlength: 48, + required: true, + 'aria-label': _('Name'), + autocomplete: 'off', + }) as HTMLInputElement; + const goBtn = h('button', { class: 'go ready', type: 'submit', 'aria-label': _('Create connection') }, ic('arrow')) as HTMLButtonElement; const err = h('p', { class: 'hint bad-t', hidden: true }); const say = (msg: string) => { // Already showing: its words change in place. @@ -162,7 +173,7 @@ function vAdd(): View { e.preventDefault(); const name = input.value.trim(); if (!name) return; - if (taken.has(name.toLowerCase())) return say('You already have a device with this name.'); + if (taken.has(name.toLowerCase())) return say(_('You already have a device with this name.')); void once(goBtn, async () => { try { const r = await call<{ id: string; config: ClientConfig; state: State }>('devices', { name, kind: kindOf(pick) }); @@ -180,23 +191,23 @@ function vAdd(): View { 'button', { type: 'button', class: 'btn soft block', onclick: () => go(vLink) }, ic('qr'), - h('span', {}, 'Add it from the device'), + h('span', {}, _('Add it from the device')), ); const free = p.device_limit - p.devices.length; const el = h( 'div', { class: 'view' }, - head('Add a device'), - sub(`${free} of ${p.device_limit} slots free`), + head(_('Add a device')), + sub(fmt(N_(p.device_limit, '%s of %s slot free', '%s of %s slots free'), num(free), num(p.device_limit))), kinds, - hint('Phones and tablets get a smaller packet size that suits mobile networks.'), + hint(_('Phones and tablets get a smaller packet size that suits mobile networks.')), form, err, - h('div', { class: 'or' }, 'OR'), + h('div', { class: 'or' }, _('OR')), viaLink, ); el.querySelector('.hint')!.classList.add('kinds-note'); - return { el, label: 'Add a device' }; + return { el, label: _('Add a device') }; } /** The page on the device itself, ready to add it: the link as a code for its camera, and as text. */ @@ -205,10 +216,10 @@ function vLink(): View { const el = h( 'div', { class: 'view' }, - head('Open on the device', { back: true }), - sub('Point its camera at the code: your page opens there with this device ready to add.'), + head(_('Open on the device'), { back: true }), + sub(_('Point its camera at the code: your page opens there with this device ready to add.')), qrBox(link, true), linkRow(link), ); - return { el, label: 'Open on the device' }; + return { el, label: _('Open on the device') }; } diff --git a/web/src/portal/flows/device-actions.ts b/web/src/portal/flows/device-actions.ts index 4cc541a..9c343ef 100644 --- a/web/src/portal/flows/device-actions.ts +++ b/web/src/portal/flows/device-actions.ts @@ -3,6 +3,7 @@ // be undone; the action's button stays busy until the router answers. import type { ClientConfig, Device } from '../../shared/types'; +import { fmt } from '../../shared/i18n'; import { call } from '../api'; import { h, ic } from '../dom'; import { EASE_IN, play } from '../motion'; @@ -13,7 +14,7 @@ import { closeSheet, head, onClosed, openSheet, type View } from '../ui/sheet'; import { secureFirst } from './secure'; import { continueSetup } from './setup-view'; -/** A question before something that cannot be undone: the action's icon in its colour, what happens, Cancel and the action. */ +/** A question before something that cannot be undone: the action's icon in its colour, what happens (on the left edge), Cancel and the action. */ function ask(o: { icon: string; tone: Tone; title: string; text: string; action: string; cls: string; run: () => Promise }): View { const ok = h( 'button', @@ -26,11 +27,11 @@ function ask(o: { icon: string; tone: Tone; title: string; text: string; action: { class: 'view' }, h( 'div', - { class: 'center-col ask' }, + { class: 'ask' }, glass(o.icon, o.tone, 'gi xl'), h('h3', {}, o.title), h('p', {}, o.text), - h('div', { class: 'btnrow' }, h('button', { type: 'button', class: 'btn soft', onclick: () => closeSheet() }, 'Cancel'), ok), + h('div', { class: 'btnrow' }, h('button', { type: 'button', class: 'btn soft', onclick: () => closeSheet() }, _('Cancel')), ok), ), ); return { el, label: o.title, asks: true }; @@ -38,9 +39,9 @@ function ask(o: { icon: string; tone: Tone; title: string; text: string; action: export function rename(d: Device) { openSheet(() => { - const input = h('input', { type: 'text', maxlength: 48, 'aria-label': 'Device name', autocomplete: 'off' }) as HTMLInputElement; + const input = h('input', { type: 'text', maxlength: 48, 'aria-label': _('Device name'), autocomplete: 'off' }) as HTMLInputElement; input.value = d.name; - const save = h('button', { class: 'go', type: 'submit', 'aria-label': 'Save' }, ic('check')) as HTMLButtonElement; + const save = h('button', { class: 'go', type: 'submit', 'aria-label': _('Save') }, ic('check')) as HTMLButtonElement; input.addEventListener('input', () => save.classList.toggle('ready', !!input.value.trim() && input.value.trim() !== d.name)); const form = h('form', { class: 'field', autocomplete: 'off' }, input, save); form.addEventListener('submit', (e) => { @@ -53,7 +54,7 @@ export function rename(d: Device) { setState(r.state); onClosed(() => { repaint(); - toast('Renamed'); + toast(_('Renamed')); }); closeSheet(); } catch (er) { @@ -62,7 +63,8 @@ export function rename(d: Device) { }); }); setTimeout(() => input.select(), 60); - return { el: h('div', { class: 'view' }, head(`Rename ${d.name}`), form), label: `Rename ${d.name}` }; + const title = fmt(_('Rename %s'), d.name); + return { el: h('div', { class: 'view' }, head(title), form), label: title }; }); } @@ -78,11 +80,13 @@ export function reconnect(d: Device) { ask({ icon: 'refresh', tone: 'orange', - title: `Reconnect ${d.name}?`, + title: fmt(_('Reconnect %s?'), d.name), text: here - ? 'It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.' - : 'It gets new keys and its current settings stop working. Set it up again with the new ones that open next.', - action: 'Reconnect', + ? _( + 'It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.', + ) + : _('It gets new keys and its current settings stop working. Set it up again with the new ones that open next.'), + action: _('Reconnect'), cls: 'accent', run: async () => { try { @@ -103,9 +107,9 @@ export function removeDevice(d: Device) { ask({ icon: 'trash', tone: 'red', - title: `Remove ${d.name}?`, - text: 'Its connection stops working at once. You can add it again later.', - action: 'Remove', + title: fmt(_('Remove %s?'), d.name), + text: _('Its connection stops working at once. You can add it again later.'), + action: _('Remove'), cls: 'red', run: async () => { try { @@ -116,7 +120,7 @@ export function removeDevice(d: Device) { const card = document.querySelector(`.dev[data-id="${CSS.escape(d.id)}"]`); const done = () => { repaint(); - toast('Device removed'); + toast(_('Device removed')); }; if (!card) return done(); play( diff --git a/web/src/portal/flows/page-code.ts b/web/src/portal/flows/page-code.ts index 3cddd5a..f4f9d7e 100644 --- a/web/src/portal/flows/page-code.ts +++ b/web/src/portal/flows/page-code.ts @@ -12,11 +12,11 @@ export function showPageCode() { const el = h( 'div', { class: 'view' }, - head('Open on another device'), - sub('Point its camera at the code: this page opens there.'), + head(_('Open on another device')), + sub(_('Point its camera at the code: this page opens there.')), qrBox(url, true), linkRow(url), ); - return { el, label: 'Open on another device' }; + return { el, label: _('Open on another device') }; }); } diff --git a/web/src/portal/flows/secure.ts b/web/src/portal/flows/secure.ts index 35bb8f1..4a451ad 100644 --- a/web/src/portal/flows/secure.ts +++ b/web/src/portal/flows/secure.ts @@ -11,20 +11,22 @@ function vSecure(url: string): View { const el = h( 'div', { class: 'view' }, - head('Open the link securely'), - sub('Connection settings only travel encrypted'), + head(_('Open the link securely')), + sub(_('Connection settings only travel encrypted')), h( 'div', { class: 'center-col secure' }, glass('lock', 'blue', 'gi xl'), - h('p', {}, 'This page is open without encryption. To add or set up a device, open the same link over HTTPS:'), + h('p', {}, _('This page is open without encryption. To add or set up a device, open the same link over HTTPS:')), ), // The same tab: the HTTPS page replaces this one. - h('a', { class: 'btn accent block', href: url }, ic('lock'), h('span', {}, 'Open securely')), - hint('The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).'), + h('a', { class: 'btn accent block', href: url }, ic('lock'), h('span', {}, _('Open securely'))), + hint( + _('The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).'), + ), ); el.lastElementChild!.classList.add('secure-note'); - return { el, label: 'Open the link securely' }; + return { el, label: _('Open the link securely') }; } /** The HTTPS twin's sheet (here, or the one the router named in a refusal). */ diff --git a/web/src/portal/flows/setup-parts.ts b/web/src/portal/flows/setup-parts.ts index b59167d..c9f2420 100644 --- a/web/src/portal/flows/setup-parts.ts +++ b/web/src/portal/flows/setup-parts.ts @@ -5,16 +5,19 @@ // where an app scans a code. The rules behind them are setup.ts. import type { ClientConfig, Device } from '../../shared/types'; +import { fill, fmt } from '../../shared/i18n'; import { h, ic, type Kid } from '../dom'; import { EASE_OUT, POP, SMOOTH, play } from '../motion'; import { APP_NAME, - PLATFORM_LABEL, + importPath, importSteps, keyFileName, opensKeyLinks, + platformLabel, routerStore, scanPath, + vpnContinue, storeFor, type AppId, type Platform, @@ -83,7 +86,7 @@ export function badge( /** Where the app comes from: the store (and, on Android, the APK beside it), or a line to go and get it. */ export function storeBlock(app: AppId, os: Platform, router: boolean): Kid[] { const st: Store | null = router ? routerStore(app) : storeFor(app, os); - if (!st) return [hint(`Get ${APP_NAME[app]} on the ${PLATFORM_LABEL[os]} and come back here.`)]; + if (!st) return [hint(fmt(_('Get %s on the %s and come back here.'), APP_NAME[app], platformLabel(os)))]; // Android: the store can fail (no Google Play, or it hides the app), so the APK sits beside it. if (st.alt) return [h('div', { class: 'badges2' }, badge(st), badge(st.alt)), hint(st.alt.why)]; return [badge(st)]; @@ -106,35 +109,40 @@ export function connectKids(c: SetupCtx): Kid[] { // On the phone being set up, a link opens AmneziaVPN only on Android; an // iPhone takes the key as a .vpn file from the share sheet. const inHand = c.same() && hereHandheld; - const copyKey = (ev: Event) => copy(c.key, 'Key copied', ev.currentTarget); + const copyKey = (ev: Event) => copy(c.key, _('Key copied'), ev.currentTarget); const send = app === 'vpn' && inHand && !opensKeyLinks(c.pf) ? shareFile(keyFileName(c.cfg.filename), c.key) : null; if (app === 'vpn' && inHand && (opensKeyLinks(c.pf) || send)) return [ send - ? badge({ top: 'Then come back here and tap', main: 'Send to AmneziaVPN', mark: 'amnezia', onclick: () => void send() }, true) - : badge({ href: c.key, top: 'Then come back here and tap', main: 'Open in AmneziaVPN', mark: 'amnezia' }, true), + ? badge({ top: _('Then come back here and tap'), main: _('Send to AmneziaVPN'), mark: 'amnezia', onclick: () => void send() }, true) + : badge({ href: c.key, top: _('Then come back here and tap'), main: _('Open in AmneziaVPN'), mark: 'amnezia' }, true), hint( - send ? 'Pick AmneziaVPN in the share sheet. Not there? ' : 'Nothing opened? ', - linkBtn('Copy the key', copyKey), - ' and add it in the app.', + ...fill( + send + ? _('Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app.') + : _('Nothing opened? %s and add it in the app.'), + linkBtn(_('Copy the key', 'in a sentence'), copyKey), + ), ), ]; - if (app === 'vpn') + if (app === 'vpn') { + const path = importPath('vpn'); return [ - badge({ top: 'The connection as one key', main: 'Copy the key', mark: 'copy', onclick: copyKey }, true), + badge({ top: _('The connection as one key'), main: _('Copy the key'), mark: 'copy', onclick: copyKey }, true), howto([ - ['Open AmneziaVPN', ''], - ['Add server › ', 'Insert key'], - ['Paste the key and connect', ''], + [fmt(_('Open %s', 'step'), name), ''], + [path.replace(/ → [^→]*$/, ' → '), path.replace(/^.* → /, '')], + [vpnContinue(), ''], ]), ]; + } const share = hereHandheld ? shareFile(c.cfg.filename, c.cfg.conf) : null; return [ share ? badge( { - top: c.same() ? `Straight into ${name}` : `Send it to the ${c.there}`, - main: 'Share the file', + top: c.same() ? fmt(_('Straight into %s'), name) : fmt(_('Send it to the %s'), c.there), + main: _('Share the file'), mark: 'share', onclick: () => void share(), }, @@ -142,8 +150,8 @@ export function connectKids(c: SetupCtx): Kid[] { ) : badge( { - top: 'Then import it in the app', - main: 'Download the file', + top: _('Then import it in the app'), + main: _('Download the file'), mark: 'download', onclick: () => download(c.cfg.filename, c.cfg.conf), }, @@ -163,23 +171,31 @@ export function sendKids(c: SetupCtx): Kid[] { const file = keyFileName(c.cfg.filename); const share = !!shareFile(file, c.key); return [ - h('p', { class: 'desc' }, `Send it to the ${c.there} in a message or a note, then in AmneziaVPN: Add server › Insert key.`), + h( + 'p', + { class: 'desc' }, + fmt(_('Send it to the %s in a message or a note, then in AmneziaVPN: %s.'), c.there, importPath('vpn').replace(/ → /g, ' › ')), + ), h( 'div', { class: 'btnrow2' }, - btn('copy', 'Copy the key', (ev) => copy(c.key, 'Key copied', ev.currentTarget)), - btn(share ? 'share' : 'download', share ? 'Share as a file' : 'Download the key', () => sendFile(file, c.key)), + btn('copy', _('Copy the key'), (ev) => copy(c.key, _('Key copied'), ev.currentTarget)), + btn(share ? 'share' : 'download', share ? _('Share as a file') : _('Download the key'), () => sendFile(file, c.key)), ), ]; } const share = !!shareFile(c.cfg.filename, c.cfg.conf); return [ - h('p', { class: 'desc' }, `Send it to the ${c.there}, then import `, h('b', {}, c.cfg.filename), ` in ${APP_NAME[app]}.`), + h( + 'p', + { class: 'desc' }, + ...fill(_('Send it to the %s, then import %s in %s.'), c.there, h('b', {}, c.cfg.filename), APP_NAME[app]), + ), h( 'div', { class: 'btnrow2' }, - btn(share ? 'share' : 'download', share ? 'Share the file' : 'Download the file', () => sendFile(c.cfg.filename, c.cfg.conf)), - btn('copy', 'Copy the configuration', (ev) => copy(c.cfg.conf, 'Configuration copied', ev.currentTarget)), + btn(share ? 'share' : 'download', share ? _('Share the file') : _('Download the file'), () => sendFile(c.cfg.filename, c.cfg.conf)), + btn('copy', _('Copy the configuration'), (ev) => copy(c.cfg.conf, _('Configuration copied'), ev.currentTarget)), ), ]; } @@ -208,7 +224,7 @@ export function filePane(cfg: ClientConfig): HTMLElement { class: 'btn soft sm', onclick: () => { reveal = !reveal; - eye.replaceChildren(ic(reveal ? 'x' : 'key'), h('span', {}, reveal ? 'Hide key' : 'Show key')); + eye.replaceChildren(ic(reveal ? 'x' : 'key'), h('span', {}, reveal ? _('Hide key') : _('Show key'))); paint(); // A key shown comes into focus out of a blur; hidden again, the mask fades back. pre.querySelectorAll('.mask, .k').forEach((x) => @@ -224,13 +240,13 @@ export function filePane(cfg: ClientConfig): HTMLElement { }, }, ic('key'), - h('span', {}, 'Show key'), + h('span', {}, _('Show key')), ); const cp = h( 'button', - { type: 'button', class: 'btn soft sm', onclick: (ev: Event) => copy(cfg.conf, 'Configuration copied', ev.currentTarget) }, + { type: 'button', class: 'btn soft sm', onclick: (ev: Event) => copy(cfg.conf, _('Configuration copied'), ev.currentTarget) }, ic('copy'), - h('span', { class: 'lbl' }, 'Copy'), + h('span', { class: 'lbl' }, _('Copy')), ); const card = h( 'div', @@ -239,16 +255,16 @@ export function filePane(cfg: ClientConfig): HTMLElement { 'div', { class: 'fc-row' }, h('span', { class: 'filecard-ic' }, '.conf'), - h('span', { class: 't' }, h('span', { class: 'mono' }, cfg.filename), h('span', {}, 'For computers and routers')), + h('span', { class: 't' }, h('span', { class: 'mono' }, cfg.filename), h('span', {}, _('For computers and routers'))), ), h( 'button', { type: 'button', class: 'btn accent sm block', onclick: () => sendFile(cfg.filename, cfg.conf) }, ic(share ? 'open' : 'download'), - h('span', {}, share ? 'Share file' : 'Download'), + h('span', {}, share ? _('Share file') : _('Download')), ), ); - const conf = accordion([{ icon: glass('file'), title: 'Configuration', body: [h('div', { class: 'confbar' }, eye, cp), pre] }], { + const conf = accordion([{ icon: glass('file'), title: _('Configuration'), body: [h('div', { class: 'confbar' }, eye, cp), pre] }], { inset: true, }); return h('div', { class: 'step-box' }, card, conf.el); @@ -265,7 +281,7 @@ export function scanLine(app: AppId): ScanLine { const name = h('span', { class: 'osm-p' }, APP_NAME[app]); const path = menuLine(scanPath(app, 'ios'), scanPath(app, 'android')); return { - el: h('span', { class: 'scanline' }, h('span', {}, 'In ', name, ':'), path.el), + el: h('span', { class: 'scanline' }, h('span', {}, ...fill(_('In %s:'), name)), path.el), set(a) { morphText(name, APP_NAME[a], undefined, { whole: true }); path.set(scanPath(a, 'ios'), scanPath(a, 'android')); @@ -291,12 +307,12 @@ export function connPill(get: () => { text: string; msg: string; file: string; a const tip = h('span', { class: 'hp-tip', 'aria-hidden': 'true' }, tt, tm); const dl = h('button', { type: 'button', class: 'hp-b', onclick: () => sendFile(get().file, get().text) }, ic('download')); const cp = h('button', { type: 'button', class: 'hp-b' }, ic('copy')); - const el = h('div', { class: 'hpill', role: 'group', 'aria-label': 'The connection', 'data-key': 'conn' }, dl, cp, tip); + const el = h('div', { class: 'hpill', role: 'group', 'aria-label': _('The connection'), 'data-key': 'conn' }, dl, cp, tip); let tipFor: HTMLElement | null = null; let tipT = 0; let warmUntil = 0; - const words = (b: HTMLElement) => (b === cp && cp.classList.contains('done') ? 'Copied' : (b.getAttribute('aria-label') ?? '')); + const words = (b: HTMLElement) => (b === cp && cp.classList.contains('done') ? _('Copied') : (b.getAttribute('aria-label') ?? '')); // Centred under its key, but never past the sheet's edge (× and its margin to the right). const centre = (b: HTMLElement, t: string) => { tm.textContent = t; @@ -401,8 +417,8 @@ export function connPill(get: () => { text: string; msg: string; file: string; a el, sync() { const app = get().app; - dl.setAttribute('aria-label', `Download ${app} config`); - cp.setAttribute('aria-label', `Copy ${app} config`); + dl.setAttribute('aria-label', fmt(_('Download %s config'), app)); + cp.setAttribute('aria-label', fmt(_('Copy %s config'), app)); }, }; } diff --git a/web/src/portal/flows/setup-view.ts b/web/src/portal/flows/setup-view.ts index a8fcc72..7c1f687 100644 --- a/web/src/portal/flows/setup-view.ts +++ b/web/src/portal/flows/setup-view.ts @@ -8,6 +8,7 @@ // connection sits on top the whole time (wait.ts). import type { ClientConfig, Device } from '../../shared/types'; +import { fmt } from '../../shared/i18n'; import { vpnKey, vpnQrText } from '../../shared/vpnkey'; import { ApiError, call } from '../api'; import { h, put } from '../dom'; @@ -115,6 +116,7 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { const same = sameDevice(d.kind, pf); const layout: Layout = same ? 'same' : router ? 'router' : handheld ? 'away' : 'pc-away'; const there = deviceNoun(d.kind); + const thereOn = deviceNoun(d.kind, true); // A router takes AmneziaWG (or WireGuard), never AmneziaVPN. const choices = apps.filter((a) => !router || a.id !== 'vpn'); let app: AppId = recallApp(d) ?? (router ? 'awg' : 'vpn'); @@ -152,15 +154,15 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { layout === 'away' ? connPill(() => ({ ...(app === 'vpn' - ? { text: key, msg: 'Key copied', file: keyFileName(cfg.filename) } - : { text: cfg.conf, msg: 'Configuration copied', file: cfg.filename }), + ? { text: key, msg: _('Key copied'), file: keyFileName(cfg.filename) } + : { text: cfg.conf, msg: _('Configuration copied'), file: cfg.filename }), app: APP_NAME[app], })) : null; /** Everything a pick changes, refilled in place. */ function fill() { - morphText(title1, router ? `Get ${APP_NAME[app]} on the router` : `Get ${APP_NAME[app]}`, undefined, { whole: true }); + morphText(title1, router ? fmt(_('Get %s on the router'), APP_NAME[app]) : fmt(_('Get %s'), APP_NAME[app]), undefined, { whole: true }); morphInto(getBox, storeBlock(app, pf, router)); // The router's file is the same for either app: it stays as it is (a folded configuration stays folded). if (!router) morphInto(addBox, connectKids(c)); @@ -187,22 +189,22 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { const linkThere = setupLink(pageUrl(), d.id); const linkBody = () => [ handheld - ? codeRow(linkThere, [h('span', {}, 'Point its camera at the code: the link opens there.')]).el - : h('p', { class: 'desc' }, `Open this link on the ${there} to set it up there.`), + ? codeRow(linkThere, [h('span', {}, _('Point its camera at the code: the link opens there.'))]).el + : h('p', { class: 'desc' }, fmt(_('Open this link on the %s to set it up there.'), thereOn)), linkRow(linkThere), ]; const step1 = () => step('1', title1, [picker(), getBox]); - const step2 = () => step('2', router ? 'Import the configuration' : 'Add the connection', [addBox]); + const step2 = () => step('2', router ? _('Import the configuration') : _('Add the connection'), [addBox]); const body = h('div', { class: 'setup' }); if (inWebview(navigator.userAgent)) body.appendChild( - notice('warn', 'shield', null, 'Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.'), + notice('warn', 'shield', null, _('Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.')), ); if (layout === 'same') { // Opened, the way round folds the steps away: the device is not in hand. const steps = h('div', { class: 'steps-wrap' }, h('div', { class: 'steps-gap' }), step1(), step2()); - const round = accordion([{ icon: glass('link'), title: `Not on the ${there} right now?`, body: linkBody() }], { + const round = accordion([{ icon: glass('link'), title: fmt(_('Not on the %s right now?'), thereOn), body: linkBody() }], { inset: true, onToggle: (_i, open, instant) => foldBlock(steps, open, instant), }); @@ -213,8 +215,8 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { body.appendChild( accordion( [ - { icon: glass('link'), title: `Open your link on the ${there}`, body: linkBody() }, - { icon: glass('app'), title: 'Already has the app', body: [picker(), codeBox] }, + { icon: glass('link'), title: fmt(_('Open your link on the %s'), thereOn), body: linkBody() }, + { icon: glass('app'), title: _('Already has the app'), body: [picker(), codeBox] }, ], { inset: true, open: 1 }, ).el, @@ -224,8 +226,8 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { body.appendChild( accordion( [ - { icon: glass('link'), title: `Open your link on the ${there}`, body: linkBody() }, - { icon: glass('key'), title: 'Copy or save the connection', body: [picker(), sendBox] }, + { icon: glass('link'), title: fmt(_('Open your link on the %s'), thereOn), body: linkBody() }, + { icon: glass('key'), title: _('Copy or save the connection'), body: [picker(), sendBox] }, ], { inset: true, open: 0 }, ).el, @@ -248,7 +250,12 @@ export function setupView(d: Device, cfg: ClientConfig, key: string): View { onClosed(() => repaint()); const subline = - layout === 'same' ? 'Two steps, about a minute' : router ? 'The packages and the file for OpenWrt' : `The app goes on the ${there}.`; - const el = h('div', { class: 'view' }, head(`Set up ${d.name}`, { acts: !!pill }), sub(subline), way.el, body); - return { el, label: `Set up ${d.name}`, acts: pill?.el ?? null }; + layout === 'same' + ? _('Two steps, about a minute') + : router + ? _('The packages and the file for OpenWrt') + : fmt(_('The app goes on the %s.'), there); + const title = fmt(_('Set up %s'), d.name); + const el = h('div', { class: 'view' }, head(title, { acts: !!pill }), sub(subline), way.el, body); + return { el, label: title, acts: pill?.el ?? null }; } diff --git a/web/src/portal/flows/wait.ts b/web/src/portal/flows/wait.ts index c548496..35a6aa3 100644 --- a/web/src/portal/flows/wait.ts +++ b/web/src/portal/flows/wait.ts @@ -5,6 +5,7 @@ // and the sheet closes by itself onto the page. import type { Device } from '../../shared/types'; +import { fmt } from '../../shared/i18n'; import { gone, call } from '../api'; import { h, ic } from '../dom'; import { EASE_OUT, play } from '../motion'; @@ -20,7 +21,7 @@ export interface Way { } export function waitWay(d: Device): Way { - const line = h('b', {}, 'Waiting for the connection'); + const line = h('b', {}, _('Waiting for the connection')); const more = h('span', { class: 'ws', hidden: true }); const el = h( 'div', @@ -38,12 +39,12 @@ export function waitWay(d: Device): Way { el, connected() { el.classList.add('done'); - morphText(line, `${d.name} connected`); + morphText(line, fmt(_('%s connected'), d.name)); }, gaveUp() { el.classList.add('stopped'); - morphText(line, 'No connection yet'); - more.textContent = 'Close this and open it again to keep checking.'; + morphText(line, _('No connection yet')); + more.textContent = _('Close this and open it again to keep checking.'); more.hidden = false; play( line.parentElement!, diff --git a/web/src/portal/i18n.ts b/web/src/portal/i18n.ts new file mode 100644 index 0000000..576ff24 --- /dev/null +++ b/web/src/portal/i18n.ts @@ -0,0 +1,100 @@ +// The portal's languages: English (the code's) and the translations bundled +// with it (i18n/.po, turned into lookup tables at build time). The page +// opens in the visitor's own choice, kept in this browser, or else in the +// first of the browser's (the system's) languages it has; the language menu in +// the breadcrumb switches it in place. This module installs the globals _() +// and N_() that the page and the shared code call (shared/i18n.ts), so it is +// imported before anything that draws. + +import type { Catalog } from '../../i18n/po'; +import ru from './i18n/ru.po'; + +export interface Lang { + code: string; + /** In its own language: what the menu lists. */ + name: string; +} + +export const LANGS: Lang[] = [ + { code: 'en', name: 'English' }, + { code: 'ru', name: 'Русский' }, +]; + +const catalogs: Record = { ru: [ru] }; + +/** Which plural form n takes (the index into the .po's msgstr[n]), by each language's gettext rule. */ +const FORMS: Record number> = { + en: (n) => (n !== 1 ? 1 : 0), + ru: (n) => (n % 10 === 1 && n % 100 !== 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2), +}; + +const STORE = 'dl.lang'; + +/** The language to open in: the visitor's kept choice, else the browser's first we have, else English. */ +export function pickLang(kept: string | null, browser: readonly string[]): string { + const have = (c: string | null | undefined) => (c && LANGS.some((l) => l.code === c) ? c : null); + return have(kept) ?? browser.map((b) => have(b.toLowerCase().split(/[-_]/)[0])).find(Boolean) ?? 'en'; +} + +let current = 'en'; +let active: Catalog[] = []; +const listeners: (() => void)[] = []; + +const key = (s: string, ctx?: string) => (ctx ? `${ctx}\u0004${s}` : s); + +function tr(s: string, ctx?: string): string { + const k = key(s, ctx); + for (const c of active) if (k in c.s) return c.s[k]; + return s; +} + +function ntr(n: number, s: string, p: string, ctx?: string): string { + const k = key(s, ctx); + const forms = active.find((c) => k in c.p)?.p[k]; + return forms?.[(FORMS[current] ?? FORMS.en)(n)] ?? (n === 1 ? s : p); +} + +export const lang = () => current; + +/** + * A message the router sent: in English when no translation is installed on + * it, so the page translates the ones its catalog has (the backend's + * portal.uc and devices.uc are in it). + */ +export const routerText = (msg: string) => tr(msg); + +/** Switch the page's language; `keep`: remember it in this browser (the visitor chose it). */ +export function setLang(code: string, keep = true) { + current = LANGS.some((l) => l.code === code) ? code : 'en'; + active = catalogs[current] ?? []; + document.documentElement.lang = current; + if (keep) + try { + localStorage.setItem(STORE, current); + } catch { + /* no storage: the choice lasts this visit */ + } + listeners.forEach((f) => f()); +} + +/** Redraw on a language change (main.ts: the page; the demo: its own parts). */ +export function onLang(f: () => void) { + listeners.push(f); +} + +/** More strings for a language (the demo's own, from its catalog). */ +export function addCatalog(code: string, c: Catalog) { + (catalogs[code] ??= []).push(c); + if (code === current) active = catalogs[code]; +} + +function kept(): string | null { + try { + return localStorage.getItem(STORE); + } catch { + return null; + } +} + +Object.assign(globalThis, { _: tr, N_: ntr }); +setLang(pickLang(kept(), navigator.languages?.length ? navigator.languages : [navigator.language]), false); diff --git a/web/src/portal/i18n/portal.pot b/web/src/portal/i18n/portal.pot new file mode 100644 index 0000000..733ffb8 --- /dev/null +++ b/web/src/portal/i18n/portal.pot @@ -0,0 +1,1378 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" already exists." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" is already taken." +msgstr "" + +#: web/src/portal/setup.ts +#: web/src/portal/ui/morph.ts +msgid "%s (Android: %s)" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "%s (router time)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s already has %d device. Remove one first to lower the limit to %d." +msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d." +msgstr[0] "" +msgstr[1] "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s can't use the network interface %s: it exists and isn't Dawnline's." +msgstr "" + +#: web/src/portal/flows/wait.ts +msgid "%s connected" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s d ago" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "%s day" +msgid_plural "%s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/shared/format.ts +msgid "%s h ago" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s has an invalid interface name \"%s\"." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s has no room for every device on %s." +msgstr "" + +#: web/src/shared/format.ts +msgid "%s in total" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: %s)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: none)." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "%s left" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s min ago" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s must be a number or range" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "%s of %s" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s of %s GB" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s of %s GB this month" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "%s of %s in total." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "%s of %s slot free" +msgid_plural "%s of %s slots free" +msgstr[0] "" +msgstr[1] "" + +#: web/src/portal/page/access.ts +msgid "%s on %s" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "%s options" +msgstr "" + +#: web/src/shared/format.ts +msgid "%s this month" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "%s used" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "%s your time" +msgstr "" + +#: web/src/shared/format.ts +msgid "%sd %sh" +msgstr "" + +#: web/src/shared/format.ts +msgid "%sh %sm" +msgstr "" + +#: web/src/shared/format.ts +msgid "%sm" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "A total for your whole access, it does not reset." +msgstr "" + +#: web/src/portal/setup.ts +msgid "APK file on" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Access %s" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Access ended" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Access must be lan, internet or both." +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Access paused" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Access until" +msgstr "" + +#: web/src/shared/format.ts +msgid "Active" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Add Tunnel" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Add a device" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Add device" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Add it from the device" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Add the connection" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Add this device" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Add this phone" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Add your first device" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link." +msgstr "" + +#: web/src/portal/page/access.ts +#: web/src/portal/page/devices.ts +msgid "Address copied" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Already has the app" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Android phone" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Android tablet" +msgstr "" + +#: web/src/portal/main.ts +msgid "Ask for a new one." +msgstr "" + +#: web/src/shared/format.ts +msgid "B" +msgstr "" + +#: web/src/portal/ui/sheet.ts +msgid "Back" +msgstr "" + +#: web/src/portal/page/frame.ts +msgid "Breadcrumb" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Cancel" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Circle %s: server %s does not exist." +msgstr "" + +#: web/src/portal/ui/sheet.ts +msgid "Close" +msgstr "" + +#: web/src/portal/flows/wait.ts +msgid "Close this and open it again to keep checking." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Configuration" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/flows/setup-view.ts +msgid "Configuration copied" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Confirm the import and connect" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Connect" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Connected" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Connected, no data left" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Connected, outside your hours" +msgstr "" + +#: web/src/portal/flows/secure.ts +msgid "Connection settings only travel encrypted" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "Continue" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/ui/feedback.ts +msgid "Copied" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Copy %s" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy %s config" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Copy IP address" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Copy local address" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Copy or save the connection" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy the configuration" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy the key" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgctxt "in a sentence" +msgid "Copy the key" +msgstr "" + +#: web/src/portal/ui/codes.ts +msgid "Copy the link" +msgstr "" + +#: web/src/portal/ui/feedback.ts +msgid "Copying is blocked here. Select the text and copy it by hand." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Create connection" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Create from QR code" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Create from file or archive" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Cross-site request refused." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Data limit must be a positive number of GB." +msgstr "" + +#: web/src/shared/format.ts +msgid "Data limit reached" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Data this month" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Data used" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is also used by device %s of %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is not a plain IPv4 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is outside %s's tunnel %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is the router's own address on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address (none) is not a plain IPv4 address." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the preshared key is not a key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the private key is not a key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the public key is not a key." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s: person %s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit must be between 1 and 32." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit reached (%d)." +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Device name" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Device not found." +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Device removed" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Devices at home" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Devices at home and on this VPN reach yours as %s" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Disabled" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download %s config" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Download for Linux" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Download for Mac" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Download for Windows" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Download from" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Download on the" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download the file" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download the key" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "End date must be YYYY-MM-DD." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Endpoint must be a hostname or IP address." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Ends %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Enter a device name (up to 48 characters)." +msgstr "" + +#: web/src/shared/format.ts +msgid "Expired" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Extra data must be a positive number of GB." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "For computers and routers" +msgstr "" + +#: web/src/shared/format.ts +msgid "GB" +msgstr "" + +#: web/src/shared/format.ts +msgid "Gbit/s" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Get %s" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Get %s on the %s and come back here." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Get %s on the router" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Get it on" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Hide key" +msgstr "" + +#: web/src/portal/page/access.ts +#: web/src/shared/format.ts +msgid "Home network" +msgstr "" + +#: web/src/shared/format.ts +msgid "Home network + Internet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Hours must look like 07:00-23:00." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Hours, router time" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Hours, your time" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "IP address copied" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import Tunnel(s) from File…" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import from file or archive" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Import the configuration" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import tunnel(s) from file…" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "In %s:" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Included" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "Insert" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Install from" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Interface name: 1-12 lowercase letters, digits or _." +msgstr "" + +#: web/src/portal/page/access.ts +#: web/src/shared/format.ts +msgid "Internet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Invalid JSON." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Invalid public key." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "It ended on %s." +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "It gets new keys and its current settings stop working. Set it up again with the new ones that open next." +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next." +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Its connection stops working at once. You can add it again later." +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Its settings changed: update the connection" +msgstr "" + +#: web/src/shared/format.ts +msgid "KB" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/flows/setup-view.ts +msgid "Key copied" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed (is amneziawg-tools installed?)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Key generation failed (no random data)." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed." +msgstr "" + +#: web/src/portal/page/frame.ts +msgid "Language" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Last 7 days" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Last connected %s" +msgstr "" + +#: web/src/portal/ui/codes.ts +msgid "Link copied" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Linux PC" +msgstr "" + +#: web/src/shared/format.ts +msgid "MB" +msgstr "" + +#: web/src/shared/format.ts +msgid "Mbit/s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Method not allowed." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Mobile" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Monthly data must be a positive number of GB." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Name" +msgstr "" + +#: web/src/portal/flows/wait.ts +msgid "No connection yet" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "No data limit. The count starts again on the 1st." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "No end date" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free address left on %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free addresses left in the server subnet." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "No limit" +msgstr "" + +#: web/src/shared/format.ts +msgid "No server" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "No server yet" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Not found." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Not included" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Not on the %s right now?" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Not set up yet" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Nothing gets through until it resets." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Nothing opened? %s and add it in the app." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Now, %s" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "OR" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Official release on GitHub" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "On %s." +msgstr "" + +#: web/src/portal/setup.ts +msgid "On GitHub" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Only the admin can turn devices off." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/setup.ts +msgctxt "step" +msgid "Open %s" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Open %s." +msgstr "" + +#: web/src/portal/setup.ts +msgid "Open a terminal in the folder with the file" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Open in AmneziaVPN" +msgstr "" + +#: web/src/portal/flows/page-code.ts +#: web/src/portal/page/frame.ts +msgid "Open on another device" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Open on the device" +msgstr "" + +#: web/src/portal/flows/secure.ts +msgid "Open securely" +msgstr "" + +#: web/src/portal/flows/secure.ts +msgid "Open the link securely" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Open this link on the %s to set it up there." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Open this link over HTTPS to get the connection settings." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Open this page in Safari or Chrome: the store opens from here, but the app handoff does not." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Open your link on the %s" +msgstr "" + +#: web/src/portal/setup.ts +msgid "OpenWrt packages" +msgstr "" + +#: web/src/portal/setup.ts +msgid "OpenWrt packages + kmod" +msgstr "" + +#: web/src/shared/format.ts +msgid "Other" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Other devices at home reach yours as %s" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Out of data" +msgstr "" + +#: web/src/shared/format.ts +msgid "Outside allowed hours" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Outside your hours" +msgstr "" + +#: web/src/shared/format.ts +msgid "PC" +msgstr "" + +#: web/src/shared/format.ts +msgid "Paused" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: circle %s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: has the same personal link as %s." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: home service %s does not exist." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: server %s does not exist." +msgstr "" + +#: web/src/shared/format.ts +msgid "Phone" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Phones and tablets get a smaller packet size that suits mobile networks." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app." +msgstr "" + +#: web/src/portal/setup.ts +msgid "Pick the file and connect" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Point its camera at the code: the link opens there." +msgstr "" + +#: web/src/portal/flows/page-code.ts +msgid "Point its camera at the code: this page opens there." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Point its camera at the code: your page opens there with this device ready to add." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Port must be 1-65535." +msgstr "" + +#: web/src/shared/qr.ts +msgid "QR code" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "QR code" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +#: web/src/portal/page/devices.ts +msgid "Reconnect" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Reconnect %s?" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +#: web/src/portal/page/devices.ts +msgid "Remove" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Remove %s?" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Rename" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Rename %s" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Renamed" +msgstr "" + +#: web/src/portal/api.ts +msgid "Request failed (%s)" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Request too large." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Resets on the 1st." +msgstr "" + +#: web/src/shared/format.ts +msgid "Router" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Run" +msgstr "" + +#: web/src/portal/flows/device-actions.ts +msgid "Save" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Scan from QR code" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s in a message or a note, then in AmneziaVPN: %s." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s, then import %s in %s." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send to AmneziaVPN" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Server is disabled" +msgstr "" + +#: web/src/shared/format.ts +msgid "Server is turned off" +msgstr "" + +#: web/src/portal/flows/setup-view.ts +#: web/src/portal/page/devices.ts +msgid "Set up %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Set up a server first." +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Settings changed" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Settings changed, update needed" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share as a file" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share file" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share the file" +msgstr "" + +#: web/src/portal/ui/codes.ts +msgid "Share the link" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Show key" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Straight into %s" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Subnet must look like 10.77.0.0/24." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Subnet overlaps %s." +msgstr "" + +#: web/src/shared/format.ts +msgid "TB" +msgstr "" + +#: web/src/shared/format.ts +msgid "Tablet" +msgstr "" + +#: web/src/portal/setup.ts +msgid "Tap “%s” and connect" +msgstr "" + +#: web/src/portal/setup.ts +msgid "The APK is for phones without Google Play, or where the store hides the app." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "The admin has turned this device off." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "The app goes on the %s." +msgstr "" + +#: web/src/portal/flows/secure.ts +msgid "The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”)." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "The connection" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "The connection as one key" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The id may use lowercase letters, digits and underscores." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "The packages and the file for OpenWrt" +msgstr "" + +#: web/src/portal/main.ts +msgid "The page could not load" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The person has no server." +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Then come back here and tap" +msgstr "" + +#: web/src/portal/flows/setup-parts.ts +msgid "Then import it in the app" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "This device" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "This key is already in use." +msgstr "" + +#: web/src/portal/main.ts +msgid "This link no longer works" +msgstr "" + +#: web/src/portal/flows/secure.ts +msgid "This page is open without encryption. To add or set up a device, open the same link over HTTPS:" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Through the router" +msgstr "" + +#: web/src/portal/page/access.ts +#: web/src/portal/page/devices.ts +msgid "Today" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Too many changes in a short time. Try again in a few minutes." +msgstr "" + +#: web/src/portal/flows/setup-view.ts +msgid "Two steps, about a minute" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Two steps, about a minute: get the app, then add the connection." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown DNS choice." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Unknown action." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown circle." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Unknown device." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown end action." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown person." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown server." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown service %s." +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Update" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Update the connection" +msgstr "" + +#: web/src/portal/flows/wait.ts +msgid "Waiting for the connection" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Warning must be 0-60 days." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "What is it?" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "Windows PC" +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Yesterday" +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "You already have a device with this name." +msgstr "" + +#: web/src/portal/flows/add.ts +msgid "You have reached your limit of %s device" +msgid_plural "You have reached your limit of %s devices" +msgstr[0] "" +msgstr[1] "" + +#: web/src/portal/page/devices.ts +msgid "You have reached your limit of %s device. Remove one to add another." +msgid_plural "You have reached your limit of %s devices. Remove one to add another." +msgstr[0] "" +msgstr[1] "" + +#: web/src/portal/page/notices.ts +msgid "You haven’t been added to one." +msgstr "" + +#: web/src/portal/page/access.ts +msgid "Your access" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access has ended." +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access is paused." +msgstr "" + +#: web/src/portal/page/devices.ts +msgid "Your devices" +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s enabled again." +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s extended." +msgstr "" + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s resumed." +msgstr "" + +#: web/src/shared/format.ts +msgid "bit/s" +msgstr "" + +#: web/src/portal/setup.ts +msgid "computer" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "computer" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "day left" +msgid_plural "days left" +msgstr[0] "" +msgstr[1] "" + +#: web/src/portal/setup.ts +msgid "device" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "device" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "ended" +msgstr "" + +#: web/src/shared/format.ts +msgid "ends in %s day" +msgid_plural "ends in %s days" +msgstr[0] "" +msgstr[1] "" + +#: web/src/shared/format.ts +msgid "ends today" +msgstr "" + +#: web/src/shared/format.ts +msgid "ends tomorrow" +msgstr "" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "h1-h4 must be distinct" +msgstr "" + +#: web/src/shared/format.ts +msgid "just now" +msgstr "" + +#: web/src/shared/format.ts +msgid "kbit/s" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "name" +msgstr "" + +#: web/src/shared/format.ts +msgid "never" +msgstr "" + +#: web/src/portal/page/access.ts +msgid "no limit" +msgstr "" + +#: web/src/portal/setup.ts +msgid "phone" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "phone" +msgstr "" + +#: web/src/portal/setup.ts +msgid "router" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "router" +msgstr "" + +#: web/src/portal/setup.ts +msgid "tablet" +msgstr "" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "tablet" +msgstr "" + +#: web/src/portal/setup.ts +msgid "this device" +msgstr "" diff --git a/web/src/portal/i18n/ru.po b/web/src/portal/i18n/ru.po new file mode 100644 index 0000000..d1a6d8e --- /dev/null +++ b/web/src/portal/i18n/ru.po @@ -0,0 +1,1387 @@ +msgid "" +msgstr "" +"Project-Id-Version: Dawnline\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Language-Team: Russian\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" already exists." +msgstr "Устройство «%s» уже есть." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "\"%s\" is already taken." +msgstr "Идентификатор «%s» уже занят." + +#: web/src/portal/setup.ts +#: web/src/portal/ui/morph.ts +msgid "%s (Android: %s)" +msgstr "%s (на Android: %s)" + +#: web/src/portal/page/notices.ts +msgid "%s (router time)" +msgstr "%s (по времени роутера)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s already has %d device. Remove one first to lower the limit to %d." +msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d." +msgstr[0] "%s: уже %d устройство. Чтобы снизить лимит до %d, сначала удалите одно из них." +msgstr[1] "%s: уже %d устройства. Чтобы снизить лимит до %d, сначала удалите одно из них." +msgstr[2] "%s: уже %d устройств. Чтобы снизить лимит до %d, сначала удалите одно из них." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s can't use the network interface %s: it exists and isn't Dawnline's." +msgstr "Сервер %s не может использовать сетевой интерфейс %s: он уже существует и создан не Dawnline." + +#: web/src/portal/flows/wait.ts +msgid "%s connected" +msgstr "Подключено: %s" + +#: web/src/shared/format.ts +msgid "%s d ago" +msgstr "%s дн. назад" + +#: web/src/portal/page/access.ts +msgid "%s day" +msgid_plural "%s days" +msgstr[0] "%s день" +msgstr[1] "%s дня" +msgstr[2] "%s дней" + +#: web/src/shared/format.ts +msgid "%s h ago" +msgstr "%s ч назад" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s has an invalid interface name \"%s\"." +msgstr "У сервера %s недопустимое имя интерфейса «%s»." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "%s has no room for every device on %s." +msgstr "В подсети %s не хватит адресов для всех устройств сервера %s." + +#: web/src/shared/format.ts +msgid "%s in total" +msgstr "%s всего" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down." +msgstr "Сервер %s остановлен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: %s)." +msgstr "Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (установлен %s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s is kept down: its disguise needs AmneziaWG %s (installed: none)." +msgstr "Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (не установлен)." + +#: web/src/portal/page/access.ts +msgid "%s left" +msgstr "осталось %s" + +#: web/src/shared/format.ts +msgid "%s min ago" +msgstr "%s мин назад" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "%s must be a number or range" +msgstr "%s: нужно число или диапазон" + +#: web/src/portal/page/devices.ts +msgid "%s of %s" +msgstr "%s из %s" + +#: web/src/shared/format.ts +msgid "%s of %s GB" +msgstr "%s из %s ГБ" + +#: web/src/shared/format.ts +msgid "%s of %s GB this month" +msgstr "%s из %s ГБ в этом месяце" + +#: web/src/portal/page/access.ts +msgid "%s of %s in total." +msgstr "Всего %s из %s." + +#: web/src/portal/flows/add.ts +msgid "%s of %s slot free" +msgid_plural "%s of %s slots free" +msgstr[0] "Свободно %s из %s места" +msgstr[1] "Свободно %s из %s мест" +msgstr[2] "Свободно %s из %s мест" + +#: web/src/portal/page/access.ts +msgid "%s on %s" +msgstr "%s за %s" + +#: web/src/portal/page/devices.ts +msgid "%s options" +msgstr "Действия с устройством %s" + +#: web/src/shared/format.ts +msgid "%s this month" +msgstr "%s в этом месяце" + +#: web/src/portal/page/access.ts +msgid "%s used" +msgstr "%s использовано" + +#: web/src/portal/page/notices.ts +msgid "%s your time" +msgstr "%s по вашему времени" + +#: web/src/shared/format.ts +msgid "%sd %sh" +msgstr "%s д %s ч" + +#: web/src/shared/format.ts +msgid "%sh %sm" +msgstr "%s ч %s мин" + +#: web/src/shared/format.ts +msgid "%sm" +msgstr "%s мин" + +#: web/src/portal/page/access.ts +msgid "A total for your whole access, it does not reset." +msgstr "Считается за весь срок доступа и не обнуляется." + +#: web/src/portal/setup.ts +msgid "APK file on" +msgstr "APK-файл на" + +#: web/src/portal/page/notices.ts +msgid "Access %s" +msgstr "Доступ %s" + +#: web/src/portal/page/notices.ts +msgid "Access ended" +msgstr "Доступ закончился" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Access must be lan, internet or both." +msgstr "Доступ должен быть lan, internet или both." + +#: web/src/portal/page/notices.ts +msgid "Access paused" +msgstr "Доступ на паузе" + +#: web/src/portal/page/access.ts +msgid "Access until" +msgstr "Доступ до" + +#: web/src/shared/format.ts +msgid "Active" +msgstr "Активен" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Add Tunnel" +msgstr "Добавить туннель" + +#: web/src/portal/flows/add.ts +msgid "Add a device" +msgstr "Добавить устройство" + +#: web/src/portal/page/devices.ts +msgid "Add device" +msgstr "Добавить устройство" + +#: web/src/portal/flows/add.ts +msgid "Add it from the device" +msgstr "Добавить с самого устройства" + +#: web/src/portal/flows/setup-view.ts +msgid "Add the connection" +msgstr "Добавьте подключение" + +#: web/src/portal/page/devices.ts +msgid "Add this device" +msgstr "Добавить это устройство" + +#: web/src/portal/page/devices.ts +msgid "Add this phone" +msgstr "Добавить этот телефон" + +#: web/src/portal/page/devices.ts +msgid "Add your first device" +msgstr "Добавьте первое устройство" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link." +msgstr "Сейчас добавить устройство нельзя: VPN-сервер не готов. Обратитесь к тому, кто прислал вам эту ссылку." + +#: web/src/portal/page/access.ts +#: web/src/portal/page/devices.ts +msgid "Address copied" +msgstr "Адрес скопирован" + +#: web/src/portal/flows/setup-view.ts +msgid "Already has the app" +msgstr "Приложение уже установлено" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed (%s): install it in Dawnline → Components." +msgstr "AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "AmneziaWG is not installed: install it in Dawnline → Components." +msgstr "AmneziaWG не установлен: установите его в Dawnline → Компоненты." + +#: web/src/portal/flows/add.ts +msgid "Android phone" +msgstr "Телефон Android" + +#: web/src/portal/flows/add.ts +msgid "Android tablet" +msgstr "Планшет Android" + +#: web/src/portal/main.ts +msgid "Ask for a new one." +msgstr "Попросите новую." + +#: web/src/shared/format.ts +msgid "B" +msgstr "Б" + +#: web/src/portal/ui/sheet.ts +msgid "Back" +msgstr "Назад" + +#: web/src/portal/page/frame.ts +msgid "Breadcrumb" +msgstr "Навигационная цепочка" + +#: web/src/portal/flows/device-actions.ts +msgid "Cancel" +msgstr "Отмена" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Circle %s: server %s does not exist." +msgstr "Круг %s: сервера %s нет." + +#: web/src/portal/ui/sheet.ts +msgid "Close" +msgstr "Закрыть" + +#: web/src/portal/flows/wait.ts +msgid "Close this and open it again to keep checking." +msgstr "Закройте окно и откройте его снова, чтобы проверить ещё раз." + +#: web/src/portal/flows/setup-parts.ts +msgid "Configuration" +msgstr "Конфигурация" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/flows/setup-view.ts +msgid "Configuration copied" +msgstr "Конфигурация скопирована" + +#: web/src/portal/setup.ts +msgid "Confirm the import and connect" +msgstr "Подтвердите импорт и подключитесь" + +#: web/src/portal/page/devices.ts +msgid "Connect" +msgstr "Подключить" + +#: web/src/portal/page/devices.ts +msgid "Connected" +msgstr "Подключено" + +#: web/src/portal/page/devices.ts +msgid "Connected, no data left" +msgstr "Подключено, трафик закончился" + +#: web/src/portal/page/devices.ts +msgid "Connected, outside your hours" +msgstr "Подключено, вне часов доступа" + +#: web/src/portal/flows/secure.ts +msgid "Connection settings only travel encrypted" +msgstr "Настройки подключения передаются только в зашифрованном виде" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "Continue" +msgstr "Продолжить" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/ui/feedback.ts +msgid "Copied" +msgstr "Скопировано" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy" +msgstr "Скопировать" + +#: web/src/portal/page/access.ts +msgid "Copy %s" +msgstr "Скопировать %s" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy %s config" +msgstr "Скопировать конфигурацию %s" + +#: web/src/portal/page/devices.ts +msgid "Copy IP address" +msgstr "Скопировать IP-адрес" + +#: web/src/portal/page/devices.ts +msgid "Copy local address" +msgstr "Скопировать локальный адрес" + +#: web/src/portal/flows/setup-view.ts +msgid "Copy or save the connection" +msgstr "Скопировать или сохранить подключение" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy the configuration" +msgstr "Скопировать конфигурацию" + +#: web/src/portal/flows/setup-parts.ts +msgid "Copy the key" +msgstr "Скопировать ключ" + +#: web/src/portal/flows/setup-parts.ts +msgctxt "in a sentence" +msgid "Copy the key" +msgstr "Скопируйте ключ" + +#: web/src/portal/ui/codes.ts +msgid "Copy the link" +msgstr "Скопировать ссылку" + +#: web/src/portal/ui/feedback.ts +msgid "Copying is blocked here. Select the text and copy it by hand." +msgstr "Копирование здесь заблокировано. Выделите текст и скопируйте его вручную." + +#: web/src/portal/flows/add.ts +msgid "Create connection" +msgstr "Создать подключение" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Create from QR code" +msgstr "Создать из QR-кода" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Create from file or archive" +msgstr "Создать из файла или архива" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Cross-site request refused." +msgstr "Запрос с другого сайта отклонён." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Data limit must be a positive number of GB." +msgstr "Лимит трафика должен быть положительным числом ГБ." + +#: web/src/shared/format.ts +msgid "Data limit reached" +msgstr "Лимит трафика исчерпан" + +#: web/src/portal/page/access.ts +msgid "Data this month" +msgstr "Трафик за месяц" + +#: web/src/portal/page/access.ts +msgid "Data used" +msgstr "Трафик всего" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is also used by device %s of %s." +msgstr "Устройство %s (%s): адрес %s уже занят устройством %s (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is not a plain IPv4 address." +msgstr "Устройство %s (%s): адрес %s не является обычным IPv4-адресом." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is outside %s's tunnel %s." +msgstr "Устройство %s (%s): адрес %s вне туннеля сервера %s (%s)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address %s is the router's own address on %s." +msgstr "Устройство %s (%s): адрес %s принадлежит самому роутеру на сервере %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: address (none) is not a plain IPv4 address." +msgstr "Устройство %s (%s): нет IPv4-адреса." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the preshared key is not a key." +msgstr "Устройство %s (%s): общий ключ (PSK) некорректен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the private key is not a key." +msgstr "Устройство %s (%s): приватный ключ некорректен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s of %s: the public key is not a key." +msgstr "Устройство %s (%s): публичный ключ некорректен." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device %s: person %s does not exist." +msgstr "Устройство %s: человека %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit must be between 1 and 32." +msgstr "Лимит устройств: от 1 до 32." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Device limit reached (%d)." +msgstr "Достигнут лимит устройств (%d)." + +#: web/src/portal/flows/device-actions.ts +msgid "Device name" +msgstr "Имя устройства" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Device not found." +msgstr "Устройство не найдено." + +#: web/src/portal/flows/device-actions.ts +msgid "Device removed" +msgstr "Устройство удалено" + +#: web/src/portal/page/access.ts +msgid "Devices at home" +msgstr "Устройства дома" + +#: web/src/portal/page/access.ts +msgid "Devices at home and on this VPN reach yours as %s" +msgstr "Устройства дома и в этом VPN обращаются к вашим по адресу %s" + +#: web/src/portal/page/devices.ts +msgid "Disabled" +msgstr "Отключено" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download" +msgstr "Скачать" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download %s config" +msgstr "Скачать конфигурацию %s" + +#: web/src/portal/setup.ts +msgid "Download for Linux" +msgstr "Скачать для Linux" + +#: web/src/portal/setup.ts +msgid "Download for Mac" +msgstr "Скачать для Mac" + +#: web/src/portal/setup.ts +msgid "Download for Windows" +msgstr "Скачать для Windows" + +#: web/src/portal/setup.ts +msgid "Download from" +msgstr "Скачать с сайта" + +#: web/src/portal/setup.ts +msgid "Download on the" +msgstr "Загрузите в" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download the file" +msgstr "Скачать файл" + +#: web/src/portal/flows/setup-parts.ts +msgid "Download the key" +msgstr "Скачать ключ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "End date must be YYYY-MM-DD." +msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Endpoint must be a hostname or IP address." +msgstr "Адрес сервера должен быть именем хоста или IP-адресом." + +#: web/src/portal/page/access.ts +msgid "Ends %s" +msgstr "Закончится %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Enter a device name (up to 48 characters)." +msgstr "Введите название устройства (до 48 символов)." + +#: web/src/shared/format.ts +msgid "Expired" +msgstr "Срок истёк" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Extra data must be a positive number of GB." +msgstr "Дополнительный трафик должен быть положительным числом ГБ." + +#: web/src/portal/flows/setup-parts.ts +msgid "For computers and routers" +msgstr "Для компьютеров и роутеров" + +#: web/src/shared/format.ts +msgid "GB" +msgstr "ГБ" + +#: web/src/shared/format.ts +msgid "Gbit/s" +msgstr "Гбит/с" + +#: web/src/portal/flows/setup-view.ts +msgid "Get %s" +msgstr "Установите %s" + +#: web/src/portal/flows/setup-parts.ts +msgid "Get %s on the %s and come back here." +msgstr "Установите %s на %s и вернитесь сюда." + +#: web/src/portal/flows/setup-view.ts +msgid "Get %s on the router" +msgstr "Установите %s на роутер" + +#: web/src/portal/setup.ts +msgid "Get it on" +msgstr "Доступно в" + +#: web/src/portal/flows/setup-parts.ts +msgid "Hide key" +msgstr "Скрыть ключ" + +#: web/src/portal/page/access.ts +#: web/src/shared/format.ts +msgid "Home network" +msgstr "Домашняя сеть" + +#: web/src/shared/format.ts +msgid "Home network + Internet" +msgstr "Домашняя сеть и интернет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Hours must look like 07:00-23:00." +msgstr "Часы доступа указываются так: 07:00-23:00." + +#: web/src/portal/page/access.ts +msgid "Hours, router time" +msgstr "Часы доступа, время роутера" + +#: web/src/portal/page/access.ts +msgid "Hours, your time" +msgstr "Часы доступа, ваше время" + +#: web/src/portal/page/devices.ts +msgid "IP address copied" +msgstr "IP-адрес скопирован" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import Tunnel(s) from File…" +msgstr "Импорт туннелей из файла…" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import from file or archive" +msgstr "Импорт из файла или архива" + +#: web/src/portal/flows/setup-view.ts +msgid "Import the configuration" +msgstr "Импортируйте конфигурацию" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Import tunnel(s) from file…" +msgstr "Импорт туннелей из файла…" + +#: web/src/portal/flows/setup-parts.ts +msgid "In %s:" +msgstr "В %s:" + +#: web/src/portal/page/access.ts +msgid "Included" +msgstr "Есть доступ" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "Insert" +msgstr "Вставить" + +#: web/src/portal/setup.ts +msgid "Install from" +msgstr "Установить с сайта" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Interface name: 1-12 lowercase letters, digits or _." +msgstr "Имя интерфейса: 1–12 строчных латинских букв, цифр или _." + +#: web/src/portal/page/access.ts +#: web/src/shared/format.ts +msgid "Internet" +msgstr "Интернет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Invalid JSON." +msgstr "Некорректный JSON." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Invalid public key." +msgstr "Недопустимый публичный ключ." + +#: web/src/portal/page/access.ts +msgid "It ended on %s." +msgstr "Доступ закончился %s." + +#: web/src/portal/flows/device-actions.ts +msgid "It gets new keys and its current settings stop working. Set it up again with the new ones that open next." +msgstr "Устройство получит новые ключи, а текущие настройки перестанут работать. Настройте его заново с новыми - они откроются следом." + +#: web/src/portal/flows/device-actions.ts +msgid "It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next." +msgstr "Устройство получит новые ключи. Сейчас вы подключены через его текущие настройки: через несколько секунд после подтверждения связь прервётся. Добавьте новые - они откроются следом." + +#: web/src/portal/flows/device-actions.ts +msgid "Its connection stops working at once. You can add it again later." +msgstr "Подключение сразу перестанет работать. Устройство можно будет добавить снова." + +#: web/src/portal/page/devices.ts +msgid "Its settings changed: update the connection" +msgstr "Настройки изменились: обновите подключение" + +#: web/src/shared/format.ts +msgid "KB" +msgstr "КБ" + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/flows/setup-view.ts +msgid "Key copied" +msgstr "Ключ скопирован" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed (is amneziawg-tools installed?)." +msgstr "Не удалось создать ключ (установлен ли amneziawg-tools?)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "Key generation failed (no random data)." +msgstr "Не удалось создать ключ (нет случайных данных)." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Key generation failed." +msgstr "Не удалось создать ключ." + +#: web/src/portal/page/frame.ts +msgid "Language" +msgstr "Язык" + +#: web/src/portal/page/devices.ts +msgid "Last 7 days" +msgstr "За 7 дней" + +#: web/src/portal/page/devices.ts +msgid "Last connected %s" +msgstr "В сети %s" + +#: web/src/portal/ui/codes.ts +msgid "Link copied" +msgstr "Ссылка скопирована" + +#: web/src/portal/flows/add.ts +msgid "Linux PC" +msgstr "Компьютер с Linux" + +#: web/src/shared/format.ts +msgid "MB" +msgstr "МБ" + +#: web/src/shared/format.ts +msgid "Mbit/s" +msgstr "Мбит/с" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Method not allowed." +msgstr "Метод не поддерживается." + +#: web/src/portal/flows/add.ts +msgid "Mobile" +msgstr "Мобильный" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Monthly data must be a positive number of GB." +msgstr "Месячный лимит трафика должен быть положительным числом ГБ." + +#: web/src/portal/flows/add.ts +msgid "Name" +msgstr "Имя" + +#: web/src/portal/flows/wait.ts +msgid "No connection yet" +msgstr "Подключения пока нет" + +#: web/src/portal/page/access.ts +msgid "No data limit. The count starts again on the 1st." +msgstr "Лимита трафика нет. Счёт начинается заново 1-го числа." + +#: web/src/portal/page/access.ts +msgid "No end date" +msgstr "Бессрочно" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free address left on %s." +msgstr "На сервере %s не осталось свободных адресов." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "No free addresses left in the server subnet." +msgstr "В подсети сервера не осталось свободных адресов." + +#: web/src/portal/page/access.ts +msgid "No limit" +msgstr "Без лимита" + +#: web/src/shared/format.ts +msgid "No server" +msgstr "Нет сервера" + +#: web/src/portal/page/notices.ts +msgid "No server yet" +msgstr "Сервера пока нет" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Not found." +msgstr "Не найден." + +#: web/src/portal/page/access.ts +msgid "Not included" +msgstr "Нет доступа" + +#: web/src/portal/flows/setup-view.ts +msgid "Not on the %s right now?" +msgstr "Открыли на другом %s?" + +#: web/src/portal/page/devices.ts +msgid "Not set up yet" +msgstr "Ещё не настроено" + +#: web/src/portal/page/notices.ts +msgid "Nothing gets through until it resets." +msgstr "Ничего не проходит, пока лимит не обнулится." + +#: web/src/portal/flows/setup-parts.ts +msgid "Nothing opened? %s and add it in the app." +msgstr "Ничего не открылось? %s и добавьте его в приложении." + +#: web/src/portal/page/access.ts +msgid "Now, %s" +msgstr "Сейчас %s" + +#: web/src/portal/flows/add.ts +msgid "OR" +msgstr "ИЛИ" + +#: web/src/portal/setup.ts +msgid "Official release on GitHub" +msgstr "Официальная версия на GitHub" + +#: web/src/portal/page/notices.ts +msgid "On %s." +msgstr "Дата окончания - %s." + +#: web/src/portal/setup.ts +msgid "On GitHub" +msgstr "На GitHub" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Only the admin can turn devices off." +msgstr "Отключать устройства может только администратор." + +#: web/src/portal/flows/setup-parts.ts +#: web/src/portal/setup.ts +msgctxt "step" +msgid "Open %s" +msgstr "Откройте %s" + +#: web/src/portal/page/notices.ts +msgid "Open %s." +msgstr "Доступ открыт %s." + +#: web/src/portal/setup.ts +msgid "Open a terminal in the folder with the file" +msgstr "Откройте терминал в папке с файлом" + +#: web/src/portal/flows/setup-parts.ts +msgid "Open in AmneziaVPN" +msgstr "Открыть в AmneziaVPN" + +#: web/src/portal/flows/page-code.ts +#: web/src/portal/page/frame.ts +msgid "Open on another device" +msgstr "Открыть на другом устройстве" + +#: web/src/portal/flows/add.ts +msgid "Open on the device" +msgstr "Открыть на устройстве" + +#: web/src/portal/flows/secure.ts +msgid "Open securely" +msgstr "Открыть по HTTPS" + +#: web/src/portal/flows/secure.ts +msgid "Open the link securely" +msgstr "Откройте защищённую ссылку" + +#: web/src/portal/flows/setup-view.ts +msgid "Open this link on the %s to set it up there." +msgstr "Откройте эту ссылку на %s, чтобы настроить его там." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Open this link over HTTPS to get the connection settings." +msgstr "Чтобы получить настройки подключения, откройте эту ссылку по HTTPS." + +#: web/src/portal/flows/setup-view.ts +msgid "Open this page in Safari or Chrome: the store opens from here, but the app handoff does not." +msgstr "Откройте эту страницу в Safari или Chrome: магазин отсюда откроется, а передача в приложение - нет." + +#: web/src/portal/flows/setup-view.ts +msgid "Open your link on the %s" +msgstr "Откройте свою ссылку на %s" + +#: web/src/portal/setup.ts +msgid "OpenWrt packages" +msgstr "Пакеты OpenWrt" + +#: web/src/portal/setup.ts +msgid "OpenWrt packages + kmod" +msgstr "Пакеты OpenWrt + kmod" + +#: web/src/shared/format.ts +msgid "Other" +msgstr "Другое" + +#: web/src/portal/page/access.ts +msgid "Other devices at home reach yours as %s" +msgstr "Другие устройства дома обращаются к вашим по адресу %s" + +#: web/src/portal/page/notices.ts +msgid "Out of data" +msgstr "Трафик закончился" + +#: web/src/shared/format.ts +msgid "Outside allowed hours" +msgstr "Вне часов доступа" + +#: web/src/portal/page/notices.ts +msgid "Outside your hours" +msgstr "Вне часов доступа" + +#: web/src/shared/format.ts +msgid "PC" +msgstr "Компьютер" + +#: web/src/shared/format.ts +msgid "Paused" +msgstr "На паузе" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: circle %s does not exist." +msgstr "Человек %s: круга %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: has the same personal link as %s." +msgstr "Человек %s: личная ссылка совпадает со ссылкой человека %s." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: home service %s does not exist." +msgstr "Человек %s: домашнего сервиса %s нет." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Person %s: server %s does not exist." +msgstr "Человек %s: сервера %s нет." + +#: web/src/shared/format.ts +msgid "Phone" +msgstr "Телефон" + +#: web/src/portal/flows/add.ts +msgid "Phones and tablets get a smaller packet size that suits mobile networks." +msgstr "У телефонов и планшетов пакеты меньше - так лучше для мобильных сетей." + +#: web/src/portal/flows/setup-parts.ts +msgid "Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app." +msgstr "Выберите AmneziaVPN в меню «Поделиться». Его там нет? %s и добавьте его в приложении." + +#: web/src/portal/setup.ts +msgid "Pick the file and connect" +msgstr "Выберите файл и подключитесь" + +#: web/src/portal/flows/setup-view.ts +msgid "Point its camera at the code: the link opens there." +msgstr "Наведите камеру устройства на код - ссылка откроется на нём." + +#: web/src/portal/flows/page-code.ts +msgid "Point its camera at the code: this page opens there." +msgstr "Наведите камеру устройства на код - там откроется эта страница." + +#: web/src/portal/flows/add.ts +msgid "Point its camera at the code: your page opens there with this device ready to add." +msgstr "Наведите камеру устройства на код - там откроется ваша страница, и его можно будет сразу добавить." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Port must be 1-65535." +msgstr "Порт: от 1 до 65535." + +#: web/src/shared/qr.ts +msgid "QR code" +msgstr "QR-код" + +#: web/src/portal/setup.ts +msgctxt "AmneziaVPN app" +msgid "QR code" +msgstr "QR-код" + +#: web/src/portal/flows/device-actions.ts +#: web/src/portal/page/devices.ts +msgid "Reconnect" +msgstr "Переподключить" + +#: web/src/portal/flows/device-actions.ts +msgid "Reconnect %s?" +msgstr "Переподключить «%s»?" + +#: web/src/portal/flows/device-actions.ts +#: web/src/portal/page/devices.ts +msgid "Remove" +msgstr "Удалить" + +#: web/src/portal/flows/device-actions.ts +msgid "Remove %s?" +msgstr "Удалить «%s»?" + +#: web/src/portal/page/devices.ts +msgid "Rename" +msgstr "Переименовать" + +#: web/src/portal/flows/device-actions.ts +msgid "Rename %s" +msgstr "Переименовать «%s»" + +#: web/src/portal/flows/device-actions.ts +msgid "Renamed" +msgstr "Переименовано" + +#: web/src/portal/api.ts +msgid "Request failed (%s)" +msgstr "Не удалось выполнить запрос (%s)" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Request too large." +msgstr "Слишком большой запрос." + +#: web/src/portal/page/access.ts +msgid "Resets on the 1st." +msgstr "Обнуляется 1-го числа." + +#: web/src/shared/format.ts +msgid "Router" +msgstr "Роутер" + +#: web/src/portal/setup.ts +msgid "Run" +msgstr "Выполните" + +#: web/src/portal/flows/device-actions.ts +msgid "Save" +msgstr "Сохранить" + +#: web/src/portal/setup.ts +msgctxt "WireGuard app" +msgid "Scan from QR code" +msgstr "Сканировать QR-код" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s" +msgstr "Отправить на %s" + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s in a message or a note, then in AmneziaVPN: %s." +msgstr "Отправьте его на %s в сообщении или заметке, затем в AmneziaVPN: %s." + +#: web/src/portal/flows/setup-parts.ts +msgid "Send it to the %s, then import %s in %s." +msgstr "Отправьте его на %s, затем импортируйте %s в %s." + +#: web/src/portal/flows/setup-parts.ts +msgid "Send to AmneziaVPN" +msgstr "Отправить в AmneziaVPN" + +#: web/src/portal/page/notices.ts +msgid "Server is disabled" +msgstr "Сервер выключен" + +#: web/src/shared/format.ts +msgid "Server is turned off" +msgstr "Сервер выключен" + +#: web/src/portal/flows/setup-view.ts +#: web/src/portal/page/devices.ts +msgid "Set up %s" +msgstr "Настроить %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Set up a server first." +msgstr "Сначала настройте сервер." + +#: web/src/portal/page/devices.ts +msgid "Settings changed" +msgstr "Настройки изменились" + +#: web/src/portal/page/devices.ts +msgid "Settings changed, update needed" +msgstr "Настройки изменились, нужно обновить" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share as a file" +msgstr "Поделиться файлом" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share file" +msgstr "Поделиться файлом" + +#: web/src/portal/flows/setup-parts.ts +msgid "Share the file" +msgstr "Поделиться файлом" + +#: web/src/portal/ui/codes.ts +msgid "Share the link" +msgstr "Поделиться ссылкой" + +#: web/src/portal/flows/setup-parts.ts +msgid "Show key" +msgstr "Показать ключ" + +#: web/src/portal/flows/setup-parts.ts +msgid "Straight into %s" +msgstr "Сразу в %s" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Subnet must look like 10.77.0.0/24." +msgstr "Подсеть указывается так: 10.77.0.0/24." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Subnet overlaps %s." +msgstr "Подсеть пересекается с %s." + +#: web/src/shared/format.ts +msgid "TB" +msgstr "ТБ" + +#: web/src/shared/format.ts +msgid "Tablet" +msgstr "Планшет" + +#: web/src/portal/setup.ts +msgid "Tap “%s” and connect" +msgstr "Нажмите «%s» и подключитесь" + +#: web/src/portal/setup.ts +msgid "The APK is for phones without Google Play, or where the store hides the app." +msgstr "APK - для телефонов без Google Play или если магазин скрывает приложение." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "The admin has turned this device off." +msgstr "Администратор отключил это устройство." + +#: web/src/portal/flows/setup-view.ts +msgid "The app goes on the %s." +msgstr "Приложение ставится на %s." + +#: web/src/portal/flows/secure.ts +msgid "The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”)." +msgstr "Браузер может предупредить, что сертификату нельзя доверять: это собственный сертификат роутера. Продолжите переход («Дополнительные» → «Перейти на сайт»)." + +#: web/src/portal/flows/setup-parts.ts +msgid "The connection" +msgstr "Подключение" + +#: web/src/portal/flows/setup-parts.ts +msgid "The connection as one key" +msgstr "Подключение одним ключом" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The id may use lowercase letters, digits and underscores." +msgstr "В идентификаторе можно использовать строчные латинские буквы, цифры и подчёркивания." + +#: web/src/portal/flows/setup-view.ts +msgid "The packages and the file for OpenWrt" +msgstr "Пакеты и файл для OpenWrt" + +#: web/src/portal/main.ts +msgid "The page could not load" +msgstr "Не удалось загрузить страницу" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "The person has no server." +msgstr "У человека нет сервера." + +#: web/src/portal/flows/setup-parts.ts +msgid "Then come back here and tap" +msgstr "Затем вернитесь сюда и нажмите" + +#: web/src/portal/flows/setup-parts.ts +msgid "Then import it in the app" +msgstr "Затем импортируйте его в приложении" + +#: web/src/portal/page/devices.ts +msgid "This device" +msgstr "Это устройство" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "This key is already in use." +msgstr "Этот ключ уже используется." + +#: web/src/portal/main.ts +msgid "This link no longer works" +msgstr "Эта ссылка больше не работает" + +#: web/src/portal/flows/secure.ts +msgid "This page is open without encryption. To add or set up a device, open the same link over HTTPS:" +msgstr "Эта страница открыта без шифрования. Чтобы добавить или настроить устройство, откройте ту же ссылку по HTTPS:" + +#: web/src/portal/page/access.ts +msgid "Through the router" +msgstr "Через роутер" + +#: web/src/portal/page/access.ts +#: web/src/portal/page/devices.ts +msgid "Today" +msgstr "Сегодня" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Too many changes in a short time. Try again in a few minutes." +msgstr "Слишком много изменений за короткое время. Попробуйте ещё раз через несколько минут." + +#: web/src/portal/flows/setup-view.ts +msgid "Two steps, about a minute" +msgstr "Два шага, около минуты" + +#: web/src/portal/page/devices.ts +msgid "Two steps, about a minute: get the app, then add the connection." +msgstr "Два шага, около минуты: установите приложение, затем добавьте подключение." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown DNS choice." +msgstr "Неизвестный вариант DNS." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Unknown action." +msgstr "Неизвестное действие." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown circle." +msgstr "Неизвестный круг." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/devices.uc +msgid "Unknown device." +msgstr "Неизвестное устройство." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown end action." +msgstr "Неизвестное действие по окончании доступа." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown person." +msgstr "Неизвестный человек." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown server." +msgstr "Неизвестный сервер." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Unknown service %s." +msgstr "Неизвестный сервис %s." + +#: web/src/portal/page/devices.ts +msgid "Update" +msgstr "Обновить" + +#: web/src/portal/page/devices.ts +msgid "Update the connection" +msgstr "Обновить подключение" + +#: web/src/portal/flows/wait.ts +msgid "Waiting for the connection" +msgstr "Ждём подключения" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc +msgid "Warning must be 0-60 days." +msgstr "Предупреждать можно за 0–60 дней." + +#: web/src/portal/flows/add.ts +msgid "What is it?" +msgstr "Что это за устройство?" + +#: web/src/portal/flows/add.ts +msgid "Windows PC" +msgstr "Компьютер с Windows" + +#: web/src/portal/page/devices.ts +msgid "Yesterday" +msgstr "Вчера" + +#: web/src/portal/flows/add.ts +msgid "You already have a device with this name." +msgstr "У вас уже есть устройство с таким именем." + +#: web/src/portal/flows/add.ts +msgid "You have reached your limit of %s device" +msgid_plural "You have reached your limit of %s devices" +msgstr[0] "Достигнут лимит - %s устройство" +msgstr[1] "Достигнут лимит - %s устройства" +msgstr[2] "Достигнут лимит - %s устройств" + +#: web/src/portal/page/devices.ts +msgid "You have reached your limit of %s device. Remove one to add another." +msgid_plural "You have reached your limit of %s devices. Remove one to add another." +msgstr[0] "Достигнут лимит - %s устройство. Удалите одно, чтобы добавить новое." +msgstr[1] "Достигнут лимит - %s устройства. Удалите одно, чтобы добавить новое." +msgstr[2] "Достигнут лимит - %s устройств. Удалите одно, чтобы добавить новое." + +#: web/src/portal/page/notices.ts +msgid "You haven’t been added to one." +msgstr "Вас ещё не добавили ни на один сервер." + +#: web/src/portal/page/access.ts +msgid "Your access" +msgstr "Ваш доступ" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access has ended." +msgstr "Ваш доступ закончился." + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/portal.uc +msgid "Your access is paused." +msgstr "Ваш доступ на паузе." + +#: web/src/portal/page/devices.ts +msgid "Your devices" +msgstr "Ваши устройства" + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s enabled again." +msgstr "Ваши устройства не подключатся, пока его снова не включат." + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s extended." +msgstr "Ваши устройства не подключатся, пока доступ не продлят." + +#: web/src/portal/page/notices.ts +msgid "Your devices can’t connect until it’s resumed." +msgstr "Ваши устройства не подключатся, пока доступ не возобновят." + +#: web/src/shared/format.ts +msgid "bit/s" +msgstr "бит/с" + +#: web/src/portal/setup.ts +msgid "computer" +msgstr "компьютер" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "computer" +msgstr "компьютере" + +#: web/src/portal/page/access.ts +msgid "day left" +msgid_plural "days left" +msgstr[0] "день остался" +msgstr[1] "дня осталось" +msgstr[2] "дней осталось" + +#: web/src/portal/setup.ts +msgid "device" +msgstr "устройство" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "device" +msgstr "устройстве" + +#: web/src/portal/page/access.ts +msgid "ended" +msgstr "закончился" + +#: web/src/shared/format.ts +msgid "ends in %s day" +msgid_plural "ends in %s days" +msgstr[0] "закончится через %s день" +msgstr[1] "закончится через %s дня" +msgstr[2] "закончится через %s дней" + +#: web/src/shared/format.ts +msgid "ends today" +msgstr "закончится сегодня" + +#: web/src/shared/format.ts +msgid "ends tomorrow" +msgstr "закончится завтра" + +#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc +msgid "h1-h4 must be distinct" +msgstr "h1-h4 должны быть разными" + +#: web/src/shared/format.ts +msgid "just now" +msgstr "только что" + +#: web/src/shared/format.ts +msgid "kbit/s" +msgstr "кбит/с" + +#: web/src/portal/page/access.ts +msgid "name" +msgstr "имя" + +#: web/src/shared/format.ts +msgid "never" +msgstr "никогда" + +#: web/src/portal/page/access.ts +msgid "no limit" +msgstr "без лимита" + +#: web/src/portal/setup.ts +msgid "phone" +msgstr "телефон" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "phone" +msgstr "телефоне" + +#: web/src/portal/setup.ts +msgid "router" +msgstr "роутер" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "router" +msgstr "роутере" + +#: web/src/portal/setup.ts +msgid "tablet" +msgstr "планшет" + +#: web/src/portal/setup.ts +msgctxt "on the" +msgid "tablet" +msgstr "планшете" + +#: web/src/portal/setup.ts +msgid "this device" +msgstr "это устройство" diff --git a/web/src/portal/main.ts b/web/src/portal/main.ts index c280de5..7f129b2 100644 --- a/web/src/portal/main.ts +++ b/web/src/portal/main.ts @@ -6,6 +6,8 @@ // Layout: no navbar, a breadcrumb on top. Phone: "Your access" first, devices // under it; desktop (≥ 960px): devices left, access right and sticky. +// First: the translation globals, before anything draws. +import { onLang } from './i18n'; import { put, h } from './dom'; import { EASE_OUT, play, publishSprings } from './motion'; import { gone, call } from './api'; @@ -26,6 +28,8 @@ const app = document.getElementById('app')!; let parts: { notice: HTMLElement; devices: HTMLElement; access: HTMLElement } | null = null; let booted = false; +/** How the page was last drawn: what a language change draws again. */ +let redraw: () => void = () => {}; /** The first paint comes in: the blocks rise one after the other, the sun rises behind its line. */ function intro() { @@ -65,6 +69,7 @@ function intro() { function render(o: RepaintOpts = {}) { const st = state(); if (!st) return; + redraw = render; // Paused by the admin: nothing on the page works until it is resumed, so the page is the one card that says so. if (st.person.state === 'paused') { document.title = placeName(); @@ -101,7 +106,14 @@ function only(icon: string, title: string, text: string, gone = false, tone: Ton function linkGone() { setState(null); closeSheet(true); - only('key', 'This link no longer works', 'Ask for a new one.', true); + redraw = linkGone; + only('key', _('This link no longer works'), _('Ask for a new one.'), true); +} + +/** Nothing could load: the reason as the router or the browser gave it. */ +function notLoaded(why: string) { + redraw = () => notLoaded(why); + only('server', _('The page could not load'), why); } /** @@ -130,10 +142,17 @@ async function refresh() { } catch (e) { if (gone(e)) linkGone(); // A network hiccup: keep showing the last state (the page loads fresh data on reload). - else if (!state()) only('server', 'The page could not load', (e as Error).message); + else if (!state()) notLoaded((e as Error).message); } } +// Another language: everything is drawn again in it, the sections too (their headings are text). +onLang(() => { + closeMenu(true); + parts = null; + redraw(); +}); + // What the keyboard does never animates. document.addEventListener('keydown', (e) => { if (e.key !== 'Escape') return; diff --git a/web/src/portal/page/access.ts b/web/src/portal/page/access.ts index 5c31ca2..a151eec 100644 --- a/web/src/portal/page/access.ts +++ b/web/src/portal/page/access.ts @@ -5,7 +5,8 @@ // calendar of the weeks, with the admin's hours as a bar of the day. import type { Person } from '../../shared/types'; -import { ACCESS_LABEL, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format'; +import { accessLabel, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format'; +import { fill, fmt, locale, num, plural } from '../../shared/i18n'; import { h, ic, markup } from '../dom'; import { calendar, clockOf, hoursFor, minuteAt, monthOf, stretches } from '../days'; import { now, today, type State } from '../state'; @@ -18,6 +19,8 @@ import { reachableFromHome } from './devices'; const desc = (text: string) => h('p', { class: 'desc' }, text); /** A share of a length, as a CSS percentage. */ const pc = (part: number, whole: number) => `${((part / whole) * 100).toFixed(2)}%`; +/** A router day (YYYY-MM-DD) as "13 Oct", without the year. */ +const dayMonth = (d: string) => parseDay(d).toLocaleDateString(locale(), { day: 'numeric', month: 'short' }); /** What the access reaches, as two tiles: the home network and the internet, each in or out. */ function reachTiles(access: Person['access']): HTMLElement { @@ -27,14 +30,14 @@ function reachTiles(access: Person['access']): HTMLElement { { class: `reach-tile${on ? '' : ' off'}` }, glass(icon, on ? 'blue' : 'grey', 'gi rt-ic'), h('b', {}, name), - h('span', { class: 'rt-sub' }, on ? sub : 'Not included'), - h('span', { class: 'rt-mark', 'aria-label': on ? 'Included' : 'Not included' }, ic(on ? 'check' : 'minus')), + h('span', { class: 'rt-sub' }, on ? sub : _('Not included')), + h('span', { class: 'rt-mark', 'aria-label': on ? _('Included') : _('Not included') }, ic(on ? 'check' : 'minus')), ); return h( 'div', { class: 'reach2' }, - tile(access !== 'internet', 'home', 'Home network', 'Devices at home'), - tile(access !== 'lan', 'globe', 'Internet', 'Through the router'), + tile(access !== 'internet', 'home', _('Home network'), _('Devices at home')), + tile(access !== 'lan', 'globe', _('Internet'), _('Through the router')), ); } @@ -45,12 +48,12 @@ function namesAtHome(p: Person, mesh: boolean): Node[] { const first = named[0].hostname; const dot0 = first.indexOf('.'); const domain = dot0 > 0 ? first.slice(dot0) : ''; + const pattern = h('span', { class: 'mono' }, `${_('name')}${domain}`); return [ h( 'span', { class: 'lbl-s' }, - mesh ? 'Devices at home and on this VPN reach yours as ' : 'Other devices at home reach yours as ', - h('span', { class: 'mono' }, `name${domain}`), + ...fill(mesh ? _('Devices at home and on this VPN reach yours as %s') : _('Other devices at home reach yours as %s'), pattern), ), h( 'div', @@ -63,8 +66,8 @@ function namesAtHome(p: Person, mesh: boolean): Node[] { type: 'button', class: 'namechip', title: d.name, - 'aria-label': `Copy ${d.hostname}`, - onclick: (ev: Event) => copy(d.hostname, 'Address copied', ev.currentTarget), + 'aria-label': fmt(_('Copy %s'), d.hostname), + onclick: (ev: Event) => copy(d.hostname, _('Address copied'), ev.currentTarget), }, h('span', {}, dot > 0 ? [d.hostname.slice(0, dot), h('span', { class: 'faint' }, d.hostname.slice(dot))] : d.hostname), ic('copy'), @@ -95,12 +98,16 @@ function month(p: Person, used: number, pct: number): HTMLElement { const { days, day } = monthOf(today()); const series = p.month_days ?? []; const max = Math.max(1, ...series); - const short = (d: number) => - parseDay(`${today().slice(0, 8)}${String(d).padStart(2, '0')}`).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }); + const short = (d: number) => dayMonth(`${today().slice(0, 8)}${String(d).padStart(2, '0')}`); // The total, and a bar under the pointer in its place, at once: no morph while the pointer moves. const total = h('b', { class: 'num', 'data-t': 'm-used' }, bytes(used)); - const tail = h('span', {}, ' used'); - const read = h('span', { class: 'mread' }, total, tail); + const read = h('span', { class: 'mread' }); + /** The month's total, or (`d`) one day's: the number in its sentence. */ + const say = (v: number, d?: number) => { + setText(total, bytes(v)); + read.replaceChildren(...(d ? fill(_('%s on %s'), total, short(d)) : fill(_('%s used'), total))); + }; + say(used); const bars = h('div', { class: 'mbars' }); for (let i = 0; i < days; i++) { if (i >= day) { @@ -110,18 +117,12 @@ function month(p: Person, used: number, pct: number): HTMLElement { const v = series[i] ?? 0; const b = h('i', { class: i === day - 1 ? 'today' : '' }); b.style.height = `${Math.max(3, Math.round((v / max) * 64))}px`; - b.addEventListener('pointerenter', () => { - setText(total, bytes(v)); - setText(tail, ` on ${short(i + 1)}`); - }); - b.addEventListener('pointerleave', () => { - setText(total, bytes(used)); - setText(tail, ' used'); - }); + b.addEventListener('pointerenter', () => say(v, i + 1)); + b.addEventListener('pointerleave', () => say(used)); bars.appendChild(b); } // "Today" under its bar; the month's ends step aside when it comes close. - const td = h('span', { class: 'td' }, 'Today'); + const td = h('span', { class: 'td' }, _('Today')); td.style.left = pc(day - 0.5, days); const axis = h( 'div', @@ -142,7 +143,7 @@ function month(p: Person, used: number, pct: number): HTMLElement { h( 'span', { class: `num${p.state === 'quota' ? ' bad-t' : ''}`, 'data-t': 'm-left' }, - p.quota_limit ? `${bytes(Math.max(0, p.quota_limit - used))} left` : 'No limit', + p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit'), ), ), p.quota_limit ? meter(pct) : null, @@ -151,7 +152,9 @@ function month(p: Person, used: number, pct: number): HTMLElement { /** The days left as a number over a calendar of the weeks to the end (the last day ringed). */ function untilCal(p: Person, left: number): HTMLElement { - const day = (d: string) => parseDay(d).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' }); + const day = (d: string) => parseDay(d).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }); + // The weekdays' initials, Monday first (1 Jan 2024 was a Monday). + const weekdays = Array.from({ length: 7 }, (_x, i) => new Date(2024, 0, 1 + i, 12).toLocaleDateString(locale(), { weekday: 'narrow' })); const cells = calendar(today(), p.expires); const cal = cells ? h( @@ -160,7 +163,7 @@ function untilCal(p: Person, left: number): HTMLElement { h( 'div', { class: 'cal-h' }, - ['M', 'T', 'W', 'T', 'F', 'S', 'S'].map((x) => h('span', {}, x)), + weekdays.map((x) => h('span', {}, x)), ), h( 'div', @@ -179,9 +182,9 @@ function untilCal(p: Person, left: number): HTMLElement { h( 'div', { class: 'until-num' }, - h('b', { class: 'num' }, String(left)), - h('span', {}, `${left === 1 ? 'day' : 'days'} left`), - h('span', { class: 'until-sub' }, `Ends ${day(p.expires)}`), + h('b', { class: 'num' }, num(left)), + h('span', {}, N_(left, 'day left', 'days left')), + h('span', { class: 'until-sub' }, fmt(_('Ends %s'), day(p.expires))), ), cal, ); @@ -203,7 +206,7 @@ function hoursBar(hours: string, tzOffset: number | undefined): HTMLElement | nu i.style.width = pc(b - a, 1440); bar.appendChild(i); } - const mark = h('span', { class: `hours-now${inside ? '' : ' out'}`, title: `Now, ${clockOf(at)}` }); + const mark = h('span', { class: `hours-now${inside ? '' : ' out'}`, title: fmt(_('Now, %s'), clockOf(at)) }); mark.style.left = pc(at, 1440); bar.appendChild(mark); return h( @@ -212,7 +215,7 @@ function hoursBar(hours: string, tzOffset: number | undefined): HTMLElement | nu h( 'div', { class: 'hours-top' }, - h('span', {}, hw.yours ? 'Hours, your time' : 'Hours, router time'), + h('span', {}, hw.yours ? _('Hours, your time') : _('Hours, router time')), h('b', { class: 'num' }, `${clockOf(hw.from)}–${clockOf(hw.to)}`), ), bar, @@ -236,30 +239,30 @@ export function accessAccordion(st: State, open = 1): Accordion { ? h( 'span', { class: 'until-val' }, - h('span', { class: 'num', 'data-t': 'until-date' }, date(p.expires).replace(/ \d{4}$/, '')), + h('span', { class: 'num', 'data-t': 'until-date' }, dayMonth(p.expires)), left != null ? h( 'span', { class: `num ${left < 0 ? 'bad-t' : endsSoon(p, left) ? 'warn-t' : 'ok-t'}`, 'data-t': 'until-left' }, - left >= 0 ? `${left} day${left === 1 ? '' : 's'}` : 'ended', + left >= 0 ? plural(left, '%s day', '%s days') : _('ended'), ) : null, ) - : h('span', {}, 'No end date'); + : h('span', {}, _('No end date')); const untilBody = [ - !p.expires ? null : left != null && left < 0 ? desc(`It ended on ${date(p.expires)}.`) : untilCal(p, left ?? 0), + !p.expires ? null : left != null && left < 0 ? desc(fmt(_('It ended on %s.'), date(p.expires))) : untilCal(p, left ?? 0), p.hours ? hoursBar(p.hours, st.tz_offset) : null, ]; return accordion( [ { icon: glass(p.access === 'internet' ? 'globe' : p.access === 'lan' ? 'home' : 'shield'), - title: ACCESS_LABEL[p.access], + title: accessLabel(p.access), body: [reachTiles(p.access), ...namesAtHome(p, !!st.server.device_mesh)], }, { icon: glass('chart'), - title: total ? 'Data used' : 'Data this month', + title: total ? _('Data used') : _('Data this month'), val: h( 'span', { class: 'data-val' }, @@ -267,23 +270,23 @@ export function accessAccordion(st: State, open = 1): Accordion { h( 'span', { class: 'num', 'data-t': 'data-val' }, - `${bytes(used)}${p.quota_limit ? ` / ${bytes(p.quota_limit)}` : ' · no limit'}`, + `${bytes(used)} ${p.quota_limit ? `/ ${bytes(p.quota_limit)}` : `· ${_('no limit')}`}`, ), ), valHide: true, body: [ - total ? desc(`${bytes(used)} of ${bytes(p.quota_limit)} in total.`) : month(p, used, pct), + total ? desc(fmt(_('%s of %s in total.'), bytes(used), bytes(p.quota_limit))) : month(p, used, pct), desc( !p.quota_limit - ? 'No data limit. The count starts again on the 1st.' + ? _('No data limit. The count starts again on the 1st.') : total - ? 'A total for your whole access, it does not reset.' - : 'Resets on the 1st.', + ? _('A total for your whole access, it does not reset.') + : _('Resets on the 1st.'), ), ], }, // No end date and no hours: nothing to open, the row just says so. - { icon: glass('calendar'), title: 'Access until', val: untilVal, valHide: !!p.expires && (left ?? 0) >= 0, body: untilBody }, + { icon: glass('calendar'), title: _('Access until'), val: untilVal, valHide: !!p.expires && (left ?? 0) >= 0, body: untilBody }, ], { open }, ); @@ -293,8 +296,8 @@ export function accessAccordion(st: State, open = 1): Accordion { export function accessSection(): HTMLElement { return h( 'section', - { class: 'access', id: 'access', 'aria-label': 'Your access' }, - h('div', { class: 'sec-head' }, h('h2', {}, 'Your access')), + { class: 'access', id: 'access', 'aria-label': _('Your access') }, + h('div', { class: 'sec-head' }, h('h2', {}, _('Your access'))), h('div', { class: 'acc-slot' }), ); } diff --git a/web/src/portal/page/devices.ts b/web/src/portal/page/devices.ts index 4d70c37..21c2084 100644 --- a/web/src/portal/page/devices.ts +++ b/web/src/portal/page/devices.ts @@ -6,6 +6,7 @@ import type { Device, Person } from '../../shared/types'; import { addDays, ago, byDeviceState, bytes, parseDay } from '../../shared/format'; +import { fmt, locale, num, plural } from '../../shared/i18n'; import { h, ic } from '../dom'; import { BOUNCY, EASE_IN, EASE_OUT, SMOOTH, play } from '../motion'; import { now, today, type RepaintOpts, type State } from '../state'; @@ -22,16 +23,16 @@ export const reachableFromHome = (p: Person, d: Device) => p.access !== 'interne /** The status line: its class and words (short, on one line; the full wording shows on hover). */ function statusOf(d: Device, p: Person): [string, string] { - if (d.disabled) return ['', 'Disabled']; + if (d.disabled) return ['', _('Disabled')]; // The Update pill beside it says what to do. - if (d.config_stale && d.handshake) return ['warn-t', 'Settings changed']; + if (d.config_stale && d.handshake) return ['warn-t', _('Settings changed')]; // Over the data limit or outside the hours the tunnel stays up but passes nothing: the app says // "connected", so say here why nothing works. - if (d.online && p.state === 'quota') return ['warn-t', 'Connected, no data left']; - if (d.online && p.state === 'hours') return ['warn-t', 'Connected, outside your hours']; - if (d.online) return ['ok-t', 'Connected']; - if (!d.handshake) return ['warn-t', 'Not set up yet']; - return ['', `Last connected ${ago(d.handshake, now())}`]; + if (d.online && p.state === 'quota') return ['warn-t', _('Connected, no data left')]; + if (d.online && p.state === 'hours') return ['warn-t', _('Connected, outside your hours')]; + if (d.online) return ['ok-t', _('Connected')]; + if (!d.handshake) return ['warn-t', _('Not set up yet')]; + return ['', fmt(_('Last connected %s'), ago(d.handshake, now()))]; } function menuItems(d: Device, st: State): (MenuItem | null)[] { @@ -39,8 +40,8 @@ function menuItems(d: Device, st: State): (MenuItem | null)[] { // How devices at home reach it: only where the router actually lets them through. ...(reachableFromHome(st.person, d) ? [ - { label: 'Copy IP address', icon: 'copy', run: () => copy(d.address, 'IP address copied') }, - ...(d.hostname ? [{ label: 'Copy local address', icon: 'home', run: () => copy(d.hostname, 'Address copied') }] : []), + { label: _('Copy IP address'), icon: 'copy', run: () => copy(d.address, _('IP address copied')) }, + ...(d.hostname ? [{ label: _('Copy local address'), icon: 'home', run: () => copy(d.hostname, _('Address copied')) }] : []), null, ] : []), @@ -48,24 +49,24 @@ function menuItems(d: Device, st: State): (MenuItem | null)[] { ...(d.disabled ? [] : [ - { label: 'Rename', icon: 'edit', run: () => rename(d) }, - { label: 'Reconnect', icon: 'refresh', tone: 'warn' as const, run: () => reconnect(d) }, - { label: 'Remove', icon: 'trash', tone: 'bad' as const, run: () => removeDevice(d) }, + { label: _('Rename'), icon: 'edit', run: () => rename(d) }, + { label: _('Reconnect'), icon: 'refresh', tone: 'warn' as const, run: () => reconnect(d) }, + { label: _('Remove'), icon: 'trash', tone: 'bad' as const, run: () => removeDevice(d) }, ]), ]; } /** "Today", "Yesterday", "Tue 13 Oct": a spark bar's day, on the router's calendar. */ function dayName(back: number): string { - if (back === 0) return 'Today'; - if (back === 1) return 'Yesterday'; - return parseDay(addDays(today(), -back)).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' }); + if (back === 0) return _('Today'); + if (back === 1) return _('Yesterday'); + return parseDay(addDays(today(), -back)).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }); } /** Last 7 days as a number and bars; a bar under the pointer puts its own day in the number's place. */ function usage(d: Device, stale: boolean): HTMLElement { const week = d.spark.reduce((a, b) => a + b, 0); - const lbl = h('span', { class: 'use-lbl' }, 'Last 7 days'); + const lbl = h('span', { class: 'use-lbl' }, _('Last 7 days')); const val = h('span', { class: 'use-val num', 'data-t': `${d.id}:use` }, bytes(week)); let side: HTMLElement; if (stale) @@ -74,12 +75,12 @@ function usage(d: Device, stale: boolean): HTMLElement { { type: 'button', class: 'upd-pill', - 'aria-label': 'Update the connection', - title: 'Its settings changed: update the connection', + 'aria-label': _('Update the connection'), + title: _('Its settings changed: update the connection'), onclick: () => reconnect(d), }, ic('refresh'), - h('span', {}, 'Update'), + h('span', {}, _('Update')), ); else { const max = Math.max(1, ...d.spark); @@ -94,7 +95,7 @@ function usage(d: Device, stale: boolean): HTMLElement { setText(val, bytes(v)); }); b.addEventListener('pointerleave', () => { - setText(lbl, 'Last 7 days'); + setText(lbl, _('Last 7 days')); setText(val, bytes(week)); }); side.appendChild(b); @@ -108,15 +109,15 @@ function card(d: Device, st: State): HTMLElement { const locked = !!st.locked; // The device this page was opened from (through the tunnel): it is connected, so say which one it is instead. const here = st.here === d.id; - const [cls, words] = here ? ['here-t', 'This device'] : statusOf(d, p); + const [cls, words] = here ? ['here-t', _('This device')] : statusOf(d, p); const setUp = !d.handshake && !d.disabled; const stale = d.config_stale && !setUp && !locked && !d.disabled; // On one line; the exact time, or the whole wording, on hover. const title = !here && d.handshake && !d.online && !d.disabled && !d.config_stale - ? new Date(d.handshake * 1000).toLocaleString('en-GB') + ? new Date(d.handshake * 1000).toLocaleString(locale()) : stale - ? 'Settings changed, update needed' + ? _('Settings changed, update needed') : words; const items = menuItems(d, st); const more = @@ -124,7 +125,13 @@ function card(d: Device, st: State): HTMLElement { ? null : h( 'button', - { type: 'button', class: 'knob more', 'aria-label': `${d.name} options`, 'aria-haspopup': 'menu', 'aria-expanded': 'false' }, + { + type: 'button', + class: 'knob more', + 'aria-label': fmt(_('%s options'), d.name), + 'aria-haspopup': 'menu', + 'aria-expanded': 'false', + }, ic('more'), ); more?.addEventListener('click', () => openMenu(more, items)); @@ -152,11 +159,11 @@ function card(d: Device, st: State): HTMLElement { { type: 'button', class: 'btn tint block setup-btn', - 'aria-label': `Set up ${d.name}`, + 'aria-label': fmt(_('Set up %s'), d.name), onclick: (ev: Event) => openSetup(d, ev.currentTarget), }, ic('qr'), - h('span', {}, 'Connect'), + h('span', {}, _('Connect')), ) : usage(d, stale), ); @@ -168,25 +175,25 @@ const firstCard = (mobile: boolean) => 'div', { class: 'dev first', 'data-id': 'first' }, glass('plus', 'blue'), - h('b', {}, 'Add your first device'), - h('p', {}, 'Two steps, about a minute: get the app, then add the connection.'), + h('b', {}, _('Add your first device')), + h('p', {}, _('Two steps, about a minute: get the app, then add the connection.')), h( 'button', { type: 'button', class: 'btn accent block', onclick: startAdd }, ic('plus'), - h('span', {}, mobile ? 'Add this phone' : 'Add this device'), + h('span', {}, mobile ? _('Add this phone') : _('Add this device')), ), ); const addCard = () => - h('button', { type: 'button', class: 'dev add', 'data-id': 'add', onclick: startAdd }, glass('plus'), h('span', {}, 'Add device')); + h('button', { type: 'button', class: 'dev add', 'data-id': 'add', onclick: startAdd }, glass('plus'), h('span', {}, _('Add device'))); /** The section, built once; `fill` puts the cards in. */ export function devicesSection(): HTMLElement { return h( 'section', - { class: 'devices', id: 'devices', 'aria-label': 'Your devices' }, - h('div', { class: 'sec-head' }, h('h2', {}, 'Your devices'), h('span', { class: 'aside num' })), + { class: 'devices', id: 'devices', 'aria-label': _('Your devices') }, + h('div', { class: 'sec-head' }, h('h2', {}, _('Your devices')), h('span', { class: 'aside num' })), h('div', { class: 'dgrid' }), h('p', { class: 'note-s limit', hidden: true }), ); @@ -254,7 +261,7 @@ export function fillDevices(section: HTMLElement, st: State, o: RepaintOpts = {} } if (repainting) morphChanged(grid, said); const count = section.querySelector('.sec-head .aside') as HTMLElement; - const n = `${p.devices.length} of ${p.device_limit}`; + const n = fmt(_('%s of %s'), num(p.devices.length), num(p.device_limit)); if (repainting) morphText(count, n); else count.textContent = n; // The admin may add devices past the limit. @@ -262,7 +269,11 @@ export function fillDevices(section: HTMLElement, st: State, o: RepaintOpts = {} const limit = section.querySelector('.limit') as HTMLElement; const was = limit.hidden; const hide = st.can_add || !!st.locked; - limit.textContent = `You have reached your limit of ${p.device_limit} devices. Remove one to add another.`; + limit.textContent = plural( + p.device_limit, + 'You have reached your limit of %s device. Remove one to add another.', + 'You have reached your limit of %s devices. Remove one to add another.', + ); limit.getAnimations().forEach((a) => a.cancel()); // A slot freed: the note fades the way it came, then leaves the layout. if (repainting && !was && hide) { diff --git a/web/src/portal/page/frame.ts b/web/src/portal/page/frame.ts index 9258459..26f7b59 100644 --- a/web/src/portal/page/frame.ts +++ b/web/src/portal/page/frame.ts @@ -1,11 +1,14 @@ // The page's frame: no navbar. The page fades out under the screen's top and // bottom edges (the top fade only once it scrolls, so the breadcrumb at rest // stays crisp), and opens with a breadcrumb: the Dawnline mark, the place (the -// server's name) and the person. The content goes in `body`. +// server's name) and the person, then the language and this page's code. The +// content goes in `body`. import { h, ic, markup } from '../dom'; import { placeName, state } from '../state'; import { showPageCode } from '../flows/page-code'; +import { openMenu } from '../ui/menu'; +import { LANGS, lang, setLang } from '../i18n'; // The sun rises from behind the horizon once, on the visit's first paint. const LOGO = @@ -37,10 +40,28 @@ export function single(on: boolean) { pageEl?.classList.toggle('single', on); } +/** The language: its code and a chevron; the menu lists the languages by their own names. */ +function langPicker(): HTMLElement { + const b = h( + 'button', + { type: 'button', class: 'cr-lang', 'aria-label': _('Language'), 'aria-haspopup': 'menu', 'aria-expanded': 'false' }, + h('span', {}, lang().toUpperCase()), + ic('chevron', 'i cr-down'), + ); + b.addEventListener('click', () => + openMenu( + b, + LANGS.map((l) => ({ label: l.name, checked: l.code === lang(), run: () => l.code !== lang() && setLang(l.code) })), + ), + ); + return b; +} + /** * The breadcrumb: the place, then the person (none when the link stopped - * working); at its end, this page's code for another device, on the page - * itself only (not over a card: paused, link gone, nothing loaded). + * working); at its end, the language and this page's code for another + * device, on the page itself only (not over a card: paused, link gone, + * nothing loaded). */ export function crumbs(gone = false, card = false) { if (!crumbsEl) return; @@ -50,12 +71,13 @@ export function crumbs(gone = false, card = false) { h('span', { class: 'cr-mark' }, markup(LOGO)), h( 'nav', - { class: 'cr-path', 'aria-label': 'Breadcrumb' }, + { class: 'cr-path', 'aria-label': _('Breadcrumb') }, place, p ? [ic('chevron'), h('span', { class: 'cur', 'aria-current': 'page' }, p.name)] : null, ), + ...(card ? [] : [langPicker()]), ...(p && !card - ? [h('button', { type: 'button', class: 'knob cr-qr', 'aria-label': 'Open on another device', onclick: showPageCode }, ic('qr'))] + ? [h('button', { type: 'button', class: 'knob cr-qr', 'aria-label': _('Open on another device'), onclick: showPageCode }, ic('qr'))] : []), ); } diff --git a/web/src/portal/page/notices.ts b/web/src/portal/page/notices.ts index 89118fd..d304c5f 100644 --- a/web/src/portal/page/notices.ts +++ b/web/src/portal/page/notices.ts @@ -4,6 +4,7 @@ import type { Person } from '../../shared/types'; import { daysLeft, date, endsIn, endsSoon } from '../../shared/format'; +import { fmt } from '../../shared/i18n'; import { h } from '../dom'; import { clockOf, hoursFor } from '../days'; import { state, today } from '../state'; @@ -23,25 +24,26 @@ export function notice(tone: Tone, icon: string, title: string | null, sub: stri /** The admin's hours as the visitor reads them: "08:00–22:00 your time" (or the router's, said so). */ export function hoursText(hours: string): string { const hw = hoursFor(hours, state()?.tz_offset, -new Date().getTimezoneOffset()); - if (!hw) return `${hours.replace('-', '–')} (router time)`; - return `${clockOf(hw.from)}–${clockOf(hw.to)} ${hw.yours ? 'your time' : '(router time)'}`; + if (!hw) return fmt(_('%s (router time)'), hours.replace('-', '–')); + const span = `${clockOf(hw.from)}–${clockOf(hw.to)}`; + return fmt(hw.yours ? _('%s your time') : _('%s (router time)'), span); } /** Why the person's devices can't connect: icon, a short title, and a line that adds to it (never says it again). */ export function stateNotice(p: Person): [string, string, string] { switch (p.state) { case 'server_off': - return ['server', 'Server is disabled', 'Your devices can’t connect until it’s enabled again.']; + return ['server', _('Server is disabled'), _('Your devices can’t connect until it’s enabled again.')]; case 'no_server': - return ['server', 'No server yet', 'You haven’t been added to one.']; + return ['server', _('No server yet'), _('You haven’t been added to one.')]; case 'quota': - return ['chart', 'Out of data', 'Nothing gets through until it resets.']; + return ['chart', _('Out of data'), _('Nothing gets through until it resets.')]; case 'expired': - return ['calendar', 'Access ended', 'Your devices can’t connect until it’s extended.']; + return ['calendar', _('Access ended'), _('Your devices can’t connect until it’s extended.')]; case 'hours': - return ['clock', 'Outside your hours', `Open ${hoursText(p.hours)}.`]; + return ['clock', _('Outside your hours'), fmt(_('Open %s.'), hoursText(p.hours))]; default: - return ['pause', 'Access paused', 'Your devices can’t connect until it’s resumed.']; + return ['pause', _('Access paused'), _('Your devices can’t connect until it’s resumed.')]; } } @@ -49,5 +51,7 @@ export function stateNotice(p: Person): [string, string, string] { export function pageNotice(p: Person): HTMLElement | null { if (p.state !== 'active') return notice(p.state === 'quota' || p.state === 'expired' ? 'bad' : 'warn', ...stateNotice(p)); const left = daysLeft(p.expires, today()); - return endsSoon(p, left) ? notice('warn', 'calendar', `Access ${endsIn(left as number)}`, `On ${date(p.expires)}.`) : null; + return endsSoon(p, left) + ? notice('warn', 'calendar', fmt(_('Access %s'), endsIn(left as number)), fmt(_('On %s.'), date(p.expires))) + : null; } diff --git a/web/src/portal/po.d.ts b/web/src/portal/po.d.ts new file mode 100644 index 0000000..8ce5526 --- /dev/null +++ b/web/src/portal/po.d.ts @@ -0,0 +1,6 @@ +// A .po catalog imported by the portal is its lookup table, made at build time +// (tsup.config.ts and vitest.config.ts read it with i18n/po.ts). +declare module '*.po' { + const catalog: import('../../i18n/po').Catalog; + export default catalog; +} diff --git a/web/src/portal/setup.ts b/web/src/portal/setup.ts index 04875ae..70c82e5 100644 --- a/web/src/portal/setup.ts +++ b/web/src/portal/setup.ts @@ -2,6 +2,7 @@ // is open on the device being set up. Pure: the set-up sheet (flows/) draws it. import type { Kind } from '../shared/types'; +import { fmt } from '../shared/i18n'; export type Platform = 'ios' | 'android' | 'windows' | 'mac' | 'linux' | 'unknown'; export type AppId = 'vpn' | 'awg' | 'wg'; @@ -61,64 +62,67 @@ export interface Store { } const GH_CLIENT = 'https://github.com/amnezia-vpn/amnezia-client/releases/latest'; -const APK: NonNullable = { - href: GH_CLIENT, - top: 'APK file on', +const apk = (href: string): NonNullable => ({ + href, + top: _('APK file on'), main: 'GitHub', mark: 'github', - why: 'The APK is for phones without Google Play, or where the store hides the app.', -}; + why: _('The APK is for phones without Google Play, or where the store hides the app.'), +}); /** Where the app comes from on a platform: the store first, the official GitHub release where no store has it. */ export function storeFor(app: AppId, platform: Platform): Store | null { + const onAppStore = _('Download on the'); + const onPlay = _('Get it on'); + const onGitHub = _('Official release on GitHub'); const S: Record>> = { vpn: { - ios: { href: 'https://apps.apple.com/app/amneziavpn/id1600529900', top: 'Download on the', main: 'App Store', mark: 'appstore' }, + ios: { href: 'https://apps.apple.com/app/amneziavpn/id1600529900', top: onAppStore, main: 'App Store', mark: 'appstore' }, android: { href: 'https://play.google.com/store/apps/details?id=org.amnezia.vpn', - top: 'Get it on', + top: onPlay, main: 'Google Play', mark: 'googleplay', - alt: APK, + alt: apk(GH_CLIENT), }, - windows: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Windows', mark: 'windows' }, - mac: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Mac', mark: 'apple' }, - linux: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Linux', mark: 'linux' }, + windows: { href: GH_CLIENT, top: onGitHub, main: _('Download for Windows'), mark: 'windows' }, + mac: { href: GH_CLIENT, top: onGitHub, main: _('Download for Mac'), mark: 'apple' }, + linux: { href: GH_CLIENT, top: onGitHub, main: _('Download for Linux'), mark: 'linux' }, }, awg: { - ios: { href: 'https://apps.apple.com/us/app/amneziawg/id6478942365', top: 'Download on the', main: 'App Store', mark: 'appstore' }, + ios: { href: 'https://apps.apple.com/us/app/amneziawg/id6478942365', top: onAppStore, main: 'App Store', mark: 'appstore' }, android: { href: 'https://play.google.com/store/apps/details?id=org.amnezia.awg', - top: 'Get it on', + top: onPlay, main: 'Google Play', mark: 'googleplay', - alt: { ...APK, href: 'https://github.com/amnezia-vpn/amneziawg-android/releases' }, + alt: apk('https://github.com/amnezia-vpn/amneziawg-android/releases'), }, windows: { href: 'https://github.com/amnezia-vpn/amneziawg-windows-client/releases', - top: 'Official release on GitHub', - main: 'Download for Windows', + top: onGitHub, + main: _('Download for Windows'), mark: 'windows', }, mac: { href: 'https://apps.apple.com/us/app/amneziawg/id6478942365', - top: 'Download on the', + top: onAppStore, main: 'Mac App Store', mark: 'appstore', }, - linux: { href: 'https://github.com/amnezia-vpn/amneziawg-tools', top: 'On GitHub', main: 'amneziawg-tools', mark: 'linux' }, + linux: { href: 'https://github.com/amnezia-vpn/amneziawg-tools', top: _('On GitHub'), main: 'amneziawg-tools', mark: 'linux' }, }, wg: { - ios: { href: 'https://apps.apple.com/app/wireguard/id1441195209', top: 'Download on the', main: 'App Store', mark: 'appstore' }, + ios: { href: 'https://apps.apple.com/app/wireguard/id1441195209', top: onAppStore, main: 'App Store', mark: 'appstore' }, android: { href: 'https://play.google.com/store/apps/details?id=com.wireguard.android', - top: 'Get it on', + top: onPlay, main: 'Google Play', mark: 'googleplay', }, - windows: { href: 'https://www.wireguard.com/install/', top: 'Download from', main: 'wireguard.com', mark: 'windows' }, - mac: { href: 'https://apps.apple.com/app/wireguard/id1451685025', top: 'Download on the', main: 'Mac App Store', mark: 'appstore' }, - linux: { href: 'https://www.wireguard.com/install/', top: 'Install from', main: 'wireguard.com', mark: 'linux' }, + windows: { href: 'https://www.wireguard.com/install/', top: _('Download from'), main: 'wireguard.com', mark: 'windows' }, + mac: { href: 'https://apps.apple.com/app/wireguard/id1451685025', top: onAppStore, main: 'Mac App Store', mark: 'appstore' }, + linux: { href: 'https://www.wireguard.com/install/', top: _('Install from'), main: 'wireguard.com', mark: 'linux' }, }, }; return S[app][platform] ?? null; @@ -129,12 +133,12 @@ export const routerStore = (app: AppId): Store => app === 'wg' ? { href: 'https://openwrt.org/docs/guide-user/services/vpn/wireguard/start', - top: 'OpenWrt packages', + top: _('OpenWrt packages'), main: 'wireguard-tools', mark: 'openwrt', } : // One line on a phone: the kernel module goes on top. - { href: 'https://openwrt.org/packages/start', top: 'OpenWrt packages + kmod', main: 'amneziawg-tools', mark: 'openwrt' }; + { href: 'https://openwrt.org/packages/start', top: _('OpenWrt packages + kmod'), main: 'amneziawg-tools', mark: 'openwrt' }; /** * Does AmneziaVPN here open a `vpn://` link? Only the Android app registers the @@ -146,31 +150,45 @@ export const opensKeyLinks = (platform: Platform): boolean => platform === 'andr /** The key as a file for the share sheet: AmneziaVPN on iOS imports `.vpn` files (the key as text). */ export const keyFileName = (confName: string): string => `${confName.replace(/\.conf$/i, '')}.vpn`; +/** A path through an app's menus: its items in order. */ +const menu = (...items: string[]) => items.join(' → '); + /* - * Inside the app: where the scanner and the importer are, as each platform's - * app words it. The WireGuard apps are the same apps as AmneziaWG (it is - * their fork), menus included. + * Inside the app: where the scanner and the importer are, word for word as + * each platform's app labels them, in its own Russian when the page is in + * Russian (every one of these apps has it). Checked against the apps' + * sources in October 2026: wireguard-apple, wireguard-android and + * wireguard-windows, their amneziawg forks (the same apps, menus included) + * and amnezia-client. The context keeps the apps' words apart from the + * portal's own. AmneziaVPN opens its "Connection" screen from the + in its + * bottom bar (no label there); the scanner is on it on phones only. */ -const TUNNEL_MENU: Partial> = { - ios: { file: '+ → Create from file or archive', qr: '+ → Create from QR code' }, - android: { file: '+ → Import from file or archive', qr: '+ → Scan from QR code' }, - mac: { file: '+ → Import tunnel(s) from file' }, - windows: { file: 'Add Tunnel → Import tunnel(s) from file' }, -}; +function tunnelMenu(platform: Platform): { file: string; qr?: string } | undefined { + const menus: Partial> = { + ios: { file: menu('+', _('Create from file or archive', 'WireGuard app')), qr: menu('+', _('Create from QR code', 'WireGuard app')) }, + android: { file: menu('+', _('Import from file or archive', 'WireGuard app')), qr: menu('+', _('Scan from QR code', 'WireGuard app')) }, + mac: { file: menu('+', _('Import Tunnel(s) from File…', 'WireGuard app')) }, + windows: { file: menu(_('Add Tunnel', 'WireGuard app'), _('Import tunnel(s) from file…', 'WireGuard app')) }, + }; + return menus[platform]; +} /** Where the app scans a code; a phone of either kind gets both wordings. */ export function scanPath(app: AppId, platform: Platform = 'unknown'): string { - if (app === 'vpn') return 'Add server → Scan QR'; - const qr = TUNNEL_MENU[platform]?.qr; - return qr ?? `${TUNNEL_MENU.ios!.qr} (Android: ${TUNNEL_MENU.android!.qr!.replace(/^.* → /, '')})`; + if (app === 'vpn') return menu('+', _('QR code', 'AmneziaVPN app')); + const qr = tunnelMenu(platform)?.qr; + return qr ?? fmt(_('%s (Android: %s)'), tunnelMenu('ios')!.qr, tunnelMenu('android')!.qr!.replace(/^.* → /, '')); } -/** Where the app takes a file (AmneziaVPN: the key). */ +/** Where the app takes a file (AmneziaVPN: the key, pasted by its Insert button); elsewhere, the Android app's words. */ export function importPath(app: AppId, platform: Platform = 'unknown'): string { - if (app === 'vpn') return 'Add server → Insert key'; - return TUNNEL_MENU[platform]?.file ?? 'Add tunnel → Import from file'; + if (app === 'vpn') return menu('+', _('Insert', 'AmneziaVPN app')); + return (tunnelMenu(platform) ?? tunnelMenu('android')!).file; } +/** The last step in AmneziaVPN, once the key is in: its Continue button. */ +export const vpnContinue = () => fmt(_('Tap “%s” and connect'), _('Continue', 'AmneziaVPN app')); + /** * The file into the app, step by step: [text, the part in bold]. Linux has no * app, only the tools: the file goes up straight from where it was saved @@ -179,25 +197,22 @@ export function importPath(app: AppId, platform: Platform = 'unknown'): string { export function importSteps(app: AppId, platform: Platform, file: string, shared: boolean): [string, string][] { if (platform === 'linux') return [ - ['Open a terminal in the folder with the file', ''], - ['Run ', `sudo ${app === 'wg' ? 'wg-quick' : 'awg-quick'} up ./${file}`], + [_('Open a terminal in the folder with the file'), ''], + // The command comes after the word, in bold: "Run sudo awg-quick up …". + [`${_('Run')} `, `sudo ${app === 'wg' ? 'wg-quick' : 'awg-quick'} up ./${file}`], ]; const path = importPath(app, platform); return [ - [`Open ${APP_NAME[app]}`, ''], + [fmt(_('Open %s', 'step'), APP_NAME[app]), ''], [path.replace(/ → [^→]*$/, ' → '), path.replace(/^.* → /, '')], - [shared ? 'Confirm the import and connect' : 'Pick the file and connect', ''], + [shared ? _('Confirm the import and connect') : _('Pick the file and connect'), ''], ]; } -export const PLATFORM_LABEL: Record = { - ios: 'iPhone / iPad', - android: 'Android', - windows: 'Windows', - mac: 'Mac', - linux: 'Linux', - unknown: 'this device', -}; +/** The platform in a sentence: its name, or "this device". */ +export function platformLabel(p: Platform): string { + return { ios: 'iPhone / iPad', android: 'Android', windows: 'Windows', mac: 'Mac', linux: 'Linux', unknown: _('this device') }[p]; +} /** * The personal link that opens straight on one device's set-up: the page then @@ -220,6 +235,16 @@ export const wantsAdd = (hash: string): boolean => hash === '#add'; /** * "the phone", "the computer": the device being set up, in a sentence. The * sheet's title already names it; the lines under it do not repeat the name. + * `on`: the word after "on the" ("open it on the phone"), which other + * languages decline (Russian: на телефоне, but на телефон after "to the"). */ -export const deviceNoun = (kind: Kind): string => - ({ phone: 'phone', tablet: 'tablet', computer: 'computer', router: 'router', other: 'device' })[kind]; +export const deviceNoun = (kind: Kind, on = false): string => + (on + ? { + phone: _('phone', 'on the'), + tablet: _('tablet', 'on the'), + computer: _('computer', 'on the'), + router: _('router', 'on the'), + other: _('device', 'on the'), + } + : { phone: _('phone'), tablet: _('tablet'), computer: _('computer'), router: _('router'), other: _('device') })[kind]; diff --git a/web/src/portal/styles/menu-toast.css b/web/src/portal/styles/menu-toast.css index 672fe0c..0736650 100644 --- a/web/src/portal/styles/menu-toast.css +++ b/web/src/portal/styles/menu-toast.css @@ -55,6 +55,10 @@ height: 16px; color: var(--text-2); } +/* An option's check, kept in its place on the others so the names line up. */ +.mi .i.off { + visibility: hidden; +} .mi.warn, .mi.warn .i { color: var(--warn); diff --git a/web/src/portal/styles/page.css b/web/src/portal/styles/page.css index 5e52e45..a895b00 100644 --- a/web/src/portal/styles/page.css +++ b/web/src/portal/styles/page.css @@ -81,6 +81,44 @@ body.scrolled .edge-fade.top { width: 14px; height: 14px; } +/* The language: a pill as high as the QR knob beside it, its code and a chevron that turns up while + the menu is open. */ +.cr-lang { + display: inline-flex; + align-items: center; + gap: 4px; + height: 32px; + padding: 0 8px 0 12px; + border-radius: 999px; + background: var(--knob); + color: var(--text); + font-size: 14px; + font-weight: 500; + letter-spacing: -0.01em; + flex: none; + transition: + transform 150ms var(--ease-out), + background-color 150ms; +} +.cr-lang:hover { + background: color-mix(in srgb, var(--knob), var(--text) 6%); +} +.cr-lang:active { + transform: scale(0.94); +} +.cr-lang[aria-expanded='true'] { + background: color-mix(in srgb, var(--knob), var(--text) 10%); +} +.cr-down { + width: 14px; + height: 14px; + color: var(--text-2); + transform: rotate(90deg); + transition: transform 200ms var(--ease-out); +} +.cr-lang[aria-expanded='true'] .cr-down { + transform: rotate(-90deg); +} /* Phones: one column, access first. From 960px: devices left, access right and sticky. The foot clears the bottom fade at the end of the scroll. */ diff --git a/web/src/portal/styles/sheet.css b/web/src/portal/styles/sheet.css index 1177265..a9c73a3 100644 --- a/web/src/portal/styles/sheet.css +++ b/web/src/portal/styles/sheet.css @@ -210,7 +210,8 @@ visibility: hidden; white-space: nowrap; } -/* Connected: nothing is left to do here, so × and the view's buttons step away; the sheet then closes by itself. */ +/* Connected: nothing is left to do here, so × and the view's buttons step away; the sheet then closes + by itself. A question has its own Cancel: no × beside it either. */ .sheet .x, .sheet-acts { transition: @@ -221,7 +222,8 @@ scale 240ms var(--ease-out); } .sheet.arrived .x, -.sheet.arrived .sheet-acts { +.sheet.arrived .sheet-acts, +.sheet.asks .x { opacity: 0; filter: blur(3px); scale: 0.9; @@ -229,38 +231,54 @@ } /* A question before something that cannot be undone. */ -.center-col { +.center-col, +.ask { display: flex; flex-direction: column; +} +.center-col { align-items: center; text-align: center; } -.center-col.ask { - padding-top: 28px; +/* A question before something that cannot be undone (Reconnect, Remove): the icon, the question + and what happens on the left edge, as iOS asks now, as far from the top as from the sides; the + buttons span the sheet under them. */ +.ask { + align-items: flex-start; + text-align: left; + padding-top: 24px; } .center-col.secure { padding-top: 4px; } -.center-col .gi.xl { +:is(.center-col, .ask) .gi.xl { width: 64px; height: 64px; margin: 8px 0 16px; } -.center-col h3 { +.ask .gi.xl { + margin: 0 0 18px; +} +:is(.center-col, .ask) h3 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -0.5px; } -.center-col p { +:is(.center-col, .ask) p { margin: 6px 0 22px; color: var(--text-2); font-size: 15px; line-height: 21px; +} +.center-col p { max-width: 30ch; text-wrap: balance; } +.ask p { + text-wrap: pretty; +} .center-col.secure p { margin-top: 0; } diff --git a/web/src/portal/ui/codes.ts b/web/src/portal/ui/codes.ts index 5e3fe96..ec211e9 100644 --- a/web/src/portal/ui/codes.ts +++ b/web/src/portal/ui/codes.ts @@ -98,7 +98,12 @@ export function linkRow(url: string): HTMLElement { h('span', { class: 'mono' }, url.replace(/^https?:\/\//, '')), h( 'button', - { type: 'button', class: 'knob', 'aria-label': 'Copy the link', onclick: (ev: Event) => copy(url, 'Link copied', ev.currentTarget) }, + { + type: 'button', + class: 'knob', + 'aria-label': _('Copy the link'), + onclick: (ev: Event) => copy(url, _('Link copied'), ev.currentTarget), + }, ic('copy'), ), share @@ -107,7 +112,7 @@ export function linkRow(url: string): HTMLElement { { type: 'button', class: 'knob', - 'aria-label': 'Share the link', + 'aria-label': _('Share the link'), onclick: () => navigator.share({ url, title: placeName() }).catch(() => undefined), }, ic('share'), diff --git a/web/src/portal/ui/feedback.ts b/web/src/portal/ui/feedback.ts index 85f3424..78bdbfe 100644 --- a/web/src/portal/ui/feedback.ts +++ b/web/src/portal/ui/feedback.ts @@ -43,7 +43,9 @@ export function toast(msg: string, bad = false) { /** * The control that copied says so for a moment: its icon turns into a check - * and a "Copy…" label (`.lbl`, a badge's main line) into "Copied". + * and its "Copy…" label (`.lbl`, a badge's main line) into "Copied". Every + * control that copies with a label says "Copy…" (in any language), so the + * label is not read for the word. */ function copied(from: Element) { if (from.classList.contains('copied')) return; @@ -67,16 +69,16 @@ function copied(from: Element) { }, ); } - if (label && /^Copy/.test(was)) morphText(label, 'Copied'); + if (label) morphText(label, _('Copied')); setTimeout(() => { if (check && icon) check.replaceWith(icon); - if (label && /^Copy/.test(was)) morphText(label, was); + if (label) morphText(label, was); from.classList.remove('copied'); }, 1600); } /** `from`: the control that copied, which then shows a check for a moment. */ -export async function copy(text: string, what = 'Copied', from?: EventTarget | null) { +export async function copy(text: string, what = _('Copied'), from?: EventTarget | null) { try { await navigator.clipboard.writeText(text); } catch { @@ -85,7 +87,7 @@ export async function copy(text: string, what = 'Copied', from?: EventTarget | n ta.select(); const ok = document.execCommand('copy'); ta.remove(); - if (!ok) return toast('Copying is blocked here. Select the text and copy it by hand.', true); + if (!ok) return toast(_('Copying is blocked here. Select the text and copy it by hand.'), true); } if (from instanceof Element) copied(from); toast(what); diff --git a/web/src/portal/ui/menu.ts b/web/src/portal/ui/menu.ts index fdcb3d6..31d95d7 100644 --- a/web/src/portal/ui/menu.ts +++ b/web/src/portal/ui/menu.ts @@ -1,14 +1,18 @@ // The ⋯ menu: a small panel under (or over) its button, items with an icon, // a highlight that glides after the pointer and takes the item's colour -// (orange for Reconnect, red for Remove). One at a time; it closes on a press -// outside, on scroll, on Escape and when its button is pressed again. +// (orange for Reconnect, red for Remove). A choice among options (the +// language) marks the current one with a check instead of icons. One at a +// time; it closes on a press outside, on scroll, on Escape and when its button +// is pressed again. import { h, ic } from '../dom'; import { EASE_IN, POP, play } from '../motion'; export interface MenuItem { label: string; - icon: string; + /** An action's icon; an option (`checked` set) shows a check in its place, on the current one only. */ + icon?: string; + checked?: boolean; tone?: 'warn' | 'bad'; run: () => unknown; } @@ -53,14 +57,15 @@ export function openMenu(anchor: HTMLElement, all: (MenuItem | null)[]) { 'button', { type: 'button', - role: 'menuitem', + role: it.checked === undefined ? 'menuitem' : 'menuitemradio', + 'aria-checked': it.checked === undefined ? null : String(it.checked), class: `mi ${it.tone ?? ''}`, onclick: () => { closeMenu(); it.run(); }, }, - ic(it.icon), + it.checked === undefined ? ic(it.icon ?? '') : ic('check', it.checked ? 'i' : 'i off'), h('span', {}, it.label), ); // The highlight comes in where the pointer is, then glides from item to item. diff --git a/web/src/portal/ui/morph.ts b/web/src/portal/ui/morph.ts index 38b61e0..543aee0 100644 --- a/web/src/portal/ui/morph.ts +++ b/web/src/portal/ui/morph.ts @@ -6,6 +6,7 @@ // "iPad connected"), and a menu path for another app or the other phone system // (`menuLine`: where the app scans, iOS "Create", Android "Scan"). +import { fmt } from '../../shared/i18n'; import { h, ic, markup, put, type Kid } from '../dom'; import { EASE_IN, EASE_OUT, POP, SMOOTH, calm, play } from '../motion'; @@ -229,8 +230,8 @@ export function morphText(el: HTMLElement, next: string, from = textOf(el), o: M easing: SMOOTH.easing, }); }); - const out = was.filter((_, i) => !stays.has(i)); - const inn = now.filter((_, j) => !comes.has(j)); + const out = was.filter((_x, i) => !stays.has(i)); + const inn = now.filter((_x, j) => !comes.has(j)); // A long text keeps the same overall sweep: the steps shorten instead. const so = Math.min(12, 160 / Math.max(1, out.length)); const si = Math.min(22, 260 / Math.max(1, inn.length)); @@ -521,7 +522,7 @@ export function menuLine(ios: string, android: string): MenuLine { ); const set = (i: string, a: string) => { - el.setAttribute('aria-label', (i === a ? i : `${i} (Android: ${a.split(' → ').pop()})`).replace(/ → /g, ' › ')); + el.setAttribute('aria-label', (i === a ? i : fmt(_('%s (Android: %s)'), i, a.split(' → ').pop())).replace(/ → /g, ' › ')); const I = i.split(' → '); const A = a.split(' → '); const next = I.map((s, n) => cut(s, A[n] ?? s)); diff --git a/web/src/portal/ui/sheet.ts b/web/src/portal/ui/sheet.ts index cec4830..4f89bc5 100644 --- a/web/src/portal/ui/sheet.ts +++ b/web/src/portal/ui/sheet.ts @@ -14,7 +14,7 @@ export interface View { el: HTMLElement; /** The sheet's accessible name while this view shows (its title). */ label: string; - /** A question (Remove, Reconnect): an alert dialog. */ + /** A question (Remove, Reconnect): an alert dialog, closed by its Cancel (no ×). */ asks?: boolean; /** Its own buttons, pinned beside × while it shows. */ acts?: HTMLElement | null; @@ -108,7 +108,7 @@ export function startWidth(p: WidthPlan | null) { /* ---------- the drawer ---------- */ function build() { - closeBtn = h('button', { type: 'button', class: 'knob x', 'aria-label': 'Close', onclick: () => closeSheet() }, ic('x')); + closeBtn = h('button', { type: 'button', class: 'knob x', onclick: () => closeSheet() }, ic('x')); actsEl = h('div', { class: 'sheet-acts' }); vp = h('div', { class: 'vp' }); scroller = h('div', { class: 'sheet-scroll' }, vp); @@ -122,7 +122,10 @@ function build() { function label(v: View) { sheetEl.setAttribute('aria-label', v.label); + // Built once, named each time: the language may have changed since. + closeBtn.setAttribute('aria-label', _('Close')); sheetEl.setAttribute('role', v.asks ? 'alertdialog' : 'dialog'); + sheetEl.classList.toggle('asks', !!v.asks); } /** The view being left (a new one, or the sheet closing) lets go of what it holds. */ @@ -466,7 +469,7 @@ export function head(title: string, o: { back?: boolean; acts?: boolean } = {}): return h( 'div', { class: `vhead${o.back ? ' center' : ''}${o.acts ? ' with-acts' : ''}` }, - o.back ? h('button', { type: 'button', class: 'knob back', 'aria-label': 'Back', onclick: back }, ic('chevron')) : null, + o.back ? h('button', { type: 'button', class: 'knob back', 'aria-label': _('Back'), onclick: back }, ic('chevron')) : null, h('h2', {}, title), ); } diff --git a/web/src/shared/format.ts b/web/src/shared/format.ts index fe597b8..9e1de50 100644 --- a/web/src/shared/format.ts +++ b/web/src/shared/format.ts @@ -1,36 +1,41 @@ -// Formatting helpers shared by the admin UI and the portal (English only). +// Formatting helpers shared by the admin UI and the portal, in the page's +// language (shared/i18n.ts): units, relative times, dates, labels. import type { Access, Kind, PersonState } from './types'; +import { fmt, locale, num, plural } from './i18n'; -export function bytes(n: number): string { - if (!n || n < 0) return '0 B'; - const units = ['B', 'KB', 'MB', 'GB', 'TB']; +/** A size with its unit: one decimal from 1 KB up to 100 of a unit ("1.5 GB", "120 MB"). */ +function sized(v: number, units: string[], step: number): string { let i = 0; - let v = n; - while (v >= 1024 && i < units.length - 1) { - v /= 1024; + while (v >= step && i < units.length - 1) { + v /= step; i++; } - return `${v >= 100 || i === 0 ? Math.round(v) : v.toFixed(1)} ${units[i]}`; + return `${v >= 100 || i === 0 ? num(Math.round(v)) : num(v, 1)} ${units[i]}`; +} + +export function bytes(n: number): string { + return sized(!n || n < 0 ? 0 : n, [_('B'), _('KB'), _('MB'), _('GB'), _('TB')], 1024); } /** Bytes per second as a bit rate. */ export function bits(bps: number): string { const b = bps * 8; - if (b < 1000) return `${Math.round(b)} bit/s`; - if (b < 1e6) return `${(b / 1e3).toFixed(b < 1e4 ? 1 : 0)} kbit/s`; - if (b < 1e9) return `${(b / 1e6).toFixed(b < 1e7 ? 1 : 0)} Mbit/s`; - return `${(b / 1e9).toFixed(1)} Gbit/s`; + const units = [_('bit/s'), _('kbit/s'), _('Mbit/s'), _('Gbit/s')]; + if (b < 1000) return `${num(Math.round(b))} ${units[0]}`; + const i = b < 1e6 ? 1 : b < 1e9 ? 2 : 3; + const v = b / 1000 ** i; + return `${num(v, i === 3 || v < 10 ? 1 : 0)} ${units[i]}`; } export function ago(ts: number, now = Date.now() / 1000): string { - if (!ts) return 'never'; + if (!ts) return _('never'); const d = Math.max(0, Math.round(now - ts)); - if (d < 60) return 'just now'; - if (d < 3600) return `${Math.floor(d / 60)} min ago`; - if (d < 86400) return `${Math.floor(d / 3600)} h ago`; - if (d < 86400 * 30) return `${Math.floor(d / 86400)} d ago`; - return new Date(ts * 1000).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }); + if (d < 60) return _('just now'); + if (d < 3600) return fmt(_('%s min ago'), Math.floor(d / 60)); + if (d < 86400) return fmt(_('%s h ago'), Math.floor(d / 3600)); + if (d < 86400 * 30) return fmt(_('%s d ago'), Math.floor(d / 86400)); + return new Date(ts * 1000).toLocaleDateString(locale(), { day: 'numeric', month: 'short', year: 'numeric' }); } export function duration(sec: number): string { @@ -38,17 +43,17 @@ export function duration(sec: number): string { const d = Math.floor(sec / 86400); const h = Math.floor((sec % 86400) / 3600); const m = Math.floor((sec % 3600) / 60); - if (d) return `${d}d ${h}h`; - if (h) return `${h}h ${m}m`; - return `${m}m`; + if (d) return fmt(_('%sd %sh'), d, h); + if (h) return fmt(_('%sh %sm'), h, m); + return fmt(_('%sm'), m); } export function clock(ts: number): string { const d = new Date(ts * 1000); const today = new Date(); const sameDay = d.toDateString() === today.toDateString(); - const t = d.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' }); - return sameDay ? t : `${d.toLocaleDateString('en-GB', { day: 'numeric', month: 'short' })} ${t}`; + const t = d.toLocaleTimeString(locale(), { hour: '2-digit', minute: '2-digit' }); + return sameDay ? t : `${d.toLocaleDateString(locale(), { day: 'numeric', month: 'short' })} ${t}`; } /* ---------- days (YYYY-MM-DD, the router's calendar) ---------- */ @@ -67,7 +72,7 @@ export function parseDay(s: string): Date { /** "1 Oct 2026". A YYYY-MM-DD is a calendar day; other strings and Dates are moments. */ export function fmtDay(d: Date | string): string { const v = typeof d === 'string' ? (/^\d{4}-\d{2}-\d{2}$/.test(d) ? parseDay(d) : new Date(d)) : d; - return v.toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }); + return v.toLocaleDateString(locale(), { day: 'numeric', month: 'short', year: 'numeric' }); } export function date(s: string): string { @@ -137,47 +142,37 @@ export function endsSoon(p: { expire_warn: number }, left: number | null): boole /** "ends today", "ends tomorrow", "ends in 7 days" for daysLeft() > 0. */ export function endsIn(left: number): string { - return left <= 1 ? 'ends today' : left === 2 ? 'ends tomorrow' : `ends in ${left} days`; -} - -/** "1 event", "2,000 events". */ -export function plural(n: number, one: string, many = `${one}s`): string { - return `${n.toLocaleString('en-GB')} ${n === 1 ? one : many}`; + return left <= 1 ? _('ends today') : left === 2 ? _('ends tomorrow') : plural(left, 'ends in %s day', 'ends in %s days'); } /** Small sizes on flash and in memory: B, KB, MB. */ export function kb(n: number): string { - return n < 1024 ? `${n} B` : n < 1048576 ? `${(n / 1024).toFixed(n < 10240 ? 1 : 0)} KB` : `${(n / 1048576).toFixed(1)} MB`; + if (n < 1024) return `${num(n)} ${_('B')}`; + return n < 1048576 ? `${num(n / 1024, n < 10240 ? 1 : 0)} ${_('KB')}` : `${num(n / 1048576, 1)} ${_('MB')}`; } -export const ACCESS_LABEL: Record = { - lan: 'Home network', - internet: 'Internet', - both: 'Home network + Internet', -}; - -export const ACCESS_SHORT: Record = { lan: 'LAN', internet: 'Internet', both: 'LAN + Internet' }; +export function accessLabel(a: Access): string { + return { lan: _('Home network'), internet: _('Internet'), both: _('Home network + Internet') }[a]; +} /** In picker order. */ export const KINDS: Kind[] = ['computer', 'phone', 'tablet', 'router', 'other']; -export const KIND_LABEL: Record = { - computer: 'PC', - phone: 'Phone', - tablet: 'Tablet', - router: 'Router', - other: 'Other', -}; +export function kindLabel(k: Kind): string { + return { computer: _('PC'), phone: _('Phone'), tablet: _('Tablet'), router: _('Router'), other: _('Other') }[k]; +} -export const STATE_LABEL: Record = { - active: 'Active', - paused: 'Paused', - expired: 'Expired', - quota: 'Data limit reached', - hours: 'Outside allowed hours', - no_server: 'No server', - server_off: 'Server is turned off', -}; +export function stateLabel(s: PersonState): string { + return { + active: _('Active'), + paused: _('Paused'), + expired: _('Expired'), + quota: _('Data limit reached'), + hours: _('Outside allowed hours'), + no_server: _('No server'), + server_off: _('Server is turned off'), + }[s]; +} export function initials(name: string): string { const parts = name.trim().split(/\s+/).filter(Boolean); @@ -190,8 +185,8 @@ export function initials(name: string): string { /** "1.2 GB of 50 GB" style quota text, or just usage when unlimited. */ export function quotaText(used: number, quotaGb: number, period: 'month' | 'total'): string { const u = bytes(used); - if (!quotaGb) return `${u} ${period === 'total' ? 'in total' : 'this month'}`; - return `${u} of ${quotaGb} GB${period === 'total' ? '' : ' this month'}`; + if (!quotaGb) return fmt(period === 'total' ? _('%s in total') : _('%s this month'), u); + return fmt(period === 'total' ? _('%s of %s GB') : _('%s of %s GB this month'), u, num(quotaGb)); } export function slugify(s: string): string { diff --git a/web/src/shared/globals.d.ts b/web/src/shared/globals.d.ts new file mode 100644 index 0000000..075410d --- /dev/null +++ b/web/src/shared/globals.d.ts @@ -0,0 +1,11 @@ +// The translation globals: LuCI's own in the admin UI (cbi.js), installed by the +// portal from its catalog (portal/i18n.ts). How to use them: shared/i18n.ts. + +declare global { + /** `msg` in the page's language (English when the catalog has no translation). */ + const _: (msg: string, ctx?: string) => string; + /** `singular` or `plural` for n, by the language's plural rules (Russian has three forms). */ + const N_: (n: number, singular: string, plural: string, ctx?: string) => string; +} + +export {}; diff --git a/web/src/shared/i18n.ts b/web/src/shared/i18n.ts new file mode 100644 index 0000000..fe1cdad --- /dev/null +++ b/web/src/shared/i18n.ts @@ -0,0 +1,58 @@ +// Translation helpers for the admin UI and the portal. Text is English in the +// code and goes through the globals _() and N_(): LuCI's own in the admin UI +// (cbi.js, looking up the luci-i18n-dawnline-* catalog of the page's +// language), installed by the portal from its bundled catalog (portal/i18n.ts). +// web/i18n/extract.ts collects the strings into the catalogs; how to write them +// is in rules/i18n.md. +// +// Placeholders are %s and %d, filled in order by fmt() (LuCI's +// String.format exists only in the admin UI). Numbers and dates follow the +// page's language: , which LuCI sets from its language and the +// portal from the visitor's choice. + +/** The page's language: "en", "ru". */ +export function lang(): string { + return (typeof document === 'undefined' ? '' : document.documentElement.lang) || 'en'; +} + +/** The locale for Intl: English dates stay day-first (en-GB), as before translations. */ +export function locale(): string { + const l = lang(); + return l === 'en' ? 'en-GB' : l; +} + +/** %s and %d replaced by the arguments in order, %% by a percent sign. */ +export function fmt(s: string, ...args: unknown[]): string { + let i = 0; + return s.replace(/%([%sd])/g, (_m, c: string) => (c === '%' ? '%' : String(args[i++] ?? ''))); +} + +/** A number in the page's language: 2,000 or 2 000; `digits` fixes the decimals. */ +export function num(n: number, digits?: number): string { + return n.toLocaleString(locale(), digits === undefined ? undefined : { minimumFractionDigits: digits, maximumFractionDigits: digits }); +} + +/** + * A count with its word: plural(n, '%s event', '%s events') is "1 event", + * "2,000 events" (and "21 событие", "22 события", "25 событий" in Russian). + * Both forms are literals: extract.ts reads them as one plural entry. + */ +export function plural(n: number, one: string, many: string): string { + return fmt(N_(n, one, many), num(n)); +} + +/** + * A translated sentence with elements in it (a link, a ): the text around + * the placeholders and the arguments, in order, as children for E() or h(). + * fill(_('Install it in %s'), link) is ['Install it in ', link]. + */ +export function fill(s: string, ...args: T[]): (string | T)[] { + let i = 0; + return s + .split(/(%[%sd])/) + .filter(Boolean) + .map((p) => (p === '%%' ? '%' : p === '%s' || p === '%d' ? args[i++] : p)); +} + +/** A string the router or a generated list holds (not a literal here): in the page's language when the catalog has it. */ +export const known = (s: string): string => _(s); diff --git a/web/src/shared/qr.ts b/web/src/shared/qr.ts index 3e64397..ab458b7 100644 --- a/web/src/shared/qr.ts +++ b/web/src/shared/qr.ts @@ -93,7 +93,7 @@ export function qrSvg(text: string, margin = 3, logo = true, look: QrLook = 'pla `` + `${mark(round ? bg : '#fff')}`; } - const open = ``; + const open = ``; return round ? `${open}` + `${logoTile}` diff --git a/web/src/shared/types.ts b/web/src/shared/types.ts index 7e43cab..d39544a 100644 --- a/web/src/shared/types.ts +++ b/web/src/shared/types.ts @@ -87,6 +87,7 @@ export interface Server { /** The tunnel core that serves it (see admin/cores); AmneziaWG when absent. */ core?: string; /** Why the tunnel can't run: its interface name is taken by a network section Dawnline didn't make. */ + /** Why the server can't start: a whole sentence from the router, its name in it. */ blocked?: string | null; ifname: string; port: number; diff --git a/web/tests/events.test.ts b/web/tests/events.test.ts index 679976f..294b2c9 100644 --- a/web/tests/events.test.ts +++ b/web/tests/events.test.ts @@ -1,7 +1,18 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { installFakeDom, text } from './fakedom'; import { csvCell, toCsv } from '../src/admin/events/csv'; -import { categoryOf, eventBy, isProblem } from '../src/admin/events/model'; +import { + adminName, + adminSentence, + categoryOf, + changedText, + daysOf, + eventBy, + isProblem, + logText, + noteText, + reasonText, +} from '../src/admin/events/model'; import { eventText } from '../src/admin/events/render'; import type { LogEvent, Person } from '../src/shared/types'; @@ -62,3 +73,49 @@ describe('events', () => { ).toBe('Device Myata · Phone changed network nas (10.0.0.2) → 5.6.7.8'); }); }); + +describe('the router’s words', () => { + it('puts the admin’s own changes into sentences', () => { + expect(adminSentence('changed', 'server', 'Home')).toEqual({ text: 'You changed server %s', named: true }); + expect(adminSentence('cleared', null, 'the service log')).toEqual({ text: 'You cleared the service log', named: false }); + expect(adminSentence('reset traffic history', null, 'for Anna')).toEqual({ text: 'You reset traffic history for %s', named: true }); + expect(adminName('reset traffic history', 'for Anna')).toBe('Anna'); + expect(adminSentence('frobnicated', 'gizmo', 'x')).toBeNull(); + }); + it('reads the notes, the reasons and the days', () => { + expect(noteText('port 8443, certificate')).toBe('port 8443, certificate'); + expect(noteText('3 events · people · older than 7 days')).toBe('3 events · People · older than 7 days'); + expect(noteText('12 entries older than 30 days')).toBe('12 entries, older than 30 days'); + expect(noteText('something new')).toBe('something new'); + expect(reasonText('data limit reached')).toBe('data limit reached'); + expect(daysOf('3 days')).toBe(3); + expect(daysOf('1 day')).toBe(1); + expect(daysOf('soon')).toBeNull(); + expect(changedText('device_limit, moved to Home')).toBe('device limit, moved to Home'); + }); +}); + +describe('service log lines', () => { + it('match their templates, values and older dashes kept', () => { + const g = globalThis as unknown as { _: (s: string) => string }; + const was = g._; + // A catalog that brackets what it knows. + g._ = (s: string) => `[${s}]`; + try { + expect(logText('stopped unexpectedly')).toBe('[stopped unexpectedly]'); + expect(logText('updated · 0.9.0 → 0.10.0')).toBe('[updated · %s → %s]'.replace('%s', '0.9.0').replace('%s', '0.10.0')); + expect(logText('are missing — loading them again')).toBe( + '[%s - %s]'.replace('%s', '[are missing]').replace('%s', '[loading them again]'), + ); + expect(logText("are missing - not repaired again (3 repairs didn't help)")).toBe( + "[%s - not repaired again (%d repairs didn't help)]".replace('%s', '[are missing]').replace('%d', '3'), + ); + expect(logText('updates available · Dawnline 0.11.0, 2 system packages')).toBe( + '[updates available · %s]'.replace('%s', 'Dawnline 0.11.0, [%d system packages]'.replace('%d', '2')), + ); + expect(logText('something the page never saw')).toBe('something the page never saw'); + } finally { + g._ = was; + } + }); +}); diff --git a/web/tests/format.test.ts b/web/tests/format.test.ts index c329017..24b4e02 100644 --- a/web/tests/format.test.ts +++ b/web/tests/format.test.ts @@ -1,18 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { - addDays, - addMonthsClamped, - date, - dayDiff, - daysLeft, - endsIn, - endsSoon, - fmtDay, - kb, - plural, - shiftDay, - todayOf, -} from '../src/shared/format'; +import { addDays, addMonthsClamped, date, dayDiff, daysLeft, endsIn, endsSoon, fmtDay, kb, shiftDay, todayOf } from '../src/shared/format'; +import { plural } from '../src/shared/i18n'; describe('months', () => { it('clamps the day to the end of the month', () => { @@ -69,8 +57,8 @@ describe('router days', () => { describe('numbers', () => { it('pluralises and sizes', () => { - expect(plural(1, 'event')).toBe('1 event'); - expect(plural(2000, 'address', 'addresses')).toBe('2,000 addresses'); + expect(plural(1, '%s event', '%s events')).toBe('1 event'); + expect(plural(2000, '%s address', '%s addresses')).toBe('2,000 addresses'); expect(kb(512)).toBe('512 B'); expect(kb(1536)).toBe('1.5 KB'); expect(kb(3 * 1048576)).toBe('3.0 MB'); diff --git a/web/tests/i18n.test.ts b/web/tests/i18n.test.ts new file mode 100644 index 0000000..66290c9 --- /dev/null +++ b/web/tests/i18n.test.ts @@ -0,0 +1,147 @@ +import { beforeAll, describe, expect, it } from 'vitest'; +import fs from 'node:fs'; +import { catalogOf, parsePo, pluralForms, writePo, type Po } from '../i18n/po'; +import { badTranslation, badText } from '../i18n/extract'; +import { lmo, sfh } from '../i18n/lmo'; +import { fill, fmt, lang, num, plural } from '../src/shared/i18n'; + +describe('po files', () => { + const po: Po = { + header: [ + ['Language', 'ru'], + ['Plural-Forms', 'nplurals=3; plural=(n != 1);'], + ], + entries: [ + { id: 'Say "hi" \\ there', str: ['Скажи «привет»'], refs: ['web/src/a.ts', 'web/src/b.ts'] }, + { ctx: 'state', id: 'Off', str: ['Выкл.'], refs: [] }, + { id: '%s day', plural: '%s days', str: ['%s день', '%s дня', '%s дней'], refs: ['web/src/c.ts'] }, + { id: 'Untranslated', str: [''], refs: [] }, + ], + }; + + it('reads back what it writes', () => { + const text = writePo(po); + expect(text).toContain('msgid "Say \\"hi\\" \\\\ there"'); + expect(text).toContain('"Plural-Forms: nplurals=3; plural=(n != 1);\\n"'); + expect(parsePo(text)).toEqual(po); + expect(pluralForms(po)).toBe(3); + }); + + it('joins continued strings and keeps unknown escapes as written', () => { + const p = parsePo('msgid ""\nmsgstr ""\n"Language: ru\\n"\n\nmsgid "Long "\n"line"\nmsgstr "Длинная "\n"строка\\n"\n'); + expect(p.header).toEqual([['Language', 'ru']]); + expect(p.entries[0]).toMatchObject({ id: 'Long line', str: ['Длинная строка\\n'] }); + }); + + it('makes a lookup table of the translated entries only', () => { + const c = catalogOf(po); + expect(c.s).toEqual({ 'Say "hi" \\ there': 'Скажи «привет»', 'state\u0004Off': 'Выкл.' }); + expect(c.p).toEqual({ '%s day': ['%s день', '%s дня', '%s дней'] }); + }); +}); + +describe('LMO catalogs', () => { + it('match what LuCI’s po2lmo makes, byte for byte', () => { + // po2lmo.lmo: the SDK's po2lmo run on po2lmo.po (context, plural forms, Cyrillic, a string left as it is). + const po = parsePo(fs.readFileSync(new URL('./i18n/po2lmo.po', import.meta.url), 'utf8')); + const want = fs.readFileSync(new URL('./i18n/po2lmo.lmo', import.meta.url)); + expect(Buffer.from(lmo(po)).equals(want)).toBe(true); + }); + it('hash keys as LuCI looks them up', () => { + // cbi.js: sfh("Save") is what the translations endpoint names "Save" by. + expect(sfh(new TextEncoder().encode('Save')).toString(16).padStart(8, '0')).toBe('219966c7'); + }); +}); + +describe('string checks', () => { + it('refuses what LuCI could not look up again', () => { + expect(badText('Fine text')).toBeNull(); + expect(badText(' lead')).toMatch(/starts or ends/); + expect(badText('two spaces')).toMatch(/two spaces/); + expect(badText('a\nb')).toMatch(/newline/); + expect(badText('')).toMatch(/empty/); + }); + it('wants the placeholders of the English', () => { + expect(badTranslation({ id: '%s of %s', str: ['%s из %s'], refs: [] })).toBeNull(); + expect(badTranslation({ id: '%s of %s', str: ['%s из'], refs: [] })).toMatch(/placeholders/); + expect(badTranslation({ id: '%s day', plural: '%s days', str: ['%s день', '%s дня', 'дней'], refs: [] })).toMatch(/placeholders/); + expect(badTranslation({ id: 'Line', str: ['Строка\\n'], refs: [] })).toMatch(/backslash/); + expect(badTranslation({ id: 'A — b', str: ['А — б'], refs: [] })).toMatch(/em dash/); + expect(badTranslation({ id: 'A — b', str: ['А - б'], refs: [] })).toBeNull(); + }); +}); + +describe('formatting', () => { + it('fills placeholders in order', () => { + expect(fmt('%s of %d', 'a', 3)).toBe('a of 3'); + expect(fmt('100%% of %s', 'x')).toBe('100% of x'); + expect(fmt('%s and %s', 'one')).toBe('one and '); + }); + it('puts elements into a sentence', () => { + const link = { el: 'a' }; + expect(fill('Install it in %s, then %s.', link, 'come back')).toEqual(['Install it in ', link, ', then ', 'come back', '.']); + expect(fill('%s%% done', 5)).toEqual([5, '%', ' done']); + }); + it('speaks English without a page language', () => { + expect(lang()).toBe('en'); + expect(num(2000)).toBe('2,000'); + expect(num(1.5, 1)).toBe('1.5'); + expect(plural(1, '%s event', '%s events')).toBe('1 event'); + }); +}); + +describe('the portal’s languages', () => { + let i18n: typeof import('../src/portal/i18n'); + const store: Record = {}; + + beforeAll(async () => { + Object.assign(globalThis, { + document: { documentElement: { lang: '' } }, + localStorage: { getItem: (k: string) => store[k] ?? null, setItem: (k: string, v: string) => (store[k] = v) }, + }); + i18n = await import('../src/portal/i18n'); + }); + + it('opens in the kept choice, else the browser’s first language it has', () => { + expect(i18n.pickLang(null, ['ru-RU', 'en-US'])).toBe('ru'); + expect(i18n.pickLang(null, ['de-DE', 'ru'])).toBe('ru'); + expect(i18n.pickLang(null, ['de-DE', 'fr'])).toBe('en'); + expect(i18n.pickLang('en', ['ru-RU'])).toBe('en'); + expect(i18n.pickLang('xx', ['ru-RU'])).toBe('ru'); + }); + + it('switches the page and keeps the choice', () => { + i18n.addCatalog('ru', { s: { Hello: 'Привет' }, p: { '%s device': ['%s устройство', '%s устройства', '%s устройств'] } }); + i18n.setLang('ru'); + expect(lang()).toBe('ru'); + expect(store['dl.lang']).toBe('ru'); + expect(_('Hello')).toBe('Привет'); + expect(_('Not in the catalog')).toBe('Not in the catalog'); + expect([1, 2, 5, 11, 21, 22, 25, 111].map((n) => plural(n, '%s device', '%s devices'))).toEqual([ + '1 устройство', + '2 устройства', + '5 устройств', + '11 устройств', + '21 устройство', + '22 устройства', + '25 устройств', + '111 устройств', + ]); + expect(num(2000)).toBe('2 000'); + i18n.setLang('en'); + expect(_('Hello')).toBe('Hello'); + expect(plural(2, '%s device', '%s devices')).toBe('2 devices'); + }); + + it('picks plural forms by the formula its catalog declares', () => { + const header = parsePo(fs.readFileSync(new URL('../src/portal/i18n/ru.po', import.meta.url), 'utf8')).header; + const formula = header + .find(([k]) => k === 'Plural-Forms')![1] + .replace(/^.*plural=/, '') + .replace(/;$/, ''); + const index = new Function('n', `return +(${formula});`) as (n: number) => number; + i18n.addCatalog('ru', { s: {}, p: { probe: ['0', '1', '2'] } }); + i18n.setLang('ru', false); + for (let n = 0; n <= 250; n++) expect(N_(n, 'probe', 'probes')).toBe(String(index(n))); + }); +}); diff --git a/web/tests/i18n/po2lmo.lmo b/web/tests/i18n/po2lmo.lmo new file mode 100644 index 0000000..e57bda2 Binary files /dev/null and b/web/tests/i18n/po2lmo.lmo differ diff --git a/web/tests/i18n/po2lmo.po b/web/tests/i18n/po2lmo.po new file mode 100644 index 0000000..c76ca31 --- /dev/null +++ b/web/tests/i18n/po2lmo.po @@ -0,0 +1,30 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Language: ru\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +msgid "Save" +msgstr "Сохранить" + +msgctxt "state" +msgid "Off" +msgstr "Выкл." + +msgid "%s device" +msgid_plural "%s devices" +msgstr[0] "%s устройство" +msgstr[1] "%s устройства" +msgstr[2] "%s устройств" + +msgid "Dawnline" +msgstr "Dawnline" + +msgid "Untranslated" +msgstr "" + +msgid "Say \"hi\" \\ there" +msgstr "Скажи «привет» \\ там" + +msgid "abc" +msgstr "abcde" diff --git a/web/tests/setup.test.ts b/web/tests/setup.test.ts index 9f6042a..e0e6221 100644 --- a/web/tests/setup.test.ts +++ b/web/tests/setup.test.ts @@ -94,13 +94,15 @@ describe('setup', () => { it('words the import as each platform’s app does', () => { expect(importPath('awg', 'ios')).toBe('+ → Create from file or archive'); expect(importPath('awg', 'android')).toBe('+ → Import from file or archive'); - expect(importPath('wg', 'windows')).toBe('Add Tunnel → Import tunnel(s) from file'); - expect(importPath('vpn', 'ios')).toBe('Add server → Insert key'); + expect(importPath('wg', 'windows')).toBe('Add Tunnel → Import tunnel(s) from file…'); + expect(importPath('vpn', 'ios')).toBe('+ → Insert'); + expect(scanPath('vpn')).toBe('+ → QR code'); + expect(importPath('awg', 'unknown')).toBe('+ → Import from file or archive'); expect(scanPath('awg', 'android')).toBe('+ → Scan from QR code'); expect(scanPath('awg')).toBe('+ → Create from QR code (Android: Scan from QR code)'); expect(importSteps('awg', 'mac', 'Outline-Home.conf', false)).toEqual([ ['Open AmneziaWG', ''], - ['+ → ', 'Import tunnel(s) from file'], + ['+ → ', 'Import Tunnel(s) from File…'], ['Pick the file and connect', ''], ]); expect(importSteps('awg', 'linux', 'Outline-Home.conf', false)[1]).toEqual(['Run ', 'sudo awg-quick up ./Outline-Home.conf']); diff --git a/web/tests/setup.ts b/web/tests/setup.ts new file mode 100644 index 0000000..e4fa4a5 --- /dev/null +++ b/web/tests/setup.ts @@ -0,0 +1,6 @@ +// Tests read English: _() and N_() as LuCI has them with no catalog loaded. +// The portal's own (portal/i18n.ts) replace these where a test imports it. +Object.assign(globalThis, { + _: (s: string) => s, + N_: (n: number, s: string, p: string) => (n === 1 ? s : p), +}); diff --git a/web/tsconfig.test.json b/web/tsconfig.test.json index 3946579..7d0b510 100644 --- a/web/tsconfig.test.json +++ b/web/tsconfig.test.json @@ -1,5 +1,5 @@ { "extends": "./tsconfig.json", - "compilerOptions": { "types": ["node"] }, - "include": ["src", "tests"] + "compilerOptions": { "types": ["node"], "allowImportingTsExtensions": true }, + "include": ["src", "tests", "i18n"] } diff --git a/web/tsup.config.ts b/web/tsup.config.ts index 19e453d..5e73c5d 100644 --- a/web/tsup.config.ts +++ b/web/tsup.config.ts @@ -2,6 +2,7 @@ import { defineConfig } from 'tsup'; import { build, transform, type Plugin } from 'esbuild'; import fs from 'node:fs'; import path from 'node:path'; +import { catalogOf, parsePo } from './i18n/po.ts'; const PKG = '../package/luci-app-dawnline'; const ADMIN_OUT = `${PKG}/htdocs/luci-static/resources/dawnline`; @@ -48,6 +49,17 @@ async function portalCss(): Promise { return r.outputFiles[0].text.trim(); } +/** The portal's translations: a .po it imports becomes its lookup table (i18n/po.ts). */ +export const poCatalog: Plugin = { + name: 'po-catalog', + setup(build) { + build.onLoad({ filter: /\.po$/ }, (args) => ({ + contents: JSON.stringify(catalogOf(parsePo(fs.readFileSync(args.path, 'utf8')))), + loader: 'json', + })); + }, +}; + // The admin styles are plain .css files under src/admin/styles, imported as // text and joined in styles/index.ts (rendered inside each view): each is // minified here. They get a namespace (and a path not ending in .css) of @@ -107,6 +119,7 @@ export default defineConfig([ sourcemap: false, minify: true, noExternal: ['qrcode-generator'], + esbuildPlugins: [poCatalog], esbuildOptions(o) { o.legalComments = 'none'; o.charset = 'utf8'; diff --git a/web/tsup.demo.config.ts b/web/tsup.demo.config.ts index 7c8e458..e1a8762 100644 --- a/web/tsup.demo.config.ts +++ b/web/tsup.demo.config.ts @@ -2,6 +2,7 @@ import { defineConfig } from 'tsup'; import { build } from 'esbuild'; import fs from 'node:fs'; import path from 'node:path'; +import { poCatalog } from './tsup.config'; // The portal demo: a static site in dist/demo (vercel.json deploys it). The // real portal with the demo's router in the page (src/portal/demo); its @@ -19,6 +20,7 @@ export default defineConfig({ sourcemap: false, minify: true, noExternal: ['qrcode-generator'], + esbuildPlugins: [poCatalog], esbuildOptions(o) { o.legalComments = 'none'; o.charset = 'utf8'; diff --git a/web/vitest.config.ts b/web/vitest.config.ts index b0e95a5..a17f80c 100644 --- a/web/vitest.config.ts +++ b/web/vitest.config.ts @@ -1,8 +1,20 @@ import { defineConfig } from 'vitest/config'; +import { catalogOf, parsePo } from './i18n/po.ts'; export default defineConfig({ + // A .po the portal imports is its lookup table, as in the bundle (tsup.config.ts). + plugins: [ + { + name: 'po-catalog', + enforce: 'pre', + transform(code, id) { + if (id.endsWith('.po')) return { code: `export default ${JSON.stringify(catalogOf(parsePo(code)))};`, map: null }; + }, + }, + ], test: { include: ['tests/**/*.test.ts'], environment: 'node', + setupFiles: ['tests/setup.ts'], }, });