diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3e1e531d..08901374 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -26,6 +26,7 @@ these entries stays in the GitHub releases and the Git history. - Let an agent read the running application through MCP with the `state` grant: the `webfront.state.*` tools give the registered functions, the calls to JavaScript, the browsers and tasks, and the watches (pages, differences, whole values) in the bounds of the inspectors; they never write (#685, ADR-027, `docs/DEVELOPING_WITH_AGENTS.md`). - Let an agent read the locked packages with the `packages` grant: the `list`, `why` and `info` operations answer `wf list --tree`, `wf why` and `wf info`, in environment 1.2.1 or later (#685, `docs/AUTOMATION.md`). - Browse in the **Packages** panel of the inspectors the locked packages as a tree under the roots of the manifest, with the requested ranges and the `peer`, `deduped` and multiple-version marks; search a package by name and open its detail with its `wf why` chains; the tree follows `wf install` and `wf restore` (#683, ADR-027, `docs/DEVELOPER_ENVIRONMENT.md`). +- See in the **Bridge** panel of the inspectors the state of the bridge in the interface's page: `webFront.ready` (pending, resolved, or rejected and why), the pending `cppFunction` calls and their duration, the Promises rejected lately, and the JavaScript functions that C++ calls; a bridge that no inspector reads records nothing (#684, ADR-027, `docs/DEVELOPER_ENVIRONMENT.md`). - Declare what the inspectors show with `app.watch(name, source)`, whose handle removes the watch when it is destroyed; the Watches panel follows their registrations and removals. Outside the developer environment and in a distribution build, `watch` registers nothing (#680, ADR-027). - Embed a plain interface directory (HTML, JavaScript, CSS, vendored files) from CMake with `webfront_embed_directory(app ui CLASS AppUI)`, without the developer environment: the build regenerates the provider when a file changes, and `fs::DocumentRootFirstFSWith` lets a development root serve in front of it (#675, `docs/EMBEDDED_ASSETS.md`). - Set from the configuration `Referrer-Policy` (`contentPolicy.referrerPolicy`: `"no-referrer"` forbids explicitly that a capability in your URLs leaves in `Referer`), `X-Content-Type-Options: nosniff` (`noSniff`) and the `Cache-Control` of HTML pages (`htmlCacheControl`), on files, route and generated replies unless a reply sets its own (#674, `docs/CONTENT_POLICY.md`). diff --git a/docs/DEVELOPER_ENVIRONMENT.md b/docs/DEVELOPER_ENVIRONMENT.md index 28f7ce08..cb550ae3 100644 --- a/docs/DEVELOPER_ENVIRONMENT.md +++ b/docs/DEVELOPER_ENVIRONMENT.md @@ -509,8 +509,20 @@ environment's `mount`, not to the embedded bootstrap page): environment (`webfront.developer.read`), in the manifest directory the application chose; it uses no network and writes nothing. Every second it asks whether either file changed and reads them again when one did, so the tree follows `wf install` and `wf restore`; it warns when the lock no longer matches the manifest. The names and texts of packages - are not trusted: they are shown as text, never as HTML, with their control characters made visible. The Bridge panel - comes with the next versions of the environment. + are not trusted: they are shown as text, never as HTML, with their control characters made visible. + + The **Bridge** panel shows the state of the bridge in the page of the interface (the `webFront` of the preview frame, + or of the developer page while no interface has one): whether `webFront.ready` is pending, resolved or rejected and + why, the state of the connection, the `cppFunction` calls that C++ has not answered yet and for how long, the Promises + rejected lately (function, reason with its error code, time; the 50 latest), and the JavaScript functions that C++ + called with the number of their calls. `WebFront.js` records nothing by itself: the page that holds the tab installs + a probe in the bridge at the panel's first read and removes it fifteen seconds after the last one. A call made before + that is listed without a duration, and the rejections and the JavaScript calls are those seen while a panel reads; a + call that the panel saw pending is followed to its answer, so its rejection is listed even if the panel closed meanwhile. + The inspectors' own calls are not shown. Attached, the panel reads the page directly; detached, its window does not + see the page, so the page publishes the same state to C++ every 250 ms while the panel reads, and stops within + fifteen seconds of its last read (`webfront.inspector.bridgeSource`, `publishBridge` and `bridge`, admitted pages + only). The tab is a button (`aria-expanded`, `aria-haspopup="menu"`, 44 px target), its menu a `menu` of `menuitem`s of 44 px, and the window a non-modal dialog. The interface stays in the preview diff --git a/docs/adr/ADR-027-inspecteurs-de-l-etat-de-l-application.md b/docs/adr/ADR-027-inspecteurs-de-l-etat-de-l-application.md index ae687a8b..ad040540 100644 --- a/docs/adr/ADR-027-inspecteurs-de-l-etat-de-l-application.md +++ b/docs/adr/ADR-027-inspecteurs-de-l-etat-de-l-application.md @@ -4,6 +4,7 @@ | Version | Date | État | Auteur | Évolution | Révision Git | | --- | --- | --- | --- | --- | --- | +| 1.5 | 2026-11-28 | Proposée | Ambroise Leclerc | État du pont dans la page (#684, section 8) : sonde `probe` de `WebFront.js`, posée seulement pendant qu'un inspecteur lit ; moniteur de la page hôte, qui suit le pont de l'interface ; relais `webfront.inspector.bridgeSource`, `publishBridge` et `bridge`, sous la règle d'accès de la section 2, où la page ne publie que pendant qu'un panneau détaché lit (bail de 15 s) ; état borné à 256 lignes de textes de 256 octets, pour 16 pages au plus. | À renseigner après intégration. | | 1.4 | 2026-11-28 | Proposée | Ambroise Leclerc | Outils MCP (#685) : la section 10 fixe les dix outils `webfront.state.*` sous le grant `state`, servis nativement et sans exécution ; lectures seules (ni `write`, ni préférences, ni fenêtres) ; une mémoire des observateurs propre à ces lectures, que `fold` et `reset` gèrent sans toucher l'application ni un panneau ; mêmes bornes que les pages ; refus aux codes `webfront.inspector.*` ; les packages passent par les opérations `list`, `why` et `info` de l'environnement, sous le grant `packages`. | Issue #685. | | 1.3 | 2026-11-27 | Proposée | Ambroise Leclerc | Observateurs (#682) : précisions de la section « Précisions des observateurs » (6 bis) — `fold` répond par une page vide, `limits` par six nombres, la source propriétaire reçoit son état, le mutateur reçoit le texte déjà validé, un parent signalé « enfants modifiés » perd ses enfants en mémoire, la mémoire de 10 000 nœuds se compte par connexion et par observateur, `maxWriteTextBytes` tient compte de l'en-tête réel du texte, un formateur écrit pour `std::format_context` est accepté. | À renseigner après intégration. | | 1.2 | 2026-11-26 | Proposée | Ambroise Leclerc | Registre introspectable (#681) : pages `webfront.inspector.functions`, `jsFunctions` et `browsers` (section 7) ; enregistrements tenus par les gestionnaires, donc retirés avec une fonction d'espace ; fonctions `webfront.inspector.*` non listées ; durée mesurée pendant une fenêtre de 5 s après chaque lecture des fonctions ; appels vers JavaScript comptés par nom, 1 024 noms au plus, seulement une fois l'environnement monté ; `BasicWF::registeredFunctions()` pour l'application. | À renseigner après intégration. | @@ -827,8 +828,64 @@ La même règle désactive « Détacher » quand aucun conteneur détaché ne do Chaque panneau a une action « Détacher / Rattacher », désactivée avec sa raison quand aucun conteneur détaché n'est disponible. Le choix est conservé par projet dans `.webfront/developer/`, comme `terminal-window.json`. -L'état du pont dans la page (#684) vit dans la page de l'application. Détaché, le panneau le lit par un relais C++ : -la page publie son état par un appel réservé, et l'inspecteur le lit comme un observateur, sous la même règle d'accès. +**État du pont dans la page (#684).** Le panneau **État TypeScript ▸ Pont** montre `webFront.ready` (en attente, +résolue, ou rejetée avec sa raison), l'état de la connexion, les appels `cppFunction` en attente avec leur durée, les +Promises rejetées récemment (fonction, raison, heure) et les fonctions JavaScript que C++ appelle, avec le nombre de leurs +appels. Cet état vit dans la page de l'application. + +- **Sonde.** `WebFront.js` ne garde rien pour l'inspecteur : chaque appel en attente porte seulement son nom, et `ready` + la raison de son rejet (`readyError`). Le pont a un champ `probe`, nul par défaut. Quand il est posé, `callCppFunction` + lui confie la paire qui règle la Promise (`probe.call(nom, resolve, reject)` rend la paire à utiliser) et + `callJsFunction` lui annonce chaque fonction appelée par C++ (`probe.jsCall(nom)`). Sans sonde, un appel coûte un test + de nullité : ni horloge, ni table. Le format binaire ne change pas ; les ressources du cœur restent dans la liste et le + budget de l'ADR-016. +- **Moniteur.** La page hôte (celle qui tient l'onglet, `inspector-host.mjs`) crée un moniteur (`inspector-bridge.mjs`) + qui pose la sonde à sa première lecture et la retire quinze secondes après la dernière (plus que la plus lente des + périodes d'un panneau, pour qu'un panneau qui lit ne laisse aucun moment sans sonde) : un pont que personne n'inspecte + n'enregistre rien. Il suit le pont de l'interface (le `webFront` du cadre de l'aperçu, là où l'application appelle + C++), ou celui de la page hôte quand l'interface n'en a pas ; un cadre rechargé donne un nouvel état. Les appels en + attente quand la sonde est posée (à la première lecture, ou après un bail échu) sont repris avec leur nom, sans durée + connue. Un pont d'un `WebFront.js` antérieur n'a pas de champ `probe` : le moniteur n'en pose pas, retrouve à chaque + lecture les appels en attente, apprend l'issue de `ready` par la Promise elle-même, et le panneau dit que l'historique + manque. Une exception du moniteur ne retient jamais le règlement d'une Promise de l'application. Les appels de l'inspecteur lui-même + (`webfront.inspector.*`, `wfInspect.*`) ne sont pas suivis. Un appel suivi l'est jusqu'à sa réponse, même après le + retrait de la sonde : il faut de toute façon le retirer des appels en attente, et son rejet éventuel reste donc listé. L'état rendu est borné : 100 appels en attente (les plus + anciens), 50 rejets (les plus récents), 100 fonctions JavaScript (les plus appelées, sur 1 000 noms comptés un par un), + textes de 256 octets coupés sur une frontière de caractère, caractères de contrôle rendus visibles ; un nom long est + compté sous son libellé borné. Pour savoir quand un appel + se termine, le moniteur en enveloppe chacun et garde une entrée par appel en attente, comme le pont lui-même : ce + stockage suit `pendingCalls`, que les identifiants d'appel sur 16 bits bornent à 65 535 entrées. +- **Panneau rattaché.** L'iframe de la fenêtre flottante lit le moniteur de sa page hôte + (`window.parent.webfrontInspectorHost.bridgeState`), sans passer par C++. +- **Panneau détaché : relais par C++.** Une autre fenêtre ne voit pas la page, et `BroadcastChannel` n'est pas garanti + entre les vues natives. Trois fonctions réservées, sous la règle d'accès de la section 2, relaient l'état : + `webfront.inspector.bridgeSource(hôte)` annonce la page hôte et répond si un panneau attend déjà ; + `webfront.inspector.publishBridge(hôte, lignes)` publie l'état et répond s'il faut continuer ; + `webfront.inspector.bridge(hôte, depuis, nombre)` rend une page `(lignes, suivant, publication, âge en ms, drapeaux)` + dans `responseBudget` (drapeaux : 1 la page est annoncée et connectée, 2 elle a publié). Une ligne est un tuple + `(genre, nom, détail, nombre, nombre)` : une liste de tuples des types existants (exception de l'ADR-003). `publication` + numérote l'état. `suivant` est un curseur opaque qui nomme la publication lue par la première page : C++ garde aussi la + publication précédente, si bien qu'un lecteur termine la publication qu'il a commencée même si une autre arrive entre + deux pages ; un lecteur qui voit `publication` changer (elle a disparu) recommence. +- **Rien n'est publié sans lecteur.** Une lecture ouvre un bail de 15 s (plus long que la plus lente des périodes d'un + panneau) ; si la page ne publie pas, C++ le lui demande par `wfInspect.publish()`, une fois par seconde au plus. La page + publie alors toutes les 250 ms, et s'arrête dès qu'une publication apprend que le bail est échu. Un panneau fermé ou en + pause laisse donc la page se taire, et la sonde quitter le pont. +- **Bornes du relais.** Un état de plus de 256 lignes est refusé (`std::invalid_argument`) sans remplacer le précédent ; + chaque texte est borné par `boundedText` (256 octets, 16 pour le genre). C++ connaît 256 pages au plus (un identifiant + et deux rappels chacune) et garde l'état publié de 16 d'entre elles : au-delà de 16 états, la page lue le moins + récemment perd son état mais pas sa place, et une lecture la relance. Une connexion a une page au plus (une annonce + sous un autre identifiant retire la précédente) et une page connectée ne perd jamais sa place : au-delà de 256 pages + connectées, une annonce est refusée (`webfront.inspector.unavailable`). Une page déconnectée est oubliée à la première + lecture ou annonce qui la constate, en gardant pour son identifiant le bail d'un lecteur : une lecture la trouve + déconnectée et rend une page vide, sans drapeau de source. Une page qui a perdu sa place s'annonce de nouveau quand son panneau est détaché, ou quand sa + publication est refusée (`unknown`) ; une nouvelle annonce garde le bail d'un lecteur, et celle de la même connexion + garde aussi son état. Un état appartient à la connexion qui s'est annoncée la dernière sous cet + identifiant : la publication d'une autre connexion est refusée (`webfront.inspector.unavailable`). Une publication sans annonce est + refusée (`webfront.inspector.unknown`). + +Les deux panneaux affichent les mêmes lignes : le panneau rattaché passe l'état du moniteur par le même encodage en +lignes que le relais. ### 9. Ressources diff --git a/docs/adr/README.md b/docs/adr/README.md index 9023a1ed..af0a07f6 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -69,7 +69,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md). | [ADR-024](ADR-024-tls-integre.md) | Optional integrated TLS 1.3 server | Proposed | 2026-11-21 | 1.0 | | [ADR-025](ADR-025-mcp-http-dans-l-application.md) | The application serves MCP over Streamable HTTP on its own loopback listener, with a session Bearer token, strict Host/Origin checks, per-instance discovery and no automation in distribution builds; the webfront-agent launcher is removed; amends ADR-019 | Accepted (delivery in progress) | 2026-11-21 | 1.4 — 2026-11-28 | | [ADR-026](ADR-026-configuration-mcp-persistante.md) | Stable MCP client configuration with explicit development security modes | Accepted | 2026-11-22 | 1.2 — 2026-11-22 | -| [ADR-027](ADR-027-inspecteurs-de-l-etat-de-l-application.md) | Application state inspectors in the developer environment only: reserved `webfront.inspector.*` functions refused to unproven views unless the application trusts loopback clients, tree nodes on existing bridge types with paged reads and paged differences, observer operations run whole under the application's lock or on its executor, writes only when the application provides them, one `inspector.html` page, shown in a floating window of the page and, for a detached panel only, in the first container that grants access (a native secondary window, else a system-browser tab); an introspectable registry of the registered C++ functions, of the JavaScript functions C++ calls and of the connected browsers, counted with relaxed atomics and timed only while an inspector reads | Proposed | 2026-11-25 | 1.4 — 2026-11-28 | +| [ADR-027](ADR-027-inspecteurs-de-l-etat-de-l-application.md) | Application state inspectors in the developer environment only: reserved `webfront.inspector.*` functions refused to unproven views unless the application trusts loopback clients, tree nodes on existing bridge types with paged reads and paged differences, observer operations run whole under the application's lock or on its executor, writes only when the application provides them, one `inspector.html` page, shown in a floating window of the page and, for a detached panel only, in the first container that grants access (a native secondary window, else a system-browser tab); an introspectable registry of the registered C++ functions, of the JavaScript functions C++ calls and of the connected browsers, counted with relaxed atomics and timed only while an inspector reads | Proposed | 2026-11-25 | 1.5 — 2026-11-28 | Numbering follows the reading topics; milestones and individual file histories provide the chronology, which does not follow the numerical order. diff --git a/include/webfront/BridgeState.hpp b/include/webfront/BridgeState.hpp new file mode 100644 index 00000000..66e3f45a --- /dev/null +++ b/include/webfront/BridgeState.hpp @@ -0,0 +1,296 @@ +// SPDX-License-Identifier: Apache-2.0 OR CECILL-B +// Author: Ambroise Leclerc +// Created: 2026-11-27 +// +// WebFront — core +// Role: Relay of the state of the bridge in a page (ADR-027, section 8): the page publishes it, a detached inspector reads it. +// Thread: thread-safe | Alloc: heap-init +// LLM: internal; a page publishes only while a reader asks (the lease), keep every stored text and count bounded + +#pragma once + +#include "BridgeError.hpp" +#include "Introspection.hpp" +#include "Watches.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace webfront::inspect { + +/// A published state holds at most this many rows; a publication of more is refused. +inline constexpr std::size_t maxBridgeRows = 256; +/// The states of at most this many pages are kept: past it, the state of the page read the longest ago is dropped, and that +/// page publishes it again when it is read. +inline constexpr std::size_t maxBridgeSources = 16; +/// At most this many pages are known at once, each by its identifier and the two callbacks of its connection. A connection +/// has one page at most (announcing another identifier drops its previous one), and a page whose connection is gone is +/// dropped first: past the bound, an announcement is refused, and no connected page ever loses its place. +inline constexpr std::size_t maxBridgeAnnouncements = 256; +/// A page publishes for this long after an inspector read its state: longer than the slowest period of a panel (5 s), so +/// that a panel that reads keeps its page publishing, and a panel that is paused or closed lets it stop. +inline constexpr std::chrono::seconds bridgeLease{15}; +/// A page that should publish and did not for this long is asked again, at most once per such duration. +inline constexpr std::chrono::seconds bridgeAskAgain{1}; +/// The cursors of the pages of a state count rows in units of this, more than a state holds (maxBridgeRows). +inline constexpr std::uint64_t bridgeCursorStride = 1024; + +/// A row of the state of a bridge, as the page writes it (inspector-bridge.mjs): (kind, name, detail, number, number). +/// The kinds are the page's vocabulary ("page", "ready", "connection", "counts", "pending", "rejected", "js"): C++ +/// relays the rows without reading them, and only bounds them. +using BridgeRow = std::tuple; +/// A page of the state: (rows, next, publication, age in milliseconds, flags). `next` is the cursor of the following page, +/// 0 at the end: it names the publication the first page read and the place in it, so that the following pages read the +/// same publication even after a newer one (the previous one is kept). `publication` numbers the state the rows belong to, +/// 0 before the first one: a reader that sees it change between two pages (that publication is gone) starts again. The +/// flags are those of bridge_flag. +/// A cursor is publication × bridgeCursorStride + index; a cursor below the stride is an index in the latest publication. +using BridgePage = std::tuple, double, double, double, double>; + +/// The bits of the flags of a BridgePage. +namespace bridge_flag { +inline constexpr unsigned source = 1; ///< the page of that identifier announced itself and is still connected +inline constexpr unsigned published = 2; ///< it published a state at least once +} // namespace bridge_flag + +inline constexpr std::size_t maxBridgeRowBytes = detail::encodedTuple + 2 * detail::encodedNumber + detail::encodedText(maxKindBytes) + + 2 * detail::encodedText(maxTextBytes); +static_assert(maxBridgeRowBytes + responseHeaderBytes <= minPageBytes); + +/** + * @brief The states of the bridges that pages publish for the inspectors that cannot read them directly: a detached + * panel is another window, which does not see the page of the application (ADR-027, section 8). A page that holds the + * inspectors announces itself under its host identifier; it publishes only while a reader asks, so that a page nobody + * inspects sends nothing. Thread-safe. A source's `ask` is called outside the lock, by whoever read; its `alive` is called + * under it and must not come back here. + */ +class BridgeStates { +public: + using Clock = std::chrono::steady_clock; + + /// What a read gives beside its page: the request to make to the source (null when none is due), outside any lock. + struct Read { + BridgePage page; + std::function ask; + }; + + /** + * The page `host` announces that it can publish the state of its bridge: `owner` identifies its connection (a value + * that compares equal only for the same one), `ask` asks it to start (called on a reader's thread, outside the lock), + * `alive` tells whether its connection is still there and admitted. The same connection announcing itself again (its + * Bridge panel was detached again) keeps its state; another connection under the same identifier (the page was loaded + * again) replaces it and its state is forgotten. A reader's lease is kept either way. Returns whether a reader is + * waiting for it now. + * @throws BridgeError `webfront.inspector.unavailable` when maxBridgeAnnouncements connected pages are known already + */ + template + bool announce(const std::string& host, Owner owner, std::function ask, std::function alive, Clock::time_point now = Clock::now()) { + std::scoped_lock lock{mutex}; + // Dropped: the pages whose connection is gone (a reader's lease is kept for the page that comes back under that + // identifier), and the earlier page of this connection under another identifier. + std::erase_if(sources, [&](auto& entry) { + if (entry.first == host) + return false; + const auto same = std::any_cast(&entry.second.owner); + if (same && *same == owner) + return true; + if (entry.second.alive()) + return false; + if (now < entry.second.wantedUntil) + keepReader(entry.first, entry.second.wantedUntil); + return true; + }); + if (!sources.contains(host) && sources.size() >= maxBridgeAnnouncements) + throw webfront::detail::makeBridgeError(code::unavailable, "Too many pages publish the state of their bridge"); + // A reader may have asked before the page announced itself (a detached panel outlives a reload of its page). + auto wanted = readers.contains(host) ? readers[host] : Clock::time_point{}; + readers.erase(host); + auto& source = sources[host]; + wanted = (std::max)(wanted, source.wantedUntil); // a source that announces itself again keeps its reader + const auto same = std::any_cast(&source.owner); + if (!same || !(*same == owner)) { + source = Source{}; + source.owner = std::move(owner); + } + source.ask = std::move(ask); + source.alive = std::move(alive); + source.wantedUntil = wanted; + return now < source.wantedUntil; + } + + /** + * The page `host` publishes the state of its bridge. Each text is made safe and bounded (boundedText). Returns + * whether a reader still asks for it: the page stops publishing when not. + * @throws std::invalid_argument for more than maxBridgeRows rows; nothing is kept then + * @throws BridgeError `webfront.inspector.unknown` when the page did not announce itself (or lost its place: it + * announces itself again), `webfront.inspector.unavailable` when another connection announced itself under + * this identifier since: the state shown is that of the latest one only + */ + template + bool publish(const std::string& host, const Owner& owner, std::vector rows, Clock::time_point now = Clock::now()) { + if (rows.size() > maxBridgeRows) + throw std::invalid_argument("The state of a bridge holds at most " + std::to_string(maxBridgeRows) + " rows"); + for (auto& [kind, name, text, first, second] : rows) { + kind = boundedText(kind, maxKindBytes); + name = boundedText(name); + text = boundedText(text); + } + std::scoped_lock lock{mutex}; + const auto found = sources.find(host); + if (found == sources.end()) + throw webfront::detail::makeBridgeError(code::unknown, "This page did not announce the state of its bridge"); + auto& source = found->second; + const auto holder = std::any_cast(&source.owner); + if (!holder || !(*holder == owner)) + throw webfront::detail::makeBridgeError(code::unavailable, "Another page publishes the state of its bridge under this identifier"); + // The previous publication stays readable, so that a reader that began it reads it to its end. + source.previousRows = std::exchange(source.rows, std::move(rows)); + source.previousPublication = source.publication; + source.previousPublishedAt = source.publishedAt; + source.publication = ++publications; + source.publishedAt = now; + const bool wanted = now < source.wantedUntil; + // The rows of at most maxBridgeSources pages are kept: the page read the longest ago loses its state, not its place, + // so that a read finds it, asks it and gets its state again. + std::size_t holding = 0; + for (const auto& entry : sources) + holding += entry.second.publication != 0 ? 1 : 0; + while (holding > maxBridgeSources) { + Source* oldest = nullptr; + for (auto& entry : sources) + if (entry.second.publication != 0 && (!oldest || entry.second.wantedUntil < oldest->wantedUntil)) + oldest = &entry.second; + if (!oldest) + break; + oldest->rows = {}; + oldest->previousRows = {}; + oldest->publication = 0; + oldest->previousPublication = 0; + --holding; + } + return wanted; + } + + /** + * The page that webfront.inspector.bridge(host, from, count) answers: the rows from the cursor `from` (0 for the first + * page of the latest publication, else the `next` of the page before), at most `count` and as many as fit `budget`. + * A cursor of a publication that is neither the latest nor the one before gives an empty last page under the latest + * publication, which the reader sees changed. A read renews the lease of the source, and gives the request to make to + * a source that is not publishing. + */ + [[nodiscard]] Read read(const std::string& host, double from, double count, std::size_t budget, Clock::time_point now = Clock::now()) { + const auto first = detail::pageNumber(from, "cursor"); + const auto wanted = std::min(detail::pageNumber(count, "count"), maxPageCount); + const auto room = detail::rowsRoom(budget); + Read result; + std::scoped_lock lock{mutex}; + const auto found = sources.find(host); + if (found == sources.end() || !found->second.alive()) { + if (found != sources.end()) + sources.erase(found); + // Kept for the page that announces itself next under this identifier. + keepReader(host, now + bridgeLease); + result.page = BridgePage{std::vector{}, 0.0, 0.0, 0.0, 0.0}; + return result; + } + auto& source = found->second; + // The latest lease wins: a read whose time was taken earlier but that takes the lock last never shortens it. + source.wantedUntil = (std::max)(source.wantedUntil, now + bridgeLease); + const bool fresh = source.publication != 0 && now - source.publishedAt < bridgeAskAgain; + if (!fresh && (source.askedAt == Clock::time_point{} || now - source.askedAt >= bridgeAskAgain)) { + source.askedAt = now; + result.ask = source.ask; + } + // The publication the cursor names: the latest, the one before it, or one that is gone (nothing to serve). + const auto named = first / bridgeCursorStride; + const auto* state = &source.rows; + auto served = source.publication; + auto publishedAt = source.publishedAt; + std::uint64_t start = first % bridgeCursorStride; + static const std::vector none; + if (named != 0 && named != source.publication) { + if (named == source.previousPublication) { + state = &source.previousRows; + served = source.previousPublication; + publishedAt = source.previousPublishedAt; + } else + state = &none; + } + std::vector rows; + std::size_t used = 0; + double next = 0; + for (std::size_t index = static_cast(std::min(start, state->size())); index < state->size(); ++index) { + const auto& row = (*state)[index]; + const auto bytes = detail::encodedTuple + 2 * detail::encodedNumber + detail::encodedText(std::get<0>(row).size()) + + detail::encodedText(std::get<1>(row).size()) + detail::encodedText(std::get<2>(row).size()); + if (rows.size() == wanted || used + bytes > room) { + next = static_cast(served * bridgeCursorStride + index); + break; + } + used += bytes; + rows.push_back(row); + } + // `now` may have been read before a publication that took the lock first: an age is never negative. + const auto age = served == 0 ? 0.0 : (std::max)(0.0, std::chrono::duration(now - publishedAt).count()); + result.page = BridgePage{std::move(rows), + next, + static_cast(served), + age, + static_cast(bridge_flag::source | (source.publication != 0 ? bridge_flag::published : 0u))}; + return result; + } + + /// The pages that announced themselves and were not replaced or found gone. + [[nodiscard]] std::size_t sourceCount() const { + std::scoped_lock lock{mutex}; + return sources.size(); + } + +private: + /// Keeps a reader's lease for an identifier that no page holds now: the latest of the leases, within the bound of + /// maxBridgeSources identifiers (past it, the one whose lease ends first is dropped). + void keepReader(const std::string& host, Clock::time_point until) { + if (const auto found = readers.find(host); found != readers.end()) { + found->second = (std::max)(found->second, until); + return; + } + if (readers.size() >= maxBridgeSources) + readers.erase(std::ranges::min_element(readers, {}, [](const auto& entry) { + return entry.second; + })); + readers.emplace(host, until); + } + + struct Source { + std::any owner; + std::function ask; + std::function alive; + std::vector rows; + std::uint64_t publication = 0; + Clock::time_point publishedAt; + std::vector previousRows; // the publication before, for a reader that began it + std::uint64_t previousPublication = 0; + Clock::time_point previousPublishedAt; + Clock::time_point wantedUntil; + Clock::time_point askedAt; + }; + + mutable std::mutex mutex; + std::map sources; + std::map readers; // the leases of the identifiers read before their page announced itself + std::uint64_t publications = 0; +}; + +} // namespace webfront::inspect diff --git a/include/webfront/DeveloperApp.hpp b/include/webfront/DeveloperApp.hpp index 6c72e5ec..70bafef8 100644 --- a/include/webfront/DeveloperApp.hpp +++ b/include/webfront/DeveloperApp.hpp @@ -9,6 +9,7 @@ #pragma once +#include "BridgeState.hpp" #include "InspectorReads.hpp" #include "system/DeveloperFS.hpp" #include "system/DeveloperReleaseData.hpp" @@ -307,6 +308,41 @@ class DeveloperAppWithNetwork : public BasicWFinspectedBrowsers(ui), from, count, this->inspectedTasks(), inspect::responseBudget); }); + // The state of the bridge in a page (#684, section 8): a detached panel is another window, which does not see the page + // of the application, so that page publishes its state here and the panel reads it, both under the inspectors' access. + // A page publishes only while a panel reads: bridgeSource() announces it and says whether one does, a read asks an + // idle page to start (wfInspect.publish, inspector-bridge.mjs), and each publication is told whether to go on. + const auto bridges = std::make_shared(); + this->template reservedCppFunction("webfront.inspector.bridgeSource", [bridges](Caller ui, std::string host) { + admit(ui); + requireHost(host); + return bridges->announce( + host, + ui, + [ui] { + ui.jsFunction("wfInspect.publish")(); + }, + [ui] { + return ui.isLocalClient(); + }); + }); + this->template reservedCppFunction>( + "webfront.inspector.publishBridge", + [bridges](Caller ui, std::string host, std::vector rows) { + admit(ui); + requireHost(host); + return bridges->publish(host, ui, std::move(rows)); + }); + this->template reservedCppFunction( + "webfront.inspector.bridge", + [bridges](Caller ui, std::string host, double from, double count) { + admit(ui); + requireHost(host); + auto read = bridges->read(host, from, count, inspect::responseBudget); + if (read.ask) + read.ask(); + return std::move(read.page); + }); // A secondary window of the panel for the host page, with the proof of the view (section 8); opening it again brings it to the front. // The window is opened on the interface thread, where openSecondaryWindow() does not hold the server's thread. this->template reservedCppFunction, Caller, std::string, std::string, double, double>( @@ -397,6 +433,12 @@ class DeveloperAppWithNetwork : public BasicWF data{ + static constexpr std::size_t dataSize{45498}; + static constexpr std::array data{ 0x2f2f2f2040627269, 0x65662042726f7773, 0x65722d7369646520, 0x57656246726f6e74, 0x206272696467652e, 0x0a0a2866756e6374, 0x696f6e2028676c6f, 0x62616c29207b0a20, 0x2020202275736520, 0x737472696374223b, 0x0a0a20202020636f, 0x6e737420436f6d6d, 0x616e64203d204f62, 0x6a6563742e667265, 0x657a65287b0a2020, @@ -282,856 +282,873 @@ struct WebFrontJsData { 0x7469616c697a6564, 0x223b0a2020202020, 0x2020202020202074, 0x6869732e6c697474, 0x6c65456e6469616e, 0x203d2066616c7365, 0x3b0a202020202020, 0x2020202020207468, 0x69732e6e65787443, 0x616c6c4964203d20, 0x313b0a2020202020, 0x2020202020202074, 0x6869732e70656e64, 0x696e6743616c6c73, 0x203d206e6577204d, - 0x617028293b0a2020, 0x2020202020202020, 0x2020746869732e72, 0x6561647953657474, 0x6c6564203d206661, - 0x6c73653b0a202020, 0x2020202020202020, 0x20746869732e7265, 0x61647950726f6d69, 0x7365203d206e6577, - 0x2050726f6d697365, 0x28287265736f6c76, 0x652c2072656a6563, 0x7429203d3e207b0a, 0x2020202020202020, - 0x2020202020202020, 0x746869732e726573, 0x6f6c766552656164, 0x79203d207265736f, 0x6c76653b0a202020, - 0x2020202020202020, 0x2020202020746869, 0x732e72656a656374, 0x5265616479203d20, 0x72656a6563743b0a, - 0x2020202020202020, 0x202020207d293b0a, 0x2020202020202020, 0x202020202f2f2057, 0x6974686f75742074, - 0x6869732c20612070, 0x6167652074686174, 0x206e657665722074, 0x6f75636865732077, 0x656246726f6e742e, - 0x726561647920776f, 0x756c642073656520, 0x616e2022756e6861, 0x6e646c65640a2020, 0x2020202020202020, - 0x20202f2f2070726f, 0x6d6973652072656a, 0x656374696f6e2220, 0x7761726e696e6720, 0x6966207468652069, - 0x6e697469616c2063, 0x6f6e6e656374696f, 0x6e206661696c732e, 0x204170706c696361, 0x74696f6e20636f64, - 0x65207374696c6c0a, 0x2020202020202020, 0x202020202f2f2067, 0x6574732069747320, 0x6f776e20696e6465, - 0x70656e64656e7420, 0x736574746c656d65, 0x6e7420766961202e, 0x7468656e28292f2e, 0x636174636828292f, - 0x6177616974206f6e, 0x207468652073616d, 0x652070726f6d6973, 0x653b0a2020202020, 0x202020202020202f, - 0x2f20617474616368, 0x696e672061206861, 0x6e646c6572206865, 0x726520646f65736e, 0x277420636f6e7375, - 0x6d65206f72206166, 0x666563742074686f, 0x73652e0a20202020, 0x2020202020202020, 0x746869732e726561, - 0x647950726f6d6973, 0x652e636174636828, 0x2829203d3e207b7d, 0x293b0a2020202020, 0x2020202020202074, - 0x6869732e626f756e, 0x6450726f6d697365, 0x203d206e65772050, 0x726f6d6973652828, 0x7265736f6c76652c, - 0x2072656a65637429, 0x203d3e207b0a2020, 0x2020202020202020, 0x2020202020207468, 0x69732e7265736f6c, - 0x7665426f756e6420, 0x3d207265736f6c76, 0x653b0a2020202020, 0x2020202020202020, 0x202020746869732e, - 0x72656a656374426f, 0x756e64203d207265, 0x6a6563743b0a2020, 0x2020202020202020, 0x20207d293b0a2020, - 0x2020202020202020, 0x2020746869732e62, 0x6f756e6450726f6d, 0x6973652e63617463, 0x68282829203d3e20, - 0x7b7d293b0a202020, 0x2020202020202020, 0x20746869732e736f, 0x636b6574203d206e, 0x657720576562536f, - 0x636b65742875726c, 0x2c20225765624672, 0x6f6e745f302e3122, 0x293b0a2020202020, 0x2020202020202074, - 0x6869732e736f636b, 0x65742e62696e6172, 0x7954797065203d20, 0x2261727261796275, 0x66666572223b0a20, - 0x2020202020202020, 0x202020746869732e, 0x736f636b65742e6f, 0x6e6f70656e203d20, 0x2829203d3e207468, - 0x69732e68616e6473, 0x68616b6528293b0a, 0x2020202020202020, 0x2020202074686973, 0x2e736f636b65742e, - 0x6f6e6d6573736167, 0x65203d206576656e, 0x74203d3e20746869, 0x732e6f6e4d657373, 0x616765286576656e, - 0x742e64617461293b, 0x0a20202020202020, 0x2020202020746869, 0x732e736f636b6574, 0x2e6f6e636c6f7365, - 0x203d206576656e74, 0x203d3e207b0a2020, 0x2020202020202020, 0x202020202020636f, 0x6e73742064657461, - 0x696c203d20657665, 0x6e742e776173436c, 0x65616e203f206063, 0x6f64653d247b6576, 0x656e742e636f6465, - 0x7d20726561736f6e, 0x3d247b6576656e74, 0x2e726561736f6e7d, 0x60203a2022636f6e, 0x6e656374696f6e20, - 0x6c6f7374223b0a20, 0x2020202020202020, 0x2020202020202063, 0x6f6e737420657272, 0x6f72203d20627269, - 0x6467654572726f72, 0x2842726964676543, 0x6f64652e64697363, 0x6f6e6e6563746564, 0x2c20605765624672, - 0x6f6e7420636f6e6e, 0x656374696f6e2063, 0x6c6f7365643a2024, 0x7b64657461696c7d, 0x60293b0a20202020, - 0x2020202020202020, 0x2020202074686973, 0x2e736574746c6552, 0x6561647952656a65, 0x6374656428657272, - 0x6f72293b0a202020, 0x2020202020202020, 0x2020202020746869, 0x732e72656a656374, 0x426f756e64286572, - 0x726f72293b20202f, 0x2f2061206e6f2d6f, 0x70206f6e63652073, 0x6574746c65640a20, 0x2020202020202020, - 0x2020202020202066, 0x6f722028636f6e73, 0x742070656e64696e, 0x67206f6620746869, 0x732e70656e64696e, - 0x6743616c6c732e76, 0x616c756573282929, 0x0a20202020202020, 0x2020202020202020, 0x202020202070656e, - 0x64696e672e72656a, 0x656374286572726f, 0x72293b0a20202020, 0x2020202020202020, 0x2020202074686973, - 0x2e70656e64696e67, 0x43616c6c732e636c, 0x65617228293b0a20, 0x2020202020202020, 0x2020202020202074, - 0x6869732e73746174, 0x65203d2022636c6f, 0x736564223b0a2020, 0x2020202020202020, 0x202020202020636f, - 0x6e736f6c652e6c6f, 0x6728605b57656246, 0x726f6e7420636c6f, 0x73655d20247b6465, 0x7461696c7d60293b, - 0x0a20202020202020, 0x20202020207d3b0a, 0x2020202020202020, 0x2020202074686973, 0x2e736f636b65742e, - 0x6f6e6572726f7220, 0x3d202829203d3e20, 0x7b0a202020202020, 0x2020202020202020, 0x2020636f6e737420, - 0x6572726f72203d20, 0x6e6577204572726f, 0x7228225765624672, 0x6f6e7420636f6e6e, 0x656374696f6e2066, - 0x61696c656422293b, 0x0a20202020202020, 0x2020202020202020, 0x20746869732e7365, 0x74746c6552656164, - 0x7952656a65637465, 0x64286572726f7229, 0x3b0a202020202020, 0x2020202020202020, 0x2020746869732e72, - 0x656a656374426f75, 0x6e64286572726f72, 0x293b0a2020202020, 0x2020202020202020, 0x202020636f6e736f, - 0x6c652e6572726f72, 0x28225b5765624672, 0x6f6e7420736f636b, 0x6574206572726f72, 0x5d222c206572726f, - 0x72293b0a20202020, 0x2020202020202020, 0x7d3b0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, - 0x2f205265736f6c76, 0x6573206f6e636520, 0x7468652057656253, 0x6f636b6574206861, 0x6e647368616b6520, - 0x69732061636b6e6f, 0x776c65646765642c, 0x2072656a65637473, 0x2069662074686520, 0x696e697469616c20, - 0x636f6e6e65637469, 0x6f6e0a2020202020, 0x2020202f2f2f2063, 0x6c6f736573206f72, 0x206661696c732062, - 0x65666f7265207468, 0x61742e20446f6573, 0x206e6f7420726566, 0x6c656374206c6174, 0x657220646973636f, - 0x6e6e656374733b20, 0x7365652070656e64, 0x696e6743616c6c73, 0x2f73746174652e0a, 0x2020202020202020, - 0x6765742072656164, 0x792829207b0a2020, 0x2020202020202020, 0x202072657475726e, 0x20746869732e7265, - 0x61647950726f6d69, 0x73653b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f205265736f6c, - 0x766573206f6e6365, 0x2074686973206272, 0x6f7773657220636c, 0x69656e7420686f6c, 0x6473207468652063, - 0x6f6f6b6965207468, 0x61742062696e6473, 0x2074686520726561, 0x642055524c732067, 0x6976656e20746f20, - 0x7468697320706167, 0x6520284144522d30, 0x3230292c20616e64, 0x0a20202020202020, 0x202f2f2f2072656a, - 0x656374732c207769, 0x746820616e206578, 0x706c696369742065, 0x72726f722c207768, 0x656e207468652065, - 0x786368616e676520, 0x6661696c73206f72, 0x207468652062726f, 0x7773657220726566, 0x7573657320746865, - 0x20636f6f6b69653a, 0x20626f756e642072, 0x656164730a202020, 0x20202020202f2f2f, 0x207468656e206661, - 0x696c2c2077697468, 0x6f75742066616c6c, 0x696e67206261636b, 0x20746f2074686520, 0x746f6b656e20616c, - 0x6f6e652e20432b2b, 0x2073746172747320, 0x6974207269676874, 0x2061667465722074, 0x68652068616e6473, - 0x68616b652e0a2020, 0x2020202020206765, 0x7420626f756e6428, 0x29207b0a20202020, 0x2020202020202020, - 0x72657475726e2074, 0x6869732e626f756e, 0x6450726f6d697365, 0x3b0a202020202020, 0x20207d0a0a202020, - 0x20202020202f2f2f, 0x2045786368616e67, 0x657320746865206f, 0x6e652d74696d6520, 0x7365637265742072, - 0x6563656976656420, 0x7468726f75676820, 0x7468652062726964, 0x676520666f722074, 0x686520636f6f6b69, - 0x65206f6620746869, 0x7320636c69656e74, 0x2c207468656e2063, 0x6865636b73207468, 0x6174207468650a20, - 0x202020202020202f, 0x2f2f2062726f7773, 0x6572206b65707420, 0x69742e2054686520, 0x7365637265742069, - 0x732073696e676c65, 0x207573653b207468, 0x6520636f6f6b6965, 0x2069732048747470, 0x4f6e6c792c20736f, - 0x2074686520706167, 0x65206e6576657220, 0x7265616473206974, 0x2e0a202020202020, 0x20206173796e6320, - 0x62696e64436c6965, 0x6e74287365637265, 0x7429207b0a202020, 0x2020202020202020, 0x202f2f204162736f, - 0x6c75746520616e64, 0x2070696e6e656420, 0x746f20746865206f, 0x726967696e206f66, 0x2074686520617070, - 0x6c69636174696f6e, 0x3a2061203c626173, 0x6520687265663e20, 0x696e207468652070, 0x616765206d757374, - 0x206e657665722072, 0x6564697265637420, 0x7468650a20202020, 0x2020202020202020, 0x2f2f206f6e652d74, - 0x696d652073656372, 0x657420746f20616e, 0x6f7468657220686f, 0x73742c20616e6420, 0x6120726564697265, - 0x6374206d75737420, 0x6e65766572206361, 0x7272792069742061, 0x7761792e0a202020, 0x2020202020202020, - 0x20636f6e73742062, 0x617365203d20676c, 0x6f62616c2e6c6f63, 0x6174696f6e2e6f72, 0x6967696e202b2022, - 0x2f77656266726f6e, 0x742f736572766963, 0x65732f62696e642f, 0x223b0a2020202020, 0x2020202020202063, - 0x6f6e73742070696e, 0x6e6564203d207b63, 0x726564656e746961, 0x6c733a202273616d, 0x652d6f726967696e, - 0x222c206d6f64653a, 0x202273616d652d6f, 0x726967696e222c20, 0x7265646972656374, 0x3a20226572726f72, - 0x222c206361636865, 0x3a20226e6f2d7374, 0x6f7265227d3b0a20, 0x2020202020202020, 0x202020747279207b, - 0x0a20202020202020, 0x2020202020202020, 0x20636f6e73742065, 0x786368616e676520, 0x3d20617761697420, - 0x6665746368286261, 0x7365202b20656e63, 0x6f6465555249436f, 0x6d706f6e656e7428, 0x736563726574292c, - 0x2070696e6e656429, 0x3b0a202020202020, 0x2020202020202020, 0x2020696620282165, 0x786368616e67652e, - 0x6f6b29207468726f, 0x77206e6577204572, 0x726f722860746865, 0x2073657276657220, 0x7265667573656420, - 0x7468652065786368, 0x616e676520284854, 0x545020247b657863, 0x68616e67652e7374, 0x617475737d296029, - 0x3b0a202020202020, 0x2020202020202020, 0x2020636f6e737420, 0x636c69656e74203d, 0x2065786368616e67, - 0x652e686561646572, 0x732e676574282258, 0x2d57656246726f6e, 0x742d436c69656e74, 0x22293b0a20202020, - 0x2020202020202020, 0x2020202069662028, 0x21636c69656e7429, 0x207468726f77206e, 0x6577204572726f72, - 0x2822746865207365, 0x7276657220646964, 0x206e6f74206e616d, 0x652074686520636c, 0x69656e7422293b0a, - 0x2020202020202020, 0x2020202020202020, 0x636f6e7374206368, 0x65636b203d206177, 0x6169742066657463, - 0x682862617365202b, 0x2022636865636b2f, 0x22202b20656e636f, 0x6465555249436f6d, 0x706f6e656e742863, - 0x6c69656e74292c20, 0x70696e6e6564293b, 0x0a20202020202020, 0x2020202020202020, 0x2069662028216368, - 0x65636b2e6f6b2920, 0x7468726f77206e65, 0x77204572726f7228, 0x227468652062726f, 0x7773657220726566, - 0x7573656420746865, 0x2062696e64696e67, 0x20636f6f6b696522, 0x293b0a2020202020, 0x2020202020202020, - 0x202020746869732e, 0x7265736f6c766542, 0x6f756e6428293b0a, 0x2020202020202020, 0x202020207d206361, - 0x7463682028657272, 0x6f7229207b0a2020, 0x2020202020202020, 0x202020202020636f, 0x6e7374206661696c, - 0x757265203d206e65, 0x77204572726f7228, 0x6057656246726f6e, 0x7420636f756c6420, 0x6e6f742062696e64, - 0x2074686973206272, 0x6f7773657220666f, 0x722072656164733a, 0x20247b6572726f72, 0x2e6d657373616765, - 0x207c7c206572726f, 0x727d60293b0a2020, 0x2020202020202020, 0x2020202020207468, 0x69732e72656a6563, - 0x74426f756e642866, 0x61696c757265293b, 0x0a20202020202020, 0x2020202020202020, 0x20636f6e736f6c65, - 0x2e6572726f722822, 0x5b57656246726f6e, 0x742062696e64696e, 0x675d222c20666169, 0x6c757265293b0a20, - 0x2020202020202020, 0x2020207d0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x2f2f2f2052656a65, - 0x6374732074686520, 0x696e697469616c2d, 0x72656164696e6573, 0x732070726f6d6973, 0x65206174206d6f73, - 0x74206f6e63652c20, 0x616e64206f6e6c79, 0x207768696c652073, 0x74696c6c20776169, 0x74696e67206f6e20, - 0x7468650a20202020, 0x202020202f2f2f20, 0x68616e647368616b, 0x652e204120666169, 0x6c656420636f6e6e, - 0x656374696f6e2074, 0x79706963616c6c79, 0x2066697265732062, 0x6f74682060657272, 0x6f726020616e6420, - 0x60636c6f7365602c, 0x20616e642061206c, 0x617465720a202020, 0x20202020202f2f2f, 0x20646973636f6e6e, - 0x6563742028616674, 0x6572206c696e6b69, 0x6e6729206d757374, 0x206e6f742072652d, 0x736574746c652061, - 0x6e20616c72656164, 0x792d7265736f6c76, 0x6564206072656164, 0x79603b2074686973, 0x2067756172640a20, - 0x202020202020202f, 0x2f2f206d616b6573, 0x206576657279206f, 0x6e65206f66207468, 0x6f73652063617365, - 0x732061206861726d, 0x6c657373206e6f2d, 0x6f70206166746572, 0x2074686520666972, 0x737420736574746c, - 0x656d656e742e0a20, 0x2020202020202073, 0x6574746c65526561, 0x647952656a656374, 0x6564286572726f72, - 0x29207b0a20202020, 0x2020202020202020, 0x6966202874686973, 0x2e72656164795365, 0x74746c6564207c7c, - 0x20746869732e7374, 0x617465203d3d3d20, 0x226c696e6b656422, 0x292072657475726e, 0x3b0a202020202020, - 0x2020202020207468, 0x69732e7265616479, 0x536574746c656420, 0x3d20747275653b0a, 0x2020202020202020, - 0x2020202074686973, 0x2e72656a65637452, 0x6561647928657272, 0x6f72293b0a202020, 0x20202020207d0a0a, - 0x2020202020202020, 0x68616e647368616b, 0x652829207b0a2020, 0x2020202020202020, 0x2020746869732e73, - 0x74617465203d2022, 0x68616e647368616b, 0x696e67223b0a2020, 0x2020202020202020, 0x20202f2f20416e20, - 0x656d626564646564, 0x2066726f6e74656e, 0x6420676976657320, 0x6974732076696577, 0x2061207065722d6c, - 0x61756e6368207365, 0x6372657420617420, 0x7468652073746172, 0x74206f6620746865, 0x20646f63756d656e, - 0x7420284144522d30, 0x3230292e20497420, 0x7761732074616b65, 0x6e0a202020202020, 0x2020202020202f2f, - 0x206f7574206f6620, 0x7468652077696e64, 0x6f77207768656e20, 0x7468697320736372, 0x697074206c6f6164, - 0x65642c20736f2074, 0x6865207061676520, 0x646f6573206e6f74, 0x206b656570207265, 0x6164696e67206974, - 0x3b20746865207379, 0x7374656d2062726f, 0x7773657220686173, 0x206e6f6e652e0a20, 0x2020202020202020, - 0x202020636f6e7374, 0x2073656372657420, 0x3d20766965775365, 0x637265743b0a2020, 0x2020202020202020, - 0x2020636f6e737420, 0x686561646572203d, 0x205b436f6d6d616e, 0x642e68616e647368, 0x616b652c206e6174, - 0x69766549734c6974, 0x746c65456e646961, 0x6e2829203f203020, 0x3a20315d3b0a2020, 0x2020202020202020, - 0x2020666f7220286c, 0x657420696e646578, 0x203d20303b20696e, 0x646578203c207365, 0x637265742e6c656e, - 0x6774683b202b2b69, 0x6e64657829206865, 0x616465722e707573, 0x6828736563726574, 0x2e63686172436f64, - 0x65417428696e6465, 0x7829202620307837, 0x66293b0a20202020, 0x2020202020202020, 0x746869732e736f63, - 0x6b65742e73656e64, 0x286e65772055696e, 0x7438417272617928, 0x6865616465722929, 0x3b0a202020202020, - 0x20207d0a0a202020, 0x20202020206f6e4d, 0x6573736167652862, 0x756666657229207b, 0x0a20202020202020, - 0x2020202020636f6e, 0x7374207669657720, 0x3d206e6577204461, 0x7461566965772862, 0x7566666572293b0a, - 0x2020202020202020, 0x2020202072657175, 0x6972654279746573, 0x28766965772c2030, 0x2c20312c20226d65, - 0x7373616765206865, 0x6164657222293b0a, 0x2020202020202020, 0x2020202073776974, 0x6368202876696577, - 0x2e67657455696e74, 0x3828302929207b0a, 0x2020202020202020, 0x2020202063617365, 0x20436f6d6d616e64, - 0x2e61636b3a0a2020, 0x2020202020202020, 0x2020202020207265, 0x7175697265427974, 0x657328766965772c, - 0x20302c20322c2022, 0x61636b6e6f776c65, 0x6467656d656e7422, 0x293b0a2020202020, 0x2020202020202020, - 0x2020206966202874, 0x6869732e73746174, 0x65203d3d3d202268, 0x616e647368616b69, 0x6e672229207b0a20, - 0x2020202020202020, 0x2020202020202020, 0x202020746869732e, 0x6c6974746c65456e, 0x6469616e203d2076, - 0x6965772e67657455, 0x696e743828312920, 0x3d3d3d20303b0a20, 0x2020202020202020, 0x2020202020202020, - 0x202020746869732e, 0x7374617465203d20, 0x226c696e6b656422, 0x3b0a202020202020, 0x2020202020202020, - 0x2020202020207468, 0x69732e7265616479, 0x536574746c656420, 0x3d20747275653b0a, 0x2020202020202020, - 0x2020202020202020, 0x2020202074686973, 0x2e7265736f6c7665, 0x526561647928293b, 0x0a20202020202020, - 0x2020202020202020, 0x207d0a2020202020, 0x2020202020202020, 0x202020627265616b, 0x3b0a202020202020, - 0x2020202020206361, 0x736520436f6d6d61, 0x6e642e7465787443, 0x6f6d6d616e643a0a, 0x2020202020202020, - 0x2020202020202020, 0x746869732e68616e, 0x646c655465787443, 0x6f6d6d616e642876, 0x696577293b0a2020, - 0x2020202020202020, 0x2020202020206272, 0x65616b3b0a202020, 0x2020202020202020, 0x206361736520436f, - 0x6d6d616e642e6361, 0x6c6c46756e637469, 0x6f6e3a0a20202020, 0x2020202020202020, 0x2020202074686973, - 0x2e63616c6c4a7346, 0x756e6374696f6e28, 0x76696577293b0a20, 0x2020202020202020, 0x2020202020202062, - 0x7265616b3b0a2020, 0x2020202020202020, 0x2020636173652043, 0x6f6d6d616e642e64, 0x6f6d42617463683a, - 0x0a20202020202020, 0x2020202020202020, 0x20747279207b0a20, 0x2020202020202020, 0x2020202020202020, - 0x2020206966202876, 0x6965772e62797465, 0x4c656e677468203e, 0x2031303234202a20, 0x3130323429207468, - 0x726f77206e657720, 0x52616e6765457272, 0x6f722822444f4d20, 0x6261746368206578, 0x6365656473203120, - 0x4d694222293b0a20, 0x2020202020202020, 0x2020202020202020, 0x2020206966202821, 0x746869732e646f6d, - 0x426174636848616e, 0x646c657229207468, 0x726f77206e657720, 0x4572726f72282244, 0x4f4d20696e746572, - 0x7072657465722069, 0x73206e6f7420696e, 0x7374616c6c656422, 0x293b0a2020202020, 0x2020202020202020, - 0x2020202020202074, 0x6869732e646f6d42, 0x6174636848616e64, 0x6c6572286e657720, 0x55696e7438417272, - 0x6179286275666665, 0x7229293b0a202020, 0x2020202020202020, 0x20202020207d2063, 0x6174636820286572, - 0x726f7229207b0a20, 0x2020202020202020, 0x2020202020202020, 0x202020636f6e7374, 0x206964203d207669, - 0x65772e627974654c, 0x656e677468203e3d, 0x2036203f20766965, 0x772e67657455696e, 0x74333228322c2074, - 0x72756529203a2030, 0x3b0a202020202020, 0x2020202020202020, 0x2020202020207468, 0x69732e6370704675, - 0x6e6374696f6e2822, 0x7766446f6d2e7265, 0x6a65637465642229, 0x2869642c20537472, 0x696e67286572726f, - 0x722e6d6573736167, 0x65207c7c20657272, 0x6f72292e736c6963, 0x6528302c20343039, 0x3629292e63617463, - 0x68282829203d3e20, 0x7b7d293b0a202020, 0x2020202020202020, 0x20202020207d0a20, 0x2020202020202020, - 0x2020202020202062, 0x7265616b3b0a2020, 0x2020202020202020, 0x2020636173652043, 0x6f6d6d616e642e66, - 0x756e6374696f6e52, 0x657475726e3a0a20, 0x2020202020202020, 0x2020202020202074, 0x6869732e68616e64, - 0x6c6546756e637469, 0x6f6e52657475726e, 0x2876696577293b0a, 0x2020202020202020, 0x2020202020202020, - 0x627265616b3b0a20, 0x2020202020202020, 0x2020206465666175, 0x6c743a0a20202020, 0x2020202020202020, - 0x202020207468726f, 0x77206e6577204572, 0x726f722860556e73, 0x7570706f72746564, 0x2057656246726f6e, - 0x7420636f6d6d616e, 0x6420247b76696577, 0x2e67657455696e74, 0x382830297d60293b, 0x0a20202020202020, - 0x20202020207d0a20, 0x202020202020207d, 0x0a0a202020202020, 0x202068616e646c65, 0x54657874436f6d6d, - 0x616e642876696577, 0x29207b0a20202020, 0x2020202020202020, 0x7265717569726542, 0x7974657328766965, - 0x772c20302c20342c, 0x2022746578742063, 0x6f6d6d616e642068, 0x656164657222293b, 0x0a20202020202020, - 0x2020202020636f6e, 0x7374206c656e6774, 0x68203d2076696577, 0x2e67657455696e74, 0x31362832293b0a20, - 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x766965772c20342c, 0x206c656e6774682c, - 0x2022746578742063, 0x6f6d6d616e642070, 0x61796c6f61642229, 0x3b0a202020202020, 0x202020202020636f, - 0x6e73742074657874, 0x203d206e65772054, 0x6578744465636f64, 0x657228227574662d, 0x3822292e6465636f, - 0x6465286e65772055, 0x696e743841727261, 0x7928766965772e62, 0x75666665722c2076, 0x6965772e62797465, - 0x4f6666736574202b, 0x20342c206c656e67, 0x746829293b0a2020, 0x2020202020202020, 0x2020737769746368, - 0x2028766965772e67, 0x657455696e743828, 0x312929207b0a2020, 0x2020202020202020, 0x2020636173652054, - 0x657874436f6d6d61, 0x6e642e6465627567, 0x4c6f673a0a202020, 0x2020202020202020, 0x2020202020636f6e, - 0x736f6c652e6c6f67, 0x2874657874293b0a, 0x2020202020202020, 0x2020202020202020, 0x627265616b3b0a20, - 0x2020202020202020, 0x2020206361736520, 0x54657874436f6d6d, 0x616e642e696e6a65, 0x6374536372697074, - 0x3a207b0a20202020, 0x2020202020202020, 0x20202020636f6e73, 0x7420736372697074, 0x203d20646f63756d, - 0x656e742e63726561, 0x7465456c656d656e, 0x7428227363726970, 0x7422293b0a202020, 0x2020202020202020, - 0x2020202020736372, 0x6970742e74657874, 0x203d20746578743b, 0x0a20202020202020, 0x2020202020202020, - 0x2028646f63756d65, 0x6e742e626f647920, 0x3f3f20646f63756d, 0x656e742e68656164, 0x203f3f20646f6375, - 0x6d656e742e646f63, 0x756d656e74456c65, 0x6d656e74292e6170, 0x70656e644368696c, 0x6428736372697074, - 0x293b0a2020202020, 0x2020202020202020, 0x202020627265616b, 0x3b0a202020202020, 0x2020202020207d0a, - 0x2020202020202020, 0x2020202064656661, 0x756c743a0a202020, 0x2020202020202020, 0x2020202020746872, - 0x6f77206e65772045, 0x72726f722860556e, 0x737570706f727465, 0x642057656246726f, 0x6e74207465787420, - 0x636f6d6d616e6420, 0x247b766965772e67, 0x657455696e743828, 0x31297d60293b0a20, 0x2020202020202020, - 0x2020207d0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x63616c6c4a734675, 0x6e6374696f6e286d, - 0x6573736167652920, 0x7b0a202020202020, 0x2020202020207265, 0x7175697265427974, 0x6573286d65737361, - 0x67652c20302c2038, 0x2c202266756e6374, 0x696f6e2063616c6c, 0x2068656164657222, 0x293b0a2020202020, - 0x2020202020202063, 0x6f6e737420636f75, 0x6e74203d206d6573, 0x736167652e676574, 0x55696e7438283129, - 0x3b0a202020202020, 0x202020202020636f, 0x6e73742063616c6c, 0x4964203d206d6573, 0x736167652e676574, - 0x55696e7431362832, 0x2c20746869732e6c, 0x6974746c65456e64, 0x69616e293b0a2020, 0x2020202020202020, - 0x202069662028636f, 0x756e74203d3d3d20, 0x30290a2020202020, 0x2020202020202020, 0x2020207468726f77, - 0x206e657720457272, 0x6f72282246756e63, 0x74696f6e2063616c, 0x6c20686173206e6f, 0x2066756e6374696f, - 0x6e206e616d652229, 0x3b0a202020202020, 0x202020202020636f, 0x6e7374207061796c, 0x6f616453697a6520, - 0x3d206d6573736167, 0x652e67657455696e, 0x74333228342c2074, 0x6869732e6c697474, 0x6c65456e6469616e, - 0x293b0a2020202020, 0x2020202020202072, 0x6571756972654279, 0x746573286d657373, 0x6167652c20382c20, - 0x7061796c6f616453, 0x697a652c20226675, 0x6e6374696f6e2063, 0x616c6c207061796c, 0x6f616422293b0a20, - 0x2020202020202020, 0x202020636f6e7374, 0x207061796c6f6164, 0x203d206e65772044, 0x6174615669657728, - 0x6d6573736167652e, 0x6275666665722c20, 0x6d6573736167652e, 0x627974654f666673, 0x6574202b20382c20, - 0x7061796c6f616453, 0x697a65293b0a2020, 0x2020202020202020, 0x2020636f6e737420, 0x5b6e616d65732c20, - 0x6e616d6542797465, 0x735d203d20746869, 0x732e6465636f6465, 0x506172616d657465, 0x727328312c207061, - 0x796c6f6164293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x74205b706172616d, 0x65746572732c2070, - 0x6172616d65746572, 0x42797465735d203d, 0x20746869732e6465, 0x636f646550617261, 0x6d65746572732863, - 0x6f756e74202d2031, 0x2c207061796c6f61, 0x642c206e616d6542, 0x79746573293b0a20, 0x2020202020202020, - 0x202020696620286e, 0x616d654279746573, 0x202b20706172616d, 0x6574657242797465, 0x7320213d3d207061, - 0x796c6f616453697a, 0x65290a2020202020, 0x2020202020202020, 0x2020207468726f77, 0x206e657720457272, - 0x6f72282246756e63, 0x74696f6e2063616c, 0x6c20636f6e746169, 0x6e7320747261696c, 0x696e67207061796c, - 0x6f61642064617461, 0x22293b0a20202020, 0x2020202020202020, 0x6c65742065786563, 0x7574696f6e3b0a20, - 0x2020202020202020, 0x202020747279207b, 0x0a20202020202020, 0x2020202020202020, 0x2065786563757469, - 0x6f6e203d20746869, 0x732e657865637574, 0x6546756e6374696f, 0x6e286e616d65735b, 0x305d2c2070617261, - 0x6d6574657273293b, 0x0a20202020202020, 0x20202020207d2063, 0x6174636820286572, 0x726f7229207b0a20, - 0x2020202020202020, 0x2020202020202074, 0x6869732e7265706f, 0x727443616c6c4661, 0x696c757265286361, - 0x6c6c49642c206572, 0x726f72293b0a2020, 0x2020202020202020, 0x2020202020207265, 0x7475726e3b0a2020, - 0x2020202020202020, 0x20207d0a20202020, 0x2020202020202020, 0x2f2f2063616c6c49, 0x642030206d65616e, - 0x7320746865206361, 0x6c6c657220697320, 0x6e6f742077616974, 0x696e6720666f7220, 0x616e797468696e67, - 0x2c20736f20746865, 0x7265206973206e6f, 0x7468696e6720746f, 0x2073656e64206261, 0x636b2e0a20202020, - 0x2020202020202020, 0x6966202863616c6c, 0x496420213d3d2030, 0x290a202020202020, 0x2020202020202020, - 0x202050726f6d6973, 0x652e7265736f6c76, 0x6528657865637574, 0x696f6e292e746865, 0x6e280a2020202020, - 0x2020202020202020, 0x2020202020202076, 0x616c7565203d3e20, 0x746869732e726570, 0x6f727443616c6c53, - 0x7563636573732863, 0x616c6c49642c2076, 0x616c7565292c0a20, 0x2020202020202020, 0x2020202020202020, - 0x2020206572726f72, 0x203d3e2074686973, 0x2e73656e6446756e, 0x6374696f6e457272, 0x6f722863616c6c49, - 0x642c206572726f72, 0x29293b0a20202020, 0x202020207d0a0a20, 0x2020202020202072, 0x65706f727443616c, - 0x6c4661696c757265, 0x2863616c6c49642c, 0x206572726f722920, 0x7b0a202020202020, 0x2020202020206966, - 0x202863616c6c4964, 0x203d3d3d2030290a, 0x2020202020202020, 0x2020202020202020, 0x636f6e736f6c652e, - 0x6572726f7228225b, 0x57656246726f6e74, 0x204a617661536372, 0x6970742063616c6c, 0x5d222c206572726f, - 0x72293b0a20202020, 0x2020202020202020, 0x656c73650a202020, 0x2020202020202020, 0x2020202020746869, - 0x732e73656e644675, 0x6e6374696f6e4572, 0x726f722863616c6c, 0x49642c206572726f, 0x72293b0a20202020, - 0x202020207d0a0a20, 0x2020202020202072, 0x65706f727443616c, 0x6c53756363657373, 0x2863616c6c49642c, - 0x2076616c75652920, 0x7b0a202020202020, 0x2020202020207472, 0x79207b0a20202020, 0x2020202020202020, - 0x2020202074686973, 0x2e73656e6446756e, 0x6374696f6e526574, 0x75726e2863616c6c, 0x49642c2076616c75, - 0x65293b0a20202020, 0x2020202020202020, 0x7d20636174636820, 0x286572726f722920, 0x7b0a202020202020, - 0x2020202020202020, 0x2020746869732e73, 0x656e6446756e6374, 0x696f6e4572726f72, 0x2863616c6c49642c, - 0x206572726f72293b, 0x0a20202020202020, 0x20202020207d0a20, 0x202020202020207d, 0x0a0a202020202020, - 0x2020657865637574, 0x6546756e6374696f, 0x6e286e616d652c20, 0x6172677329207b0a, 0x2020202020202020, - 0x202020202f2f2054, 0x6865206578636861, 0x6e6765206f662074, 0x6865207265616420, 0x62696e64696e6720, - 0x62656c6f6e677320, 0x746f207468652062, 0x7269646765207468, 0x6174207265636569, 0x7665642074686520, - 0x63616c6c2c206e6f, 0x7420746f20612067, 0x6c6f62616c207369, 0x6e676c65746f6e2e, 0x0a20202020202020, - 0x2020202020696620, 0x286e616d65203d3d, 0x3d2022776642696e, 0x642e65786368616e, 0x676522290a202020, - 0x2020202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e62696e64436c69, 0x656e74282e2e2e61, - 0x726773293b0a2020, 0x2020202020202020, 0x2020636f6e737420, 0x70617468203d206e, 0x616d652e73706c69, - 0x7428222e22293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x74206d656d626572, 0x203d20706174682e, - 0x706f7028293b0a20, 0x2020202020202020, 0x2020206c65742063, 0x6f6e74657874203d, 0x20676c6f62616c3b, - 0x0a20202020202020, 0x2020202020666f72, 0x2028636f6e737420, 0x636f6d706f6e656e, 0x74206f6620706174, - 0x6829207b0a202020, 0x2020202020202020, 0x2020202020696620, 0x28636f6e74657874, 0x203d3d206e756c6c, - 0x207c7c202128636f, 0x6d706f6e656e7420, 0x696e20636f6e7465, 0x787429290a202020, 0x2020202020202020, - 0x2020202020202020, 0x207468726f772062, 0x7269646765457272, 0x6f72284272696467, 0x65436f64652e6e6f, - 0x74466f756e642c20, 0x604a617661536372, 0x697074206e616d65, 0x7370616365202724, 0x7b636f6d706f6e65, - 0x6e747d2720776173, 0x206e6f7420666f75, 0x6e64207768696c65, 0x207265736f6c7669, 0x6e672027247b6e61, - 0x6d657d2760293b0a, 0x2020202020202020, 0x2020202020202020, 0x636f6e7465787420, 0x3d20636f6e746578, - 0x745b636f6d706f6e, 0x656e745d3b0a2020, 0x2020202020202020, 0x20207d0a20202020, 0x2020202020202020, - 0x69662028636f6e74, 0x657874203d3d206e, 0x756c6c207c7c2074, 0x7970656f6620636f, 0x6e746578745b6d65, - 0x6d6265725d20213d, 0x3d202266756e6374, 0x696f6e22290a2020, 0x2020202020202020, 0x2020202020207468, - 0x726f772062726964, 0x67654572726f7228, 0x427269646765436f, 0x64652e6e6f74466f, 0x756e642c20604a61, - 0x7661536372697074, 0x2066756e6374696f, 0x6e2027247b6e616d, 0x657d272077617320, 0x6e6f7420666f756e, - 0x6460293b0a202020, 0x2020202020202020, 0x2072657475726e20, 0x636f6e746578745b, 0x6d656d6265725d28, - 0x2e2e2e6172677329, 0x3b0a202020202020, 0x20207d0a0a202020, 0x202020202068616e, 0x646c6546756e6374, - 0x696f6e5265747572, 0x6e286d6573736167, 0x6529207b0a202020, 0x2020202020202020, 0x2072657175697265, - 0x4279746573286d65, 0x73736167652c2030, 0x2c20382c20226675, 0x6e6374696f6e2072, 0x657475726e206865, - 0x6164657222293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x742063616c6c4964, 0x203d206d65737361, - 0x67652e6765745569, 0x6e74313628322c20, 0x746869732e6c6974, 0x746c65456e646961, 0x6e293b0a20202020, - 0x2020202020202020, 0x636f6e7374207065, 0x6e64696e67203d20, 0x746869732e70656e, 0x64696e6743616c6c, - 0x732e676574286361, 0x6c6c4964293b0a20, 0x2020202020202020, 0x2020206966202821, 0x70656e64696e6729, - 0x0a20202020202020, 0x2020202020202020, 0x207468726f77206e, 0x6577204572726f72, 0x286046756e637469, - 0x6f6e207265747572, 0x6e2068617320756e, 0x6b6e6f776e206361, 0x6c6c20696420247b, 0x63616c6c49647d60, - 0x293b0a2020202020, 0x2020202020202074, 0x6869732e70656e64, 0x696e6743616c6c73, 0x2e64656c65746528, - 0x63616c6c4964293b, 0x0a0a202020202020, 0x2020202020202f2f, 0x2041206465636f64, 0x65206661696c7572, - 0x652068617320746f, 0x20736574746c6520, 0x7468652070656e64, 0x696e672063616c6c, 0x2072617468657220, - 0x7468616e20657363, 0x61706520696e746f, 0x2074686520736f63, 0x6b65742068616e64, 0x6c65722c0a202020, - 0x2020202020202020, 0x202f2f206f746865, 0x7277697365207468, 0x652063616c6c6572, 0x27732070726f6d69, - 0x736520776f756c64, 0x2068616e6720666f, 0x72657665722e0a20, 0x2020202020202020, 0x202020747279207b, - 0x0a20202020202020, 0x2020202020202020, 0x20746869732e7365, 0x74746c6552657475, 0x726e2870656e6469, - 0x6e672c206d657373, 0x616765293b0a2020, 0x2020202020202020, 0x20207d2063617463, 0x6820286572726f72, - 0x29207b0a20202020, 0x2020202020202020, 0x2020202069662028, 0x6572726f7220696e, 0x7374616e63656f66, - 0x204572726f722026, 0x26206572726f722e, 0x636f6465203d3d3d, 0x20756e646566696e, 0x656429207b0a2020, - 0x2020202020202020, 0x2020202020202020, 0x20204f626a656374, 0x2e646566696e6550, 0x726f706572747928, - 0x6572726f722c2022, 0x636f6465222c207b, 0x76616c75653a2042, 0x7269646765436f64, 0x652e6d616c666f72, - 0x6d65642c20656e75, 0x6d657261626c653a, 0x20747275652c2077, 0x72697461626c653a, 0x2066616c73652c20, - 0x636f6e6669677572, 0x61626c653a206661, 0x6c73657d293b0a20, 0x2020202020202020, 0x2020202020202020, - 0x2020206272696467, 0x654572726f72732e, 0x616464286572726f, 0x72293b0a20202020, 0x2020202020202020, - 0x202020207d0a2020, 0x2020202020202020, 0x2020202020207065, 0x6e64696e672e7265, 0x6a65637428657272, - 0x6f72293b0a202020, 0x2020202020202020, 0x207d0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, - 0x2f20536574746c65, 0x7320612070656e64, 0x696e672063616c6c, 0x2077697468207468, 0x652076616c75652c, - 0x2074686520657863, 0x657074696f6e206f, 0x7220746865206162, 0x73656e6365206f66, 0x2076616c75652074, - 0x6861742061207265, 0x7475726e206d6573, 0x7361676520636172, 0x726965732e0a2020, 0x2020202020207365, - 0x74746c6552657475, 0x726e2870656e6469, 0x6e672c206d657373, 0x61676529207b0a20, 0x2020202020202020, - 0x202020636f6e7374, 0x20636f756e74203d, 0x206d657373616765, 0x2e67657455696e74, 0x382831293b0a2020, - 0x2020202020202020, 0x2020636f6e737420, 0x7061796c6f616453, 0x697a65203d206d65, 0x73736167652e6765, - 0x7455696e74333228, 0x342c20746869732e, 0x6c6974746c65456e, 0x6469616e293b0a20, 0x2020202020202020, - 0x2020207265717569, 0x7265427974657328, 0x6d6573736167652c, 0x20382c207061796c, 0x6f616453697a652c, - 0x202266756e637469, 0x6f6e207265747572, 0x6e207061796c6f61, 0x6422293b0a202020, 0x2020202020202020, - 0x20636f6e73742070, 0x61796c6f6164203d, 0x206e657720446174, 0x6156696577286d65, 0x73736167652e6275, - 0x666665722c206d65, 0x73736167652e6279, 0x74654f6666736574, 0x202b20382c207061, 0x796c6f616453697a, - 0x65293b0a0a202020, 0x2020202020202020, 0x2069662028746869, 0x732e636172726965, 0x7345786365707469, - 0x6f6e28636f756e74, 0x2c207061796c6f61, 0x6453697a652c2070, 0x61796c6f61642929, 0x207b0a2020202020, - 0x2020202020202020, 0x20202070656e6469, 0x6e672e72656a6563, 0x7428746869732e73, 0x696e676c6556616c, - 0x7565287061796c6f, 0x61642c207061796c, 0x6f616453697a652c, 0x2022457863657074, 0x696f6e2229293b0a, - 0x2020202020202020, 0x2020202020202020, 0x72657475726e3b0a, 0x2020202020202020, 0x202020207d0a2020, - 0x2020202020202020, 0x202069662028636f, 0x756e74203d3d3d20, 0x3029207b0a202020, 0x2020202020202020, - 0x2020202020696620, 0x287061796c6f6164, 0x53697a6520213d3d, 0x2030290a20202020, 0x2020202020202020, - 0x2020202020202020, 0x7468726f77206e65, 0x77204572726f7228, 0x22566f6964207265, 0x7475726e20636f6e, - 0x7461696e73207061, 0x796c6f6164206461, 0x746122293b0a2020, 0x2020202020202020, 0x2020202020207065, - 0x6e64696e672e7265, 0x736f6c766528756e, 0x646566696e656429, 0x3b0a202020202020, 0x2020202020202020, - 0x202072657475726e, 0x3b0a202020202020, 0x2020202020207d0a, 0x2020202020202020, 0x2020202069662028, - 0x636f756e7420213d, 0x3d2031290a202020, 0x2020202020202020, 0x2020202020746872, 0x6f77206e65772045, - 0x72726f7228224675, 0x6e6374696f6e2072, 0x657475726e206d75, 0x737420636f6e7461, 0x696e207a65726f20, - 0x6f72206f6e652076, 0x616c756522293b0a, 0x2020202020202020, 0x2020202070656e64, 0x696e672e7265736f, - 0x6c76652874686973, 0x2e73696e676c6556, 0x616c756528706179, 0x6c6f61642c207061, 0x796c6f616453697a, - 0x652c202246756e63, 0x74696f6e2229293b, 0x0a20202020202020, 0x207d0a0a20202020, 0x2020202063617272, - 0x6965734578636570, 0x74696f6e28636f75, 0x6e742c207061796c, 0x6f616453697a652c, 0x207061796c6f6164, - 0x29207b0a20202020, 0x2020202020202020, 0x69662028636f756e, 0x7420213d3d203120, 0x7c7c207061796c6f, - 0x616453697a65203d, 0x3d3d203029207265, 0x7475726e2066616c, 0x73653b0a20202020, 0x2020202020202020, - 0x72657475726e2070, 0x61796c6f61642e67, 0x657455696e743828, 0x3029203d3d3d2050, 0x6172616d54797065, - 0x2e65786365707469, 0x6f6e3b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f204465636f64, - 0x6573206578616374, 0x6c79206f6e652076, 0x616c756520616e64, 0x2072656a65637473, 0x20616e7920627974, - 0x6573206c65667420, 0x6f76657220616674, 0x65722069742e0a20, 0x2020202020202073, 0x696e676c6556616c, - 0x7565287061796c6f, 0x61642c207061796c, 0x6f616453697a652c, 0x207768617429207b, 0x0a20202020202020, - 0x2020202020636f6e, 0x7374205b76616c75, 0x65732c20636f6e73, 0x756d65645d203d20, 0x746869732e646563, - 0x6f6465506172616d, 0x657465727328312c, 0x207061796c6f6164, 0x293b0a2020202020, 0x2020202020202069, - 0x662028636f6e7375, 0x6d656420213d3d20, 0x7061796c6f616453, 0x697a65290a202020, 0x2020202020202020, - 0x2020202020746872, 0x6f77206e65772045, 0x72726f722860247b, 0x776861747d207265, 0x7475726e20636f6e, - 0x7461696e73207472, 0x61696c696e672070, 0x61796c6f61642064, 0x61746160293b0a20, 0x2020202020202020, - 0x2020207265747572, 0x6e2076616c756573, 0x5b305d3b0a202020, 0x20202020207d0a0a, 0x2020202020202020, - 0x2f2f2f204465636f, 0x6465732060636f75, 0x6e746020636f6e73, 0x6563757469766520, 0x76616c7565733b20, - 0x72657475726e7320, 0x7468656d20776974, 0x6820746865206279, 0x74657320636f6e73, 0x756d65642c20616e, - 0x64207265636f7264, 0x7320746865697220, 0x7368617065732069, 0x6e20607368617065, 0x7360207768656e20, - 0x676976656e2e0a20, 0x2020202020202064, 0x65636f6465506172, 0x616d657465727328, 0x636f756e742c2076, - 0x6965772c206f6666, 0x736574203d20302c, 0x2073686170657320, 0x3d206e756c6c2920, 0x7b0a202020202020, + 0x617028293b0a2020, 0x2020202020202020, 0x20202f2f2f205768, 0x617420616e20696e, 0x73706563746f7220, + 0x6f66207468652064, 0x6576656c6f706572, 0x20656e7669726f6e, 0x6d656e7420696e73, 0x74616c6c7320746f, + 0x20666f6c6c6f7720, 0x7468697320627269, 0x6467652c206e756c, 0x6c206f7468657277, 0x6973653a20697473, + 0x0a20202020202020, 0x20202020202f2f2f, 0x206063616c6c286e, 0x616d652c20726573, 0x6f6c76652c207265, + 0x6a65637429602072, 0x657475726e732074, 0x6865207061697220, 0x7468617420736574, 0x746c657320612063, + 0x616c6c20746f2043, 0x2b2b20696e206974, 0x7320706c6163652c, 0x20616e6420697473, 0x20606a7343616c6c, + 0x286e616d6529600a, 0x2020202020202020, 0x202020202f2f2f20, 0x697320746f6c6420, 0x65616368204a6176, + 0x6153637269707420, 0x66756e6374696f6e, 0x207468617420432b, 0x2b2063616c6c732e, 0x20576974686f7574, + 0x206f6e6520746865, 0x2062726964676520, 0x7265636f72647320, 0x6e6f7468696e672e, 0x0a20202020202020, + 0x2020202020746869, 0x732e70726f626520, 0x3d206e756c6c3b0a, 0x2020202020202020, 0x202020202f2f2f20, + 0x5768792060726561, 0x6479602077617320, 0x72656a6563746564, 0x2c206e756c6c206f, 0x7468657277697365, + 0x2e0a202020202020, 0x2020202020207468, 0x69732e7265616479, 0x4572726f72203d20, 0x6e756c6c3b0a2020, + 0x2020202020202020, 0x2020746869732e72, 0x6561647953657474, 0x6c6564203d206661, 0x6c73653b0a202020, + 0x2020202020202020, 0x20746869732e7265, 0x61647950726f6d69, 0x7365203d206e6577, 0x2050726f6d697365, + 0x28287265736f6c76, 0x652c2072656a6563, 0x7429203d3e207b0a, 0x2020202020202020, 0x2020202020202020, + 0x746869732e726573, 0x6f6c766552656164, 0x79203d207265736f, 0x6c76653b0a202020, 0x2020202020202020, + 0x2020202020746869, 0x732e72656a656374, 0x5265616479203d20, 0x72656a6563743b0a, 0x2020202020202020, + 0x202020207d293b0a, 0x2020202020202020, 0x202020202f2f2057, 0x6974686f75742074, 0x6869732c20612070, + 0x6167652074686174, 0x206e657665722074, 0x6f75636865732077, 0x656246726f6e742e, 0x726561647920776f, + 0x756c642073656520, 0x616e2022756e6861, 0x6e646c65640a2020, 0x2020202020202020, 0x20202f2f2070726f, + 0x6d6973652072656a, 0x656374696f6e2220, 0x7761726e696e6720, 0x6966207468652069, 0x6e697469616c2063, + 0x6f6e6e656374696f, 0x6e206661696c732e, 0x204170706c696361, 0x74696f6e20636f64, 0x65207374696c6c0a, + 0x2020202020202020, 0x202020202f2f2067, 0x6574732069747320, 0x6f776e20696e6465, 0x70656e64656e7420, + 0x736574746c656d65, 0x6e7420766961202e, 0x7468656e28292f2e, 0x636174636828292f, 0x6177616974206f6e, + 0x207468652073616d, 0x652070726f6d6973, 0x653b0a2020202020, 0x202020202020202f, 0x2f20617474616368, + 0x696e672061206861, 0x6e646c6572206865, 0x726520646f65736e, 0x277420636f6e7375, 0x6d65206f72206166, + 0x666563742074686f, 0x73652e0a20202020, 0x2020202020202020, 0x746869732e726561, 0x647950726f6d6973, + 0x652e636174636828, 0x2829203d3e207b7d, 0x293b0a2020202020, 0x2020202020202074, 0x6869732e626f756e, + 0x6450726f6d697365, 0x203d206e65772050, 0x726f6d6973652828, 0x7265736f6c76652c, 0x2072656a65637429, + 0x203d3e207b0a2020, 0x2020202020202020, 0x2020202020207468, 0x69732e7265736f6c, 0x7665426f756e6420, + 0x3d207265736f6c76, 0x653b0a2020202020, 0x2020202020202020, 0x202020746869732e, 0x72656a656374426f, + 0x756e64203d207265, 0x6a6563743b0a2020, 0x2020202020202020, 0x20207d293b0a2020, 0x2020202020202020, + 0x2020746869732e62, 0x6f756e6450726f6d, 0x6973652e63617463, 0x68282829203d3e20, 0x7b7d293b0a202020, + 0x2020202020202020, 0x20746869732e736f, 0x636b6574203d206e, 0x657720576562536f, 0x636b65742875726c, + 0x2c20225765624672, 0x6f6e745f302e3122, 0x293b0a2020202020, 0x2020202020202074, 0x6869732e736f636b, + 0x65742e62696e6172, 0x7954797065203d20, 0x2261727261796275, 0x66666572223b0a20, 0x2020202020202020, + 0x202020746869732e, 0x736f636b65742e6f, 0x6e6f70656e203d20, 0x2829203d3e207468, 0x69732e68616e6473, + 0x68616b6528293b0a, 0x2020202020202020, 0x2020202074686973, 0x2e736f636b65742e, 0x6f6e6d6573736167, + 0x65203d206576656e, 0x74203d3e20746869, 0x732e6f6e4d657373, 0x616765286576656e, 0x742e64617461293b, + 0x0a20202020202020, 0x2020202020746869, 0x732e736f636b6574, 0x2e6f6e636c6f7365, 0x203d206576656e74, + 0x203d3e207b0a2020, 0x2020202020202020, 0x202020202020636f, 0x6e73742064657461, 0x696c203d20657665, + 0x6e742e776173436c, 0x65616e203f206063, 0x6f64653d247b6576, 0x656e742e636f6465, 0x7d20726561736f6e, + 0x3d247b6576656e74, 0x2e726561736f6e7d, 0x60203a2022636f6e, 0x6e656374696f6e20, 0x6c6f7374223b0a20, + 0x2020202020202020, 0x2020202020202063, 0x6f6e737420657272, 0x6f72203d20627269, 0x6467654572726f72, + 0x2842726964676543, 0x6f64652e64697363, 0x6f6e6e6563746564, 0x2c20605765624672, 0x6f6e7420636f6e6e, + 0x656374696f6e2063, 0x6c6f7365643a2024, 0x7b64657461696c7d, 0x60293b0a20202020, 0x2020202020202020, + 0x2020202074686973, 0x2e736574746c6552, 0x6561647952656a65, 0x6374656428657272, 0x6f72293b0a202020, + 0x2020202020202020, 0x2020202020746869, 0x732e72656a656374, 0x426f756e64286572, 0x726f72293b20202f, + 0x2f2061206e6f2d6f, 0x70206f6e63652073, 0x6574746c65640a20, 0x2020202020202020, 0x2020202020202066, + 0x6f722028636f6e73, 0x742070656e64696e, 0x67206f6620746869, 0x732e70656e64696e, 0x6743616c6c732e76, + 0x616c756573282929, 0x0a20202020202020, 0x2020202020202020, 0x202020202070656e, 0x64696e672e72656a, + 0x656374286572726f, 0x72293b0a20202020, 0x2020202020202020, 0x2020202074686973, 0x2e70656e64696e67, + 0x43616c6c732e636c, 0x65617228293b0a20, 0x2020202020202020, 0x2020202020202074, 0x6869732e73746174, + 0x65203d2022636c6f, 0x736564223b0a2020, 0x2020202020202020, 0x202020202020636f, 0x6e736f6c652e6c6f, + 0x6728605b57656246, 0x726f6e7420636c6f, 0x73655d20247b6465, 0x7461696c7d60293b, 0x0a20202020202020, + 0x20202020207d3b0a, 0x2020202020202020, 0x2020202074686973, 0x2e736f636b65742e, 0x6f6e6572726f7220, + 0x3d202829203d3e20, 0x7b0a202020202020, 0x2020202020202020, 0x2020636f6e737420, 0x6572726f72203d20, + 0x6e6577204572726f, 0x7228225765624672, 0x6f6e7420636f6e6e, 0x656374696f6e2066, 0x61696c656422293b, + 0x0a20202020202020, 0x2020202020202020, 0x20746869732e7365, 0x74746c6552656164, 0x7952656a65637465, + 0x64286572726f7229, 0x3b0a202020202020, 0x2020202020202020, 0x2020746869732e72, 0x656a656374426f75, + 0x6e64286572726f72, 0x293b0a2020202020, 0x2020202020202020, 0x202020636f6e736f, 0x6c652e6572726f72, + 0x28225b5765624672, 0x6f6e7420736f636b, 0x6574206572726f72, 0x5d222c206572726f, 0x72293b0a20202020, + 0x2020202020202020, 0x7d3b0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, 0x2f205265736f6c76, + 0x6573206f6e636520, 0x7468652057656253, 0x6f636b6574206861, 0x6e647368616b6520, 0x69732061636b6e6f, + 0x776c65646765642c, 0x2072656a65637473, 0x2069662074686520, 0x696e697469616c20, 0x636f6e6e65637469, + 0x6f6e0a2020202020, 0x2020202f2f2f2063, 0x6c6f736573206f72, 0x206661696c732062, 0x65666f7265207468, + 0x61742e20446f6573, 0x206e6f7420726566, 0x6c656374206c6174, 0x657220646973636f, 0x6e6e656374733b20, + 0x7365652070656e64, 0x696e6743616c6c73, 0x2f73746174652e0a, 0x2020202020202020, 0x6765742072656164, + 0x792829207b0a2020, 0x2020202020202020, 0x202072657475726e, 0x20746869732e7265, 0x61647950726f6d69, + 0x73653b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f205265736f6c, 0x766573206f6e6365, + 0x2074686973206272, 0x6f7773657220636c, 0x69656e7420686f6c, 0x6473207468652063, 0x6f6f6b6965207468, + 0x61742062696e6473, 0x2074686520726561, 0x642055524c732067, 0x6976656e20746f20, 0x7468697320706167, + 0x6520284144522d30, 0x3230292c20616e64, 0x0a20202020202020, 0x202f2f2f2072656a, 0x656374732c207769, + 0x746820616e206578, 0x706c696369742065, 0x72726f722c207768, 0x656e207468652065, 0x786368616e676520, + 0x6661696c73206f72, 0x207468652062726f, 0x7773657220726566, 0x7573657320746865, 0x20636f6f6b69653a, + 0x20626f756e642072, 0x656164730a202020, 0x20202020202f2f2f, 0x207468656e206661, 0x696c2c2077697468, + 0x6f75742066616c6c, 0x696e67206261636b, 0x20746f2074686520, 0x746f6b656e20616c, 0x6f6e652e20432b2b, + 0x2073746172747320, 0x6974207269676874, 0x2061667465722074, 0x68652068616e6473, 0x68616b652e0a2020, + 0x2020202020206765, 0x7420626f756e6428, 0x29207b0a20202020, 0x2020202020202020, 0x72657475726e2074, + 0x6869732e626f756e, 0x6450726f6d697365, 0x3b0a202020202020, 0x20207d0a0a202020, 0x20202020202f2f2f, + 0x2045786368616e67, 0x657320746865206f, 0x6e652d74696d6520, 0x7365637265742072, 0x6563656976656420, + 0x7468726f75676820, 0x7468652062726964, 0x676520666f722074, 0x686520636f6f6b69, 0x65206f6620746869, + 0x7320636c69656e74, 0x2c207468656e2063, 0x6865636b73207468, 0x6174207468650a20, 0x202020202020202f, + 0x2f2f2062726f7773, 0x6572206b65707420, 0x69742e2054686520, 0x7365637265742069, 0x732073696e676c65, + 0x207573653b207468, 0x6520636f6f6b6965, 0x2069732048747470, 0x4f6e6c792c20736f, 0x2074686520706167, + 0x65206e6576657220, 0x7265616473206974, 0x2e0a202020202020, 0x20206173796e6320, 0x62696e64436c6965, + 0x6e74287365637265, 0x7429207b0a202020, 0x2020202020202020, 0x202f2f204162736f, 0x6c75746520616e64, + 0x2070696e6e656420, 0x746f20746865206f, 0x726967696e206f66, 0x2074686520617070, 0x6c69636174696f6e, + 0x3a2061203c626173, 0x6520687265663e20, 0x696e207468652070, 0x616765206d757374, 0x206e657665722072, + 0x6564697265637420, 0x7468650a20202020, 0x2020202020202020, 0x2f2f206f6e652d74, 0x696d652073656372, + 0x657420746f20616e, 0x6f7468657220686f, 0x73742c20616e6420, 0x6120726564697265, 0x6374206d75737420, + 0x6e65766572206361, 0x7272792069742061, 0x7761792e0a202020, 0x2020202020202020, 0x20636f6e73742062, + 0x617365203d20676c, 0x6f62616c2e6c6f63, 0x6174696f6e2e6f72, 0x6967696e202b2022, 0x2f77656266726f6e, + 0x742f736572766963, 0x65732f62696e642f, 0x223b0a2020202020, 0x2020202020202063, 0x6f6e73742070696e, + 0x6e6564203d207b63, 0x726564656e746961, 0x6c733a202273616d, 0x652d6f726967696e, 0x222c206d6f64653a, + 0x202273616d652d6f, 0x726967696e222c20, 0x7265646972656374, 0x3a20226572726f72, 0x222c206361636865, + 0x3a20226e6f2d7374, 0x6f7265227d3b0a20, 0x2020202020202020, 0x202020747279207b, 0x0a20202020202020, + 0x2020202020202020, 0x20636f6e73742065, 0x786368616e676520, 0x3d20617761697420, 0x6665746368286261, + 0x7365202b20656e63, 0x6f6465555249436f, 0x6d706f6e656e7428, 0x736563726574292c, 0x2070696e6e656429, + 0x3b0a202020202020, 0x2020202020202020, 0x2020696620282165, 0x786368616e67652e, 0x6f6b29207468726f, + 0x77206e6577204572, 0x726f722860746865, 0x2073657276657220, 0x7265667573656420, 0x7468652065786368, + 0x616e676520284854, 0x545020247b657863, 0x68616e67652e7374, 0x617475737d296029, 0x3b0a202020202020, + 0x2020202020202020, 0x2020636f6e737420, 0x636c69656e74203d, 0x2065786368616e67, 0x652e686561646572, + 0x732e676574282258, 0x2d57656246726f6e, 0x742d436c69656e74, 0x22293b0a20202020, 0x2020202020202020, + 0x2020202069662028, 0x21636c69656e7429, 0x207468726f77206e, 0x6577204572726f72, 0x2822746865207365, + 0x7276657220646964, 0x206e6f74206e616d, 0x652074686520636c, 0x69656e7422293b0a, 0x2020202020202020, + 0x2020202020202020, 0x636f6e7374206368, 0x65636b203d206177, 0x6169742066657463, 0x682862617365202b, + 0x2022636865636b2f, 0x22202b20656e636f, 0x6465555249436f6d, 0x706f6e656e742863, 0x6c69656e74292c20, + 0x70696e6e6564293b, 0x0a20202020202020, 0x2020202020202020, 0x2069662028216368, 0x65636b2e6f6b2920, + 0x7468726f77206e65, 0x77204572726f7228, 0x227468652062726f, 0x7773657220726566, 0x7573656420746865, + 0x2062696e64696e67, 0x20636f6f6b696522, 0x293b0a2020202020, 0x2020202020202020, 0x202020746869732e, + 0x7265736f6c766542, 0x6f756e6428293b0a, 0x2020202020202020, 0x202020207d206361, 0x7463682028657272, + 0x6f7229207b0a2020, 0x2020202020202020, 0x202020202020636f, 0x6e7374206661696c, 0x757265203d206e65, + 0x77204572726f7228, 0x6057656246726f6e, 0x7420636f756c6420, 0x6e6f742062696e64, 0x2074686973206272, + 0x6f7773657220666f, 0x722072656164733a, 0x20247b6572726f72, 0x2e6d657373616765, 0x207c7c206572726f, + 0x727d60293b0a2020, 0x2020202020202020, 0x2020202020207468, 0x69732e72656a6563, 0x74426f756e642866, + 0x61696c757265293b, 0x0a20202020202020, 0x2020202020202020, 0x20636f6e736f6c65, 0x2e6572726f722822, + 0x5b57656246726f6e, 0x742062696e64696e, 0x675d222c20666169, 0x6c757265293b0a20, 0x2020202020202020, + 0x2020207d0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x2f2f2f2052656a65, 0x6374732074686520, + 0x696e697469616c2d, 0x72656164696e6573, 0x732070726f6d6973, 0x65206174206d6f73, 0x74206f6e63652c20, + 0x616e64206f6e6c79, 0x207768696c652073, 0x74696c6c20776169, 0x74696e67206f6e20, 0x7468650a20202020, + 0x202020202f2f2f20, 0x68616e647368616b, 0x652e204120666169, 0x6c656420636f6e6e, 0x656374696f6e2074, + 0x79706963616c6c79, 0x2066697265732062, 0x6f74682060657272, 0x6f726020616e6420, 0x60636c6f7365602c, + 0x20616e642061206c, 0x617465720a202020, 0x20202020202f2f2f, 0x20646973636f6e6e, 0x6563742028616674, + 0x6572206c696e6b69, 0x6e6729206d757374, 0x206e6f742072652d, 0x736574746c652061, 0x6e20616c72656164, + 0x792d7265736f6c76, 0x6564206072656164, 0x79603b2074686973, 0x2067756172640a20, 0x202020202020202f, + 0x2f2f206d616b6573, 0x206576657279206f, 0x6e65206f66207468, 0x6f73652063617365, 0x732061206861726d, + 0x6c657373206e6f2d, 0x6f70206166746572, 0x2074686520666972, 0x737420736574746c, 0x656d656e742e0a20, + 0x2020202020202073, 0x6574746c65526561, 0x647952656a656374, 0x6564286572726f72, 0x29207b0a20202020, + 0x2020202020202020, 0x6966202874686973, 0x2e72656164795365, 0x74746c6564207c7c, 0x20746869732e7374, + 0x617465203d3d3d20, 0x226c696e6b656422, 0x292072657475726e, 0x3b0a202020202020, 0x2020202020207468, + 0x69732e7265616479, 0x536574746c656420, 0x3d20747275653b0a, 0x2020202020202020, 0x2020202074686973, + 0x2e72656164794572, 0x726f72203d206572, 0x726f723b0a202020, 0x2020202020202020, 0x20746869732e7265, + 0x6a65637452656164, 0x79286572726f7229, 0x3b0a202020202020, 0x20207d0a0a202020, 0x202020202068616e, + 0x647368616b652829, 0x207b0a2020202020, 0x2020202020202074, 0x6869732e73746174, 0x65203d202268616e, + 0x647368616b696e67, 0x223b0a2020202020, 0x202020202020202f, 0x2f20416e20656d62, 0x6564646564206672, + 0x6f6e74656e642067, 0x6976657320697473, 0x2076696577206120, 0x7065722d6c61756e, 0x6368207365637265, + 0x7420617420746865, 0x207374617274206f, 0x662074686520646f, 0x63756d656e742028, 0x4144522d30323029, + 0x2e20497420776173, 0x2074616b656e0a20, 0x2020202020202020, 0x2020202f2f206f75, 0x74206f6620746865, + 0x2077696e646f7720, 0x7768656e20746869, 0x7320736372697074, 0x206c6f616465642c, 0x20736f2074686520, + 0x7061676520646f65, 0x73206e6f74206b65, 0x6570207265616469, 0x6e672069743b2074, 0x6865207379737465, + 0x6d2062726f777365, 0x7220686173206e6f, 0x6e652e0a20202020, 0x2020202020202020, 0x636f6e7374207365, + 0x63726574203d2076, 0x6965775365637265, 0x743b0a2020202020, 0x2020202020202063, 0x6f6e737420686561, + 0x646572203d205b43, 0x6f6d6d616e642e68, 0x616e647368616b65, 0x2c206e6174697665, 0x49734c6974746c65, + 0x456e6469616e2829, 0x203f2030203a2031, 0x5d3b0a2020202020, 0x2020202020202066, 0x6f7220286c657420, + 0x696e646578203d20, 0x303b20696e646578, 0x203c207365637265, 0x742e6c656e677468, 0x3b202b2b696e6465, + 0x7829206865616465, 0x722e707573682873, 0x65637265742e6368, 0x6172436f64654174, 0x28696e6465782920, + 0x262030783766293b, 0x0a20202020202020, 0x2020202020746869, 0x732e736f636b6574, 0x2e73656e64286e65, + 0x772055696e743841, 0x7272617928686561, 0x64657229293b0a20, 0x202020202020207d, 0x0a0a202020202020, + 0x20206f6e4d657373, 0x6167652862756666, 0x657229207b0a2020, 0x2020202020202020, 0x2020636f6e737420, + 0x76696577203d206e, 0x6577204461746156, 0x6965772862756666, 0x6572293b0a202020, 0x2020202020202020, + 0x2072657175697265, 0x4279746573287669, 0x65772c20302c2031, 0x2c20226d65737361, 0x6765206865616465, + 0x7222293b0a202020, 0x2020202020202020, 0x2073776974636820, 0x28766965772e6765, 0x7455696e74382830, + 0x2929207b0a202020, 0x2020202020202020, 0x206361736520436f, 0x6d6d616e642e6163, 0x6b3a0a2020202020, + 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x766965772c20302c, 0x20322c202261636b, + 0x6e6f776c65646765, 0x6d656e7422293b0a, 0x2020202020202020, 0x2020202020202020, 0x6966202874686973, + 0x2e7374617465203d, 0x3d3d202268616e64, 0x7368616b696e6722, 0x29207b0a20202020, 0x2020202020202020, + 0x2020202020202020, 0x746869732e6c6974, 0x746c65456e646961, 0x6e203d2076696577, 0x2e67657455696e74, + 0x38283129203d3d3d, 0x20303b0a20202020, 0x2020202020202020, 0x2020202020202020, 0x746869732e737461, + 0x7465203d20226c69, 0x6e6b6564223b0a20, 0x2020202020202020, 0x2020202020202020, 0x202020746869732e, + 0x7265616479536574, 0x746c6564203d2074, 0x7275653b0a202020, 0x2020202020202020, 0x2020202020202020, + 0x20746869732e7265, 0x736f6c7665526561, 0x647928293b0a2020, 0x2020202020202020, 0x2020202020207d0a, + 0x2020202020202020, 0x2020202020202020, 0x627265616b3b0a20, 0x2020202020202020, 0x2020206361736520, + 0x436f6d6d616e642e, 0x74657874436f6d6d, 0x616e643a0a202020, 0x2020202020202020, 0x2020202020746869, + 0x732e68616e646c65, 0x54657874436f6d6d, 0x616e642876696577, 0x293b0a2020202020, 0x2020202020202020, + 0x202020627265616b, 0x3b0a202020202020, 0x2020202020206361, 0x736520436f6d6d61, 0x6e642e63616c6c46, + 0x756e6374696f6e3a, 0x0a20202020202020, 0x2020202020202020, 0x20746869732e6361, 0x6c6c4a7346756e63, + 0x74696f6e28766965, 0x77293b0a20202020, 0x2020202020202020, 0x2020202062726561, 0x6b3b0a2020202020, + 0x2020202020202063, 0x61736520436f6d6d, 0x616e642e646f6d42, 0x617463683a0a2020, 0x2020202020202020, + 0x2020202020207472, 0x79207b0a20202020, 0x2020202020202020, 0x2020202020202020, 0x6966202876696577, + 0x2e627974654c656e, 0x677468203e203130, 0x3234202a20313032, 0x3429207468726f77, 0x206e65772052616e, + 0x67654572726f7228, 0x22444f4d20626174, 0x6368206578636565, 0x64732031204d6942, 0x22293b0a20202020, + 0x2020202020202020, 0x2020202020202020, 0x6966202821746869, 0x732e646f6d426174, 0x636848616e646c65, + 0x7229207468726f77, 0x206e657720457272, 0x6f722822444f4d20, 0x696e746572707265, 0x746572206973206e, + 0x6f7420696e737461, 0x6c6c656422293b0a, 0x2020202020202020, 0x2020202020202020, 0x2020202074686973, + 0x2e646f6d42617463, 0x6848616e646c6572, 0x286e65772055696e, 0x7438417272617928, 0x6275666665722929, + 0x3b0a202020202020, 0x2020202020202020, 0x20207d2063617463, 0x6820286572726f72, 0x29207b0a20202020, + 0x2020202020202020, 0x2020202020202020, 0x636f6e7374206964, 0x203d20766965772e, 0x627974654c656e67, + 0x7468203e3d203620, 0x3f20766965772e67, 0x657455696e743332, 0x28322c2074727565, 0x29203a20303b0a20, + 0x2020202020202020, 0x2020202020202020, 0x202020746869732e, 0x63707046756e6374, 0x696f6e2822776644, + 0x6f6d2e72656a6563, 0x7465642229286964, 0x2c20537472696e67, 0x286572726f722e6d, 0x657373616765207c, + 0x7c206572726f7229, 0x2e736c6963652830, 0x2c20343039362929, 0x2e63617463682828, 0x29203d3e207b7d29, + 0x3b0a202020202020, 0x2020202020202020, 0x20207d0a20202020, 0x2020202020202020, 0x2020202062726561, + 0x6b3b0a2020202020, 0x2020202020202063, 0x61736520436f6d6d, 0x616e642e66756e63, 0x74696f6e52657475, + 0x726e3a0a20202020, 0x2020202020202020, 0x2020202074686973, 0x2e68616e646c6546, 0x756e6374696f6e52, + 0x657475726e287669, 0x6577293b0a202020, 0x2020202020202020, 0x2020202020627265, 0x616b3b0a20202020, + 0x2020202020202020, 0x64656661756c743a, 0x0a20202020202020, 0x2020202020202020, 0x207468726f77206e, + 0x6577204572726f72, 0x2860556e73757070, 0x6f72746564205765, 0x6246726f6e742063, 0x6f6d6d616e642024, + 0x7b766965772e6765, 0x7455696e74382830, 0x297d60293b0a2020, 0x2020202020202020, 0x20207d0a20202020, + 0x202020207d0a0a20, 0x2020202020202068, 0x616e646c65546578, 0x74436f6d6d616e64, 0x287669657729207b, + 0x0a20202020202020, 0x2020202020726571, 0x7569726542797465, 0x7328766965772c20, 0x302c20342c202274, + 0x65787420636f6d6d, 0x616e642068656164, 0x657222293b0a2020, 0x2020202020202020, 0x2020636f6e737420, + 0x6c656e677468203d, 0x20766965772e6765, 0x7455696e74313628, 0x32293b0a20202020, 0x2020202020202020, + 0x7265717569726542, 0x7974657328766965, 0x772c20342c206c65, 0x6e6774682c202274, 0x65787420636f6d6d, + 0x616e64207061796c, 0x6f616422293b0a20, 0x2020202020202020, 0x202020636f6e7374, 0x2074657874203d20, + 0x6e65772054657874, 0x4465636f64657228, 0x227574662d382229, 0x2e6465636f646528, 0x6e65772055696e74, + 0x3841727261792876, 0x6965772e62756666, 0x65722c2076696577, 0x2e627974654f6666, 0x736574202b20342c, + 0x206c656e67746829, 0x293b0a2020202020, 0x2020202020202073, 0x7769746368202876, 0x6965772e67657455, + 0x696e743828312929, 0x207b0a2020202020, 0x2020202020202063, 0x6173652054657874, 0x436f6d6d616e642e, + 0x64656275674c6f67, 0x3a0a202020202020, 0x2020202020202020, 0x2020636f6e736f6c, 0x652e6c6f67287465, + 0x7874293b0a202020, 0x2020202020202020, 0x2020202020627265, 0x616b3b0a20202020, 0x2020202020202020, + 0x6361736520546578, 0x74436f6d6d616e64, 0x2e696e6a65637453, 0x63726970743a207b, 0x0a20202020202020, + 0x2020202020202020, 0x20636f6e73742073, 0x6372697074203d20, 0x646f63756d656e74, 0x2e63726561746545, + 0x6c656d656e742822, 0x7363726970742229, 0x3b0a202020202020, 0x2020202020202020, 0x2020736372697074, + 0x2e74657874203d20, 0x746578743b0a2020, 0x2020202020202020, 0x2020202020202864, 0x6f63756d656e742e, + 0x626f6479203f3f20, 0x646f63756d656e74, 0x2e68656164203f3f, 0x20646f63756d656e, 0x742e646f63756d65, + 0x6e74456c656d656e, 0x74292e617070656e, 0x644368696c642873, 0x6372697074293b0a, 0x2020202020202020, + 0x2020202020202020, 0x627265616b3b0a20, 0x2020202020202020, 0x2020207d0a202020, 0x2020202020202020, + 0x2064656661756c74, 0x3a0a202020202020, 0x2020202020202020, 0x20207468726f7720, 0x6e6577204572726f, + 0x722860556e737570, 0x706f727465642057, 0x656246726f6e7420, 0x7465787420636f6d, 0x6d616e6420247b76, + 0x6965772e67657455, 0x696e74382831297d, 0x60293b0a20202020, 0x2020202020202020, 0x7d0a202020202020, + 0x20207d0a0a202020, 0x202020202063616c, 0x6c4a7346756e6374, 0x696f6e286d657373, 0x61676529207b0a20, + 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x6d6573736167652c, 0x20302c20382c2022, + 0x66756e6374696f6e, 0x2063616c6c206865, 0x6164657222293b0a, 0x2020202020202020, 0x20202020636f6e73, + 0x7420636f756e7420, 0x3d206d6573736167, 0x652e67657455696e, 0x74382831293b0a20, 0x2020202020202020, + 0x202020636f6e7374, 0x2063616c6c496420, 0x3d206d6573736167, 0x652e67657455696e, 0x74313628322c2074, + 0x6869732e6c697474, 0x6c65456e6469616e, 0x293b0a2020202020, 0x2020202020202069, 0x662028636f756e74, + 0x203d3d3d2030290a, 0x2020202020202020, 0x2020202020202020, 0x7468726f77206e65, 0x77204572726f7228, + 0x2246756e6374696f, 0x6e2063616c6c2068, 0x6173206e6f206675, 0x6e6374696f6e206e, 0x616d6522293b0a20, + 0x2020202020202020, 0x202020636f6e7374, 0x207061796c6f6164, 0x53697a65203d206d, 0x6573736167652e67, + 0x657455696e743332, 0x28342c2074686973, 0x2e6c6974746c6545, 0x6e6469616e293b0a, 0x2020202020202020, + 0x2020202072657175, 0x6972654279746573, 0x286d657373616765, 0x2c20382c20706179, 0x6c6f616453697a65, + 0x2c202266756e6374, 0x696f6e2063616c6c, 0x207061796c6f6164, 0x22293b0a20202020, 0x2020202020202020, + 0x636f6e7374207061, 0x796c6f6164203d20, 0x6e65772044617461, 0x56696577286d6573, 0x736167652e627566, + 0x6665722c206d6573, 0x736167652e627974, 0x654f666673657420, 0x2b20382c20706179, 0x6c6f616453697a65, + 0x293b0a2020202020, 0x2020202020202063, 0x6f6e7374205b6e61, 0x6d65732c206e616d, 0x6542797465735d20, + 0x3d20746869732e64, 0x65636f6465506172, 0x616d657465727328, 0x312c207061796c6f, 0x6164293b0a202020, + 0x2020202020202020, 0x20636f6e7374205b, 0x706172616d657465, 0x72732c2070617261, 0x6d65746572427974, + 0x65735d203d207468, 0x69732e6465636f64, 0x65506172616d6574, 0x65727328636f756e, 0x74202d20312c2070, + 0x61796c6f61642c20, 0x6e616d6542797465, 0x73293b0a20202020, 0x2020202020202020, 0x696620286e616d65, + 0x4279746573202b20, 0x706172616d657465, 0x7242797465732021, 0x3d3d207061796c6f, 0x616453697a65290a, + 0x2020202020202020, 0x2020202020202020, 0x7468726f77206e65, 0x77204572726f7228, 0x2246756e6374696f, + 0x6e2063616c6c2063, 0x6f6e7461696e7320, 0x747261696c696e67, 0x207061796c6f6164, 0x206461746122293b, + 0x0a20202020202020, 0x2020202020746869, 0x732e70726f62653f, 0x2e6a7343616c6c28, 0x6e616d65735b305d, + 0x293b0a2020202020, 0x202020202020206c, 0x6574206578656375, 0x74696f6e3b0a2020, 0x2020202020202020, + 0x2020747279207b0a, 0x2020202020202020, 0x2020202020202020, 0x657865637574696f, 0x6e203d2074686973, + 0x2e65786563757465, 0x46756e6374696f6e, 0x286e616d65735b30, 0x5d2c20706172616d, 0x6574657273293b0a, + 0x2020202020202020, 0x202020207d206361, 0x7463682028657272, 0x6f7229207b0a2020, 0x2020202020202020, + 0x2020202020207468, 0x69732e7265706f72, 0x7443616c6c466169, 0x6c7572652863616c, 0x6c49642c20657272, + 0x6f72293b0a202020, 0x2020202020202020, 0x2020202020726574, 0x75726e3b0a202020, 0x2020202020202020, + 0x207d0a2020202020, 0x202020202020202f, 0x2f2063616c6c4964, 0x2030206d65616e73, 0x207468652063616c, + 0x6c6572206973206e, 0x6f74207761697469, 0x6e6720666f722061, 0x6e797468696e672c, 0x20736f2074686572, + 0x65206973206e6f74, 0x68696e6720746f20, 0x73656e6420626163, 0x6b2e0a2020202020, 0x2020202020202069, + 0x66202863616c6c49, 0x6420213d3d203029, 0x0a20202020202020, 0x2020202020202020, 0x2050726f6d697365, + 0x2e7265736f6c7665, 0x2865786563757469, 0x6f6e292e7468656e, 0x280a202020202020, 0x2020202020202020, + 0x2020202020207661, 0x6c7565203d3e2074, 0x6869732e7265706f, 0x727443616c6c5375, 0x6363657373286361, + 0x6c6c49642c207661, 0x6c7565292c0a2020, 0x2020202020202020, 0x2020202020202020, 0x20206572726f7220, + 0x3d3e20746869732e, 0x73656e6446756e63, 0x74696f6e4572726f, 0x722863616c6c4964, 0x2c206572726f7229, + 0x293b0a2020202020, 0x2020207d0a0a2020, 0x2020202020207265, 0x706f727443616c6c, 0x4661696c75726528, + 0x63616c6c49642c20, 0x6572726f7229207b, 0x0a20202020202020, 0x2020202020696620, 0x2863616c6c496420, + 0x3d3d3d2030290a20, 0x2020202020202020, 0x2020202020202063, 0x6f6e736f6c652e65, 0x72726f7228225b57, + 0x656246726f6e7420, 0x4a61766153637269, 0x70742063616c6c5d, 0x222c206572726f72, 0x293b0a2020202020, + 0x2020202020202065, 0x6c73650a20202020, 0x2020202020202020, 0x2020202074686973, 0x2e73656e6446756e, + 0x6374696f6e457272, 0x6f722863616c6c49, 0x642c206572726f72, 0x293b0a2020202020, 0x2020207d0a0a2020, + 0x2020202020207265, 0x706f727443616c6c, 0x5375636365737328, 0x63616c6c49642c20, 0x76616c756529207b, + 0x0a20202020202020, 0x2020202020747279, 0x207b0a2020202020, 0x2020202020202020, 0x202020746869732e, + 0x73656e6446756e63, 0x74696f6e52657475, 0x726e2863616c6c49, 0x642c2076616c7565, 0x293b0a2020202020, + 0x202020202020207d, 0x2063617463682028, 0x6572726f7229207b, 0x0a20202020202020, 0x2020202020202020, + 0x20746869732e7365, 0x6e6446756e637469, 0x6f6e4572726f7228, 0x63616c6c49642c20, 0x6572726f72293b0a, + 0x2020202020202020, 0x202020207d0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x2065786563757465, + 0x46756e6374696f6e, 0x286e616d652c2061, 0x72677329207b0a20, 0x2020202020202020, 0x2020202f2f205468, + 0x652065786368616e, 0x6765206f66207468, 0x6520726561642062, 0x696e64696e672062, 0x656c6f6e67732074, + 0x6f20746865206272, 0x6964676520746861, 0x7420726563656976, 0x6564207468652063, 0x616c6c2c206e6f74, + 0x20746f206120676c, 0x6f62616c2073696e, 0x676c65746f6e2e0a, 0x2020202020202020, 0x2020202069662028, + 0x6e616d65203d3d3d, 0x2022776642696e64, 0x2e65786368616e67, 0x6522290a20202020, 0x2020202020202020, + 0x2020202072657475, 0x726e20746869732e, 0x62696e64436c6965, 0x6e74282e2e2e6172, 0x6773293b0a202020, + 0x2020202020202020, 0x20636f6e73742070, 0x617468203d206e61, 0x6d652e73706c6974, 0x28222e22293b0a20, + 0x2020202020202020, 0x202020636f6e7374, 0x206d656d62657220, 0x3d20706174682e70, 0x6f7028293b0a2020, + 0x2020202020202020, 0x20206c657420636f, 0x6e74657874203d20, 0x676c6f62616c3b0a, 0x2020202020202020, + 0x20202020666f7220, 0x28636f6e73742063, 0x6f6d706f6e656e74, 0x206f662070617468, 0x29207b0a20202020, + 0x2020202020202020, 0x2020202069662028, 0x636f6e7465787420, 0x3d3d206e756c6c20, 0x7c7c202128636f6d, + 0x706f6e656e742069, 0x6e20636f6e746578, 0x7429290a20202020, 0x2020202020202020, 0x2020202020202020, + 0x7468726f77206272, 0x696467654572726f, 0x7228427269646765, 0x436f64652e6e6f74, 0x466f756e642c2060, + 0x4a61766153637269, 0x7074206e616d6573, 0x706163652027247b, 0x636f6d706f6e656e, 0x747d272077617320, + 0x6e6f7420666f756e, 0x64207768696c6520, 0x7265736f6c76696e, 0x672027247b6e616d, 0x657d2760293b0a20, + 0x2020202020202020, 0x2020202020202063, 0x6f6e74657874203d, 0x20636f6e74657874, 0x5b636f6d706f6e65, + 0x6e745d3b0a202020, 0x2020202020202020, 0x207d0a2020202020, 0x2020202020202069, 0x662028636f6e7465, + 0x7874203d3d206e75, 0x6c6c207c7c207479, 0x70656f6620636f6e, 0x746578745b6d656d, 0x6265725d20213d3d, + 0x202266756e637469, 0x6f6e22290a202020, 0x2020202020202020, 0x2020202020746872, 0x6f77206272696467, + 0x654572726f722842, 0x7269646765436f64, 0x652e6e6f74466f75, 0x6e642c20604a6176, 0x6153637269707420, + 0x66756e6374696f6e, 0x2027247b6e616d65, 0x7d2720776173206e, 0x6f7420666f756e64, 0x60293b0a20202020, + 0x2020202020202020, 0x72657475726e2063, 0x6f6e746578745b6d, 0x656d6265725d282e, 0x2e2e61726773293b, + 0x0a20202020202020, 0x207d0a0a20202020, 0x2020202068616e64, 0x6c6546756e637469, 0x6f6e52657475726e, + 0x286d657373616765, 0x29207b0a20202020, 0x2020202020202020, 0x7265717569726542, 0x79746573286d6573, + 0x736167652c20302c, 0x20382c202266756e, 0x6374696f6e207265, 0x7475726e20686561, 0x64657222293b0a20, + 0x2020202020202020, 0x202020636f6e7374, 0x2063616c6c496420, 0x3d206d6573736167, 0x652e67657455696e, + 0x74313628322c2074, 0x6869732e6c697474, 0x6c65456e6469616e, 0x293b0a2020202020, 0x2020202020202063, + 0x6f6e73742070656e, 0x64696e67203d2074, 0x6869732e70656e64, 0x696e6743616c6c73, 0x2e6765742863616c, + 0x6c4964293b0a2020, 0x2020202020202020, 0x2020696620282170, 0x656e64696e67290a, 0x2020202020202020, + 0x2020202020202020, 0x7468726f77206e65, 0x77204572726f7228, 0x6046756e6374696f, 0x6e2072657475726e, + 0x2068617320756e6b, 0x6e6f776e2063616c, 0x6c20696420247b63, 0x616c6c49647d6029, 0x3b0a202020202020, + 0x2020202020207468, 0x69732e70656e6469, 0x6e6743616c6c732e, 0x64656c6574652863, 0x616c6c4964293b0a, + 0x0a20202020202020, 0x20202020202f2f20, 0x41206465636f6465, 0x206661696c757265, 0x2068617320746f20, + 0x736574746c652074, 0x68652070656e6469, 0x6e672063616c6c20, 0x7261746865722074, 0x68616e2065736361, + 0x706520696e746f20, 0x74686520736f636b, 0x65742068616e646c, 0x65722c0a20202020, 0x2020202020202020, + 0x2f2f206f74686572, 0x7769736520746865, 0x2063616c6c657227, 0x732070726f6d6973, 0x6520776f756c6420, + 0x68616e6720666f72, 0x657665722e0a2020, 0x2020202020202020, 0x2020747279207b0a, 0x2020202020202020, + 0x2020202020202020, 0x746869732e736574, 0x746c655265747572, 0x6e2870656e64696e, 0x672c206d65737361, + 0x6765293b0a202020, 0x2020202020202020, 0x207d206361746368, 0x20286572726f7229, 0x207b0a2020202020, + 0x2020202020202020, 0x2020206966202865, 0x72726f7220696e73, 0x74616e63656f6620, 0x4572726f72202626, + 0x206572726f722e63, 0x6f6465203d3d3d20, 0x756e646566696e65, 0x6429207b0a202020, 0x2020202020202020, + 0x2020202020202020, 0x204f626a6563742e, 0x646566696e655072, 0x6f70657274792865, 0x72726f722c202263, + 0x6f6465222c207b76, 0x616c75653a204272, 0x69646765436f6465, 0x2e6d616c666f726d, 0x65642c20656e756d, + 0x657261626c653a20, 0x747275652c207772, 0x697461626c653a20, 0x66616c73652c2063, 0x6f6e666967757261, + 0x626c653a2066616c, 0x73657d293b0a2020, 0x2020202020202020, 0x2020202020202020, 0x2020627269646765, + 0x4572726f72732e61, 0x6464286572726f72, 0x293b0a2020202020, 0x2020202020202020, 0x2020207d0a202020, + 0x2020202020202020, 0x202020202070656e, 0x64696e672e72656a, 0x656374286572726f, 0x72293b0a20202020, + 0x2020202020202020, 0x7d0a202020202020, 0x20207d0a0a202020, 0x20202020202f2f2f, 0x20536574746c6573, + 0x20612070656e6469, 0x6e672063616c6c20, 0x7769746820746865, 0x2076616c75652c20, 0x7468652065786365, + 0x7074696f6e206f72, 0x2074686520616273, 0x656e6365206f6620, 0x76616c7565207468, 0x6174206120726574, + 0x75726e206d657373, 0x6167652063617272, 0x6965732e0a202020, 0x2020202020736574, 0x746c655265747572, + 0x6e2870656e64696e, 0x672c206d65737361, 0x676529207b0a2020, 0x2020202020202020, 0x2020636f6e737420, + 0x636f756e74203d20, 0x6d6573736167652e, 0x67657455696e7438, 0x2831293b0a202020, 0x2020202020202020, + 0x20636f6e73742070, 0x61796c6f61645369, 0x7a65203d206d6573, 0x736167652e676574, 0x55696e7433322834, + 0x2c20746869732e6c, 0x6974746c65456e64, 0x69616e293b0a2020, 0x2020202020202020, 0x2020726571756972, + 0x654279746573286d, 0x6573736167652c20, 0x382c207061796c6f, 0x616453697a652c20, 0x2266756e6374696f, + 0x6e2072657475726e, 0x207061796c6f6164, 0x22293b0a20202020, 0x2020202020202020, 0x636f6e7374207061, + 0x796c6f6164203d20, 0x6e65772044617461, 0x56696577286d6573, 0x736167652e627566, 0x6665722c206d6573, + 0x736167652e627974, 0x654f666673657420, 0x2b20382c20706179, 0x6c6f616453697a65, 0x293b0a0a20202020, + 0x2020202020202020, 0x6966202874686973, 0x2e63617272696573, 0x457863657074696f, 0x6e28636f756e742c, + 0x207061796c6f6164, 0x53697a652c207061, 0x796c6f6164292920, 0x7b0a202020202020, 0x2020202020202020, + 0x202070656e64696e, 0x672e72656a656374, 0x28746869732e7369, 0x6e676c6556616c75, 0x65287061796c6f61, + 0x642c207061796c6f, 0x616453697a652c20, 0x2245786365707469, 0x6f6e2229293b0a20, 0x2020202020202020, + 0x2020202020202072, 0x657475726e3b0a20, 0x2020202020202020, 0x2020207d0a202020, 0x2020202020202020, + 0x2069662028636f75, 0x6e74203d3d3d2030, 0x29207b0a20202020, 0x2020202020202020, 0x2020202069662028, + 0x7061796c6f616453, 0x697a6520213d3d20, 0x30290a2020202020, 0x2020202020202020, 0x2020202020202074, + 0x68726f77206e6577, 0x204572726f722822, 0x566f696420726574, 0x75726e20636f6e74, 0x61696e7320706179, + 0x6c6f616420646174, 0x6122293b0a202020, 0x2020202020202020, 0x202020202070656e, 0x64696e672e726573, + 0x6f6c766528756e64, 0x6566696e6564293b, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e3b, + 0x0a20202020202020, 0x20202020207d0a20, 0x2020202020202020, 0x2020206966202863, 0x6f756e7420213d3d, + 0x2031290a20202020, 0x2020202020202020, 0x202020207468726f, 0x77206e6577204572, 0x726f72282246756e, + 0x6374696f6e207265, 0x7475726e206d7573, 0x7420636f6e746169, 0x6e207a65726f206f, 0x72206f6e65207661, + 0x6c756522293b0a20, 0x2020202020202020, 0x20202070656e6469, 0x6e672e7265736f6c, 0x766528746869732e, + 0x73696e676c655661, 0x6c7565287061796c, 0x6f61642c20706179, 0x6c6f616453697a65, 0x2c202246756e6374, + 0x696f6e2229293b0a, 0x2020202020202020, 0x7d0a0a2020202020, 0x2020206361727269, 0x6573457863657074, + 0x696f6e28636f756e, 0x742c207061796c6f, 0x616453697a652c20, 0x7061796c6f616429, 0x207b0a2020202020, + 0x2020202020202069, 0x662028636f756e74, 0x20213d3d2031207c, 0x7c207061796c6f61, 0x6453697a65203d3d, + 0x3d20302920726574, 0x75726e2066616c73, 0x653b0a2020202020, 0x2020202020202072, 0x657475726e207061, + 0x796c6f61642e6765, 0x7455696e74382830, 0x29203d3d3d205061, 0x72616d547970652e, 0x657863657074696f, + 0x6e3b0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, 0x2f204465636f6465, 0x732065786163746c, + 0x79206f6e65207661, 0x6c756520616e6420, 0x72656a6563747320, 0x616e792062797465, 0x73206c656674206f, + 0x7665722061667465, 0x722069742e0a2020, 0x2020202020207369, 0x6e676c6556616c75, 0x65287061796c6f61, + 0x642c207061796c6f, 0x616453697a652c20, 0x7768617429207b0a, 0x2020202020202020, 0x20202020636f6e73, + 0x74205b76616c7565, 0x732c20636f6e7375, 0x6d65645d203d2074, 0x6869732e6465636f, 0x6465506172616d65, + 0x7465727328312c20, 0x7061796c6f616429, 0x3b0a202020202020, 0x2020202020206966, 0x2028636f6e73756d, + 0x656420213d3d2070, 0x61796c6f61645369, 0x7a65290a20202020, 0x2020202020202020, 0x202020207468726f, + 0x77206e6577204572, 0x726f722860247b77, 0x6861747d20726574, 0x75726e20636f6e74, 0x61696e7320747261, + 0x696c696e67207061, 0x796c6f6164206461, 0x746160293b0a2020, 0x2020202020202020, 0x202072657475726e, + 0x2076616c7565735b, 0x305d3b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f204465636f64, + 0x65732060636f756e, 0x746020636f6e7365, 0x6375746976652076, 0x616c7565733b2072, 0x657475726e732074, + 0x68656d2077697468, 0x2074686520627974, 0x657320636f6e7375, 0x6d65642c20616e64, 0x207265636f726473, + 0x2074686569722073, 0x686170657320696e, 0x2060736861706573, 0x60207768656e2067, 0x6976656e2e0a2020, + 0x2020202020206465, 0x636f646550617261, 0x6d65746572732863, 0x6f756e742c207669, 0x65772c206f666673, + 0x6574203d20302c20, 0x736861706573203d, 0x206e756c6c29207b, 0x0a20202020202020, 0x2020202020636f6e, + 0x73742076616c7565, 0x73203d205b5d3b0a, 0x2020202020202020, 0x202020206c657420, 0x637572736f72203d, + 0x206f66667365743b, 0x0a20202020202020, 0x2020202020666f72, 0x20286c657420696e, 0x646578203d20303b, + 0x20696e646578203c, 0x20636f756e743b20, 0x2b2b696e64657829, 0x207b0a2020202020, 0x2020202020202020, + 0x2020207265717569, 0x7265427974657328, 0x766965772c206375, 0x72736f722c20312c, 0x2022706172616d65, + 0x7465722074797065, 0x22293b0a20202020, 0x2020202020202020, 0x20202020636f6e73, 0x74207b76616c7565, + 0x2c2062797465732c, 0x2073686170657d20, 0x3d20746869732e64, 0x65636f646556616c, 0x756528766965772e, + 0x67657455696e7438, 0x28637572736f7229, 0x2c20766965772c20, 0x637572736f72293b, 0x0a20202020202020, + 0x2020202020202020, 0x2076616c7565732e, 0x707573682876616c, 0x7565293b0a202020, 0x2020202020202020, + 0x2020202020696620, 0x2873686170657329, 0x0a20202020202020, 0x2020202020202020, 0x2020202020736861, + 0x7065732e70757368, 0x287368617065293b, 0x0a20202020202020, 0x2020202020202020, 0x20637572736f7220, + 0x2b3d206279746573, 0x3b0a202020202020, 0x2020202020207d0a, 0x2020202020202020, 0x2020202072657475, + 0x726e205b76616c75, 0x65732c2063757273, 0x6f72202d206f6666, 0x7365745d3b0a2020, 0x2020202020207d0a, + 0x0a20202020202020, 0x202f2f2f20446563, 0x6f64657320746865, 0x2073696e676c6520, 0x76616c7565207374, + 0x617274696e672061, 0x7420276f66667365, 0x74272c2072657475, 0x726e696e67206974, 0x20616c6f6e677369, + 0x6465207468652062, 0x79746520636f756e, 0x7420697420636f6e, 0x73756d65642e0a20, 0x2020202020202064, + 0x65636f646556616c, 0x756528747970652c, 0x20766965772c206f, 0x666673657429207b, 0x0a20202020202020, + 0x2020202020636f6e, 0x7374206465636f64, 0x6572203d2076616c, 0x75654465636f6465, 0x72732e6765742874, + 0x797065293b0a2020, 0x2020202020202020, 0x2020696620282164, 0x65636f646572290a, 0x2020202020202020, + 0x2020202020202020, 0x7468726f77206e65, 0x7720547970654572, 0x726f722860556e73, 0x7570706f72746564, + 0x20706172616d6574, 0x6572207479706520, 0x247b747970657d60, 0x293b0a2020202020, 0x2020202020202063, + 0x6f6e737420646563, 0x6f646564203d2064, 0x65636f6465722874, 0x6869732c20747970, 0x652c20766965772c, + 0x206f666673657429, 0x3b0a202020202020, 0x2020202020206465, 0x636f6465642e7368, 0x617065203f3f3d20, + 0x7769726553686170, 0x652874797065293b, 0x0a20202020202020, 0x2020202020726574, 0x75726e206465636f, + 0x6465643b0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x6465636f64654e75, 0x6d62657228766965, + 0x772c206f66667365, 0x7429207b0a202020, 0x2020202020202020, 0x2072657175697265, 0x4279746573287669, + 0x65772c206f666673, 0x65742c20392c2022, 0x6e756d6265722229, 0x3b0a202020202020, 0x2020202020207265, + 0x7475726e207b7661, 0x6c75653a20766965, 0x772e676574466c6f, 0x61743634286f6666, 0x736574202b20312c, + 0x20746869732e6c69, 0x74746c65456e6469, 0x616e292c20627974, 0x65733a20397d3b0a, 0x2020202020202020, + 0x7d0a0a2020202020, 0x2020202f2f2f2044, 0x65636f6465732061, 0x20736d616c6c5374, 0x72696e672c207374, + 0x72696e67206f7220, 0x6c6f6e6753747269, 0x6e672e0a20202020, 0x202020206465636f, 0x6465537472696e67, + 0x28747970652c2076, 0x6965772c206f6666, 0x73657429207b0a20, 0x2020202020202020, 0x202020636f6e7374, + 0x2073697a65427974, 0x6573203d20747970, 0x65203d3d3d205061, 0x72616d547970652e, 0x736d616c6c537472, + 0x696e67203f203120, 0x3a2074797065203d, 0x3d3d20506172616d, 0x547970652e6c6f6e, 0x67537472696e6720, + 0x3f2034203a20323b, 0x0a20202020202020, 0x2020202020726571, 0x7569726542797465, 0x7328766965772c20, + 0x6f6666736574202b, 0x20312c2073697a65, 0x42797465732c2022, 0x737472696e67206c, 0x656e67746822293b, + 0x0a20202020202020, 0x2020202020636f6e, 0x7374206c656e6774, 0x68203d2073697a65, 0x4279746573203d3d, + 0x3d2031203f207669, 0x65772e6765745569, 0x6e7438286f666673, 0x6574202b2031290a, 0x2020202020202020, + 0x2020202020202020, 0x3a2073697a654279, 0x746573203d3d3d20, 0x32203f2076696577, 0x2e67657455696e74, + 0x3136286f66667365, 0x74202b20312c2074, 0x6869732e6c697474, 0x6c65456e6469616e, 0x29203a2076696577, + 0x2e67657455696e74, 0x3332286f66667365, 0x74202b20312c2074, 0x6869732e6c697474, 0x6c65456e6469616e, + 0x293b0a2020202020, 0x2020202020202063, 0x6f6e737420706179, 0x6c6f6164203d206f, 0x6666736574202b20, + 0x31202b2073697a65, 0x42797465733b0a20, 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, + 0x766965772c207061, 0x796c6f61642c206c, 0x656e6774682c2022, 0x737472696e672070, 0x61796c6f61642229, + 0x3b0a202020202020, 0x202020202020636f, 0x6e73742062797465, 0x73203d206e657720, 0x55696e7438417272, + 0x617928766965772e, 0x6275666665722c20, 0x766965772e627974, 0x654f666673657420, 0x2b207061796c6f61, + 0x642c206c656e6774, 0x68293b0a20202020, 0x2020202020202020, 0x72657475726e207b, 0x76616c75653a206e, + 0x6577205465787444, 0x65636f6465722822, 0x7574662d3822292e, 0x6465636f64652862, 0x79746573292c2062, + 0x797465733a203120, 0x2b2073697a654279, 0x746573202b206c65, 0x6e6774687d3b0a20, 0x202020202020207d, + 0x0a0a202020202020, 0x20202f2f2f20416e, 0x2065786365707469, 0x6f6e206973206120, 0x312d627974652063, + 0x6f64652073697a65, 0x2c2074686520636f, 0x64652c2061203136, 0x2d626974206d6573, 0x736167652073697a, + 0x6520616e64207468, 0x65206d6573736167, 0x652e204974206465, 0x636f64657320746f, 0x20616e204572726f, + 0x7220776974680a20, 0x202020202020202f, 0x2f2f2060636f6465, 0x602c207768696368, 0x206120736574746c, + 0x65642063616c6c20, 0x72656a6563747320, 0x776974682e0a2020, 0x2020202020206465, 0x636f646545786365, + 0x7074696f6e287669, 0x65772c206f666673, 0x657429207b0a2020, 0x2020202020202020, 0x2020726571756972, + 0x6542797465732876, 0x6965772c206f6666, 0x736574202b20312c, 0x20312c2022657863, 0x657074696f6e2063, + 0x6f64652073697a65, 0x22293b0a20202020, 0x2020202020202020, 0x636f6e737420636f, 0x646553697a65203d, + 0x20766965772e6765, 0x7455696e7438286f, 0x6666736574202b20, 0x31293b0a20202020, 0x2020202020202020, + 0x7265717569726542, 0x7974657328766965, 0x772c206f66667365, 0x74202b20322c2063, 0x6f646553697a6520, + 0x2b20322c20226578, 0x63657074696f6e20, 0x636f646522293b0a, 0x2020202020202020, 0x20202020636f6e73, + 0x7420636f6465203d, 0x206e657720546578, 0x744465636f646572, 0x28227574662d3822, 0x292e6465636f6465, + 0x286e65772055696e, 0x7438417272617928, 0x766965772e627566, 0x6665722c20766965, 0x772e627974654f66, + 0x66736574202b206f, 0x6666736574202b20, 0x322c20636f646553, 0x697a6529293b0a20, 0x2020202020202020, + 0x202020636f6e7374, 0x206d657373616765, 0x53697a65203d2076, 0x6965772e67657455, 0x696e743136286f66, + 0x66736574202b2032, 0x202b20636f646553, 0x697a652c20746869, 0x732e6c6974746c65, 0x456e6469616e293b, + 0x0a20202020202020, 0x2020202020636f6e, 0x7374207061796c6f, 0x6164203d206f6666, 0x736574202b203420, + 0x2b20636f64655369, 0x7a653b0a20202020, 0x2020202020202020, 0x7265717569726542, 0x7974657328766965, + 0x772c207061796c6f, 0x61642c206d657373, 0x61676553697a652c, 0x2022657863657074, 0x696f6e206d657373, + 0x61676522293b0a20, 0x2020202020202020, 0x202020636f6e7374, 0x206d657373616765, 0x203d206e65772054, + 0x6578744465636f64, 0x657228227574662d, 0x3822292e6465636f, 0x6465286e65772055, 0x696e743841727261, + 0x7928766965772e62, 0x75666665722c2076, 0x6965772e62797465, 0x4f6666736574202b, 0x207061796c6f6164, + 0x2c206d6573736167, 0x6553697a6529293b, 0x0a20202020202020, 0x2020202020726574, 0x75726e207b76616c, + 0x75653a2062726964, 0x67654572726f7228, 0x76616c6964436f64, 0x652e746573742863, 0x6f646529203f2063, + 0x6f6465203a204272, 0x69646765436f6465, 0x2e67656e65726963, 0x2c206d6573736167, 0x65292c2062797465, + 0x733a2034202b2063, 0x6f646553697a6520, 0x2b206d6573736167, 0x6553697a657d3b0a, 0x2020202020202020, + 0x7d0a0a2020202020, 0x2020206465636f64, 0x655475706c652876, 0x6965772c206f6666, 0x73657429207b0a20, + 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x766965772c206f66, 0x667365742c20322c, + 0x20227475706c6520, 0x6865616465722229, 0x3b0a202020202020, 0x2020202020202f2f, 0x20496e7369646520, + 0x61206c6973742065, 0x6c656d656e742074, 0x6865206e65737469, 0x6e6720697320636f, 0x756e746564207768, + 0x696c652064657363, 0x656e64696e672c20, 0x736f207468617420, 0x61206d6573736167, 0x65206f662074686f, + 0x7573616e6473206f, 0x66206e6573746564, 0x207475706c65730a, 0x2020202020202020, 0x202020202f2f2069, + 0x7320726566757365, 0x6420617420746865, 0x206c696d69742061, 0x6e64206e65766572, 0x2065786861757374, + 0x7320746865207374, 0x61636b2e0a202020, 0x2020202020202020, 0x20636f6e73742063, 0x6f756e746564203d, + 0x20746869732e6c69, 0x7374456c656d656e, 0x7444657074682021, 0x3d3d20756e646566, 0x696e65643b0a2020, + 0x2020202020202020, 0x202069662028636f, 0x756e746564202626, 0x20746869732e6c69, 0x7374456c656d656e, + 0x744465707468203e, 0x3d206d61784c6973, 0x745475706c654465, 0x707468290a202020, 0x2020202020202020, + 0x2020202020746872, 0x6f77206e65772054, 0x7970654572726f72, 0x286057656246726f, 0x6e74206c69737420, + 0x656c656d656e7473, 0x206e657374207475, 0x706c657320617420, 0x6d6f737420247b6d, 0x61784c6973745475, + 0x706c654465707468, 0x7d20646565706029, 0x3b0a202020202020, 0x2020202020206966, 0x2028636f756e7465, + 0x64290a2020202020, 0x2020202020202020, 0x2020202b2b746869, 0x732e6c697374456c, 0x656d656e74446570, + 0x74683b0a20202020, 0x2020202020202020, 0x747279207b0a2020, 0x2020202020202020, 0x202020202020636f, + 0x6e73742073686170, 0x6573203d205b5d3b, 0x0a20202020202020, 0x2020202020202020, 0x20636f6e7374205b, + 0x7475706c652c2063, 0x6f6e73756d65645d, 0x203d20746869732e, 0x6465636f64655061, 0x72616d6574657273, + 0x28766965772e6765, 0x7455696e7438286f, 0x6666736574202b20, 0x31292c2076696577, 0x2c206f6666736574, + 0x202b20322c207368, 0x61706573293b0a20, 0x2020202020202020, 0x2020202020202072, 0x657475726e207b76, + 0x616c75653a207475, 0x706c652c20627974, 0x65733a2032202b20, 0x636f6e73756d6564, 0x2c2073686170653a, + 0x206028247b736861, 0x7065732e6a6f696e, 0x28222c22297d2960, 0x7d3b0a2020202020, 0x202020202020207d, + 0x2066696e616c6c79, 0x207b0a2020202020, 0x2020202020202020, 0x2020206966202863, 0x6f756e746564290a, + 0x2020202020202020, 0x2020202020202020, 0x202020202d2d7468, 0x69732e6c69737445, 0x6c656d656e744465, + 0x7074683b0a202020, 0x2020202020202020, 0x207d0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, + 0x2f2041206c697374, 0x2069732061203332, 0x2d62697420636f75, 0x6e7420666f6c6c6f, 0x7765642062792074, + 0x686174206d616e79, 0x2076616c75657320, 0x6f66206f6e652073, 0x686170653b207468, 0x6520656c656d656e, + 0x7473206172726976, 0x652061732061204a, 0x6176615363726970, 0x742061727261792e, 0x0a20202020202020, + 0x206465636f64654c, 0x6973742876696577, 0x2c206f6666736574, 0x29207b0a20202020, 0x2020202020202020, + 0x7265717569726542, 0x7974657328766965, 0x772c206f66667365, 0x742c20352c20226c, 0x6973742068656164, + 0x657222293b0a2020, 0x2020202020202020, 0x2020636f6e737420, 0x636f756e74203d20, 0x766965772e676574, + 0x55696e743332286f, 0x6666736574202b20, 0x312c20746869732e, 0x6c6974746c65456e, 0x6469616e293b0a20, + 0x2020202020202020, 0x2020202f2f204576, 0x65727920656c656d, 0x656e742074616b65, 0x73206174206c6561, + 0x7374206f6e652062, 0x7974653a20612063, 0x6f756e7420746865, 0x206d657373616765, 0x2063616e6e6f7420, + 0x686f6c6420697320, 0x7265667573656420, 0x6265666f72652061, 0x6e797468696e6720, 0x697320616c6c6f63, + 0x617465642e0a2020, 0x2020202020202020, 0x2020726571756972, 0x6542797465732876, 0x6965772c206f6666, + 0x736574202b20352c, 0x20636f756e742c20, 0x226c69737420656c, 0x656d656e74732229, 0x3b0a202020202020, 0x202020202020636f, 0x6e73742076616c75, 0x6573203d205b5d3b, 0x0a20202020202020, 0x20202020206c6574, - 0x20637572736f7220, 0x3d206f6666736574, 0x3b0a202020202020, 0x202020202020666f, 0x7220286c65742069, - 0x6e646578203d2030, 0x3b20696e64657820, 0x3c20636f756e743b, 0x202b2b696e646578, 0x29207b0a20202020, - 0x2020202020202020, 0x2020202072657175, 0x6972654279746573, 0x28766965772c2063, 0x7572736f722c2031, - 0x2c2022706172616d, 0x6574657220747970, 0x6522293b0a202020, 0x2020202020202020, 0x2020202020636f6e, - 0x7374207b76616c75, 0x652c206279746573, 0x2c2073686170657d, 0x203d20746869732e, 0x6465636f64655661, - 0x6c75652876696577, 0x2e67657455696e74, 0x3828637572736f72, 0x292c20766965772c, 0x20637572736f7229, - 0x3b0a202020202020, 0x2020202020202020, 0x202076616c756573, 0x2e70757368287661, 0x6c7565293b0a2020, - 0x2020202020202020, 0x2020202020206966, 0x2028736861706573, 0x290a202020202020, 0x2020202020202020, - 0x2020202020207368, 0x617065732e707573, 0x6828736861706529, 0x3b0a202020202020, 0x2020202020202020, - 0x2020637572736f72, 0x202b3d2062797465, 0x733b0a2020202020, 0x202020202020207d, 0x0a20202020202020, - 0x2020202020726574, 0x75726e205b76616c, 0x7565732c20637572, 0x736f72202d206f66, 0x667365745d3b0a20, - 0x202020202020207d, 0x0a0a202020202020, 0x20202f2f2f204465, 0x636f646573207468, 0x652073696e676c65, - 0x2076616c75652073, 0x74617274696e6720, 0x617420276f666673, 0x6574272c20726574, 0x75726e696e672069, - 0x7420616c6f6e6773, 0x6964652074686520, 0x6279746520636f75, 0x6e7420697420636f, 0x6e73756d65642e0a, - 0x2020202020202020, 0x6465636f64655661, 0x6c75652874797065, 0x2c20766965772c20, 0x6f66667365742920, - 0x7b0a202020202020, 0x202020202020636f, 0x6e7374206465636f, 0x646572203d207661, 0x6c75654465636f64, - 0x6572732e67657428, 0x74797065293b0a20, 0x2020202020202020, 0x2020206966202821, 0x6465636f64657229, - 0x0a20202020202020, 0x2020202020202020, 0x207468726f77206e, 0x6577205479706545, 0x72726f722860556e, - 0x737570706f727465, 0x6420706172616d65, 0x7465722074797065, 0x20247b747970657d, 0x60293b0a20202020, - 0x2020202020202020, 0x636f6e7374206465, 0x636f646564203d20, 0x6465636f64657228, 0x746869732c207479, - 0x70652c2076696577, 0x2c206f6666736574, 0x293b0a2020202020, 0x2020202020202064, 0x65636f6465642e73, - 0x68617065203f3f3d, 0x2077697265536861, 0x7065287479706529, 0x3b0a202020202020, 0x2020202020207265, - 0x7475726e20646563, 0x6f6465643b0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x206465636f64654e, - 0x756d626572287669, 0x65772c206f666673, 0x657429207b0a2020, 0x2020202020202020, 0x2020726571756972, - 0x6542797465732876, 0x6965772c206f6666, 0x7365742c20392c20, 0x226e756d62657222, 0x293b0a2020202020, - 0x2020202020202072, 0x657475726e207b76, 0x616c75653a207669, 0x65772e676574466c, 0x6f61743634286f66, - 0x66736574202b2031, 0x2c20746869732e6c, 0x6974746c65456e64, 0x69616e292c206279, 0x7465733a20397d3b, - 0x0a20202020202020, 0x207d0a0a20202020, 0x202020202f2f2f20, 0x4465636f64657320, 0x6120736d616c6c53, - 0x7472696e672c2073, 0x7472696e67206f72, 0x206c6f6e67537472, 0x696e672e0a202020, 0x2020202020646563, - 0x6f6465537472696e, 0x6728747970652c20, 0x766965772c206f66, 0x6673657429207b0a, 0x2020202020202020, - 0x20202020636f6e73, 0x742073697a654279, 0x746573203d207479, 0x7065203d3d3d2050, 0x6172616d54797065, - 0x2e736d616c6c5374, 0x72696e67203f2031, 0x203a207479706520, 0x3d3d3d2050617261, 0x6d547970652e6c6f, - 0x6e67537472696e67, 0x203f2034203a2032, 0x3b0a202020202020, 0x2020202020207265, 0x7175697265427974, - 0x657328766965772c, 0x206f666673657420, 0x2b20312c2073697a, 0x6542797465732c20, 0x22737472696e6720, - 0x6c656e6774682229, 0x3b0a202020202020, 0x202020202020636f, 0x6e7374206c656e67, 0x7468203d2073697a, - 0x654279746573203d, 0x3d3d2031203f2076, 0x6965772e67657455, 0x696e7438286f6666, 0x736574202b203129, - 0x0a20202020202020, 0x2020202020202020, 0x203a2073697a6542, 0x79746573203d3d3d, 0x2032203f20766965, - 0x772e67657455696e, 0x743136286f666673, 0x6574202b20312c20, 0x746869732e6c6974, 0x746c65456e646961, - 0x6e29203a20766965, 0x772e67657455696e, 0x743332286f666673, 0x6574202b20312c20, 0x746869732e6c6974, - 0x746c65456e646961, 0x6e293b0a20202020, 0x2020202020202020, 0x636f6e7374207061, 0x796c6f6164203d20, - 0x6f6666736574202b, 0x2031202b2073697a, 0x6542797465733b0a, 0x2020202020202020, 0x2020202072657175, - 0x6972654279746573, 0x28766965772c2070, 0x61796c6f61642c20, 0x6c656e6774682c20, 0x22737472696e6720, - 0x7061796c6f616422, 0x293b0a2020202020, 0x2020202020202063, 0x6f6e737420627974, 0x6573203d206e6577, - 0x2055696e74384172, 0x7261792876696577, 0x2e6275666665722c, 0x20766965772e6279, 0x74654f6666736574, - 0x202b207061796c6f, 0x61642c206c656e67, 0x7468293b0a202020, 0x2020202020202020, 0x2072657475726e20, - 0x7b76616c75653a20, 0x6e65772054657874, 0x4465636f64657228, 0x227574662d382229, 0x2e6465636f646528, - 0x6279746573292c20, 0x62797465733a2031, 0x202b2073697a6542, 0x79746573202b206c, 0x656e6774687d3b0a, - 0x2020202020202020, 0x7d0a0a2020202020, 0x2020202f2f2f2041, 0x6e20657863657074, 0x696f6e2069732061, - 0x20312d6279746520, 0x636f64652073697a, 0x652c207468652063, 0x6f64652c20612031, 0x362d626974206d65, - 0x7373616765207369, 0x7a6520616e642074, 0x6865206d65737361, 0x67652e2049742064, 0x65636f6465732074, - 0x6f20616e20457272, 0x6f7220776974680a, 0x2020202020202020, 0x2f2f2f2060636f64, 0x65602c2077686963, - 0x6820612073657474, 0x6c65642063616c6c, 0x2072656a65637473, 0x20776974682e0a20, 0x2020202020202064, - 0x65636f6465457863, 0x657074696f6e2876, 0x6965772c206f6666, 0x73657429207b0a20, 0x2020202020202020, - 0x2020207265717569, 0x7265427974657328, 0x766965772c206f66, 0x66736574202b2031, 0x2c20312c20226578, - 0x63657074696f6e20, 0x636f64652073697a, 0x6522293b0a202020, 0x2020202020202020, 0x20636f6e73742063, - 0x6f646553697a6520, 0x3d20766965772e67, 0x657455696e743828, 0x6f6666736574202b, 0x2031293b0a202020, - 0x2020202020202020, 0x2072657175697265, 0x4279746573287669, 0x65772c206f666673, 0x6574202b20322c20, - 0x636f646553697a65, 0x202b20322c202265, 0x7863657074696f6e, 0x20636f646522293b, 0x0a20202020202020, - 0x2020202020636f6e, 0x737420636f646520, 0x3d206e6577205465, 0x78744465636f6465, 0x7228227574662d38, - 0x22292e6465636f64, 0x65286e6577205569, 0x6e74384172726179, 0x28766965772e6275, 0x666665722c207669, - 0x65772e627974654f, 0x6666736574202b20, 0x6f6666736574202b, 0x20322c20636f6465, 0x53697a6529293b0a, - 0x2020202020202020, 0x20202020636f6e73, 0x74206d6573736167, 0x6553697a65203d20, 0x766965772e676574, - 0x55696e743136286f, 0x6666736574202b20, 0x32202b20636f6465, 0x53697a652c207468, 0x69732e6c6974746c, - 0x65456e6469616e29, 0x3b0a202020202020, 0x202020202020636f, 0x6e7374207061796c, 0x6f6164203d206f66, - 0x66736574202b2034, 0x202b20636f646553, 0x697a653b0a202020, 0x2020202020202020, 0x2072657175697265, - 0x4279746573287669, 0x65772c207061796c, 0x6f61642c206d6573, 0x7361676553697a65, 0x2c20226578636570, - 0x74696f6e206d6573, 0x7361676522293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x74206d6573736167, - 0x65203d206e657720, 0x546578744465636f, 0x6465722822757466, 0x2d3822292e646563, 0x6f6465286e657720, - 0x55696e7438417272, 0x617928766965772e, 0x6275666665722c20, 0x766965772e627974, 0x654f666673657420, - 0x2b207061796c6f61, 0x642c206d65737361, 0x676553697a652929, 0x3b0a202020202020, 0x2020202020207265, - 0x7475726e207b7661, 0x6c75653a20627269, 0x6467654572726f72, 0x2876616c6964436f, 0x64652e7465737428, - 0x636f646529203f20, 0x636f6465203a2042, 0x7269646765436f64, 0x652e67656e657269, 0x632c206d65737361, - 0x6765292c20627974, 0x65733a2034202b20, 0x636f646553697a65, 0x202b206d65737361, 0x676553697a657d3b, - 0x0a20202020202020, 0x207d0a0a20202020, 0x202020206465636f, 0x64655475706c6528, 0x766965772c206f66, - 0x6673657429207b0a, 0x2020202020202020, 0x2020202072657175, 0x6972654279746573, 0x28766965772c206f, - 0x66667365742c2032, 0x2c20227475706c65, 0x2068656164657222, 0x293b0a2020202020, 0x202020202020202f, - 0x2f20496e73696465, 0x2061206c69737420, 0x656c656d656e7420, 0x746865206e657374, 0x696e672069732063, - 0x6f756e7465642077, 0x68696c6520646573, 0x63656e64696e672c, 0x20736f2074686174, 0x2061206d65737361, - 0x6765206f66207468, 0x6f7573616e647320, 0x6f66206e65737465, 0x64207475706c6573, 0x0a20202020202020, - 0x20202020202f2f20, 0x6973207265667573, 0x6564206174207468, 0x65206c696d697420, 0x616e64206e657665, - 0x7220657868617573, 0x7473207468652073, 0x7461636b2e0a2020, 0x2020202020202020, 0x2020636f6e737420, - 0x636f756e74656420, 0x3d20746869732e6c, 0x697374456c656d65, 0x6e74446570746820, 0x213d3d20756e6465, - 0x66696e65643b0a20, 0x2020202020202020, 0x2020206966202863, 0x6f756e7465642026, 0x2620746869732e6c, - 0x697374456c656d65, 0x6e74446570746820, 0x3e3d206d61784c69, 0x73745475706c6544, 0x65707468290a2020, - 0x2020202020202020, 0x2020202020207468, 0x726f77206e657720, 0x547970654572726f, 0x7228605765624672, - 0x6f6e74206c697374, 0x20656c656d656e74, 0x73206e6573742074, 0x75706c6573206174, 0x206d6f737420247b, - 0x6d61784c69737454, 0x75706c6544657074, 0x687d206465657060, 0x293b0a2020202020, 0x2020202020202069, - 0x662028636f756e74, 0x6564290a20202020, 0x2020202020202020, 0x202020202b2b7468, 0x69732e6c69737445, - 0x6c656d656e744465, 0x7074683b0a202020, 0x2020202020202020, 0x20747279207b0a20, 0x2020202020202020, - 0x2020202020202063, 0x6f6e737420736861, 0x706573203d205b5d, 0x3b0a202020202020, 0x2020202020202020, - 0x2020636f6e737420, 0x5b7475706c652c20, 0x636f6e73756d6564, 0x5d203d2074686973, 0x2e6465636f646550, - 0x6172616d65746572, 0x7328766965772e67, 0x657455696e743828, 0x6f6666736574202b, 0x2031292c20766965, - 0x772c206f66667365, 0x74202b20322c2073, 0x6861706573293b0a, 0x2020202020202020, 0x2020202020202020, - 0x72657475726e207b, 0x76616c75653a2074, 0x75706c652c206279, 0x7465733a2032202b, 0x20636f6e73756d65, - 0x642c207368617065, 0x3a206028247b7368, 0x617065732e6a6f69, 0x6e28222c22297d29, 0x607d3b0a20202020, - 0x2020202020202020, 0x7d2066696e616c6c, 0x79207b0a20202020, 0x2020202020202020, 0x2020202069662028, - 0x636f756e74656429, 0x0a20202020202020, 0x2020202020202020, 0x20202020202d2d74, 0x6869732e6c697374, - 0x456c656d656e7444, 0x657074683b0a2020, 0x2020202020202020, 0x20207d0a20202020, 0x202020207d0a0a20, - 0x202020202020202f, 0x2f2f2041206c6973, 0x7420697320612033, 0x322d62697420636f, 0x756e7420666f6c6c, - 0x6f77656420627920, 0x74686174206d616e, 0x792076616c756573, 0x206f66206f6e6520, 0x73686170653b2074, - 0x686520656c656d65, 0x6e74732061727269, 0x7665206173206120, 0x4a61766153637269, 0x7074206172726179, - 0x2e0a202020202020, 0x20206465636f6465, 0x4c69737428766965, 0x772c206f66667365, 0x7429207b0a202020, - 0x2020202020202020, 0x2072657175697265, 0x4279746573287669, 0x65772c206f666673, 0x65742c20352c2022, - 0x6c69737420686561, 0x64657222293b0a20, 0x2020202020202020, 0x202020636f6e7374, 0x20636f756e74203d, - 0x20766965772e6765, 0x7455696e74333228, 0x6f6666736574202b, 0x20312c2074686973, 0x2e6c6974746c6545, - 0x6e6469616e293b0a, 0x2020202020202020, 0x202020202f2f2045, 0x7665727920656c65, 0x6d656e742074616b, - 0x6573206174206c65, 0x617374206f6e6520, 0x627974653a206120, 0x636f756e74207468, 0x65206d6573736167, - 0x652063616e6e6f74, 0x20686f6c64206973, 0x2072656675736564, 0x206265666f726520, 0x616e797468696e67, - 0x20697320616c6c6f, 0x63617465642e0a20, 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, - 0x766965772c206f66, 0x66736574202b2035, 0x2c20636f756e742c, 0x20226c6973742065, 0x6c656d656e747322, - 0x293b0a2020202020, 0x2020202020202063, 0x6f6e73742076616c, 0x756573203d205b5d, 0x3b0a202020202020, - 0x2020202020206c65, 0x7420637572736f72, 0x203d206f66667365, 0x74202b20353b0a20, 0x2020202020202020, - 0x2020206c6574206c, 0x6973745368617065, 0x203d206e756c6c3b, 0x0a20202020202020, 0x2020202020636f6e, - 0x7374206f75746572, 0x4465707468203d20, 0x746869732e6c6973, 0x74456c656d656e74, 0x44657074683b0a20, - 0x2020202020202020, 0x202020747279207b, 0x0a20202020202020, 0x2020202020202020, 0x20666f7220286c65, - 0x7420696e64657820, 0x3d20303b20696e64, 0x6578203c20636f75, 0x6e743b202b2b696e, 0x64657829207b0a20, - 0x2020202020202020, 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x766965772c206375, - 0x72736f722c20312c, 0x20226c6973742065, 0x6c656d656e742074, 0x79706522293b0a20, 0x2020202020202020, - 0x2020202020202020, 0x2020206966202876, 0x6965772e67657455, 0x696e743828637572, 0x736f7229203d3d3d, - 0x20506172616d5479, 0x70652e6578636570, 0x74696f6e290a2020, 0x2020202020202020, 0x2020202020202020, - 0x2020202020207468, 0x726f77206e657720, 0x547970654572726f, 0x7228224120576562, 0x46726f6e74206c69, - 0x737420656c656d65, 0x6e742063616e6e6f, 0x7420626520616e20, 0x657863657074696f, 0x6e22293b0a202020, - 0x2020202020202020, 0x2020202020202020, 0x20746869732e6c69, 0x7374456c656d656e, 0x744465707468203d, - 0x20303b20202f2f20, 0x6561636820656c65, 0x6d656e7420636f75, 0x6e74732069747320, 0x6f776e207475706c, - 0x65206e657374696e, 0x670a202020202020, 0x2020202020202020, 0x202020202020636f, 0x6e7374207b76616c, - 0x75652c2062797465, 0x732c207368617065, 0x7d203d2074686973, 0x2e6465636f646556, 0x616c756528766965, - 0x772e67657455696e, 0x743828637572736f, 0x72292c2076696577, 0x2c20637572736f72, 0x293b0a2020202020, - 0x2020202020202020, 0x2020202020202072, 0x6571756972654c69, 0x7374456c656d656e, 0x7453686170652873, - 0x68617065293b0a20, 0x2020202020202020, 0x2020202020202020, 0x202020696620286c, 0x6973745368617065, - 0x203d3d3d206e756c, 0x6c290a2020202020, 0x2020202020202020, 0x2020202020202020, 0x2020206c69737453, - 0x68617065203d2073, 0x686170653b0a2020, 0x2020202020202020, 0x2020202020202020, 0x2020656c73652069, - 0x6620287368617065, 0x20213d3d206c6973, 0x745368617065290a, 0x2020202020202020, 0x2020202020202020, - 0x2020202020202020, 0x7468726f77206e65, 0x7720547970654572, 0x726f722822576562, 0x46726f6e74206c69, - 0x737420656c656d65, 0x6e74732061726520, 0x6e6f74206f66206f, 0x6e65207479706522, 0x293b0a2020202020, - 0x2020202020202020, 0x2020202020202076, 0x616c7565732e7075, 0x73682876616c7565, 0x293b0a2020202020, - 0x2020202020202020, 0x2020202020202063, 0x7572736f72202b3d, 0x2062797465733b0a, 0x2020202020202020, - 0x2020202020202020, 0x7d0a202020202020, 0x2020202020207d20, 0x66696e616c6c7920, 0x7b0a202020202020, - 0x2020202020202020, 0x2020746869732e6c, 0x697374456c656d65, 0x6e74446570746820, 0x3d206f7574657244, - 0x657074683b0a2020, 0x2020202020202020, 0x20207d0a20202020, 0x2020202020202020, 0x72657475726e207b, - 0x76616c75653a2076, 0x616c7565732c2062, 0x797465733a206375, 0x72736f72202d206f, 0x66667365742c2073, - 0x686170653a20224c, 0x227d3b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f205265736f6c, - 0x7665732074686520, 0x656c656d656e7420, 0x7370656320616e64, 0x206c656e67746820, 0x7072656669782066, - 0x6f72206120747970, 0x6564206172726179, 0x2c2077686f736520, 0x6865616465722069, 0x7320322062797465, - 0x7320696e20746865, 0x0a20202020202020, 0x202f2f2f20636f6d, 0x7061637420736d61, 0x6c6c417272617955, - 0x3820666f726d2061, 0x6e64203520627974, 0x6573206f74686572, 0x776973652e0a2020, 0x2020202020207265, - 0x6164547970656441, 0x7272617948656164, 0x657228747970652c, 0x20766965772c206f, 0x666673657429207b, - 0x0a20202020202020, 0x2020202020636f6e, 0x737420736d616c6c, 0x203d207479706520, 0x3d3d3d2050617261, - 0x6d547970652e736d, 0x616c6c4172726179, 0x55383b0a20202020, 0x2020202020202020, 0x636f6e7374207370, - 0x6563203d20736d61, 0x6c6c203f207b2e2e, 0x2e6172726179436f, 0x6465732e67657428, 0x506172616d547970, - 0x652e617272617955, 0x38292c20636f6e73, 0x74727563746f723a, 0x2055696e74384172, 0x7261797d203a2061, - 0x72726179436f6465, 0x732e676574287479, 0x7065293b0a202020, 0x2020202020202020, 0x2069662028217370, - 0x6563290a20202020, 0x2020202020202020, 0x202020207468726f, 0x77206e6577205479, 0x70654572726f7228, - 0x60556e737570706f, 0x7274656420747970, 0x6564206172726179, 0x20636f646520247b, 0x747970657d60293b, - 0x0a20202020202020, 0x2020202020636f6e, 0x7374206865616465, 0x7253697a65203d20, 0x736d616c6c203f20, - 0x32203a20353b0a20, 0x2020202020202020, 0x2020207265717569, 0x7265427974657328, 0x766965772c206f66, - 0x667365742c206865, 0x6164657253697a65, 0x2c20226172726179, 0x2068656164657222, 0x293b0a2020202020, - 0x2020202020202063, 0x6f6e7374206c656e, 0x677468203d20736d, 0x616c6c203f207669, 0x65772e6765745569, - 0x6e7438286f666673, 0x6574202b20312920, 0x3a20766965772e67, 0x657455696e743332, 0x286f666673657420, - 0x2b20312c20746869, 0x732e6c6974746c65, 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020726574, - 0x75726e207b737065, 0x632c206865616465, 0x7253697a652c206c, 0x656e6774687d3b0a, 0x2020202020202020, - 0x7d0a0a2020202020, 0x2020206465636f64, 0x6554797065644172, 0x7261792874797065, 0x2c20766965772c20, - 0x6f66667365742920, 0x7b0a202020202020, 0x202020202020636f, 0x6e7374207b737065, 0x632c206865616465, - 0x7253697a652c206c, 0x656e6774687d203d, 0x20746869732e7265, 0x6164547970656441, 0x7272617948656164, - 0x657228747970652c, 0x20766965772c206f, 0x6666736574293b0a, 0x2020202020202020, 0x20202020636f6e73, - 0x7420627974654c65, 0x6e677468203d206c, 0x656e677468202a20, 0x737065632e627974, 0x65733b0a20202020, - 0x2020202020202020, 0x69662028214e756d, 0x6265722e69735361, 0x6665496e74656765, 0x7228627974654c65, - 0x6e67746829290a20, 0x2020202020202020, 0x2020202020202074, 0x68726f77206e6577, 0x2052616e67654572, - 0x726f722822547970, 0x6564206172726179, 0x206c656e67746820, 0x697320746f6f206c, 0x6172676522293b0a, - 0x2020202020202020, 0x2020202072657175, 0x6972654279746573, 0x28766965772c206f, 0x6666736574202b20, - 0x6865616465725369, 0x7a652c2062797465, 0x4c656e6774682c20, 0x2261727261792070, 0x61796c6f61642229, - 0x3b0a0a2020202020, 0x2020202020202063, 0x6f6e737420726573, 0x756c74203d206e65, 0x7720737065632e63, - 0x6f6e737472756374, 0x6f72286c656e6774, 0x68293b0a20202020, 0x2020202020202020, 0x636f6e7374207061, - 0x796c6f6164203d20, 0x6f6666736574202b, 0x2068656164657253, 0x697a653b0a202020, 0x2020202020202020, - 0x20666f7220286c65, 0x7420696e64657820, 0x3d20303b20696e64, 0x6578203c206c656e, 0x6774683b202b2b69, - 0x6e646578290a2020, 0x2020202020202020, 0x2020202020207265, 0x73756c745b696e64, 0x65785d203d207669, - 0x65775b737065632e, 0x6765747465725d28, 0x7061796c6f616420, 0x2b20696e64657820, 0x2a20737065632e62, - 0x797465732c207468, 0x69732e6c6974746c, 0x65456e6469616e29, 0x3b0a202020202020, 0x2020202020207265, - 0x7475726e207b7661, 0x6c75653a20726573, 0x756c742c20627974, 0x65733a2068656164, 0x657253697a65202b, - 0x20627974654c656e, 0x6774687d3b0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x202f2f2f204d6172, - 0x6b7320606974656d, 0x736020746f206265, 0x2073656e74206173, 0x2061206c6973743a, 0x20616e79206e756d, - 0x626572206f662065, 0x6c656d656e747320, 0x6f66206f6e652074, 0x7970652c20656163, 0x6820612073747269, - 0x6e672c2061207479, 0x7065642061727261, 0x79206f7220612074, 0x75706c652c207768, 0x6963680a20202020, - 0x202020202f2f2f20, 0x432b2b2072656365, 0x6976657320617320, 0x61207374643a3a76, 0x6563746f722e204e, - 0x756d626572732067, 0x6f20617320612074, 0x7970656420617272, 0x6179202861206c69, 0x7374206f66206e75, - 0x6d62657273206f72, 0x20626f6f6c65616e, 0x7320697320726566, 0x75736564292e2041, 0x20706c61696e0a20, - 0x202020202020202f, 0x2f2f206172726179, 0x2069732061207475, 0x706c65206f662061, 0x74206d6f73742032, - 0x353520656c656d65, 0x6e7473206f662061, 0x6e79207479706573, 0x2e0a202020202020, 0x20206c6973742869, - 0x74656d7329207b0a, 0x2020202020202020, 0x2020202072657475, 0x726e206e65772057, 0x656246726f6e744c, - 0x697374286974656d, 0x73293b0a20202020, 0x202020207d0a0a20, 0x2020202020202063, 0x707046756e637469, - 0x6f6e286e616d6529, 0x207b0a2020202020, 0x2020202020202072, 0x657475726e20282e, 0x2e2e617267732920, - 0x3d3e20746869732e, 0x63616c6c43707046, 0x756e6374696f6e28, 0x6e616d652c206172, 0x6773293b0a202020, - 0x20202020207d0a0a, 0x2020202020202020, 0x63616c6c43707046, 0x756e6374696f6e28, 0x6e616d652c206172, - 0x677329207b0a2020, 0x2020202020202020, 0x202072657475726e, 0x206e65772050726f, 0x6d69736528287265, - 0x736f6c76652c2072, 0x656a65637429203d, 0x3e207b0a20202020, 0x2020202020202020, 0x202020206c657420, - 0x63616c6c4964203d, 0x20303b0a20202020, 0x2020202020202020, 0x2020202074727920, 0x7b0a202020202020, - 0x2020202020202020, 0x2020202020206966, 0x2028746869732e73, 0x7461746520213d3d, 0x20226c696e6b6564, - 0x22290a2020202020, 0x2020202020202020, 0x2020202020202020, 0x2020207468726f77, 0x2062726964676545, - 0x72726f7228427269, 0x646765436f64652e, 0x646973636f6e6e65, 0x637465642c202257, 0x656246726f6e7420, - 0x6272696467652069, 0x73206e6f7420636f, 0x6e6e656374656422, 0x293b0a2020202020, 0x2020202020202020, - 0x2020202020202063, 0x6f6e73742076616c, 0x756573203d205b6e, 0x616d652c202e2e2e, 0x617267735d3b0a20, - 0x2020202020202020, 0x2020202020202020, 0x2020206966202876, 0x616c7565732e6c65, 0x6e677468203e2032, - 0x3535290a20202020, 0x2020202020202020, 0x2020202020202020, 0x202020207468726f, 0x77206e6577205261, - 0x6e67654572726f72, 0x2822412066756e63, 0x74696f6e2063616c, 0x6c2063616e6e6f74, 0x20636f6e7461696e, - 0x206d6f7265207468, 0x616e203235352074, 0x6f702d6c6576656c, 0x2076616c75657322, 0x293b0a2020202020, - 0x2020202020202020, 0x2020202020202063, 0x6f6e737420706179, 0x6c6f616453697a65, 0x203d2076616c7565, - 0x732e726564756365, 0x282873697a652c20, 0x76616c756529203d, 0x3e2073697a65202b, 0x20746869732e7061, - 0x72616d6574657253, 0x697a652876616c75, 0x65292c2030293b0a, 0x2020202020202020, 0x2020202020202020, - 0x2020202074686973, 0x2e636865636b4d65, 0x737361676553697a, 0x65287061796c6f61, 0x6453697a65293b0a, - 0x2020202020202020, 0x2020202020202020, 0x20202020636f6e73, 0x7420627566666572, 0x203d206e65772041, - 0x7272617942756666, 0x65722838202b2070, 0x61796c6f61645369, 0x7a65293b0a202020, 0x2020202020202020, - 0x2020202020202020, 0x20636f6e73742076, 0x696577203d206e65, 0x7720446174615669, 0x6577286275666665, - 0x72293b0a20202020, 0x2020202020202020, 0x2020202020202020, 0x63616c6c4964203d, 0x20746869732e616c, - 0x6c6f636174654361, 0x6c6c496428293b0a, 0x2020202020202020, 0x2020202020202020, 0x2020202076696577, - 0x2e73657455696e74, 0x3828302c20436f6d, 0x6d616e642e63616c, 0x6c46756e6374696f, 0x6e293b0a20202020, - 0x2020202020202020, 0x2020202020202020, 0x766965772e736574, 0x55696e743828312c, 0x2076616c7565732e, - 0x6c656e677468293b, 0x0a20202020202020, 0x2020202020202020, 0x2020202020766965, 0x772e73657455696e, - 0x74313628322c2063, 0x616c6c49642c2074, 0x6869732e6c697474, 0x6c65456e6469616e, 0x293b0a2020202020, - 0x2020202020202020, 0x2020202020202076, 0x6965772e73657455, 0x696e74333228342c, 0x207061796c6f6164, - 0x53697a652c207468, 0x69732e6c6974746c, 0x65456e6469616e29, 0x3b0a202020202020, 0x2020202020202020, - 0x2020202020206c65, 0x7420637572736f72, 0x203d20383b0a2020, 0x2020202020202020, 0x2020202020202020, - 0x2020666f72202863, 0x6f6e73742076616c, 0x7565206f66207661, 0x6c756573290a2020, 0x2020202020202020, - 0x2020202020202020, 0x2020202020206375, 0x72736f72202b3d20, 0x746869732e656e63, 0x6f6465506172616d, - 0x657465722876616c, 0x75652c2076696577, 0x2c20637572736f72, 0x293b0a2020202020, 0x2020202020202020, - 0x2020202020202074, 0x6869732e70656e64, 0x696e6743616c6c73, 0x2e7365742863616c, 0x6c49642c207b7265, - 0x736f6c76652c2072, 0x656a6563747d293b, 0x0a20202020202020, 0x2020202020202020, 0x2020202020746869, - 0x732e736f636b6574, 0x2e73656e64286275, 0x66666572293b0a20, 0x2020202020202020, 0x202020202020207d, - 0x2063617463682028, 0x6572726f7229207b, 0x0a20202020202020, 0x2020202020202020, 0x2020202020696620, - 0x2863616c6c496420, 0x213d3d2030290a20, 0x2020202020202020, 0x2020202020202020, 0x2020202020202074, - 0x6869732e70656e64, 0x696e6743616c6c73, 0x2e64656c65746528, 0x63616c6c4964293b, 0x0a20202020202020, - 0x2020202020202020, 0x202020202072656a, 0x656374286572726f, 0x72293b0a20202020, 0x2020202020202020, - 0x202020207d0a2020, 0x2020202020202020, 0x20207d293b0a2020, 0x2020202020207d0a, 0x0a20202020202020, - 0x202f2f2f20526566, 0x757365732061206d, 0x6573736167652074, 0x686520432b2b2073, 0x69646520776f756c, - 0x6420636c6f736520, 0x74686520636f6e6e, 0x656374696f6e2066, 0x6f723a2074686520, 0x382d627974652068, - 0x656164657220616e, 0x6420746865207061, 0x796c6f616420746f, 0x6765746865722e0a, 0x2020202020202020, - 0x636865636b4d6573, 0x7361676553697a65, 0x287061796c6f6164, 0x53697a6529207b0a, 0x2020202020202020, - 0x2020202069662028, 0x38202b207061796c, 0x6f616453697a6520, 0x3e20746869732e6d, 0x61784d6573736167, - 0x654279746573290a, 0x2020202020202020, 0x2020202020202020, 0x7468726f77206e65, 0x772052616e676545, - 0x72726f7228605765, 0x6246726f6e74206d, 0x657373616765206f, 0x6620247b38202b20, 0x7061796c6f616453, - 0x697a657d20627974, 0x6573206578636565, 0x647320746865206d, 0x6178696d756d206f, 0x6620247b74686973, - 0x2e6d61784d657373, 0x6167654279746573, 0x7d20627974657360, 0x293b0a2020202020, 0x2020207d0a0a2020, - 0x202020202020616c, 0x6c6f636174654361, 0x6c6c49642829207b, 0x0a20202020202020, 0x2020202020666f72, - 0x20286c6574206174, 0x74656d707473203d, 0x20303b2061747465, 0x6d707473203c2030, 0x78666666663b202b, - 0x2b617474656d7074, 0x7329207b0a202020, 0x2020202020202020, 0x2020202020636f6e, 0x73742063616e6469, - 0x64617465203d2074, 0x6869732e6e657874, 0x43616c6c49643b0a, 0x2020202020202020, 0x2020202020202020, - 0x746869732e6e6578, 0x7443616c6c496420, 0x3d20746869732e6e, 0x65787443616c6c49, 0x64203d3d3d203078, - 0x66666666203f2031, 0x203a20746869732e, 0x6e65787443616c6c, 0x4964202b20313b0a, 0x2020202020202020, - 0x2020202020202020, 0x6966202821746869, 0x732e70656e64696e, 0x6743616c6c732e68, 0x61732863616e6469, - 0x6461746529290a20, 0x2020202020202020, 0x2020202020202020, 0x2020207265747572, 0x6e2063616e646964, - 0x6174653b0a202020, 0x2020202020202020, 0x207d0a2020202020, 0x2020202020202074, 0x68726f77206e6577, - 0x204572726f722822, 0x546f6f206d616e79, 0x206f75747374616e, 0x64696e6720576562, 0x46726f6e74206361, - 0x6c6c7322293b0a20, 0x202020202020207d, 0x0a0a202020202020, 0x202073656e644675, 0x6e6374696f6e5265, - 0x7475726e2863616c, 0x6c49642c2076616c, 0x756529207b0a2020, 0x2020202020202020, 0x2020636f6e737420, - 0x76616c756573203d, 0x2076616c7565203d, 0x3d3d20756e646566, 0x696e6564203f205b, 0x5d203a205b76616c, - 0x75655d3b0a202020, 0x2020202020202020, 0x20636f6e73742070, 0x61796c6f61645369, 0x7a65203d2076616c, - 0x7565732e72656475, 0x6365282873697a65, 0x2c206974656d2920, 0x3d3e2073697a6520, 0x2b20746869732e70, - 0x6172616d65746572, 0x53697a6528697465, 0x6d292c2030293b0a, 0x2020202020202020, 0x2020202074686973, - 0x2e636865636b4d65, 0x737361676553697a, 0x65287061796c6f61, 0x6453697a65293b0a, 0x2020202020202020, - 0x20202020636f6e73, 0x7420627566666572, 0x203d206e65772041, 0x7272617942756666, 0x65722838202b2070, - 0x61796c6f61645369, 0x7a65293b0a202020, 0x2020202020202020, 0x20636f6e73742076, 0x696577203d206e65, - 0x7720446174615669, 0x6577286275666665, 0x72293b0a20202020, 0x2020202020202020, 0x766965772e736574, - 0x55696e743828302c, 0x20436f6d6d616e64, 0x2e66756e6374696f, 0x6e52657475726e29, 0x3b0a202020202020, - 0x2020202020207669, 0x65772e7365745569, 0x6e743828312c2076, 0x616c7565732e6c65, 0x6e677468293b0a20, - 0x2020202020202020, 0x202020766965772e, 0x73657455696e7431, 0x3628322c2063616c, 0x6c49642c20746869, - 0x732e6c6974746c65, 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, - 0x74333228342c2070, 0x61796c6f61645369, 0x7a652c2074686973, 0x2e6c6974746c6545, 0x6e6469616e293b0a, - 0x2020202020202020, 0x202020206c657420, 0x637572736f72203d, 0x20383b0a20202020, 0x2020202020202020, - 0x666f722028636f6e, 0x7374206974656d20, 0x6f662076616c7565, 0x73290a2020202020, 0x2020202020202020, - 0x202020637572736f, 0x72202b3d20746869, 0x732e656e636f6465, 0x506172616d657465, 0x72286974656d2c20, - 0x766965772c206375, 0x72736f72293b0a20, 0x2020202020202020, 0x202020746869732e, 0x736f636b65742e73, - 0x656e642862756666, 0x6572293b0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x2f2f2f2052656a65, - 0x6374732074686520, 0x432b2b2063616c6c, 0x206063616c6c4964, 0x6020776974682074, 0x6865206d65737361, - 0x676520616e642074, 0x686520636f646520, 0x6f6620606572726f, 0x7260202874686520, 0x67656e6572696320, - 0x636f646520776865, 0x6e20697420686173, 0x206e6f6e65206f72, 0x2061207265736572, 0x766564206f6e6529, - 0x2e0a202020202020, 0x202073656e644675, 0x6e6374696f6e4572, 0x726f722863616c6c, 0x49642c206572726f, - 0x7229207b0a202020, 0x2020202020202020, 0x20636f6e7374206d, 0x657373616765203d, 0x2065786365707469, - 0x6f6e546578742865, 0x72726f72293b0a20, 0x2020202020202020, 0x202020636f6e7374, 0x20636f6465203d20, - 0x6e65772054657874, 0x456e636f64657228, 0x292e656e636f6465, 0x2865786365707469, 0x6f6e436f64652865, - 0x72726f7229293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x742077686f6c6520, 0x3d206e6577205465, - 0x7874456e636f6465, 0x7228292e656e636f, 0x6465286d65737361, 0x6765293b0a202020, 0x2020202020202020, - 0x202f2f2041206d65, 0x7373616765206c6f, 0x6e67657220746861, 0x6e20746865203136, 0x2d626974206c656e, - 0x6774682c206f7220, 0x7468616e20776861, 0x7420746865206d61, 0x78696d756d206d65, 0x7373616765207369, - 0x7a65206c65617665, 0x7320616674657220, 0x74686520382d6279, 0x7465206865616465, 0x722c207468650a20, - 0x2020202020202020, 0x2020202f2f20636f, 0x646520616e642074, 0x68652074776f2073, 0x697a65732c206973, - 0x2063757420626566, 0x6f72652074686520, 0x6669727374205554, 0x462d382063686172, 0x6163746572207468, - 0x617420776f756c64, 0x206e6f7420666974, 0x2077686f6c652e0a, 0x2020202020202020, 0x20202020636f6e73, - 0x7420726f6f6d203d, 0x204d6174682e6d61, 0x7828302c20746869, 0x732e6d61784d6573, 0x7361676542797465, - 0x73202d203132202d, 0x20636f64652e6c65, 0x6e677468293b0a20, 0x2020202020202020, 0x2020206c65742063, - 0x7574203d204d6174, 0x682e6d696e287768, 0x6f6c652e6c656e67, 0x74682c2036353533, 0x352c20726f6f6d29, - 0x3b0a202020202020, 0x2020202020207768, 0x696c652028637574, 0x203e203020262620, 0x637574203c207768, - 0x6f6c652e6c656e67, 0x7468202626202877, 0x686f6c655b637574, 0x5d20262030786330, 0x29203d3d3d203078, - 0x3830290a20202020, 0x2020202020202020, 0x202020202d2d6375, 0x743b0a2020202020, 0x2020202020202063, - 0x6f6e737420627974, 0x6573203d2077686f, 0x6c652e7375626172, 0x72617928302c2063, 0x7574293b0a202020, - 0x2020202020202020, 0x20636f6e73742062, 0x7566666572203d20, 0x6e65772041727261, 0x7942756666657228, - 0x3132202b20636f64, 0x652e6c656e677468, 0x202b206279746573, 0x2e6c656e67746829, 0x3b0a202020202020, - 0x202020202020636f, 0x6e73742076696577, 0x203d206e65772044, 0x6174615669657728, 0x627566666572293b, - 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, 0x743828302c20436f, 0x6d6d616e642e6675, - 0x6e6374696f6e5265, 0x7475726e293b0a20, 0x2020202020202020, 0x202020766965772e, 0x73657455696e7438, - 0x28312c2031293b0a, 0x2020202020202020, 0x2020202076696577, 0x2e73657455696e74, 0x313628322c206361, - 0x6c6c49642c207468, 0x69732e6c6974746c, 0x65456e6469616e29, 0x3b0a202020202020, 0x2020202020207669, - 0x65772e7365745569, 0x6e74333228342c20, 0x34202b20636f6465, 0x2e6c656e67746820, 0x2b2062797465732e, - 0x6c656e6774682c20, 0x746869732e6c6974, 0x746c65456e646961, 0x6e293b0a20202020, 0x2020202020202020, - 0x766965772e736574, 0x55696e743828382c, 0x20506172616d5479, 0x70652e6578636570, 0x74696f6e293b0a20, - 0x2020202020202020, 0x202020766965772e, 0x73657455696e7438, 0x28392c20636f6465, 0x2e6c656e67746829, - 0x3b0a202020202020, 0x2020202020206e65, 0x772055696e743841, 0x7272617928627566, 0x6665722c20313029, - 0x2e73657428636f64, 0x65293b0a20202020, 0x2020202020202020, 0x766965772e736574, 0x55696e7431362831, - 0x30202b20636f6465, 0x2e6c656e6774682c, 0x2062797465732e6c, 0x656e6774682c2074, 0x6869732e6c697474, - 0x6c65456e6469616e, 0x293b0a2020202020, 0x202020202020206e, 0x65772055696e7438, 0x4172726179286275, - 0x666665722c203132, 0x202b20636f64652e, 0x6c656e677468292e, 0x7365742862797465, 0x73293b0a20202020, - 0x2020202020202020, 0x746869732e736f63, 0x6b65742e73656e64, 0x2862756666657229, 0x3b0a202020202020, - 0x20207d0a0a202020, 0x2020202020706172, 0x616d657465725369, 0x7a652876616c7565, 0x29207b0a20202020, - 0x2020202020202020, 0x7377697463682028, 0x747970656f662076, 0x616c756529207b0a, 0x2020202020202020, - 0x2020202063617365, 0x2022626f6f6c6561, 0x6e223a0a20202020, 0x2020202020202020, 0x2020202072657475, - 0x726e20313b0a2020, 0x2020202020202020, 0x2020636173652022, 0x6e756d626572223a, 0x0a20202020202020, - 0x2020202020202020, 0x2072657475726e20, 0x393b0a2020202020, 0x2020202020202063, 0x6173652022737472, - 0x696e67223a0a2020, 0x2020202020202020, 0x2020202020207265, 0x7475726e20746869, 0x732e737472696e67, - 0x506172616d657465, 0x7253697a65287661, 0x6c7565293b0a2020, 0x2020202020202020, 0x2020636173652022, - 0x6f626a656374223a, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e20, 0x746869732e6f626a, - 0x656374506172616d, 0x6574657253697a65, 0x2876616c7565293b, 0x0a20202020202020, 0x20202020207d0a20, + 0x20637572736f7220, 0x3d206f6666736574, 0x202b20353b0a2020, 0x2020202020202020, 0x20206c6574206c69, + 0x7374536861706520, 0x3d206e756c6c3b0a, 0x2020202020202020, 0x20202020636f6e73, 0x74206f7574657244, + 0x65707468203d2074, 0x6869732e6c697374, 0x456c656d656e7444, 0x657074683b0a2020, 0x2020202020202020, + 0x2020747279207b0a, 0x2020202020202020, 0x2020202020202020, 0x666f7220286c6574, 0x20696e646578203d, + 0x20303b20696e6465, 0x78203c20636f756e, 0x743b202b2b696e64, 0x657829207b0a2020, 0x2020202020202020, + 0x2020202020202020, 0x2020726571756972, 0x6542797465732876, 0x6965772c20637572, 0x736f722c20312c20, + 0x226c69737420656c, 0x656d656e74207479, 0x706522293b0a2020, 0x2020202020202020, 0x2020202020202020, + 0x2020696620287669, 0x65772e6765745569, 0x6e74382863757273, 0x6f7229203d3d3d20, 0x506172616d547970, + 0x652e657863657074, 0x696f6e290a202020, 0x2020202020202020, 0x2020202020202020, 0x2020202020746872, + 0x6f77206e65772054, 0x7970654572726f72, 0x2822412057656246, 0x726f6e74206c6973, 0x7420656c656d656e, + 0x742063616e6e6f74, 0x20626520616e2065, 0x7863657074696f6e, 0x22293b0a20202020, 0x2020202020202020, + 0x2020202020202020, 0x746869732e6c6973, 0x74456c656d656e74, 0x4465707468203d20, 0x303b20202f2f2065, + 0x61636820656c656d, 0x656e7420636f756e, 0x747320697473206f, 0x776e207475706c65, 0x206e657374696e67, + 0x0a20202020202020, 0x2020202020202020, 0x2020202020636f6e, 0x7374207b76616c75, 0x652c206279746573, + 0x2c2073686170657d, 0x203d20746869732e, 0x6465636f64655661, 0x6c75652876696577, 0x2e67657455696e74, + 0x3828637572736f72, 0x292c20766965772c, 0x20637572736f7229, 0x3b0a202020202020, 0x2020202020202020, + 0x2020202020207265, 0x71756972654c6973, 0x74456c656d656e74, 0x5368617065287368, 0x617065293b0a2020, + 0x2020202020202020, 0x2020202020202020, 0x2020696620286c69, 0x7374536861706520, 0x3d3d3d206e756c6c, + 0x290a202020202020, 0x2020202020202020, 0x2020202020202020, 0x20206c6973745368, 0x617065203d207368, + 0x6170653b0a202020, 0x2020202020202020, 0x2020202020202020, 0x20656c7365206966, 0x2028736861706520, + 0x213d3d206c697374, 0x5368617065290a20, 0x2020202020202020, 0x2020202020202020, 0x2020202020202074, + 0x68726f77206e6577, 0x2054797065457272, 0x6f72282257656246, 0x726f6e74206c6973, 0x7420656c656d656e, + 0x747320617265206e, 0x6f74206f66206f6e, 0x6520747970652229, 0x3b0a202020202020, 0x2020202020202020, + 0x2020202020207661, 0x6c7565732e707573, 0x682876616c756529, 0x3b0a202020202020, 0x2020202020202020, + 0x2020202020206375, 0x72736f72202b3d20, 0x62797465733b0a20, 0x2020202020202020, 0x202020202020207d, + 0x0a20202020202020, 0x20202020207d2066, 0x696e616c6c79207b, 0x0a20202020202020, 0x2020202020202020, + 0x20746869732e6c69, 0x7374456c656d656e, 0x744465707468203d, 0x206f757465724465, 0x7074683b0a202020, + 0x2020202020202020, 0x207d0a2020202020, 0x2020202020202072, 0x657475726e207b76, 0x616c75653a207661, + 0x6c7565732c206279, 0x7465733a20637572, 0x736f72202d206f66, 0x667365742c207368, 0x6170653a20224c22, + 0x7d3b0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, 0x2f205265736f6c76, 0x6573207468652065, + 0x6c656d656e742073, 0x70656320616e6420, 0x6c656e6774682070, 0x726566697820666f, 0x7220612074797065, + 0x642061727261792c, 0x2077686f73652068, 0x6561646572206973, 0x2032206279746573, 0x20696e207468650a, + 0x2020202020202020, 0x2f2f2f20636f6d70, 0x61637420736d616c, 0x6c41727261795538, 0x20666f726d20616e, + 0x6420352062797465, 0x73206f7468657277, 0x6973652e0a202020, 0x2020202020726561, 0x6454797065644172, + 0x7261794865616465, 0x7228747970652c20, 0x766965772c206f66, 0x6673657429207b0a, 0x2020202020202020, + 0x20202020636f6e73, 0x7420736d616c6c20, 0x3d2074797065203d, 0x3d3d20506172616d, 0x547970652e736d61, + 0x6c6c417272617955, 0x383b0a2020202020, 0x2020202020202063, 0x6f6e737420737065, 0x63203d20736d616c, + 0x6c203f207b2e2e2e, 0x6172726179436f64, 0x65732e6765742850, 0x6172616d54797065, 0x2e61727261795538, + 0x292c20636f6e7374, 0x727563746f723a20, 0x55696e7438417272, 0x61797d203a206172, 0x726179436f646573, + 0x2e67657428747970, 0x65293b0a20202020, 0x2020202020202020, 0x6966202821737065, 0x63290a2020202020, 0x2020202020202020, 0x2020207468726f77, 0x206e657720547970, 0x654572726f722860, 0x556e737570706f72, - 0x7465642057656246, 0x726f6e7420706172, 0x616d657465722074, 0x7970652027247b74, 0x7970656f66207661, - 0x6c75657d2760293b, 0x0a20202020202020, 0x207d0a0a20202020, 0x202020202f2f2f20, 0x54686520656e636f, - 0x6465642073697a65, 0x206f662061207374, 0x72696e673a206974, 0x7320686561646572, 0x20616e6420697473, - 0x205554462d382062, 0x797465732e0a2020, 0x2020202020207374, 0x72696e6750617261, 0x6d6574657253697a, - 0x652876616c756529, 0x207b0a2020202020, 0x2020202020202063, 0x6f6e7374206c656e, 0x677468203d206e65, - 0x772054657874456e, 0x636f64657228292e, 0x656e636f64652876, 0x616c7565292e6c65, 0x6e6774683b0a2020, - 0x2020202020202020, 0x202072657475726e, 0x20737472696e6748, 0x656164657253697a, 0x65286c656e677468, - 0x29202b206c656e67, 0x74683b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f205468652065, - 0x6e636f6465642073, 0x697a65206f662061, 0x206c6973742c2074, 0x75706c65206f7220, 0x7479706564206172, - 0x7261792e0a202020, 0x20202020206f626a, 0x656374506172616d, 0x6574657253697a65, 0x2876616c75652920, - 0x7b0a202020202020, 0x2020202020206966, 0x202876616c756520, 0x696e7374616e6365, 0x6f66205765624672, - 0x6f6e744c69737429, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e20, 0x746869732e6c6973, - 0x74506172616d6574, 0x657253697a652876, 0x616c7565293b0a20, 0x2020202020202020, 0x2020206966202841, - 0x727261792e697341, 0x727261792876616c, 0x756529290a202020, 0x2020202020202020, 0x2020202020726574, - 0x75726e2074686973, 0x2e7475706c655061, 0x72616d6574657253, 0x697a652876616c75, 0x65293b0a20202020, - 0x2020202020202020, 0x6966202869735479, 0x7065644172726179, 0x2876616c75652929, 0x0a20202020202020, - 0x2020202020202020, 0x2072657475726e20, 0x746869732e747970, 0x6564417272617950, 0x6172616d65746572, - 0x53697a652876616c, 0x7565293b0a202020, 0x2020202020202020, 0x207468726f77206e, 0x6577205479706545, - 0x72726f722860556e, 0x737570706f727465, 0x642057656246726f, 0x6e7420706172616d, 0x6574657220747970, - 0x652027247b747970, 0x656f662076616c75, 0x657d2760293b0a20, 0x202020202020207d, 0x0a0a202020202020, - 0x20202f2f2f205468, 0x652073686170652c, 0x2061732074686520, 0x6465636f64657220, 0x636f6d7075746573, - 0x2069742c206f6620, 0x612076616c756520, 0x61626f757420746f, 0x20626520656e636f, 0x6465642061732061, - 0x206c69737420656c, 0x656d656e742e0a20, 0x2020202020202076, 0x616c756553686170, 0x652876616c75652c, - 0x206465707468203d, 0x203029207b0a2020, 0x2020202020202020, 0x2020737769746368, 0x2028747970656f66, - 0x2076616c75652920, 0x7b0a202020202020, 0x2020202020206361, 0x73652022626f6f6c, 0x65616e223a0a2020, - 0x2020202020202020, 0x2020202020207265, 0x7475726e20226222, 0x3b0a202020202020, 0x2020202020206361, - 0x736520226e756d62, 0x6572223a0a202020, 0x2020202020202020, 0x2020202020726574, 0x75726e20226e223b, - 0x0a20202020202020, 0x2020202020636173, 0x652022737472696e, 0x67223a0a20202020, 0x2020202020202020, - 0x2020202072657475, 0x726e202273223b0a, 0x2020202020202020, 0x202020207d0a2020, 0x2020202020202020, - 0x2020696620287661, 0x6c756520696e7374, 0x616e63656f662057, 0x656246726f6e744c, 0x697374290a202020, - 0x2020202020202020, 0x2020202020726574, 0x75726e20224c223b, 0x0a20202020202020, 0x2020202020696620, - 0x2841727261792e69, 0x7341727261792876, 0x616c75652929207b, 0x0a20202020202020, 0x2020202020202020, - 0x202f2f20436f756e, 0x746564207768696c, 0x652064657363656e, 0x64696e673a20616e, 0x206172726179206e, - 0x6573746564207468, 0x6f7573616e647320, 0x6465657020697320, 0x7265667573656420, 0x617420746865206c, - 0x696d69742c206e6f, 0x7420616674657220, 0x6578686175737469, 0x6e67207468652073, 0x7461636b2e0a2020, - 0x2020202020202020, 0x2020202020206966, 0x2028646570746820, 0x3e3d206d61784c69, 0x73745475706c6544, - 0x65707468290a2020, 0x2020202020202020, 0x2020202020202020, 0x20207468726f7720, 0x6e65772054797065, - 0x4572726f72286057, 0x656246726f6e7420, 0x6c69737420656c65, 0x6d656e7473206e65, 0x7374207475706c65, - 0x73206174206d6f73, 0x7420247b6d61784c, 0x6973745475706c65, 0x44657074687d2064, 0x65657060293b0a20, - 0x2020202020202020, 0x2020202020202072, 0x657475726e206028, 0x247b76616c75652e, 0x6d617028656c656d, - 0x656e74203d3e2074, 0x6869732e76616c75, 0x6553686170652865, 0x6c656d656e742c20, 0x6465707468202b20, - 0x3129292e6a6f696e, 0x28222c22297d2960, 0x3b0a202020202020, 0x2020202020207d0a, 0x2020202020202020, - 0x2020202069662028, 0x6973547970656441, 0x727261792876616c, 0x7565292026262061, 0x7272617954797065, - 0x732e686173287661, 0x6c75652e636f6e73, 0x74727563746f7229, 0x290a202020202020, 0x2020202020202020, - 0x202072657475726e, 0x206061247b617272, 0x617954797065732e, 0x6765742876616c75, 0x652e636f6e737472, - 0x7563746f72292e63, 0x6f64657d603b0a20, 0x2020202020202020, 0x2020207468726f77, 0x206e657720547970, - 0x654572726f722860, 0x556e737570706f72, 0x7465642057656246, 0x726f6e7420706172, 0x616d657465722074, - 0x7970652027247b74, 0x7970656f66207661, 0x6c75657d2760293b, 0x0a20202020202020, 0x207d0a0a20202020, - 0x202020202f2f2f20, 0x54686520656e636f, 0x6465642073697a65, 0x206f662061206c69, 0x73742c2061667465, - 0x7220636865636b69, 0x6e67207468617420, 0x69747320656c656d, 0x656e747320686176, 0x65206f6e65207368, - 0x61706520616e6420, 0x686f6c64206e6f20, 0x6c6973742e0a2020, 0x2020202020206c69, 0x7374506172616d65, - 0x74657253697a6528, 0x6c69737429207b0a, 0x2020202020202020, 0x2020202069662028, 0x6c6973742e697465, - 0x6d732e6c656e6774, 0x68203e2030786666, 0x666666666666290a, 0x2020202020202020, 0x2020202020202020, - 0x7468726f77206e65, 0x772052616e676545, 0x72726f7228225765, 0x6246726f6e74206c, 0x697374732063616e, - 0x6e6f742065786365, 0x6564203432393439, 0x363732393520656c, 0x656d656e74732229, 0x3b0a202020202020, - 0x2020202020206c65, 0x7420736861706520, 0x3d206e756c6c3b0a, 0x2020202020202020, 0x20202020666f7220, - 0x28636f6e73742069, 0x74656d206f66206c, 0x6973742e6974656d, 0x7329207b0a202020, 0x2020202020202020, - 0x2020202020636f6e, 0x7374206974656d53, 0x68617065203d2074, 0x6869732e76616c75, 0x6553686170652869, - 0x74656d293b0a2020, 0x2020202020202020, 0x2020202020207265, 0x71756972654c6973, 0x74456c656d656e74, - 0x5368617065286974, 0x656d536861706529, 0x3b0a202020202020, 0x2020202020202020, 0x2020696620286974, - 0x656d536861706520, 0x3d3d3d20226e2220, 0x7c7c206974656d53, 0x68617065203d3d3d, 0x20226222290a2020, - 0x2020202020202020, 0x2020202020202020, 0x20207468726f7720, 0x6e65772054797065, 0x4572726f72282241, - 0x2057656246726f6e, 0x74206c6973742068, 0x6f6c647320737472, 0x696e67732c207479, 0x7065642061727261, - 0x7973206f72207475, 0x706c65733a207365, 0x6e64206e756d6265, 0x7273206173206120, 0x7479706564206172, - 0x72617922293b0a20, 0x2020202020202020, 0x2020202020202069, 0x6620287368617065, 0x203d3d3d206e756c, - 0x6c290a2020202020, 0x2020202020202020, 0x2020202020202073, 0x68617065203d2069, 0x74656d5368617065, - 0x3b0a202020202020, 0x2020202020202020, 0x2020656c73652069, 0x6620286974656d53, 0x6861706520213d3d, - 0x207368617065290a, 0x2020202020202020, 0x2020202020202020, 0x202020207468726f, 0x77206e6577205479, - 0x70654572726f7228, 0x2257656246726f6e, 0x74206c6973742065, 0x6c656d656e747320, 0x617265206e6f7420, - 0x6f66206f6e652074, 0x79706522293b0a20, 0x2020202020202020, 0x2020207d0a202020, 0x2020202020202020, - 0x2072657475726e20, 0x35202b206c697374, 0x2e6974656d732e72, 0x6564756365282873, 0x697a652c20697465, - 0x6d29203d3e207369, 0x7a65202b20746869, 0x732e706172616d65, 0x74657253697a6528, 0x6974656d292c2030, - 0x293b0a2020202020, 0x2020207d0a0a2020, 0x2020202020207475, 0x706c65506172616d, 0x6574657253697a65, - 0x2876616c75652920, 0x7b0a202020202020, 0x2020202020206966, 0x202876616c75652e, 0x6c656e677468203e, - 0x20323535290a2020, 0x2020202020202020, 0x2020202020207468, 0x726f77206e657720, 0x52616e6765457272, - 0x6f72282257656246, 0x726f6e7420747570, 0x6c65732063616e6e, 0x6f74206578636565, 0x642032353520656c, - 0x656d656e74732229, 0x3b0a202020202020, 0x2020202020207265, 0x7475726e2032202b, 0x2076616c75652e72, - 0x6564756365282873, 0x697a652c20656c65, 0x6d656e7429203d3e, 0x2073697a65202b20, 0x746869732e706172, - 0x616d657465725369, 0x7a6528656c656d65, 0x6e74292c2030293b, 0x0a20202020202020, 0x207d0a0a20202020, - 0x2020202074797065, 0x6441727261795061, 0x72616d6574657253, 0x697a652876616c75, 0x6529207b0a202020, - 0x2020202020202020, 0x2069662028216172, 0x7261795479706573, 0x2e6861732876616c, 0x75652e636f6e7374, - 0x727563746f722929, 0x0a20202020202020, 0x2020202020202020, 0x207468726f77206e, 0x6577205479706545, - 0x72726f722860556e, 0x737570706f727465, 0x6420747970656420, 0x617272617920247b, 0x76616c75652e636f, - 0x6e7374727563746f, 0x722e6e616d657d60, 0x293b0a2020202020, 0x2020202020202069, 0x66202876616c7565, - 0x2e6c656e67746820, 0x3e20307866666666, 0x66666666290a2020, 0x2020202020202020, 0x2020202020207468, - 0x726f77206e657720, 0x52616e6765457272, 0x6f72282254797065, 0x6420617272617973, 0x2063616e6e6f7420, - 0x6578636565642034, 0x3239343936373239, 0x3520656c656d656e, 0x747322293b0a2020, 0x2020202020202020, - 0x202072657475726e, 0x2074797065644172, 0x7261794865616465, 0x7253697a65287661, 0x6c756529202b2076, - 0x616c75652e627974, 0x654c656e6774683b, 0x0a20202020202020, 0x207d0a0a20202020, 0x20202020656e636f, - 0x6465506172616d65, 0x7465722876616c75, 0x652c20766965772c, 0x206f666673657429, 0x207b0a2020202020, - 0x2020202020202073, 0x7769746368202874, 0x7970656f66207661, 0x6c756529207b0a20, 0x2020202020202020, - 0x2020206361736520, 0x22626f6f6c65616e, 0x223a0a2020202020, 0x2020202020202020, 0x202020766965772e, - 0x73657455696e7438, 0x286f66667365742c, 0x2076616c7565203f, 0x20506172616d5479, 0x70652e626f6f6c65, - 0x616e54727565203a, 0x20506172616d5479, 0x70652e626f6f6c65, 0x616e46616c736529, 0x3b0a202020202020, - 0x2020202020202020, 0x202072657475726e, 0x20313b0a20202020, 0x2020202020202020, 0x6361736520226e75, - 0x6d626572223a0a20, 0x2020202020202020, 0x2020202020202076, 0x6965772e73657455, 0x696e7438286f6666, - 0x7365742c20506172, 0x616d547970652e6e, 0x756d626572293b0a, 0x2020202020202020, 0x2020202020202020, - 0x766965772e736574, 0x466c6f6174363428, 0x6f6666736574202b, 0x20312c2076616c75, 0x652c20746869732e, - 0x6c6974746c65456e, 0x6469616e293b0a20, 0x2020202020202020, 0x2020202020202072, 0x657475726e20393b, - 0x0a20202020202020, 0x2020202020636173, 0x652022737472696e, 0x67223a0a20202020, 0x2020202020202020, - 0x2020202072657475, 0x726e20746869732e, 0x656e636f64655374, 0x72696e672876616c, 0x75652c2076696577, - 0x2c206f6666736574, 0x293b0a2020202020, 0x2020202020202063, 0x61736520226f626a, 0x656374223a0a2020, - 0x2020202020202020, 0x2020202020207265, 0x7475726e20746869, 0x732e656e636f6465, 0x4f626a6563742876, - 0x616c75652c207669, 0x65772c206f666673, 0x6574293b0a202020, 0x2020202020202020, 0x207d0a2020202020, - 0x2020202020202074, 0x68726f77206e6577, 0x2054797065457272, 0x6f722860556e7375, 0x70706f7274656420, - 0x57656246726f6e74, 0x20706172616d6574, 0x6572207479706520, 0x27247b747970656f, 0x662076616c75657d, - 0x2760293b0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x2f2f2f2057726974, 0x6573206120737472, - 0x696e672077697468, 0x2074686520736d61, 0x6c6c657374206865, 0x6164657220697473, 0x205554462d38206c, - 0x656e67746820616c, 0x6c6f777320616e64, 0x2072657475726e73, 0x2074686520627974, 0x6573207772697474, - 0x656e2e0a20202020, 0x20202020656e636f, 0x6465537472696e67, 0x2876616c75652c20, 0x766965772c206f66, - 0x6673657429207b0a, 0x2020202020202020, 0x20202020636f6e73, 0x7420627974657320, 0x3d206e6577205465, - 0x7874456e636f6465, 0x7228292e656e636f, 0x64652876616c7565, 0x293b0a2020202020, 0x2020202020202063, - 0x6f6e737420686561, 0x64657253697a6520, 0x3d20737472696e67, 0x4865616465725369, 0x7a65286279746573, - 0x2e6c656e67746829, 0x3b0a202020202020, 0x2020202020206966, 0x2028686561646572, 0x53697a65203d3d3d, - 0x203229207b0a2020, 0x2020202020202020, 0x2020202020207669, 0x65772e7365745569, 0x6e7438286f666673, - 0x65742c2050617261, 0x6d547970652e736d, 0x616c6c537472696e, 0x67293b0a20202020, 0x2020202020202020, - 0x2020202076696577, 0x2e73657455696e74, 0x38286f6666736574, 0x202b20312c206279, 0x7465732e6c656e67, - 0x7468293b0a202020, 0x2020202020202020, 0x207d20656c736520, 0x6966202868656164, 0x657253697a65203d, - 0x3d3d203329207b0a, 0x2020202020202020, 0x2020202020202020, 0x766965772e736574, 0x55696e7438286f66, - 0x667365742c205061, 0x72616d547970652e, 0x737472696e67293b, 0x0a20202020202020, 0x2020202020202020, - 0x20766965772e7365, 0x7455696e74313628, 0x6f6666736574202b, 0x20312c2062797465, 0x732e6c656e677468, - 0x2c20746869732e6c, 0x6974746c65456e64, 0x69616e293b0a2020, 0x2020202020202020, 0x20207d20656c7365, - 0x207b0a2020202020, 0x2020202020202020, 0x202020766965772e, 0x73657455696e7438, 0x286f66667365742c, - 0x20506172616d5479, 0x70652e6c6f6e6753, 0x7472696e67293b0a, 0x2020202020202020, 0x2020202020202020, - 0x766965772e736574, 0x55696e743332286f, 0x6666736574202b20, 0x312c206279746573, 0x2e6c656e6774682c, - 0x20746869732e6c69, 0x74746c65456e6469, 0x616e293b0a202020, 0x2020202020202020, 0x207d0a2020202020, - 0x202020202020206e, 0x65772055696e7438, 0x4172726179287669, 0x65772e6275666665, 0x722c20766965772e, - 0x627974654f666673, 0x6574202b206f6666, 0x736574202b206865, 0x6164657253697a65, 0x2c2062797465732e, - 0x6c656e677468292e, 0x7365742862797465, 0x73293b0a20202020, 0x2020202020202020, 0x72657475726e2068, - 0x656164657253697a, 0x65202b2062797465, 0x732e6c656e677468, 0x3b0a202020202020, 0x20207d0a0a202020, - 0x20202020202f2f2f, 0x2057726974657320, 0x61206c6973742c20, 0x7475706c65206f72, 0x2074797065642061, - 0x7272617920616e64, 0x2072657475726e73, 0x2074686520627974, 0x6573207772697474, 0x656e2e0a20202020, - 0x20202020656e636f, 0x64654f626a656374, 0x2876616c75652c20, 0x766965772c206f66, 0x6673657429207b0a, - 0x2020202020202020, 0x2020202069662028, 0x76616c756520696e, 0x7374616e63656f66, 0x2057656246726f6e, - 0x744c697374290a20, 0x2020202020202020, 0x2020202020202072, 0x657475726e207468, 0x69732e656e636f64, - 0x654c697374287661, 0x6c75652c20766965, 0x772c206f66667365, 0x74293b0a20202020, 0x2020202020202020, - 0x6966202841727261, 0x792e697341727261, 0x792876616c756529, 0x290a202020202020, 0x2020202020202020, - 0x202072657475726e, 0x20746869732e656e, 0x636f64655475706c, 0x652876616c75652c, 0x20766965772c206f, - 0x6666736574293b0a, 0x2020202020202020, 0x2020202069662028, 0x6973547970656441, 0x727261792876616c, - 0x756529290a202020, 0x2020202020202020, 0x2020202020726574, 0x75726e2074686973, 0x2e656e636f646554, - 0x7970656441727261, 0x792876616c75652c, 0x20766965772c206f, 0x6666736574293b0a, 0x2020202020202020, - 0x202020207468726f, 0x77206e6577205479, 0x70654572726f7228, 0x60556e737570706f, 0x7274656420576562, - 0x46726f6e74207061, 0x72616d6574657220, 0x747970652027247b, 0x747970656f662076, 0x616c75657d276029, - 0x3b0a202020202020, 0x20207d0a0a202020, 0x20202020202f2f2f, 0x2057726974657320, 0x61206c6973742061, - 0x7420606f66667365, 0x746020616e642072, 0x657475726e732074, 0x6865206279746573, 0x207772697474656e, - 0x2e0a202020202020, 0x2020656e636f6465, 0x4c697374286c6973, 0x742c20766965772c, 0x206f666673657429, - 0x207b0a2020202020, 0x2020202020202076, 0x6965772e73657455, 0x696e7438286f6666, 0x7365742c20506172, - 0x616d547970652e6c, 0x697374293b0a2020, 0x2020202020202020, 0x2020766965772e73, 0x657455696e743332, - 0x286f666673657420, 0x2b20312c206c6973, 0x742e6974656d732e, 0x6c656e6774682c20, 0x746869732e6c6974, - 0x746c65456e646961, 0x6e293b0a20202020, 0x2020202020202020, 0x6c65742077726974, 0x74656e203d20353b, - 0x0a20202020202020, 0x2020202020666f72, 0x2028636f6e737420, 0x6974656d206f6620, 0x6c6973742e697465, - 0x6d73290a20202020, 0x2020202020202020, 0x2020202077726974, 0x74656e202b3d2074, 0x6869732e656e636f, - 0x6465506172616d65, 0x746572286974656d, 0x2c20766965772c20, 0x6f6666736574202b, 0x207772697474656e, - 0x293b0a2020202020, 0x2020202020202072, 0x657475726e207772, 0x697474656e3b0a20, 0x202020202020207d, - 0x0a0a202020202020, 0x2020656e636f6465, 0x5475706c65287661, 0x6c75652c20766965, 0x772c206f66667365, - 0x7429207b0a202020, 0x2020202020202020, 0x20766965772e7365, 0x7455696e7438286f, 0x66667365742c2050, - 0x6172616d54797065, 0x2e7475706c65293b, 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, - 0x7438286f66667365, 0x74202b20312c2076, 0x616c75652e6c656e, 0x677468293b0a2020, 0x2020202020202020, - 0x20206c6574207772, 0x697474656e203d20, 0x323b0a2020202020, 0x2020202020202066, 0x6f722028636f6e73, - 0x7420656c656d656e, 0x74206f662076616c, 0x7565290a20202020, 0x2020202020202020, 0x2020202077726974, - 0x74656e202b3d2074, 0x6869732e656e636f, 0x6465506172616d65, 0x74657228656c656d, 0x656e742c20766965, - 0x772c206f66667365, 0x74202b2077726974, 0x74656e293b0a2020, 0x2020202020202020, 0x202072657475726e, - 0x207772697474656e, 0x3b0a202020202020, 0x20207d0a0a202020, 0x2020202020656e63, 0x6f64655479706564, - 0x4172726179287661, 0x6c75652c20766965, 0x772c206f66667365, 0x7429207b0a202020, 0x2020202020202020, - 0x20636f6e73742073, 0x706563203d206172, 0x7261795479706573, 0x2e6765742876616c, 0x75652e636f6e7374, - 0x727563746f72293b, 0x0a20202020202020, 0x2020202020696620, 0x282173706563290a, 0x2020202020202020, - 0x2020202020202020, 0x7468726f77206e65, 0x7720547970654572, 0x726f722860556e73, 0x7570706f72746564, - 0x2074797065642061, 0x7272617920247b76, 0x616c75652e636f6e, 0x7374727563746f72, 0x2e6e616d657d6029, - 0x3b0a202020202020, 0x202020202020636f, 0x6e73742068656164, 0x657253697a65203d, 0x2074797065644172, - 0x7261794865616465, 0x7253697a65287661, 0x6c7565293b0a2020, 0x2020202020202020, 0x2020766965772e73, - 0x657455696e743828, 0x6f66667365742c20, 0x6865616465725369, 0x7a65203d3d3d2032, 0x203f20506172616d, - 0x547970652e736d61, 0x6c6c417272617955, 0x38203a2073706563, 0x2e636f6465293b0a, 0x2020202020202020, - 0x2020202069662028, 0x6865616465725369, 0x7a65203d3d3d2032, 0x290a202020202020, 0x2020202020202020, - 0x2020766965772e73, 0x657455696e743828, 0x6f6666736574202b, 0x20312c2076616c75, 0x652e6c656e677468, - 0x293b0a2020202020, 0x2020202020202065, 0x6c73650a20202020, 0x2020202020202020, 0x2020202076696577, - 0x2e73657455696e74, 0x3332286f66667365, 0x74202b20312c2076, 0x616c75652e6c656e, 0x6774682c20746869, - 0x732e6c6974746c65, 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020666f72, 0x20286c657420696e, - 0x646578203d20303b, 0x20696e646578203c, 0x2076616c75652e6c, 0x656e6774683b202b, 0x2b696e646578290a, - 0x2020202020202020, 0x2020202020202020, 0x766965775b737065, 0x632e736574746572, 0x5d286f6666736574, - 0x202b206865616465, 0x7253697a65202b20, 0x696e646578202a20, 0x737065632e627974, 0x65732c2076616c75, - 0x655b696e6465785d, 0x2c20746869732e6c, 0x6974746c65456e64, 0x69616e293b0a2020, 0x2020202020202020, - 0x202072657475726e, 0x2068656164657253, 0x697a65202b207661, 0x6c75652e62797465, 0x4c656e6774683b0a, - 0x2020202020202020, 0x7d0a202020207d0a, 0x0a202020202f2f20, 0x4578706f73656420, 0x286265796f6e6420, - 0x7468652064656661, 0x756c742060776562, 0x46726f6e74602073, 0x696e676c65746f6e, 0x2920736f20746573, - 0x74732063616e2063, 0x6f6e737472756374, 0x206164646974696f, 0x6e616c2062726964, 0x6765730a20202020, - 0x2f2f20706f696e74, 0x6564206174206120, 0x646966666572656e, 0x742055524c2c2065, 0x2e672e20746f2065, - 0x7865726369736520, 0x74686520696e6974, 0x69616c2d636f6e6e, 0x656374696f6e2d66, 0x61696c7572652070, - 0x6174682e0a202020, 0x20676c6f62616c2e, 0x57656246726f6e74, 0x427269646765203d, 0x2057656246726f6e, - 0x744272696467653b, 0x0a20202020676c6f, 0x62616c2e77656246, 0x726f6e74203d206e, 0x6577205765624672, - 0x6f6e744272696467, 0x6528293b0a7d2928, 0x676c6f62616c5468, 0x6973293b0a000000 + 0x7465642074797065, 0x6420617272617920, 0x636f646520247b74, 0x7970657d60293b0a, 0x2020202020202020, + 0x20202020636f6e73, 0x7420686561646572, 0x53697a65203d2073, 0x6d616c6c203f2032, 0x203a20353b0a2020, + 0x2020202020202020, 0x2020726571756972, 0x6542797465732876, 0x6965772c206f6666, 0x7365742c20686561, + 0x64657253697a652c, 0x2022617272617920, 0x6865616465722229, 0x3b0a202020202020, 0x202020202020636f, + 0x6e7374206c656e67, 0x7468203d20736d61, 0x6c6c203f20766965, 0x772e67657455696e, 0x7438286f66667365, + 0x74202b203129203a, 0x20766965772e6765, 0x7455696e74333228, 0x6f6666736574202b, 0x20312c2074686973, + 0x2e6c6974746c6545, 0x6e6469616e293b0a, 0x2020202020202020, 0x2020202072657475, 0x726e207b73706563, + 0x2c20686561646572, 0x53697a652c206c65, 0x6e6774687d3b0a20, 0x202020202020207d, 0x0a0a202020202020, + 0x20206465636f6465, 0x5479706564417272, 0x617928747970652c, 0x20766965772c206f, 0x666673657429207b, + 0x0a20202020202020, 0x2020202020636f6e, 0x7374207b73706563, 0x2c20686561646572, 0x53697a652c206c65, + 0x6e6774687d203d20, 0x746869732e726561, 0x6454797065644172, 0x7261794865616465, 0x7228747970652c20, + 0x766965772c206f66, 0x66736574293b0a20, 0x2020202020202020, 0x202020636f6e7374, 0x20627974654c656e, + 0x677468203d206c65, 0x6e677468202a2073, 0x7065632e62797465, 0x733b0a2020202020, 0x2020202020202069, + 0x662028214e756d62, 0x65722e6973536166, 0x65496e7465676572, 0x28627974654c656e, 0x67746829290a2020, + 0x2020202020202020, 0x2020202020207468, 0x726f77206e657720, 0x52616e6765457272, 0x6f72282254797065, + 0x6420617272617920, 0x6c656e6774682069, 0x7320746f6f206c61, 0x72676522293b0a20, 0x2020202020202020, + 0x2020207265717569, 0x7265427974657328, 0x766965772c206f66, 0x66736574202b2068, 0x656164657253697a, + 0x652c20627974654c, 0x656e6774682c2022, 0x6172726179207061, 0x796c6f616422293b, 0x0a0a202020202020, + 0x202020202020636f, 0x6e73742072657375, 0x6c74203d206e6577, 0x20737065632e636f, 0x6e7374727563746f, + 0x72286c656e677468, 0x293b0a2020202020, 0x2020202020202063, 0x6f6e737420706179, 0x6c6f6164203d206f, + 0x6666736574202b20, 0x6865616465725369, 0x7a653b0a20202020, 0x2020202020202020, 0x666f7220286c6574, + 0x20696e646578203d, 0x20303b20696e6465, 0x78203c206c656e67, 0x74683b202b2b696e, 0x646578290a202020, + 0x2020202020202020, 0x2020202020726573, 0x756c745b696e6465, 0x785d203d20766965, 0x775b737065632e67, + 0x65747465725d2870, 0x61796c6f6164202b, 0x20696e646578202a, 0x20737065632e6279, 0x7465732c20746869, + 0x732e6c6974746c65, 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020726574, 0x75726e207b76616c, + 0x75653a2072657375, 0x6c742c2062797465, 0x733a206865616465, 0x7253697a65202b20, 0x627974654c656e67, + 0x74687d3b0a202020, 0x20202020207d0a0a, 0x2020202020202020, 0x2f2f2f204d61726b, 0x7320606974656d73, + 0x6020746f20626520, 0x73656e7420617320, 0x61206c6973743a20, 0x616e79206e756d62, 0x6572206f6620656c, + 0x656d656e7473206f, 0x66206f6e65207479, 0x70652c2065616368, 0x206120737472696e, 0x672c206120747970, + 0x6564206172726179, 0x206f722061207475, 0x706c652c20776869, 0x63680a2020202020, 0x2020202f2f2f2043, + 0x2b2b207265636569, 0x7665732061732061, 0x207374643a3a7665, 0x63746f722e204e75, 0x6d6265727320676f, + 0x2061732061207479, 0x7065642061727261, 0x79202861206c6973, 0x74206f66206e756d, 0x62657273206f7220, + 0x626f6f6c65616e73, 0x2069732072656675, 0x736564292e204120, 0x706c61696e0a2020, 0x2020202020202f2f, + 0x2f20617272617920, 0x6973206120747570, 0x6c65206f66206174, 0x206d6f7374203235, 0x3520656c656d656e, + 0x7473206f6620616e, 0x792074797065732e, 0x0a20202020202020, 0x206c697374286974, 0x656d7329207b0a20, + 0x2020202020202020, 0x2020207265747572, 0x6e206e6577205765, 0x6246726f6e744c69, 0x7374286974656d73, + 0x293b0a2020202020, 0x2020207d0a0a2020, 0x2020202020206370, 0x7046756e6374696f, 0x6e286e616d652920, + 0x7b0a202020202020, 0x2020202020207265, 0x7475726e20282e2e, 0x2e6172677329203d, 0x3e20746869732e63, + 0x616c6c4370704675, 0x6e6374696f6e286e, 0x616d652c20617267, 0x73293b0a20202020, 0x202020207d0a0a20, + 0x2020202020202063, 0x616c6c4370704675, 0x6e6374696f6e286e, 0x616d652c20617267, 0x7329207b0a202020, + 0x2020202020202020, 0x2072657475726e20, 0x6e65772050726f6d, 0x6973652828726573, 0x6f6c76652c207265, + 0x6a65637429203d3e, 0x207b0a2020202020, 0x2020202020202020, 0x2020206966202874, 0x6869732e70726f62, + 0x65290a2020202020, 0x2020202020202020, 0x202020202020205b, 0x7265736f6c76652c, 0x2072656a6563745d, + 0x203d20746869732e, 0x70726f62652e6361, 0x6c6c286e616d652c, 0x207265736f6c7665, 0x2c2072656a656374, + 0x293b0a2020202020, 0x2020202020202020, 0x2020206c65742063, 0x616c6c4964203d20, 0x303b0a2020202020, + 0x2020202020202020, 0x202020747279207b, 0x0a20202020202020, 0x2020202020202020, 0x2020202020696620, + 0x28746869732e7374, 0x61746520213d3d20, 0x226c696e6b656422, 0x290a202020202020, 0x2020202020202020, + 0x2020202020202020, 0x20207468726f7720, 0x6272696467654572, 0x726f722842726964, 0x6765436f64652e64, + 0x6973636f6e6e6563, 0x7465642c20225765, 0x6246726f6e742062, 0x7269646765206973, 0x206e6f7420636f6e, + 0x6e65637465642229, 0x3b0a202020202020, 0x2020202020202020, 0x202020202020636f, 0x6e73742076616c75, + 0x6573203d205b6e61, 0x6d652c202e2e2e61, 0x7267735d3b0a2020, 0x2020202020202020, 0x2020202020202020, + 0x2020696620287661, 0x6c7565732e6c656e, 0x677468203e203235, 0x35290a2020202020, 0x2020202020202020, + 0x2020202020202020, 0x2020207468726f77, 0x206e65772052616e, 0x67654572726f7228, 0x22412066756e6374, + 0x696f6e2063616c6c, 0x2063616e6e6f7420, 0x636f6e7461696e20, 0x6d6f726520746861, 0x6e2032353520746f, + 0x702d6c6576656c20, 0x76616c7565732229, 0x3b0a202020202020, 0x2020202020202020, 0x202020202020636f, + 0x6e7374207061796c, 0x6f616453697a6520, 0x3d2076616c756573, 0x2e72656475636528, 0x2873697a652c2076, + 0x616c756529203d3e, 0x2073697a65202b20, 0x746869732e706172, 0x616d657465725369, 0x7a652876616c7565, + 0x292c2030293b0a20, 0x2020202020202020, 0x2020202020202020, 0x202020746869732e, 0x636865636b4d6573, + 0x7361676553697a65, 0x287061796c6f6164, 0x53697a65293b0a20, 0x2020202020202020, 0x2020202020202020, + 0x202020636f6e7374, 0x2062756666657220, 0x3d206e6577204172, 0x7261794275666665, 0x722838202b207061, + 0x796c6f616453697a, 0x65293b0a20202020, 0x2020202020202020, 0x2020202020202020, 0x636f6e7374207669, + 0x6577203d206e6577, 0x2044617461566965, 0x7728627566666572, 0x293b0a2020202020, 0x2020202020202020, + 0x2020202020202063, 0x616c6c4964203d20, 0x746869732e616c6c, 0x6f6361746543616c, 0x6c496428293b0a20, + 0x2020202020202020, 0x2020202020202020, 0x202020766965772e, 0x73657455696e7438, 0x28302c20436f6d6d, + 0x616e642e63616c6c, 0x46756e6374696f6e, 0x293b0a2020202020, 0x2020202020202020, 0x2020202020202076, + 0x6965772e73657455, 0x696e743828312c20, 0x76616c7565732e6c, 0x656e677468293b0a, 0x2020202020202020, + 0x2020202020202020, 0x2020202076696577, 0x2e73657455696e74, 0x313628322c206361, 0x6c6c49642c207468, + 0x69732e6c6974746c, 0x65456e6469616e29, 0x3b0a202020202020, 0x2020202020202020, 0x2020202020207669, + 0x65772e7365745569, 0x6e74333228342c20, 0x7061796c6f616453, 0x697a652c20746869, 0x732e6c6974746c65, + 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020202020, 0x20202020206c6574, 0x20637572736f7220, + 0x3d20383b0a202020, 0x2020202020202020, 0x2020202020202020, 0x20666f722028636f, 0x6e73742076616c75, + 0x65206f662076616c, 0x756573290a202020, 0x2020202020202020, 0x2020202020202020, 0x2020202020637572, + 0x736f72202b3d2074, 0x6869732e656e636f, 0x6465506172616d65, 0x7465722876616c75, 0x652c20766965772c, + 0x20637572736f7229, 0x3b0a202020202020, 0x2020202020202020, 0x2020202020207468, 0x69732e70656e6469, + 0x6e6743616c6c732e, 0x7365742863616c6c, 0x49642c207b726573, 0x6f6c76652c207265, 0x6a6563742c206e61, + 0x6d657d293b0a2020, 0x2020202020202020, 0x2020202020202020, 0x2020746869732e73, 0x6f636b65742e7365, + 0x6e64286275666665, 0x72293b0a20202020, 0x2020202020202020, 0x202020207d206361, 0x7463682028657272, + 0x6f7229207b0a2020, 0x2020202020202020, 0x2020202020202020, 0x2020696620286361, 0x6c6c496420213d3d, + 0x2030290a20202020, 0x2020202020202020, 0x2020202020202020, 0x2020202074686973, 0x2e70656e64696e67, + 0x43616c6c732e6465, 0x6c6574652863616c, 0x6c4964293b0a2020, 0x2020202020202020, 0x2020202020202020, + 0x202072656a656374, 0x286572726f72293b, 0x0a20202020202020, 0x2020202020202020, 0x207d0a2020202020, + 0x202020202020207d, 0x293b0a2020202020, 0x2020207d0a0a2020, 0x2020202020202f2f, 0x2f20526566757365, + 0x732061206d657373, 0x6167652074686520, 0x432b2b2073696465, 0x20776f756c642063, 0x6c6f736520746865, + 0x20636f6e6e656374, 0x696f6e20666f723a, 0x2074686520382d62, 0x7974652068656164, 0x657220616e642074, + 0x6865207061796c6f, 0x616420746f676574, 0x6865722e0a202020, 0x2020202020636865, 0x636b4d6573736167, + 0x6553697a65287061, 0x796c6f616453697a, 0x6529207b0a202020, 0x2020202020202020, 0x206966202838202b, + 0x207061796c6f6164, 0x53697a65203e2074, 0x6869732e6d61784d, 0x6573736167654279, 0x746573290a202020, + 0x2020202020202020, 0x2020202020746872, 0x6f77206e65772052, 0x616e67654572726f, 0x7228605765624672, + 0x6f6e74206d657373, 0x616765206f662024, 0x7b38202b20706179, 0x6c6f616453697a65, 0x7d20627974657320, + 0x6578636565647320, 0x746865206d617869, 0x6d756d206f662024, 0x7b746869732e6d61, 0x784d657373616765, + 0x42797465737d2062, 0x7974657360293b0a, 0x2020202020202020, 0x7d0a0a2020202020, 0x202020616c6c6f63, + 0x61746543616c6c49, 0x642829207b0a2020, 0x2020202020202020, 0x2020666f7220286c, 0x657420617474656d, + 0x707473203d20303b, 0x20617474656d7074, 0x73203c2030786666, 0x66663b202b2b6174, 0x74656d7074732920, + 0x7b0a202020202020, 0x2020202020202020, 0x2020636f6e737420, 0x63616e6469646174, 0x65203d2074686973, + 0x2e6e65787443616c, 0x6c49643b0a202020, 0x2020202020202020, 0x2020202020746869, 0x732e6e6578744361, + 0x6c6c4964203d2074, 0x6869732e6e657874, 0x43616c6c4964203d, 0x3d3d203078666666, 0x66203f2031203a20, + 0x746869732e6e6578, 0x7443616c6c496420, 0x2b20313b0a202020, 0x2020202020202020, 0x2020202020696620, + 0x2821746869732e70, 0x656e64696e674361, 0x6c6c732e68617328, 0x63616e6469646174, 0x6529290a20202020, + 0x2020202020202020, 0x2020202020202020, 0x72657475726e2063, 0x616e646964617465, 0x3b0a202020202020, + 0x2020202020207d0a, 0x2020202020202020, 0x202020207468726f, 0x77206e6577204572, 0x726f722822546f6f, + 0x206d616e79206f75, 0x747374616e64696e, 0x672057656246726f, 0x6e742063616c6c73, 0x22293b0a20202020, + 0x202020207d0a0a20, 0x2020202020202073, 0x656e6446756e6374, 0x696f6e5265747572, 0x6e2863616c6c4964, + 0x2c2076616c756529, 0x207b0a2020202020, 0x2020202020202063, 0x6f6e73742076616c, 0x756573203d207661, + 0x6c7565203d3d3d20, 0x756e646566696e65, 0x64203f205b5d203a, 0x205b76616c75655d, 0x3b0a202020202020, + 0x202020202020636f, 0x6e7374207061796c, 0x6f616453697a6520, 0x3d2076616c756573, 0x2e72656475636528, + 0x2873697a652c2069, 0x74656d29203d3e20, 0x73697a65202b2074, 0x6869732e70617261, 0x6d6574657253697a, + 0x65286974656d292c, 0x2030293b0a202020, 0x2020202020202020, 0x20746869732e6368, 0x65636b4d65737361, + 0x676553697a652870, 0x61796c6f61645369, 0x7a65293b0a202020, 0x2020202020202020, 0x20636f6e73742062, + 0x7566666572203d20, 0x6e65772041727261, 0x7942756666657228, 0x38202b207061796c, 0x6f616453697a6529, + 0x3b0a202020202020, 0x202020202020636f, 0x6e73742076696577, 0x203d206e65772044, 0x6174615669657728, + 0x627566666572293b, 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, 0x743828302c20436f, + 0x6d6d616e642e6675, 0x6e6374696f6e5265, 0x7475726e293b0a20, 0x2020202020202020, 0x202020766965772e, + 0x73657455696e7438, 0x28312c2076616c75, 0x65732e6c656e6774, 0x68293b0a20202020, 0x2020202020202020, + 0x766965772e736574, 0x55696e7431362832, 0x2c2063616c6c4964, 0x2c20746869732e6c, 0x6974746c65456e64, + 0x69616e293b0a2020, 0x2020202020202020, 0x2020766965772e73, 0x657455696e743332, 0x28342c207061796c, + 0x6f616453697a652c, 0x20746869732e6c69, 0x74746c65456e6469, 0x616e293b0a202020, 0x2020202020202020, + 0x206c657420637572, 0x736f72203d20383b, 0x0a20202020202020, 0x2020202020666f72, 0x2028636f6e737420, + 0x6974656d206f6620, 0x76616c756573290a, 0x2020202020202020, 0x2020202020202020, 0x637572736f72202b, + 0x3d20746869732e65, 0x6e636f6465506172, 0x616d657465722869, 0x74656d2c20766965, 0x772c20637572736f, + 0x72293b0a20202020, 0x2020202020202020, 0x746869732e736f63, 0x6b65742e73656e64, 0x2862756666657229, + 0x3b0a202020202020, 0x20207d0a0a202020, 0x20202020202f2f2f, 0x2052656a65637473, 0x2074686520432b2b, + 0x2063616c6c206063, 0x616c6c4964602077, 0x6974682074686520, 0x6d65737361676520, 0x616e642074686520, + 0x636f6465206f6620, 0x606572726f726020, 0x287468652067656e, 0x6572696320636f64, 0x65207768656e2069, + 0x7420686173206e6f, 0x6e65206f72206120, 0x7265736572766564, 0x206f6e65292e0a20, 0x2020202020202073, + 0x656e6446756e6374, 0x696f6e4572726f72, 0x2863616c6c49642c, 0x206572726f722920, 0x7b0a202020202020, + 0x202020202020636f, 0x6e7374206d657373, 0x616765203d206578, 0x63657074696f6e54, 0x657874286572726f, + 0x72293b0a20202020, 0x2020202020202020, 0x636f6e737420636f, 0x6465203d206e6577, 0x2054657874456e63, + 0x6f64657228292e65, 0x6e636f6465286578, 0x63657074696f6e43, 0x6f6465286572726f, 0x7229293b0a202020, + 0x2020202020202020, 0x20636f6e73742077, 0x686f6c65203d206e, 0x6577205465787445, 0x6e636f6465722829, + 0x2e656e636f646528, 0x6d65737361676529, 0x3b0a202020202020, 0x2020202020202f2f, 0x2041206d65737361, + 0x6765206c6f6e6765, 0x72207468616e2074, 0x68652031362d6269, 0x74206c656e677468, 0x2c206f7220746861, + 0x6e20776861742074, 0x6865206d6178696d, 0x756d206d65737361, 0x67652073697a6520, 0x6c65617665732061, + 0x6674657220746865, 0x20382d6279746520, 0x6865616465722c20, 0x7468650a20202020, 0x2020202020202020, + 0x2f2f20636f646520, 0x616e642074686520, 0x74776f2073697a65, 0x732c206973206375, 0x74206265666f7265, + 0x2074686520666972, 0x7374205554462d38, 0x2063686172616374, 0x6572207468617420, 0x776f756c64206e6f, + 0x7420666974207768, 0x6f6c652e0a202020, 0x2020202020202020, 0x20636f6e73742072, 0x6f6f6d203d204d61, + 0x74682e6d61782830, 0x2c20746869732e6d, 0x61784d6573736167, 0x654279746573202d, 0x203132202d20636f, + 0x64652e6c656e6774, 0x68293b0a20202020, 0x2020202020202020, 0x6c65742063757420, 0x3d204d6174682e6d, + 0x696e2877686f6c65, 0x2e6c656e6774682c, 0x2036353533352c20, 0x726f6f6d293b0a20, 0x2020202020202020, + 0x2020207768696c65, 0x2028637574203e20, 0x3020262620637574, 0x203c2077686f6c65, 0x2e6c656e67746820, + 0x2626202877686f6c, 0x655b6375745d2026, 0x203078633029203d, 0x3d3d203078383029, 0x0a20202020202020, + 0x2020202020202020, 0x202d2d6375743b0a, 0x2020202020202020, 0x20202020636f6e73, 0x7420627974657320, + 0x3d2077686f6c652e, 0x7375626172726179, 0x28302c2063757429, 0x3b0a202020202020, 0x202020202020636f, + 0x6e73742062756666, 0x6572203d206e6577, 0x2041727261794275, 0x6666657228313220, 0x2b20636f64652e6c, + 0x656e677468202b20, 0x62797465732e6c65, 0x6e677468293b0a20, 0x2020202020202020, 0x202020636f6e7374, + 0x2076696577203d20, 0x6e65772044617461, 0x5669657728627566, 0x666572293b0a2020, 0x2020202020202020, + 0x2020766965772e73, 0x657455696e743828, 0x302c20436f6d6d61, 0x6e642e66756e6374, 0x696f6e5265747572, + 0x6e293b0a20202020, 0x2020202020202020, 0x766965772e736574, 0x55696e743828312c, 0x2031293b0a202020, + 0x2020202020202020, 0x20766965772e7365, 0x7455696e74313628, 0x322c2063616c6c49, 0x642c20746869732e, + 0x6c6974746c65456e, 0x6469616e293b0a20, 0x2020202020202020, 0x202020766965772e, 0x73657455696e7433, + 0x3228342c2034202b, 0x20636f64652e6c65, 0x6e677468202b2062, 0x797465732e6c656e, 0x6774682c20746869, + 0x732e6c6974746c65, 0x456e6469616e293b, 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, + 0x743828382c205061, 0x72616d547970652e, 0x657863657074696f, 0x6e293b0a20202020, 0x2020202020202020, + 0x766965772e736574, 0x55696e743828392c, 0x20636f64652e6c65, 0x6e677468293b0a20, 0x2020202020202020, + 0x2020206e65772055, 0x696e743841727261, 0x7928627566666572, 0x2c203130292e7365, 0x7428636f6465293b, + 0x0a20202020202020, 0x2020202020766965, 0x772e73657455696e, 0x743136283130202b, 0x20636f64652e6c65, + 0x6e6774682c206279, 0x7465732e6c656e67, 0x74682c2074686973, 0x2e6c6974746c6545, 0x6e6469616e293b0a, + 0x2020202020202020, 0x202020206e657720, 0x55696e7438417272, 0x6179286275666665, 0x722c203132202b20, + 0x636f64652e6c656e, 0x677468292e736574, 0x286279746573293b, 0x0a20202020202020, 0x2020202020746869, + 0x732e736f636b6574, 0x2e73656e64286275, 0x66666572293b0a20, 0x202020202020207d, 0x0a0a202020202020, + 0x2020706172616d65, 0x74657253697a6528, 0x76616c756529207b, 0x0a20202020202020, 0x2020202020737769, + 0x7463682028747970, 0x656f662076616c75, 0x6529207b0a202020, 0x2020202020202020, 0x2063617365202262, + 0x6f6f6c65616e223a, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e20, 0x313b0a2020202020, + 0x2020202020202063, 0x61736520226e756d, 0x626572223a0a2020, 0x2020202020202020, 0x2020202020207265, + 0x7475726e20393b0a, 0x2020202020202020, 0x2020202063617365, 0x2022737472696e67, 0x223a0a2020202020, + 0x2020202020202020, 0x2020207265747572, 0x6e20746869732e73, 0x7472696e67506172, 0x616d657465725369, + 0x7a652876616c7565, 0x293b0a2020202020, 0x2020202020202063, 0x61736520226f626a, 0x656374223a0a2020, + 0x2020202020202020, 0x2020202020207265, 0x7475726e20746869, 0x732e6f626a656374, 0x506172616d657465, + 0x7253697a65287661, 0x6c7565293b0a2020, 0x2020202020202020, 0x20207d0a20202020, 0x2020202020202020, + 0x7468726f77206e65, 0x7720547970654572, 0x726f722860556e73, 0x7570706f72746564, 0x2057656246726f6e, + 0x7420706172616d65, 0x7465722074797065, 0x2027247b74797065, 0x6f662076616c7565, 0x7d2760293b0a2020, + 0x2020202020207d0a, 0x0a20202020202020, 0x202f2f2f20546865, 0x20656e636f646564, 0x2073697a65206f66, + 0x206120737472696e, 0x673a206974732068, 0x656164657220616e, 0x6420697473205554, 0x462d382062797465, + 0x732e0a2020202020, 0x202020737472696e, 0x67506172616d6574, 0x657253697a652876, 0x616c756529207b0a, + 0x2020202020202020, 0x20202020636f6e73, 0x74206c656e677468, 0x203d206e65772054, 0x657874456e636f64, + 0x657228292e656e63, 0x6f64652876616c75, 0x65292e6c656e6774, 0x683b0a2020202020, 0x2020202020202072, + 0x657475726e207374, 0x72696e6748656164, 0x657253697a65286c, 0x656e67746829202b, 0x206c656e6774683b, + 0x0a20202020202020, 0x207d0a0a20202020, 0x202020202f2f2f20, 0x54686520656e636f, 0x6465642073697a65, + 0x206f662061206c69, 0x73742c207475706c, 0x65206f7220747970, 0x6564206172726179, 0x2e0a202020202020, + 0x20206f626a656374, 0x506172616d657465, 0x7253697a65287661, 0x6c756529207b0a20, 0x2020202020202020, + 0x2020206966202876, 0x616c756520696e73, 0x74616e63656f6620, 0x57656246726f6e74, 0x4c697374290a2020, + 0x2020202020202020, 0x2020202020207265, 0x7475726e20746869, 0x732e6c6973745061, 0x72616d6574657253, + 0x697a652876616c75, 0x65293b0a20202020, 0x2020202020202020, 0x6966202841727261, 0x792e697341727261, + 0x792876616c756529, 0x290a202020202020, 0x2020202020202020, 0x202072657475726e, 0x20746869732e7475, + 0x706c65506172616d, 0x6574657253697a65, 0x2876616c7565293b, 0x0a20202020202020, 0x2020202020696620, + 0x2869735479706564, 0x4172726179287661, 0x6c756529290a2020, 0x2020202020202020, 0x2020202020207265, + 0x7475726e20746869, 0x732e747970656441, 0x7272617950617261, 0x6d6574657253697a, 0x652876616c756529, + 0x3b0a202020202020, 0x2020202020207468, 0x726f77206e657720, 0x547970654572726f, 0x722860556e737570, + 0x706f727465642057, 0x656246726f6e7420, 0x706172616d657465, 0x7220747970652027, 0x247b747970656f66, + 0x2076616c75657d27, 0x60293b0a20202020, 0x202020207d0a0a20, 0x202020202020202f, 0x2f2f205468652073, + 0x686170652c206173, 0x2074686520646563, 0x6f64657220636f6d, 0x7075746573206974, 0x2c206f6620612076, + 0x616c75652061626f, 0x757420746f206265, 0x20656e636f646564, 0x2061732061206c69, 0x737420656c656d65, + 0x6e742e0a20202020, 0x2020202076616c75, 0x6553686170652876, 0x616c75652c206465, 0x707468203d203029, + 0x207b0a2020202020, 0x2020202020202073, 0x7769746368202874, 0x7970656f66207661, 0x6c756529207b0a20, + 0x2020202020202020, 0x2020206361736520, 0x22626f6f6c65616e, 0x223a0a2020202020, 0x2020202020202020, + 0x2020207265747572, 0x6e202262223b0a20, 0x2020202020202020, 0x2020206361736520, 0x226e756d62657222, + 0x3a0a202020202020, 0x2020202020202020, 0x202072657475726e, 0x20226e223b0a2020, 0x2020202020202020, + 0x2020636173652022, 0x737472696e67223a, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e20, + 0x2273223b0a202020, 0x2020202020202020, 0x207d0a2020202020, 0x2020202020202069, 0x66202876616c7565, + 0x20696e7374616e63, 0x656f662057656246, 0x726f6e744c697374, 0x290a202020202020, 0x2020202020202020, + 0x202072657475726e, 0x20224c223b0a2020, 0x2020202020202020, 0x2020696620284172, 0x7261792e69734172, + 0x7261792876616c75, 0x652929207b0a2020, 0x2020202020202020, 0x2020202020202f2f, 0x20436f756e746564, + 0x207768696c652064, 0x657363656e64696e, 0x673a20616e206172, 0x726179206e657374, 0x65642074686f7573, + 0x616e647320646565, 0x7020697320726566, 0x7573656420617420, 0x746865206c696d69, 0x742c206e6f742061, + 0x6674657220657868, 0x61757374696e6720, 0x7468652073746163, 0x6b2e0a2020202020, 0x2020202020202020, + 0x2020206966202864, 0x65707468203e3d20, 0x6d61784c69737454, 0x75706c6544657074, 0x68290a2020202020, + 0x2020202020202020, 0x2020202020202074, 0x68726f77206e6577, 0x2054797065457272, 0x6f72286057656246, + 0x726f6e74206c6973, 0x7420656c656d656e, 0x7473206e65737420, 0x7475706c65732061, 0x74206d6f73742024, + 0x7b6d61784c697374, 0x5475706c65446570, 0x74687d2064656570, 0x60293b0a20202020, 0x2020202020202020, + 0x2020202072657475, 0x726e206028247b76, 0x616c75652e6d6170, 0x28656c656d656e74, 0x203d3e2074686973, + 0x2e76616c75655368, 0x61706528656c656d, 0x656e742c20646570, 0x7468202b20312929, 0x2e6a6f696e28222c, + 0x22297d29603b0a20, 0x2020202020202020, 0x2020207d0a202020, 0x2020202020202020, 0x2069662028697354, + 0x7970656441727261, 0x792876616c756529, 0x2026262061727261, 0x7954797065732e68, 0x61732876616c7565, + 0x2e636f6e73747275, 0x63746f7229290a20, 0x2020202020202020, 0x2020202020202072, 0x657475726e206061, + 0x247b617272617954, 0x797065732e676574, 0x2876616c75652e63, 0x6f6e737472756374, 0x6f72292e636f6465, + 0x7d603b0a20202020, 0x2020202020202020, 0x7468726f77206e65, 0x7720547970654572, 0x726f722860556e73, + 0x7570706f72746564, 0x2057656246726f6e, 0x7420706172616d65, 0x7465722074797065, 0x2027247b74797065, + 0x6f662076616c7565, 0x7d2760293b0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x202f2f2f20546865, + 0x20656e636f646564, 0x2073697a65206f66, 0x2061206c6973742c, 0x2061667465722063, 0x6865636b696e6720, + 0x7468617420697473, 0x20656c656d656e74, 0x732068617665206f, 0x6e65207368617065, 0x20616e6420686f6c, + 0x64206e6f206c6973, 0x742e0a2020202020, 0x2020206c69737450, 0x6172616d65746572, 0x53697a65286c6973, + 0x7429207b0a202020, 0x2020202020202020, 0x20696620286c6973, 0x742e6974656d732e, 0x6c656e677468203e, + 0x2030786666666666, 0x666666290a202020, 0x2020202020202020, 0x2020202020746872, 0x6f77206e65772052, + 0x616e67654572726f, 0x7228225765624672, 0x6f6e74206c697374, 0x732063616e6e6f74, 0x2065786365656420, + 0x3432393439363732, 0x393520656c656d65, 0x6e747322293b0a20, 0x2020202020202020, 0x2020206c65742073, + 0x68617065203d206e, 0x756c6c3b0a202020, 0x2020202020202020, 0x20666f722028636f, 0x6e7374206974656d, + 0x206f66206c697374, 0x2e6974656d732920, 0x7b0a202020202020, 0x2020202020202020, 0x2020636f6e737420, + 0x6974656d53686170, 0x65203d2074686973, 0x2e76616c75655368, 0x617065286974656d, 0x293b0a2020202020, + 0x2020202020202020, 0x2020207265717569, 0x72654c697374456c, 0x656d656e74536861, 0x7065286974656d53, + 0x68617065293b0a20, 0x2020202020202020, 0x2020202020202069, 0x6620286974656d53, 0x68617065203d3d3d, + 0x20226e22207c7c20, 0x6974656d53686170, 0x65203d3d3d202262, 0x22290a2020202020, 0x2020202020202020, + 0x2020202020202074, 0x68726f77206e6577, 0x2054797065457272, 0x6f72282241205765, 0x6246726f6e74206c, + 0x69737420686f6c64, 0x7320737472696e67, 0x732c207479706564, 0x2061727261797320, 0x6f72207475706c65, + 0x733a2073656e6420, 0x6e756d6265727320, 0x6173206120747970, 0x6564206172726179, 0x22293b0a20202020, + 0x2020202020202020, 0x2020202069662028, 0x7368617065203d3d, 0x3d206e756c6c290a, 0x2020202020202020, + 0x2020202020202020, 0x2020202073686170, 0x65203d206974656d, 0x53686170653b0a20, 0x2020202020202020, + 0x2020202020202065, 0x6c73652069662028, 0x6974656d53686170, 0x6520213d3d207368, 0x617065290a202020, + 0x2020202020202020, 0x2020202020202020, 0x207468726f77206e, 0x6577205479706545, 0x72726f7228225765, + 0x6246726f6e74206c, 0x69737420656c656d, 0x656e747320617265, 0x206e6f74206f6620, 0x6f6e652074797065, + 0x22293b0a20202020, 0x2020202020202020, 0x7d0a202020202020, 0x2020202020207265, 0x7475726e2035202b, + 0x206c6973742e6974, 0x656d732e72656475, 0x6365282873697a65, 0x2c206974656d2920, 0x3d3e2073697a6520, + 0x2b20746869732e70, 0x6172616d65746572, 0x53697a6528697465, 0x6d292c2030293b0a, 0x2020202020202020, + 0x7d0a0a2020202020, 0x2020207475706c65, 0x506172616d657465, 0x7253697a65287661, 0x6c756529207b0a20, + 0x2020202020202020, 0x2020206966202876, 0x616c75652e6c656e, 0x677468203e203235, 0x35290a2020202020, + 0x2020202020202020, 0x2020207468726f77, 0x206e65772052616e, 0x67654572726f7228, 0x2257656246726f6e, + 0x74207475706c6573, 0x2063616e6e6f7420, 0x6578636565642032, 0x353520656c656d65, 0x6e747322293b0a20, + 0x2020202020202020, 0x2020207265747572, 0x6e2032202b207661, 0x6c75652e72656475, 0x6365282873697a65, + 0x2c20656c656d656e, 0x7429203d3e207369, 0x7a65202b20746869, 0x732e706172616d65, 0x74657253697a6528, + 0x656c656d656e7429, 0x2c2030293b0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x2074797065644172, + 0x726179506172616d, 0x6574657253697a65, 0x2876616c75652920, 0x7b0a202020202020, 0x2020202020206966, + 0x2028216172726179, 0x54797065732e6861, 0x732876616c75652e, 0x636f6e7374727563, 0x746f7229290a2020, + 0x2020202020202020, 0x2020202020207468, 0x726f77206e657720, 0x547970654572726f, 0x722860556e737570, + 0x706f727465642074, 0x7970656420617272, 0x617920247b76616c, 0x75652e636f6e7374, 0x727563746f722e6e, + 0x616d657d60293b0a, 0x2020202020202020, 0x2020202069662028, 0x76616c75652e6c65, 0x6e677468203e2030, + 0x7866666666666666, 0x66290a2020202020, 0x2020202020202020, 0x2020207468726f77, 0x206e65772052616e, + 0x67654572726f7228, 0x2254797065642061, 0x7272617973206361, 0x6e6e6f7420657863, 0x6565642034323934, + 0x3936373239352065, 0x6c656d656e747322, 0x293b0a2020202020, 0x2020202020202072, 0x657475726e207479, + 0x7065644172726179, 0x4865616465725369, 0x7a652876616c7565, 0x29202b2076616c75, 0x652e627974654c65, + 0x6e6774683b0a2020, 0x2020202020207d0a, 0x0a20202020202020, 0x20656e636f646550, 0x6172616d65746572, + 0x2876616c75652c20, 0x766965772c206f66, 0x6673657429207b0a, 0x2020202020202020, 0x2020202073776974, + 0x6368202874797065, 0x6f662076616c7565, 0x29207b0a20202020, 0x2020202020202020, 0x636173652022626f, + 0x6f6c65616e223a0a, 0x2020202020202020, 0x2020202020202020, 0x766965772e736574, 0x55696e7438286f66, + 0x667365742c207661, 0x6c7565203f205061, 0x72616d547970652e, 0x626f6f6c65616e54, 0x727565203a205061, + 0x72616d547970652e, 0x626f6f6c65616e46, 0x616c7365293b0a20, 0x2020202020202020, 0x2020202020202072, + 0x657475726e20313b, 0x0a20202020202020, 0x2020202020636173, 0x6520226e756d6265, 0x72223a0a20202020, + 0x2020202020202020, 0x2020202076696577, 0x2e73657455696e74, 0x38286f6666736574, 0x2c20506172616d54, + 0x7970652e6e756d62, 0x6572293b0a202020, 0x2020202020202020, 0x2020202020766965, 0x772e736574466c6f, + 0x61743634286f6666, 0x736574202b20312c, 0x2076616c75652c20, 0x746869732e6c6974, 0x746c65456e646961, + 0x6e293b0a20202020, 0x2020202020202020, 0x2020202072657475, 0x726e20393b0a2020, 0x2020202020202020, + 0x2020636173652022, 0x737472696e67223a, 0x0a20202020202020, 0x2020202020202020, 0x2072657475726e20, + 0x746869732e656e63, 0x6f6465537472696e, 0x672876616c75652c, 0x20766965772c206f, 0x6666736574293b0a, + 0x2020202020202020, 0x2020202063617365, 0x20226f626a656374, 0x223a0a2020202020, 0x2020202020202020, + 0x2020207265747572, 0x6e20746869732e65, 0x6e636f64654f626a, 0x6563742876616c75, 0x652c20766965772c, + 0x206f666673657429, 0x3b0a202020202020, 0x2020202020207d0a, 0x2020202020202020, 0x202020207468726f, + 0x77206e6577205479, 0x70654572726f7228, 0x60556e737570706f, 0x7274656420576562, 0x46726f6e74207061, + 0x72616d6574657220, 0x747970652027247b, 0x747970656f662076, 0x616c75657d276029, 0x3b0a202020202020, + 0x20207d0a0a202020, 0x20202020202f2f2f, 0x2057726974657320, 0x6120737472696e67, 0x2077697468207468, + 0x6520736d616c6c65, 0x7374206865616465, 0x7220697473205554, 0x462d38206c656e67, 0x746820616c6c6f77, + 0x7320616e64207265, 0x7475726e73207468, 0x6520627974657320, 0x7772697474656e2e, 0x0a20202020202020, + 0x20656e636f646553, 0x7472696e67287661, 0x6c75652c20766965, 0x772c206f66667365, 0x7429207b0a202020, + 0x2020202020202020, 0x20636f6e73742062, 0x79746573203d206e, 0x6577205465787445, 0x6e636f6465722829, + 0x2e656e636f646528, 0x76616c7565293b0a, 0x2020202020202020, 0x20202020636f6e73, 0x7420686561646572, + 0x53697a65203d2073, 0x7472696e67486561, 0x64657253697a6528, 0x62797465732e6c65, 0x6e677468293b0a20, + 0x2020202020202020, 0x2020206966202868, 0x656164657253697a, 0x65203d3d3d203229, 0x207b0a2020202020, + 0x2020202020202020, 0x202020766965772e, 0x73657455696e7438, 0x286f66667365742c, 0x20506172616d5479, + 0x70652e736d616c6c, 0x537472696e67293b, 0x0a20202020202020, 0x2020202020202020, 0x20766965772e7365, + 0x7455696e7438286f, 0x6666736574202b20, 0x312c206279746573, 0x2e6c656e67746829, 0x3b0a202020202020, + 0x2020202020207d20, 0x656c736520696620, 0x2868656164657253, 0x697a65203d3d3d20, 0x3329207b0a202020, + 0x2020202020202020, 0x2020202020766965, 0x772e73657455696e, 0x7438286f66667365, 0x742c20506172616d, + 0x547970652e737472, 0x696e67293b0a2020, 0x2020202020202020, 0x2020202020207669, 0x65772e7365745569, + 0x6e743136286f6666, 0x736574202b20312c, 0x2062797465732e6c, 0x656e6774682c2074, 0x6869732e6c697474, + 0x6c65456e6469616e, 0x293b0a2020202020, 0x202020202020207d, 0x20656c7365207b0a, 0x2020202020202020, + 0x2020202020202020, 0x766965772e736574, 0x55696e7438286f66, 0x667365742c205061, 0x72616d547970652e, + 0x6c6f6e6753747269, 0x6e67293b0a202020, 0x2020202020202020, 0x2020202020766965, 0x772e73657455696e, + 0x743332286f666673, 0x6574202b20312c20, 0x62797465732e6c65, 0x6e6774682c207468, 0x69732e6c6974746c, + 0x65456e6469616e29, 0x3b0a202020202020, 0x2020202020207d0a, 0x2020202020202020, 0x202020206e657720, + 0x55696e7438417272, 0x617928766965772e, 0x6275666665722c20, 0x766965772e627974, 0x654f666673657420, + 0x2b206f6666736574, 0x202b206865616465, 0x7253697a652c2062, 0x797465732e6c656e, 0x677468292e736574, + 0x286279746573293b, 0x0a20202020202020, 0x2020202020726574, 0x75726e2068656164, 0x657253697a65202b, + 0x2062797465732e6c, 0x656e6774683b0a20, 0x202020202020207d, 0x0a0a202020202020, 0x20202f2f2f205772, + 0x697465732061206c, 0x6973742c20747570, 0x6c65206f72207479, 0x7065642061727261, 0x7920616e64207265, + 0x7475726e73207468, 0x6520627974657320, 0x7772697474656e2e, 0x0a20202020202020, 0x20656e636f64654f, + 0x626a656374287661, 0x6c75652c20766965, 0x772c206f66667365, 0x7429207b0a202020, 0x2020202020202020, + 0x206966202876616c, 0x756520696e737461, 0x6e63656f66205765, 0x6246726f6e744c69, 0x7374290a20202020, + 0x2020202020202020, 0x2020202072657475, 0x726e20746869732e, 0x656e636f64654c69, 0x73742876616c7565, + 0x2c20766965772c20, 0x6f6666736574293b, 0x0a20202020202020, 0x2020202020696620, 0x2841727261792e69, + 0x7341727261792876, 0x616c756529290a20, 0x2020202020202020, 0x2020202020202072, 0x657475726e207468, + 0x69732e656e636f64, 0x655475706c652876, 0x616c75652c207669, 0x65772c206f666673, 0x6574293b0a202020, + 0x2020202020202020, 0x2069662028697354, 0x7970656441727261, 0x792876616c756529, 0x290a202020202020, + 0x2020202020202020, 0x202072657475726e, 0x20746869732e656e, 0x636f646554797065, 0x6441727261792876, + 0x616c75652c207669, 0x65772c206f666673, 0x6574293b0a202020, 0x2020202020202020, 0x207468726f77206e, + 0x6577205479706545, 0x72726f722860556e, 0x737570706f727465, 0x642057656246726f, 0x6e7420706172616d, + 0x6574657220747970, 0x652027247b747970, 0x656f662076616c75, 0x657d2760293b0a20, 0x202020202020207d, + 0x0a0a202020202020, 0x20202f2f2f205772, 0x697465732061206c, 0x6973742061742060, 0x6f66667365746020, + 0x616e642072657475, 0x726e732074686520, 0x6279746573207772, 0x697474656e2e0a20, 0x2020202020202065, + 0x6e636f64654c6973, 0x74286c6973742c20, 0x766965772c206f66, 0x6673657429207b0a, 0x2020202020202020, + 0x2020202076696577, 0x2e73657455696e74, 0x38286f6666736574, 0x2c20506172616d54, 0x7970652e6c697374, + 0x293b0a2020202020, 0x2020202020202076, 0x6965772e73657455, 0x696e743332286f66, 0x66736574202b2031, + 0x2c206c6973742e69, 0x74656d732e6c656e, 0x6774682c20746869, 0x732e6c6974746c65, 0x456e6469616e293b, + 0x0a20202020202020, 0x20202020206c6574, 0x207772697474656e, 0x203d20353b0a2020, 0x2020202020202020, + 0x2020666f72202863, 0x6f6e737420697465, 0x6d206f66206c6973, 0x742e6974656d7329, 0x0a20202020202020, + 0x2020202020202020, 0x207772697474656e, 0x202b3d2074686973, 0x2e656e636f646550, 0x6172616d65746572, + 0x286974656d2c2076, 0x6965772c206f6666, 0x736574202b207772, 0x697474656e293b0a, 0x2020202020202020, + 0x2020202072657475, 0x726e207772697474, 0x656e3b0a20202020, 0x202020207d0a0a20, 0x2020202020202065, + 0x6e636f6465547570, 0x6c652876616c7565, 0x2c20766965772c20, 0x6f66667365742920, 0x7b0a202020202020, + 0x2020202020207669, 0x65772e7365745569, 0x6e7438286f666673, 0x65742c2050617261, 0x6d547970652e7475, + 0x706c65293b0a2020, 0x2020202020202020, 0x2020766965772e73, 0x657455696e743828, 0x6f6666736574202b, + 0x20312c2076616c75, 0x652e6c656e677468, 0x293b0a2020202020, 0x202020202020206c, 0x6574207772697474, + 0x656e203d20323b0a, 0x2020202020202020, 0x20202020666f7220, 0x28636f6e73742065, 0x6c656d656e74206f, + 0x662076616c756529, 0x0a20202020202020, 0x2020202020202020, 0x207772697474656e, 0x202b3d2074686973, + 0x2e656e636f646550, 0x6172616d65746572, 0x28656c656d656e74, 0x2c20766965772c20, 0x6f6666736574202b, + 0x207772697474656e, 0x293b0a2020202020, 0x2020202020202072, 0x657475726e207772, 0x697474656e3b0a20, + 0x202020202020207d, 0x0a0a202020202020, 0x2020656e636f6465, 0x5479706564417272, 0x61792876616c7565, + 0x2c20766965772c20, 0x6f66667365742920, 0x7b0a202020202020, 0x202020202020636f, 0x6e73742073706563, + 0x203d206172726179, 0x54797065732e6765, 0x742876616c75652e, 0x636f6e7374727563, 0x746f72293b0a2020, + 0x2020202020202020, 0x2020696620282173, 0x706563290a202020, 0x2020202020202020, 0x2020202020746872, + 0x6f77206e65772054, 0x7970654572726f72, 0x2860556e73757070, 0x6f72746564207479, 0x7065642061727261, + 0x7920247b76616c75, 0x652e636f6e737472, 0x7563746f722e6e61, 0x6d657d60293b0a20, 0x2020202020202020, + 0x202020636f6e7374, 0x2068656164657253, 0x697a65203d207479, 0x7065644172726179, 0x4865616465725369, + 0x7a652876616c7565, 0x293b0a2020202020, 0x2020202020202076, 0x6965772e73657455, 0x696e7438286f6666, + 0x7365742c20686561, 0x64657253697a6520, 0x3d3d3d2032203f20, 0x506172616d547970, 0x652e736d616c6c41, + 0x727261795538203a, 0x20737065632e636f, 0x6465293b0a202020, 0x2020202020202020, 0x2069662028686561, + 0x64657253697a6520, 0x3d3d3d2032290a20, 0x2020202020202020, 0x2020202020202076, 0x6965772e73657455, + 0x696e7438286f6666, 0x736574202b20312c, 0x2076616c75652e6c, 0x656e677468293b0a, 0x2020202020202020, + 0x20202020656c7365, 0x0a20202020202020, 0x2020202020202020, 0x20766965772e7365, 0x7455696e74333228, + 0x6f6666736574202b, 0x20312c2076616c75, 0x652e6c656e677468, 0x2c20746869732e6c, 0x6974746c65456e64, + 0x69616e293b0a2020, 0x2020202020202020, 0x2020666f7220286c, 0x657420696e646578, 0x203d20303b20696e, + 0x646578203c207661, 0x6c75652e6c656e67, 0x74683b202b2b696e, 0x646578290a202020, 0x2020202020202020, + 0x2020202020766965, 0x775b737065632e73, 0x65747465725d286f, 0x6666736574202b20, 0x6865616465725369, + 0x7a65202b20696e64, 0x6578202a20737065, 0x632e62797465732c, 0x2076616c75655b69, 0x6e6465785d2c2074, + 0x6869732e6c697474, 0x6c65456e6469616e, 0x293b0a2020202020, 0x2020202020202072, 0x657475726e206865, + 0x6164657253697a65, 0x202b2076616c7565, 0x2e627974654c656e, 0x6774683b0a202020, 0x20202020207d0a20, + 0x2020207d0a0a2020, 0x20202f2f20457870, 0x6f73656420286265, 0x796f6e6420746865, 0x2064656661756c74, + 0x206077656246726f, 0x6e74602073696e67, 0x6c65746f6e292073, 0x6f20746573747320, 0x63616e20636f6e73, + 0x7472756374206164, 0x646974696f6e616c, 0x2062726964676573, 0x0a202020202f2f20, 0x706f696e74656420, + 0x6174206120646966, 0x666572656e742055, 0x524c2c20652e672e, 0x20746f2065786572, 0x6369736520746865, + 0x20696e697469616c, 0x2d636f6e6e656374, 0x696f6e2d6661696c, 0x7572652070617468, 0x2e0a20202020676c, + 0x6f62616c2e576562, 0x46726f6e74427269, 0x646765203d205765, 0x6246726f6e744272, 0x696467653b0a2020, + 0x2020676c6f62616c, 0x2e77656246726f6e, 0x74203d206e657720, 0x57656246726f6e74, 0x4272696467652829, + 0x3b0a7d2928676c6f, 0x62616c5468697329, 0x3b0a000000000000 }; }; diff --git a/js/core/WebFront.js b/js/core/WebFront.js index 8f8ddb7b..e18c347c 100644 --- a/js/core/WebFront.js +++ b/js/core/WebFront.js @@ -234,6 +234,12 @@ this.littleEndian = false; this.nextCallId = 1; this.pendingCalls = new Map(); + /// What an inspector of the developer environment installs to follow this bridge, null otherwise: its + /// `call(name, resolve, reject)` returns the pair that settles a call to C++ in its place, and its `jsCall(name)` + /// is told each JavaScript function that C++ calls. Without one the bridge records nothing. + this.probe = null; + /// Why `ready` was rejected, null otherwise. + this.readyError = null; this.readySettled = false; this.readyPromise = new Promise((resolve, reject) => { this.resolveReady = resolve; @@ -314,6 +320,7 @@ settleReadyRejected(error) { if (this.readySettled || this.state === "linked") return; this.readySettled = true; + this.readyError = error; this.rejectReady(error); } @@ -397,6 +404,7 @@ const [parameters, parameterBytes] = this.decodeParameters(count - 1, payload, nameBytes); if (nameBytes + parameterBytes !== payloadSize) throw new Error("Function call contains trailing payload data"); + this.probe?.jsCall(names[0]); let execution; try { execution = this.executeFunction(names[0], parameters); @@ -645,6 +653,8 @@ callCppFunction(name, args) { return new Promise((resolve, reject) => { + if (this.probe) + [resolve, reject] = this.probe.call(name, resolve, reject); let callId = 0; try { if (this.state !== "linked") @@ -664,7 +674,7 @@ let cursor = 8; for (const value of values) cursor += this.encodeParameter(value, view, cursor); - this.pendingCalls.set(callId, {resolve, reject}); + this.pendingCalls.set(callId, {resolve, reject, name}); this.socket.send(buffer); } catch (error) { if (callId !== 0) diff --git a/js/developer/environment/bundles.json b/js/developer/environment/bundles.json index 778e6b63..d562aa12 100644 --- a/js/developer/environment/bundles.json +++ b/js/developer/environment/bundles.json @@ -17,18 +17,19 @@ "js/developer/environment/packages.mjs": "37fe2a410e211264cfeaedbff3df50f7e62b02f8088130127d94f92081e2a5ad", "js/developer/environment/starter.mjs": "fd43db1861121577c48a0327436ce39cb9076d7cad0e9e273d40955747cc6a48", "js/developer/environment/paths.mjs": "3b6114df78eb193161c5c84499dda084cb7ff91c56a4496371c30295d00880e3", - "js/developer/environment/runtime.mjs": "b8ab1940e402f393da8eb7e3b8e8288f31d1034f309c3644454a038660179444", + "js/developer/environment/runtime.mjs": "1b5f0bfc5964b902725a4c765d83db0644cdad91a8f07d8bf6a3bbd0f550c1eb", "js/developer/environment/automation.mjs": "773dcca7b8847c11670995f759c218c86af95a29ea46b44f350f79c4b71a143c", "js/developer/environment/development.mjs": "1f32f911610c72ad3e935de1c2b138fa275ce9eda04bb63c824d5e09923305a6", "js/developer/environment/testing.mjs": "aeb584505fab5957b9c02e78536e12f7d7f3d12f8adb2e17f1a1a6e395e43f3c", "js/developer/environment/terminal.mjs": "e7c3ca8f9833f10e07939277996eb01fb989c986420c96052271ff469fa59062", "js/developer/environment/workspace.mjs": "e82ec4df21ffb2b112550e0212504aba05af4f924b5645c0712f40f8466257fc", "js/developer/environment/menu.mjs": "b4fe4c38e6b8cc6c1101df842e282ab85e6c6e029b2225738b9d27bc5efbc88d", - "js/developer/environment/inspector-host.mjs": "bffcef61b8a5778f53adfea5096c5d5fa277868bbaa39e60142a3493210076fb", - "js/developer/environment/inspector.mjs": "3fb29ac2f6f268bfa125d66dbbaddd68115e2f497b3f4f15de36b45e1d5aba7e", + "js/developer/environment/inspector-host.mjs": "304a8a6713026939d66088dd0bb68a96ff4ee14e970c6886d61c82ebde611ac5", + "js/developer/environment/inspector.mjs": "183ece8ad6581c458315211b3edea6fa2823c2212d3999e7e9e069a1e78309e5", "js/developer/environment/inspector-packages.mjs": "1c3f6350780b841784f83bc20ead2945157c48a1f136c47e3a7a90d89bea8522", - "js/developer/environment/inspector-registry.mjs": "bdddca4f710567b9c5030a741ed96ca6b79ebbd080da6e0bb3336e91bb1f7b39", + "js/developer/environment/inspector-registry.mjs": "6653afc473fcef677d8b02541085943da3f7d15c5b64d23dafd43c750a9e28d8", "js/developer/environment/inspector-watches.mjs": "f5b8f901b86969bfe349d0e875cce9fba375d922f95f4fb213dc2f690083175e", + "js/developer/environment/inspector-bridge.mjs": "fa891a6098edccd4fdae288c07d5b5d766919021acece61f6d3e5a3e55882bbc", "js/developer/environment/inspector.html": "66bfb80d6bd29bc9aabf71e0dd9b163dfcd1f1c77d1a41818645af1a4f9b8616", "js/developer/environment/tarball.mjs": "1c1e1aea067910e1fec74e85b4bf9fbefed9b38187a04d8d2764f0b9a96fca39", "js/developer/environment/commands.mjs": "a759f48584b78aed79e9965fd202d2ec108a6948ef6f1b8d689fed87a458b265", @@ -56,7 +57,7 @@ "js/developer/tools/archive.mjs": "da63bb9d796ddfd24ed945b15c53f66a0400eb177886fd4f1c8fd10cafb5a91b", "js/developer/tools/distribution.mjs": "43dfdccc912693db46fd095fd78ae79325abab672d99f89fd569914ef3499cad", "js/developer/scripts/build.mjs": "a6b64a8a75c9a30118e7f5c843a0feee89ee1372ccd19b7e468c816b23fd1367", - "js/developer/webfront.project.json": "6d9f5e94ee8c3ac6de2191c3dfda75a62205fe5819232744d7934e9c08f218dd", + "js/developer/webfront.project.json": "ac750924271fe5f9c9be27007068ba435ba7d31dd25df656c24a581d2298be0e", "js/core/bootstrap/bootstrap.bundle.mjs": "18a0567efa928fddbaa3f8d16a4d1e8440f21709ff2e3058d10ba406b2e9b66d", "js/developer/environment/packages.bundle.mjs": "5598a590a9e859a4128075387a6c32963b2246ca120c2d7775851c780ad437f2", "include/webfront/system/DeveloperReleaseData.hpp": "8b3c8800211c13b1984e794de6110d56238e9fb1cfb16afbc2868d57eb91c70e" diff --git a/js/developer/environment/inspector-bridge.mjs b/js/developer/environment/inspector-bridge.mjs new file mode 100644 index 00000000..7eb465a2 --- /dev/null +++ b/js/developer/environment/inspector-bridge.mjs @@ -0,0 +1,525 @@ +// The panel of the bridge in the page (#684, ADR-027 section 8): whether webFront.ready settled and why it was rejected, +// the state of the connection, the calls to C++ that are pending and for how long, the Promises rejected lately, and the +// JavaScript functions that C++ called. That state lives in the page of the application. The page that holds the tab follows +// it with a monitor, which installs a probe in the bridge only while an inspector reads. Attached, the panel is a frame of +// that page and reads the monitor directly; detached, it is another window that does not see the page, so the page publishes +// the same rows to C++ (webfront.inspector.publishBridge) and the panel reads them back (webfront.inspector.bridge). +import {createPoller, createTable, createToolbar, filterRows, formatDuration, readFailure} from './inspector-registry.mjs'; + +export const sourceFunction = 'webfront.inspector.bridgeSource'; +export const publishFunction = 'webfront.inspector.publishBridge'; +export const bridgeFunction = 'webfront.inspector.bridge'; +/** The JavaScript function that C++ calls to ask this page to publish: `wfInspect.publish`. */ +export const publisherGlobal = 'wfInspect'; + +/** + * The bounds of a state: the oldest pending calls, the latest rejections and the most called JavaScript functions shown, + * and the bytes of a text. Together they stay under the 256 rows that C++ keeps for a page. + */ +export const limits = Object.freeze({pending: 100, rejections: 50, jsFunctions: 100, jsNames: 1000, text: 256}); +/** + * A monitor keeps its probe in the bridge this long after its last read, in milliseconds: longer than the slowest period of + * a panel (5 s), so that a panel that reads never leaves a moment without a probe. + */ +export const defaultLease = 15000; +/** A page publishes at this period while a detached panel reads, in milliseconds. */ +export const publishPeriod = 250; + +// --- Texts ----------------------------------------------------------------------------------------------------- + +const encoder = new TextEncoder(); + +/** A digest of fixed size of a text (FNV-1a over its UTF-16 units, 64 bits as two 32-bit halves), to tell two long names apart. */ +export function digest(text) { + let low = 0x84222325, high = 0xcbf29ce4; + for (let index = 0; index < text.length; ++index) { + low ^= text.charCodeAt(index); + // Multiplied by the 64-bit FNV prime 0x100000001b3, kept as two halves. + const lowProduct = Math.imul(low, 0x1b3) >>> 0; + const carry = Math.floor((low >>> 0) * 0x1b3 / 0x100000000); + high = (Math.imul(high, 0x1b3) + Math.imul(low, 0x100) + carry) >>> 0; + low = lowProduct; + } + return high.toString(16).padStart(8, '0') + (low >>> 0).toString(16).padStart(8, '0'); +} +const controls = /[\u0000-\u001f\u007f]/g; + +/** + * A text of the page made safe to show and bounded, as C++ bounds it (inspect::boundedText): control characters become + * their visible pictures, then the text is cut to `limit` UTF-8 bytes on a character boundary, ending with "…" when cut. + */ +export function boundedText(value, limit = limits.text) { + let text; + try { text = String(value); } + catch { text = '(a value that cannot be read)'; } + text = text.replace(controls, control => String.fromCodePoint(control === '\u007f' ? 0x2421 : 0x2400 + control.codePointAt(0))); + if (encoder.encode(text).length <= limit) return text; + let cut = '', bytes = 3; // the ellipsis takes three bytes + for (const character of text) { + const size = encoder.encode(character).length; + if (bytes + size > limit) break; + cut += character; + bytes += size; + } + return `${cut}…`; +} + +/** Why a Promise was rejected, as a text: the code of an error that has one, then its message. */ +export function rejectionReason(error) { + try { + // By its `message`, not by its constructor: an error of the interface's frame is not an Error of this page. + const described = error !== null && typeof error === 'object'; + const message = described && typeof error.message === 'string' ? error.message : String(error); + const code = described && typeof error.code === 'string' ? error.code : ''; + return boundedText(code && code !== 'webfront.error' ? `${code}: ${message}` : message); + } catch { return 'A rejection whose reason cannot be read'; } +} + +/** The inspectors' own traffic, which a monitor does not show: reading the state would otherwise change it. */ +export const ownTraffic = name => typeof name === 'string' && (name.startsWith('webfront.inspector.') || name.startsWith(`${publisherGlobal}.`)); + +// --- Monitor --------------------------------------------------------------------------------------------------- + +/** + * Follows the bridge of a page. `target()` gives what to follow now: `{bridge, label, path}`, or null when the page has no + * bridge; it is asked at each read, since the interface's frame is loaded again by each build. `read()` gives the state as + * an object (see `emptyState`) and keeps the probe in the bridge for `lease` more milliseconds: without a read the probe is + * removed, and the bridge records nothing. Calls that were pending when the probe came are shown without a duration. + * `clock()` is a monotonic time in milliseconds, `now()` the time of day, `timers` gives setTimeout and clearTimeout. + */ +export function createBridgeMonitor({target, clock = () => performance.now(), now = () => Date.now(), timers = globalThis, lease = defaultLease}) { + let followed = null, sequence = 0, until = 0, timer = null; + // The state of each bridge it followed, kept while that bridge lives: the target goes back to the page's own bridge + // each time the interface's frame is loaded again, and a call that is already followed must not be wrapped again. + const states = new WeakMap(); + + function follow(bridge) { + const known = states.get(bridge); + if (known) return known; + const state = {bridge, since: now(), pending: new Set(), tracked: new WeakSet(), rejections: [], rejected: 0, js: new Map(), jsOthers: 0, + // A bridge of a WebFront.js before #684 has no `probe` field, which it would never read: setting one would show + // nothing. Its pending calls are then adopted at each read, without the history of what settled in between. + probes: 'probe' in bridge, ready: null}; + // A bridge before #684 has no `readyError`: what `ready` became is learnt from the Promise itself. + if (!('readyError' in bridge) && typeof bridge.ready?.then === 'function') { + bridge.ready.then(() => { state.ready = {state: 'resolved', reason: ''}; }, + error => { state.ready = {state: 'rejected', reason: rejectionReason(error)}; }); + } + const settle = (entry, failed, error) => { + if (!state.pending.delete(entry)) return; + if (!failed) return; + ++state.rejected; + state.rejections.push({id: ++sequence, name: entry.name, reason: rejectionReason(error), at: now()}); + if (state.rejections.length > limits.rejections) state.rejections.shift(); + }; + const track = (name, started, resolve, reject) => { + const entry = {id: ++sequence, name: boundedText(name), started}; + state.pending.add(entry); + // The application's Promise is settled whatever the monitor does: an exception of the monitor (its clock, the + // reason of a rejection) neither keeps a call pending nor stops the bridge rejecting the others when it closes. + const quietly = (failed, error) => { + try { settle(entry, failed, error); } + catch { /* never the application's problem */ } + }; + const settlers = [value => { quietly(false); resolve(value); }, error => { quietly(true, error); reject(error); }]; + state.tracked.add(settlers[0]); + return settlers; + }; + // Nothing here may throw: a probe that fails must never fail a call of the application. + state.probe = { + call(name, resolve, reject) { + try { return ownTraffic(name) ? [resolve, reject] : track(name, clock(), resolve, reject); } + catch { return [resolve, reject]; } + }, + jsCall(name) { + try { + if (ownTraffic(name)) return; + // A long name is kept by its bounded label and a digest of the whole name: what the monitor keeps of a + // name never exceeds the bound, and two names that share their label stay two functions. + // The label keeps room for the digest, so that two such names are also shown apart. + const key = typeof name === 'string' && name.length <= limits.text / 4 ? name + : `${boundedText(name, limits.text - 17)}#${digest(String(name))}`; + const known = state.js.get(key); + if (known) ++known.calls; + else if (state.js.size < limits.jsNames) state.js.set(key, {id: ++sequence, name: boundedText(key), calls: 1}); + else ++state.jsOthers; + } catch { /* never the application's problem */ } + }, + }; + // The calls made while no probe was there (before the first read, or between two leases): their name is known, not + // when they started. A call that is already followed is left as it is. + state.adopt = () => { + try { + for (const call of bridge.pendingCalls?.values() ?? []) { + if (typeof call?.resolve !== 'function' || typeof call?.reject !== 'function' || state.tracked.has(call.resolve) + || ownTraffic(call.name)) continue; + [call.resolve, call.reject] = track(call.name ?? '(unknown)', null, call.resolve, call.reject); + } + } catch { /* a bridge of another version: only the calls made from now on are followed */ } + }; + states.set(bridge, state); + return state; + } + + function install() { + if (!followed) return; + if (!followed.probes) { + followed.adopt(); + return; + } + if (followed.bridge.probe === followed.probe) return; + followed.adopt(); + followed.bridge.probe = followed.probe; + } + function release() { + timers.clearTimeout(timer); + timer = null; + try { if (followed && followed.bridge.probe === followed.probe) followed.bridge.probe = null; } + catch { /* the frame of the bridge is gone */ } + // No strong reference to a bridge that is not observed: the frame of an interface that was loaded again can go. Its + // state stays in `states` for as long as that bridge lives, and the calls already followed settle through it. + followed = null; + } + function renew() { + until = clock() + lease; + if (timer !== null) return; + const check = () => { + timer = null; + const left = until - clock(); + if (left <= 0) release(); + else timer = timers.setTimeout(check, left); + }; + timer = timers.setTimeout(check, lease); + } + + return { + /** Whether the probe is in the bridge now. */ + get observing() { return Boolean(followed?.probes) && followed.bridge.probe === followed.probe; }, + read() { + let current = null; + try { current = target(); } + catch { /* a frame of another origin, or one that is going away */ } + if (!current?.bridge) { + release(); + followed = null; + return emptyState(); + } + if (followed?.bridge !== current.bridge) { + release(); + followed = follow(current.bridge); + } + try { install(); } + catch { return emptyState(); } + renew(); + const {bridge} = followed, time = clock(); + const pending = [...followed.pending].slice(0, limits.pending) + .map(({id, name, started}) => ({id, name, elapsed: started === null ? null : Math.max(0, time - started)})); + const jsFunctions = [...followed.js.values()].sort((a, b) => b.calls - a.calls || a.id - b.id).slice(0, limits.jsFunctions) + .map(entry => ({...entry})); + const settled = Boolean(bridge.readySettled); + const ready = !('readyError' in bridge) + ? followed.ready ?? {state: settled ? 'unknown' : 'pending', reason: ''} + : {state: !settled ? 'pending' : bridge.readyError ? 'rejected' : 'resolved', reason: settled && bridge.readyError ? rejectionReason(bridge.readyError) : ''}; + return { + page: {label: boundedText(current.label ?? ''), path: boundedText(current.path ?? '')}, + ready, + // Without a probe, only the calls pending now are known: neither their durations nor what settled meanwhile. + history: followed.probes, + connection: boundedText(bridge.state ?? 'unknown', 16), + since: followed.since, + pendingTotal: followed.pending.size, + rejectedTotal: followed.rejected, + jsTotal: followed.js.size + (followed.jsOthers ? 1 : 0), + // Past the names it keeps, calls are counted without their name: how many other functions is not known. + jsSaturated: followed.jsOthers > 0, + pending, + rejections: followed.rejections.map(entry => ({...entry})), + jsFunctions, + }; + }, + /** Removes the probe now, as the end of the lease would. */ + release, + }; +} + +/** + * What to follow for a page that shows the interface in `frame`: the bridge of the interface when its page has one, since + * that is where the application calls C++; null otherwise (no interface yet, or a page without WebFront.js), which leaves + * the bridge of the page that holds the frame. + */ +export function interfaceTarget(frame) { + const shown = frame?.contentWindow; + const bridge = shown?.webFront; // throws for a frame of another origin: the monitor then shows no bridge + return bridge ? {bridge, label: 'interface', path: shown.location.pathname} : null; +} + +/** The state of a page without a bridge. */ +export const emptyState = () => ({page: {label: '', path: ''}, ready: {state: 'none', reason: ''}, connection: 'none', since: 0, + history: true, pendingTotal: 0, rejectedTotal: 0, jsTotal: 0, jsSaturated: false, pending: [], rejections: [], jsFunctions: []}); + +// --- Rows ------------------------------------------------------------------------------------------------------ + +/** + * A state as the rows that cross the bridge, each `[kind, name, detail, number, number]`: one shape, so that they go as a + * list of tuples with the existing types (ADR-003). An unknown duration is -1. + */ +export function toRows(state) { + return [ + ['page', state.page.label, state.page.path, state.since, 0], + ['ready', state.ready.state, state.ready.reason, 0, 0], + ['connection', state.connection, '', state.history ? 0 : 1, 0], + ['counts', '', '', state.pendingTotal, state.rejectedTotal], + ['jsCount', '', '', state.jsTotal, state.jsSaturated ? 1 : 0], + ...state.pending.map(call => ['pending', call.name, '', call.id, call.elapsed ?? -1]), + ...state.rejections.map(rejection => ['rejected', rejection.name, rejection.reason, rejection.id, rejection.at]), + ...state.jsFunctions.map(called => ['js', called.name, '', called.id, called.calls]), + ]; +} + +const unreadable = () => new Error('The inspectors gave a state of the bridge that this environment does not read'); + +/** The state that `rows` describe; throws when they are not rows of a state. Rows of a kind it does not know are ignored. */ +export function fromRows(rows) { + if (!Array.isArray(rows)) throw unreadable(); + const state = emptyState(); + for (const row of rows) { + if (!Array.isArray(row) || row.length !== 5) throw unreadable(); + const [kind, name, detail, first, second] = row; + if (typeof kind !== 'string' || typeof name !== 'string' || typeof detail !== 'string' || !Number.isFinite(first) || !Number.isFinite(second)) + throw unreadable(); + if (kind === 'page') Object.assign(state, {page: {label: name, path: detail}, since: first}); + else if (kind === 'ready') state.ready = {state: name, reason: detail}; + else if (kind === 'connection') Object.assign(state, {connection: name, history: first === 0}); + else if (kind === 'counts') Object.assign(state, {pendingTotal: first, rejectedTotal: second}); + else if (kind === 'jsCount') Object.assign(state, {jsTotal: first, jsSaturated: second !== 0}); + else if (kind === 'pending') state.pending.push({id: first, name, elapsed: second < 0 ? null : second}); + else if (kind === 'rejected') state.rejections.push({id: first, name, reason: detail, at: second}); + else if (kind === 'js') state.jsFunctions.push({id: first, name, calls: second}); + } + return state; +} + +// --- Relay ----------------------------------------------------------------------------------------------------- + +/** + * Publishes the state of `monitor` to C++ for the detached panels of the page `host`, only while one reads. `announce()` + * tells C++ that this page can publish, and starts when a panel already waits; C++ asks later through the page's + * `wfInspect.publish()`. Each publication is answered by whether a panel still reads: when none does, the publications stop + * and the monitor's probe leaves the bridge at the end of its lease. A library without the relay leaves the page silent. + */ +export function createBridgePublisher({monitor, bridge, host, view, period = publishPeriod}) { + let running = false, timer = null, stopped = false; + async function publish() { + timer = null; + let wanted = false; + let forgotten = false; + try { wanted = await bridge.cppFunction(publishFunction)(host, bridge.list(toRows(monitor.read()))); } + catch (error) { + // The connection is gone, or the page is no longer admitted: a later request starts again. A page that the relay + // forgot (it keeps a bounded number of them) announces itself again. + forgotten = error?.code === 'webfront.inspector.unknown'; + } + if (wanted === true && !stopped) timer = view.setTimeout(publish, period); + else running = false; + if (forgotten && !stopped) announce(); + } + async function announce() { + try { if (await bridge.cppFunction(sourceFunction)(host) === true) start(); } + catch { /* an older library: the attached panel still reads the monitor */ } + } + function start() { + if (running || stopped) return; + running = true; + publish(); + } + view[publisherGlobal] = {publish: start}; + return { + get running() { return running; }, + start, + announce, + stop() { + stopped = true; + view.clearTimeout(timer); + timer = null; + running = false; + }, + }; +} + +/** How many times a read starts again because the page published between two pages, before it gives up. */ +export const readingAttempts = 8; + +/** + * The state that the page `host` published, read page after page: `{state, age, source, published}`, where `age` is how + * long ago it was published in milliseconds, `source` whether that page is connected and `published` whether it published + * yet (`state` is null until then). A publication that arrives between two pages starts the read again; after + * `readingAttempts` such changes it throws, so that the panel says the state could not be read. Null once `active()` is + * false: the read is no longer wanted. + */ +export async function readPublishedState(bridge, host, {active = () => true} = {}) { + for (let attempt = 0; attempt < readingAttempts; ++attempt) { + const rows = []; + let cursor = 0, publication = null, age = 0, flags = 0, stable = true; + for (;;) { + if (!active()) return null; + const answer = await bridge.cppFunction(bridgeFunction)(host, cursor, 200); + if (!Array.isArray(answer) || answer.length !== 5 || !Array.isArray(answer[0]) || !answer.slice(1).every(Number.isFinite)) throw unreadable(); + const [list, next, number] = answer; + if (publication !== null && number !== publication) { stable = false; break; } + publication = number; + [, , , age, flags] = answer; + rows.push(...list); + if (!next) break; + if (next <= cursor) throw unreadable(); + cursor = next; + } + if (!stable) continue; + const published = (flags & 2) !== 0; + return {state: published ? fromRows(rows) : null, age, source: (flags & 1) !== 0, published}; + } + throw new Error(`the page published a new state during each of ${readingAttempts} reads; trying again at the next period`); +} + +// --- Panel ----------------------------------------------------------------------------------------------------- + +export const pendingColumns = [ + {key: 'name', label: 'C++ function', text: row => row.name, className: 'name'}, + {key: 'elapsed', label: 'Pending for', text: row => formatDuration(row.elapsed), numeric: true, + title: row => row.elapsed === null ? 'Called before an inspector read this page: when is not known' : ''}, +]; + +export const rejectionColumns = [ + {key: 'at', label: 'Time', text: row => formatTime(row.at), numeric: true}, + {key: 'name', label: 'C++ function', text: row => row.name, className: 'name'}, + {key: 'reason', label: 'Reason', text: row => row.reason, className: 'error-text'}, +]; + +export const calledColumns = [ + {key: 'name', label: 'JavaScript function', text: row => row.name, className: 'name'}, + {key: 'calls', label: 'Calls', text: row => String(row.calls), numeric: true}, +]; + +/** A time of day as hours, minutes, seconds and milliseconds. */ +export function formatTime(milliseconds) { + const date = new Date(milliseconds); + if (Number.isNaN(date.getTime())) return '–'; + const two = value => String(value).padStart(2, '0'); + return `${two(date.getHours())}:${two(date.getMinutes())}:${two(date.getSeconds())}.${String(date.getMilliseconds()).padStart(3, '0')}`; +} + +const readyTexts = { + pending: 'pending: the handshake is not acknowledged yet', + resolved: 'resolved', + rejected: 'rejected', + unknown: 'settled: this page\'s WebFront.js does not tell how, and its outcome is not known yet', + none: 'this page has no WebFront bridge', +}; + +/** What the panel says of webFront.ready. */ +export const describeReady = ready => ready.state === 'rejected' && ready.reason ? `rejected: ${ready.reason}` : readyTexts[ready.state] ?? ready.state; + +export const bridgeStyles = ` +dl.bridge{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;margin:0 0 12px} +dl.bridge dt{color:#a9b3c4} +dl.bridge dd{margin:0;overflow-wrap:anywhere} +dl.bridge dd.rejected{color:#ffbd2e}`; + +/** A published state older than this, in milliseconds, is said to be old: its page stopped publishing. */ +export const staleAfter = 3000; + +/** + * The panel of the bridge. `source()` resolves with `{state, age, source, published}` as readPublishedState does, or null + * when nothing was read: the attached panel gives the monitor of its host page, the detached one the relay. + */ +export async function showBridgePanel({page, view, header, body, status, source}) { + let search = '', failed = false, data = null, last = null; + const summary = page.createElement('dl'); + summary.className = 'bridge'; + const field = label => { + const term = page.createElement('dt'), value = page.createElement('dd'); + term.textContent = label; + summary.append(term, value); + return value; + }; + const fields = {page: field('Page'), ready: field('webFront.ready'), connection: field('Connection'), counts: field('Calls to C++')}; + const pending = createTable(page, {columns: pendingColumns, caption: 'Pending calls to C++ (cppFunction)', sort: 'elapsed', descending: true}); + const rejections = createTable(page, {columns: rejectionColumns, caption: 'Promises rejected lately', sort: 'at', descending: true}); + const called = createTable(page, {columns: calledColumns, caption: 'JavaScript functions called by C++, while an inspector reads', + sort: 'calls', descending: true}); + const show = () => { + if (!data?.state) return; + const {state} = data; + fields.page.textContent = state.page.label ? `${state.page.label} (${state.page.path})` : state.page.path || '–'; + fields.ready.textContent = describeReady(state.ready); + fields.ready.classList.toggle('rejected', state.ready.state === 'rejected'); + fields.connection.textContent = state.connection; + fields.counts.textContent = `${state.pendingTotal} pending, ${state.rejectedTotal} rejected since ${formatTime(state.since)}`; + pending.render(filterRows(state.pending, search, ['name'])); + rejections.render(filterRows(state.rejections, search, ['name', 'reason'])); + called.render(filterRows(state.jsFunctions, search, ['name'])); + tell(); + }; + // The status tells the last read, whatever is shown: a failed read stays told until a read succeeds, and a page that + // is gone or has not published stays told while the rows read earlier are kept and searched. + const tell = () => { + if (failed || !last) return; + status.classList.remove('error'); + if (!last.state) { + status.textContent = last.source ? 'Waiting for the page to publish the state of its bridge…' + : 'The page that opened this panel is not connected: its bridge cannot be read.'; + return; + } + const {state} = last; + const hidden = [state.pendingTotal > state.pending.length ? `${state.pendingTotal - state.pending.length} more pending calls` : '', + state.jsTotal > state.jsFunctions.length + ? `${state.jsSaturated ? 'at least ' : ''}${state.jsTotal - state.jsFunctions.length} more JavaScript functions` : ''].filter(Boolean); + status.textContent = [last.age > staleAfter ? `The page published this state ${formatDuration(last.age)} ago.` : '', + state.history ? '' : 'This page\'s WebFront.js predates the inspectors: the calls are found at each read, without their durations; a call made and settled between two reads, and the JavaScript calls, are not seen.', + hidden.length ? `Not shown: ${hidden.join(', ')}.` : ''].filter(Boolean).join(' '); + }; + const toolbar = createToolbar(page, view, {searchLabel: 'Search the calls', onSearch: text => { search = text; show(); }}); + header.insertBefore(toolbar.pause, header.children[1] ?? null); + const box = table => { + const scroll = page.createElement('div'); + scroll.className = 'scroll'; + scroll.append(table.element); + return scroll; + }; + body.append(toolbar.element, summary, box(pending), box(rejections), box(called)); + const poller = createPoller({ + read: ({active}) => source({active}), + onData: read => { + failed = false; + last = read; + if (read.state) data = read; + if (data) show(); else tell(); + }, + onError: error => { + failed = true; + status.classList.add('error'); + status.textContent = readFailure(error, 'The state of the bridge'); + }, + period: toolbar.chosen, + timers: view, + }); + toolbar.attach(poller); + view.addEventListener('pagehide', () => poller.stop()); + await poller.start(); + return {poller, toolbar, summary, fields, pending, rejections, called}; +} + +/** + * Where a panel reads the state: in a frame, the monitor of the page that holds it, through the same rows as the relay so + * that both show the same thing; detached, what that page published to C++. + */ +export function bridgeSource({view, bridge, framed, host}) { + if (framed) return async () => { + const monitor = view.parent.webfrontInspectorHost?.bridgeState; + if (!monitor) throw new Error('The page that holds this panel does not follow its bridge'); + return {state: fromRows(toRows(monitor.read())), age: 0, source: true, published: true}; + }; + return ({active}) => { + if (!host) throw new Error('This window does not name the page whose bridge it shows: open the panel from the menu'); + return readPublishedState(bridge, host, {active}); + }; +} diff --git a/js/developer/environment/inspector-host.mjs b/js/developer/environment/inspector-host.mjs index ca8c7ced..833b1a11 100644 --- a/js/developer/environment/inspector-host.mjs +++ b/js/developer/environment/inspector-host.mjs @@ -6,6 +6,7 @@ import {readProject, call} from './io.mjs'; import {clampRect, step, minimumSize, windowControls} from './workspace.mjs'; import {inspectorPanels as panels, panelTitle, inspectorChannel} from './menu.mjs'; +import {createBridgeMonitor, createBridgePublisher} from './inspector-bridge.mjs'; const encoder = new TextEncoder(); const decoder = new TextDecoder(); @@ -250,8 +251,9 @@ export async function claimHostIdentifier(view) { * webfront.inspector.embedded(); an error counts as embedded, which never offers a tab). `open(panel)` shows a panel in its * container, `detach(panel)` and `attach(panel)` move it, and `reason(panel)` says why it cannot be detached ('' when it * can). `windowOpen` replaces window.open (tests). `hostId` names this page in its detached windows (claimHostIdentifier()). + * `inspected()` gives the bridge whose state the Bridge panel shows, as `{bridge, label, path}`, or null for this page's own. */ -export async function createInspectorHost({bridge, page, inspectorUrl, access, embedded = null, windowOpen = null, hostId = null}) { +export async function createInspectorHost({bridge, page, inspectorUrl, access, embedded = null, windowOpen = null, hostId = null, inspected = null}) { const view = page.defaultView, root = page.documentElement; const self = hostId ?? await claimHostIdentifier(view); const viewport = () => ({width: root.clientWidth, height: root.clientHeight}); @@ -378,6 +380,8 @@ export async function createInspectorHost({bridge, page, inspectorUrl, access, e * window closed meanwhile) is closed then: the panel stays in the floating window, or closed. */ async function openDetached(id, container) { + // The relay keeps a bounded number of pages: one that lost its place announces itself again when its panel is detached. + if (id === 'typescript.bridge' && containers?.host) publisher.announce(); if (container === 'window') { const rect = shown(), started = action; const attempt = {cancelled: false}; @@ -467,6 +471,13 @@ export async function createInspectorHost({bridge, page, inspectorUrl, access, e if (shownPanel === id && preferences.detached.has(id) && action === started) hideFloating(); } + // The state of the bridge in the page (#684): of the interface when it has a bridge (`inspected`), else of this page. It is + // followed only while a panel reads, and published to C++ for the detached panels of an admitted page. + const bridgeState = createBridgeMonitor({target: () => inspected?.() ?? {bridge, label: 'this page', path: view.location?.pathname ?? ''}, + timers: view, clock: () => view.performance?.now() ?? Date.now()}); + const publisher = createBridgePublisher({monitor: bridgeState, bridge, host: self, view}); + if (containers?.host) publisher.announce(); + const host = { get containers() { return containers; }, get embedded() { return isEmbedded; }, @@ -474,6 +485,10 @@ export async function createInspectorHost({bridge, page, inspectorUrl, access, e get id() { return self; }, /** The bridge this host was created with: the frame of the floating window borrows it (inspector.mjs, pageBridge). */ get bridge() { return bridge; }, + /** The monitor of the bridge in this page (inspector-bridge.mjs): the frame reads it, the detached panels read what it publishes. */ + get bridgeState() { return bridgeState; }, + /** Whether this page publishes the state of its bridge now: a detached Bridge panel reads it. */ + get bridgePublishing() { return publisher.running; }, get shownPanel() { return shownPanel; }, get frame() { return frame; }, panel, bar, detachButton, closeButton, notice, diff --git a/js/developer/environment/inspector-registry.mjs b/js/developer/environment/inspector-registry.mjs index a164a10e..030a38aa 100644 --- a/js/developer/environment/inspector-registry.mjs +++ b/js/developer/environment/inspector-registry.mjs @@ -121,7 +121,7 @@ export function filterRows(rows, search, fields) { } /** Whether a function is one of WebFront's own (the environment's callbacks, the terminal's commands, the DOM bridge). */ -export const ownFunction = name => name.startsWith('webfront.') || name.startsWith('wfDom.') || name.startsWith('wfBind.'); +export const ownFunction = name => name.startsWith('webfront.') || name.startsWith('wfDom.') || name.startsWith('wfBind.') || name.startsWith('wfInspect.'); /** A duration in milliseconds as a short text: microseconds under a millisecond, seconds from a second; "–" when unknown. */ export function formatDuration(milliseconds) { diff --git a/js/developer/environment/inspector.mjs b/js/developer/environment/inspector.mjs index 79a38c60..745a1be4 100644 --- a/js/developer/environment/inspector.mjs +++ b/js/developer/environment/inspector.mjs @@ -3,11 +3,16 @@ // none and borrows that page's bridge, since the adapters give the proof of the view to the main frame only. The panel of the // watches lists them by webfront.inspector.watches and follows the registrations and removals (section 3, "Découverte"); the // tree of each is in inspector-watches.mjs (#682). The panels of the functions and of the browsers are in -// inspector-registry.mjs (#681, section 7), the one of the packages in inspector-packages.mjs (#683). +// inspector-registry.mjs (#681, section 7), the one of the packages in inspector-packages.mjs (#683), the one of the bridge +// in the page in inspector-bridge.mjs (#684). import {inspectorPanels as panels, panelTitle, inspectorChannel as channelName} from './menu.mjs'; import {showFunctionsPanel, showBrowsersPanel, registryStyles, periods, formatPeriod, keptPeriod, keepPeriod, createPoller} from './inspector-registry.mjs'; import {showPackagesPanel, packagesStyles} from './inspector-packages.mjs'; import {createWatchTree, createTreeView, watchTreeStyles} from './inspector-watches.mjs'; +import {showBridgePanel, bridgeSource, bridgeStyles} from './inspector-bridge.mjs'; + +// What a page of the application's origin reads a published state with, as a detached Bridge panel does. +export {readPublishedState} from './inspector-bridge.mjs'; // --- Bridge ---------------------------------------------------------------------------------------------------- @@ -200,10 +205,6 @@ ul.watches .kind{color:#d7fa85;font-family:ui-monospace,monospace;font-size:12px ul.watches .location{grid-column:1/3;color:#a9b3c4;font-size:12px;overflow-wrap:anywhere} ul.watches .writable{color:#8fd0ff;font-size:12px}`; -const placeholders = { - 'typescript.bridge': 'The state of the bridge in the page comes with the next versions of the environment.', -}; - /** * Renders the list of the watches in `list`, one item per watch, kept by id so that a removal removes its item. With * `onToggle(watch, item)`, each item has a button that unfolds the tree of its watch. @@ -272,7 +273,7 @@ export async function main(view = window) { page.title = `WebFront inspector: ${panelTitle(id)}`; reloadWhenRestored(view); const style = page.createElement('style'); - style.textContent = styles + registryStyles + packagesStyles + watchTreeStyles; + style.textContent = styles + registryStyles + packagesStyles + watchTreeStyles + bridgeStyles; page.head.append(style); const header = page.createElement('header'); const heading = page.createElement('h1'); @@ -322,10 +323,8 @@ export async function main(view = window) { return {bridge, ...await show({page, view, header, body, status, bridge})}; } if (id === 'typescript.packages') return {bridge, ...await showPackagesPanel({page, view, header, body, status, bridge})}; - if (id !== 'cpp.watches') { - status.textContent = placeholders[id]; - return {bridge}; - } + if (id === 'typescript.bridge') + return {bridge, ...await showBridgePanel({page, view, header, body, status, source: bridgeSource({view, bridge, framed, host: params.get('host')})})}; const list = page.createElement('ul'); list.className = 'watches'; list.setAttribute('aria-label', 'Watches'); diff --git a/js/developer/environment/runtime.mjs b/js/developer/environment/runtime.mjs index df6d9b43..20a608f2 100644 --- a/js/developer/environment/runtime.mjs +++ b/js/developer/environment/runtime.mjs @@ -19,6 +19,7 @@ import {typescriptPackage, parseCheckOptions, checkHost} from './typecheck.mjs'; import {pinnedStarters} from './bootstrap.mjs'; import {createWorkspace, isManaged, layoutState, State} from './workspace.mjs'; import {prepareInspectors} from './inspector-host.mjs'; +import {interfaceTarget} from './inspector-bridge.mjs'; import {connectAutomation as connectAgent, clipText, automationHelp, onAutomationNotice} from './automation.mjs'; import {ls, cat, tree, mounts, fileCommandHelp, withheld, withheldReason} from './files.mjs'; import {dependencyTree, why as whyInstalled, info as packageInfo} from './dependencies.mjs'; @@ -680,6 +681,7 @@ export async function mount({bridge, config, terminal: element, preview, onExit, }); const workspace = layout && preview && !isManaged(preview) ? await createWorkspace({bridge, element, frame: preview, openInspector}) : null; if (workspace) inspectors = prepareInspectors({bridge, page: element.ownerDocument, access: workspace.inspectorAccess, + inspected: () => interfaceTarget(preview), inspectorUrl: new URL('./inspector.html', import.meta.url).href}); terminal.open(element); fit.fit(); diff --git a/js/developer/tools/bundle-inputs.json b/js/developer/tools/bundle-inputs.json index 33412cf5..6aeffa7a 100644 --- a/js/developer/tools/bundle-inputs.json +++ b/js/developer/tools/bundle-inputs.json @@ -29,6 +29,7 @@ "js/developer/environment/inspector-packages.mjs", "js/developer/environment/inspector-registry.mjs", "js/developer/environment/inspector-watches.mjs", + "js/developer/environment/inspector-bridge.mjs", "js/developer/environment/inspector.html", "js/developer/environment/tarball.mjs", "js/developer/environment/commands.mjs", diff --git a/js/developer/webfront.project.json b/js/developer/webfront.project.json index dc534654..189f4038 100644 --- a/js/developer/webfront.project.json +++ b/js/developer/webfront.project.json @@ -35,6 +35,7 @@ "test/developer/specs/inspector-specs.mjs", "test/developer/specs/inspector-registry-specs.mjs", "test/developer/specs/inspector-watches-specs.mjs", + "test/developer/specs/inspector-bridge-specs.mjs", "test/developer/specs/inspector-packages-specs.mjs", "test/developer/specs/files-specs.mjs", "test/developer/specs/dependencies-specs.mjs", diff --git a/test/developer/specs/inspector-bridge-specs.mjs b/test/developer/specs/inspector-bridge-specs.mjs new file mode 100644 index 00000000..c1e7c265 --- /dev/null +++ b/test/developer/specs/inspector-bridge-specs.mjs @@ -0,0 +1,904 @@ +// Specs of the panel of the bridge in the page (#684, ADR-027 section 8): the monitor that follows a bridge only while an +// inspector reads, the rows of a state, their publication to C++ for a detached panel, the read of what was published, and +// the panel. A real bridge is followed in test/web/suite/specs/bridge-state-specs.mjs. +import {createBridgeMonitor, createBridgePublisher, readPublishedState, toRows, fromRows, emptyState, boundedText, rejectionReason, + ownTraffic, interfaceTarget, defaultLease, digest, showBridgePanel, bridgeSource, describeReady, formatTime, limits, readingAttempts, staleAfter, + sourceFunction, publishFunction, bridgeFunction, publisherGlobal} from '../../../js/developer/environment/inspector-bridge.mjs'; +import {ownFunction} from '../../../js/developer/environment/inspector-registry.mjs'; +import {main} from '../../../js/developer/environment/inspector.mjs'; + +/** A bridge as WebFront.js is one for a monitor: `probe`, `pendingCalls`, the state of `ready`, and calls settled by hand. */ +function fakeWebFront({state = 'linked', readySettled = true, readyError = null} = {}) { + let nextId = 1; + const bridge = {probe: null, readyError, readySettled, state, pendingCalls: new Map(), + /** A call to C++ as callCppFunction makes it; `settle.resolve(value)` or `settle.reject(error)` answer it. */ + call(name) { + const settle = {}; + const promise = new Promise((resolve, reject) => { + if (bridge.probe) [resolve, reject] = bridge.probe.call(name, resolve, reject); + const id = nextId++; + bridge.pendingCalls.set(id, {resolve, reject, name}); + const answer = method => value => { + const pending = bridge.pendingCalls.get(id); + bridge.pendingCalls.delete(id); + pending[method](value); + }; + Object.assign(settle, {resolve: answer('resolve'), reject: answer('reject')}); + }); + promise.catch(() => {}); + return {promise, ...settle}; + }, + /** A call of C++ to JavaScript as callJsFunction tells it. */ + called(name) { bridge.probe?.jsCall(name); }, + }; + return bridge; +} + +/** A clock and timers moved by hand: `advance(ms)` runs the timers that come due. */ +function manualTime() { + let time = 0, next = 1; + const timers = new Map(); + return { + clock: () => time, + now: () => 1_700_000_000_000 + time, + get pending() { return timers.size; }, + setTimeout(run, delay) { timers.set(next, {run, at: time + delay}); return next++; }, + clearTimeout(id) { timers.delete(id); }, + advance(milliseconds) { + const end = time + milliseconds; + for (;;) { + const due = [...timers].filter(([, timer]) => timer.at <= end).sort((a, b) => a[1].at - b[1].at)[0]; + if (!due) break; + timers.delete(due[0]); + time = Math.max(time, due[1].at); + due[1].run(); + } + time = end; + }, + }; +} + +const monitorOf = (bridge, time, options = {}) => createBridgeMonitor({target: () => ({bridge, label: 'interface', path: '/app/'}), + clock: time.clock, now: time.now, timers: time, ...options}); + +/** A C++ relay in memory: one page per host, the lease told by `wanted`. */ +function fakeRelay({wanted = true, pageSize = 200} = {}) { + const relay = {wanted, published: new Map(), publication: 0, calls: [], sources: new Set(), age: 0, + list: items => ({list: [...items]}), + cppFunction: name => async (...args) => { + relay.calls.push([name, ...args]); + if (name === sourceFunction) { relay.sources.add(args[0]); return relay.wanted; } + if (name === publishFunction) { + relay.published.set(args[0], {rows: args[1].list, publication: ++relay.publication}); + return relay.wanted; + } + if (name === bridgeFunction) { + const [host, from, count] = args; + const entry = relay.published.get(host); + relay.onRead?.(from); + if (!entry) return [[], 0, 0, 0, relay.sources.has(host) ? 1 : 0]; + const rows = entry.rows.slice(from, from + Math.min(count, pageSize)); + return [rows, from + rows.length < entry.rows.length ? from + rows.length : 0, entry.publication, relay.age, 3]; + } + throw Object.assign(new Error(`C++ function '${name}' was not found`), {code: 'webfront.notFound'}); + }}; + return relay; +} + +const sampleState = () => ({ + page: {label: 'interface', path: '/app/'}, ready: {state: 'resolved', reason: ''}, connection: 'linked', since: 1_700_000_000_000, + history: true, pendingTotal: 2, rejectedTotal: 1, jsTotal: 1, jsSaturated: false, + pending: [{id: 3, name: 'app.save', elapsed: 1250}, {id: 4, name: 'app.load', elapsed: null}], + rejections: [{id: 5, name: 'app.open', reason: 'app.missing: no such file', at: 1_700_000_001_000}], + jsFunctions: [{id: 6, name: 'draw', calls: 12}], +}); + +function panelParts() { + const header = document.createElement('header'); + header.append(document.createElement('h1')); + const body = document.createElement('main'); + const status = document.createElement('p'); + body.append(status); + return {page: document, header, body, status}; +} + +/** A view for a panel: timers run by hand, a storage and listeners of its own. */ +function panelView() { + let pending = null, next = 1; + const listeners = new Map(); + return { + setTimeout(run) { pending = {id: next, run}; return next++; }, + clearTimeout(id) { if (pending?.id === id) pending = null; }, + fire() { const {run} = pending; pending = null; run(); }, + localStorage: {getItem: () => null, setItem: () => {}}, + addEventListener: (name, handler) => listeners.set(name, handler), + listeners, + }; +} + +const column = (table, index) => table.rows.map(row => row.children[index].textContent); + +describe('The panel of the bridge in the page', () => { + describe('texts', () => { + it('are cut on a character boundary within their bytes, and end with an ellipsis when cut', () => { + expect(boundedText('short')).toBe('short'); + const cut = boundedText('é'.repeat(200)); + expect(new TextEncoder().encode(cut).length).toBeLessThanOrEqual(limits.text); + expect(cut.endsWith('…')).toBeTrue(); + expect(cut.slice(0, -1)).toBe('é'.repeat(126)); + expect(boundedText('😀😀😀', 8)).toBe('😀…'); + }); + + it('show control characters as their pictures, as C++ does', () => { + expect(boundedText('a\nb\u0000c\u007f')).toBe('a␊b␀c␡'); + }); + + it('never throw for a value that cannot be read', () => { + expect(boundedText({toString() { throw new Error('no'); }})).toBe('(a value that cannot be read)'); + expect(rejectionReason({get message() { throw new Error('no'); }, toString() { throw new Error('no'); }})).toBe('A rejection whose reason cannot be read'); + }); + + it('give the reason of a rejection: the code of a coded error, then its message', () => { + expect(rejectionReason(Object.assign(new Error('the user said no'), {code: 'app.denied'}))).toBe('app.denied: the user said no'); + expect(rejectionReason(Object.assign(new Error('C++ callback failed'), {code: 'webfront.error'}))).toBe('C++ callback failed'); + expect(rejectionReason(new Error('plain'))).toBe('plain'); + expect(rejectionReason('a string')).toBe('a string'); + expect(rejectionReason(undefined)).toBe('undefined'); + }); + + it('read the message of an error of another frame, which is not an Error of this page', () => { + const frame = document.createElement('iframe'); + document.body.append(frame); + try { + const foreign = Object.assign(new frame.contentWindow.Error('the user said no'), {code: 'denied'}); + expect(foreign instanceof Error).toBeFalse(); + expect(rejectionReason(foreign)).toBe('denied: the user said no'); + expect(rejectionReason(new frame.contentWindow.TypeError('not a wire value'))).toBe('not a wire value'); + } finally { frame.remove(); } + }); + + it('tell the inspectors\' own traffic, which the registry panel hides too', () => { + expect(ownTraffic('webfront.inspector.functions')).toBeTrue(); + expect(ownTraffic(`${publisherGlobal}.publish`)).toBeTrue(); + expect(ownTraffic('webfront.developer.read')).toBeFalse(); + expect(ownTraffic('app.save')).toBeFalse(); + expect(ownFunction(`${publisherGlobal}.publish`)).toBeTrue(); + }); + }); + + describe('monitor', () => { + it('installs no probe until it is read, and removes it at the end of its lease', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time, {lease: 5000}); + expect(bridge.probe).toBeNull(); + expect(monitor.observing).toBeFalse(); + monitor.read(); + expect(bridge.probe).not.toBeNull(); + expect(monitor.observing).toBeTrue(); + time.advance(4000); + monitor.read(); // a read renews the lease + time.advance(4000); + expect(bridge.probe).not.toBeNull(); + time.advance(1001); + expect(bridge.probe).toBeNull(); + expect(time.pending).toBe(0); + monitor.read(); + expect(bridge.probe).not.toBeNull(); + }); + + it('keeps its probe longer than the slowest period of a panel, so that a panel that reads never misses a call', () => { + expect(defaultLease).toBeGreaterThan(5000 * 2); + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + for (let read = 0; read < 4; ++read) { + monitor.read(); + time.advance(5000 + 500); // the period, and the time a slow read takes + expect(bridge.probe).withContext(`after read ${read}`).not.toBeNull(); + } + }); + + it('lets go of a bridge it no longer observes, and finds its state again when it observes it anew', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const call = bridge.call('app.slow'); + monitor.release(); + expect(monitor.observing).toBeFalse(); + call.reject(new Error('while released')); + await expectAsync(call.promise).toBeRejected(); + const state = monitor.read(); + expect(state.rejections.map(entry => entry.name)).toEqual(['app.slow']); + }); + + it('never removes a probe that is not its own', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const other = {call: (name, resolve, reject) => [resolve, reject], jsCall() {}}; + bridge.probe = other; + monitor.release(); + expect(bridge.probe).toBe(other); + }); + + it('tells the state of ready and of the connection', () => { + const time = manualTime(); + expect(monitorOf(fakeWebFront({state: 'handshaking', readySettled: false}), time).read().ready).toEqual({state: 'pending', reason: ''}); + const resolved = monitorOf(fakeWebFront(), time).read(); + expect(resolved.ready).toEqual({state: 'resolved', reason: ''}); + expect(resolved.connection).toBe('linked'); + expect(resolved.page).toEqual({label: 'interface', path: '/app/'}); + const failure = Object.assign(new Error('WebFront connection closed: connection lost'), {code: 'webfront.disconnected'}); + const rejected = monitorOf(fakeWebFront({state: 'closed', readyError: failure}), time).read(); + expect(rejected.ready).toEqual({state: 'rejected', reason: 'webfront.disconnected: WebFront connection closed: connection lost'}); + expect(rejected.connection).toBe('closed'); + }); + + it('shows a call while it is pending, with how long, then no longer once it is answered', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const call = bridge.call('app.save'); + time.advance(120); + const during = monitor.read(); + expect(during.pending).toEqual([jasmine.objectContaining({name: 'app.save', elapsed: 120})]); + expect(during.pendingTotal).toBe(1); + call.resolve('saved'); + expect(await call.promise).toBe('saved'); + const after = monitor.read(); + expect(after.pending).toEqual([]); + expect(after.rejectedTotal).toBe(0); + }); + + it('shows a rejected Promise with its function, its reason and its time, and keeps the latest only', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + time.advance(10); + const call = bridge.call('app.open'); + call.reject(Object.assign(new Error('no such file'), {code: 'app.missing'})); + await expectAsync(call.promise).toBeRejected(); + const state = monitor.read(); + expect(state.rejections).toEqual([jasmine.objectContaining({name: 'app.open', reason: 'app.missing: no such file', at: time.now()})]); + expect(state.pending).toEqual([]); + for (let index = 0; index < limits.rejections + 5; ++index) bridge.call(`call${index}`).reject(new Error('failed')); + const many = monitor.read(); + expect(many.rejectedTotal).toBe(limits.rejections + 6); + expect(many.rejections.length).toBe(limits.rejections); + expect(many.rejections.at(-1).name).toBe(`call${limits.rejections + 4}`); + }); + + it('adopts the calls made before it read, without a duration, and follows them to their end', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const early = bridge.call('app.early'), failing = bridge.call('app.failing'); + const monitor = monitorOf(bridge, time); + time.advance(50); + expect(monitor.read().pending).toEqual([jasmine.objectContaining({name: 'app.early', elapsed: null}), + jasmine.objectContaining({name: 'app.failing', elapsed: null})]); + early.resolve(1); + failing.reject(new Error('late failure')); + await early.promise; + const state = monitor.read(); + expect(state.pending).toEqual([]); + expect(state.rejections.map(({name, reason}) => [name, reason])).toEqual([['app.failing', 'late failure']]); + }); + + it('still follows to its end a call made while it observed, after its probe is gone', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time, {lease: 1000}); + monitor.read(); + const call = bridge.call('app.slow'); + time.advance(2000); + expect(bridge.probe).toBeNull(); + const unseen = bridge.call('app.unseen'); + call.reject(new Error('too late')); + unseen.reject(new Error('never seen')); + const state = monitor.read(); + expect(state.rejections.map(rejection => rejection.name)).toEqual(['app.slow']); + }); + + it('adopts, when it reads again, the calls made after its probe left, and follows once those it already followed', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time, {lease: 1000}); + monitor.read(); + const followedCall = bridge.call('app.followed'); + time.advance(2000); + expect(bridge.probe).toBeNull(); + const between = bridge.call('app.between'); + const state = monitor.read(); + expect(state.pending.map(({name, elapsed}) => [name, elapsed])).toEqual([['app.followed', 2000], ['app.between', null]]); + expect(state.pendingTotal).toBe(2); + between.reject(new Error('seen after all')); + followedCall.resolve(); + await followedCall.promise; + const after = monitor.read(); + expect(after.pending).toEqual([]); + expect(after.rejections.map(({name, reason}) => [name, reason])).toEqual([['app.between', 'seen after all']]); + expect(after.rejectedTotal).toBe(1); + }); + + it('shows the oldest pending calls within its bound, and counts them all', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + for (let index = 0; index < limits.pending + 7; ++index) bridge.call(`call${index}`); + const state = monitor.read(); + expect(state.pending.length).toBe(limits.pending); + expect(state.pending[0].name).toBe('call0'); + expect(state.pendingTotal).toBe(limits.pending + 7); + }); + + it('counts the JavaScript functions that C++ calls, the most called first, within its bounds', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + bridge.called('before'); + monitor.read(); + bridge.called('draw'); + bridge.called('resize'); + bridge.called('draw'); + const state = monitor.read(); + expect(state.jsFunctions.map(({name, calls}) => [name, calls])).toEqual([['draw', 2], ['resize', 1]]); + for (let index = 0; index < limits.jsNames + 3; ++index) bridge.called(`generated${index}`); + const many = monitor.read(); + expect(many.jsFunctions.length).toBe(limits.jsFunctions); + expect(many.jsFunctions[0].name).toBe('draw'); + // Past the names it keeps, the others are counted together as one more, and the count is no longer exact. + expect(many.jsTotal).toBe(limits.jsNames + 1); + expect(many.jsSaturated).toBeTrue(); + expect(state.jsSaturated).toBeFalse(); + expect(fromRows(toRows(many)).jsSaturated).toBeTrue(); + }); + + it('tells apart two long names that share their label', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const shared = `app.${'x'.repeat(300)}`; + bridge.called(`${shared}.first`); + bridge.called(`${shared}.second`); + bridge.called(`${shared}.first`); + const state = monitor.read(); + expect(state.jsFunctions.map(entry => entry.calls)).toEqual([2, 1]); + expect(state.jsTotal).toBe(2); + // Shown apart too: each label keeps the digest of its whole name, within the bound. + const [first, second] = state.jsFunctions.map(entry => entry.name); + expect(first).not.toBe(second); + expect(first.endsWith(`#${digest(`${shared}.first`)}`)).toBeTrue(); + expect(second.endsWith(`#${digest(`${shared}.second`)}`)).toBeTrue(); + for (const label of [first, second]) expect(new TextEncoder().encode(label).length).toBeLessThanOrEqual(limits.text); + expect(digest(`${shared}.first`)).not.toBe(digest(`${shared}.second`)); + expect(digest('a')).toMatch(/^[0-9a-f]{16}$/); + expect(digest('')).toBe('cbf29ce484222325'); // the FNV-1a offset basis + expect(digest('a')).toBe('af63dc4c8601ec8c'); // FNV-1a 64 of "a" + }); + + it('shows a short name with its control characters made visible, as the relay shows it', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + bridge.called('draw\nframe'); + bridge.called('draw\nframe'); + const [called] = monitor.read().jsFunctions; + expect(called).toEqual(jasmine.objectContaining({name: 'draw\u240aframe', calls: 2})); + expect(fromRows(toRows(monitor.read())).jsFunctions[0].name).toBe('draw\u240aframe'); + }); + + it('keeps of a long name no more than its bounded label', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const long = name => `${name}.${'x'.repeat(100_000)}`; + bridge.called(long('a')); + bridge.called(long('a')); + bridge.called(long('b')); + const state = monitor.read(); + expect(state.jsFunctions.map(entry => entry.calls)).toEqual([2, 1]); + expect(state.jsFunctions.every(entry => new TextEncoder().encode(entry.name).length <= limits.text)).toBeTrue(); + }); + + it('does not show the inspectors\' own traffic', () => { + const bridge = fakeWebFront(), time = manualTime(); + const earlier = bridge.call('webfront.inspector.functions'); + const monitor = monitorOf(bridge, time); + monitor.read(); + bridge.call('webfront.inspector.publishBridge').reject(new Error('denied')); + bridge.called('wfInspect.publish'); + earlier.reject(new Error('denied')); + const state = monitor.read(); + expect(state.pending).toEqual([]); + expect(state.rejections).toEqual([]); + expect(state.jsFunctions).toEqual([]); + }); + + it('never fails a call of the application, whatever the name or the reason', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + const hostile = {toString() { throw new Error('no name'); }}; + const call = bridge.call(hostile); + call.resolve('answered'); + expect(await call.promise).toBe('answered'); + expect(() => bridge.called(hostile)).not.toThrow(); + const rejected = bridge.call('app.fails'); + const reason = {get message() { throw new Error('no'); }, toString() { throw new Error('no'); }}; + rejected.reject(reason); + await expectAsync(rejected.promise).toBeRejectedWith(reason); + expect(monitor.read().rejections.at(-1).reason).toBe('A rejection whose reason cannot be read'); + }); + + it('settles every call of the application even when the monitor fails, also as the bridge closes', async () => { + const bridge = fakeWebFront(), time = manualTime(); + let broken = false; + const monitor = monitorOf(bridge, time, {now: () => { if (broken) throw new Error('clock gone'); return time.now(); }}); + monitor.read(); + const calls = [bridge.call('app.one'), bridge.call('app.two'), bridge.call('app.three')]; + broken = true; + // As WebFront.js does on close: reject every pending call in turn, then clear them. + const closed = Object.assign(new Error('WebFront connection closed'), {code: 'webfront.disconnected'}); + for (const pending of [...bridge.pendingCalls.values()]) expect(() => pending.reject(closed)).not.toThrow(); + for (const call of calls) await expectAsync(call.promise).toBeRejectedWith(closed); + const answered = bridge.call('app.four'); + answered.resolve('kept'); + expect(await answered.promise).toBe('kept'); + }); + + it('finds the pending calls of a bridge that predates the probe at each read, and learns ready from its Promise', async () => { + let rejectReady; + const ready = new Promise((resolve, reject) => { rejectReady = reject; }); + ready.catch(() => {}); + // A WebFront.js before #684: no probe, no readyError, pending calls without their name. + const old = {readySettled: false, state: 'handshaking', ready, pendingCalls: new Map()}; + const time = manualTime(); + const monitor = monitorOf(old, time); + const first = monitor.read(); + expect('probe' in old).withContext('no probe is set on a bridge that would not read it').toBeFalse(); + expect(monitor.observing).toBeFalse(); + expect(first.history).toBeFalse(); + expect(first.ready.state).toBe('pending'); + let settle; + const promise = new Promise((resolve, reject) => { settle = {resolve, reject}; }); + promise.catch(() => {}); + old.pendingCalls.set(1, {...settle}); + expect(monitor.read().pending.map(call => call.name)).toEqual(['(unknown)']); + expect(monitor.read().pending.length).withContext('found once, not at each read').toBe(1); + old.pendingCalls.get(1).reject(new Error('refused')); + old.pendingCalls.delete(1); + await expectAsync(promise).toBeRejected(); + const after = monitor.read(); + expect(after.pending).toEqual([]); + expect(after.rejections.map(rejection => rejection.reason)).toEqual(['refused']); + // ready was rejected: an old bridge is not shown "resolved". + old.readySettled = true; + old.state = 'closed'; + expect(monitor.read().ready.state).toBe('unknown'); + rejectReady(new Error('WebFront connection failed')); + await Promise.resolve(); + await Promise.resolve(); + expect(monitor.read().ready).toEqual({state: 'rejected', reason: 'WebFront connection failed'}); + expect(fromRows(toRows(monitor.read())).history).toBeFalse(); + }); + + it('starts from a new state when the page of the interface is loaded again', () => { + const first = fakeWebFront(), second = fakeWebFront(), time = manualTime(); + let current = first; + const monitor = createBridgeMonitor({target: () => ({bridge: current, label: 'interface', path: '/app/'}), clock: time.clock, now: time.now, timers: time}); + monitor.read(); + first.call('app.old'); + expect(monitor.read().pendingTotal).toBe(1); + current = second; + const state = monitor.read(); + expect(state.pendingTotal).toBe(0); + expect(first.probe).toBeNull(); + expect(second.probe).not.toBeNull(); + }); + + it('wraps a pending call once, however many times the target comes back to its bridge', async () => { + const page = fakeWebFront(), time = manualTime(); + let current = page; + const monitor = createBridgeMonitor({target: () => ({bridge: current, label: 'this page', path: '/'}), clock: time.clock, now: time.now, timers: time}); + monitor.read(); + const call = page.call('app.long'); + const wrapped = [...page.pendingCalls.values()][0].resolve; + for (let reload = 0; reload < 3; ++reload) { + current = fakeWebFront(); // the interface's frame has a bridge + monitor.read(); + current = page; // the frame is loaded again: back to the page's own bridge + expect(monitor.read().pending.map(entry => entry.name)).toEqual(['app.long']); + } + expect([...page.pendingCalls.values()][0].resolve).withContext('the call keeps the wrapper it had').toBe(wrapped); + call.reject(new Error('failed once')); + await expectAsync(call.promise).toBeRejected(); + const state = monitor.read(); + expect(state.rejectedTotal).toBe(1); + expect(state.pending).toEqual([]); + }); + + it('gives the state of a page without a bridge, and of a target that cannot be read', () => { + const time = manualTime(); + expect(createBridgeMonitor({target: () => null, clock: time.clock, now: time.now, timers: time}).read()).toEqual(emptyState()); + const crossOrigin = createBridgeMonitor({target: () => { throw new DOMException('blocked', 'SecurityError'); }, clock: time.clock, now: time.now, timers: time}); + expect(crossOrigin.read().ready.state).toBe('none'); + }); + + it('follows the interface\'s bridge when its frame has one, else leaves the page\'s own', () => { + const bridge = fakeWebFront(); + expect(interfaceTarget({contentWindow: {webFront: bridge, location: {pathname: '/webfront/developer/preview/index.html'}}})) + .toEqual({bridge, label: 'interface', path: '/webfront/developer/preview/index.html'}); + expect(interfaceTarget({contentWindow: {location: {pathname: '/'}}})).toBeNull(); + expect(interfaceTarget({contentWindow: null})).toBeNull(); + expect(interfaceTarget(null)).toBeNull(); + }); + }); + + describe('rows', () => { + it('carry a state both ways, each of one shape: three texts and two numbers', () => { + const rows = toRows(sampleState()); + expect(rows.every(row => row.length === 5 && row.slice(0, 3).every(text => typeof text === 'string') + && row.slice(3).every(Number.isFinite))).toBeTrue(); + expect(fromRows(rows)).toEqual(sampleState()); + expect(fromRows(toRows(emptyState()))).toEqual(emptyState()); + }); + + it('of the fullest state fit what C++ keeps for a page', () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + monitor.read(); + for (let index = 0; index < 300; ++index) { + bridge.call(`pending${index}`); + bridge.call(`rejected${index}`).reject(new Error('x')); + bridge.called(`js${index}`); + } + expect(toRows(monitor.read()).length).toBeLessThanOrEqual(256); + }); + + it('ignore a kind they do not know, and refuse what is not a row', () => { + expect(fromRows([['later', 'x', '', 0, 0], ['connection', 'linked', '', 0, 0]]).connection).toBe('linked'); + expect(() => fromRows([['pending', 'x', '', 0]])).toThrowError(/does not read/); + expect(() => fromRows([['pending', 'x', 3, 0, 0]])).toThrowError(/does not read/); + expect(() => fromRows('rows')).toThrowError(/does not read/); + }); + }); + + describe('publisher', () => { + const setup = (relayOptions = {}) => { + const bridge = fakeWebFront(), time = manualTime(), relay = fakeRelay(relayOptions); + const view = {setTimeout: (run, delay) => time.setTimeout(run, delay), clearTimeout: id => time.clearTimeout(id)}; + const monitor = monitorOf(bridge, time); + const publisher = createBridgePublisher({monitor, bridge: relay, host: 'host-a', view, period: 250}); + return {bridge, time, relay, view, monitor, publisher}; + }; + const settled = async () => { for (let turn = 0; turn < 5; ++turn) await Promise.resolve(); }; + + it('announces the page and publishes nothing while no panel reads', async () => { + const {relay, publisher, bridge, view} = setup({wanted: false}); + await publisher.announce(); + expect(relay.calls).toEqual([[sourceFunction, 'host-a']]); + expect(publisher.running).toBeFalse(); + expect(bridge.probe).withContext('nothing is recorded in the bridge').toBeNull(); + expect(typeof view[publisherGlobal].publish).toBe('function'); + }); + + it('publishes at its period once C++ asks, and stops when told that no panel reads any more', async () => { + const {relay, publisher, bridge, view, time} = setup({wanted: false}); + await publisher.announce(); + relay.wanted = true; + view[publisherGlobal].publish(); + view[publisherGlobal].publish(); // a second request while it publishes starts nothing more + await settled(); + expect(relay.published.get('host-a').publication).toBe(1); + expect(relay.published.get('host-a').rows).toEqual(toRows(fromRows(relay.published.get('host-a').rows))); + expect(bridge.probe).not.toBeNull(); + bridge.call('app.save'); + time.advance(250); + await settled(); + expect(relay.published.get('host-a').publication).toBe(2); + expect(fromRows(relay.published.get('host-a').rows).pending.map(call => call.name)).toEqual(['app.save']); + relay.wanted = false; + time.advance(250); + await settled(); + expect(relay.published.get('host-a').publication).toBe(3); + expect(publisher.running).toBeFalse(); + time.advance(60000); + await settled(); + expect(relay.published.get('host-a').publication).withContext('no publication without a reader').toBe(3); + expect(bridge.probe).withContext('the probe left the bridge with its lease').toBeNull(); + }); + + it('starts at once when a panel already waits for the page that announces itself', async () => { + const {relay, publisher} = setup({wanted: true}); + await publisher.announce(); + await settled(); + expect(relay.published.get('host-a').publication).toBe(1); + expect(publisher.running).toBeTrue(); + publisher.stop(); + }); + + it('announces itself again when the relay forgot the page, and goes on publishing if a panel waits', async () => { + const {relay, publisher} = setup({wanted: true}); + const answer = relay.cppFunction; + let forgotten = true; + relay.cppFunction = name => async (...args) => { + if (name === publishFunction && forgotten) { + relay.calls.push([name, args[0]]); + throw Object.assign(new Error('This page did not announce the state of its bridge'), {code: 'webfront.inspector.unknown'}); + } + if (name === sourceFunction) forgotten = false; + return answer(name)(...args); + }; + publisher.start(); + await settled(); + await settled(); + expect(relay.calls.map(call => call[0])).toEqual([publishFunction, sourceFunction, publishFunction]); + expect(relay.published.get('host-a').publication).toBe(1); + expect(publisher.running).toBeTrue(); + publisher.stop(); + }); + + it('stays silent with a library that has no relay, and stops on a failed publication', async () => { + const {publisher, bridge} = setup(); + const calls = []; + const failing = createBridgePublisher({monitor: monitorOf(bridge, manualTime()), host: 'host-a', view: {setTimeout() {}, clearTimeout() {}}, + bridge: {list: items => items, cppFunction: name => async () => { calls.push(name); throw Object.assign(new Error('not found'), {code: 'webfront.notFound'}); }}}); + await failing.announce(); + expect(calls).toEqual([sourceFunction]); + expect(failing.running).toBeFalse(); + failing.start(); + await settled(); + expect(calls).toEqual([sourceFunction, publishFunction]); + expect(failing.running).toBeFalse(); + publisher.stop(); + }); + }); + + describe('published state', () => { + it('is read page after page', async () => { + const relay = fakeRelay({pageSize: 3}); + relay.sources.add('host-a'); + relay.published.set('host-a', {rows: toRows(sampleState()), publication: 7}); + relay.age = 40; + const read = await readPublishedState(relay, 'host-a'); + expect(read).toEqual({state: sampleState(), age: 40, source: true, published: true}); + expect(relay.calls.map(call => call[2])).toEqual([0, 3, 6]); + }); + + it('starts again when the page published between two pages, and gives up after too many', async () => { + const relay = fakeRelay({pageSize: 3}); + relay.published.set('host-a', {rows: toRows(sampleState()), publication: 1}); + let changes = 1; + relay.onRead = from => { if (from === 3 && changes-- > 0) relay.published.get('host-a').publication = 2; }; + expect((await readPublishedState(relay, 'host-a')).state).toEqual(sampleState()); + relay.onRead = from => { if (from === 3) ++relay.published.get('host-a').publication; }; + relay.calls.length = 0; + await expectAsync(readPublishedState(relay, 'host-a')).toBeRejectedWithError(/during each of 8 reads/); + expect(relay.calls.length).toBe(2 * readingAttempts); + }); + + it('tells a page that has not published yet, and one that is not connected', async () => { + const relay = fakeRelay(); + expect(await readPublishedState(relay, 'gone')).toEqual({state: null, age: 0, source: false, published: false}); + relay.sources.add('host-a'); + expect(await readPublishedState(relay, 'host-a')).toEqual({state: null, age: 0, source: true, published: false}); + }); + + it('stops once it is no longer active, and refuses an answer that is not a page', async () => { + const relay = fakeRelay(); + expect(await readPublishedState(relay, 'host-a', {active: () => false})).toBeNull(); + expect(relay.calls).toEqual([]); + const wrong = {cppFunction: () => async () => [[], 0, 0]}; + await expectAsync(readPublishedState(wrong, 'host-a')).toBeRejectedWithError(/does not read/); + const stuck = {cppFunction: () => async () => [[['js', 'draw', '', 1, 1]], 0.5, 1, 0, 3]}; + await expectAsync(readPublishedState(stuck, 'host-a')).toBeRejectedWithError(/does not read/); + }); + }); + + describe('panel', () => { + const setup = async source => { + const view = panelView(), parts = panelParts(); + const panel = await showBridgePanel({...parts, view, source}); + return {view, panel, ...parts}; + }; + const read = (state, extra = {}) => ({state, age: 0, source: true, published: true, ...extra}); + + it('shows ready, the connection, the pending calls, the rejections and the JavaScript functions', async () => { + const {panel, status} = await setup(async () => read(sampleState())); + expect(panel.fields.page.textContent).toBe('interface (/app/)'); + expect(panel.fields.ready.textContent).toBe('resolved'); + expect(panel.fields.connection.textContent).toBe('linked'); + expect(panel.fields.counts.textContent).toContain('2 pending, 1 rejected since '); + expect(column(panel.pending, 0)).toEqual(['app.save', 'app.load']); + expect(column(panel.pending, 1)).toEqual(['1.25 s', '–']); + expect(column(panel.rejections, 1)).toEqual(['app.open']); + expect(column(panel.rejections, 2)).toEqual(['app.missing: no such file']); + expect(column(panel.rejections, 0)).toEqual([formatTime(1_700_000_001_000)]); + expect(column(panel.called, 0)).toEqual(['draw']); + expect(column(panel.called, 1)).toEqual(['12']); + expect(status.textContent).toBe(''); + }); + + it('follows a call from pending to answered at the next read, and a rejection with its reason', async () => { + let state = sampleState(); + const {panel, view} = await setup(async () => read(state)); + expect(column(panel.pending, 0)).toContain('app.save'); + state = {...sampleState(), pendingTotal: 0, pending: [], rejectedTotal: 2, + rejections: [...sampleState().rejections, {id: 9, name: 'app.save', reason: 'disk full', at: 1_700_000_002_000}]}; + view.fire(); + await panel.poller.settled(); + expect(column(panel.pending, 0)).toEqual([]); + expect(column(panel.rejections, 1)).toEqual(['app.save', 'app.open']); + expect(column(panel.rejections, 2)[0]).toBe('disk full'); + }); + + it('says why ready was rejected', async () => { + const {panel} = await setup(async () => read({...sampleState(), connection: 'closed', + ready: {state: 'rejected', reason: 'webfront.disconnected: WebFront connection closed: connection lost'}})); + expect(panel.fields.ready.textContent).toBe('rejected: webfront.disconnected: WebFront connection closed: connection lost'); + expect(panel.fields.ready.classList.contains('rejected')).toBeTrue(); + expect(describeReady({state: 'pending', reason: ''})).toContain('pending'); + expect(describeReady({state: 'none', reason: ''})).toContain('no WebFront bridge'); + }); + + it('shows the texts of the page as text, never as markup', async () => { + const hostile = ''; + const {panel, body} = await setup(async () => read({...sampleState(), page: {label: hostile, path: hostile}, + pending: [{id: 1, name: hostile, elapsed: 1}], rejections: [{id: 2, name: hostile, reason: hostile, at: 0}], + jsFunctions: [{id: 3, name: hostile, calls: 1}]})); + expect(body.querySelector('img')).toBeNull(); + expect(column(panel.pending, 0)).toEqual([hostile]); + expect(column(panel.rejections, 2)).toEqual([hostile]); + expect(window.injected).toBeUndefined(); + }); + + it('searches the calls by name and by reason', async () => { + const {panel, toolbar = panel.toolbar} = await setup(async () => read(sampleState())); + toolbar.search.value = 'missing'; + toolbar.search.dispatchEvent(new Event('input')); + expect(column(panel.pending, 0)).toEqual([]); + expect(column(panel.rejections, 1)).toEqual(['app.open']); + toolbar.search.value = 'SAVE'; + toolbar.search.dispatchEvent(new Event('input')); + expect(column(panel.pending, 0)).toEqual(['app.save']); + }); + + it('says what is not shown, and that a published state is old', async () => { + const {status} = await setup(async () => read({...sampleState(), pendingTotal: 130, jsTotal: 105}, {age: staleAfter + 2000})); + expect(status.textContent).toContain('The page published this state 5.00 s ago.'); + expect(status.textContent).toContain('128 more pending calls'); + expect(status.textContent).toContain('104 more JavaScript functions'); + expect(status.textContent).not.toContain('at least'); + }); + + it('says when the page\'s WebFront.js predates the inspectors', async () => { + const {status} = await setup(async () => read({...sampleState(), history: false})); + expect(status.textContent).toContain('predates the inspectors'); + expect(describeReady({state: 'unknown', reason: ''})).toContain('not known yet'); + }); + + it('says "at least" for the JavaScript functions it could not count by name', async () => { + const {status} = await setup(async () => read({...sampleState(), jsTotal: 1001, jsSaturated: true})); + expect(status.textContent).toContain('at least 1000 more JavaScript functions'); + }); + + it('waits for a page that has not published yet, and says when that page is not connected', async () => { + let answer = {state: null, age: 0, source: true, published: false}; + const {panel, status, view} = await setup(async () => answer); + expect(status.textContent).toContain('Waiting for the page to publish'); + answer = read(sampleState()); + view.fire(); + await panel.poller.settled(); + expect(status.textContent).toBe(''); + expect(column(panel.pending, 0)).toContain('app.save'); + answer = {state: null, age: 0, source: false, published: false}; + view.fire(); + await panel.poller.settled(); + expect(status.textContent).toContain('is not connected'); + // What was read last stays shown, and searching it does not hide that the page is gone. + expect(column(panel.pending, 0)).toContain('app.save'); + panel.toolbar.search.value = 'save'; + panel.toolbar.search.dispatchEvent(new Event('input')); + expect(column(panel.pending, 0)).toEqual(['app.save']); + expect(status.textContent).toContain('is not connected'); + // The page comes back and has not published yet: the status says so. + answer = {state: null, age: 0, source: true, published: false}; + view.fire(); + await panel.poller.settled(); + expect(status.textContent).toContain('Waiting for the page to publish'); + }); + + it('says when the published state could not be read, keeps the rows, and clears it at the next read', async () => { + let busy = false; + const {panel, status, view} = await setup(async () => { + if (busy) throw new Error('the page published a new state during each of 8 reads; trying again at the next period'); + return read(sampleState()); + }); + busy = true; + view.fire(); + await panel.poller.settled(); + expect(status.classList.contains('error')).toBeTrue(); + expect(status.textContent).toContain('during each of 8 reads'); + expect(column(panel.pending, 0)).toContain('app.save'); + busy = false; + view.fire(); + await panel.poller.settled(); + expect(status.classList.contains('error')).toBeFalse(); + }); + + it('says why a read failed, and clears it when a read succeeds', async () => { + let fail = Object.assign(new Error('denied'), {code: 'webfront.inspector.denied'}); + const {panel, status, view} = await setup(async () => { if (fail) throw fail; return read(sampleState()); }); + expect(status.classList.contains('error')).toBeTrue(); + expect(status.textContent).toContain('not admitted'); + fail = null; + view.fire(); + await panel.poller.settled(); + expect(status.classList.contains('error')).toBeFalse(); + expect(panel.fields.ready.textContent).toBe('resolved'); + }); + + it('pauses and resumes its reads', async () => { + let reads = 0; + const {panel, view} = await setup(async () => { ++reads; return read(sampleState()); }); + panel.toolbar.pause.click(); + expect(panel.poller.paused).toBeTrue(); + expect(panel.toolbar.pause.textContent).toBe('Resume'); + const before = reads; + panel.toolbar.pause.click(); + view.fire(); + await panel.poller.settled(); + expect(reads).toBe(before + 1); + }); + }); + + describe('source of a panel', () => { + it('in a frame is the monitor of the page that holds it, through the same rows as the relay', async () => { + const bridge = fakeWebFront(), time = manualTime(); + const monitor = monitorOf(bridge, time); + const view = {parent: {webfrontInspectorHost: {bridgeState: monitor}}}; + const source = bridgeSource({view, bridge: null, framed: true, host: 'host-a'}); + const call = bridge.call('app.before'); + const first = await source({active: () => true}); + expect(first).toEqual({state: jasmine.objectContaining({connection: 'linked'}), age: 0, source: true, published: true}); + expect(first.state.pending.map(entry => entry.name)).toEqual(['app.before']); + call.resolve(); + // Attached and detached show the same state: what the page would publish, read back. + const relay = fakeRelay(); + const state = monitor.read(); + await relay.cppFunction(publishFunction)('host-a', relay.list(toRows(state))); + expect((await readPublishedState(relay, 'host-a')).state).toEqual((await source({active: () => true})).state); + }); + + it('in a frame whose page does not follow its bridge says so', async () => { + const source = bridgeSource({view: {parent: {webfrontInspectorHost: {}}}, bridge: null, framed: true, host: null}); + await expectAsync(source({active: () => true})).toBeRejectedWithError(/does not follow its bridge/); + }); + + it('detached is what the page named by the window published', async () => { + const relay = fakeRelay(); + relay.published.set('host-a', {rows: toRows(sampleState()), publication: 1}); + const source = bridgeSource({view: {}, bridge: relay, framed: false, host: 'host-a'}); + expect((await source({active: () => true})).state).toEqual(sampleState()); + expect(relay.calls[0]).toEqual([bridgeFunction, 'host-a', 0, 200]); + expect(() => bridgeSource({view: {}, bridge: relay, framed: false, host: null})({active: () => true})).toThrowError(/does not name the page/); + }); + }); + + describe('page', () => { + it('shows the Bridge panel for inspector.html?panel=typescript.bridge, from the monitor of its host in a frame', async () => { + const frame = document.createElement('iframe'); + document.body.append(frame); + try { + const followed = fakeWebFront(), time = manualTime(); + followed.call('app.save'); + const host = {bridge: {ready: Promise.resolve()}, bridgeState: monitorOf(followed, time)}; + const view = {...panelView(), document: frame.contentDocument, parent: {webfrontInspectorHost: host}, + location: {href: 'http://localhost/webfront/developer/environment/inspector.html?panel=typescript.bridge&frame=1'}}; + const shown = await main(view); + expect(frame.contentDocument.title).toBe('WebFront inspector: TypeScript state: Bridge'); + expect(shown.fields.ready.textContent).toBe('resolved'); + expect([...frame.contentDocument.querySelectorAll('table.registry')[0].querySelectorAll('tbody tr')].map(row => row.children[0].textContent)) + .toEqual(['app.save']); + expect(frame.contentDocument.querySelector('dl.bridge')).not.toBeNull(); + expect(followed.probe).withContext('the panel reads: the bridge is followed').not.toBeNull(); + shown.poller.stop(); + } finally { frame.remove(); } + }); + }); +}); diff --git a/test/unit/BridgeStateTests.cpp b/test/unit/BridgeStateTests.cpp new file mode 100644 index 00000000..32491108 --- /dev/null +++ b/test/unit/BridgeStateTests.cpp @@ -0,0 +1,462 @@ +// SPDX-License-Identifier: Apache-2.0 OR CECILL-B +// Author: Ambroise Leclerc +// Created: 2026-11-27 +// +// WebFront — tests/unit +// Role: The relay of the state of a page's bridge: announcement, lease of the publications, bounded pages (#684). +// Thread: worker-safe | Alloc: unrestricted +// LLM: tests of inspect::BridgeStates with an injected clock; the access rules and the wire are in ViewAssociationTests.cpp + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace webfront::bdd; +using namespace webfront; + +namespace { + +using States = inspect::BridgeStates; +using Rows = std::vector; +using namespace std::chrono_literals; + +/// A page that announces itself: how many times it was asked to publish, and whether its connection is there. +struct Page { + int asked = 0; + bool alive = true; + + bool announce(States& states, const std::string& host, States::Clock::time_point now) { + return states.announce( + host, + this, + [this] { + ++asked; + }, + [this] { + return alive; + }, + now); + } +}; + +Rows someRows(std::size_t count, std::size_t textBytes = 4) { + Rows rows; + for (std::size_t index = 0; index < count; ++index) + rows.emplace_back("pending", "call" + std::to_string(index), std::string(textBytes, 'x'), static_cast(index), 1.5); + return rows; +} + +double flagsOf(const inspect::BridgePage& page) { + return std::get<4>(page); +} + +const Scenario bridgeStateLease{ + "A page publishes the state of its bridge only while an inspector reads it (#684)", + {"inspector", "bridge-state"}, + [] { + given("a page that announced itself, which nobody reads", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + const bool wanted = page.announce(states, "host-1", start); + then("it is told that no reader waits, and is not asked to publish", [&] { + require(!wanted); + requireEqual(page.asked, 0); + requireEqual(states.sourceCount(), std::size_t{1}); + }); + when("an inspector reads its state", [&] { + auto read = states.read("host-1", 0, 200, 32768, start + 1s); + then("the page is known, has published nothing yet, and is to be asked to publish", [&] { + requireEqual(flagsOf(read.page), double{inspect::bridge_flag::source}); + require(std::get<0>(read.page).empty()); + requireEqual(std::get<2>(read.page), 0.0); + require(static_cast(read.ask)); + read.ask(); + requireEqual(page.asked, 1); + }); + andWhen("it reads again at once, before the page answered", [&] { + const auto again = states.read("host-1", 0, 200, 32768, start + 1s + 100ms); + then("the page is not asked twice within a second", [&] { + require(!static_cast(again.ask)); + }); + }); + andWhen("the page still has not published a second later", [&] { + const auto later = states.read("host-1", 0, 200, 32768, start + 2s + 100ms); + then("it is asked again", [&] { + require(static_cast(later.ask)); + }); + }); + andWhen("the page publishes", [&] { + const bool goOn = states.publish("host-1", &page, someRows(3), start + 1s + 200ms); + then("it is told to go on: a reader read less than the lease ago", [&] { + require(goOn); + }); + then("the next read gives the rows, their publication and its age, and asks nothing", [&] { + const auto next = states.read("host-1", 0, 200, 32768, start + 1s + 500ms); + require(std::get<0>(next.page) == someRows(3)); + requireEqual(std::get<1>(next.page), 0.0); + requireEqual(std::get<2>(next.page), 1.0); + requireEqual(std::get<3>(next.page), 300.0); + requireEqual(flagsOf(next.page), double{inspect::bridge_flag::source | inspect::bridge_flag::published}); + require(!static_cast(next.ask)); + }); + then("a publication made after the lease is told to stop", [&] { + require(states.publish("host-1", &page, someRows(1), start + 1s + inspect::bridgeLease - 1ms)); + require(!states.publish("host-1", &page, someRows(1), start + 1s + inspect::bridgeLease)); + }); + then("a read after the publications stopped asks the page to start again", [&] { + const auto late = states.read("host-1", 0, 200, 32768, start + 60s); + require(static_cast(late.ask)); + require(std::get<0>(late.page) == someRows(3)); + }); + }); + }); + }); + given("an inspector that reads a page before it announced itself", [&] { + States states; + const States::Clock::time_point start{1000s}; + const auto read = states.read("host-2", 0, 200, 32768, start); + then("no source is known and nothing is asked", [&] { + requireEqual(flagsOf(read.page), 0.0); + require(!static_cast(read.ask)); + requireEqual(states.sourceCount(), std::size_t{0}); + }); + when("the page announces itself within the lease", [&] { + Page page; + then("it is told that a reader waits", [&] { + require(page.announce(states, "host-2", start + 2s)); + }); + }); + when("the page announces itself after the lease", [&] { + Page page; + then("it is told that no reader waits", [&] { + require(!page.announce(states, "host-2", start + inspect::bridgeLease + 1s)); + }); + }); + }); + given("a page that published and then disconnected", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host-3", start); + states.publish("host-3", &page, someRows(2), start); + page.alive = false; + const auto read = states.read("host-3", 0, 200, 32768, start + 1s); + then("its state is forgotten: a read finds no source", [&] { + requireEqual(flagsOf(read.page), 0.0); + require(std::get<0>(read.page).empty()); + requireEqual(states.sourceCount(), std::size_t{0}); + }); + when("the page is loaded again and announces itself under the same identifier", [&] { + Page again; + then("it is told that the reader waits, and starts from an empty state", [&] { + require(again.announce(states, "host-3", start + 2s)); + const auto fresh = states.read("host-3", 0, 200, 32768, start + 2s); + requireEqual(flagsOf(fresh.page), double{inspect::bridge_flag::source}); + }); + }); + }); + given("a page that an inspector reads, which announces itself again", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host-4", start); + static_cast(states.read("host-4", 0, 200, 32768, start + 1s)); + states.publish("host-4", &page, someRows(2), start + 1s); + then("the same connection is told that its reader still waits, and keeps the state it published", [&] { + require(page.announce(states, "host-4", start + 2s)); + const auto kept = states.read("host-4", 0, 200, 32768, start + 2s).page; + require(std::get<0>(kept) == someRows(2)); + requireEqual(std::get<2>(kept), 1.0); + requireEqual(flagsOf(kept), double{inspect::bridge_flag::source | inspect::bridge_flag::published}); + }); + then("another connection under the same identifier is told that the reader waits, and starts from an empty state", [&] { + Page reloaded; + require(reloaded.announce(states, "host-4", start + 2s)); + const auto fresh = states.read("host-4", 0, 200, 32768, start + 2s).page; + require(std::get<0>(fresh).empty()); + requireEqual(flagsOf(fresh), double{inspect::bridge_flag::source}); + }); + then("after the lease, it is told that no reader waits", [&] { + require(!page.announce(states, "host-4", start + 1s + inspect::bridgeLease)); + }); + }); + given("two connections that announce themselves under one identifier", [&] { + States states; + Page earlier, later; + const States::Clock::time_point start{1000s}; + earlier.announce(states, "host-5", start); + later.announce(states, "host-5", start); + states.publish("host-5", &later, someRows(2), start); + then("the publication of the earlier one is refused as unavailable, and the state stays that of the later one", [&] { + std::string code; + try { + states.publish("host-5", &earlier, someRows(5), start); + } catch (const BridgeError& error) { + code = error.code(); + } + requireEqual(code, std::string{inspect::code::unavailable}); + require(std::get<0>(states.read("host-5", 0, 200, 32768, start).page) == someRows(2)); + }); + }); + given("two reads that take the lock in the reverse order of their time", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host-8", start); + static_cast(states.read("host-8", 0, 0, 32768, start + 10s)); + static_cast(states.read("host-8", 0, 0, 32768, start)); + then("the later lease is kept: a publication within it is told to go on", [&] { + require(states.publish("host-8", &page, someRows(1), start + inspect::bridgeLease + 5s)); + }); + }); + given("a read whose time was taken just before a publication", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host-6", start); + states.publish("host-6", &page, someRows(1), start + 5ms); + then("the age it gives is zero, never negative", [&] { + requireEqual(std::get<3>(states.read("host-6", 0, 200, 32768, start).page), 0.0); + }); + }); + given("a reader of a state of several pages while the page publishes again", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host-7", start); + states.publish("host-7", &page, someRows(inspect::maxBridgeRows - 1), start); + const auto first = states.read("host-7", 0, 200, 32768, start).page; + requireEqual(std::get<0>(first).size(), std::size_t{200}); + states.publish("host-7", &page, someRows(3), start + 250ms); + then("the next page is that of the publication it began, not of the newer one", [&] { + const auto second = states.read("host-7", std::get<1>(first), 200, 32768, start + 260ms).page; + requireEqual(std::get<2>(second), std::get<2>(first)); + requireEqual(std::get<0>(second).size(), std::size_t{inspect::maxBridgeRows - 1 - 200}); + requireEqual(std::get<1>(second), 0.0); + auto all = std::get<0>(first); + all.insert(all.end(), std::get<0>(second).begin(), std::get<0>(second).end()); + require(all == someRows(inspect::maxBridgeRows - 1)); + requireEqual(std::get<3>(second), 260.0); + }); + then("a new read starts on the newer publication", [&] { + const auto latest = states.read("host-7", 0, 200, 32768, start + 260ms).page; + require(std::get<0>(latest) == someRows(3)); + requireEqual(std::get<2>(latest), 2.0); + }); + then("once two newer ones came, the publication it began is gone: an empty page under the latest one", [&] { + states.publish("host-7", &page, someRows(4), start + 500ms); + const auto gone = states.read("host-7", std::get<1>(first), 200, 32768, start + 510ms).page; + require(std::get<0>(gone).empty()); + requireEqual(std::get<1>(gone), 0.0); + requireEqual(std::get<2>(gone), 3.0); + }); + }); + given("a page that did not announce itself", [&] { + States states; + Page page; + then("its publication is refused as unknown, the code on which a page announces itself again", [&] { + std::string code; + try { + states.publish("nobody", &page, someRows(1)); + } catch (const BridgeError& error) { + code = error.code(); + } + requireEqual(code, std::string{inspect::code::unknown}); + }); + }); + } +}; + +const Scenario bridgeStateBounds{ + "The relayed state of a bridge is bounded in rows, in bytes and in pages (#684, ADR-027 section 3)", + {"inspector", "bridge-state"}, + [] { + given("a page that announced itself", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "host", start); + when("it publishes more rows than a state holds", [&] { + states.publish("host", &page, someRows(2), start); + then("the publication is refused and the earlier state is kept", [&] { + checkThrows([&] { + states.publish("host", &page, someRows(inspect::maxBridgeRows + 1), start); + }); + require(std::get<0>(states.read("host", 0, 200, 32768, start).page) == someRows(2)); + }); + }); + when("it publishes texts longer than the bound, with control characters", [&] { + Rows rows; + rows.emplace_back(std::string(40, 'k'), std::string(1000, 'n'), std::string("a\nb\x7f"), 1.0, 2.0); + states.publish("host", &page, std::move(rows), start); + const auto stored = std::get<0>(states.read("host", 0, 200, 32768, start).page); + then("each text is cut to its bound and the controls are made visible", [&] { + requireEqual(stored.size(), std::size_t{1}); + require(std::get<0>(stored[0]).size() <= inspect::maxKindBytes); + require(std::get<1>(stored[0]).size() <= inspect::maxTextBytes); + require(std::get<1>(stored[0]).ends_with("\xE2\x80\xA6")); + requireEqual(std::get<2>(stored[0]), + std::string{"a\xE2\x90\x8A" + "b\xE2\x90\xA1"}); + }); + }); + when("it publishes a full state of the longest rows", [&] { + states.publish("host", &page, someRows(inspect::maxBridgeRows, inspect::maxTextBytes), start); + then("the smallest budget still serves it, page after page, each within the budget", [&] { + Rows all; + double cursor = 0; + std::size_t pages = 0; + for (;;) { + const auto served = states.read("host", cursor, 200, inspect::minPageBytes, start).page; + const auto& [rows, next, publication, age, flags] = served; + require(!rows.empty()); + std::size_t bytes = inspect::responseHeaderBytes; + for (const auto& [kind, name, text, first, second] : rows) + bytes += 2 + 2 * 9 + 3 + kind.size() + 3 + name.size() + 3 + text.size(); + require(bytes <= inspect::minPageBytes); + all.insert(all.end(), rows.begin(), rows.end()); + ++pages; + if (next == 0) + break; + require(next > cursor); + cursor = next; + } + require(all == someRows(inspect::maxBridgeRows, inspect::maxTextBytes)); + require(pages > 1); + }); + then("a page holds at most the count asked, and a count of 0 gives the publication alone", [&] { + const auto two = states.read("host", 0, 2, 32768, start).page; + requireEqual(std::get<0>(two).size(), std::size_t{2}); + requireEqual(std::get<1>(two), double(1 * inspect::bridgeCursorStride + 2)); + const auto none = states.read("host", 0, 0, 32768, start).page; + require(std::get<0>(none).empty()); + requireEqual(std::get<2>(none), 1.0); + }); + then("a cursor past the end gives an empty last page, and a cursor that is not a whole number is refused", [&] { + const auto past = states.read("host", 5000, 200, 32768, start).page; + require(std::get<0>(past).empty()); + requireEqual(std::get<1>(past), 0.0); + checkThrows([&] { + static_cast(states.read("host", 1.5, 200, 32768, start)); + }); + checkThrows([&] { + static_cast(states.read("host", 0, -1, 32768, start)); + }); + }); + }); + }); + given("more pages that published than the relay keeps the states of", [&] { + States states; + std::vector pages(inspect::maxBridgeSources + 1); + const States::Clock::time_point start{1000s}; + const auto name = [](std::size_t index) { + return "host" + std::to_string(index); + }; + for (std::size_t index = 0; index < pages.size(); ++index) { + pages[index].announce(states, name(index), start); + // Each page is read, later than the one before, then publishes. + static_cast(states.read(name(index), 0, 0, 32768, start + std::chrono::seconds(index))); + states.publish(name(index), &pages[index], someRows(1), start + std::chrono::seconds(index)); + } + then("the page read the longest ago loses its state, not its place", [&] { + requireEqual(states.sourceCount(), pages.size()); + const auto first = states.read(name(0), 0, 200, 32768, start + 100s); + requireEqual(flagsOf(first.page), double{inspect::bridge_flag::source}); + require(std::get<0>(first.page).empty()); + require(static_cast(first.ask)); + require(std::get<0>(states.read(name(1), 0, 200, 32768, start + 100s).page) == someRows(1)); + }); + then("a page whose lease ended and that publishes last loses its own state, not a page read since", [&] { + // host1 is read now; host0, read the longest ago, publishes once more after its lease. + static_cast(states.read(name(1), 0, 0, 32768, start + 100s)); + require(!states.publish(name(0), &pages[0], someRows(3), start + 100s)); + require(std::get<0>(states.read(name(0), 0, 200, 32768, start + 100s).page).empty()); + require(std::get<0>(states.read(name(1), 0, 200, 32768, start + 100s).page) == someRows(1)); + }); + then("a read of that page asks it, and its next publication is kept", [&] { + auto first = states.read(name(0), 0, 200, 32768, start + 100s); + first.ask(); + requireEqual(pages[0].asked, 1); + require(states.publish(name(0), &pages[0], someRows(2), start + 101s)); + require(std::get<0>(states.read(name(0), 0, 200, 32768, start + 101s).page) == someRows(2)); + }); + }); + given("a connection that announces itself under another identifier", [&] { + States states; + Page page; + const States::Clock::time_point start{1000s}; + page.announce(states, "first", start); + page.announce(states, "second", start); + then("its earlier identifier is dropped: a connection has one page at most", [&] { + requireEqual(states.sourceCount(), std::size_t{1}); + requireEqual(flagsOf(states.read("first", 0, 0, 32768, start).page), 0.0); + requireEqual(flagsOf(states.read("second", 0, 0, 32768, start).page), double{inspect::bridge_flag::source}); + }); + }); + given("a page read within its lease, which disconnects, then another page announces itself", [&] { + States states; + Page gone, other; + const States::Clock::time_point start{1000s}; + gone.announce(states, "host-a", start); + static_cast(states.read("host-a", 0, 0, 32768, start + 1s)); + gone.alive = false; + other.announce(states, "host-b", start + 2s); + then("the page is dropped, but the reader's lease waits for the page that comes back under its identifier", [&] { + requireEqual(states.sourceCount(), std::size_t{1}); + Page back; + require(back.announce(states, "host-a", start + 3s)); + }); + }); + given("two reads of a page not yet announced that take the lock in the reverse order of their time", [&] { + States states; + const States::Clock::time_point start{1000s}; + static_cast(states.read("host-c", 0, 0, 32768, start + 10s)); + static_cast(states.read("host-c", 0, 0, 32768, start)); + then("the later lease is kept for the page that announces itself", [&] { + Page page; + require(page.announce(states, "host-c", start + inspect::bridgeLease + 5s)); + }); + }); + given("more pages announced than the relay knows", [&] { + States states; + std::vector pages(inspect::maxBridgeAnnouncements + 1); + const States::Clock::time_point start{1000s}; + for (std::size_t index = 0; index < inspect::maxBridgeAnnouncements; ++index) { + pages[index].announce(states, "host" + std::to_string(index), start); + if (index > 0) + static_cast(states.read("host" + std::to_string(index), 0, 0, 32768, start + std::chrono::seconds(index))); + } + when("one more announces itself while all of them are connected", [&] { + then("it is refused as unavailable, and no connected page loses its place", [&] { + std::string code; + try { + pages.back().announce(states, "last", start + 1000s); + } catch (const BridgeError& error) { + code = error.code(); + } + requireEqual(code, std::string{inspect::code::unavailable}); + requireEqual(states.sourceCount(), inspect::maxBridgeAnnouncements); + requireEqual(flagsOf(states.read("host0", 0, 0, 32768, start + 1000s).page), double{inspect::bridge_flag::source}); + }); + }); + when("pages disconnected before another one announces itself", [&] { + pages[3].alive = false; + pages[4].alive = false; + pages.back().announce(states, "last", start + 1000s); + then("those are forgotten first, and no connected page loses its place", [&] { + requireEqual(states.sourceCount(), inspect::maxBridgeAnnouncements - 1); + requireEqual(flagsOf(states.read("host0", 0, 0, 32768, start + 1000s).page), double{inspect::bridge_flag::source}); + }); + }); + }); + } +}; + +} // namespace diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 118cca77..45540f48 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -80,7 +80,7 @@ list(APPEND TESTS_LIST WebKitGTKPolicyTests.cpp ContentPolicyTests.cpp HTTPServe list(APPEND TESTS_LIST FormsTests.cpp ReactStoreTests.cpp DomDocumentTests.cpp DomBatchTests.cpp JSFunctionTests.cpp TypeErasedFunctionTests.cpp MessagesTests.cpp IndexFSTests.cpp) list(APPEND TESTS_LIST FileSystemTests.cpp NativeFSTests.cpp DownloadsTests.cpp StorageTests.cpp NativeStorageTests.cpp PtyTests.cpp) list(APPEND TESTS_LIST DefaultFSTests.cpp StdnetShutdownTests.cpp ProfileLeaseTests.cpp SafePathTests.cpp UISubscribersTests.cpp) -list(APPEND TESTS_LIST ReadBindingTests.cpp ViewAssociationTests.cpp WatchTests.cpp WatchTreeTests.cpp WatchPassTests.cpp WatchWriteTests.cpp IntrospectionTests.cpp BroadcastTests.cpp SpaceTests.cpp WebFrontTests.cpp WebLinkTests.cpp CEFPathsTests.cpp CEFMacrosTests.cpp) +list(APPEND TESTS_LIST ReadBindingTests.cpp ViewAssociationTests.cpp WatchTests.cpp WatchTreeTests.cpp WatchPassTests.cpp WatchWriteTests.cpp IntrospectionTests.cpp BridgeStateTests.cpp BroadcastTests.cpp SpaceTests.cpp WebFrontTests.cpp WebLinkTests.cpp CEFPathsTests.cpp CEFMacrosTests.cpp) list(APPEND TESTS_LIST DeveloperTests.cpp WfDriverTests.cpp AutomationTests.cpp AutomationChannelTests.cpp AutomationDiscoveryTests.cpp AutomationMcpHttpTests.cpp AutomationStateTests.cpp JasmineConsumerTests.cpp HostTests.cpp LifeTests.cpp HostLoopTests.cpp StructuredShutdownTests.cpp JsFunctionSenderTests.cpp ApplicationTaskTests.cpp DeferredCallTests.cpp) list(APPEND TESTS_LIST Main.cpp ScenarioIsolation.cpp FrontendUrlTests.cpp ApplicationUrlTests.cpp FrontendContractTests.cpp UIExecutorTests.cpp NativeWindowTests.cpp WindowRegistryTests.cpp CommandsTests.cpp EmbeddedCoreAssetsTests.cpp) if(WEBFRONT_USE_MDDLOG) diff --git a/test/unit/InspectorDistribution.cpp b/test/unit/InspectorDistribution.cpp index 9587fbb6..4de5d3de 100644 --- a/test/unit/InspectorDistribution.cpp +++ b/test/unit/InspectorDistribution.cpp @@ -39,6 +39,9 @@ const Scenario inspectorsAbsent{"A distribution build registers no inspector fun "webfront.inspector.functions", "webfront.inspector.jsFunctions", "webfront.inspector.browsers", + "webfront.inspector.bridgeSource", + "webfront.inspector.publishBridge", + "webfront.inspector.bridge", "webfront.inspector.readPreferences", "webfront.inspector.savePreferences", "webfront.inspector.openWindow", diff --git a/test/unit/ViewAssociationTests.cpp b/test/unit/ViewAssociationTests.cpp index 63ef571a..5c2f5d92 100644 --- a/test/unit/ViewAssociationTests.cpp +++ b/test/unit/ViewAssociationTests.cpp @@ -811,6 +811,84 @@ std::string answerOf(Ask ask) { } } // namespace +const Scenario inspectorBridgeRelay{ + "The state of a page's bridge is published and read by admitted pages only, with the existing wire types (#684, ADR-003)", + {"view-association", "inspector", "bridge-state"}, + [] { + using Rows = std::vector; + // Two rows: the test socket carries client frames of less than 126 bytes. + const Rows rows{ + { "pending", "save", "", 7.0, 125.5}, + { "js", "draw", "\xC3\xA9", 9.0, 3.0}}; + given("the proven view of a bootstrapped application", [&] { + freshNetwork(); + AdmittedBrowser browser{false, true}; + then("the three functions of the relay exist", [&] { + for (const auto* name : {"webfront.inspector.bridgeSource", "webfront.inspector.publishBridge", "webfront.inspector.bridge"}) + require(browser.app.hasCppFunction(name)); + }); + when("it announces the state of its bridge while nobody reads", [&] { + callWith("webfront.inspector.bridgeSource", 21, std::string{"h1"}); + then("it is told not to publish", [&] { + require(ViewSocket::wrote(booleanAnswer(21, false))); + require(!ViewSocket::writtenText().contains("wfInspect.publish")); + }); + andWhen("an inspector reads that state", [&] { + const auto empty = answerOf([] { + callWith("webfront.inspector.bridge", 22, std::string{"h1"}, 0.0, 200.0); + }); + then("the page is asked to publish, by a call to its JavaScript function", [&] { + require(empty.contains("wfInspect.publish")); + require(!empty.contains(inspect::code::denied)); + }); + andWhen("the page publishes its rows", [&] { + callWith("webfront.inspector.publishBridge", 23, std::string{"h1"}, rows); + then("it is told to go on publishing", [&] { + require(ViewSocket::wrote(booleanAnswer(23, true))); + }); + const auto answer = answerOf([] { + callWith("webfront.inspector.bridge", 24, std::string{"h1"}, 0.0, 200.0); + }); + then("the inspector reads the same rows back, encoded as a list of tuples", [&] { + require(answer.contains(encodedValue(rows))); + }); + }); + }); + }); + when("it publishes without having announced itself", [&] { + const auto answer = answerOf([&] { + callWith("webfront.inspector.publishBridge", 25, std::string{"h2"}, rows); + }); + then("the publication is refused as unknown", [&] { + require(answer.contains(inspect::code::unknown)); + }); + }); + when("it names a host with an identifier that is not one", [&] { + const auto answer = answerOf([] { + callWith("webfront.inspector.bridge", 26, std::string{"../host"}, 0.0, 200.0); + }); + then("the call is refused", [&] { + require(answer.contains("Invalid inspector host identifier")); + }); + }); + }); + given("a page that is not admitted, such as the frame of the interface or an external browser", [&] { + freshNetwork(); + AdmittedBrowser browser{false, false}; + then("it can neither announce, nor publish, nor read a state", [&] { + require(answerOf([] { + callWith("webfront.inspector.bridgeSource", 21, std::string{"h1"}); + }).contains(inspect::code::denied)); + require(answerOf([&] { + callWith("webfront.inspector.publishBridge", 22, std::string{"h1"}, rows); + }).contains(inspect::code::denied)); + require(answerOf([] { + callWith("webfront.inspector.bridge", 23, std::string{"h1"}, 0.0, 200.0); + }).contains(inspect::code::denied)); + }); + }); } +}; + const Scenario inspectorRegistryAccess{ "The functions, the JavaScript calls and the browsers are told to an admitted page only (ADR-027, sections 2 and 7)", {"view-association", "inspector"}, @@ -969,6 +1047,15 @@ const Scenario inspectorRegistryAccess{ require(browsers.contains(encodedValue(std::tuple{0.0, double{localClient | started | caller}, std::string{"/"}}).substr(2))); }); }); + given("a developer application that is not bootstrapped, asked for the relay of the bridge", [&] { + freshNetwork(); + webfront::test::TemporaryDirectory project; + InspectorApp app(project.path(), WebFrontConfig{.port = "0"}); + then("it has none of its functions", [&] { + for (const auto* name : {"webfront.inspector.bridgeSource", "webfront.inspector.publishBridge", "webfront.inspector.bridge"}) + require(!app.hasCppFunction(name)); + }); + }); given("a developer application that is not bootstrapped", [&] { freshNetwork(); webfront::test::TemporaryDirectory project; diff --git a/test/web/DeveloperTest.cpp b/test/web/DeveloperTest.cpp index 4b13376b..d3af601f 100644 --- a/test/web/DeveloperTest.cpp +++ b/test/web/DeveloperTest.cpp @@ -317,12 +317,26 @@ class Part { app.cppFunction("test.unwatch", [this](std::string name) { watches.erase(name); }); + // A call that answers only once the page lets it go: the Bridge panel shows it pending meanwhile (#684). + app.cppFunction("test.hold", [this] { + held = true; + return answerOnceLetGo(&app, &held); + }); + app.cppFunction("test.letGo", [this] { + held = false; + }); subscription = app.subscribeUIStarted([injected = false](App::UI ui) mutable { if (!std::exchange(injected, true)) ui.addScript(runScript); }); } + /// Completes once `holding` is false; after thirty seconds at most, so that a failed spec does not keep the call for ever. + static webfront::ResultTask answerOnceLetGo(App* application, std::atomic* holding) { + for (int waits = 0; waits < 3000 && holding->load(); ++waits) + co_await application->resumeAfter(std::chrono::milliseconds(10)); + } + ~Part() { watches.clear(); states->releaseAll(); @@ -383,7 +397,8 @@ class Part { std::shared_ptr states; webfront::Commands commands; webfront::UISubscription subscription; - std::map watches; // used on the server thread only + std::map watches; // used on the server thread only + std::atomic held{false}; // test.hold answers once test.letGo cleared it }; } // namespace diff --git a/test/web/JasmineTest.cpp b/test/web/JasmineTest.cpp index b121da78..b5fb2349 100644 --- a/test/web/JasmineTest.cpp +++ b/test/web/JasmineTest.cpp @@ -243,6 +243,7 @@ class BrowserIntegrationTest { private: TestWF* webFront{}; + atomic echoHeld{false}; // heldEcho answers once releaseHeldEcho cleared it optional rejectedWebSocket; optional cancelledTask; TestState state; @@ -451,6 +452,12 @@ class BrowserIntegrationTest { using Record = tuple>; + /// Answers once `holding` is false; after thirty seconds at most, so that a failed spec does not keep the call for ever. + static ResultTask heldEcho(TestWF* app, string value, atomic* holding) { + for (int waits = 0; waits < 3000 && holding->load(); ++waits) + co_await app->resumeAfter(chrono::milliseconds(10)); + co_return "held:" + value; + } static ResultTask deferredEcho(TestWF* app, string value, int delayMs) { co_await app->resumeAfter(chrono::milliseconds(delayMs)); co_return "deferred:" + value; @@ -500,6 +507,14 @@ class BrowserIntegrationTest { webFront->cppFunction("deferredEcho", [this](string value, int delayMs) { return deferredEcho(webFront, std::move(value), delayMs); }); + // A call that stays pending until the spec releases it: the state of the bridge shows it meanwhile (#684). + webFront->cppFunction("heldEcho", [this](string value) { + echoHeld = true; + return heldEcho(webFront, std::move(value), &echoHeld); + }); + webFront->cppFunction("releaseHeldEcho", [this] { + echoHeld = false; + }); webFront->cppFunction("deferredFailure", [this]() { return deferredFailure(webFront, "rejected after a delay"); }); @@ -904,6 +919,11 @@ class BrowserIntegrationTest { caller.jsFunction("webfrontTests.receiveFromCaller")(token); return "cpp-result:" + token; }); + // Calls a JavaScript function of the page that asks: the state of the bridge tells it (#684). + webFront->cppFunction("callBridgeStateSpecs", [](TestWF::UI caller, const string& token) { + caller.jsFunction("bridgeStateSpecs.called")(token); + return "called:" + token; + }); webFront->cppFunction("browserReady", [this](TestWF::UI ui) { // Raw origin probes create extra sessions; bind calls to the document reporting ready. connectedUI = ui; diff --git a/test/web/developer-specs.mjs b/test/web/developer-specs.mjs index 9320ddd0..17f383a6 100644 --- a/test/web/developer-specs.mjs +++ b/test/web/developer-specs.mjs @@ -1093,6 +1093,61 @@ try { assert(opened.length === 0, 'An embedded view must never open a tab of the inspectors'); floating().querySelector('.webfront-inspector-close').click(); assert(floating().hidden, 'The inspector window must close'); + + // The Bridge entry shows the state of the bridge in the page of the interface (#684, ADR-027 section 8): the + // attached panel reads it in this page, and a detached one reads what this page publishes to C++. + const interfaceBridge = context.preview.contentWindow.webFront ?? webFront; + assert(webFront.probe === null && interfaceBridge.probe === null, 'A bridge that no inspector reads must record nothing'); + await window.webfrontInspectorHost.open('typescript.bridge'); + await until(() => floating() && !floating().hidden, 'The Bridge entry must open the inspector in the floating window'); + const field = index => panel()?.querySelectorAll('dl.bridge dd')[index]?.textContent ?? ''; + await until(() => field(1) === 'resolved', () => `The Bridge panel must tell that ready is resolved: ${field(1)}`); + assert(field(2) === 'linked', `The Bridge panel must tell the connection: ${field(2)}`); + assert(interfaceBridge.probe !== null, 'The bridge of the interface must be followed while the panel reads'); + const tableRows = index => [...(panel()?.querySelectorAll('table.registry')[index]?.querySelectorAll('tbody tr') ?? [])] + .map(row => [...row.children].map(cell => cell.textContent)); + // A call that C++ does not answer yet is pending, then gone; a rejected one is shown with its reason. + // C++ answers test.hold only once test.letGo was called: the call stays pending for as long as the panel needs. + const held = interfaceBridge.cppFunction('test.hold')(); + try { + await until(() => tableRows(0).some(row => row[0] === 'test.hold'), () => `A pending call must be shown: ${JSON.stringify(tableRows(0))}`); + } finally { await interfaceBridge.cppFunction('test.letGo')(); } + await held; + await until(() => !tableRows(0).some(row => row[0] === 'test.hold'), 'An answered call must leave the pending calls'); + await interfaceBridge.cppFunction('test.noSuchFunction')().catch(() => {}); + const rejected = () => tableRows(1).find(row => row[1] === 'test.noSuchFunction'); + await until(rejected, () => `A rejected Promise must be shown: ${JSON.stringify(tableRows(1))}`); + assert(/^webfront\.notFound: /.test(rejected()[2]), `A rejection must be shown with its reason: ${rejected()[2]}`); + if (secondaryWindow) { + // Detached in a native window, the panel reads the relay for this page: its first read asks this page to + // publish, which proves that it named this page and reached C++. The window's document is not reachable + // from here; what it reads is checked below through the same relay. + assert(!window.webfrontInspectorHost.bridgePublishing, 'A page must not publish while no detached panel reads'); + const views = await webFront.cppFunction('test.views')(); + floating().querySelector('.webfront-inspector-detach').click(); + await until(() => floating().hidden, 'A detached Bridge panel must leave the floating window'); + await until(async () => await webFront.cppFunction('test.views')() === views + 1, 'The detached Bridge panel must be a proven view'); + await until(() => window.webfrontInspectorHost.bridgePublishing, + 'The detached Bridge panel must read the state of this page, which then publishes it'); + await webFront.cppFunction('webfront.inspector.closeWindow')('typescript.bridge', window.webfrontInspectorHost.id); + window.webfrontInspectorHost.attach('typescript.bridge'); + await window.webfrontInspectorHost.saved(); + await until(rejected, 'The Bridge panel attached again must show the rejection'); + } + // Detached, the panel reads the relay: this page publishes once a reader asks, and the state is the same. + const {readPublishedState} = await import(`${location.origin}/webfront/developer/environment/inspector.mjs`); + let relayed = null; + await until(async () => (relayed = await readPublishedState(webFront, window.webfrontInspectorHost.id))?.state, + () => `The page must publish the state of its bridge for a detached panel: ${JSON.stringify(relayed)}`); + const attachedRejections = tableRows(1).map(row => [row[1], row[2]]).sort(); + const relayedRejections = relayed.state.rejections.map(rejection => [rejection.name, rejection.reason]).sort(); + assert(JSON.stringify(relayedRejections) === JSON.stringify(attachedRejections), + `A detached panel must read the state that the attached one shows: ${JSON.stringify(relayedRejections)} instead of ${JSON.stringify(attachedRejections)}`); + assert(relayed.state.ready.state === 'resolved' && relayed.state.connection === field(2) && relayed.source && relayed.published, + `The relayed state must tell ready and the connection: ${JSON.stringify(relayed)}`); + assert(`${relayed.state.page.label} (${relayed.state.page.path})` === field(0), `Both must name the same page: ${field(0)}`); + floating().querySelector('.webfront-inspector-close').click(); + assert(floating().hidden, 'The inspector window must close'); } finally { window.open = open; } } assert(here.menus().length === 0, 'The menu must be closed'); diff --git a/test/web/suite/specs/bridge-state-specs.mjs b/test/web/suite/specs/bridge-state-specs.mjs new file mode 100644 index 00000000..52122018 --- /dev/null +++ b/test/web/suite/specs/bridge-state-specs.mjs @@ -0,0 +1,198 @@ +// The state of the bridge in the page, in a real browser (#684, ADR-027 section 8): a call to C++ that is pending is seen +// with its name, then is gone once C++ answered; a rejected Promise is seen with its reason; the JavaScript functions that +// C++ calls are told. The same state crosses the bridge as a list of tuples (the exception of ADR-003: no new wire +// type) when the page publishes it for a detached panel, which reads it back. +// +// These specs run in the frame of wf test, against the WebFront.js and the C++ of this checkout. They follow this frame's +// bridge through the probe that WebFront.js offers to an inspector, as the environment's monitor does (inspector-bridge.mjs, +// whose own specs are test/developer/specs/inspector-bridge-specs.mjs). The frame's connection is not the application's +// view: the relay is reached as the page that holds the frame reaches it, through that page's bridge. + +const hostBridge = () => window.parent.webfrontInspectorHost?.bridge ?? window.parent.webFront; +const relayHost = 'jasmine-bridge-state'; +const relay = {source: 'webfront.inspector.bridgeSource', publish: 'webfront.inspector.publishBridge', read: 'webfront.inspector.bridge'}; + +const reasonOf = error => error?.code && error.code !== 'webfront.error' ? `${error.code}: ${error.message}` : String(error?.message ?? error); + +/** What follows a bridge through its probe: the pending calls, the rejections and the JavaScript calls, as rows of the relay. */ +function follow(bridge) { + const pending = new Set(), rejections = [], js = new Map(); + let sequence = 0; + const track = (name, started, resolve, reject) => { + const entry = {id: ++sequence, name, started}; + pending.add(entry); + return [value => { pending.delete(entry); resolve(value); }, error => { + pending.delete(entry); + rejections.push({id: ++sequence, name, reason: reasonOf(error), at: Date.now()}); + reject(error); + }]; + }; + const probe = { + call: (name, resolve, reject) => track(name, performance.now(), resolve, reject), + jsCall: name => js.set(name, (js.get(name) ?? 0) + 1), + }; + // The calls made before the probe: WebFront.js keeps their name, not when they started. + for (const call of bridge.pendingCalls.values()) [call.resolve, call.reject] = track(call.name, null, call.resolve, call.reject); + bridge.probe = probe; + const elapsed = started => started === null ? null : performance.now() - started; + return { + pending: () => [...pending].map(({name, started}) => ({name, elapsed: elapsed(started)})), + rejections: () => [...rejections], + jsCalls: name => js.get(name) ?? 0, + rows: () => [ + ['ready', !bridge.readySettled ? 'pending' : bridge.readyError ? 'rejected' : 'resolved', String(bridge.readyError?.message ?? ''), 0, 0], + ['connection', bridge.state, '', 0, 0], + ...[...pending].map(call => ['pending', call.name, '', call.id, elapsed(call.started) ?? -1]), + ...rejections.map(rejection => ['rejected', rejection.name, rejection.reason, rejection.id, rejection.at]), + ...[...js].map(([name, calls], index) => ['js', name, '', index + 1, calls]), + ], + release() { if (bridge.probe === probe) bridge.probe = null; }, + }; +} + +/** Every row that the relay gives for `host`, with the publication, the age and the flags of the last page. */ +async function readRelay(bridge, host) { + const rows = []; + for (let cursor = 0, pages = 0; pages < 100; ++pages) { + const [list, next, publication, age, flags] = await bridge.cppFunction(relay.read)(host, cursor, 200); + rows.push(...list); + if (!next) return {rows, publication, age, flags}; + expect(next).toBeGreaterThan(cursor); + cursor = next; + } + throw new Error('The relay never ended'); +} + +describe('The state of the bridge in the page', () => { + let followed; + + beforeAll(() => webFront.ready); + afterEach(() => { + followed?.release(); + followed = null; + }); + + it('records nothing in a bridge that no inspector reads', async () => { + expect(webFront.probe).toBeNull(); + expect(webFront.readyError).toBeNull(); + const answer = webFront.cppFunction('deferredEcho')('unobserved', 100); + // Only the name of a pending call is kept, for an inspector that would come later. + const calls = [...webFront.pendingCalls.values()]; + expect(calls.map(call => call.name)).toContain('deferredEcho'); + expect(calls.every(call => Object.keys(call).sort().join() === 'name,reject,resolve')).toBeTrue(); + expect(await answer).toBe('deferred:unobserved'); + }); + + it('shows a call that is pending with its duration, then no longer once C++ answered', async () => { + followed = follow(webFront); + // C++ answers heldEcho only once releaseHeldEcho was called: the call is pending for as long as the spec looks. + const answer = webFront.cppFunction('heldEcho')('still pending'); + try { + await new Promise(resolve => setTimeout(resolve, 50)); + const pending = followed.pending().find(call => call.name === 'heldEcho'); + expect(pending).withContext(JSON.stringify(followed.pending())).toBeDefined(); + expect(pending.elapsed).toBeGreaterThanOrEqual(40); + } finally { await webFront.cppFunction('releaseHeldEcho')(); } + + expect(await answer).toBe('held:still pending'); + expect(followed.pending().some(call => call.name === 'heldEcho')).toBeFalse(); + expect(followed.rejections()).toEqual([]); + }); + + it('lets an inspector adopt a call that was made before it came, by its name', async () => { + const answer = webFront.cppFunction('heldEcho')('made before'); + try { + followed = follow(webFront); + expect(followed.pending().find(call => call.name === 'heldEcho')?.elapsed).toBeNull(); + } finally { await webFront.cppFunction('releaseHeldEcho')(); } + expect(await answer).toBe('held:made before'); + expect(followed.pending().some(call => call.name === 'heldEcho')).toBeFalse(); + }); + + it('shows a rejected Promise with its function, its reason and its time', async () => { + followed = follow(webFront); + const started = Date.now(); + await expectAsync(webFront.cppFunction('throwFromCpp')()).toBeRejected(); + await expectAsync(webFront.cppFunction('throwCodedFromCpp')()).toBeRejected(); + await expectAsync(webFront.cppFunction('noSuchFunctionOfTheSuite')()).toBeRejected(); + // A call that cannot even be encoded is rejected before it is sent: it is seen too. + await expectAsync(webFront.cppFunction('echoString')(Symbol('not a wire value'))).toBeRejected(); + expect(followed.rejections().length).toBe(4); + const [plain, coded, missing, unsent] = followed.rejections(); + expect(plain.name).toBe('throwFromCpp'); + expect(plain.reason).toContain('C++ callback failed'); + expect(plain.at).toBeGreaterThanOrEqual(started); + expect(coded).toEqual(jasmine.objectContaining({name: 'throwCodedFromCpp', reason: 'denied: the user said no'})); + expect(missing.reason).toMatch(/^webfront\.notFound: /); + expect(unsent.name).toBe('echoString'); + expect(followed.pending()).toEqual([]); + }); + + it('tells the JavaScript functions that C++ calls', async () => { + const tokens = []; + globalThis.bridgeStateSpecs = {called: token => tokens.push(token)}; + try { + followed = follow(webFront); + expect(await webFront.cppFunction('callBridgeStateSpecs')('one')).toBe('called:one'); + expect(await webFront.cppFunction('callBridgeStateSpecs')('two')).toBe('called:two'); + // C++ sends its call to JavaScript before the answer of the call that made it: both were received by now. + expect(tokens).toEqual(['one', 'two']); + expect(followed.jsCalls('bridgeStateSpecs.called')).toBe(2); + } finally { delete globalThis.bridgeStateSpecs; } + }); + + describe('relayed by C++ for a detached panel', () => { + it('is refused to this frame, which is not a view of the application', async () => { + const refused = async (name, ...args) => (await webFront.cppFunction(name)(...args).then(() => null, failure => failure))?.code; + followed = follow(webFront); + const rows = followed.rows(); + followed.release(); // the refusals below are not what these rows tell + expect(await refused(relay.source, relayHost)).toBe('webfront.inspector.denied'); + expect(await refused(relay.publish, relayHost, webFront.list(rows))).toBe('webfront.inspector.denied'); + expect(await refused(relay.read, relayHost, 0, 200)).toBe('webfront.inspector.denied'); + }); + + it('asks the page to publish when a panel reads, and gives the panel the state that the page published', async () => { + const host = hostBridge(); + await host.ready; + // What C++ calls in the page that announced itself: the environment's own publisher, if any, is set aside meanwhile. + const page = window.parent, publisher = page.wfInspect; + let asked = 0; + page.wfInspect = {publish: () => { ++asked; }}; + try { + expect(await host.cppFunction(relay.source)(relayHost)).withContext('nobody reads yet').toBeFalse(); + // (rows, next, publication, age, flags): the page is known (1) and has published nothing (2 is not set). + expect(await readRelay(host, relayHost)).toEqual({rows: [], publication: 0, age: 0, flags: 1}); + for (let waited = 0; !asked && waited < 100; ++waited) await new Promise(resolve => setTimeout(resolve, 20)); + expect(asked).withContext('C++ asked the page to publish').toBe(1); + + followed = follow(webFront); + const pendingCall = webFront.cppFunction('heldEcho')('relayed'); + await expectAsync(webFront.cppFunction('throwCodedFromCpp')()).toBeRejected(); + const published = followed.rows(); + expect(published.map(row => row[0])).toEqual(['ready', 'connection', 'pending', 'rejected']); + expect(await host.cppFunction(relay.publish)(relayHost, host.list(published))).withContext('a panel reads: go on publishing').toBeTrue(); + + const read = await readRelay(host, relayHost); + // The rows cross the bridge both ways as a list of tuples of the existing types, unchanged. + expect(read.rows).toEqual(published); + expect(read.publication).toBeGreaterThan(0); + expect(read.age).toBeGreaterThanOrEqual(0); + expect(read.flags).toBe(3); + expect(read.rows[0].slice(0, 2)).toEqual(['ready', 'resolved']); + expect(read.rows[1].slice(0, 2)).toEqual(['connection', 'linked']); + expect(read.rows[2].slice(0, 2)).toEqual(['pending', 'heldEcho']); + expect(read.rows[3].slice(0, 3)).toEqual(['rejected', 'throwCodedFromCpp', 'denied: the user said no']); + await webFront.cppFunction('releaseHeldEcho')(); + expect(await pendingCall).toBe('held:relayed'); + // A state of more rows than the relay keeps is refused, and the earlier one stays. + const tooMany = Array.from({length: 257}, (unused, index) => ['js', `f${index}`, '', index, 1]); + await expectAsync(host.cppFunction(relay.publish)(relayHost, host.list(tooMany))).toBeRejected(); + expect((await readRelay(host, relayHost)).rows).toEqual(published); + } finally { + await webFront.cppFunction('releaseHeldEcho')().catch(() => {}); + if (publisher === undefined) delete page.wfInspect; else page.wfInspect = publisher; + } + }); + }); +}); diff --git a/test/web/suite/specs/webfront-specs.mjs b/test/web/suite/specs/webfront-specs.mjs index ad0f42dc..f1769718 100644 --- a/test/web/suite/specs/webfront-specs.mjs +++ b/test/web/suite/specs/webfront-specs.mjs @@ -9,6 +9,7 @@ import './content-policy-specs.mjs'; import './dom-specs.mjs'; import './spaces-specs.mjs'; import './inspector-specs.mjs'; +import './bridge-state-specs.mjs'; import { importedValue } from './module-fixture.mjs'; import './async-diagnostics.js';