From 076820c2d5bdd8b19a23543388ec699ac26a294f Mon Sep 17 00:00:00 2001 From: Doug Mealing Date: Fri, 27 Nov 2026 17:57:28 -0500 Subject: [PATCH 01/10] feat(docs-site): the model explorer as one browser app over the docs view docsSiteFile() now writes the explorer as a single-page app instead of a page per screen: a shell, the bundled page code and templates, the theme, a vendored Cytoscape 3.30.2 (MIT), and three data files (explorer.json, explorer-model.js, explorer-stamp.js). Pages are drawn on visit by the same code the static export runs (src/explorer/core.ts), so they are byte for byte the old pages. It runs from file:// with hash routes and follows the model on disk by polling the stamp file. output: "static" keeps the page-per-screen export from the same code; assetBase now applies to it only. The app's files live once at explorer-app/ with a committed copy in every port's package, refreshed by scripts/sync-explorer-app.sh and held by the `explorer app copies` gate. --- changelog.d/explorer-app.md | 16 + docs/features/explorer-site.md | 90 +++-- explorer-app/README.md | 59 ++++ explorer-app/assets/cytoscape.min.js | 32 ++ explorer-app/assets/explorer-app.js | 255 ++++++++++++++ explorer-app/assets/explorer.css | 232 ++++++++++++ explorer-app/assets/explorer.js | 332 ++++++++++++++++++ explorer-app/index.html | 20 ++ scripts/ci-lane-map.txt | 1 + scripts/ci-local.sh | 16 + scripts/sync-explorer-app.sh | 23 ++ .../ExplorerApp/assets/cytoscape.min.js | 32 ++ .../ExplorerApp/assets/explorer-app.js | 255 ++++++++++++++ .../ExplorerApp/assets/explorer.css | 232 ++++++++++++ .../ExplorerApp/assets/explorer.js | 332 ++++++++++++++++++ .../ExplorerApp/index.html | 20 ++ .../explorer-app/assets/cytoscape.min.js | 32 ++ .../explorer-app/assets/explorer-app.js | 255 ++++++++++++++ .../explorer-app/assets/explorer.css | 232 ++++++++++++ .../explorer-app/assets/explorer.js | 332 ++++++++++++++++++ .../metaobjects/explorer-app/index.html | 20 ++ .../explorer_app/assets/cytoscape.min.js | 32 ++ .../explorer_app/assets/explorer-app.js | 255 ++++++++++++++ .../explorer_app/assets/explorer.css | 232 ++++++++++++ .../explorer_app/assets/explorer.js | 332 ++++++++++++++++++ .../documentation/explorer_app/index.html | 20 ++ .../cli/test/explorer-site-ledger.test.ts | 2 +- .../cli/test/gen-docs-generators.test.ts | 10 +- .../packages/cli/test/gen-docs-site.test.ts | 8 +- .../cli/test/unit/rules-inert.test.ts | 6 +- .../src/generators/docs-site-file.ts | 21 +- .../test/docs-site-explorer.test.ts | 12 +- .../typescript/packages/docs-site/README.md | 20 +- .../packages/docs-site/app-src/env.d.ts | 5 + .../packages/docs-site/app-src/index.html | 20 ++ .../packages/docs-site/app-src/main.ts | 194 ++++++++++ .../docs-site/app/assets/cytoscape.min.js | 32 ++ .../docs-site/app/assets/explorer-app.js | 255 ++++++++++++++ .../docs-site/app/assets/explorer.css | 232 ++++++++++++ .../packages/docs-site/app/assets/explorer.js | 332 ++++++++++++++++++ .../packages/docs-site/app/index.html | 20 ++ .../packages/docs-site/assets/explorer.js | 51 ++- .../packages/docs-site/package.json | 3 +- .../packages/docs-site/scripts/build-app.ts | 87 +++++ .../packages/docs-site/src/explorer/core.ts | 241 +++++++++++++ .../packages/docs-site/src/explorer/html.ts | 2 +- .../packages/docs-site/src/explorer/pages.ts | 2 +- .../packages/docs-site/src/explorer/site.ts | 329 +++++++---------- .../docs-site/src/explorer/view-index.ts | 16 +- .../packages/docs-site/src/index.ts | 20 +- .../packages/docs-site/src/link-check.ts | 52 ++- .../packages/docs-site/src/scaffold.ts | 12 + .../docs-site/test/explorer-app.test.ts | 189 ++++++++++ .../docs-site/test/explorer-site.test.ts | 26 +- .../packages/docs-site/tsconfig.app.json | 6 + .../packages/metadata/src/constants.ts | 1 + 56 files changed, 5597 insertions(+), 298 deletions(-) create mode 100644 changelog.d/explorer-app.md create mode 100644 explorer-app/README.md create mode 100644 explorer-app/assets/cytoscape.min.js create mode 100644 explorer-app/assets/explorer-app.js create mode 100644 explorer-app/assets/explorer.css create mode 100644 explorer-app/assets/explorer.js create mode 100644 explorer-app/index.html create mode 100755 scripts/sync-explorer-app.sh create mode 100644 server/csharp/MetaObjects.Codegen/ExplorerApp/assets/cytoscape.min.js create mode 100644 server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js create mode 100644 server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.css create mode 100644 server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.js create mode 100644 server/csharp/MetaObjects.Codegen/ExplorerApp/index.html create mode 100644 server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/cytoscape.min.js create mode 100644 server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer-app.js create mode 100644 server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.css create mode 100644 server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.js create mode 100644 server/java/codegen-base/src/main/resources/metaobjects/explorer-app/index.html create mode 100644 server/python/src/metaobjects/documentation/explorer_app/assets/cytoscape.min.js create mode 100644 server/python/src/metaobjects/documentation/explorer_app/assets/explorer-app.js create mode 100644 server/python/src/metaobjects/documentation/explorer_app/assets/explorer.css create mode 100644 server/python/src/metaobjects/documentation/explorer_app/assets/explorer.js create mode 100644 server/python/src/metaobjects/documentation/explorer_app/index.html create mode 100644 server/typescript/packages/docs-site/app-src/env.d.ts create mode 100644 server/typescript/packages/docs-site/app-src/index.html create mode 100644 server/typescript/packages/docs-site/app-src/main.ts create mode 100644 server/typescript/packages/docs-site/app/assets/cytoscape.min.js create mode 100644 server/typescript/packages/docs-site/app/assets/explorer-app.js create mode 100644 server/typescript/packages/docs-site/app/assets/explorer.css create mode 100644 server/typescript/packages/docs-site/app/assets/explorer.js create mode 100644 server/typescript/packages/docs-site/app/index.html create mode 100644 server/typescript/packages/docs-site/scripts/build-app.ts create mode 100644 server/typescript/packages/docs-site/src/explorer/core.ts create mode 100644 server/typescript/packages/docs-site/test/explorer-app.test.ts create mode 100644 server/typescript/packages/docs-site/tsconfig.app.json diff --git a/changelog.d/explorer-app.md b/changelog.d/explorer-app.md new file mode 100644 index 0000000000..157d53cb87 --- /dev/null +++ b/changelog.d/explorer-app.md @@ -0,0 +1,16 @@ +- **docs-site: the model explorer is one browser app.** `docsSiteFile()` now writes the + explorer as a few files (a shell, the app, the theme, Cytoscape and three data files: + `explorer.json`, `explorer-model.js`, `explorer-stamp.js`) in place of a page per screen. + The app draws every page when it is visited, with the same page code and templates, so each + page is byte-for-byte the one the static site wrote. It runs from `file://` with no server, + addresses each page as `index.html#/`, and follows the model while it is open: it polls + the stamp file about once a second and draws the current page again when `meta gen` rewrites + the model. Cytoscape 3.30.2 (MIT) ships with the site, so the graphs draw offline and the + CDN notice is gone. `docsSiteFile({ output: "static" })` (and `generateExplorerSite({ output: + "static" })`) writes the earlier page-per-screen site from the same code, for publishing + without scripts or for Pagefind; `assetBase` now applies to that export only, which given one + loads Cytoscape from it and ships no copy. The app's files live once at `explorer-app/` and + in every port's package (`scripts/sync-explorer-app.sh`, gated by `explorer app copies`); + the other ports' docs-site generators are still to write them. Generated-output change: the + next `meta gen` replaces the explorer's pages with the app's files, and `meta verify + --codegen` holds the new files to the model as before. diff --git a/docs/features/explorer-site.md b/docs/features/explorer-site.md index 9bf9aa9556..91b62bd4c4 100644 --- a/docs/features/explorer-site.md +++ b/docs/features/explorer-site.md @@ -1,10 +1,14 @@ # The model explorer site -`docsSiteFile()` builds a static site that shows one project: what the software does, how the +`docsSiteFile()` builds a site that shows one project: what the software does, how the model is put together, and whether each requirement claim holds. Every page is drawn from one data file, [`explorer.json`](docs-view.md) (the docs view), which the generator builds during the same `meta gen` run. A page never works a model fact out for itself. +By default the site is one browser app: a handful of files that draw every page when it is +visited, from `file://` with no server, and follow the model while it is open. `output: +"static"` writes every page as its own HTML file instead, from the same page code. + The explorer is the default site. The earlier site (package navigation, a page per object, the Mermaid ER diagrams) is still there as `docsSiteFile({ site: "classic" })`. @@ -35,26 +39,61 @@ generator in the run, wherever it appears in the list, because it reads what the | Generated files per node | The files this run wrote, with the node each came from. Files under a target whose `outDir` lies outside the project are left out, under `meta gen` and `verify --codegen` alike | | Routes per node | The REST routes this run's routes generator mounts; none if the run has no routes generator | -Open `site/index.html` in a browser, or serve the directory. The pages use relative links, so -the site works from any path and from `file://`. +Open `site/index.html` in a browser, or serve the directory. The site uses relative links, so +it works from any path and from `file://`. + +### What it writes + +| File | What it is | +|---|---| +| `index.html` | The app's shell | +| `assets/explorer-app.js` | The app: the explorer's page code and templates, and a router | +| `assets/explorer.css`, `assets/explorer.js` | The theme (yours, when you own it) | +| `assets/cytoscape.min.js` | [Cytoscape.js](https://js.cytoscape.org/) 3.30.2 (MIT), so the graphs draw offline | +| `explorer.json` | The docs view | +| `explorer-model.js` | The view, the prompt texts, the title and any owned templates, as a script | +| `explorer-stamp.js` | A hash of the model file | + +Every page is an address inside the app: `index.html#/model/acme/shop/Order.html`, with the +map's and the trace's query and a member's anchor after it +(`#/map.html?slice=…`, `#/model/acme/shop/Order.html#m-total`). Back, forward, bookmarks and +opening a link in a new tab work as they do on a static site. The app files are the same in +every port; `explorer-app/README.md` at the repository root describes them and the two data +files a port writes beside them. + +### The live view + +Leave the explorer open while you work. About once a second it reloads `explorer-stamp.js`, +and when the stamp has moved (a `meta gen` rewrote the model) it reloads `explorer-model.js` +and draws the page you are on again, keeping the address and the scroll position. A model +file caught half-written is not taken: the app waits for one that carries the new stamp. + +### The static export + +`docsSiteFile({ output: "static" })` writes the earlier layout: a page per screen, the theme, +`assets/cytoscape.min.js`, `assets/explorer-data.js` (the map's data) and `explorer.json`. It +draws its pages with the same code as the app, and the two are held to each other page for +page. Use it to publish the site where scripts are not wanted, or to index it for full-text +search. ### Options | Option | Default | What it does | |---|---|---| | `site` | `"explorer"` | `"classic"` builds the earlier site instead | +| `output` | `"app"` | The explorer only: `"static"` writes a page per screen (see "The static export") | | `subDir` | `"site"` | The directory under the `docs` target | | `title` | the project directory's name | The name in the header and the page titles | | `prompts` | none | An extra directory of prompt `.mustache` sources, so the prompt pages can show the text | | `stamp` | none | Footer text. With none, the pages depend on the model alone | -| `assetBase` | `https://cdn.jsdelivr.net/npm` | Where the graph library loads from (see "Offline use") | +| `assetBase` | none | A static explorer only: load the graph library from this base and ship no copy (see "Offline use"). The classic site's CDN base | | `target` | `"docs"` | The output target | ### Search Every page has a search box over a built-in index of objects, fields, prompts and -requirements; press `/` to jump to it. For full-text search, run -[Pagefind](https://pagefind.app/) over the output after `meta gen`: +requirements; press `/` to jump to it. For full-text search, build the static export and run +[Pagefind](https://pagefind.app/) over it after `meta gen`: ```bash npx pagefind --site docs/generated/site @@ -70,15 +109,17 @@ Pagefind's output is not generated by `meta gen`, so leave `pagefind/` out of th ### Offline use The map, the mini-maps and the trace draw with [Cytoscape.js](https://js.cytoscape.org/), -loaded from `${assetBase}/cytoscape@3.30.2/dist/cytoscape.min.js`. Only those three kinds of -page load it. Opened without network access, every page still renders and the graphs show a -notice in their place. To serve the file yourself, put -`cytoscape@3.30.2/dist/cytoscape.min.js` under a path of your own and pass that path: +which the site ships as `assets/cytoscape.min.js`, so the explorer needs no network access. +A static export loads it only on those three kinds of page. To load it from a mirror of your +own instead, give a static export an `assetBase`: its pages then load +`${assetBase}/cytoscape@3.30.2/dist/cytoscape.min.js` and the site ships no copy. ```ts -docsSiteFile({ assetBase: "/vendor/npm" }) +docsSiteFile({ output: "static", assetBase: "/vendor/npm" }) ``` +If the library does not load, every page still renders and the graphs show a notice. + ## The screens | Screen | Page | What it shows | @@ -130,16 +171,17 @@ copies the templates of both sites to `codegen/docs-site/templates/` (the explor `explorer-*.mustache` files) and their CSS and JS to `codegen/docs-site/assets/` (`explorer.css`, `explorer.js`). Only files that are not there yet are written (`--force` overwrites). `docsSiteFile()` renders with your copies, and a file you did not copy falls back -to the packaged one. A project that ejected the theme before the explorer existed has only the +to the packaged one. The app carries your templates in `explorer-model.js` and draws every +page with them, and writes your CSS and JS in place of its own. A project that ejected the theme before the explorer existed has only the classic files; `meta gen` warns about it, and running `meta eject docs-site` again adds the explorer's files without touching the ones you own. ## Drift and determinism The site prints no date and no build time, its graph layouts start from fixed positions, and -the same model writes the same bytes. `meta verify --codegen` therefore holds it to the model -like any other generated output. Every build also checks its own links and fails on a dangling -one. +the same model writes the same bytes, in both outputs. `meta verify --codegen` therefore holds +it to the model like any other generated output. Every build draws every page and checks its +links, the app's in memory, and fails on a dangling one. ## As a library @@ -157,14 +199,17 @@ generateExplorerSite({ }); ``` -It takes `templatesDir`, `assetsDir`, `assetBase` and `stamp` as well, and throws on a -dangling link. `buildDocsView` also takes the verify payload, the manifest and the routes +It takes `output`, `templatesDir`, `assetsDir`, `assetBase` and `stamp` as well, and throws on +a dangling link. `createExplorer` (the page table both outputs draw from) and +`explorerModelScript` (the model file's writer) are exported too. `buildDocsView` also takes the verify payload, the manifest and the routes ([explorer-data.md](explorer-data.md)); the view's shape is [docs-view.md](docs-view.md). ## Not built yet -- A 3D view of the map, an LLM-written summary, a test-result overlay, a live view served by - the running application, and publishing the site. +- A 3D view of the map, an LLM-written summary, a test-result overlay, a view served by the + running application, and publishing the site. +- The app in the other ports: its files are in each port's package already (see + `explorer-app/README.md`), and each port's docs-site generator is still to write them. - "Hand-written code that imports it": the site reads no import graph, so the object pages say it was not scanned. - Generated-file provenance from the JVM, Python and C# generators (see @@ -172,7 +217,12 @@ dangling link. `buildDocsView` also takes the verify payload, the manifest and t ## Verified by -- `server/typescript/packages/docs-site/test/explorer-site.test.ts`: the shop and crm cases +- `server/typescript/packages/docs-site/test/explorer-app.test.ts`: the files the app output + writes, the model and stamp files, owned templates and theme, and the committed bundle, run + outside a browser, drawing every page the static export writes byte for byte on the shop, crm + and fitness models. `explorer-app/` is what the sources build, and the TypeScript package's + copy equals it (the `explorer app copies` gate checks every port's). +- `server/typescript/packages/docs-site/test/explorer-site.test.ts` (the static export): the shop and crm cases (`fixtures/explorer-conformance/`) and the fitness model (`fixtures/persistence-conformance/canonical/meta.fitness.json`). Every screen is written, links resolve, two builds match byte for byte, status chips and verdict outlines are diff --git a/explorer-app/README.md b/explorer-app/README.md new file mode 100644 index 0000000000..99b0d39545 --- /dev/null +++ b/explorer-app/README.md @@ -0,0 +1,59 @@ +# The model explorer app + +The model explorer as one browser app, which every port's docs-site generator writes beside the +docs view. This directory is the canonical copy; each port's package carries the same bytes. + +Everything here but this README and `assets/cytoscape.min.js` is built. Do not edit it by hand: +change the sources and rebuild. + +```bash +bun server/typescript/packages/docs-site/scripts/build-app.ts # rebuild +bun server/typescript/packages/docs-site/scripts/build-app.ts --check # exit 1 when stale +bash scripts/sync-explorer-app.sh # refresh every port's copy +``` + +The `explorer app copies` step of `scripts/ci-local.sh --only gates` fails when this directory is +stale or a port's copy differs from it. + +## Files + +| File | What it is | Built from | +|---|---|---| +| `index.html` | The shell: loads the data, Cytoscape, the app and the theme | `server/typescript/packages/docs-site/app-src/index.html` | +| `assets/explorer-app.js` | The app: the explorer's page code and templates, and the router around them, as one classic script | `app-src/main.ts`, `src/explorer/{core,pages,html,view-index}.ts`, `templates/explorer-*.mustache`, the Mustache renderer | +| `assets/explorer.css`, `assets/explorer.js` | The theme (`meta eject docs-site` copies them; an owned copy replaces these in the written site) | `server/typescript/packages/docs-site/assets/` | +| `assets/cytoscape.min.js` | [Cytoscape.js](https://js.cytoscape.org/) 3.30.2, MIT (its licence is the file's header), so the graphs draw offline | vendored from the npm package `cytoscape@3.30.2`, `dist/cytoscape.min.js` | + +## Where each port keeps its copy + +| Port | Copy | +|---|---| +| TypeScript | `server/typescript/packages/docs-site/app/` | +| Python | `server/python/src/metaobjects/documentation/explorer_app/` | +| Java and Kotlin | `server/java/codegen-base/src/main/resources/metaobjects/explorer-app/` | +| C# | `server/csharp/MetaObjects.Codegen/ExplorerApp/` | + +## What a port writes beside the app + +A port's generator copies the files above into the site directory and writes three data files of +its own: + +| File | Contents | +|---|---| +| `explorer.json` | The docs view (`docs/features/docs-view.md`) | +| `explorer-model.js` | `window.MO_MODEL = {"stamp":…,"title":…,"footer":…,"texts":{…},"templates":{…},"view":{…}};` — the project's title, the footer text, each prompt's text by node id, any owned explorer templates by basename (sorted keys), and the view, as compact JSON | +| `explorer-stamp.js` | `window.MO_STAMP = "";` | + +The stamp is the first 16 hex digits of the SHA-256 of the model's JSON without the stamp +(`{"title":…,…,"view":…}`). The app polls `explorer-stamp.js` about once a second and reloads +`explorer-model.js` when the stamp moves, so the open page follows a regenerated model. The +TypeScript writer is `explorerModelScript()` in `@metaobjectsdev/docs-site`. + +## Drawing the pages outside a browser + +The bundle sets `globalThis.MoExplorer.explorerFor(model)`, which takes the parsed `MO_MODEL` +object and returns the explorer's page table (`pages`, a map from site path to a function that +draws the page, and `graphData()`). The TypeScript static export (`docsSiteFile({ output: +"static" })`) draws the same pages from the same sources, and +`server/typescript/packages/docs-site/test/explorer-app.test.ts` holds this bundle to them page +for page. diff --git a/explorer-app/assets/cytoscape.min.js b/explorer-app/assets/cytoscape.min.js new file mode 100644 index 0000000000..ff0d7c1796 --- /dev/null +++ b/explorer-app/assets/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2024, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}var u="undefined"==typeof window?null:window,c=u?u.navigator:null;u&&u.document;var d=e(""),h=e({}),p=e((function(){})),f="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),g=function(e){return e&&e.instanceString&&y(e.instanceString)?e.instanceString():null},v=function(t){return null!=t&&e(t)==d},y=function(t){return null!=t&&e(t)===p},m=function(e){return!E(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},b=function(t){return null!=t&&e(t)===h&&!m(t)&&t.constructor===Object},x=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},w=function(e){return"undefined"===f?void 0:null!=e&&e instanceof HTMLElement},E=function(e){return k(e)||C(e)},k=function(e){return"collection"===g(e)&&e._private.single},C=function(e){return"collection"===g(e)&&!e._private.single},S=function(e){return"core"===g(e)},P=function(e){return"stylesheet"===g(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},T=function(t){return function(t){return null!=t&&e(t)===h}(t)&&y(t.then)},_=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},L=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},R={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},V=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=H();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?ge(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=H(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=pe(t)||0,j(n)&&(c=!!n.leading,a=(d="maxWait"in n)?fe(pe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(H())},m},ye=u?u.performance:null,me=ye&&ye.now?function(){return ye.now()}:function(){return Date.now()},be=function(){if(u){if(u.requestAnimationFrame)return function(e){u.requestAnimationFrame(e)};if(u.mozRequestAnimationFrame)return function(e){u.mozRequestAnimationFrame(e)};if(u.webkitRequestAnimationFrame)return function(e){u.webkitRequestAnimationFrame(e)};if(u.msRequestAnimationFrame)return function(e){u.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(me())}),1e3/60)}}(),xe=function(e){return be(e)},we=me,Ee=65599,ke=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*Ee+t.value|0;return r},Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*Ee+e|0},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},Pe=function(e){return 2097152*e[0]+e[1]},De=function(e,t){return[Ce(e[0],t[0]),Se(e[1],t[1])]},Te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return ke({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ge=function(e){e.splice(0,e.length)},Ue=function(e,t,n){return n&&(t=N(n,t)),e[t]},Ze=function(e,t,n,r){n&&(t=N(n,t)),e[t]=r},$e="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Qe=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Je,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];m(t.classes)?l=t.classes:v(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=m.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},ot={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!i){var T=S*u+C;!i&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},pt=Math.sqrt(2),ft=function(e,t,n){0===n.length&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=ft(i,e,t),n--}return t},vt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/pt);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},kt=function(e,t){return Math.sqrt(Ct(e,t))},Ct=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},St=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Mt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Bt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},It=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},At=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ot=function(e,t){return Lt(e,t.x1,t.y1)&&Lt(e,t.x2,t.y2)},Rt=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,d=i/2,h=a/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=n-d+c-o,v=r-h-o,y=n+d-c+o,m=v;if((s=Zt(e,t,n,r,g,v,y,m,!1)).length>0)return s}if(f){var b=n+d+o,x=r-h+c-o,w=b,E=r+h-c+o;if((s=Zt(e,t,n,r,b,x,w,E,!1)).length>0)return s}if(p){var k=n-d+c-o,C=r+h+o,S=n+d-c+o,P=C;if((s=Zt(e,t,n,r,k,C,S,P,!1)).length>0)return s}if(f){var D=n-d-o,T=r-h+c-o,_=D,M=r+h-c+o;if((s=Zt(e,t,n,r,D,T,_,M,!1)).length>0)return s}var B=n-d+c,N=r-h+c;if((l=Gt(e,t,n,r,B,N,c+o)).length>0&&l[0]<=B&&l[1]<=N)return[l[0],l[1]];var z=n+d-c,I=r-h+c;if((l=Gt(e,t,n,r,z,I,c+o)).length>0&&l[0]>=z&&l[1]<=I)return[l[0],l[1]];var A=n+d-c,L=r+h-c;if((l=Gt(e,t,n,r,A,L,c+o)).length>0&&l[0]>=A&&l[1]>=L)return[l[0],l[1]];var O=n-d+c,R=r+h-c;return(l=Gt(e,t,n,r,O,R,c+o)).length>0&&l[0]<=O&&l[1]>=R?[l[0],l[1]]:[]},Vt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ft=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},jt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Yt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Xt=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Ht(c,-l);d=Wt(g)}else d=c;return Yt(e,t,d)},Wt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ut=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Zt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Ut(e,n,o)===o?[o,s]:Ut(e,n,i)===i?[i,a]:Ut(i,o,n)===n?[n,r]:[]:[]},$t=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Ht(g,-s);u=Wt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Cn,o=r,s=0;s=2?Mn(e,t,n,0,Dn,Tn):Mn(e,t,n,0,Pn)},squaredEuclidean:function(e,t,n){return Mn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Mn(e,t,n,0,Pn)},max:function(e,t,n){return Mn(e,t,n,-1/0,_n)}};function Nn(e,t,n,r,i,a){var o;return o=y(e)?e:Bn[e]||Bn.euclidean,0===t&&y(e)?o(i,a):o(t,n,r,i,a)}Bn["squared-euclidean"]=Bn.squaredEuclidean,Bn.squaredeuclidean=Bn.squaredEuclidean;var zn=He({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),In=function(e){return zn(e)},An=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Nn(e,r.length,a,(function(e){return r[e](t)}),o,s)},Ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},jn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=rr(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=rr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},lr=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},ur={};[nt,at,ot,lt,ct,ht,vt,sn,un,dn,pn,kn,Kn,Jn,ar,{hierholzer:function(e){if(!b(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=or(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=v(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=p(i);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var y in f.unshift(l.getElementById(g.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:sr,htbc:sr,htb:sr,hopcroftTarjanBiconnectedComponents:sr},{tarjanStronglyConnected:lr,tsc:lr,tscc:lr,tarjanStronglyConnectedComponents:lr}].forEach((function(e){L(ur,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var cr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};cr.prototype={fulfill:function(e){return dr(this,1,"fulfillValue",e)},reject:function(e){return dr(this,2,"rejectReason",e)},then:function(e,t){var n=new cr;return this.onFulfilled.push(fr(e,n,"fulfill")),this.onRejected.push(fr(t,n,"reject")),hr(this),n.proxy}};var dr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,hr(e)),e},hr=function(e){1===e.state?pr(e,"onFulfilled",e.fulfillValue):2===e.state&&pr(e,"onRejected",e.rejectReason)},pr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1};var ri=function(e,t){var n=this.__data__,r=Qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ii(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){m(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};qi.className=qi.classNames=qi.classes;var Yi={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:I,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yi.variable="(?:[\\w-.]|(?:\\\\"+Yi.metaChar+"))+",Yi.className="(?:[\\w-]|(?:\\\\"+Yi.metaChar+"))+",Yi.value=Yi.string+"|"+Yi.number,Yi.id=Yi.variable,function(){var e,t,n;for(e=Yi.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Yi.comparatorOp+="|\\!"+t)}();var Xi=0,Wi=1,Hi=2,Ki=3,Gi=4,Ui=5,Zi=6,$i=7,Qi=8,Ji=9,ea=10,ta=11,na=12,ra=13,ia=14,aa=15,oa=16,sa=17,la=18,ua=19,ca=20,da=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*A(e,t)}(e.selector,t.selector)})),ha=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return je("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return je("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&je("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return v(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Xi:var l=e(s);return l.substring(0,l.length-1);case Ki:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ui:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Gi:return"["+r.field+"]";case Zi:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case $i:return s;case Qi:return"#"+s;case Ji:return"."+s;case sa:case aa:return i(r.parent,a)+n(">")+i(r.child,a);case la:case oa:return i(r.ancestor,a)+" "+i(r.descendant,a);case ua:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case ca:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ba(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Ba)},_a.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Na)},_a.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,za)},_a.ancestors=_a.parents,(Pa=Da={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pa.data,Pa.removeAttr=Pa.removeData;var Ia,Aa,La=Da,Oa={};function Ra(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:Va("indegree",(function(e,t){return et})),minOutdegree:Va("outdegree",(function(e,t){return et}))}),L(Oa,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,y=g;g&&(f=f[0]);var m=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+m[e]):void 0!==i&&p.position({x:i.x+m.x,y:i.y+m.y})}}else if(!a)return;return this}}).modelPosition=Ia.point=Ia.position,Ia.modelPositions=Ia.points=Ia.positions,Ia.renderedPoint=Ia.renderedPosition,Ia.relativePoint=Ia.relativePosition;var qa,Ya,Xa=Aa;qa=Ya={},Ya.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Ya.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Ya.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ka=function(e,t){return null==t?e:Ha(e,t.x1,t.y1,t.x2,t.y2)},Ga=function(e,t,n){return Ue(e,t,n)},Ua=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Nt(u,1),Ha(e,u.x1,u.y1,u.x2,u.y2)}}},Za=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Ga(a,"labelWidth",n),p=Ga(a,"labelHeight",n),f=Ga(a,"labelX",n),g=Ga(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=i.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?Ga(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,Ha(e,o,l,s,u),Ha(i.labelBounds.all,o,l,s,u)}return e}},$a=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=_t(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;Ha(h,n=o-S,i=s-P,r=o+S,a=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,i,a=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(a>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(zt(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,i=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+i,y2:n.y2+i,w:n.w,h:n.h});Mt(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),Ha(h,n-=k,i-=k,r+=k,a+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,i=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(i>(a=T[1].y)){var M=i;i=a,a=M}Ha(h,n-k,i-k,r+k,a+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((i=I.y)>(a=A.y)){var O=i;i=a,a=O}Ha(h,n-=k,i-=k,r+=k,a+=k)}if(c&&t.includeEdges&&g&&(Ua(h,e,"mid-source"),Ua(h,e,"mid-target"),Ua(h,e,"source"),Ua(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Ha(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};It(F,h),zt(F,y),Nt(F,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ha(h,n-E,i-E,r+E,a+E));var j=p.overlayBounds=p.overlayBounds||{};It(j,h),zt(j,y),Nt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=_t(),c&&t.includeLabels&&(t.includeMainLabels&&Za(h,e,null),g&&(t.includeSourceLabels&&Za(h,e,"source"),t.includeTargetLabels&&Za(h,e,"target")))}return h.x1=Wa(h.x1),h.y1=Wa(h.y1),h.x2=Wa(h.x2),h.y2=Wa(h.y2),h.w=Wa(h.x2-h.x1),h.h=Wa(h.y2-h.y1),h.w>0&&h.h>0&&b&&(zt(h,y),Nt(h,1)),h},Qa=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:bo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},wo.removeAllListeners=function(){return this.removeListener("*")},wo.emit=wo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,m(t)||(t=[t]),Co(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&v(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(b(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(v(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Go.neighbourhood=Go.neighborhood,Go.closedNeighbourhood=Go.closedNeighborhood,Go.openNeighbourhood=Go.openNeighborhood,L(Go,{source:Ta((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ta((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Qo({attr:"source"}),targets:Qo({attr:"target"})}),L(Go,{edgesWith:Ta(Jo(),"edgesWith"),edgesTo:Ta(Jo({thisIsSrc:!0}),"edgesTo")}),L(Go,{connectedEdges:Ta((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Go.componentsOf=Go.components;var ts=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $e,a=!1;if(t){if(t.length>0&&b(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new Je,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new ts(a,e),V=0;V0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var T=0;T1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),as=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},os={linear:function(e,t,n){return e+(t-e)*n},ease:as(.25,.1,.25,1),"ease-in":as(.42,0,1,1),"ease-out":as(0,0,.58,1),"ease-in-out":as(.42,0,.58,1),"ease-in-sine":as(.47,0,.745,.715),"ease-out-sine":as(.39,.575,.565,1),"ease-in-out-sine":as(.445,.05,.55,.95),"ease-in-quad":as(.55,.085,.68,.53),"ease-out-quad":as(.25,.46,.45,.94),"ease-in-out-quad":as(.455,.03,.515,.955),"ease-in-cubic":as(.55,.055,.675,.19),"ease-out-cubic":as(.215,.61,.355,1),"ease-in-out-cubic":as(.645,.045,.355,1),"ease-in-quart":as(.895,.03,.685,.22),"ease-out-quart":as(.165,.84,.44,1),"ease-in-out-quart":as(.77,0,.175,1),"ease-in-quint":as(.755,.05,.855,.06),"ease-out-quint":as(.23,1,.32,1),"ease-in-out-quint":as(.86,0,.07,1),"ease-in-expo":as(.95,.05,.795,.035),"ease-out-expo":as(.19,1,.22,1),"ease-in-out-expo":as(1,0,0,1),"ease-in-circ":as(.6,.04,.98,.335),"ease-out-circ":as(.075,.82,.165,1),"ease-in-out-circ":as(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return os.linear;var r=is(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":as};function ss(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function ls(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function us(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=ls(e,i),s=ls(t,i);if(x(o)&&x(s))return ss(a,o,s,n,r);if(m(o)&&m(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=os[d].apply(null,h)):o.easingImpl=os[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};ds(g.x,y.x)&&(m.x=us(g.x,y.x,p,f)),ds(g.y,y.y)&&(m.y=us(g.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ds(b.x,x.x)&&(w.x=us(b.x,x.x,p,f)),ds(b.y,x.y)&&(w.y=us(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ds(k,C)&&(a.zoom=Tt(a.minZoom,us(k,C,p,f),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||hs(0,d,e),cs(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var fs={animate:Fi.animate(),animation:Fi.animation(),animated:Fi.animated(),clearQueue:Fi.clearQueue(),delay:Fi.delay(),delayAnimation:Fi.delayAnimation(),stop:Fi.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ps(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&xe((function(n){ps(n,e),t()}))}()}}},gs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},vs=function(e){return v(e)?new ka(e):e},ys={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new xo(gs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,vs(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,vs(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,vs(t),n),this},once:function(e,t,n){return this.emitter().one(e,vs(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fi.eventAliasesOn(ys);var ms={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ms.jpeg=ms.jpg;var bs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=v(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(L({},e,{cy:this,eles:r}));return i}Ve("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ve("A `name` must be specified to make a layout");else Ve("Layout options must be specified to make a layout")}};bs.createLayout=bs.makeLayout=bs.layout;var xs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Es.invalidateDimensions=Es.resize;var ks={collection:function(e,t){return v(e)?this.$(e):E(e)?e.collection():m(e)?(t||(t={}),new ts(this,e,t.unique,t.removed)):new ts(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ks.elements=ks.filter=ks.$;var Cs={};Cs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],P=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],_=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(P-S)*g),Math.round(D+(T-D)*g)];n={bypass:i.bypass,name:i.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,z=0;z0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ss={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){je("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new ka(l).invalid){je("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){je("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(je("Skipping property: Invalid property definition in: "+r),o());else je("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var p=this.parse(e,u[4]);if(!p||p.mapped)return!1;var f=this.parse(e,u[5]);if(!f||f.mapped)return!1;if(p.pfValue===f.pfValue||p.strValue===f.strValue)return je("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var g=p.value,b=f.value;if(!(g[0]!==b[0]||g[1]!==b[1]||g[2]!==b[2]||g[3]!==b[3]&&(null!=g[3]&&1!==g[3]||null!=b[3]&&1!==b[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:p.value,valueMax:f.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):m(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",P=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&P?1===E.length&&v(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var _,B,N=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var V={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?V.pfValue=t:V.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(V.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(V.pfValue="rad"===z?t:(_=t,Math.PI*_/180)),"%"===z&&(V.pfValue=t/100),V}if(c.propList){var F=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),x(e)?n=e:b(e)&&(n=e.level,null!=e.position?t=yt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;x(l.x)&&(t.pan.x=l.x,o=!1),x(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(v(e)){var n=e;e=this.mutableElements().filter(n)}else E(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};As.centre=As.center,As.autolockNodes=As.autolock,As.autoungrabifyNodes=As.autoungrabify;var Ls={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ls.attr=Ls.data,Ls.removeAttr=Ls.removeData;var Os=function(e){var t=this,n=(e=L({},e)).container;n&&!w(n)&&w(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==u&&void 0!==n&&!e.headless,o=e;o.layout=L({name:a?"grid":"null"},o.layout),o.renderer=L({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ts(this),listeners:[],aniEles:new ts(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:x(o.zoom)?o.zoom:1,pan:{x:b(o.pan)&&x(o.pan.x)?o.pan.x:0,y:b(o.pan)&&x(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var c=L({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(T))return vr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(b(e)||m(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=L({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,y(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(E(n.roots))e=n.roots;else if(m(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){je("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var L=0;L0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*i;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ws(e){this.options=L({},Xs,e)}Ws.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Hs,Ks={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gs(e){this.options=L({},Ks,e)}Gs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(rl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),xe(t)):(gl(r,e),s())}()}else{for(;u;)u=o(l),l++;gl(r,e),s()}return this},Zs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Zs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var $s=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},Js=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=ll(e,i,a),d=ll(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},sl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ll=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},ul=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},dl=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},fl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yl(e){this.options=L({},vl,e)}yl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=qt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=jt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ue(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Yt(e,t,T))return v(n),!0}else if(Lt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=_t({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-a.ang):Math.PI+a.ang),Zl(t,n,Ul),zl=Gl.nx*Ul.ny-Gl.ny*Ul.nx,Il=Gl.nx*Ul.nx-Gl.ny*-Ul.ny,Ol=Math.asin(Math.max(-1,Math.min(1,zl))),Math.abs(Ol)<1e-6)return Bl=t.x,Nl=t.y,void(Vl=jl=0);Al=1,Ll=!1,Il<0?Ol<0?Ol=Math.PI+Ol:(Ol=Math.PI-Ol,Al=-1,Ll=!0):Ol>0&&(Al=-1,Ll=!0),jl=void 0!==t.radius?t.radius:r,Rl=Ol/2,ql=Math.min(Gl.len/2,Ul.len/2),i?(Fl=Math.abs(Math.cos(Rl)*jl/Math.sin(Rl)))>ql?(Fl=ql,Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))):Vl=jl:(Fl=Math.min(ql,jl),Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))),Wl=t.x+Ul.nx*Fl,Hl=t.y+Ul.ny*Fl,Bl=Wl-Ul.ny*Vl*Al,Nl=Hl+Ul.nx*Vl*Al,Yl=t.x+Gl.nx*Fl,Xl=t.y+Gl.ny*Fl,Kl=t};function Ql(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Jl(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($l(e,t,n,r,i),{cx:Bl,cy:Nl,radius:Vl,startX:Yl,startY:Xl,stopX:Wl,stopY:Hl,startAngle:Gl.ang+Math.PI/2*Al,endAngle:Ul.ang-Math.PI/2*Al,counterClockwise:Ll})}var eu={};function tu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var C,S="vertical"===u,P=S?E:w,D=S?b:m,T=Et(D),_=!1;(k&&(h||f)||!("downward"===c&&D<0||"upward"===c&&D>0||"leftward"===c&&D>0||"rightward"===c&&D<0)||(P=(T*=-1)*Math.abs(P),_=!0),h)?C=(p<0?1+p:p)*P:C=(p<0?P:0)+p*T;var M=function(e){return Math.abs(e)=Math.abs(P)},B=M(C),N=M(Math.abs(P)-Math.abs(C));if((B||N)&&!_)if(S){var z=Math.abs(D)<=a/2,I=Math.abs(m)<=o/2;if(z){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(I){var R=(r.y1+r.y2)/2,V=r.x1,F=r.x2;n.segpts=[V,R,F,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(D)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(S){var U=r.y1+C+(l?a/2*T:0),Z=r.x1,$=r.x2;n.segpts=[Z,U,$,U]}else{var Q=r.x1+C+(l?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}if(n.isRound){var te=e.pstyle("taxi-radius").value,ne="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(te),n.isArcRadius=new Array(n.segpts.length/2).fill(ne)}},eu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!x(n.startX)||!x(n.startY),v=!x(n.arrowStartX)||!x(n.arrowStartY),y=!x(n.endX)||!x(n.endY),m=!x(n.arrowEndX)||!x(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=kt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Ct(H,bt(t)),G=Ct(H,bt(W)),U=K;if(G2)Ct(H,{x:W[2],y:W[3]})0){var le=c,ue=Ct(le,bt(t)),ce=Ct(le,bt(se)),de=ue;if(ce2)Ct(le,{x:se[2],y:se[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=Tt(0,C,1),t=Dt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=Tt(0,r-.001,1),a=Tt(0,r+.001,1),o=Dt(e,t,n,i),s=Dt(e,t,n,a);return su(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,P,D,T,_=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-P)/S;N=Tt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=kt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(D,T,N),l=su(D,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},au.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},au.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ue(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ze(n.rstyle,"labelWidth",t,d),Ze(n.rscratch,"labelWidth",t,d),Ze(n.rstyle,"labelHeight",t,h),Ze(n.rscratch,"labelHeight",t,h),Ze(n.rscratch,"labelLineHeight",t,c)},au.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ze(n.rscratch,e,t,r),r):Ue(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=l(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,i).widthD)break;T+=i[M],M===i.length-1&&(_=!0)}return _||(T+="…"),T}return i},au.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},au.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=Te(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:b[0]*s,y:b[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var z={x:0,y:0};if(x(b[0])&&x(b[1])&&(z.x+=b[0],z.y+=b[1],N)){var I=e.hoverData.dragDelta;I&&x(I[0])&&x(I[1])&&(z.x+=I[0],z.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=bt(h),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=i(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),b=!1,t.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(i,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(i,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Rt(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(Xt(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Xt(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Yt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Kt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Kt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},gu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Jt(3,0)),this.generateRoundPolygon("round-triangle",Jt(3,0)),this.generatePolygon("rectangle",Jt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Jt(5,0)),this.generateRoundPolygon("round-pentagon",Jt(5,0)),this.generatePolygon("hexagon",Jt(6,0)),this.generateRoundPolygon("round-hexagon",Jt(6,0)),this.generatePolygon("heptagon",Jt(7,0)),this.generateRoundPolygon("round-heptagon",Jt(7,0)),this.generatePolygon("octagon",Jt(8,0)),this.generateRoundPolygon("round-octagon",Jt(8,0));var r=new Array(20),i=tn(5,0),a=tn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},wu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;t(this,e),this.idsByKey=new $e,this.keyForId=new $e,this.cachesByLvl=new $e,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Je,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new $e,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Eu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ku=He({getKey:null,doesEleInvalidateKey:Le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=ku(t);L(this,n),this.lookup=new wu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=Eu,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rt((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(wt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=a.getElement(e,t,n,D,Eu.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ke(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ke(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ge(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ke(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Eu.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=Ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Ke(this.onDequeues,e)},Su.setupDequeueing=xu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ke(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=_t();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!Ot(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=we(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=we(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ke(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},k=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},C=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var S="yes"===t.pstyle("ghost").value;if(S){var P=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(P,D),b(_),k(_),e.translate(-P,-D)}else x();E(),b(),k(),w(),C(),n&&e.translate(l.x1,l.y1)}}},Wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xu.drawEdgeOverlay=Wu("overlay"),Xu.drawEdgeUnderlay=Wu("underlay"),Xu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Ku.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(wt(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Ku.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ku.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ue(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ku.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ue(o,"labelX",n),d=Ue(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ue(o,"labelWidth",n),v=Ue(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),T=2;if(E>0||C>0&&k>0){var _=c-S;switch(x){case"left":_-=g;break;case"center":_-=g/2}var M=d-v-S,B=g+2*S,N=v+2*S;if(E>0){var z=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",D?Gu(e,_,M,B,N,T):e.fillRect(_,M,B,N),e.fillStyle=z}if(C>0&&k>0){var A=e.strokeStyle,L=e.lineWidth,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*s+")",e.lineWidth=C,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?Gu(e,_,M,B,N,T,"stroke"):e.strokeRect(_,M,B,N),"double"===R){var V=C/2;D?Gu(e,_+V,M+V,B-2*V,N-2*V,T,"stroke"):e.strokeRect(_+V,M+V,B-2*V,N-2*V)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=A}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var j=Ue(o,"labelWrapCachedLines",n),q=Ue(o,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-g:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=g))),w){case"top":d-=(j.length-1)*q;break;case"center":case"bottom":d-=(j.length-1)*q}for(var W=0;W0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=q}else F>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(x(d.x)&&x(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),k=0,C=0;C0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;l.colorStrokeStyle(e,F[0],F[1],F[2],t)},G=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=_e("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},U=t.pstyle("shape").strValue,Z=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var $=G(r,i,U,Z);h=$.path,v=$.cacheHit}var Q=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i,X,c)}g?e.fill(h):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i,X,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},ne=function(){if(_>0){if(e.lineWidth=_,e.lineCap=I,e.lineJoin=z,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=O;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===N){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var a=l.getNodeShape(t),o=_;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,u=(r+o+(V+Y))/r,c=(i+o+(V+Y))/i,h=r*u,p=i*c,f=l.nodeShapes[a].points;if(g)s=G(h,p,a,f).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+Y+V):"round-heptagon"===a?(v=1.075*(o+Y+V),m=-(o/2+Y+V)/35):"round-hexagon"===a?v=1.12*(o+Y+V):"round-pentagon"===a?(v=1.13*(o+Y+V),m=-(o/2+Y+V)/15):"round-tag"===a?(v=1.12*(o+Y+V),y=.07*(o/2+V+Y)):"round-triangle"===a&&(v=(o+Y+V)*(Math.PI/2),m=-(o+Y/2+V)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=h/2,x=p/2,w=(X="auto"===X?rn(h,p):X)+(o+V+Y)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Uu.drawNodeOverlay=Zu("overlay"),Uu.drawNodeUnderlay=Zu("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var $u={};$u.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},$u.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Qu={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},ac.png=function(e){return sc(e,this.bufferCanvasImage(e),"image/png")},ac.jpg=function(e){return sc(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},uc=dc,cc=dc.prototype;function dc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(cc.CANVAS_LAYERS),contexts:new Array(cc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cc.CANVAS_LAYERS),bufferCanvases:new Array(cc.BUFFER_COUNT),bufferContexts:new Array(cc.CANVAS_LAYERS)};t.data.canvasContainer=n.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};c&&c.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var o=0;o{var m2={"explorer-head.mustache":` + + + + +{{{pageTitle}}} · {{{siteTitle}}} + + + + + +
+ {{{siteTitle}}} model explorer + + + +
+
+ +`,"explorer-foot.mustache":`
+
Built from explorer.json by the metaobjects docs-site generator{{#stamp}} · {{{stamp}}}{{/stamp}}. Static: no server, no LLM call.
+ +{{#needsGraph}}{{/needsGraph}} + + + +`,"explorer-card.mustache":`
+

{{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}{{{verdictHtml}}}

+
{{{statement}}}
+
{{{barHtml}}}
{{{countsLine}}}
+ {{#hasChildren}}
    {{#children}}
  • {{{levelHtml}}}{{{linkHtml}}} {{{glyphHtml}}}
  • {{/children}}
{{/hasChildren}} +
Summary from the levels below
No summary is generated in this build.
+
+`,"explorer-overview.html.mustache":`

{{{heading}}}

+
Built from {{{sourcesLine}}}. Every number below is computed from the project's metadata or the gate's own output.
+
+{{#tiles}}
{{{n}}}
{{{l}}}
+{{/tiles}}
+{{#hasRequirements}}{{{legendHtml}}}{{/hasRequirements}} +{{#hasRequirements}} +

Features requirement.functional, by level

+{{#hasFeatures}}
+{{#featureCards}}{{> card}}{{/featureCards}} +
{{/hasFeatures}} +{{^hasFeatures}}
No requirement.functional is declared.
{{/hasFeatures}} +

Qualities requirement.architectural, the non-functional policies

+{{#hasQualities}}
+{{#qualityCards}}{{> card}}{{/qualityCards}} +
{{/hasQualities}} +{{^hasQualities}}
No requirement.architectural is declared.
{{/hasQualities}} +{{/hasRequirements}} +{{^hasRequirements}} +
This model declares no requirements yet, so this page cannot say what each part is for. Declare requirement.functional entries (levels 1 to 3 for the problem, 4 and 5 naming the model) and this page opens on them, with every entity traced to the feature it serves.
+{{/hasRequirements}} +

Packages what the model holds

+
+{{#packageCards}}

{{{name}}}

{{{kindLineHtml}}}
{{{membersHtml}}}
+{{/packageCards}}
+`,"explorer-map.html.mustache":`

Model map

+
Entities and the references between them. A slice is the set of model nodes a requirement subtree claims, a package holds, or a prompt reads and returns.
+
+ + + + + + +
+
Click a node to see why it exists, what it holds and what was generated from it. Double-click to open its page.
+
+ +`,"explorer-object.html.mustache":`
{{{crumbsHtml}}}
+

{{{name}}} {{#isAbstract}}abstract{{/isAbstract}}{{#isReadOnly}}read-only view{{/isReadOnly}}{{#isUnclaimed}}unclaimed{{/isUnclaimed}}

+ +{{#description}}
{{{description}}}
{{/description}} +
{{{kindLabel}}} · {{{storageLine}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
+
+
+

Why it exists

+ {{#hasWhy}}
+ {{#whyRows}} + {{/whyRows}}
CapabilityRequirementLevelStatusOn
{{{capabilityHtml}}}{{{reqHtml}}}
{{{statement}}}
{{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
{{/hasWhy}} + {{^hasWhy}}
{{{whyEmptyHtml}}}
{{/hasWhy}} + {{#projection}} +

Read model

+
+ {{#basesHtml}}
Surfaces fields of {{{basesHtml}}}.
{{/basesHtml}} + {{#hasOrigins}}
{{#origins}}{{/origins}}
FieldOriginDefinition
{{{field}}}{{{origin}}}{{{definitionHtml}}}
{{/hasOrigins}} +
+ {{/projection}} + {{#report}} +

Report

+
+ {{#fromHtml}}{{/fromHtml}} + {{#spineHtml}}{{/spineHtml}} + {{#dimensionsHtml}}{{/dimensionsHtml}} + {{#measuresHtml}}{{/measuresHtml}} + {{#segmentHtml}}{{/segmentHtml}} + {{#filterHtml}}{{/filterHtml}} +
From{{{fromHtml}}}
Spine{{{spineHtml}}}
Dimensions{{{dimensionsHtml}}}
Measures{{{measuresHtml}}}
Segment{{{segmentHtml}}}
Filter{{{filterHtml}}}
+ {{/report}} + {{#hasFields}}

Fields

+
{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{#fields}}{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{/fields}}
FieldTypeColumnFlagsClaimed at L5
{{{name}}} {{{inheritedHtml}}}{{{type}}}{{{refHtml}}}{{{valuesHtml}}}{{{column}}}{{{flagsHtml}}}{{{claimsHtml}}}
{{/hasFields}} + {{#hasKeys}}

Keys and references

+
{{#keys}}{{/keys}}
{{{kind}}} {{{name}}} {{{inheritedHtml}}}{{{shape}}}{{{targetHtml}}}
{{/hasKeys}} + {{#hasReporting}}

Reporting vocabulary

+
{{#reporting}}{{/reporting}}
NameKindDefinition
{{{name}}}{{{kind}}}{{{definitionHtml}}}
{{/hasReporting}} + {{#hasLayouts}}

Screens declared

{{#layouts}}
{{{kind}}} {{{name}}}{{#detailHtml}}: {{{detailHtml}}}{{/detailHtml}}
{{/layouts}}{{/hasLayouts}} +
+ +
+`,"explorer-node.html.mustache":`
{{{crumbsHtml}}}
+

{{{name}}} {{#isAbstract}}abstract{{/isAbstract}}

+ +{{#description}}
{{{description}}}
{{/description}} +
{{{kindLabel}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
+
+
+

Why it exists

+ {{#hasWhy}}
+ {{#whyRows}} + {{/whyRows}}
CapabilityRequirementLevelStatusOn
{{{capabilityHtml}}}{{{reqHtml}}}
{{{statement}}}
{{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
{{/hasWhy}} + {{^hasWhy}}
{{{whyEmptyHtml}}}
{{/hasWhy}} + {{#hasAttrs}}

Attributes

+
{{#attrs}}{{/attrs}}
@{{{name}}}{{{valueHtml}}}
{{/hasAttrs}} + {{#hasMembers}}

Members

+
+ {{#members}} + {{/members}}
NameTypeAttributes
{{{nameHtml}}}{{#below}} +{{below}}{{/below}}{{{kind}}}{{{attrsHtml}}}
{{/hasMembers}} +
+ +
+`,"explorer-prompt.html.mustache":`
{{{crumbsHtml}}}
+

{{{name}}} {{#isUnclaimed}}unclaimed{{/isUnclaimed}}

+ +{{#description}}
{{{description}}}
{{/description}} +
{{{attrsHtml}}}
+
+
+

Payload: {{{payloadHtml}}}

+ {{#hasPayload}}
{{#payloadRows}}{{/payloadRows}}
FieldTypeUsed in text
{{{name}}} {{{requiredHtml}}}{{{type}}}{{{refHtml}}}{{{usedHtml}}}
{{/hasPayload}} + {{^hasPayload}}
No payload: the text renders from nothing typed.
{{/hasPayload}} +

Reply: {{{replyHtml}}}

+ {{#hasReply}}
{{#replyRows}}{{/replyRows}}
FieldType
{{{name}}}{{{type}}}{{{valuesHtml}}}
{{/hasReply}} + {{^hasReply}}
Outbound only: no reply parser.
{{/hasReply}} +

Why it exists

+ {{#hasWhy}}
{{#whyRows}}{{/whyRows}}
CapabilityRequirementLevelStatus
{{{capabilityHtml}}}{{{reqHtml}}}
{{{statement}}}
{{{levelHtml}}}{{{statusHtml}}}
{{/hasWhy}} + {{^hasWhy}}
{{{whyEmptyHtml}}}
{{/hasWhy}} +
+
+

Text {{{textMeta}}}

+ {{#hasText}}
{{{textHtml}}}
{{/hasText}} + {{^hasText}}
The text {{{textRef}}} was not found beside the model, so this page cannot show it.
{{/hasText}} +

Generated

+ {{#hasGenerated}}{{#generated}}
{{{generator}}}{{#files}}
{{{.}}}
{{/files}}
{{/generated}}{{/hasGenerated}} + {{^hasGenerated}}
{{{generatedNote}}}
{{/hasGenerated}} +
Proven today: meta verify --templates fails if the text names a variable the payload lacks. This page shows the other direction too: payload fields the text never uses.
+
+
+`,"explorer-prompts.html.mustache":`

Prompts

+
Each declared template, its typed payload, its reply type, and the requirements that claim it.
+{{#hasRows}}
+{{#rows}} +{{/rows}}
TemplatePayloadReplyClaimed by
{{{linkHtml}}} {{{kind}}}{{#description}}
{{{description}}}
{{/description}}
{{{payloadHtml}}}{{{replyHtml}}}{{{claimsHtml}}}
{{/hasRows}} +{{^hasRows}}
This model declares no template.*.
{{/hasRows}} +`,"explorer-requirements.html.mustache":`

Requirements

+
Hierarchy is nesting. L1 to L3 describe the problem; only L4 (an object or prompt) and L5 (a member) may name the model.
+ +{{{legendHtml}}} +{{#hasTree}}
{{{treeHtml}}}
{{/hasTree}} +{{^hasTree}}
{{{emptyNote}}}
{{/hasTree}} +`,"explorer-requirement.html.mustache":`
{{{crumbsHtml}}}
+

{{{levelHtml}}}{{{name}}} {{{statusHtml}}}{{{dispositionHtml}}}{{{verdictHtml}}}

+ +
{{{address}}}
+
+
+

Statement

{{{statement}}}

Counterexample

{{{counterexample}}}{{#hasDescription}}

Scope

{{{description}}}
{{/hasDescription}}
+

Implemented by

+ {{#hasLinks}}
{{#linkRows}}{{/linkRows}}
ReferenceKindResolves
{{{refHtml}}}{{{kind}}}{{{resolvesHtml}}}
{{/hasLinks}} + {{^hasLinks}}
{{{linksEmpty}}}
{{/hasLinks}} + {{#hasBelow}}

Below ({{childCount}}){{#deeper}} {{belowCount}} in all{{/deeper}}

{{{belowBarHtml}}}
    {{#children}}
  • {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}
  • {{/children}}
{{/hasBelow}} +
{{#sliceHref}}Show this slice on the model map{{/sliceHref}}{{#sliceHref}}{{#traceHref}} · {{/traceHref}}{{/sliceHref}}{{#traceHref}}Trace to code{{/traceHref}}
+
+
+

What the build proves about this entry

+
{{#proof}}{{/proof}}
{{{what}}}{{{verdictHtml}}}{{{howHtml}}}
+ {{#trackedHtml}}

Tracked by

{{{trackedHtml}}}{{/trackedHtml}} + {{#digest}}

Statement digest

{{{digest}}}
Moves when the statement changes; a summary of this entry would be pinned to it.
{{/digest}} +
+
+`,"explorer-matrix.html.mustache":`

Traceability matrix

+
Rows are requirements that name the model; columns are stored entities and prompts, most claimed first. An empty column is a node nothing claims; a cell's colour and glyph are the row's declared status.
+{{#hasRows}}
{{{legendHtml}}}
+
{{{tableHtml}}}
{{/hasRows}} +{{^hasRows}}
{{#hasRequirements}}No requirement names the model yet: only L4 and L5 entries do.{{/hasRequirements}}{{^hasRequirements}}This model declares no requirements, so there is nothing to trace.{{/hasRequirements}}
{{/hasRows}} +`,"explorer-trace.html.mustache":`

Trace

+
From intent to code: requirement levels, then the model nodes they name, then the files generated from those nodes.
+{{#hasStarts}}
+ +
Hand-written modules that import the generated files are not scanned in this build, so the trace stops at the generated files. Click a requirement or a model node to open its page.
{{/hasStarts}} +{{^hasStarts}}
This model declares no requirements, so there is nothing to trace from. Every object's generated files are listed on its own page.
{{/hasStarts}} +`,"explorer-gaps.html.mustache":`

Gaps

+
What the model and the gate can already point at. Each card says whether it comes from the shipped gate or is a check this explorer adds.
+
+{{#cards}}

{{{title}}} {{{count}}} {{{source}}}

{{{whyHtml}}}
{{{bodyHtml}}}
+{{/cards}}
+`,"explorer-api.html.mustache":`

API

+{{#recorded}}
Every route the generated code mounts, by the object it serves: {{{summary}}}.
+{{#hasGroups}}
{{#groups}}

{{{linkHtml}}} {{{kind}}}{{#isReadOnly}} read-only{{/isReadOnly}}

{{#routes}}
{{{method}}} {{{path}}}
{{/routes}}
{{/groups}}
{{/hasGroups}} +{{^hasGroups}}
The run generated no routes.
{{/hasGroups}}{{/recorded}} +{{^recorded}}
The run that built this site recorded no routes: it generated none, or ran without the routes generator.
{{/recorded}} +`,"explorer-model.html.mustache":`

Packages

+
Every package in the model and what it declares.
+
+{{#packageCards}}

{{{name}}}

{{{kindLineHtml}}}
{{{membersHtml}}}
+{{/packageCards}}
+`,"explorer-package.html.mustache":`
{{{crumbsHtml}}}
+

{{{name}}}

+
+{{#rows}} +{{/rows}}
NameKindStorageFieldsClaim
{{{linkHtml}}} {{{abstractHtml}}}{{#description}}
{{{description}}}
{{/description}}
{{{kind}}}{{{storage}}}{{fieldCount}}{{{statusHtml}}}
+`};/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
`}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
${Z.map(X).join(" | ")}
`:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
"),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
${r(G.attrs[k2]).map(X).join(" | ")}
`:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
    ${q.map((Z)=>this.treeNode(H,Z)).join("")}
`:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/explorer-app/assets/explorer.css b/explorer-app/assets/explorer.css new file mode 100644 index 0000000000..aae678b023 --- /dev/null +++ b/explorer-app/assets/explorer.css @@ -0,0 +1,232 @@ +/* The model explorer's theme. `meta eject docs-site` copies this file to + codegen/docs-site/assets/, where an edit wins over the bundled copy. + + Colour rules (design report §4.2), which the classes below keep apart: + .s- a DECLARED status: filled chip, with its glyph in the text + .v- a GATE verdict: an outline (ring), never a fill + .bar .b-* a ROLL-UP of what sits below: a separate stacked bar + No class here colours a test result. */ + +:root { + --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f23; --muted: #5f6670; --line: #e2e3e0; + --accent: #3b5bdb; --accent-soft: #e8ecfd; --accent-ink: #ffffff; + --live: #2f9e44; --live-soft: #e3f5e7; --partial: #e8890c; --partial-soft: #fdf0dc; + --planned: #4c6ef5; --planned-soft: #e9edff; --retired: #868e96; --retired-soft: #eef0f2; + --bad: #e03131; --bad-soft: #fde8e8; --warn: #e8890c; --code: #f1f2ef; + --entity: #495057; --value: #7048e8; --prompt: #0c8599; --projection: #1971c2; --report: #c2255c; + --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); + --shadow-lift: 0 4px 14px rgba(16, 24, 40, .10); + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; + } +} +:root[data-theme="dark"] { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; +} + +* { box-sizing: border-box; } +html { -webkit-text-size-adjust: 100%; } +body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; } +code { background: var(--code); border-radius: 4px; padding: 0 4px; } +code.digest { display: block; overflow-wrap: anywhere; font-size: 11.5px; padding: 4px 6px; } +pre code, .mono code { background: none; padding: 0; } + +/* ── Header ─────────────────────────────────────────────────────────────── */ +header.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: center; padding: 10px 20px; flex-wrap: wrap; } +.brand { font-weight: 700; letter-spacing: .2px; color: var(--ink); white-space: nowrap; } +.brand:hover { text-decoration: none; } +.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; } +.nav { display: flex; gap: 4px; flex-wrap: wrap; } +.nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; } +.nav a:hover { background: var(--code); text-decoration: none; } +.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; } +#search { margin-left: auto; position: relative; } +#search input { width: 260px; max-width: 60vw; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; } +#search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); } +#results { position: absolute; right: 0; top: 36px; width: 420px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lift); display: none; } +#results a { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); } +#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; } +#results a small { color: var(--muted); display: block; } +#results .none { padding: 8px 12px; color: var(--muted); } +#theme { padding: 5px 9px; } + +/* ── Page ───────────────────────────────────────────────────────────────── */ +main { padding: 24px 20px 20px; max-width: 1400px; margin: 0 auto; } +h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } +h2 { font-size: 16px; margin: 26px 0 10px; } +h3 { font-size: 14px; margin: 16px 0 6px; } +h3.first { margin-top: 0; } +.h-sub { color: var(--muted); font-weight: 400; } +.sub { color: var(--muted); } +.small { font-size: 12px; } +.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; } +.meta-line { margin-top: 4px; } +.page { margin-top: 14px; } +.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; } +.grid { display: grid; gap: 12px; } +.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; } +a.tile { color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; } +a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); } +.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; } +.tile .l { color: var(--muted); font-size: 12.5px; line-height: 1.4; } +.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +.apis { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } +@media (max-width: 1000px) { .side { grid-template-columns: minmax(0, 1fr); } } +@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } } + +table { border-collapse: collapse; width: 100%; } +th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } +th { font-size: 12px; color: var(--muted); font-weight: 600; } +tr:target td { background: var(--accent-soft); } +table.kv th { width: 120px; } +.tablewrap { overflow-x: auto; } + +/* ── Status, verdict and roll-up ────────────────────────────────────────── */ +.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0; font-weight: 500; line-height: 1.6; } +h1 .chip { font-size: 12.5px; } +.s-live { background: var(--live-soft); color: var(--live); border-color: transparent; } +.s-partial { background: var(--partial-soft); color: var(--partial); border-color: transparent; } +.s-planned { background: var(--planned-soft); color: var(--planned); border-color: transparent; } +.s-retired { background: var(--retired-soft); color: var(--retired); border-color: transparent; text-decoration: line-through; } +.v-error, .v-unclaimed { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); } +.v-warn { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); } +.glyph { font-size: 12px; } +.g-live { color: var(--live); } .g-partial { color: var(--partial); } .g-planned { color: var(--planned); } .g-retired { color: var(--retired); } +.lvl { display: inline-block; min-width: 24px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; background: var(--code); color: var(--muted); padding: 0 4px; margin-right: 6px; line-height: 18px; } +h1 .lvl { font-size: 12px; line-height: 22px; } +.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--code); min-width: 80px; } +.bar span { display: block; height: 100%; } +.b-live { background: var(--live); } .b-partial { background: var(--partial); } .b-planned { background: var(--planned); } .b-retired { background: var(--retired); } +.minibar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 4px; } +.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin: 4px 0; } +.legend-row { margin: 10px 0; } +.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; } +.pill.gate { color: var(--accent); border-color: var(--accent); } +a.k-entity { color: var(--accent); font-weight: 500; } +span.k-entity { color: var(--entity); } .k-value { color: var(--value); } .k-prompt, .k-template { color: var(--prompt); } +.k-projection { color: var(--projection); } .k-report { color: var(--report); } +.kdot { font-size: 10px; } +.kdot.k-entity { color: var(--entity); } .kdot.k-value { color: var(--value); } .kdot.k-prompt { color: var(--prompt); } +.k-badge { color: var(--projection); } +.vals { color: var(--muted); font-size: 11.5px; } + +/* ── S1 cards ───────────────────────────────────────────────────────────── */ +.cap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; } +.cap .card h3 { margin-top: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.capcard .statement { margin: 2px 0 0; } +.rollup { margin: 10px 0 4px; } +.rollup .sub { margin-top: 3px; } +ul { padding-left: 18px; margin: 6px 0; } +.cap li, .kids li { margin: 4px 0; } +.members { margin-top: 8px; line-height: 1.9; } +details.summary { margin-top: 6px; } +details > summary { cursor: pointer; color: var(--muted); font-size: 12px; } +.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; } +.note.intro { margin: 4px 0 8px; font-size: 13.5px; } + +/* ── S5 tree ────────────────────────────────────────────────────────────── */ +.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } +.tabs a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); } +.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } +.tree { margin-top: 10px; } +.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 8px; } +.tree > ul { border-left: none; padding-left: 0; margin-left: 0; } +.tree li { margin: 4px 0; } +.tree .row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } +.tree .stmt { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-left: 30px; } + +/* ── Graphs ─────────────────────────────────────────────────────────────── */ +.graph { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; } +#cy { height: 640px; } #cymini { height: 260px; } #cytrace { height: 680px; } +.panel h3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.maplegend { margin-top: 8px; } +.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } +select, button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; max-width: 100%; } +button { cursor: pointer; } +button:hover { border-color: var(--accent); } +.layout, .gen, .route { margin: 4px 0; } +.gen .pill { margin-left: 0; } + +/* ── S4 text ────────────────────────────────────────────────────────────── */ +pre { background: var(--code); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; } +pre.text { max-height: 560px; } +.var { color: var(--prompt); } + +/* ── S6 proof ───────────────────────────────────────────────────────────── */ +.proof { font-size: 12.5px; } +.proof td:first-child { white-space: nowrap; font-weight: 500; } + +/* ── S7 matrix ──────────────────────────────────────────────────────────── */ +.mx { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } +.mx table { width: auto; border-collapse: separate; border-spacing: 0; } +/* The header row is sticky as a whole: a sticky cell per column would paint over the slanted + label of the column before it. */ +.mx thead { position: sticky; top: 0; z-index: 2; background: var(--panel); } +.mx th.col { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 0; } +.mx th.col.corner { position: sticky; left: 0; background: var(--panel); } +.mx th.col div { transform: rotate(-60deg); transform-origin: left bottom; width: 18px; margin-left: 12px; font-weight: 500; font-size: 11.5px; max-width: 18px; } +.mx th.col div a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +.mx th.col.unc div a { color: var(--bad); } +.mx td.c { width: 20px; min-width: 20px; height: 22px; padding: 0; text-align: center; font-size: 11px; border-right: 1px solid var(--line); } +.mx td.rh { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; } +.mx tr.grp td { background: var(--code); font-weight: 600; } +.mx td.c.live { background: var(--live-soft); } .mx td.c.planned { background: var(--planned-soft); } +.mx td.c.partial { background: var(--partial-soft); } .mx td.c.retired { background: var(--retired-soft); } + +/* ── S9 gaps, API ───────────────────────────────────────────────────────── */ +.gap h3 { display: flex; gap: 8px; align-items: center; margin-top: 0; flex-wrap: wrap; } +.gap .why { margin-bottom: 8px; } +.count { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--code); } +.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 4px; padding: 1px 4px; background: var(--code); color: var(--muted); } +.m-GET, .m-get { background: var(--live-soft); color: var(--live); } +.m-POST, .m-post { background: var(--planned-soft); color: var(--planned); } +.m-PUT, .m-put, .m-PATCH, .m-patch { background: var(--partial-soft); color: var(--partial); } +.m-DELETE, .m-delete { background: var(--bad-soft); color: var(--bad); } + +footer { color: var(--muted); font-size: 12px; padding: 24px 20px; text-align: center; } + +/* ── Phone ──────────────────────────────────────────────────────────────── */ +@media (max-width: 700px) { + header.top { gap: 8px 12px; padding: 10px 16px; } + .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } + .nav::-webkit-scrollbar { display: none; } + #search { order: 4; margin-left: 0; flex-basis: 100%; } + #search input { width: 100%; max-width: none; } + #results { left: 0; right: 0; width: auto; max-width: none; } + #theme { margin-left: auto; } + main { padding: 16px; } + h1 { font-size: 20px; } + .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .tile .n { font-size: 22px; } + .cap { grid-template-columns: minmax(0, 1fr); } + .apis { grid-template-columns: minmax(0, 1fr); } + #cy { height: 440px; } #cytrace { height: 520px; } + .mx { max-height: none; } + /* A wide table scrolls inside its own box, never the page. */ + main table { display: block; max-width: 100%; overflow-x: auto; } + .mx table { display: table; max-width: none; } + .tree .stmt { margin-left: 0; } + .tree ul { padding-left: 12px; margin-left: 4px; } +} +@media print { header.top, #search, #theme, .toolbar { display: none; } .card { box-shadow: none; } } diff --git a/explorer-app/assets/explorer.js b/explorer-app/assets/explorer.js new file mode 100644 index 0000000000..61c4153d2e --- /dev/null +++ b/explorer-app/assets/explorer.js @@ -0,0 +1,332 @@ +// The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. +// `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. +(function () { + "use strict"; + function run() { + var APP = window.MO_APP || null; + var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; + var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; + var $ = function (s, r) { return (r || document).querySelector(s); }; + var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; + var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; + var STATUS = ["live", "partial", "planned", "retired"]; + var GLYPH = { live: "●", partial: "◐", planned: "○", retired: "⊘" }; + var PAL = ["#1971c2", "#e8590c", "#2b8a3e", "#ae3ec9", "#c2255c", "#0b7285", "#5c940d", "#f08c00"]; + var byId = {}; + D.nodes.forEach(function (n) { byId[n.id] = n; }); + var reqById = {}; + D.reqs.forEach(function (r) { reqById[r.id] = r; }); + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; + var redraw = []; + + // ── Theme ─────────────────────────────────────────────────────────────── + var themeBtn = $("#theme"); + if (themeBtn) themeBtn.onclick = function () { + var cur = document.documentElement.getAttribute("data-theme"); + var dark = cur ? cur === "dark" : matchMedia("(prefers-color-scheme: dark)").matches; + var next = dark ? "light" : "dark"; + document.documentElement.setAttribute("data-theme", next); + try { localStorage.setItem("mo-theme", next); } catch (e) { /* private window: the toggle still works for this page */ } + redraw.forEach(function (f) { f(); }); + }; + + // ── Search ────────────────────────────────────────────────────────────── + // The built-in index ships in explorer-data.js and works from file://. When the site has been + // indexed with Pagefind (`npx pagefind --site `) and is served over http, Pagefind's + // full-text index answers instead. + var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; + function loadPagefind() { + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + pagefindTried = true; + // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every + // result URL carry the path the site is served under (a sub-path included). + var url = new URL(ROOT + "pagefind/pagefind.js", location.href).href; + return fetch(url, { method: "HEAD" }).then(function (r) { + if (!r.ok) return null; + return import(url).then(function (m) { pagefind = m; return m; }); + }).catch(function () { return null; }); + } + function show(items) { + sel = -1; + res.innerHTML = items.length ? items.map(function (x) { return '' + esc(x.t) + "" + esc(x.s) + ""; }).join("") : '
    No match
    '; + res.style.display = "block"; + } + function builtIn(v) { + var words = v.split(/\s+/).filter(Boolean); + return D.search.filter(function (x) { return words.every(function (w) { return x.k.indexOf(w) >= 0; }); }) + .sort(function (a, b) { return (a.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1) - (b.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1); }) + .slice(0, 25).map(function (x) { return { t: x.t, s: x.s, h: href(x.h) }; }); + } + if (q && res) { + q.addEventListener("input", function () { + var v = q.value.trim().toLowerCase(); + if (!v) { res.style.display = "none"; return; } + show(builtIn(v)); + loadPagefind().then(function (pf) { + if (!pf || q.value.trim().toLowerCase() !== v) return; + pf.search(v).then(function (r) { + return Promise.all(r.results.slice(0, 12).map(function (x) { return x.data(); })); + }).then(function (rows) { + if (q.value.trim().toLowerCase() !== v || !rows.length) return; + show(rows.map(function (d) { return { t: (d.meta && d.meta.title) || d.url, s: (d.excerpt || "").replace(/<[^>]+>/g, ""), h: d.url }; })); + }).catch(function () { /* keep the built-in results */ }); + }); + }); + q.addEventListener("keydown", function (e) { + var links = res.querySelectorAll("a"); + if (e.key === "ArrowDown" || e.key === "ArrowUp") { + e.preventDefault(); + sel = Math.max(0, Math.min(links.length - 1, sel + (e.key === "ArrowDown" ? 1 : -1))); + links.forEach(function (a, i) { a.classList.toggle("sel", i === sel); }); + } else if (e.key === "Enter" && links.length) { + location.href = links[Math.max(0, sel)].href; + } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } + }); + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { + if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } + }); + } + + if (typeof window.cytoscape !== "function") { + document.querySelectorAll(".graph").forEach(function (g) { + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; + }); + return; + } + + // ── Colours ───────────────────────────────────────────────────────────── + // Fill: the kind, the feature, or the DECLARED status of the claims on a node. + // Ring: a gate verdict (unclaimed). Never a test result. + function kindColour(n) { + return css({ entity: "--entity", value: "--value", prompt: "--prompt", template: "--prompt", projection: "--projection", report: "--report" }[n.kind] || "--entity"); + } + function fill(n, mode) { + if (n.abstract) return css("--retired"); + if (mode === "kind") return kindColour(n); + if (mode === "api") return n.api.length ? css("--accent") : css("--retired-soft"); + if (mode === "claims") return n.claims > 8 ? css("--live") : n.claims > 2 ? css("--partial") : n.claims > 0 ? css("--planned") : css("--retired-soft"); + if (mode === "cap") return n.feature >= 0 ? PAL[n.feature % PAL.length] : n.quality ? css("--retired") : css("--retired-soft"); + return n.status === "unclaimed" ? css("--retired-soft") : css("--" + n.status); + } + function legend(mode) { + var ring = D.hasClaims ? 'red ring: unclaimed (gate)' : ""; + if (mode === "cap") return '
    ' + D.features.map(function (f, i) { return '● ' + esc(f.label) + ""; }).join("") + '● qualities only○ no claim' + ring + "Fill is the feature (L1) with the most claims on the node; size is fields plus claims.
    "; + if (mode === "status") return '
    ' + STATUS.map(function (s) { return '' + GLYPH[s] + " " + s + ""; }).join("") + '○ no claim' + ring + "Fill is the best declared status among the requirements that claim the node.
    "; + if (mode === "api") return '
    ● mounted routes○ none
    '; + if (mode === "claims") return '
    ● more than 8 claims● 3 to 8● 1 or 2○ none' + ring + "
    "; + return '
    ' + ["entity", "value", "projection", "report", "prompt"].map(function (k) { return '● ' + k + ""; }).join("") + "Abstract bases are dashed and grey.
    "; + } + function shape(n) { return n.kind === "prompt" || n.kind === "template" ? "diamond" : n.kind === "value" ? "round-triangle" : n.kind === "projection" || n.kind === "report" ? "round-hexagon" : n.abstract ? "round-rectangle" : "ellipse"; } + function baseStyle() { + return [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", width: "data(size)", height: "data(size)", shape: "data(shape)", color: css("--ink"), "font-size": 10, "text-valign": "bottom", "text-margin-y": 3, "border-width": 1, "border-color": css("--line"), "text-wrap": "none" } }, + { selector: "node[dashed = 1]", style: { "border-style": "dashed", "border-width": 2, "background-opacity": 0.4 } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[faded = 1]", style: { opacity: 0.18 } }, + { selector: "edge", style: { width: 1.2, "line-color": css("--muted"), "target-arrow-color": css("--muted"), "target-arrow-shape": "triangle", "curve-style": "bezier", "arrow-scale": 0.7, opacity: 0.6 } }, + { selector: "edge[ext = 1]", style: { "line-style": "dashed", "target-arrow-shape": "triangle-tee" } }, + { selector: "edge[faded = 1]", style: { opacity: 0.08 } }, + { selector: ":selected", style: { "border-width": 3, "border-color": css("--accent") } }, + ]; + } + var bar = function (c) { + var t = STATUS.reduce(function (a, s) { return a + (c[s] || 0); }, 0); + if (!t) return '
    '; + return '
    ' + STATUS.filter(function (s) { return c[s]; }).map(function (s) { return ''; }).join("") + "
    "; + }; + var chip = function (s) { return s ? '' + (GLYPH[s] || "") + " " + esc(s) + "" : ""; }; + var nodeLink = function (id) { var n = byId[id]; return n ? '' + esc(n.name) + "" : esc(id); }; + + // ── S2: the model map ─────────────────────────────────────────────────── + // cose from a grid (not from one point) gives the same picture on every load. + var COSE = { name: "cose", animate: false, randomize: false, nodeRepulsion: 12000, nodeOverlap: 24, idealEdgeLength: 90, componentSpacing: 90, gravity: 0.6, padding: 24, nodeDimensionsIncludeLabels: true }; + function seedGrid(els) { + var nodes = els.filter(function (e) { return !e.data.source; }), cols = Math.ceil(Math.sqrt(nodes.length || 1)); + nodes.forEach(function (e, i) { e.position = { x: (i % cols) * 120, y: Math.floor(i / cols) * 100 }; }); + } + var cyEl = $("#cy"); + if (cyEl) { + var cy = null; + var params = new URLSearchParams(query()); + var sliceSel = $("#slice"), colourSel = $("#colour"); + if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); + if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); + var focus = params.get("focus"); + var promptSet = function () { + var s = {}; + D.nodes.forEach(function (n) { if (n.kind === "prompt" || n.kind === "template") s[n.id] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && (e.k === "payloadRef" || e.k === "responseRef")) s[e.t] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && byId[e.s] && byId[e.s].kind === "value" && e.k === "objectRef") s[e.t] = 1; }); + return s; + }; + var build = function (relayout) { + var slice = sliceSel.value, mode = colourSel.value, hide = $("#hideOut").checked, showExt = $("#showExt").checked; + $("#maplegend").innerHTML = legend(mode); + var inSlice = null; + if (slice === "@prompts") inSlice = promptSet(); + else if (slice && D.slices[slice]) { inSlice = {}; D.slices[slice].forEach(function (id) { inSlice[id] = 1; }); } + var showVals = $("#showValues").checked || slice === "@prompts" || (inSlice && Object.keys(inSlice).some(function (id) { return byId[id] && byId[id].kind !== "entity"; })); + var entityCount = D.nodes.filter(function (n) { return n.kind === "entity"; }).length; + if (!entityCount) showVals = true; + var nodes = D.nodes.filter(function (n) { return (n.kind === "entity" || showVals) && (!hide || !inSlice || inSlice[n.id]); }); + var ids = {}; + nodes.forEach(function (n) { ids[n.id] = 1; }); + var els = nodes.map(function (n) { + return { data: { id: n.id, label: n.name, col: fill(n, mode), size: 18 + Math.min(40, n.fields * 1.6 + n.claims * 2), shape: shape(n), faded: inSlice && !inSlice[n.id] ? 1 : 0, dashed: n.abstract, ring: n.unclaimed } }; + }); + D.edges.forEach(function (e, i) { + if (!ids[e.s] || !ids[e.t] || (!showExt && e.k === "extends")) return; + els.push({ data: { id: "e" + i, source: e.s, target: e.t, label: e.v || e.k, ext: e.k === "extends" ? 1 : 0, faded: inSlice && !(inSlice[e.s] && inSlice[e.t]) ? 1 : 0 } }); + }); + seedGrid(els); + var pan = cy && !relayout ? { pos: {} } : null; + if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); + if (cy) cy.destroy(); + var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); + cy = graph({ + container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), + layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, + }); + cy.on("tap", "node", function (ev) { showPanel(ev.target.id()); }); + cy.on("dbltap", "node", function (ev) { var n = byId[ev.target.id()]; if (n) location.href = href(n.href); }); + var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; + if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); + if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); + }; + ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); + $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; + redraw.push(function () { build(false); }); + build(true); + } + function slicePanel(r, nodes) { + return '
    Slice

    ' + (r.level ? "L" + r.level : "—") + '' + esc(r.label) + " " + chip(r.status) + "

    " + esc(r.statement) + "
    " + + "

    " + r.claimed + " model node" + (r.claimed === 1 ? "" : "s") + " claimed below

    " + nodes.map(nodeLink).join(", ") + + "

    Status below

    " + bar(r.rollup); + } + function showPanel(id) { + var n = byId[id], p = $("#panel"); + if (!n || !p) return; + var claims = D.reqs.filter(function (r) { return r.targets.indexOf(id) >= 0; }); + var byTop = {}; + claims.forEach(function (r) { var t = r; while (t.parent && reqById[t.parent]) t = reqById[t.parent]; (byTop[t.id] = byTop[t.id] || []).push(r); }); + var refs = D.edges.filter(function (e) { return e.s === id || e.t === id; }).length; + var gen = (D.generated[id] || []).map(function (g) { return '' + esc(g[0]) + " " + g[1]; }).join(" · "); + p.innerHTML = '
    ' + esc(n.pkg) + " · " + esc(n.kind) + (n.storage ? " · " + esc(n.storage) : "") + "
    " + + '

    ' + nodeLink(id) + (n.unclaimed ? ' unclaimed' : "") + "

    " + + "

    Why it exists (" + claims.length + " claim" + (claims.length === 1 ? "" : "s") + ")

    " + + (claims.length ? Object.keys(byTop).map(function (t) { + return "
    " + esc(reqById[t].label) + ": " + byTop[t].slice(0, 6).map(function (r) { return '' + (GLYPH[r.status] || "") + " " + esc(r.label) + ""; }).join(", ") + (byTop[t].length > 6 ? " +" + (byTop[t].length - 6) : "") + "
    "; + }).join("") : 'No requirement claims this node.') + + "

    Shape

    " + n.fields + " field" + (n.fields === 1 ? "" : "s") + ", " + refs + " reference" + (refs === 1 ? "" : "s") + + (n.api.length ? "

    API

    " + n.api.map(function (a) { return "
    " + esc(a) + "
    "; }).join("") : "") + + "

    Generated

    " + (gen || 'nothing traced'); + } + + // ── S3: the one-hop mini-map ──────────────────────────────────────────── + var mini = $("#cymini"); + if (mini) { + var me = mini.getAttribute("data-node"); + var drawMini = function () { + var es = D.edges.filter(function (e) { return e.s === me || e.t === me; }); + var ids = {}; + ids[me] = 1; + es.forEach(function (e) { ids[e.s] = 1; ids[e.t] = 1; }); + var els = Object.keys(ids).filter(function (id) { return byId[id]; }).sort().map(function (id) { + var n = byId[id]; + return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; + }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); + mini.innerHTML = ""; + var c = graph({ + container: mini, elements: els, maxZoom: 1.3, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[me = 1]", style: { width: 30, height: 30, "border-width": 3, "border-color": css("--accent") } }, + { selector: "edge", style: { width: 1, label: "data(label)", "font-size": 8, color: css("--muted"), "line-color": css("--muted"), "target-arrow-shape": "triangle", "target-arrow-color": css("--muted"), "curve-style": "bezier", "text-rotation": "autorotate", "text-background-color": css("--panel"), "text-background-opacity": 1, "text-background-padding": 2 } }, + ], + layout: { name: "concentric", concentric: function (n) { return n.data("me") ? 2 : 1; }, levelWidth: function () { return 1; }, startAngle: Math.PI, padding: 30, minNodeSpacing: 60 }, + }); + c.on("tap", "node", function (ev) { var n = byId[ev.target.id()]; if (n && n.id !== me) location.href = href(n.href); }); + }; + redraw.push(drawMini); + drawMini(); + } + + // ── S8: the trace ─────────────────────────────────────────────────────── + var tr = $("#cytrace"), tstart = $("#tstart"); + if (tr && tstart) { + var p2 = new URLSearchParams(query()).get("start"); + if (p2 && reqById[p2]) tstart.value = p2; + var drawTrace = function () { + var r0 = reqById[tstart.value]; + if (!r0) return; + var kids = {}; + D.reqs.forEach(function (r) { if (r.parent) (kids[r.parent] = kids[r.parent] || []).push(r); }); + var reqs = [], walk = function (r) { reqs.push(r); (kids[r.id] || []).forEach(walk); }; + walk(r0); + var cols = [[], [], [], []], els = [], seen = {}; + var add = function (id, label, col, data) { if (seen[id]) return; seen[id] = 1; cols[col].push(id); data.id = id; data.label = label; els.push({ data: data }); }; + reqs.forEach(function (r) { add("r:" + r.id, (r.level ? "L" + r.level + " " : "") + r.label, r.level >= 4 ? 1 : 0, { col: r.status ? css("--" + r.status) : css("--muted"), shape: "round-rectangle", go: r.href }); }); + reqs.forEach(function (r) { if (r.parent && seen["r:" + r.parent]) els.push({ data: { id: "pe:" + r.id, source: "r:" + r.parent, target: "r:" + r.id } }); }); + reqs.forEach(function (r) { + r.targets.forEach(function (t) { + var n = byId[t]; + if (!n) return; + add("o:" + t, n.name, 2, { col: kindColour(n), shape: shape(n), go: n.href, ring: n.unclaimed }); + if (!seen["le:" + r.id + ">" + t]) { seen["le:" + r.id + ">" + t] = 1; els.push({ data: { id: "le:" + r.id + ">" + t, source: "r:" + r.id, target: "o:" + t, col: r.status ? css("--" + r.status) : css("--muted") } }); } + }); + }); + cols[2].slice().forEach(function (oid) { + var id = oid.slice(2); + var gen = D.generated[id] || []; + if (!gen.length) return; + var total = gen.reduce(function (a, g) { return a + g[1]; }, 0); + var gid = "g:" + id; + add(gid, total + " generated (" + gen.map(function (g) { return g[0]; }).join(", ") + ")", 3, { col: css("--accent"), shape: "tag", go: byId[id].href }); + els.push({ data: { id: "ge:" + gid, source: oid, target: gid } }); + }); + var pos = {}; + cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); + tr.innerHTML = ""; + var c = graph({ + container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, + { selector: "node[ring = 1]", style: { "border-width": 2, "border-color": css("--bad") } }, + { selector: "edge", style: { width: 1, "line-color": "data(col)", opacity: 0.5, "curve-style": "unbundled-bezier" } }, + { selector: "edge[!col]", style: { "line-color": css("--muted") } }, + ], + layout: { name: "preset", positions: function (n) { return pos[n.id()]; }, fit: true, padding: 24 }, + }); + c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); + }; + tstart.onchange = function () { + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); + drawTrace(); + }; + redraw.push(drawTrace); + drawTrace(); + } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); +})(); diff --git a/explorer-app/index.html b/explorer-app/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/explorer-app/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/scripts/ci-lane-map.txt b/scripts/ci-lane-map.txt index 0fdd75213d..1698618b20 100644 --- a/scripts/ci-lane-map.txt +++ b/scripts/ci-lane-map.txt @@ -51,6 +51,7 @@ scripts/* | ALL | CI scripts and tooling, this map inclu .github/* | ALL | the hosted workflows that call the scripts agent-context/* | ALL | bundled into the TypeScript packages and checked by cross-port gates agent-context-shipped/* | ALL | the static agent files every port's package embeds, built from agent-context/ +explorer-app/* | ts-fast ts-unit | the model explorer app, built from the TypeScript docs-site package; the gates lane holds every port's copy to it docs/* | ALL | port tests read it: Java walks every page for blocks and reads docs/ports, TypeScript and Python read the recipes and docs/features pages, so a page edit is not prose-only README.md | NONE | root prose; the gates lane checks its claims, examples and test references CHANGELOG.md | NONE | root prose, same gates diff --git a/scripts/ci-local.sh b/scripts/ci-local.sh index b101f6aa3f..fb5df69289 100755 --- a/scripts/ci-local.sh +++ b/scripts/ci-local.sh @@ -1122,6 +1122,21 @@ gate_doc_template_drift() { gate_python_agent_context_drift() { diff -r -x README.md agent-context-shipped server/python/src/metaobjects/agent_context/shipped } +# The explorer app (explorer-app/) must be what its TypeScript sources build, and every port's +# copy must equal it (scripts/sync-explorer-app.sh refreshes the copies). +gate_explorer_app_drift() { + bun server/typescript/packages/docs-site/scripts/build-app.ts --check || return 1 + local copy rc=0 + # Keep this list in step with the dests in scripts/sync-explorer-app.sh. + for copy in \ + server/typescript/packages/docs-site/app \ + server/python/src/metaobjects/documentation/explorer_app \ + server/java/codegen-base/src/main/resources/metaobjects/explorer-app \ + server/csharp/MetaObjects.Codegen/ExplorerApp; do + diff -r -x README.md explorer-app "$copy" || { echo " stale copy: $copy (run scripts/sync-explorer-app.sh)"; rc=1; } + done + return $rc +} gate_embedded_library_drift() { bun run scripts/generate-embedded-library.ts \ && git diff --exit-code -- server/typescript/packages/metadata/src/library/embedded-library.generated.ts @@ -1496,6 +1511,7 @@ run_gates_offline() { if want gates; then step "hosted assess prompt builds" gate_assess_prompt; fi if want gates; then step "migration guides vs registry" gate_migration_guides; fi if want gates; then step "python agent-context copy" gate_python_agent_context_drift; fi + if want gates; then step_if bun "explorer app copies" gate_explorer_app_drift; fi } # Every gate below runs bun over workspace TypeScript, and on a FRESH CI checkout there is # no node_modules — so a bare `@metaobjectsdev/*` specifier either fails to resolve (what diff --git a/scripts/sync-explorer-app.sh b/scripts/sync-explorer-app.sh new file mode 100755 index 0000000000..b2891126fa --- /dev/null +++ b/scripts/sync-explorer-app.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Refresh every port's committed copy of the model explorer app from the repo-root canonical +# copy, explorer-app/ (built by server/typescript/packages/docs-site/scripts/build-app.ts). +# Each port ships the same bytes in its own package, so its docs-site generator writes the app +# with no Node on the path; only the data files (the docs view, the model script and the stamp) +# are the port's own. Run after rebuilding explorer-app/; the `gates` lane fails when a copy is +# stale. +set -euo pipefail +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +src="$root/explorer-app" +# Keep this list in step with gate_explorer_app_drift in scripts/ci-local.sh. +dests=( + "$root/server/typescript/packages/docs-site/app" + "$root/server/python/src/metaobjects/documentation/explorer_app" + "$root/server/java/codegen-base/src/main/resources/metaobjects/explorer-app" + "$root/server/csharp/MetaObjects.Codegen/ExplorerApp" +) +for dst in "${dests[@]}"; do + mkdir -p "$dst" + # --delete drops files a rebuild renamed away; the README stays at the root only. + rsync -a --delete --exclude README.md "$src/" "$dst/" + echo "synced: explorer-app/ -> ${dst#"$root"/}" +done diff --git a/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/cytoscape.min.js b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/cytoscape.min.js new file mode 100644 index 0000000000..ff0d7c1796 --- /dev/null +++ b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2024, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}var u="undefined"==typeof window?null:window,c=u?u.navigator:null;u&&u.document;var d=e(""),h=e({}),p=e((function(){})),f="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),g=function(e){return e&&e.instanceString&&y(e.instanceString)?e.instanceString():null},v=function(t){return null!=t&&e(t)==d},y=function(t){return null!=t&&e(t)===p},m=function(e){return!E(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},b=function(t){return null!=t&&e(t)===h&&!m(t)&&t.constructor===Object},x=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},w=function(e){return"undefined"===f?void 0:null!=e&&e instanceof HTMLElement},E=function(e){return k(e)||C(e)},k=function(e){return"collection"===g(e)&&e._private.single},C=function(e){return"collection"===g(e)&&!e._private.single},S=function(e){return"core"===g(e)},P=function(e){return"stylesheet"===g(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},T=function(t){return function(t){return null!=t&&e(t)===h}(t)&&y(t.then)},_=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},L=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},R={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},V=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=H();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?ge(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=H(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=pe(t)||0,j(n)&&(c=!!n.leading,a=(d="maxWait"in n)?fe(pe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(H())},m},ye=u?u.performance:null,me=ye&&ye.now?function(){return ye.now()}:function(){return Date.now()},be=function(){if(u){if(u.requestAnimationFrame)return function(e){u.requestAnimationFrame(e)};if(u.mozRequestAnimationFrame)return function(e){u.mozRequestAnimationFrame(e)};if(u.webkitRequestAnimationFrame)return function(e){u.webkitRequestAnimationFrame(e)};if(u.msRequestAnimationFrame)return function(e){u.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(me())}),1e3/60)}}(),xe=function(e){return be(e)},we=me,Ee=65599,ke=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*Ee+t.value|0;return r},Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*Ee+e|0},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},Pe=function(e){return 2097152*e[0]+e[1]},De=function(e,t){return[Ce(e[0],t[0]),Se(e[1],t[1])]},Te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return ke({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ge=function(e){e.splice(0,e.length)},Ue=function(e,t,n){return n&&(t=N(n,t)),e[t]},Ze=function(e,t,n,r){n&&(t=N(n,t)),e[t]=r},$e="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Qe=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Je,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];m(t.classes)?l=t.classes:v(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=m.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},ot={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!i){var T=S*u+C;!i&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},pt=Math.sqrt(2),ft=function(e,t,n){0===n.length&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=ft(i,e,t),n--}return t},vt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/pt);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},kt=function(e,t){return Math.sqrt(Ct(e,t))},Ct=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},St=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Mt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Bt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},It=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},At=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ot=function(e,t){return Lt(e,t.x1,t.y1)&&Lt(e,t.x2,t.y2)},Rt=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,d=i/2,h=a/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=n-d+c-o,v=r-h-o,y=n+d-c+o,m=v;if((s=Zt(e,t,n,r,g,v,y,m,!1)).length>0)return s}if(f){var b=n+d+o,x=r-h+c-o,w=b,E=r+h-c+o;if((s=Zt(e,t,n,r,b,x,w,E,!1)).length>0)return s}if(p){var k=n-d+c-o,C=r+h+o,S=n+d-c+o,P=C;if((s=Zt(e,t,n,r,k,C,S,P,!1)).length>0)return s}if(f){var D=n-d-o,T=r-h+c-o,_=D,M=r+h-c+o;if((s=Zt(e,t,n,r,D,T,_,M,!1)).length>0)return s}var B=n-d+c,N=r-h+c;if((l=Gt(e,t,n,r,B,N,c+o)).length>0&&l[0]<=B&&l[1]<=N)return[l[0],l[1]];var z=n+d-c,I=r-h+c;if((l=Gt(e,t,n,r,z,I,c+o)).length>0&&l[0]>=z&&l[1]<=I)return[l[0],l[1]];var A=n+d-c,L=r+h-c;if((l=Gt(e,t,n,r,A,L,c+o)).length>0&&l[0]>=A&&l[1]>=L)return[l[0],l[1]];var O=n-d+c,R=r+h-c;return(l=Gt(e,t,n,r,O,R,c+o)).length>0&&l[0]<=O&&l[1]>=R?[l[0],l[1]]:[]},Vt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ft=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},jt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Yt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Xt=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Ht(c,-l);d=Wt(g)}else d=c;return Yt(e,t,d)},Wt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ut=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Zt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Ut(e,n,o)===o?[o,s]:Ut(e,n,i)===i?[i,a]:Ut(i,o,n)===n?[n,r]:[]:[]},$t=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Ht(g,-s);u=Wt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Cn,o=r,s=0;s=2?Mn(e,t,n,0,Dn,Tn):Mn(e,t,n,0,Pn)},squaredEuclidean:function(e,t,n){return Mn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Mn(e,t,n,0,Pn)},max:function(e,t,n){return Mn(e,t,n,-1/0,_n)}};function Nn(e,t,n,r,i,a){var o;return o=y(e)?e:Bn[e]||Bn.euclidean,0===t&&y(e)?o(i,a):o(t,n,r,i,a)}Bn["squared-euclidean"]=Bn.squaredEuclidean,Bn.squaredeuclidean=Bn.squaredEuclidean;var zn=He({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),In=function(e){return zn(e)},An=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Nn(e,r.length,a,(function(e){return r[e](t)}),o,s)},Ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},jn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=rr(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=rr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},lr=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},ur={};[nt,at,ot,lt,ct,ht,vt,sn,un,dn,pn,kn,Kn,Jn,ar,{hierholzer:function(e){if(!b(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=or(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=v(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=p(i);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var y in f.unshift(l.getElementById(g.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:sr,htbc:sr,htb:sr,hopcroftTarjanBiconnectedComponents:sr},{tarjanStronglyConnected:lr,tsc:lr,tscc:lr,tarjanStronglyConnectedComponents:lr}].forEach((function(e){L(ur,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var cr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};cr.prototype={fulfill:function(e){return dr(this,1,"fulfillValue",e)},reject:function(e){return dr(this,2,"rejectReason",e)},then:function(e,t){var n=new cr;return this.onFulfilled.push(fr(e,n,"fulfill")),this.onRejected.push(fr(t,n,"reject")),hr(this),n.proxy}};var dr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,hr(e)),e},hr=function(e){1===e.state?pr(e,"onFulfilled",e.fulfillValue):2===e.state&&pr(e,"onRejected",e.rejectReason)},pr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1};var ri=function(e,t){var n=this.__data__,r=Qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ii(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){m(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};qi.className=qi.classNames=qi.classes;var Yi={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:I,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yi.variable="(?:[\\w-.]|(?:\\\\"+Yi.metaChar+"))+",Yi.className="(?:[\\w-]|(?:\\\\"+Yi.metaChar+"))+",Yi.value=Yi.string+"|"+Yi.number,Yi.id=Yi.variable,function(){var e,t,n;for(e=Yi.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Yi.comparatorOp+="|\\!"+t)}();var Xi=0,Wi=1,Hi=2,Ki=3,Gi=4,Ui=5,Zi=6,$i=7,Qi=8,Ji=9,ea=10,ta=11,na=12,ra=13,ia=14,aa=15,oa=16,sa=17,la=18,ua=19,ca=20,da=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*A(e,t)}(e.selector,t.selector)})),ha=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return je("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return je("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&je("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return v(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Xi:var l=e(s);return l.substring(0,l.length-1);case Ki:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ui:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Gi:return"["+r.field+"]";case Zi:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case $i:return s;case Qi:return"#"+s;case Ji:return"."+s;case sa:case aa:return i(r.parent,a)+n(">")+i(r.child,a);case la:case oa:return i(r.ancestor,a)+" "+i(r.descendant,a);case ua:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case ca:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ba(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Ba)},_a.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Na)},_a.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,za)},_a.ancestors=_a.parents,(Pa=Da={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pa.data,Pa.removeAttr=Pa.removeData;var Ia,Aa,La=Da,Oa={};function Ra(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:Va("indegree",(function(e,t){return et})),minOutdegree:Va("outdegree",(function(e,t){return et}))}),L(Oa,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,y=g;g&&(f=f[0]);var m=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+m[e]):void 0!==i&&p.position({x:i.x+m.x,y:i.y+m.y})}}else if(!a)return;return this}}).modelPosition=Ia.point=Ia.position,Ia.modelPositions=Ia.points=Ia.positions,Ia.renderedPoint=Ia.renderedPosition,Ia.relativePoint=Ia.relativePosition;var qa,Ya,Xa=Aa;qa=Ya={},Ya.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Ya.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Ya.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ka=function(e,t){return null==t?e:Ha(e,t.x1,t.y1,t.x2,t.y2)},Ga=function(e,t,n){return Ue(e,t,n)},Ua=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Nt(u,1),Ha(e,u.x1,u.y1,u.x2,u.y2)}}},Za=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Ga(a,"labelWidth",n),p=Ga(a,"labelHeight",n),f=Ga(a,"labelX",n),g=Ga(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=i.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?Ga(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,Ha(e,o,l,s,u),Ha(i.labelBounds.all,o,l,s,u)}return e}},$a=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=_t(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;Ha(h,n=o-S,i=s-P,r=o+S,a=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,i,a=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(a>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(zt(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,i=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+i,y2:n.y2+i,w:n.w,h:n.h});Mt(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),Ha(h,n-=k,i-=k,r+=k,a+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,i=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(i>(a=T[1].y)){var M=i;i=a,a=M}Ha(h,n-k,i-k,r+k,a+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((i=I.y)>(a=A.y)){var O=i;i=a,a=O}Ha(h,n-=k,i-=k,r+=k,a+=k)}if(c&&t.includeEdges&&g&&(Ua(h,e,"mid-source"),Ua(h,e,"mid-target"),Ua(h,e,"source"),Ua(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Ha(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};It(F,h),zt(F,y),Nt(F,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ha(h,n-E,i-E,r+E,a+E));var j=p.overlayBounds=p.overlayBounds||{};It(j,h),zt(j,y),Nt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=_t(),c&&t.includeLabels&&(t.includeMainLabels&&Za(h,e,null),g&&(t.includeSourceLabels&&Za(h,e,"source"),t.includeTargetLabels&&Za(h,e,"target")))}return h.x1=Wa(h.x1),h.y1=Wa(h.y1),h.x2=Wa(h.x2),h.y2=Wa(h.y2),h.w=Wa(h.x2-h.x1),h.h=Wa(h.y2-h.y1),h.w>0&&h.h>0&&b&&(zt(h,y),Nt(h,1)),h},Qa=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:bo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},wo.removeAllListeners=function(){return this.removeListener("*")},wo.emit=wo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,m(t)||(t=[t]),Co(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&v(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(b(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(v(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Go.neighbourhood=Go.neighborhood,Go.closedNeighbourhood=Go.closedNeighborhood,Go.openNeighbourhood=Go.openNeighborhood,L(Go,{source:Ta((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ta((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Qo({attr:"source"}),targets:Qo({attr:"target"})}),L(Go,{edgesWith:Ta(Jo(),"edgesWith"),edgesTo:Ta(Jo({thisIsSrc:!0}),"edgesTo")}),L(Go,{connectedEdges:Ta((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Go.componentsOf=Go.components;var ts=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $e,a=!1;if(t){if(t.length>0&&b(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new Je,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new ts(a,e),V=0;V0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var T=0;T1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),as=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},os={linear:function(e,t,n){return e+(t-e)*n},ease:as(.25,.1,.25,1),"ease-in":as(.42,0,1,1),"ease-out":as(0,0,.58,1),"ease-in-out":as(.42,0,.58,1),"ease-in-sine":as(.47,0,.745,.715),"ease-out-sine":as(.39,.575,.565,1),"ease-in-out-sine":as(.445,.05,.55,.95),"ease-in-quad":as(.55,.085,.68,.53),"ease-out-quad":as(.25,.46,.45,.94),"ease-in-out-quad":as(.455,.03,.515,.955),"ease-in-cubic":as(.55,.055,.675,.19),"ease-out-cubic":as(.215,.61,.355,1),"ease-in-out-cubic":as(.645,.045,.355,1),"ease-in-quart":as(.895,.03,.685,.22),"ease-out-quart":as(.165,.84,.44,1),"ease-in-out-quart":as(.77,0,.175,1),"ease-in-quint":as(.755,.05,.855,.06),"ease-out-quint":as(.23,1,.32,1),"ease-in-out-quint":as(.86,0,.07,1),"ease-in-expo":as(.95,.05,.795,.035),"ease-out-expo":as(.19,1,.22,1),"ease-in-out-expo":as(1,0,0,1),"ease-in-circ":as(.6,.04,.98,.335),"ease-out-circ":as(.075,.82,.165,1),"ease-in-out-circ":as(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return os.linear;var r=is(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":as};function ss(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function ls(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function us(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=ls(e,i),s=ls(t,i);if(x(o)&&x(s))return ss(a,o,s,n,r);if(m(o)&&m(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=os[d].apply(null,h)):o.easingImpl=os[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};ds(g.x,y.x)&&(m.x=us(g.x,y.x,p,f)),ds(g.y,y.y)&&(m.y=us(g.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ds(b.x,x.x)&&(w.x=us(b.x,x.x,p,f)),ds(b.y,x.y)&&(w.y=us(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ds(k,C)&&(a.zoom=Tt(a.minZoom,us(k,C,p,f),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||hs(0,d,e),cs(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var fs={animate:Fi.animate(),animation:Fi.animation(),animated:Fi.animated(),clearQueue:Fi.clearQueue(),delay:Fi.delay(),delayAnimation:Fi.delayAnimation(),stop:Fi.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ps(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&xe((function(n){ps(n,e),t()}))}()}}},gs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},vs=function(e){return v(e)?new ka(e):e},ys={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new xo(gs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,vs(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,vs(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,vs(t),n),this},once:function(e,t,n){return this.emitter().one(e,vs(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fi.eventAliasesOn(ys);var ms={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ms.jpeg=ms.jpg;var bs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=v(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(L({},e,{cy:this,eles:r}));return i}Ve("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ve("A `name` must be specified to make a layout");else Ve("Layout options must be specified to make a layout")}};bs.createLayout=bs.makeLayout=bs.layout;var xs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Es.invalidateDimensions=Es.resize;var ks={collection:function(e,t){return v(e)?this.$(e):E(e)?e.collection():m(e)?(t||(t={}),new ts(this,e,t.unique,t.removed)):new ts(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ks.elements=ks.filter=ks.$;var Cs={};Cs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],P=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],_=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(P-S)*g),Math.round(D+(T-D)*g)];n={bypass:i.bypass,name:i.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,z=0;z0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ss={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){je("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new ka(l).invalid){je("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){je("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(je("Skipping property: Invalid property definition in: "+r),o());else je("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var p=this.parse(e,u[4]);if(!p||p.mapped)return!1;var f=this.parse(e,u[5]);if(!f||f.mapped)return!1;if(p.pfValue===f.pfValue||p.strValue===f.strValue)return je("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var g=p.value,b=f.value;if(!(g[0]!==b[0]||g[1]!==b[1]||g[2]!==b[2]||g[3]!==b[3]&&(null!=g[3]&&1!==g[3]||null!=b[3]&&1!==b[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:p.value,valueMax:f.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):m(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",P=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&P?1===E.length&&v(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var _,B,N=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var V={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?V.pfValue=t:V.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(V.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(V.pfValue="rad"===z?t:(_=t,Math.PI*_/180)),"%"===z&&(V.pfValue=t/100),V}if(c.propList){var F=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),x(e)?n=e:b(e)&&(n=e.level,null!=e.position?t=yt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;x(l.x)&&(t.pan.x=l.x,o=!1),x(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(v(e)){var n=e;e=this.mutableElements().filter(n)}else E(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};As.centre=As.center,As.autolockNodes=As.autolock,As.autoungrabifyNodes=As.autoungrabify;var Ls={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ls.attr=Ls.data,Ls.removeAttr=Ls.removeData;var Os=function(e){var t=this,n=(e=L({},e)).container;n&&!w(n)&&w(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==u&&void 0!==n&&!e.headless,o=e;o.layout=L({name:a?"grid":"null"},o.layout),o.renderer=L({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ts(this),listeners:[],aniEles:new ts(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:x(o.zoom)?o.zoom:1,pan:{x:b(o.pan)&&x(o.pan.x)?o.pan.x:0,y:b(o.pan)&&x(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var c=L({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(T))return vr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(b(e)||m(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=L({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,y(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(E(n.roots))e=n.roots;else if(m(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){je("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var L=0;L0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*i;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ws(e){this.options=L({},Xs,e)}Ws.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Hs,Ks={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gs(e){this.options=L({},Ks,e)}Gs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(rl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),xe(t)):(gl(r,e),s())}()}else{for(;u;)u=o(l),l++;gl(r,e),s()}return this},Zs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Zs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var $s=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},Js=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=ll(e,i,a),d=ll(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},sl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ll=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},ul=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},dl=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},fl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yl(e){this.options=L({},vl,e)}yl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=qt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=jt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ue(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Yt(e,t,T))return v(n),!0}else if(Lt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=_t({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-a.ang):Math.PI+a.ang),Zl(t,n,Ul),zl=Gl.nx*Ul.ny-Gl.ny*Ul.nx,Il=Gl.nx*Ul.nx-Gl.ny*-Ul.ny,Ol=Math.asin(Math.max(-1,Math.min(1,zl))),Math.abs(Ol)<1e-6)return Bl=t.x,Nl=t.y,void(Vl=jl=0);Al=1,Ll=!1,Il<0?Ol<0?Ol=Math.PI+Ol:(Ol=Math.PI-Ol,Al=-1,Ll=!0):Ol>0&&(Al=-1,Ll=!0),jl=void 0!==t.radius?t.radius:r,Rl=Ol/2,ql=Math.min(Gl.len/2,Ul.len/2),i?(Fl=Math.abs(Math.cos(Rl)*jl/Math.sin(Rl)))>ql?(Fl=ql,Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))):Vl=jl:(Fl=Math.min(ql,jl),Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))),Wl=t.x+Ul.nx*Fl,Hl=t.y+Ul.ny*Fl,Bl=Wl-Ul.ny*Vl*Al,Nl=Hl+Ul.nx*Vl*Al,Yl=t.x+Gl.nx*Fl,Xl=t.y+Gl.ny*Fl,Kl=t};function Ql(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Jl(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($l(e,t,n,r,i),{cx:Bl,cy:Nl,radius:Vl,startX:Yl,startY:Xl,stopX:Wl,stopY:Hl,startAngle:Gl.ang+Math.PI/2*Al,endAngle:Ul.ang-Math.PI/2*Al,counterClockwise:Ll})}var eu={};function tu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var C,S="vertical"===u,P=S?E:w,D=S?b:m,T=Et(D),_=!1;(k&&(h||f)||!("downward"===c&&D<0||"upward"===c&&D>0||"leftward"===c&&D>0||"rightward"===c&&D<0)||(P=(T*=-1)*Math.abs(P),_=!0),h)?C=(p<0?1+p:p)*P:C=(p<0?P:0)+p*T;var M=function(e){return Math.abs(e)=Math.abs(P)},B=M(C),N=M(Math.abs(P)-Math.abs(C));if((B||N)&&!_)if(S){var z=Math.abs(D)<=a/2,I=Math.abs(m)<=o/2;if(z){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(I){var R=(r.y1+r.y2)/2,V=r.x1,F=r.x2;n.segpts=[V,R,F,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(D)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(S){var U=r.y1+C+(l?a/2*T:0),Z=r.x1,$=r.x2;n.segpts=[Z,U,$,U]}else{var Q=r.x1+C+(l?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}if(n.isRound){var te=e.pstyle("taxi-radius").value,ne="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(te),n.isArcRadius=new Array(n.segpts.length/2).fill(ne)}},eu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!x(n.startX)||!x(n.startY),v=!x(n.arrowStartX)||!x(n.arrowStartY),y=!x(n.endX)||!x(n.endY),m=!x(n.arrowEndX)||!x(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=kt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Ct(H,bt(t)),G=Ct(H,bt(W)),U=K;if(G2)Ct(H,{x:W[2],y:W[3]})0){var le=c,ue=Ct(le,bt(t)),ce=Ct(le,bt(se)),de=ue;if(ce2)Ct(le,{x:se[2],y:se[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=Tt(0,C,1),t=Dt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=Tt(0,r-.001,1),a=Tt(0,r+.001,1),o=Dt(e,t,n,i),s=Dt(e,t,n,a);return su(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,P,D,T,_=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-P)/S;N=Tt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=kt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(D,T,N),l=su(D,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},au.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},au.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ue(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ze(n.rstyle,"labelWidth",t,d),Ze(n.rscratch,"labelWidth",t,d),Ze(n.rstyle,"labelHeight",t,h),Ze(n.rscratch,"labelHeight",t,h),Ze(n.rscratch,"labelLineHeight",t,c)},au.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ze(n.rscratch,e,t,r),r):Ue(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=l(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,i).widthD)break;T+=i[M],M===i.length-1&&(_=!0)}return _||(T+="…"),T}return i},au.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},au.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=Te(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:b[0]*s,y:b[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var z={x:0,y:0};if(x(b[0])&&x(b[1])&&(z.x+=b[0],z.y+=b[1],N)){var I=e.hoverData.dragDelta;I&&x(I[0])&&x(I[1])&&(z.x+=I[0],z.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=bt(h),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=i(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),b=!1,t.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(i,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(i,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Rt(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(Xt(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Xt(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Yt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Kt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Kt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},gu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Jt(3,0)),this.generateRoundPolygon("round-triangle",Jt(3,0)),this.generatePolygon("rectangle",Jt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Jt(5,0)),this.generateRoundPolygon("round-pentagon",Jt(5,0)),this.generatePolygon("hexagon",Jt(6,0)),this.generateRoundPolygon("round-hexagon",Jt(6,0)),this.generatePolygon("heptagon",Jt(7,0)),this.generateRoundPolygon("round-heptagon",Jt(7,0)),this.generatePolygon("octagon",Jt(8,0)),this.generateRoundPolygon("round-octagon",Jt(8,0));var r=new Array(20),i=tn(5,0),a=tn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},wu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;t(this,e),this.idsByKey=new $e,this.keyForId=new $e,this.cachesByLvl=new $e,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Je,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new $e,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Eu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ku=He({getKey:null,doesEleInvalidateKey:Le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=ku(t);L(this,n),this.lookup=new wu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=Eu,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rt((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(wt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=a.getElement(e,t,n,D,Eu.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ke(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ke(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ge(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ke(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Eu.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=Ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Ke(this.onDequeues,e)},Su.setupDequeueing=xu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ke(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=_t();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!Ot(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=we(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=we(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ke(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},k=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},C=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var S="yes"===t.pstyle("ghost").value;if(S){var P=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(P,D),b(_),k(_),e.translate(-P,-D)}else x();E(),b(),k(),w(),C(),n&&e.translate(l.x1,l.y1)}}},Wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xu.drawEdgeOverlay=Wu("overlay"),Xu.drawEdgeUnderlay=Wu("underlay"),Xu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Ku.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(wt(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Ku.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ku.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ue(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ku.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ue(o,"labelX",n),d=Ue(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ue(o,"labelWidth",n),v=Ue(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),T=2;if(E>0||C>0&&k>0){var _=c-S;switch(x){case"left":_-=g;break;case"center":_-=g/2}var M=d-v-S,B=g+2*S,N=v+2*S;if(E>0){var z=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",D?Gu(e,_,M,B,N,T):e.fillRect(_,M,B,N),e.fillStyle=z}if(C>0&&k>0){var A=e.strokeStyle,L=e.lineWidth,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*s+")",e.lineWidth=C,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?Gu(e,_,M,B,N,T,"stroke"):e.strokeRect(_,M,B,N),"double"===R){var V=C/2;D?Gu(e,_+V,M+V,B-2*V,N-2*V,T,"stroke"):e.strokeRect(_+V,M+V,B-2*V,N-2*V)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=A}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var j=Ue(o,"labelWrapCachedLines",n),q=Ue(o,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-g:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=g))),w){case"top":d-=(j.length-1)*q;break;case"center":case"bottom":d-=(j.length-1)*q}for(var W=0;W0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=q}else F>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(x(d.x)&&x(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),k=0,C=0;C0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;l.colorStrokeStyle(e,F[0],F[1],F[2],t)},G=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=_e("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},U=t.pstyle("shape").strValue,Z=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var $=G(r,i,U,Z);h=$.path,v=$.cacheHit}var Q=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i,X,c)}g?e.fill(h):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i,X,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},ne=function(){if(_>0){if(e.lineWidth=_,e.lineCap=I,e.lineJoin=z,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=O;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===N){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var a=l.getNodeShape(t),o=_;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,u=(r+o+(V+Y))/r,c=(i+o+(V+Y))/i,h=r*u,p=i*c,f=l.nodeShapes[a].points;if(g)s=G(h,p,a,f).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+Y+V):"round-heptagon"===a?(v=1.075*(o+Y+V),m=-(o/2+Y+V)/35):"round-hexagon"===a?v=1.12*(o+Y+V):"round-pentagon"===a?(v=1.13*(o+Y+V),m=-(o/2+Y+V)/15):"round-tag"===a?(v=1.12*(o+Y+V),y=.07*(o/2+V+Y)):"round-triangle"===a&&(v=(o+Y+V)*(Math.PI/2),m=-(o+Y/2+V)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=h/2,x=p/2,w=(X="auto"===X?rn(h,p):X)+(o+V+Y)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Uu.drawNodeOverlay=Zu("overlay"),Uu.drawNodeUnderlay=Zu("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var $u={};$u.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},$u.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Qu={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},ac.png=function(e){return sc(e,this.bufferCanvasImage(e),"image/png")},ac.jpg=function(e){return sc(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},uc=dc,cc=dc.prototype;function dc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(cc.CANVAS_LAYERS),contexts:new Array(cc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cc.CANVAS_LAYERS),bufferCanvases:new Array(cc.BUFFER_COUNT),bufferContexts:new Array(cc.CANVAS_LAYERS)};t.data.canvasContainer=n.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};c&&c.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var o=0;o{var m2={"explorer-head.mustache":` + + + + +{{{pageTitle}}} · {{{siteTitle}}} + + + + + +
    + {{{siteTitle}}} model explorer + + + +
    +
    + +`,"explorer-foot.mustache":`
    +
    Built from explorer.json by the metaobjects docs-site generator{{#stamp}} · {{{stamp}}}{{/stamp}}. Static: no server, no LLM call.
    + +{{#needsGraph}}{{/needsGraph}} + + + +`,"explorer-card.mustache":`
    +

    {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}{{{verdictHtml}}}

    +
    {{{statement}}}
    +
    {{{barHtml}}}
    {{{countsLine}}}
    + {{#hasChildren}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{glyphHtml}}}
    • {{/children}}
    {{/hasChildren}} +
    Summary from the levels below
    No summary is generated in this build.
    +
    +`,"explorer-overview.html.mustache":`

    {{{heading}}}

    +
    Built from {{{sourcesLine}}}. Every number below is computed from the project's metadata or the gate's own output.
    +
    +{{#tiles}}
    {{{n}}}
    {{{l}}}
    +{{/tiles}}
    +{{#hasRequirements}}{{{legendHtml}}}{{/hasRequirements}} +{{#hasRequirements}} +

    Features requirement.functional, by level

    +{{#hasFeatures}}
    +{{#featureCards}}{{> card}}{{/featureCards}} +
    {{/hasFeatures}} +{{^hasFeatures}}
    No requirement.functional is declared.
    {{/hasFeatures}} +

    Qualities requirement.architectural, the non-functional policies

    +{{#hasQualities}}
    +{{#qualityCards}}{{> card}}{{/qualityCards}} +
    {{/hasQualities}} +{{^hasQualities}}
    No requirement.architectural is declared.
    {{/hasQualities}} +{{/hasRequirements}} +{{^hasRequirements}} +
    This model declares no requirements yet, so this page cannot say what each part is for. Declare requirement.functional entries (levels 1 to 3 for the problem, 4 and 5 naming the model) and this page opens on them, with every entity traced to the feature it serves.
    +{{/hasRequirements}} +

    Packages what the model holds

    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-map.html.mustache":`

    Model map

    +
    Entities and the references between them. A slice is the set of model nodes a requirement subtree claims, a package holds, or a prompt reads and returns.
    +
    + + + + + + +
    +
    Click a node to see why it exists, what it holds and what was generated from it. Double-click to open its page.
    +
    + +`,"explorer-object.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}{{#isReadOnly}}read-only view{{/isReadOnly}}{{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}} · {{{storageLine}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#projection}} +

    Read model

    +
    + {{#basesHtml}}
    Surfaces fields of {{{basesHtml}}}.
    {{/basesHtml}} + {{#hasOrigins}}
    {{#origins}}{{/origins}}
    FieldOriginDefinition
    {{{field}}}{{{origin}}}{{{definitionHtml}}}
    {{/hasOrigins}} +
    + {{/projection}} + {{#report}} +

    Report

    +
    + {{#fromHtml}}{{/fromHtml}} + {{#spineHtml}}{{/spineHtml}} + {{#dimensionsHtml}}{{/dimensionsHtml}} + {{#measuresHtml}}{{/measuresHtml}} + {{#segmentHtml}}{{/segmentHtml}} + {{#filterHtml}}{{/filterHtml}} +
    From{{{fromHtml}}}
    Spine{{{spineHtml}}}
    Dimensions{{{dimensionsHtml}}}
    Measures{{{measuresHtml}}}
    Segment{{{segmentHtml}}}
    Filter{{{filterHtml}}}
    + {{/report}} + {{#hasFields}}

    Fields

    +
    {{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{#fields}}{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{/fields}}
    FieldTypeColumnFlagsClaimed at L5
    {{{name}}} {{{inheritedHtml}}}{{{type}}}{{{refHtml}}}{{{valuesHtml}}}{{{column}}}{{{flagsHtml}}}{{{claimsHtml}}}
    {{/hasFields}} + {{#hasKeys}}

    Keys and references

    +
    {{#keys}}{{/keys}}
    {{{kind}}} {{{name}}} {{{inheritedHtml}}}{{{shape}}}{{{targetHtml}}}
    {{/hasKeys}} + {{#hasReporting}}

    Reporting vocabulary

    +
    {{#reporting}}{{/reporting}}
    NameKindDefinition
    {{{name}}}{{{kind}}}{{{definitionHtml}}}
    {{/hasReporting}} + {{#hasLayouts}}

    Screens declared

    {{#layouts}}
    {{{kind}}} {{{name}}}{{#detailHtml}}: {{{detailHtml}}}{{/detailHtml}}
    {{/layouts}}{{/hasLayouts}} +
    + +
    +`,"explorer-node.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#hasAttrs}}

    Attributes

    +
    {{#attrs}}{{/attrs}}
    @{{{name}}}{{{valueHtml}}}
    {{/hasAttrs}} + {{#hasMembers}}

    Members

    +
    + {{#members}} + {{/members}}
    NameTypeAttributes
    {{{nameHtml}}}{{#below}} +{{below}}{{/below}}{{{kind}}}{{{attrsHtml}}}
    {{/hasMembers}} +
    + +
    +`,"explorer-prompt.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{attrsHtml}}}
    +
    +
    +

    Payload: {{{payloadHtml}}}

    + {{#hasPayload}}
    {{#payloadRows}}{{/payloadRows}}
    FieldTypeUsed in text
    {{{name}}} {{{requiredHtml}}}{{{type}}}{{{refHtml}}}{{{usedHtml}}}
    {{/hasPayload}} + {{^hasPayload}}
    No payload: the text renders from nothing typed.
    {{/hasPayload}} +

    Reply: {{{replyHtml}}}

    + {{#hasReply}}
    {{#replyRows}}{{/replyRows}}
    FieldType
    {{{name}}}{{{type}}}{{{valuesHtml}}}
    {{/hasReply}} + {{^hasReply}}
    Outbound only: no reply parser.
    {{/hasReply}} +

    Why it exists

    + {{#hasWhy}}
    {{#whyRows}}{{/whyRows}}
    CapabilityRequirementLevelStatus
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} +
    +
    +

    Text {{{textMeta}}}

    + {{#hasText}}
    {{{textHtml}}}
    {{/hasText}} + {{^hasText}}
    The text {{{textRef}}} was not found beside the model, so this page cannot show it.
    {{/hasText}} +

    Generated

    + {{#hasGenerated}}{{#generated}}
    {{{generator}}}{{#files}}
    {{{.}}}
    {{/files}}
    {{/generated}}{{/hasGenerated}} + {{^hasGenerated}}
    {{{generatedNote}}}
    {{/hasGenerated}} +
    Proven today: meta verify --templates fails if the text names a variable the payload lacks. This page shows the other direction too: payload fields the text never uses.
    +
    +
    +`,"explorer-prompts.html.mustache":`

    Prompts

    +
    Each declared template, its typed payload, its reply type, and the requirements that claim it.
    +{{#hasRows}}
    +{{#rows}} +{{/rows}}
    TemplatePayloadReplyClaimed by
    {{{linkHtml}}} {{{kind}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{payloadHtml}}}{{{replyHtml}}}{{{claimsHtml}}}
    {{/hasRows}} +{{^hasRows}}
    This model declares no template.*.
    {{/hasRows}} +`,"explorer-requirements.html.mustache":`

    Requirements

    +
    Hierarchy is nesting. L1 to L3 describe the problem; only L4 (an object or prompt) and L5 (a member) may name the model.
    + +{{{legendHtml}}} +{{#hasTree}}
    {{{treeHtml}}}
    {{/hasTree}} +{{^hasTree}}
    {{{emptyNote}}}
    {{/hasTree}} +`,"explorer-requirement.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{levelHtml}}}{{{name}}} {{{statusHtml}}}{{{dispositionHtml}}}{{{verdictHtml}}}

    + +
    {{{address}}}
    +
    +
    +

    Statement

    {{{statement}}}

    Counterexample

    {{{counterexample}}}{{#hasDescription}}

    Scope

    {{{description}}}
    {{/hasDescription}}
    +

    Implemented by

    + {{#hasLinks}}
    {{#linkRows}}{{/linkRows}}
    ReferenceKindResolves
    {{{refHtml}}}{{{kind}}}{{{resolvesHtml}}}
    {{/hasLinks}} + {{^hasLinks}}
    {{{linksEmpty}}}
    {{/hasLinks}} + {{#hasBelow}}

    Below ({{childCount}}){{#deeper}} {{belowCount}} in all{{/deeper}}

    {{{belowBarHtml}}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}
    • {{/children}}
    {{/hasBelow}} +
    {{#sliceHref}}Show this slice on the model map{{/sliceHref}}{{#sliceHref}}{{#traceHref}} · {{/traceHref}}{{/sliceHref}}{{#traceHref}}Trace to code{{/traceHref}}
    +
    +
    +

    What the build proves about this entry

    +
    {{#proof}}{{/proof}}
    {{{what}}}{{{verdictHtml}}}{{{howHtml}}}
    + {{#trackedHtml}}

    Tracked by

    {{{trackedHtml}}}{{/trackedHtml}} + {{#digest}}

    Statement digest

    {{{digest}}}
    Moves when the statement changes; a summary of this entry would be pinned to it.
    {{/digest}} +
    +
    +`,"explorer-matrix.html.mustache":`

    Traceability matrix

    +
    Rows are requirements that name the model; columns are stored entities and prompts, most claimed first. An empty column is a node nothing claims; a cell's colour and glyph are the row's declared status.
    +{{#hasRows}}
    {{{legendHtml}}}
    +
    {{{tableHtml}}}
    {{/hasRows}} +{{^hasRows}}
    {{#hasRequirements}}No requirement names the model yet: only L4 and L5 entries do.{{/hasRequirements}}{{^hasRequirements}}This model declares no requirements, so there is nothing to trace.{{/hasRequirements}}
    {{/hasRows}} +`,"explorer-trace.html.mustache":`

    Trace

    +
    From intent to code: requirement levels, then the model nodes they name, then the files generated from those nodes.
    +{{#hasStarts}}
    + +
    Hand-written modules that import the generated files are not scanned in this build, so the trace stops at the generated files. Click a requirement or a model node to open its page.
    {{/hasStarts}} +{{^hasStarts}}
    This model declares no requirements, so there is nothing to trace from. Every object's generated files are listed on its own page.
    {{/hasStarts}} +`,"explorer-gaps.html.mustache":`

    Gaps

    +
    What the model and the gate can already point at. Each card says whether it comes from the shipped gate or is a check this explorer adds.
    +
    +{{#cards}}

    {{{title}}} {{{count}}} {{{source}}}

    {{{whyHtml}}}
    {{{bodyHtml}}}
    +{{/cards}}
    +`,"explorer-api.html.mustache":`

    API

    +{{#recorded}}
    Every route the generated code mounts, by the object it serves: {{{summary}}}.
    +{{#hasGroups}}
    {{#groups}}

    {{{linkHtml}}} {{{kind}}}{{#isReadOnly}} read-only{{/isReadOnly}}

    {{#routes}}
    {{{method}}} {{{path}}}
    {{/routes}}
    {{/groups}}
    {{/hasGroups}} +{{^hasGroups}}
    The run generated no routes.
    {{/hasGroups}}{{/recorded}} +{{^recorded}}
    The run that built this site recorded no routes: it generated none, or ran without the routes generator.
    {{/recorded}} +`,"explorer-model.html.mustache":`

    Packages

    +
    Every package in the model and what it declares.
    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-package.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}}

    +
    +{{#rows}} +{{/rows}}
    NameKindStorageFieldsClaim
    {{{linkHtml}}} {{{abstractHtml}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{kind}}}{{{storage}}}{{fieldCount}}{{{statusHtml}}}
    +`};/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.css b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.css new file mode 100644 index 0000000000..aae678b023 --- /dev/null +++ b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.css @@ -0,0 +1,232 @@ +/* The model explorer's theme. `meta eject docs-site` copies this file to + codegen/docs-site/assets/, where an edit wins over the bundled copy. + + Colour rules (design report §4.2), which the classes below keep apart: + .s- a DECLARED status: filled chip, with its glyph in the text + .v- a GATE verdict: an outline (ring), never a fill + .bar .b-* a ROLL-UP of what sits below: a separate stacked bar + No class here colours a test result. */ + +:root { + --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f23; --muted: #5f6670; --line: #e2e3e0; + --accent: #3b5bdb; --accent-soft: #e8ecfd; --accent-ink: #ffffff; + --live: #2f9e44; --live-soft: #e3f5e7; --partial: #e8890c; --partial-soft: #fdf0dc; + --planned: #4c6ef5; --planned-soft: #e9edff; --retired: #868e96; --retired-soft: #eef0f2; + --bad: #e03131; --bad-soft: #fde8e8; --warn: #e8890c; --code: #f1f2ef; + --entity: #495057; --value: #7048e8; --prompt: #0c8599; --projection: #1971c2; --report: #c2255c; + --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); + --shadow-lift: 0 4px 14px rgba(16, 24, 40, .10); + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; + } +} +:root[data-theme="dark"] { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; +} + +* { box-sizing: border-box; } +html { -webkit-text-size-adjust: 100%; } +body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; } +code { background: var(--code); border-radius: 4px; padding: 0 4px; } +code.digest { display: block; overflow-wrap: anywhere; font-size: 11.5px; padding: 4px 6px; } +pre code, .mono code { background: none; padding: 0; } + +/* ── Header ─────────────────────────────────────────────────────────────── */ +header.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: center; padding: 10px 20px; flex-wrap: wrap; } +.brand { font-weight: 700; letter-spacing: .2px; color: var(--ink); white-space: nowrap; } +.brand:hover { text-decoration: none; } +.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; } +.nav { display: flex; gap: 4px; flex-wrap: wrap; } +.nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; } +.nav a:hover { background: var(--code); text-decoration: none; } +.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; } +#search { margin-left: auto; position: relative; } +#search input { width: 260px; max-width: 60vw; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; } +#search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); } +#results { position: absolute; right: 0; top: 36px; width: 420px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lift); display: none; } +#results a { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); } +#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; } +#results a small { color: var(--muted); display: block; } +#results .none { padding: 8px 12px; color: var(--muted); } +#theme { padding: 5px 9px; } + +/* ── Page ───────────────────────────────────────────────────────────────── */ +main { padding: 24px 20px 20px; max-width: 1400px; margin: 0 auto; } +h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } +h2 { font-size: 16px; margin: 26px 0 10px; } +h3 { font-size: 14px; margin: 16px 0 6px; } +h3.first { margin-top: 0; } +.h-sub { color: var(--muted); font-weight: 400; } +.sub { color: var(--muted); } +.small { font-size: 12px; } +.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; } +.meta-line { margin-top: 4px; } +.page { margin-top: 14px; } +.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; } +.grid { display: grid; gap: 12px; } +.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; } +a.tile { color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; } +a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); } +.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; } +.tile .l { color: var(--muted); font-size: 12.5px; line-height: 1.4; } +.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +.apis { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } +@media (max-width: 1000px) { .side { grid-template-columns: minmax(0, 1fr); } } +@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } } + +table { border-collapse: collapse; width: 100%; } +th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } +th { font-size: 12px; color: var(--muted); font-weight: 600; } +tr:target td { background: var(--accent-soft); } +table.kv th { width: 120px; } +.tablewrap { overflow-x: auto; } + +/* ── Status, verdict and roll-up ────────────────────────────────────────── */ +.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0; font-weight: 500; line-height: 1.6; } +h1 .chip { font-size: 12.5px; } +.s-live { background: var(--live-soft); color: var(--live); border-color: transparent; } +.s-partial { background: var(--partial-soft); color: var(--partial); border-color: transparent; } +.s-planned { background: var(--planned-soft); color: var(--planned); border-color: transparent; } +.s-retired { background: var(--retired-soft); color: var(--retired); border-color: transparent; text-decoration: line-through; } +.v-error, .v-unclaimed { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); } +.v-warn { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); } +.glyph { font-size: 12px; } +.g-live { color: var(--live); } .g-partial { color: var(--partial); } .g-planned { color: var(--planned); } .g-retired { color: var(--retired); } +.lvl { display: inline-block; min-width: 24px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; background: var(--code); color: var(--muted); padding: 0 4px; margin-right: 6px; line-height: 18px; } +h1 .lvl { font-size: 12px; line-height: 22px; } +.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--code); min-width: 80px; } +.bar span { display: block; height: 100%; } +.b-live { background: var(--live); } .b-partial { background: var(--partial); } .b-planned { background: var(--planned); } .b-retired { background: var(--retired); } +.minibar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 4px; } +.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin: 4px 0; } +.legend-row { margin: 10px 0; } +.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; } +.pill.gate { color: var(--accent); border-color: var(--accent); } +a.k-entity { color: var(--accent); font-weight: 500; } +span.k-entity { color: var(--entity); } .k-value { color: var(--value); } .k-prompt, .k-template { color: var(--prompt); } +.k-projection { color: var(--projection); } .k-report { color: var(--report); } +.kdot { font-size: 10px; } +.kdot.k-entity { color: var(--entity); } .kdot.k-value { color: var(--value); } .kdot.k-prompt { color: var(--prompt); } +.k-badge { color: var(--projection); } +.vals { color: var(--muted); font-size: 11.5px; } + +/* ── S1 cards ───────────────────────────────────────────────────────────── */ +.cap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; } +.cap .card h3 { margin-top: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.capcard .statement { margin: 2px 0 0; } +.rollup { margin: 10px 0 4px; } +.rollup .sub { margin-top: 3px; } +ul { padding-left: 18px; margin: 6px 0; } +.cap li, .kids li { margin: 4px 0; } +.members { margin-top: 8px; line-height: 1.9; } +details.summary { margin-top: 6px; } +details > summary { cursor: pointer; color: var(--muted); font-size: 12px; } +.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; } +.note.intro { margin: 4px 0 8px; font-size: 13.5px; } + +/* ── S5 tree ────────────────────────────────────────────────────────────── */ +.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } +.tabs a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); } +.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } +.tree { margin-top: 10px; } +.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 8px; } +.tree > ul { border-left: none; padding-left: 0; margin-left: 0; } +.tree li { margin: 4px 0; } +.tree .row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } +.tree .stmt { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-left: 30px; } + +/* ── Graphs ─────────────────────────────────────────────────────────────── */ +.graph { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; } +#cy { height: 640px; } #cymini { height: 260px; } #cytrace { height: 680px; } +.panel h3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.maplegend { margin-top: 8px; } +.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } +select, button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; max-width: 100%; } +button { cursor: pointer; } +button:hover { border-color: var(--accent); } +.layout, .gen, .route { margin: 4px 0; } +.gen .pill { margin-left: 0; } + +/* ── S4 text ────────────────────────────────────────────────────────────── */ +pre { background: var(--code); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; } +pre.text { max-height: 560px; } +.var { color: var(--prompt); } + +/* ── S6 proof ───────────────────────────────────────────────────────────── */ +.proof { font-size: 12.5px; } +.proof td:first-child { white-space: nowrap; font-weight: 500; } + +/* ── S7 matrix ──────────────────────────────────────────────────────────── */ +.mx { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } +.mx table { width: auto; border-collapse: separate; border-spacing: 0; } +/* The header row is sticky as a whole: a sticky cell per column would paint over the slanted + label of the column before it. */ +.mx thead { position: sticky; top: 0; z-index: 2; background: var(--panel); } +.mx th.col { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 0; } +.mx th.col.corner { position: sticky; left: 0; background: var(--panel); } +.mx th.col div { transform: rotate(-60deg); transform-origin: left bottom; width: 18px; margin-left: 12px; font-weight: 500; font-size: 11.5px; max-width: 18px; } +.mx th.col div a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +.mx th.col.unc div a { color: var(--bad); } +.mx td.c { width: 20px; min-width: 20px; height: 22px; padding: 0; text-align: center; font-size: 11px; border-right: 1px solid var(--line); } +.mx td.rh { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; } +.mx tr.grp td { background: var(--code); font-weight: 600; } +.mx td.c.live { background: var(--live-soft); } .mx td.c.planned { background: var(--planned-soft); } +.mx td.c.partial { background: var(--partial-soft); } .mx td.c.retired { background: var(--retired-soft); } + +/* ── S9 gaps, API ───────────────────────────────────────────────────────── */ +.gap h3 { display: flex; gap: 8px; align-items: center; margin-top: 0; flex-wrap: wrap; } +.gap .why { margin-bottom: 8px; } +.count { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--code); } +.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 4px; padding: 1px 4px; background: var(--code); color: var(--muted); } +.m-GET, .m-get { background: var(--live-soft); color: var(--live); } +.m-POST, .m-post { background: var(--planned-soft); color: var(--planned); } +.m-PUT, .m-put, .m-PATCH, .m-patch { background: var(--partial-soft); color: var(--partial); } +.m-DELETE, .m-delete { background: var(--bad-soft); color: var(--bad); } + +footer { color: var(--muted); font-size: 12px; padding: 24px 20px; text-align: center; } + +/* ── Phone ──────────────────────────────────────────────────────────────── */ +@media (max-width: 700px) { + header.top { gap: 8px 12px; padding: 10px 16px; } + .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } + .nav::-webkit-scrollbar { display: none; } + #search { order: 4; margin-left: 0; flex-basis: 100%; } + #search input { width: 100%; max-width: none; } + #results { left: 0; right: 0; width: auto; max-width: none; } + #theme { margin-left: auto; } + main { padding: 16px; } + h1 { font-size: 20px; } + .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .tile .n { font-size: 22px; } + .cap { grid-template-columns: minmax(0, 1fr); } + .apis { grid-template-columns: minmax(0, 1fr); } + #cy { height: 440px; } #cytrace { height: 520px; } + .mx { max-height: none; } + /* A wide table scrolls inside its own box, never the page. */ + main table { display: block; max-width: 100%; overflow-x: auto; } + .mx table { display: table; max-width: none; } + .tree .stmt { margin-left: 0; } + .tree ul { padding-left: 12px; margin-left: 4px; } +} +@media print { header.top, #search, #theme, .toolbar { display: none; } .card { box-shadow: none; } } diff --git a/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.js b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.js new file mode 100644 index 0000000000..61c4153d2e --- /dev/null +++ b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer.js @@ -0,0 +1,332 @@ +// The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. +// `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. +(function () { + "use strict"; + function run() { + var APP = window.MO_APP || null; + var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; + var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; + var $ = function (s, r) { return (r || document).querySelector(s); }; + var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; + var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; + var STATUS = ["live", "partial", "planned", "retired"]; + var GLYPH = { live: "●", partial: "◐", planned: "○", retired: "⊘" }; + var PAL = ["#1971c2", "#e8590c", "#2b8a3e", "#ae3ec9", "#c2255c", "#0b7285", "#5c940d", "#f08c00"]; + var byId = {}; + D.nodes.forEach(function (n) { byId[n.id] = n; }); + var reqById = {}; + D.reqs.forEach(function (r) { reqById[r.id] = r; }); + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; + var redraw = []; + + // ── Theme ─────────────────────────────────────────────────────────────── + var themeBtn = $("#theme"); + if (themeBtn) themeBtn.onclick = function () { + var cur = document.documentElement.getAttribute("data-theme"); + var dark = cur ? cur === "dark" : matchMedia("(prefers-color-scheme: dark)").matches; + var next = dark ? "light" : "dark"; + document.documentElement.setAttribute("data-theme", next); + try { localStorage.setItem("mo-theme", next); } catch (e) { /* private window: the toggle still works for this page */ } + redraw.forEach(function (f) { f(); }); + }; + + // ── Search ────────────────────────────────────────────────────────────── + // The built-in index ships in explorer-data.js and works from file://. When the site has been + // indexed with Pagefind (`npx pagefind --site `) and is served over http, Pagefind's + // full-text index answers instead. + var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; + function loadPagefind() { + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + pagefindTried = true; + // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every + // result URL carry the path the site is served under (a sub-path included). + var url = new URL(ROOT + "pagefind/pagefind.js", location.href).href; + return fetch(url, { method: "HEAD" }).then(function (r) { + if (!r.ok) return null; + return import(url).then(function (m) { pagefind = m; return m; }); + }).catch(function () { return null; }); + } + function show(items) { + sel = -1; + res.innerHTML = items.length ? items.map(function (x) { return '' + esc(x.t) + "" + esc(x.s) + ""; }).join("") : '
    No match
    '; + res.style.display = "block"; + } + function builtIn(v) { + var words = v.split(/\s+/).filter(Boolean); + return D.search.filter(function (x) { return words.every(function (w) { return x.k.indexOf(w) >= 0; }); }) + .sort(function (a, b) { return (a.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1) - (b.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1); }) + .slice(0, 25).map(function (x) { return { t: x.t, s: x.s, h: href(x.h) }; }); + } + if (q && res) { + q.addEventListener("input", function () { + var v = q.value.trim().toLowerCase(); + if (!v) { res.style.display = "none"; return; } + show(builtIn(v)); + loadPagefind().then(function (pf) { + if (!pf || q.value.trim().toLowerCase() !== v) return; + pf.search(v).then(function (r) { + return Promise.all(r.results.slice(0, 12).map(function (x) { return x.data(); })); + }).then(function (rows) { + if (q.value.trim().toLowerCase() !== v || !rows.length) return; + show(rows.map(function (d) { return { t: (d.meta && d.meta.title) || d.url, s: (d.excerpt || "").replace(/<[^>]+>/g, ""), h: d.url }; })); + }).catch(function () { /* keep the built-in results */ }); + }); + }); + q.addEventListener("keydown", function (e) { + var links = res.querySelectorAll("a"); + if (e.key === "ArrowDown" || e.key === "ArrowUp") { + e.preventDefault(); + sel = Math.max(0, Math.min(links.length - 1, sel + (e.key === "ArrowDown" ? 1 : -1))); + links.forEach(function (a, i) { a.classList.toggle("sel", i === sel); }); + } else if (e.key === "Enter" && links.length) { + location.href = links[Math.max(0, sel)].href; + } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } + }); + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { + if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } + }); + } + + if (typeof window.cytoscape !== "function") { + document.querySelectorAll(".graph").forEach(function (g) { + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; + }); + return; + } + + // ── Colours ───────────────────────────────────────────────────────────── + // Fill: the kind, the feature, or the DECLARED status of the claims on a node. + // Ring: a gate verdict (unclaimed). Never a test result. + function kindColour(n) { + return css({ entity: "--entity", value: "--value", prompt: "--prompt", template: "--prompt", projection: "--projection", report: "--report" }[n.kind] || "--entity"); + } + function fill(n, mode) { + if (n.abstract) return css("--retired"); + if (mode === "kind") return kindColour(n); + if (mode === "api") return n.api.length ? css("--accent") : css("--retired-soft"); + if (mode === "claims") return n.claims > 8 ? css("--live") : n.claims > 2 ? css("--partial") : n.claims > 0 ? css("--planned") : css("--retired-soft"); + if (mode === "cap") return n.feature >= 0 ? PAL[n.feature % PAL.length] : n.quality ? css("--retired") : css("--retired-soft"); + return n.status === "unclaimed" ? css("--retired-soft") : css("--" + n.status); + } + function legend(mode) { + var ring = D.hasClaims ? 'red ring: unclaimed (gate)' : ""; + if (mode === "cap") return '
    ' + D.features.map(function (f, i) { return '● ' + esc(f.label) + ""; }).join("") + '● qualities only○ no claim' + ring + "Fill is the feature (L1) with the most claims on the node; size is fields plus claims.
    "; + if (mode === "status") return '
    ' + STATUS.map(function (s) { return '' + GLYPH[s] + " " + s + ""; }).join("") + '○ no claim' + ring + "Fill is the best declared status among the requirements that claim the node.
    "; + if (mode === "api") return '
    ● mounted routes○ none
    '; + if (mode === "claims") return '
    ● more than 8 claims● 3 to 8● 1 or 2○ none' + ring + "
    "; + return '
    ' + ["entity", "value", "projection", "report", "prompt"].map(function (k) { return '● ' + k + ""; }).join("") + "Abstract bases are dashed and grey.
    "; + } + function shape(n) { return n.kind === "prompt" || n.kind === "template" ? "diamond" : n.kind === "value" ? "round-triangle" : n.kind === "projection" || n.kind === "report" ? "round-hexagon" : n.abstract ? "round-rectangle" : "ellipse"; } + function baseStyle() { + return [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", width: "data(size)", height: "data(size)", shape: "data(shape)", color: css("--ink"), "font-size": 10, "text-valign": "bottom", "text-margin-y": 3, "border-width": 1, "border-color": css("--line"), "text-wrap": "none" } }, + { selector: "node[dashed = 1]", style: { "border-style": "dashed", "border-width": 2, "background-opacity": 0.4 } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[faded = 1]", style: { opacity: 0.18 } }, + { selector: "edge", style: { width: 1.2, "line-color": css("--muted"), "target-arrow-color": css("--muted"), "target-arrow-shape": "triangle", "curve-style": "bezier", "arrow-scale": 0.7, opacity: 0.6 } }, + { selector: "edge[ext = 1]", style: { "line-style": "dashed", "target-arrow-shape": "triangle-tee" } }, + { selector: "edge[faded = 1]", style: { opacity: 0.08 } }, + { selector: ":selected", style: { "border-width": 3, "border-color": css("--accent") } }, + ]; + } + var bar = function (c) { + var t = STATUS.reduce(function (a, s) { return a + (c[s] || 0); }, 0); + if (!t) return '
    '; + return '
    ' + STATUS.filter(function (s) { return c[s]; }).map(function (s) { return ''; }).join("") + "
    "; + }; + var chip = function (s) { return s ? '' + (GLYPH[s] || "") + " " + esc(s) + "" : ""; }; + var nodeLink = function (id) { var n = byId[id]; return n ? '' + esc(n.name) + "" : esc(id); }; + + // ── S2: the model map ─────────────────────────────────────────────────── + // cose from a grid (not from one point) gives the same picture on every load. + var COSE = { name: "cose", animate: false, randomize: false, nodeRepulsion: 12000, nodeOverlap: 24, idealEdgeLength: 90, componentSpacing: 90, gravity: 0.6, padding: 24, nodeDimensionsIncludeLabels: true }; + function seedGrid(els) { + var nodes = els.filter(function (e) { return !e.data.source; }), cols = Math.ceil(Math.sqrt(nodes.length || 1)); + nodes.forEach(function (e, i) { e.position = { x: (i % cols) * 120, y: Math.floor(i / cols) * 100 }; }); + } + var cyEl = $("#cy"); + if (cyEl) { + var cy = null; + var params = new URLSearchParams(query()); + var sliceSel = $("#slice"), colourSel = $("#colour"); + if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); + if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); + var focus = params.get("focus"); + var promptSet = function () { + var s = {}; + D.nodes.forEach(function (n) { if (n.kind === "prompt" || n.kind === "template") s[n.id] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && (e.k === "payloadRef" || e.k === "responseRef")) s[e.t] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && byId[e.s] && byId[e.s].kind === "value" && e.k === "objectRef") s[e.t] = 1; }); + return s; + }; + var build = function (relayout) { + var slice = sliceSel.value, mode = colourSel.value, hide = $("#hideOut").checked, showExt = $("#showExt").checked; + $("#maplegend").innerHTML = legend(mode); + var inSlice = null; + if (slice === "@prompts") inSlice = promptSet(); + else if (slice && D.slices[slice]) { inSlice = {}; D.slices[slice].forEach(function (id) { inSlice[id] = 1; }); } + var showVals = $("#showValues").checked || slice === "@prompts" || (inSlice && Object.keys(inSlice).some(function (id) { return byId[id] && byId[id].kind !== "entity"; })); + var entityCount = D.nodes.filter(function (n) { return n.kind === "entity"; }).length; + if (!entityCount) showVals = true; + var nodes = D.nodes.filter(function (n) { return (n.kind === "entity" || showVals) && (!hide || !inSlice || inSlice[n.id]); }); + var ids = {}; + nodes.forEach(function (n) { ids[n.id] = 1; }); + var els = nodes.map(function (n) { + return { data: { id: n.id, label: n.name, col: fill(n, mode), size: 18 + Math.min(40, n.fields * 1.6 + n.claims * 2), shape: shape(n), faded: inSlice && !inSlice[n.id] ? 1 : 0, dashed: n.abstract, ring: n.unclaimed } }; + }); + D.edges.forEach(function (e, i) { + if (!ids[e.s] || !ids[e.t] || (!showExt && e.k === "extends")) return; + els.push({ data: { id: "e" + i, source: e.s, target: e.t, label: e.v || e.k, ext: e.k === "extends" ? 1 : 0, faded: inSlice && !(inSlice[e.s] && inSlice[e.t]) ? 1 : 0 } }); + }); + seedGrid(els); + var pan = cy && !relayout ? { pos: {} } : null; + if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); + if (cy) cy.destroy(); + var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); + cy = graph({ + container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), + layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, + }); + cy.on("tap", "node", function (ev) { showPanel(ev.target.id()); }); + cy.on("dbltap", "node", function (ev) { var n = byId[ev.target.id()]; if (n) location.href = href(n.href); }); + var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; + if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); + if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); + }; + ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); + $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; + redraw.push(function () { build(false); }); + build(true); + } + function slicePanel(r, nodes) { + return '
    Slice

    ' + (r.level ? "L" + r.level : "—") + '' + esc(r.label) + " " + chip(r.status) + "

    " + esc(r.statement) + "
    " + + "

    " + r.claimed + " model node" + (r.claimed === 1 ? "" : "s") + " claimed below

    " + nodes.map(nodeLink).join(", ") + + "

    Status below

    " + bar(r.rollup); + } + function showPanel(id) { + var n = byId[id], p = $("#panel"); + if (!n || !p) return; + var claims = D.reqs.filter(function (r) { return r.targets.indexOf(id) >= 0; }); + var byTop = {}; + claims.forEach(function (r) { var t = r; while (t.parent && reqById[t.parent]) t = reqById[t.parent]; (byTop[t.id] = byTop[t.id] || []).push(r); }); + var refs = D.edges.filter(function (e) { return e.s === id || e.t === id; }).length; + var gen = (D.generated[id] || []).map(function (g) { return '' + esc(g[0]) + " " + g[1]; }).join(" · "); + p.innerHTML = '
    ' + esc(n.pkg) + " · " + esc(n.kind) + (n.storage ? " · " + esc(n.storage) : "") + "
    " + + '

    ' + nodeLink(id) + (n.unclaimed ? ' unclaimed' : "") + "

    " + + "

    Why it exists (" + claims.length + " claim" + (claims.length === 1 ? "" : "s") + ")

    " + + (claims.length ? Object.keys(byTop).map(function (t) { + return "
    " + esc(reqById[t].label) + ": " + byTop[t].slice(0, 6).map(function (r) { return '' + (GLYPH[r.status] || "") + " " + esc(r.label) + ""; }).join(", ") + (byTop[t].length > 6 ? " +" + (byTop[t].length - 6) : "") + "
    "; + }).join("") : 'No requirement claims this node.') + + "

    Shape

    " + n.fields + " field" + (n.fields === 1 ? "" : "s") + ", " + refs + " reference" + (refs === 1 ? "" : "s") + + (n.api.length ? "

    API

    " + n.api.map(function (a) { return "
    " + esc(a) + "
    "; }).join("") : "") + + "

    Generated

    " + (gen || 'nothing traced'); + } + + // ── S3: the one-hop mini-map ──────────────────────────────────────────── + var mini = $("#cymini"); + if (mini) { + var me = mini.getAttribute("data-node"); + var drawMini = function () { + var es = D.edges.filter(function (e) { return e.s === me || e.t === me; }); + var ids = {}; + ids[me] = 1; + es.forEach(function (e) { ids[e.s] = 1; ids[e.t] = 1; }); + var els = Object.keys(ids).filter(function (id) { return byId[id]; }).sort().map(function (id) { + var n = byId[id]; + return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; + }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); + mini.innerHTML = ""; + var c = graph({ + container: mini, elements: els, maxZoom: 1.3, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[me = 1]", style: { width: 30, height: 30, "border-width": 3, "border-color": css("--accent") } }, + { selector: "edge", style: { width: 1, label: "data(label)", "font-size": 8, color: css("--muted"), "line-color": css("--muted"), "target-arrow-shape": "triangle", "target-arrow-color": css("--muted"), "curve-style": "bezier", "text-rotation": "autorotate", "text-background-color": css("--panel"), "text-background-opacity": 1, "text-background-padding": 2 } }, + ], + layout: { name: "concentric", concentric: function (n) { return n.data("me") ? 2 : 1; }, levelWidth: function () { return 1; }, startAngle: Math.PI, padding: 30, minNodeSpacing: 60 }, + }); + c.on("tap", "node", function (ev) { var n = byId[ev.target.id()]; if (n && n.id !== me) location.href = href(n.href); }); + }; + redraw.push(drawMini); + drawMini(); + } + + // ── S8: the trace ─────────────────────────────────────────────────────── + var tr = $("#cytrace"), tstart = $("#tstart"); + if (tr && tstart) { + var p2 = new URLSearchParams(query()).get("start"); + if (p2 && reqById[p2]) tstart.value = p2; + var drawTrace = function () { + var r0 = reqById[tstart.value]; + if (!r0) return; + var kids = {}; + D.reqs.forEach(function (r) { if (r.parent) (kids[r.parent] = kids[r.parent] || []).push(r); }); + var reqs = [], walk = function (r) { reqs.push(r); (kids[r.id] || []).forEach(walk); }; + walk(r0); + var cols = [[], [], [], []], els = [], seen = {}; + var add = function (id, label, col, data) { if (seen[id]) return; seen[id] = 1; cols[col].push(id); data.id = id; data.label = label; els.push({ data: data }); }; + reqs.forEach(function (r) { add("r:" + r.id, (r.level ? "L" + r.level + " " : "") + r.label, r.level >= 4 ? 1 : 0, { col: r.status ? css("--" + r.status) : css("--muted"), shape: "round-rectangle", go: r.href }); }); + reqs.forEach(function (r) { if (r.parent && seen["r:" + r.parent]) els.push({ data: { id: "pe:" + r.id, source: "r:" + r.parent, target: "r:" + r.id } }); }); + reqs.forEach(function (r) { + r.targets.forEach(function (t) { + var n = byId[t]; + if (!n) return; + add("o:" + t, n.name, 2, { col: kindColour(n), shape: shape(n), go: n.href, ring: n.unclaimed }); + if (!seen["le:" + r.id + ">" + t]) { seen["le:" + r.id + ">" + t] = 1; els.push({ data: { id: "le:" + r.id + ">" + t, source: "r:" + r.id, target: "o:" + t, col: r.status ? css("--" + r.status) : css("--muted") } }); } + }); + }); + cols[2].slice().forEach(function (oid) { + var id = oid.slice(2); + var gen = D.generated[id] || []; + if (!gen.length) return; + var total = gen.reduce(function (a, g) { return a + g[1]; }, 0); + var gid = "g:" + id; + add(gid, total + " generated (" + gen.map(function (g) { return g[0]; }).join(", ") + ")", 3, { col: css("--accent"), shape: "tag", go: byId[id].href }); + els.push({ data: { id: "ge:" + gid, source: oid, target: gid } }); + }); + var pos = {}; + cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); + tr.innerHTML = ""; + var c = graph({ + container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, + { selector: "node[ring = 1]", style: { "border-width": 2, "border-color": css("--bad") } }, + { selector: "edge", style: { width: 1, "line-color": "data(col)", opacity: 0.5, "curve-style": "unbundled-bezier" } }, + { selector: "edge[!col]", style: { "line-color": css("--muted") } }, + ], + layout: { name: "preset", positions: function (n) { return pos[n.id()]; }, fit: true, padding: 24 }, + }); + c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); + }; + tstart.onchange = function () { + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); + drawTrace(); + }; + redraw.push(drawTrace); + drawTrace(); + } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); +})(); diff --git a/server/csharp/MetaObjects.Codegen/ExplorerApp/index.html b/server/csharp/MetaObjects.Codegen/ExplorerApp/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/server/csharp/MetaObjects.Codegen/ExplorerApp/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/cytoscape.min.js b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/cytoscape.min.js new file mode 100644 index 0000000000..ff0d7c1796 --- /dev/null +++ b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2024, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}var u="undefined"==typeof window?null:window,c=u?u.navigator:null;u&&u.document;var d=e(""),h=e({}),p=e((function(){})),f="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),g=function(e){return e&&e.instanceString&&y(e.instanceString)?e.instanceString():null},v=function(t){return null!=t&&e(t)==d},y=function(t){return null!=t&&e(t)===p},m=function(e){return!E(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},b=function(t){return null!=t&&e(t)===h&&!m(t)&&t.constructor===Object},x=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},w=function(e){return"undefined"===f?void 0:null!=e&&e instanceof HTMLElement},E=function(e){return k(e)||C(e)},k=function(e){return"collection"===g(e)&&e._private.single},C=function(e){return"collection"===g(e)&&!e._private.single},S=function(e){return"core"===g(e)},P=function(e){return"stylesheet"===g(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},T=function(t){return function(t){return null!=t&&e(t)===h}(t)&&y(t.then)},_=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},L=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},R={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},V=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=H();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?ge(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=H(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=pe(t)||0,j(n)&&(c=!!n.leading,a=(d="maxWait"in n)?fe(pe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(H())},m},ye=u?u.performance:null,me=ye&&ye.now?function(){return ye.now()}:function(){return Date.now()},be=function(){if(u){if(u.requestAnimationFrame)return function(e){u.requestAnimationFrame(e)};if(u.mozRequestAnimationFrame)return function(e){u.mozRequestAnimationFrame(e)};if(u.webkitRequestAnimationFrame)return function(e){u.webkitRequestAnimationFrame(e)};if(u.msRequestAnimationFrame)return function(e){u.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(me())}),1e3/60)}}(),xe=function(e){return be(e)},we=me,Ee=65599,ke=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*Ee+t.value|0;return r},Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*Ee+e|0},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},Pe=function(e){return 2097152*e[0]+e[1]},De=function(e,t){return[Ce(e[0],t[0]),Se(e[1],t[1])]},Te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return ke({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ge=function(e){e.splice(0,e.length)},Ue=function(e,t,n){return n&&(t=N(n,t)),e[t]},Ze=function(e,t,n,r){n&&(t=N(n,t)),e[t]=r},$e="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Qe=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Je,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];m(t.classes)?l=t.classes:v(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=m.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},ot={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!i){var T=S*u+C;!i&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},pt=Math.sqrt(2),ft=function(e,t,n){0===n.length&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=ft(i,e,t),n--}return t},vt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/pt);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},kt=function(e,t){return Math.sqrt(Ct(e,t))},Ct=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},St=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Mt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Bt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},It=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},At=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ot=function(e,t){return Lt(e,t.x1,t.y1)&&Lt(e,t.x2,t.y2)},Rt=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,d=i/2,h=a/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=n-d+c-o,v=r-h-o,y=n+d-c+o,m=v;if((s=Zt(e,t,n,r,g,v,y,m,!1)).length>0)return s}if(f){var b=n+d+o,x=r-h+c-o,w=b,E=r+h-c+o;if((s=Zt(e,t,n,r,b,x,w,E,!1)).length>0)return s}if(p){var k=n-d+c-o,C=r+h+o,S=n+d-c+o,P=C;if((s=Zt(e,t,n,r,k,C,S,P,!1)).length>0)return s}if(f){var D=n-d-o,T=r-h+c-o,_=D,M=r+h-c+o;if((s=Zt(e,t,n,r,D,T,_,M,!1)).length>0)return s}var B=n-d+c,N=r-h+c;if((l=Gt(e,t,n,r,B,N,c+o)).length>0&&l[0]<=B&&l[1]<=N)return[l[0],l[1]];var z=n+d-c,I=r-h+c;if((l=Gt(e,t,n,r,z,I,c+o)).length>0&&l[0]>=z&&l[1]<=I)return[l[0],l[1]];var A=n+d-c,L=r+h-c;if((l=Gt(e,t,n,r,A,L,c+o)).length>0&&l[0]>=A&&l[1]>=L)return[l[0],l[1]];var O=n-d+c,R=r+h-c;return(l=Gt(e,t,n,r,O,R,c+o)).length>0&&l[0]<=O&&l[1]>=R?[l[0],l[1]]:[]},Vt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ft=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},jt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Yt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Xt=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Ht(c,-l);d=Wt(g)}else d=c;return Yt(e,t,d)},Wt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ut=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Zt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Ut(e,n,o)===o?[o,s]:Ut(e,n,i)===i?[i,a]:Ut(i,o,n)===n?[n,r]:[]:[]},$t=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Ht(g,-s);u=Wt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Cn,o=r,s=0;s=2?Mn(e,t,n,0,Dn,Tn):Mn(e,t,n,0,Pn)},squaredEuclidean:function(e,t,n){return Mn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Mn(e,t,n,0,Pn)},max:function(e,t,n){return Mn(e,t,n,-1/0,_n)}};function Nn(e,t,n,r,i,a){var o;return o=y(e)?e:Bn[e]||Bn.euclidean,0===t&&y(e)?o(i,a):o(t,n,r,i,a)}Bn["squared-euclidean"]=Bn.squaredEuclidean,Bn.squaredeuclidean=Bn.squaredEuclidean;var zn=He({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),In=function(e){return zn(e)},An=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Nn(e,r.length,a,(function(e){return r[e](t)}),o,s)},Ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},jn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=rr(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=rr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},lr=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},ur={};[nt,at,ot,lt,ct,ht,vt,sn,un,dn,pn,kn,Kn,Jn,ar,{hierholzer:function(e){if(!b(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=or(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=v(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=p(i);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var y in f.unshift(l.getElementById(g.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:sr,htbc:sr,htb:sr,hopcroftTarjanBiconnectedComponents:sr},{tarjanStronglyConnected:lr,tsc:lr,tscc:lr,tarjanStronglyConnectedComponents:lr}].forEach((function(e){L(ur,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var cr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};cr.prototype={fulfill:function(e){return dr(this,1,"fulfillValue",e)},reject:function(e){return dr(this,2,"rejectReason",e)},then:function(e,t){var n=new cr;return this.onFulfilled.push(fr(e,n,"fulfill")),this.onRejected.push(fr(t,n,"reject")),hr(this),n.proxy}};var dr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,hr(e)),e},hr=function(e){1===e.state?pr(e,"onFulfilled",e.fulfillValue):2===e.state&&pr(e,"onRejected",e.rejectReason)},pr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1};var ri=function(e,t){var n=this.__data__,r=Qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ii(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){m(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};qi.className=qi.classNames=qi.classes;var Yi={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:I,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yi.variable="(?:[\\w-.]|(?:\\\\"+Yi.metaChar+"))+",Yi.className="(?:[\\w-]|(?:\\\\"+Yi.metaChar+"))+",Yi.value=Yi.string+"|"+Yi.number,Yi.id=Yi.variable,function(){var e,t,n;for(e=Yi.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Yi.comparatorOp+="|\\!"+t)}();var Xi=0,Wi=1,Hi=2,Ki=3,Gi=4,Ui=5,Zi=6,$i=7,Qi=8,Ji=9,ea=10,ta=11,na=12,ra=13,ia=14,aa=15,oa=16,sa=17,la=18,ua=19,ca=20,da=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*A(e,t)}(e.selector,t.selector)})),ha=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return je("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return je("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&je("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return v(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Xi:var l=e(s);return l.substring(0,l.length-1);case Ki:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ui:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Gi:return"["+r.field+"]";case Zi:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case $i:return s;case Qi:return"#"+s;case Ji:return"."+s;case sa:case aa:return i(r.parent,a)+n(">")+i(r.child,a);case la:case oa:return i(r.ancestor,a)+" "+i(r.descendant,a);case ua:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case ca:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ba(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Ba)},_a.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Na)},_a.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,za)},_a.ancestors=_a.parents,(Pa=Da={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pa.data,Pa.removeAttr=Pa.removeData;var Ia,Aa,La=Da,Oa={};function Ra(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:Va("indegree",(function(e,t){return et})),minOutdegree:Va("outdegree",(function(e,t){return et}))}),L(Oa,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,y=g;g&&(f=f[0]);var m=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+m[e]):void 0!==i&&p.position({x:i.x+m.x,y:i.y+m.y})}}else if(!a)return;return this}}).modelPosition=Ia.point=Ia.position,Ia.modelPositions=Ia.points=Ia.positions,Ia.renderedPoint=Ia.renderedPosition,Ia.relativePoint=Ia.relativePosition;var qa,Ya,Xa=Aa;qa=Ya={},Ya.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Ya.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Ya.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ka=function(e,t){return null==t?e:Ha(e,t.x1,t.y1,t.x2,t.y2)},Ga=function(e,t,n){return Ue(e,t,n)},Ua=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Nt(u,1),Ha(e,u.x1,u.y1,u.x2,u.y2)}}},Za=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Ga(a,"labelWidth",n),p=Ga(a,"labelHeight",n),f=Ga(a,"labelX",n),g=Ga(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=i.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?Ga(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,Ha(e,o,l,s,u),Ha(i.labelBounds.all,o,l,s,u)}return e}},$a=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=_t(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;Ha(h,n=o-S,i=s-P,r=o+S,a=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,i,a=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(a>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(zt(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,i=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+i,y2:n.y2+i,w:n.w,h:n.h});Mt(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),Ha(h,n-=k,i-=k,r+=k,a+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,i=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(i>(a=T[1].y)){var M=i;i=a,a=M}Ha(h,n-k,i-k,r+k,a+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((i=I.y)>(a=A.y)){var O=i;i=a,a=O}Ha(h,n-=k,i-=k,r+=k,a+=k)}if(c&&t.includeEdges&&g&&(Ua(h,e,"mid-source"),Ua(h,e,"mid-target"),Ua(h,e,"source"),Ua(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Ha(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};It(F,h),zt(F,y),Nt(F,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ha(h,n-E,i-E,r+E,a+E));var j=p.overlayBounds=p.overlayBounds||{};It(j,h),zt(j,y),Nt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=_t(),c&&t.includeLabels&&(t.includeMainLabels&&Za(h,e,null),g&&(t.includeSourceLabels&&Za(h,e,"source"),t.includeTargetLabels&&Za(h,e,"target")))}return h.x1=Wa(h.x1),h.y1=Wa(h.y1),h.x2=Wa(h.x2),h.y2=Wa(h.y2),h.w=Wa(h.x2-h.x1),h.h=Wa(h.y2-h.y1),h.w>0&&h.h>0&&b&&(zt(h,y),Nt(h,1)),h},Qa=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:bo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},wo.removeAllListeners=function(){return this.removeListener("*")},wo.emit=wo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,m(t)||(t=[t]),Co(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&v(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(b(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(v(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Go.neighbourhood=Go.neighborhood,Go.closedNeighbourhood=Go.closedNeighborhood,Go.openNeighbourhood=Go.openNeighborhood,L(Go,{source:Ta((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ta((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Qo({attr:"source"}),targets:Qo({attr:"target"})}),L(Go,{edgesWith:Ta(Jo(),"edgesWith"),edgesTo:Ta(Jo({thisIsSrc:!0}),"edgesTo")}),L(Go,{connectedEdges:Ta((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Go.componentsOf=Go.components;var ts=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $e,a=!1;if(t){if(t.length>0&&b(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new Je,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new ts(a,e),V=0;V0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var T=0;T1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),as=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},os={linear:function(e,t,n){return e+(t-e)*n},ease:as(.25,.1,.25,1),"ease-in":as(.42,0,1,1),"ease-out":as(0,0,.58,1),"ease-in-out":as(.42,0,.58,1),"ease-in-sine":as(.47,0,.745,.715),"ease-out-sine":as(.39,.575,.565,1),"ease-in-out-sine":as(.445,.05,.55,.95),"ease-in-quad":as(.55,.085,.68,.53),"ease-out-quad":as(.25,.46,.45,.94),"ease-in-out-quad":as(.455,.03,.515,.955),"ease-in-cubic":as(.55,.055,.675,.19),"ease-out-cubic":as(.215,.61,.355,1),"ease-in-out-cubic":as(.645,.045,.355,1),"ease-in-quart":as(.895,.03,.685,.22),"ease-out-quart":as(.165,.84,.44,1),"ease-in-out-quart":as(.77,0,.175,1),"ease-in-quint":as(.755,.05,.855,.06),"ease-out-quint":as(.23,1,.32,1),"ease-in-out-quint":as(.86,0,.07,1),"ease-in-expo":as(.95,.05,.795,.035),"ease-out-expo":as(.19,1,.22,1),"ease-in-out-expo":as(1,0,0,1),"ease-in-circ":as(.6,.04,.98,.335),"ease-out-circ":as(.075,.82,.165,1),"ease-in-out-circ":as(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return os.linear;var r=is(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":as};function ss(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function ls(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function us(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=ls(e,i),s=ls(t,i);if(x(o)&&x(s))return ss(a,o,s,n,r);if(m(o)&&m(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=os[d].apply(null,h)):o.easingImpl=os[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};ds(g.x,y.x)&&(m.x=us(g.x,y.x,p,f)),ds(g.y,y.y)&&(m.y=us(g.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ds(b.x,x.x)&&(w.x=us(b.x,x.x,p,f)),ds(b.y,x.y)&&(w.y=us(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ds(k,C)&&(a.zoom=Tt(a.minZoom,us(k,C,p,f),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||hs(0,d,e),cs(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var fs={animate:Fi.animate(),animation:Fi.animation(),animated:Fi.animated(),clearQueue:Fi.clearQueue(),delay:Fi.delay(),delayAnimation:Fi.delayAnimation(),stop:Fi.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ps(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&xe((function(n){ps(n,e),t()}))}()}}},gs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},vs=function(e){return v(e)?new ka(e):e},ys={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new xo(gs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,vs(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,vs(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,vs(t),n),this},once:function(e,t,n){return this.emitter().one(e,vs(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fi.eventAliasesOn(ys);var ms={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ms.jpeg=ms.jpg;var bs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=v(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(L({},e,{cy:this,eles:r}));return i}Ve("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ve("A `name` must be specified to make a layout");else Ve("Layout options must be specified to make a layout")}};bs.createLayout=bs.makeLayout=bs.layout;var xs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Es.invalidateDimensions=Es.resize;var ks={collection:function(e,t){return v(e)?this.$(e):E(e)?e.collection():m(e)?(t||(t={}),new ts(this,e,t.unique,t.removed)):new ts(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ks.elements=ks.filter=ks.$;var Cs={};Cs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],P=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],_=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(P-S)*g),Math.round(D+(T-D)*g)];n={bypass:i.bypass,name:i.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,z=0;z0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ss={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){je("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new ka(l).invalid){je("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){je("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(je("Skipping property: Invalid property definition in: "+r),o());else je("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var p=this.parse(e,u[4]);if(!p||p.mapped)return!1;var f=this.parse(e,u[5]);if(!f||f.mapped)return!1;if(p.pfValue===f.pfValue||p.strValue===f.strValue)return je("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var g=p.value,b=f.value;if(!(g[0]!==b[0]||g[1]!==b[1]||g[2]!==b[2]||g[3]!==b[3]&&(null!=g[3]&&1!==g[3]||null!=b[3]&&1!==b[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:p.value,valueMax:f.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):m(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",P=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&P?1===E.length&&v(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var _,B,N=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var V={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?V.pfValue=t:V.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(V.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(V.pfValue="rad"===z?t:(_=t,Math.PI*_/180)),"%"===z&&(V.pfValue=t/100),V}if(c.propList){var F=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),x(e)?n=e:b(e)&&(n=e.level,null!=e.position?t=yt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;x(l.x)&&(t.pan.x=l.x,o=!1),x(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(v(e)){var n=e;e=this.mutableElements().filter(n)}else E(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};As.centre=As.center,As.autolockNodes=As.autolock,As.autoungrabifyNodes=As.autoungrabify;var Ls={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ls.attr=Ls.data,Ls.removeAttr=Ls.removeData;var Os=function(e){var t=this,n=(e=L({},e)).container;n&&!w(n)&&w(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==u&&void 0!==n&&!e.headless,o=e;o.layout=L({name:a?"grid":"null"},o.layout),o.renderer=L({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ts(this),listeners:[],aniEles:new ts(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:x(o.zoom)?o.zoom:1,pan:{x:b(o.pan)&&x(o.pan.x)?o.pan.x:0,y:b(o.pan)&&x(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var c=L({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(T))return vr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(b(e)||m(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=L({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,y(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(E(n.roots))e=n.roots;else if(m(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){je("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var L=0;L0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*i;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ws(e){this.options=L({},Xs,e)}Ws.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Hs,Ks={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gs(e){this.options=L({},Ks,e)}Gs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(rl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),xe(t)):(gl(r,e),s())}()}else{for(;u;)u=o(l),l++;gl(r,e),s()}return this},Zs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Zs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var $s=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},Js=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=ll(e,i,a),d=ll(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},sl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ll=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},ul=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},dl=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},fl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yl(e){this.options=L({},vl,e)}yl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=qt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=jt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ue(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Yt(e,t,T))return v(n),!0}else if(Lt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=_t({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-a.ang):Math.PI+a.ang),Zl(t,n,Ul),zl=Gl.nx*Ul.ny-Gl.ny*Ul.nx,Il=Gl.nx*Ul.nx-Gl.ny*-Ul.ny,Ol=Math.asin(Math.max(-1,Math.min(1,zl))),Math.abs(Ol)<1e-6)return Bl=t.x,Nl=t.y,void(Vl=jl=0);Al=1,Ll=!1,Il<0?Ol<0?Ol=Math.PI+Ol:(Ol=Math.PI-Ol,Al=-1,Ll=!0):Ol>0&&(Al=-1,Ll=!0),jl=void 0!==t.radius?t.radius:r,Rl=Ol/2,ql=Math.min(Gl.len/2,Ul.len/2),i?(Fl=Math.abs(Math.cos(Rl)*jl/Math.sin(Rl)))>ql?(Fl=ql,Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))):Vl=jl:(Fl=Math.min(ql,jl),Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))),Wl=t.x+Ul.nx*Fl,Hl=t.y+Ul.ny*Fl,Bl=Wl-Ul.ny*Vl*Al,Nl=Hl+Ul.nx*Vl*Al,Yl=t.x+Gl.nx*Fl,Xl=t.y+Gl.ny*Fl,Kl=t};function Ql(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Jl(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($l(e,t,n,r,i),{cx:Bl,cy:Nl,radius:Vl,startX:Yl,startY:Xl,stopX:Wl,stopY:Hl,startAngle:Gl.ang+Math.PI/2*Al,endAngle:Ul.ang-Math.PI/2*Al,counterClockwise:Ll})}var eu={};function tu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var C,S="vertical"===u,P=S?E:w,D=S?b:m,T=Et(D),_=!1;(k&&(h||f)||!("downward"===c&&D<0||"upward"===c&&D>0||"leftward"===c&&D>0||"rightward"===c&&D<0)||(P=(T*=-1)*Math.abs(P),_=!0),h)?C=(p<0?1+p:p)*P:C=(p<0?P:0)+p*T;var M=function(e){return Math.abs(e)=Math.abs(P)},B=M(C),N=M(Math.abs(P)-Math.abs(C));if((B||N)&&!_)if(S){var z=Math.abs(D)<=a/2,I=Math.abs(m)<=o/2;if(z){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(I){var R=(r.y1+r.y2)/2,V=r.x1,F=r.x2;n.segpts=[V,R,F,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(D)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(S){var U=r.y1+C+(l?a/2*T:0),Z=r.x1,$=r.x2;n.segpts=[Z,U,$,U]}else{var Q=r.x1+C+(l?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}if(n.isRound){var te=e.pstyle("taxi-radius").value,ne="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(te),n.isArcRadius=new Array(n.segpts.length/2).fill(ne)}},eu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!x(n.startX)||!x(n.startY),v=!x(n.arrowStartX)||!x(n.arrowStartY),y=!x(n.endX)||!x(n.endY),m=!x(n.arrowEndX)||!x(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=kt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Ct(H,bt(t)),G=Ct(H,bt(W)),U=K;if(G2)Ct(H,{x:W[2],y:W[3]})0){var le=c,ue=Ct(le,bt(t)),ce=Ct(le,bt(se)),de=ue;if(ce2)Ct(le,{x:se[2],y:se[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=Tt(0,C,1),t=Dt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=Tt(0,r-.001,1),a=Tt(0,r+.001,1),o=Dt(e,t,n,i),s=Dt(e,t,n,a);return su(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,P,D,T,_=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-P)/S;N=Tt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=kt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(D,T,N),l=su(D,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},au.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},au.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ue(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ze(n.rstyle,"labelWidth",t,d),Ze(n.rscratch,"labelWidth",t,d),Ze(n.rstyle,"labelHeight",t,h),Ze(n.rscratch,"labelHeight",t,h),Ze(n.rscratch,"labelLineHeight",t,c)},au.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ze(n.rscratch,e,t,r),r):Ue(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=l(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,i).widthD)break;T+=i[M],M===i.length-1&&(_=!0)}return _||(T+="…"),T}return i},au.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},au.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=Te(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:b[0]*s,y:b[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var z={x:0,y:0};if(x(b[0])&&x(b[1])&&(z.x+=b[0],z.y+=b[1],N)){var I=e.hoverData.dragDelta;I&&x(I[0])&&x(I[1])&&(z.x+=I[0],z.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=bt(h),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=i(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),b=!1,t.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(i,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(i,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Rt(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(Xt(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Xt(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Yt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Kt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Kt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},gu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Jt(3,0)),this.generateRoundPolygon("round-triangle",Jt(3,0)),this.generatePolygon("rectangle",Jt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Jt(5,0)),this.generateRoundPolygon("round-pentagon",Jt(5,0)),this.generatePolygon("hexagon",Jt(6,0)),this.generateRoundPolygon("round-hexagon",Jt(6,0)),this.generatePolygon("heptagon",Jt(7,0)),this.generateRoundPolygon("round-heptagon",Jt(7,0)),this.generatePolygon("octagon",Jt(8,0)),this.generateRoundPolygon("round-octagon",Jt(8,0));var r=new Array(20),i=tn(5,0),a=tn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},wu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;t(this,e),this.idsByKey=new $e,this.keyForId=new $e,this.cachesByLvl=new $e,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Je,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new $e,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Eu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ku=He({getKey:null,doesEleInvalidateKey:Le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=ku(t);L(this,n),this.lookup=new wu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=Eu,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rt((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(wt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=a.getElement(e,t,n,D,Eu.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ke(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ke(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ge(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ke(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Eu.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=Ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Ke(this.onDequeues,e)},Su.setupDequeueing=xu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ke(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=_t();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!Ot(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=we(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=we(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ke(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},k=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},C=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var S="yes"===t.pstyle("ghost").value;if(S){var P=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(P,D),b(_),k(_),e.translate(-P,-D)}else x();E(),b(),k(),w(),C(),n&&e.translate(l.x1,l.y1)}}},Wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xu.drawEdgeOverlay=Wu("overlay"),Xu.drawEdgeUnderlay=Wu("underlay"),Xu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Ku.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(wt(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Ku.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ku.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ue(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ku.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ue(o,"labelX",n),d=Ue(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ue(o,"labelWidth",n),v=Ue(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),T=2;if(E>0||C>0&&k>0){var _=c-S;switch(x){case"left":_-=g;break;case"center":_-=g/2}var M=d-v-S,B=g+2*S,N=v+2*S;if(E>0){var z=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",D?Gu(e,_,M,B,N,T):e.fillRect(_,M,B,N),e.fillStyle=z}if(C>0&&k>0){var A=e.strokeStyle,L=e.lineWidth,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*s+")",e.lineWidth=C,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?Gu(e,_,M,B,N,T,"stroke"):e.strokeRect(_,M,B,N),"double"===R){var V=C/2;D?Gu(e,_+V,M+V,B-2*V,N-2*V,T,"stroke"):e.strokeRect(_+V,M+V,B-2*V,N-2*V)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=A}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var j=Ue(o,"labelWrapCachedLines",n),q=Ue(o,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-g:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=g))),w){case"top":d-=(j.length-1)*q;break;case"center":case"bottom":d-=(j.length-1)*q}for(var W=0;W0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=q}else F>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(x(d.x)&&x(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),k=0,C=0;C0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;l.colorStrokeStyle(e,F[0],F[1],F[2],t)},G=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=_e("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},U=t.pstyle("shape").strValue,Z=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var $=G(r,i,U,Z);h=$.path,v=$.cacheHit}var Q=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i,X,c)}g?e.fill(h):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i,X,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},ne=function(){if(_>0){if(e.lineWidth=_,e.lineCap=I,e.lineJoin=z,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=O;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===N){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var a=l.getNodeShape(t),o=_;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,u=(r+o+(V+Y))/r,c=(i+o+(V+Y))/i,h=r*u,p=i*c,f=l.nodeShapes[a].points;if(g)s=G(h,p,a,f).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+Y+V):"round-heptagon"===a?(v=1.075*(o+Y+V),m=-(o/2+Y+V)/35):"round-hexagon"===a?v=1.12*(o+Y+V):"round-pentagon"===a?(v=1.13*(o+Y+V),m=-(o/2+Y+V)/15):"round-tag"===a?(v=1.12*(o+Y+V),y=.07*(o/2+V+Y)):"round-triangle"===a&&(v=(o+Y+V)*(Math.PI/2),m=-(o+Y/2+V)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=h/2,x=p/2,w=(X="auto"===X?rn(h,p):X)+(o+V+Y)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Uu.drawNodeOverlay=Zu("overlay"),Uu.drawNodeUnderlay=Zu("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var $u={};$u.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},$u.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Qu={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},ac.png=function(e){return sc(e,this.bufferCanvasImage(e),"image/png")},ac.jpg=function(e){return sc(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},uc=dc,cc=dc.prototype;function dc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(cc.CANVAS_LAYERS),contexts:new Array(cc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cc.CANVAS_LAYERS),bufferCanvases:new Array(cc.BUFFER_COUNT),bufferContexts:new Array(cc.CANVAS_LAYERS)};t.data.canvasContainer=n.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};c&&c.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var o=0;o{var m2={"explorer-head.mustache":` + + + + +{{{pageTitle}}} · {{{siteTitle}}} + + + + + +
    + {{{siteTitle}}} model explorer + + + +
    +
    + +`,"explorer-foot.mustache":`
    +
    Built from explorer.json by the metaobjects docs-site generator{{#stamp}} · {{{stamp}}}{{/stamp}}. Static: no server, no LLM call.
    + +{{#needsGraph}}{{/needsGraph}} + + + +`,"explorer-card.mustache":`
    +

    {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}{{{verdictHtml}}}

    +
    {{{statement}}}
    +
    {{{barHtml}}}
    {{{countsLine}}}
    + {{#hasChildren}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{glyphHtml}}}
    • {{/children}}
    {{/hasChildren}} +
    Summary from the levels below
    No summary is generated in this build.
    +
    +`,"explorer-overview.html.mustache":`

    {{{heading}}}

    +
    Built from {{{sourcesLine}}}. Every number below is computed from the project's metadata or the gate's own output.
    +
    +{{#tiles}}
    {{{n}}}
    {{{l}}}
    +{{/tiles}}
    +{{#hasRequirements}}{{{legendHtml}}}{{/hasRequirements}} +{{#hasRequirements}} +

    Features requirement.functional, by level

    +{{#hasFeatures}}
    +{{#featureCards}}{{> card}}{{/featureCards}} +
    {{/hasFeatures}} +{{^hasFeatures}}
    No requirement.functional is declared.
    {{/hasFeatures}} +

    Qualities requirement.architectural, the non-functional policies

    +{{#hasQualities}}
    +{{#qualityCards}}{{> card}}{{/qualityCards}} +
    {{/hasQualities}} +{{^hasQualities}}
    No requirement.architectural is declared.
    {{/hasQualities}} +{{/hasRequirements}} +{{^hasRequirements}} +
    This model declares no requirements yet, so this page cannot say what each part is for. Declare requirement.functional entries (levels 1 to 3 for the problem, 4 and 5 naming the model) and this page opens on them, with every entity traced to the feature it serves.
    +{{/hasRequirements}} +

    Packages what the model holds

    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-map.html.mustache":`

    Model map

    +
    Entities and the references between them. A slice is the set of model nodes a requirement subtree claims, a package holds, or a prompt reads and returns.
    +
    + + + + + + +
    +
    Click a node to see why it exists, what it holds and what was generated from it. Double-click to open its page.
    +
    + +`,"explorer-object.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}{{#isReadOnly}}read-only view{{/isReadOnly}}{{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}} · {{{storageLine}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#projection}} +

    Read model

    +
    + {{#basesHtml}}
    Surfaces fields of {{{basesHtml}}}.
    {{/basesHtml}} + {{#hasOrigins}}
    {{#origins}}{{/origins}}
    FieldOriginDefinition
    {{{field}}}{{{origin}}}{{{definitionHtml}}}
    {{/hasOrigins}} +
    + {{/projection}} + {{#report}} +

    Report

    +
    + {{#fromHtml}}{{/fromHtml}} + {{#spineHtml}}{{/spineHtml}} + {{#dimensionsHtml}}{{/dimensionsHtml}} + {{#measuresHtml}}{{/measuresHtml}} + {{#segmentHtml}}{{/segmentHtml}} + {{#filterHtml}}{{/filterHtml}} +
    From{{{fromHtml}}}
    Spine{{{spineHtml}}}
    Dimensions{{{dimensionsHtml}}}
    Measures{{{measuresHtml}}}
    Segment{{{segmentHtml}}}
    Filter{{{filterHtml}}}
    + {{/report}} + {{#hasFields}}

    Fields

    +
    {{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{#fields}}{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{/fields}}
    FieldTypeColumnFlagsClaimed at L5
    {{{name}}} {{{inheritedHtml}}}{{{type}}}{{{refHtml}}}{{{valuesHtml}}}{{{column}}}{{{flagsHtml}}}{{{claimsHtml}}}
    {{/hasFields}} + {{#hasKeys}}

    Keys and references

    +
    {{#keys}}{{/keys}}
    {{{kind}}} {{{name}}} {{{inheritedHtml}}}{{{shape}}}{{{targetHtml}}}
    {{/hasKeys}} + {{#hasReporting}}

    Reporting vocabulary

    +
    {{#reporting}}{{/reporting}}
    NameKindDefinition
    {{{name}}}{{{kind}}}{{{definitionHtml}}}
    {{/hasReporting}} + {{#hasLayouts}}

    Screens declared

    {{#layouts}}
    {{{kind}}} {{{name}}}{{#detailHtml}}: {{{detailHtml}}}{{/detailHtml}}
    {{/layouts}}{{/hasLayouts}} +
    + +
    +`,"explorer-node.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#hasAttrs}}

    Attributes

    +
    {{#attrs}}{{/attrs}}
    @{{{name}}}{{{valueHtml}}}
    {{/hasAttrs}} + {{#hasMembers}}

    Members

    +
    + {{#members}} + {{/members}}
    NameTypeAttributes
    {{{nameHtml}}}{{#below}} +{{below}}{{/below}}{{{kind}}}{{{attrsHtml}}}
    {{/hasMembers}} +
    + +
    +`,"explorer-prompt.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{attrsHtml}}}
    +
    +
    +

    Payload: {{{payloadHtml}}}

    + {{#hasPayload}}
    {{#payloadRows}}{{/payloadRows}}
    FieldTypeUsed in text
    {{{name}}} {{{requiredHtml}}}{{{type}}}{{{refHtml}}}{{{usedHtml}}}
    {{/hasPayload}} + {{^hasPayload}}
    No payload: the text renders from nothing typed.
    {{/hasPayload}} +

    Reply: {{{replyHtml}}}

    + {{#hasReply}}
    {{#replyRows}}{{/replyRows}}
    FieldType
    {{{name}}}{{{type}}}{{{valuesHtml}}}
    {{/hasReply}} + {{^hasReply}}
    Outbound only: no reply parser.
    {{/hasReply}} +

    Why it exists

    + {{#hasWhy}}
    {{#whyRows}}{{/whyRows}}
    CapabilityRequirementLevelStatus
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} +
    +
    +

    Text {{{textMeta}}}

    + {{#hasText}}
    {{{textHtml}}}
    {{/hasText}} + {{^hasText}}
    The text {{{textRef}}} was not found beside the model, so this page cannot show it.
    {{/hasText}} +

    Generated

    + {{#hasGenerated}}{{#generated}}
    {{{generator}}}{{#files}}
    {{{.}}}
    {{/files}}
    {{/generated}}{{/hasGenerated}} + {{^hasGenerated}}
    {{{generatedNote}}}
    {{/hasGenerated}} +
    Proven today: meta verify --templates fails if the text names a variable the payload lacks. This page shows the other direction too: payload fields the text never uses.
    +
    +
    +`,"explorer-prompts.html.mustache":`

    Prompts

    +
    Each declared template, its typed payload, its reply type, and the requirements that claim it.
    +{{#hasRows}}
    +{{#rows}} +{{/rows}}
    TemplatePayloadReplyClaimed by
    {{{linkHtml}}} {{{kind}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{payloadHtml}}}{{{replyHtml}}}{{{claimsHtml}}}
    {{/hasRows}} +{{^hasRows}}
    This model declares no template.*.
    {{/hasRows}} +`,"explorer-requirements.html.mustache":`

    Requirements

    +
    Hierarchy is nesting. L1 to L3 describe the problem; only L4 (an object or prompt) and L5 (a member) may name the model.
    + +{{{legendHtml}}} +{{#hasTree}}
    {{{treeHtml}}}
    {{/hasTree}} +{{^hasTree}}
    {{{emptyNote}}}
    {{/hasTree}} +`,"explorer-requirement.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{levelHtml}}}{{{name}}} {{{statusHtml}}}{{{dispositionHtml}}}{{{verdictHtml}}}

    + +
    {{{address}}}
    +
    +
    +

    Statement

    {{{statement}}}

    Counterexample

    {{{counterexample}}}{{#hasDescription}}

    Scope

    {{{description}}}
    {{/hasDescription}}
    +

    Implemented by

    + {{#hasLinks}}
    {{#linkRows}}{{/linkRows}}
    ReferenceKindResolves
    {{{refHtml}}}{{{kind}}}{{{resolvesHtml}}}
    {{/hasLinks}} + {{^hasLinks}}
    {{{linksEmpty}}}
    {{/hasLinks}} + {{#hasBelow}}

    Below ({{childCount}}){{#deeper}} {{belowCount}} in all{{/deeper}}

    {{{belowBarHtml}}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}
    • {{/children}}
    {{/hasBelow}} +
    {{#sliceHref}}Show this slice on the model map{{/sliceHref}}{{#sliceHref}}{{#traceHref}} · {{/traceHref}}{{/sliceHref}}{{#traceHref}}Trace to code{{/traceHref}}
    +
    +
    +

    What the build proves about this entry

    +
    {{#proof}}{{/proof}}
    {{{what}}}{{{verdictHtml}}}{{{howHtml}}}
    + {{#trackedHtml}}

    Tracked by

    {{{trackedHtml}}}{{/trackedHtml}} + {{#digest}}

    Statement digest

    {{{digest}}}
    Moves when the statement changes; a summary of this entry would be pinned to it.
    {{/digest}} +
    +
    +`,"explorer-matrix.html.mustache":`

    Traceability matrix

    +
    Rows are requirements that name the model; columns are stored entities and prompts, most claimed first. An empty column is a node nothing claims; a cell's colour and glyph are the row's declared status.
    +{{#hasRows}}
    {{{legendHtml}}}
    +
    {{{tableHtml}}}
    {{/hasRows}} +{{^hasRows}}
    {{#hasRequirements}}No requirement names the model yet: only L4 and L5 entries do.{{/hasRequirements}}{{^hasRequirements}}This model declares no requirements, so there is nothing to trace.{{/hasRequirements}}
    {{/hasRows}} +`,"explorer-trace.html.mustache":`

    Trace

    +
    From intent to code: requirement levels, then the model nodes they name, then the files generated from those nodes.
    +{{#hasStarts}}
    + +
    Hand-written modules that import the generated files are not scanned in this build, so the trace stops at the generated files. Click a requirement or a model node to open its page.
    {{/hasStarts}} +{{^hasStarts}}
    This model declares no requirements, so there is nothing to trace from. Every object's generated files are listed on its own page.
    {{/hasStarts}} +`,"explorer-gaps.html.mustache":`

    Gaps

    +
    What the model and the gate can already point at. Each card says whether it comes from the shipped gate or is a check this explorer adds.
    +
    +{{#cards}}

    {{{title}}} {{{count}}} {{{source}}}

    {{{whyHtml}}}
    {{{bodyHtml}}}
    +{{/cards}}
    +`,"explorer-api.html.mustache":`

    API

    +{{#recorded}}
    Every route the generated code mounts, by the object it serves: {{{summary}}}.
    +{{#hasGroups}}
    {{#groups}}

    {{{linkHtml}}} {{{kind}}}{{#isReadOnly}} read-only{{/isReadOnly}}

    {{#routes}}
    {{{method}}} {{{path}}}
    {{/routes}}
    {{/groups}}
    {{/hasGroups}} +{{^hasGroups}}
    The run generated no routes.
    {{/hasGroups}}{{/recorded}} +{{^recorded}}
    The run that built this site recorded no routes: it generated none, or ran without the routes generator.
    {{/recorded}} +`,"explorer-model.html.mustache":`

    Packages

    +
    Every package in the model and what it declares.
    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-package.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}}

    +
    +{{#rows}} +{{/rows}}
    NameKindStorageFieldsClaim
    {{{linkHtml}}} {{{abstractHtml}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{kind}}}{{{storage}}}{{fieldCount}}{{{statusHtml}}}
    +`};/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.css b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.css new file mode 100644 index 0000000000..aae678b023 --- /dev/null +++ b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.css @@ -0,0 +1,232 @@ +/* The model explorer's theme. `meta eject docs-site` copies this file to + codegen/docs-site/assets/, where an edit wins over the bundled copy. + + Colour rules (design report §4.2), which the classes below keep apart: + .s- a DECLARED status: filled chip, with its glyph in the text + .v- a GATE verdict: an outline (ring), never a fill + .bar .b-* a ROLL-UP of what sits below: a separate stacked bar + No class here colours a test result. */ + +:root { + --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f23; --muted: #5f6670; --line: #e2e3e0; + --accent: #3b5bdb; --accent-soft: #e8ecfd; --accent-ink: #ffffff; + --live: #2f9e44; --live-soft: #e3f5e7; --partial: #e8890c; --partial-soft: #fdf0dc; + --planned: #4c6ef5; --planned-soft: #e9edff; --retired: #868e96; --retired-soft: #eef0f2; + --bad: #e03131; --bad-soft: #fde8e8; --warn: #e8890c; --code: #f1f2ef; + --entity: #495057; --value: #7048e8; --prompt: #0c8599; --projection: #1971c2; --report: #c2255c; + --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); + --shadow-lift: 0 4px 14px rgba(16, 24, 40, .10); + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; + } +} +:root[data-theme="dark"] { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; +} + +* { box-sizing: border-box; } +html { -webkit-text-size-adjust: 100%; } +body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; } +code { background: var(--code); border-radius: 4px; padding: 0 4px; } +code.digest { display: block; overflow-wrap: anywhere; font-size: 11.5px; padding: 4px 6px; } +pre code, .mono code { background: none; padding: 0; } + +/* ── Header ─────────────────────────────────────────────────────────────── */ +header.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: center; padding: 10px 20px; flex-wrap: wrap; } +.brand { font-weight: 700; letter-spacing: .2px; color: var(--ink); white-space: nowrap; } +.brand:hover { text-decoration: none; } +.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; } +.nav { display: flex; gap: 4px; flex-wrap: wrap; } +.nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; } +.nav a:hover { background: var(--code); text-decoration: none; } +.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; } +#search { margin-left: auto; position: relative; } +#search input { width: 260px; max-width: 60vw; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; } +#search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); } +#results { position: absolute; right: 0; top: 36px; width: 420px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lift); display: none; } +#results a { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); } +#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; } +#results a small { color: var(--muted); display: block; } +#results .none { padding: 8px 12px; color: var(--muted); } +#theme { padding: 5px 9px; } + +/* ── Page ───────────────────────────────────────────────────────────────── */ +main { padding: 24px 20px 20px; max-width: 1400px; margin: 0 auto; } +h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } +h2 { font-size: 16px; margin: 26px 0 10px; } +h3 { font-size: 14px; margin: 16px 0 6px; } +h3.first { margin-top: 0; } +.h-sub { color: var(--muted); font-weight: 400; } +.sub { color: var(--muted); } +.small { font-size: 12px; } +.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; } +.meta-line { margin-top: 4px; } +.page { margin-top: 14px; } +.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; } +.grid { display: grid; gap: 12px; } +.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; } +a.tile { color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; } +a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); } +.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; } +.tile .l { color: var(--muted); font-size: 12.5px; line-height: 1.4; } +.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +.apis { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } +@media (max-width: 1000px) { .side { grid-template-columns: minmax(0, 1fr); } } +@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } } + +table { border-collapse: collapse; width: 100%; } +th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } +th { font-size: 12px; color: var(--muted); font-weight: 600; } +tr:target td { background: var(--accent-soft); } +table.kv th { width: 120px; } +.tablewrap { overflow-x: auto; } + +/* ── Status, verdict and roll-up ────────────────────────────────────────── */ +.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0; font-weight: 500; line-height: 1.6; } +h1 .chip { font-size: 12.5px; } +.s-live { background: var(--live-soft); color: var(--live); border-color: transparent; } +.s-partial { background: var(--partial-soft); color: var(--partial); border-color: transparent; } +.s-planned { background: var(--planned-soft); color: var(--planned); border-color: transparent; } +.s-retired { background: var(--retired-soft); color: var(--retired); border-color: transparent; text-decoration: line-through; } +.v-error, .v-unclaimed { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); } +.v-warn { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); } +.glyph { font-size: 12px; } +.g-live { color: var(--live); } .g-partial { color: var(--partial); } .g-planned { color: var(--planned); } .g-retired { color: var(--retired); } +.lvl { display: inline-block; min-width: 24px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; background: var(--code); color: var(--muted); padding: 0 4px; margin-right: 6px; line-height: 18px; } +h1 .lvl { font-size: 12px; line-height: 22px; } +.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--code); min-width: 80px; } +.bar span { display: block; height: 100%; } +.b-live { background: var(--live); } .b-partial { background: var(--partial); } .b-planned { background: var(--planned); } .b-retired { background: var(--retired); } +.minibar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 4px; } +.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin: 4px 0; } +.legend-row { margin: 10px 0; } +.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; } +.pill.gate { color: var(--accent); border-color: var(--accent); } +a.k-entity { color: var(--accent); font-weight: 500; } +span.k-entity { color: var(--entity); } .k-value { color: var(--value); } .k-prompt, .k-template { color: var(--prompt); } +.k-projection { color: var(--projection); } .k-report { color: var(--report); } +.kdot { font-size: 10px; } +.kdot.k-entity { color: var(--entity); } .kdot.k-value { color: var(--value); } .kdot.k-prompt { color: var(--prompt); } +.k-badge { color: var(--projection); } +.vals { color: var(--muted); font-size: 11.5px; } + +/* ── S1 cards ───────────────────────────────────────────────────────────── */ +.cap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; } +.cap .card h3 { margin-top: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.capcard .statement { margin: 2px 0 0; } +.rollup { margin: 10px 0 4px; } +.rollup .sub { margin-top: 3px; } +ul { padding-left: 18px; margin: 6px 0; } +.cap li, .kids li { margin: 4px 0; } +.members { margin-top: 8px; line-height: 1.9; } +details.summary { margin-top: 6px; } +details > summary { cursor: pointer; color: var(--muted); font-size: 12px; } +.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; } +.note.intro { margin: 4px 0 8px; font-size: 13.5px; } + +/* ── S5 tree ────────────────────────────────────────────────────────────── */ +.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } +.tabs a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); } +.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } +.tree { margin-top: 10px; } +.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 8px; } +.tree > ul { border-left: none; padding-left: 0; margin-left: 0; } +.tree li { margin: 4px 0; } +.tree .row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } +.tree .stmt { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-left: 30px; } + +/* ── Graphs ─────────────────────────────────────────────────────────────── */ +.graph { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; } +#cy { height: 640px; } #cymini { height: 260px; } #cytrace { height: 680px; } +.panel h3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.maplegend { margin-top: 8px; } +.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } +select, button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; max-width: 100%; } +button { cursor: pointer; } +button:hover { border-color: var(--accent); } +.layout, .gen, .route { margin: 4px 0; } +.gen .pill { margin-left: 0; } + +/* ── S4 text ────────────────────────────────────────────────────────────── */ +pre { background: var(--code); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; } +pre.text { max-height: 560px; } +.var { color: var(--prompt); } + +/* ── S6 proof ───────────────────────────────────────────────────────────── */ +.proof { font-size: 12.5px; } +.proof td:first-child { white-space: nowrap; font-weight: 500; } + +/* ── S7 matrix ──────────────────────────────────────────────────────────── */ +.mx { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } +.mx table { width: auto; border-collapse: separate; border-spacing: 0; } +/* The header row is sticky as a whole: a sticky cell per column would paint over the slanted + label of the column before it. */ +.mx thead { position: sticky; top: 0; z-index: 2; background: var(--panel); } +.mx th.col { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 0; } +.mx th.col.corner { position: sticky; left: 0; background: var(--panel); } +.mx th.col div { transform: rotate(-60deg); transform-origin: left bottom; width: 18px; margin-left: 12px; font-weight: 500; font-size: 11.5px; max-width: 18px; } +.mx th.col div a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +.mx th.col.unc div a { color: var(--bad); } +.mx td.c { width: 20px; min-width: 20px; height: 22px; padding: 0; text-align: center; font-size: 11px; border-right: 1px solid var(--line); } +.mx td.rh { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; } +.mx tr.grp td { background: var(--code); font-weight: 600; } +.mx td.c.live { background: var(--live-soft); } .mx td.c.planned { background: var(--planned-soft); } +.mx td.c.partial { background: var(--partial-soft); } .mx td.c.retired { background: var(--retired-soft); } + +/* ── S9 gaps, API ───────────────────────────────────────────────────────── */ +.gap h3 { display: flex; gap: 8px; align-items: center; margin-top: 0; flex-wrap: wrap; } +.gap .why { margin-bottom: 8px; } +.count { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--code); } +.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 4px; padding: 1px 4px; background: var(--code); color: var(--muted); } +.m-GET, .m-get { background: var(--live-soft); color: var(--live); } +.m-POST, .m-post { background: var(--planned-soft); color: var(--planned); } +.m-PUT, .m-put, .m-PATCH, .m-patch { background: var(--partial-soft); color: var(--partial); } +.m-DELETE, .m-delete { background: var(--bad-soft); color: var(--bad); } + +footer { color: var(--muted); font-size: 12px; padding: 24px 20px; text-align: center; } + +/* ── Phone ──────────────────────────────────────────────────────────────── */ +@media (max-width: 700px) { + header.top { gap: 8px 12px; padding: 10px 16px; } + .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } + .nav::-webkit-scrollbar { display: none; } + #search { order: 4; margin-left: 0; flex-basis: 100%; } + #search input { width: 100%; max-width: none; } + #results { left: 0; right: 0; width: auto; max-width: none; } + #theme { margin-left: auto; } + main { padding: 16px; } + h1 { font-size: 20px; } + .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .tile .n { font-size: 22px; } + .cap { grid-template-columns: minmax(0, 1fr); } + .apis { grid-template-columns: minmax(0, 1fr); } + #cy { height: 440px; } #cytrace { height: 520px; } + .mx { max-height: none; } + /* A wide table scrolls inside its own box, never the page. */ + main table { display: block; max-width: 100%; overflow-x: auto; } + .mx table { display: table; max-width: none; } + .tree .stmt { margin-left: 0; } + .tree ul { padding-left: 12px; margin-left: 4px; } +} +@media print { header.top, #search, #theme, .toolbar { display: none; } .card { box-shadow: none; } } diff --git a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.js b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.js new file mode 100644 index 0000000000..61c4153d2e --- /dev/null +++ b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer.js @@ -0,0 +1,332 @@ +// The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. +// `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. +(function () { + "use strict"; + function run() { + var APP = window.MO_APP || null; + var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; + var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; + var $ = function (s, r) { return (r || document).querySelector(s); }; + var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; + var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; + var STATUS = ["live", "partial", "planned", "retired"]; + var GLYPH = { live: "●", partial: "◐", planned: "○", retired: "⊘" }; + var PAL = ["#1971c2", "#e8590c", "#2b8a3e", "#ae3ec9", "#c2255c", "#0b7285", "#5c940d", "#f08c00"]; + var byId = {}; + D.nodes.forEach(function (n) { byId[n.id] = n; }); + var reqById = {}; + D.reqs.forEach(function (r) { reqById[r.id] = r; }); + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; + var redraw = []; + + // ── Theme ─────────────────────────────────────────────────────────────── + var themeBtn = $("#theme"); + if (themeBtn) themeBtn.onclick = function () { + var cur = document.documentElement.getAttribute("data-theme"); + var dark = cur ? cur === "dark" : matchMedia("(prefers-color-scheme: dark)").matches; + var next = dark ? "light" : "dark"; + document.documentElement.setAttribute("data-theme", next); + try { localStorage.setItem("mo-theme", next); } catch (e) { /* private window: the toggle still works for this page */ } + redraw.forEach(function (f) { f(); }); + }; + + // ── Search ────────────────────────────────────────────────────────────── + // The built-in index ships in explorer-data.js and works from file://. When the site has been + // indexed with Pagefind (`npx pagefind --site `) and is served over http, Pagefind's + // full-text index answers instead. + var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; + function loadPagefind() { + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + pagefindTried = true; + // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every + // result URL carry the path the site is served under (a sub-path included). + var url = new URL(ROOT + "pagefind/pagefind.js", location.href).href; + return fetch(url, { method: "HEAD" }).then(function (r) { + if (!r.ok) return null; + return import(url).then(function (m) { pagefind = m; return m; }); + }).catch(function () { return null; }); + } + function show(items) { + sel = -1; + res.innerHTML = items.length ? items.map(function (x) { return '' + esc(x.t) + "" + esc(x.s) + ""; }).join("") : '
    No match
    '; + res.style.display = "block"; + } + function builtIn(v) { + var words = v.split(/\s+/).filter(Boolean); + return D.search.filter(function (x) { return words.every(function (w) { return x.k.indexOf(w) >= 0; }); }) + .sort(function (a, b) { return (a.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1) - (b.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1); }) + .slice(0, 25).map(function (x) { return { t: x.t, s: x.s, h: href(x.h) }; }); + } + if (q && res) { + q.addEventListener("input", function () { + var v = q.value.trim().toLowerCase(); + if (!v) { res.style.display = "none"; return; } + show(builtIn(v)); + loadPagefind().then(function (pf) { + if (!pf || q.value.trim().toLowerCase() !== v) return; + pf.search(v).then(function (r) { + return Promise.all(r.results.slice(0, 12).map(function (x) { return x.data(); })); + }).then(function (rows) { + if (q.value.trim().toLowerCase() !== v || !rows.length) return; + show(rows.map(function (d) { return { t: (d.meta && d.meta.title) || d.url, s: (d.excerpt || "").replace(/<[^>]+>/g, ""), h: d.url }; })); + }).catch(function () { /* keep the built-in results */ }); + }); + }); + q.addEventListener("keydown", function (e) { + var links = res.querySelectorAll("a"); + if (e.key === "ArrowDown" || e.key === "ArrowUp") { + e.preventDefault(); + sel = Math.max(0, Math.min(links.length - 1, sel + (e.key === "ArrowDown" ? 1 : -1))); + links.forEach(function (a, i) { a.classList.toggle("sel", i === sel); }); + } else if (e.key === "Enter" && links.length) { + location.href = links[Math.max(0, sel)].href; + } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } + }); + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { + if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } + }); + } + + if (typeof window.cytoscape !== "function") { + document.querySelectorAll(".graph").forEach(function (g) { + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; + }); + return; + } + + // ── Colours ───────────────────────────────────────────────────────────── + // Fill: the kind, the feature, or the DECLARED status of the claims on a node. + // Ring: a gate verdict (unclaimed). Never a test result. + function kindColour(n) { + return css({ entity: "--entity", value: "--value", prompt: "--prompt", template: "--prompt", projection: "--projection", report: "--report" }[n.kind] || "--entity"); + } + function fill(n, mode) { + if (n.abstract) return css("--retired"); + if (mode === "kind") return kindColour(n); + if (mode === "api") return n.api.length ? css("--accent") : css("--retired-soft"); + if (mode === "claims") return n.claims > 8 ? css("--live") : n.claims > 2 ? css("--partial") : n.claims > 0 ? css("--planned") : css("--retired-soft"); + if (mode === "cap") return n.feature >= 0 ? PAL[n.feature % PAL.length] : n.quality ? css("--retired") : css("--retired-soft"); + return n.status === "unclaimed" ? css("--retired-soft") : css("--" + n.status); + } + function legend(mode) { + var ring = D.hasClaims ? 'red ring: unclaimed (gate)' : ""; + if (mode === "cap") return '
    ' + D.features.map(function (f, i) { return '● ' + esc(f.label) + ""; }).join("") + '● qualities only○ no claim' + ring + "Fill is the feature (L1) with the most claims on the node; size is fields plus claims.
    "; + if (mode === "status") return '
    ' + STATUS.map(function (s) { return '' + GLYPH[s] + " " + s + ""; }).join("") + '○ no claim' + ring + "Fill is the best declared status among the requirements that claim the node.
    "; + if (mode === "api") return '
    ● mounted routes○ none
    '; + if (mode === "claims") return '
    ● more than 8 claims● 3 to 8● 1 or 2○ none' + ring + "
    "; + return '
    ' + ["entity", "value", "projection", "report", "prompt"].map(function (k) { return '● ' + k + ""; }).join("") + "Abstract bases are dashed and grey.
    "; + } + function shape(n) { return n.kind === "prompt" || n.kind === "template" ? "diamond" : n.kind === "value" ? "round-triangle" : n.kind === "projection" || n.kind === "report" ? "round-hexagon" : n.abstract ? "round-rectangle" : "ellipse"; } + function baseStyle() { + return [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", width: "data(size)", height: "data(size)", shape: "data(shape)", color: css("--ink"), "font-size": 10, "text-valign": "bottom", "text-margin-y": 3, "border-width": 1, "border-color": css("--line"), "text-wrap": "none" } }, + { selector: "node[dashed = 1]", style: { "border-style": "dashed", "border-width": 2, "background-opacity": 0.4 } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[faded = 1]", style: { opacity: 0.18 } }, + { selector: "edge", style: { width: 1.2, "line-color": css("--muted"), "target-arrow-color": css("--muted"), "target-arrow-shape": "triangle", "curve-style": "bezier", "arrow-scale": 0.7, opacity: 0.6 } }, + { selector: "edge[ext = 1]", style: { "line-style": "dashed", "target-arrow-shape": "triangle-tee" } }, + { selector: "edge[faded = 1]", style: { opacity: 0.08 } }, + { selector: ":selected", style: { "border-width": 3, "border-color": css("--accent") } }, + ]; + } + var bar = function (c) { + var t = STATUS.reduce(function (a, s) { return a + (c[s] || 0); }, 0); + if (!t) return '
    '; + return '
    ' + STATUS.filter(function (s) { return c[s]; }).map(function (s) { return ''; }).join("") + "
    "; + }; + var chip = function (s) { return s ? '' + (GLYPH[s] || "") + " " + esc(s) + "" : ""; }; + var nodeLink = function (id) { var n = byId[id]; return n ? '' + esc(n.name) + "" : esc(id); }; + + // ── S2: the model map ─────────────────────────────────────────────────── + // cose from a grid (not from one point) gives the same picture on every load. + var COSE = { name: "cose", animate: false, randomize: false, nodeRepulsion: 12000, nodeOverlap: 24, idealEdgeLength: 90, componentSpacing: 90, gravity: 0.6, padding: 24, nodeDimensionsIncludeLabels: true }; + function seedGrid(els) { + var nodes = els.filter(function (e) { return !e.data.source; }), cols = Math.ceil(Math.sqrt(nodes.length || 1)); + nodes.forEach(function (e, i) { e.position = { x: (i % cols) * 120, y: Math.floor(i / cols) * 100 }; }); + } + var cyEl = $("#cy"); + if (cyEl) { + var cy = null; + var params = new URLSearchParams(query()); + var sliceSel = $("#slice"), colourSel = $("#colour"); + if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); + if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); + var focus = params.get("focus"); + var promptSet = function () { + var s = {}; + D.nodes.forEach(function (n) { if (n.kind === "prompt" || n.kind === "template") s[n.id] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && (e.k === "payloadRef" || e.k === "responseRef")) s[e.t] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && byId[e.s] && byId[e.s].kind === "value" && e.k === "objectRef") s[e.t] = 1; }); + return s; + }; + var build = function (relayout) { + var slice = sliceSel.value, mode = colourSel.value, hide = $("#hideOut").checked, showExt = $("#showExt").checked; + $("#maplegend").innerHTML = legend(mode); + var inSlice = null; + if (slice === "@prompts") inSlice = promptSet(); + else if (slice && D.slices[slice]) { inSlice = {}; D.slices[slice].forEach(function (id) { inSlice[id] = 1; }); } + var showVals = $("#showValues").checked || slice === "@prompts" || (inSlice && Object.keys(inSlice).some(function (id) { return byId[id] && byId[id].kind !== "entity"; })); + var entityCount = D.nodes.filter(function (n) { return n.kind === "entity"; }).length; + if (!entityCount) showVals = true; + var nodes = D.nodes.filter(function (n) { return (n.kind === "entity" || showVals) && (!hide || !inSlice || inSlice[n.id]); }); + var ids = {}; + nodes.forEach(function (n) { ids[n.id] = 1; }); + var els = nodes.map(function (n) { + return { data: { id: n.id, label: n.name, col: fill(n, mode), size: 18 + Math.min(40, n.fields * 1.6 + n.claims * 2), shape: shape(n), faded: inSlice && !inSlice[n.id] ? 1 : 0, dashed: n.abstract, ring: n.unclaimed } }; + }); + D.edges.forEach(function (e, i) { + if (!ids[e.s] || !ids[e.t] || (!showExt && e.k === "extends")) return; + els.push({ data: { id: "e" + i, source: e.s, target: e.t, label: e.v || e.k, ext: e.k === "extends" ? 1 : 0, faded: inSlice && !(inSlice[e.s] && inSlice[e.t]) ? 1 : 0 } }); + }); + seedGrid(els); + var pan = cy && !relayout ? { pos: {} } : null; + if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); + if (cy) cy.destroy(); + var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); + cy = graph({ + container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), + layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, + }); + cy.on("tap", "node", function (ev) { showPanel(ev.target.id()); }); + cy.on("dbltap", "node", function (ev) { var n = byId[ev.target.id()]; if (n) location.href = href(n.href); }); + var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; + if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); + if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); + }; + ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); + $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; + redraw.push(function () { build(false); }); + build(true); + } + function slicePanel(r, nodes) { + return '
    Slice

    ' + (r.level ? "L" + r.level : "—") + '' + esc(r.label) + " " + chip(r.status) + "

    " + esc(r.statement) + "
    " + + "

    " + r.claimed + " model node" + (r.claimed === 1 ? "" : "s") + " claimed below

    " + nodes.map(nodeLink).join(", ") + + "

    Status below

    " + bar(r.rollup); + } + function showPanel(id) { + var n = byId[id], p = $("#panel"); + if (!n || !p) return; + var claims = D.reqs.filter(function (r) { return r.targets.indexOf(id) >= 0; }); + var byTop = {}; + claims.forEach(function (r) { var t = r; while (t.parent && reqById[t.parent]) t = reqById[t.parent]; (byTop[t.id] = byTop[t.id] || []).push(r); }); + var refs = D.edges.filter(function (e) { return e.s === id || e.t === id; }).length; + var gen = (D.generated[id] || []).map(function (g) { return '' + esc(g[0]) + " " + g[1]; }).join(" · "); + p.innerHTML = '
    ' + esc(n.pkg) + " · " + esc(n.kind) + (n.storage ? " · " + esc(n.storage) : "") + "
    " + + '

    ' + nodeLink(id) + (n.unclaimed ? ' unclaimed' : "") + "

    " + + "

    Why it exists (" + claims.length + " claim" + (claims.length === 1 ? "" : "s") + ")

    " + + (claims.length ? Object.keys(byTop).map(function (t) { + return "
    " + esc(reqById[t].label) + ": " + byTop[t].slice(0, 6).map(function (r) { return '' + (GLYPH[r.status] || "") + " " + esc(r.label) + ""; }).join(", ") + (byTop[t].length > 6 ? " +" + (byTop[t].length - 6) : "") + "
    "; + }).join("") : 'No requirement claims this node.') + + "

    Shape

    " + n.fields + " field" + (n.fields === 1 ? "" : "s") + ", " + refs + " reference" + (refs === 1 ? "" : "s") + + (n.api.length ? "

    API

    " + n.api.map(function (a) { return "
    " + esc(a) + "
    "; }).join("") : "") + + "

    Generated

    " + (gen || 'nothing traced'); + } + + // ── S3: the one-hop mini-map ──────────────────────────────────────────── + var mini = $("#cymini"); + if (mini) { + var me = mini.getAttribute("data-node"); + var drawMini = function () { + var es = D.edges.filter(function (e) { return e.s === me || e.t === me; }); + var ids = {}; + ids[me] = 1; + es.forEach(function (e) { ids[e.s] = 1; ids[e.t] = 1; }); + var els = Object.keys(ids).filter(function (id) { return byId[id]; }).sort().map(function (id) { + var n = byId[id]; + return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; + }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); + mini.innerHTML = ""; + var c = graph({ + container: mini, elements: els, maxZoom: 1.3, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[me = 1]", style: { width: 30, height: 30, "border-width": 3, "border-color": css("--accent") } }, + { selector: "edge", style: { width: 1, label: "data(label)", "font-size": 8, color: css("--muted"), "line-color": css("--muted"), "target-arrow-shape": "triangle", "target-arrow-color": css("--muted"), "curve-style": "bezier", "text-rotation": "autorotate", "text-background-color": css("--panel"), "text-background-opacity": 1, "text-background-padding": 2 } }, + ], + layout: { name: "concentric", concentric: function (n) { return n.data("me") ? 2 : 1; }, levelWidth: function () { return 1; }, startAngle: Math.PI, padding: 30, minNodeSpacing: 60 }, + }); + c.on("tap", "node", function (ev) { var n = byId[ev.target.id()]; if (n && n.id !== me) location.href = href(n.href); }); + }; + redraw.push(drawMini); + drawMini(); + } + + // ── S8: the trace ─────────────────────────────────────────────────────── + var tr = $("#cytrace"), tstart = $("#tstart"); + if (tr && tstart) { + var p2 = new URLSearchParams(query()).get("start"); + if (p2 && reqById[p2]) tstart.value = p2; + var drawTrace = function () { + var r0 = reqById[tstart.value]; + if (!r0) return; + var kids = {}; + D.reqs.forEach(function (r) { if (r.parent) (kids[r.parent] = kids[r.parent] || []).push(r); }); + var reqs = [], walk = function (r) { reqs.push(r); (kids[r.id] || []).forEach(walk); }; + walk(r0); + var cols = [[], [], [], []], els = [], seen = {}; + var add = function (id, label, col, data) { if (seen[id]) return; seen[id] = 1; cols[col].push(id); data.id = id; data.label = label; els.push({ data: data }); }; + reqs.forEach(function (r) { add("r:" + r.id, (r.level ? "L" + r.level + " " : "") + r.label, r.level >= 4 ? 1 : 0, { col: r.status ? css("--" + r.status) : css("--muted"), shape: "round-rectangle", go: r.href }); }); + reqs.forEach(function (r) { if (r.parent && seen["r:" + r.parent]) els.push({ data: { id: "pe:" + r.id, source: "r:" + r.parent, target: "r:" + r.id } }); }); + reqs.forEach(function (r) { + r.targets.forEach(function (t) { + var n = byId[t]; + if (!n) return; + add("o:" + t, n.name, 2, { col: kindColour(n), shape: shape(n), go: n.href, ring: n.unclaimed }); + if (!seen["le:" + r.id + ">" + t]) { seen["le:" + r.id + ">" + t] = 1; els.push({ data: { id: "le:" + r.id + ">" + t, source: "r:" + r.id, target: "o:" + t, col: r.status ? css("--" + r.status) : css("--muted") } }); } + }); + }); + cols[2].slice().forEach(function (oid) { + var id = oid.slice(2); + var gen = D.generated[id] || []; + if (!gen.length) return; + var total = gen.reduce(function (a, g) { return a + g[1]; }, 0); + var gid = "g:" + id; + add(gid, total + " generated (" + gen.map(function (g) { return g[0]; }).join(", ") + ")", 3, { col: css("--accent"), shape: "tag", go: byId[id].href }); + els.push({ data: { id: "ge:" + gid, source: oid, target: gid } }); + }); + var pos = {}; + cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); + tr.innerHTML = ""; + var c = graph({ + container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, + { selector: "node[ring = 1]", style: { "border-width": 2, "border-color": css("--bad") } }, + { selector: "edge", style: { width: 1, "line-color": "data(col)", opacity: 0.5, "curve-style": "unbundled-bezier" } }, + { selector: "edge[!col]", style: { "line-color": css("--muted") } }, + ], + layout: { name: "preset", positions: function (n) { return pos[n.id()]; }, fit: true, padding: 24 }, + }); + c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); + }; + tstart.onchange = function () { + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); + drawTrace(); + }; + redraw.push(drawTrace); + drawTrace(); + } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); +})(); diff --git a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/index.html b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/server/python/src/metaobjects/documentation/explorer_app/assets/cytoscape.min.js b/server/python/src/metaobjects/documentation/explorer_app/assets/cytoscape.min.js new file mode 100644 index 0000000000..ff0d7c1796 --- /dev/null +++ b/server/python/src/metaobjects/documentation/explorer_app/assets/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2024, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}var u="undefined"==typeof window?null:window,c=u?u.navigator:null;u&&u.document;var d=e(""),h=e({}),p=e((function(){})),f="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),g=function(e){return e&&e.instanceString&&y(e.instanceString)?e.instanceString():null},v=function(t){return null!=t&&e(t)==d},y=function(t){return null!=t&&e(t)===p},m=function(e){return!E(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},b=function(t){return null!=t&&e(t)===h&&!m(t)&&t.constructor===Object},x=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},w=function(e){return"undefined"===f?void 0:null!=e&&e instanceof HTMLElement},E=function(e){return k(e)||C(e)},k=function(e){return"collection"===g(e)&&e._private.single},C=function(e){return"collection"===g(e)&&!e._private.single},S=function(e){return"core"===g(e)},P=function(e){return"stylesheet"===g(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},T=function(t){return function(t){return null!=t&&e(t)===h}(t)&&y(t.then)},_=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},L=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},R={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},V=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=H();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?ge(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=H(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=pe(t)||0,j(n)&&(c=!!n.leading,a=(d="maxWait"in n)?fe(pe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(H())},m},ye=u?u.performance:null,me=ye&&ye.now?function(){return ye.now()}:function(){return Date.now()},be=function(){if(u){if(u.requestAnimationFrame)return function(e){u.requestAnimationFrame(e)};if(u.mozRequestAnimationFrame)return function(e){u.mozRequestAnimationFrame(e)};if(u.webkitRequestAnimationFrame)return function(e){u.webkitRequestAnimationFrame(e)};if(u.msRequestAnimationFrame)return function(e){u.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(me())}),1e3/60)}}(),xe=function(e){return be(e)},we=me,Ee=65599,ke=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*Ee+t.value|0;return r},Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*Ee+e|0},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},Pe=function(e){return 2097152*e[0]+e[1]},De=function(e,t){return[Ce(e[0],t[0]),Se(e[1],t[1])]},Te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return ke({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ge=function(e){e.splice(0,e.length)},Ue=function(e,t,n){return n&&(t=N(n,t)),e[t]},Ze=function(e,t,n,r){n&&(t=N(n,t)),e[t]=r},$e="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Qe=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Je,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];m(t.classes)?l=t.classes:v(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=m.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},ot={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!i){var T=S*u+C;!i&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},pt=Math.sqrt(2),ft=function(e,t,n){0===n.length&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=ft(i,e,t),n--}return t},vt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/pt);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},kt=function(e,t){return Math.sqrt(Ct(e,t))},Ct=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},St=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Mt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Bt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},It=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},At=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ot=function(e,t){return Lt(e,t.x1,t.y1)&&Lt(e,t.x2,t.y2)},Rt=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,d=i/2,h=a/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=n-d+c-o,v=r-h-o,y=n+d-c+o,m=v;if((s=Zt(e,t,n,r,g,v,y,m,!1)).length>0)return s}if(f){var b=n+d+o,x=r-h+c-o,w=b,E=r+h-c+o;if((s=Zt(e,t,n,r,b,x,w,E,!1)).length>0)return s}if(p){var k=n-d+c-o,C=r+h+o,S=n+d-c+o,P=C;if((s=Zt(e,t,n,r,k,C,S,P,!1)).length>0)return s}if(f){var D=n-d-o,T=r-h+c-o,_=D,M=r+h-c+o;if((s=Zt(e,t,n,r,D,T,_,M,!1)).length>0)return s}var B=n-d+c,N=r-h+c;if((l=Gt(e,t,n,r,B,N,c+o)).length>0&&l[0]<=B&&l[1]<=N)return[l[0],l[1]];var z=n+d-c,I=r-h+c;if((l=Gt(e,t,n,r,z,I,c+o)).length>0&&l[0]>=z&&l[1]<=I)return[l[0],l[1]];var A=n+d-c,L=r+h-c;if((l=Gt(e,t,n,r,A,L,c+o)).length>0&&l[0]>=A&&l[1]>=L)return[l[0],l[1]];var O=n-d+c,R=r+h-c;return(l=Gt(e,t,n,r,O,R,c+o)).length>0&&l[0]<=O&&l[1]>=R?[l[0],l[1]]:[]},Vt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ft=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},jt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Yt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Xt=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Ht(c,-l);d=Wt(g)}else d=c;return Yt(e,t,d)},Wt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ut=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Zt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Ut(e,n,o)===o?[o,s]:Ut(e,n,i)===i?[i,a]:Ut(i,o,n)===n?[n,r]:[]:[]},$t=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Ht(g,-s);u=Wt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Cn,o=r,s=0;s=2?Mn(e,t,n,0,Dn,Tn):Mn(e,t,n,0,Pn)},squaredEuclidean:function(e,t,n){return Mn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Mn(e,t,n,0,Pn)},max:function(e,t,n){return Mn(e,t,n,-1/0,_n)}};function Nn(e,t,n,r,i,a){var o;return o=y(e)?e:Bn[e]||Bn.euclidean,0===t&&y(e)?o(i,a):o(t,n,r,i,a)}Bn["squared-euclidean"]=Bn.squaredEuclidean,Bn.squaredeuclidean=Bn.squaredEuclidean;var zn=He({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),In=function(e){return zn(e)},An=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Nn(e,r.length,a,(function(e){return r[e](t)}),o,s)},Ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},jn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=rr(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=rr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},lr=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},ur={};[nt,at,ot,lt,ct,ht,vt,sn,un,dn,pn,kn,Kn,Jn,ar,{hierholzer:function(e){if(!b(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=or(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=v(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=p(i);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var y in f.unshift(l.getElementById(g.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:sr,htbc:sr,htb:sr,hopcroftTarjanBiconnectedComponents:sr},{tarjanStronglyConnected:lr,tsc:lr,tscc:lr,tarjanStronglyConnectedComponents:lr}].forEach((function(e){L(ur,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var cr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};cr.prototype={fulfill:function(e){return dr(this,1,"fulfillValue",e)},reject:function(e){return dr(this,2,"rejectReason",e)},then:function(e,t){var n=new cr;return this.onFulfilled.push(fr(e,n,"fulfill")),this.onRejected.push(fr(t,n,"reject")),hr(this),n.proxy}};var dr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,hr(e)),e},hr=function(e){1===e.state?pr(e,"onFulfilled",e.fulfillValue):2===e.state&&pr(e,"onRejected",e.rejectReason)},pr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1};var ri=function(e,t){var n=this.__data__,r=Qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ii(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){m(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};qi.className=qi.classNames=qi.classes;var Yi={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:I,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yi.variable="(?:[\\w-.]|(?:\\\\"+Yi.metaChar+"))+",Yi.className="(?:[\\w-]|(?:\\\\"+Yi.metaChar+"))+",Yi.value=Yi.string+"|"+Yi.number,Yi.id=Yi.variable,function(){var e,t,n;for(e=Yi.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Yi.comparatorOp+="|\\!"+t)}();var Xi=0,Wi=1,Hi=2,Ki=3,Gi=4,Ui=5,Zi=6,$i=7,Qi=8,Ji=9,ea=10,ta=11,na=12,ra=13,ia=14,aa=15,oa=16,sa=17,la=18,ua=19,ca=20,da=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*A(e,t)}(e.selector,t.selector)})),ha=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return je("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return je("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&je("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return v(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Xi:var l=e(s);return l.substring(0,l.length-1);case Ki:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ui:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Gi:return"["+r.field+"]";case Zi:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case $i:return s;case Qi:return"#"+s;case Ji:return"."+s;case sa:case aa:return i(r.parent,a)+n(">")+i(r.child,a);case la:case oa:return i(r.ancestor,a)+" "+i(r.descendant,a);case ua:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case ca:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ba(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Ba)},_a.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Na)},_a.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,za)},_a.ancestors=_a.parents,(Pa=Da={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pa.data,Pa.removeAttr=Pa.removeData;var Ia,Aa,La=Da,Oa={};function Ra(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:Va("indegree",(function(e,t){return et})),minOutdegree:Va("outdegree",(function(e,t){return et}))}),L(Oa,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,y=g;g&&(f=f[0]);var m=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+m[e]):void 0!==i&&p.position({x:i.x+m.x,y:i.y+m.y})}}else if(!a)return;return this}}).modelPosition=Ia.point=Ia.position,Ia.modelPositions=Ia.points=Ia.positions,Ia.renderedPoint=Ia.renderedPosition,Ia.relativePoint=Ia.relativePosition;var qa,Ya,Xa=Aa;qa=Ya={},Ya.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Ya.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Ya.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ka=function(e,t){return null==t?e:Ha(e,t.x1,t.y1,t.x2,t.y2)},Ga=function(e,t,n){return Ue(e,t,n)},Ua=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Nt(u,1),Ha(e,u.x1,u.y1,u.x2,u.y2)}}},Za=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Ga(a,"labelWidth",n),p=Ga(a,"labelHeight",n),f=Ga(a,"labelX",n),g=Ga(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=i.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?Ga(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,Ha(e,o,l,s,u),Ha(i.labelBounds.all,o,l,s,u)}return e}},$a=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=_t(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;Ha(h,n=o-S,i=s-P,r=o+S,a=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,i,a=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(a>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(zt(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,i=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+i,y2:n.y2+i,w:n.w,h:n.h});Mt(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),Ha(h,n-=k,i-=k,r+=k,a+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,i=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(i>(a=T[1].y)){var M=i;i=a,a=M}Ha(h,n-k,i-k,r+k,a+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((i=I.y)>(a=A.y)){var O=i;i=a,a=O}Ha(h,n-=k,i-=k,r+=k,a+=k)}if(c&&t.includeEdges&&g&&(Ua(h,e,"mid-source"),Ua(h,e,"mid-target"),Ua(h,e,"source"),Ua(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Ha(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};It(F,h),zt(F,y),Nt(F,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ha(h,n-E,i-E,r+E,a+E));var j=p.overlayBounds=p.overlayBounds||{};It(j,h),zt(j,y),Nt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=_t(),c&&t.includeLabels&&(t.includeMainLabels&&Za(h,e,null),g&&(t.includeSourceLabels&&Za(h,e,"source"),t.includeTargetLabels&&Za(h,e,"target")))}return h.x1=Wa(h.x1),h.y1=Wa(h.y1),h.x2=Wa(h.x2),h.y2=Wa(h.y2),h.w=Wa(h.x2-h.x1),h.h=Wa(h.y2-h.y1),h.w>0&&h.h>0&&b&&(zt(h,y),Nt(h,1)),h},Qa=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:bo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},wo.removeAllListeners=function(){return this.removeListener("*")},wo.emit=wo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,m(t)||(t=[t]),Co(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&v(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(b(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(v(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Go.neighbourhood=Go.neighborhood,Go.closedNeighbourhood=Go.closedNeighborhood,Go.openNeighbourhood=Go.openNeighborhood,L(Go,{source:Ta((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ta((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Qo({attr:"source"}),targets:Qo({attr:"target"})}),L(Go,{edgesWith:Ta(Jo(),"edgesWith"),edgesTo:Ta(Jo({thisIsSrc:!0}),"edgesTo")}),L(Go,{connectedEdges:Ta((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Go.componentsOf=Go.components;var ts=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $e,a=!1;if(t){if(t.length>0&&b(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new Je,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new ts(a,e),V=0;V0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var T=0;T1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),as=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},os={linear:function(e,t,n){return e+(t-e)*n},ease:as(.25,.1,.25,1),"ease-in":as(.42,0,1,1),"ease-out":as(0,0,.58,1),"ease-in-out":as(.42,0,.58,1),"ease-in-sine":as(.47,0,.745,.715),"ease-out-sine":as(.39,.575,.565,1),"ease-in-out-sine":as(.445,.05,.55,.95),"ease-in-quad":as(.55,.085,.68,.53),"ease-out-quad":as(.25,.46,.45,.94),"ease-in-out-quad":as(.455,.03,.515,.955),"ease-in-cubic":as(.55,.055,.675,.19),"ease-out-cubic":as(.215,.61,.355,1),"ease-in-out-cubic":as(.645,.045,.355,1),"ease-in-quart":as(.895,.03,.685,.22),"ease-out-quart":as(.165,.84,.44,1),"ease-in-out-quart":as(.77,0,.175,1),"ease-in-quint":as(.755,.05,.855,.06),"ease-out-quint":as(.23,1,.32,1),"ease-in-out-quint":as(.86,0,.07,1),"ease-in-expo":as(.95,.05,.795,.035),"ease-out-expo":as(.19,1,.22,1),"ease-in-out-expo":as(1,0,0,1),"ease-in-circ":as(.6,.04,.98,.335),"ease-out-circ":as(.075,.82,.165,1),"ease-in-out-circ":as(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return os.linear;var r=is(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":as};function ss(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function ls(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function us(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=ls(e,i),s=ls(t,i);if(x(o)&&x(s))return ss(a,o,s,n,r);if(m(o)&&m(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=os[d].apply(null,h)):o.easingImpl=os[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};ds(g.x,y.x)&&(m.x=us(g.x,y.x,p,f)),ds(g.y,y.y)&&(m.y=us(g.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ds(b.x,x.x)&&(w.x=us(b.x,x.x,p,f)),ds(b.y,x.y)&&(w.y=us(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ds(k,C)&&(a.zoom=Tt(a.minZoom,us(k,C,p,f),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||hs(0,d,e),cs(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var fs={animate:Fi.animate(),animation:Fi.animation(),animated:Fi.animated(),clearQueue:Fi.clearQueue(),delay:Fi.delay(),delayAnimation:Fi.delayAnimation(),stop:Fi.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ps(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&xe((function(n){ps(n,e),t()}))}()}}},gs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},vs=function(e){return v(e)?new ka(e):e},ys={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new xo(gs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,vs(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,vs(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,vs(t),n),this},once:function(e,t,n){return this.emitter().one(e,vs(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fi.eventAliasesOn(ys);var ms={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ms.jpeg=ms.jpg;var bs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=v(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(L({},e,{cy:this,eles:r}));return i}Ve("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ve("A `name` must be specified to make a layout");else Ve("Layout options must be specified to make a layout")}};bs.createLayout=bs.makeLayout=bs.layout;var xs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Es.invalidateDimensions=Es.resize;var ks={collection:function(e,t){return v(e)?this.$(e):E(e)?e.collection():m(e)?(t||(t={}),new ts(this,e,t.unique,t.removed)):new ts(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ks.elements=ks.filter=ks.$;var Cs={};Cs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],P=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],_=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(P-S)*g),Math.round(D+(T-D)*g)];n={bypass:i.bypass,name:i.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,z=0;z0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ss={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){je("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new ka(l).invalid){je("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){je("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(je("Skipping property: Invalid property definition in: "+r),o());else je("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var p=this.parse(e,u[4]);if(!p||p.mapped)return!1;var f=this.parse(e,u[5]);if(!f||f.mapped)return!1;if(p.pfValue===f.pfValue||p.strValue===f.strValue)return je("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var g=p.value,b=f.value;if(!(g[0]!==b[0]||g[1]!==b[1]||g[2]!==b[2]||g[3]!==b[3]&&(null!=g[3]&&1!==g[3]||null!=b[3]&&1!==b[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:p.value,valueMax:f.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):m(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",P=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&P?1===E.length&&v(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var _,B,N=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var V={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?V.pfValue=t:V.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(V.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(V.pfValue="rad"===z?t:(_=t,Math.PI*_/180)),"%"===z&&(V.pfValue=t/100),V}if(c.propList){var F=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),x(e)?n=e:b(e)&&(n=e.level,null!=e.position?t=yt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;x(l.x)&&(t.pan.x=l.x,o=!1),x(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(v(e)){var n=e;e=this.mutableElements().filter(n)}else E(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};As.centre=As.center,As.autolockNodes=As.autolock,As.autoungrabifyNodes=As.autoungrabify;var Ls={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ls.attr=Ls.data,Ls.removeAttr=Ls.removeData;var Os=function(e){var t=this,n=(e=L({},e)).container;n&&!w(n)&&w(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==u&&void 0!==n&&!e.headless,o=e;o.layout=L({name:a?"grid":"null"},o.layout),o.renderer=L({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ts(this),listeners:[],aniEles:new ts(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:x(o.zoom)?o.zoom:1,pan:{x:b(o.pan)&&x(o.pan.x)?o.pan.x:0,y:b(o.pan)&&x(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var c=L({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(T))return vr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(b(e)||m(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=L({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,y(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(E(n.roots))e=n.roots;else if(m(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){je("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var L=0;L0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*i;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ws(e){this.options=L({},Xs,e)}Ws.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Hs,Ks={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gs(e){this.options=L({},Ks,e)}Gs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(rl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),xe(t)):(gl(r,e),s())}()}else{for(;u;)u=o(l),l++;gl(r,e),s()}return this},Zs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Zs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var $s=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},Js=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=ll(e,i,a),d=ll(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},sl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ll=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},ul=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},dl=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},fl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yl(e){this.options=L({},vl,e)}yl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=qt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=jt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ue(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Yt(e,t,T))return v(n),!0}else if(Lt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=_t({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-a.ang):Math.PI+a.ang),Zl(t,n,Ul),zl=Gl.nx*Ul.ny-Gl.ny*Ul.nx,Il=Gl.nx*Ul.nx-Gl.ny*-Ul.ny,Ol=Math.asin(Math.max(-1,Math.min(1,zl))),Math.abs(Ol)<1e-6)return Bl=t.x,Nl=t.y,void(Vl=jl=0);Al=1,Ll=!1,Il<0?Ol<0?Ol=Math.PI+Ol:(Ol=Math.PI-Ol,Al=-1,Ll=!0):Ol>0&&(Al=-1,Ll=!0),jl=void 0!==t.radius?t.radius:r,Rl=Ol/2,ql=Math.min(Gl.len/2,Ul.len/2),i?(Fl=Math.abs(Math.cos(Rl)*jl/Math.sin(Rl)))>ql?(Fl=ql,Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))):Vl=jl:(Fl=Math.min(ql,jl),Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))),Wl=t.x+Ul.nx*Fl,Hl=t.y+Ul.ny*Fl,Bl=Wl-Ul.ny*Vl*Al,Nl=Hl+Ul.nx*Vl*Al,Yl=t.x+Gl.nx*Fl,Xl=t.y+Gl.ny*Fl,Kl=t};function Ql(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Jl(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($l(e,t,n,r,i),{cx:Bl,cy:Nl,radius:Vl,startX:Yl,startY:Xl,stopX:Wl,stopY:Hl,startAngle:Gl.ang+Math.PI/2*Al,endAngle:Ul.ang-Math.PI/2*Al,counterClockwise:Ll})}var eu={};function tu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var C,S="vertical"===u,P=S?E:w,D=S?b:m,T=Et(D),_=!1;(k&&(h||f)||!("downward"===c&&D<0||"upward"===c&&D>0||"leftward"===c&&D>0||"rightward"===c&&D<0)||(P=(T*=-1)*Math.abs(P),_=!0),h)?C=(p<0?1+p:p)*P:C=(p<0?P:0)+p*T;var M=function(e){return Math.abs(e)=Math.abs(P)},B=M(C),N=M(Math.abs(P)-Math.abs(C));if((B||N)&&!_)if(S){var z=Math.abs(D)<=a/2,I=Math.abs(m)<=o/2;if(z){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(I){var R=(r.y1+r.y2)/2,V=r.x1,F=r.x2;n.segpts=[V,R,F,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(D)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(S){var U=r.y1+C+(l?a/2*T:0),Z=r.x1,$=r.x2;n.segpts=[Z,U,$,U]}else{var Q=r.x1+C+(l?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}if(n.isRound){var te=e.pstyle("taxi-radius").value,ne="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(te),n.isArcRadius=new Array(n.segpts.length/2).fill(ne)}},eu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!x(n.startX)||!x(n.startY),v=!x(n.arrowStartX)||!x(n.arrowStartY),y=!x(n.endX)||!x(n.endY),m=!x(n.arrowEndX)||!x(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=kt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Ct(H,bt(t)),G=Ct(H,bt(W)),U=K;if(G2)Ct(H,{x:W[2],y:W[3]})0){var le=c,ue=Ct(le,bt(t)),ce=Ct(le,bt(se)),de=ue;if(ce2)Ct(le,{x:se[2],y:se[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=Tt(0,C,1),t=Dt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=Tt(0,r-.001,1),a=Tt(0,r+.001,1),o=Dt(e,t,n,i),s=Dt(e,t,n,a);return su(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,P,D,T,_=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-P)/S;N=Tt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=kt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(D,T,N),l=su(D,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},au.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},au.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ue(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ze(n.rstyle,"labelWidth",t,d),Ze(n.rscratch,"labelWidth",t,d),Ze(n.rstyle,"labelHeight",t,h),Ze(n.rscratch,"labelHeight",t,h),Ze(n.rscratch,"labelLineHeight",t,c)},au.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ze(n.rscratch,e,t,r),r):Ue(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=l(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,i).widthD)break;T+=i[M],M===i.length-1&&(_=!0)}return _||(T+="…"),T}return i},au.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},au.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=Te(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:b[0]*s,y:b[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var z={x:0,y:0};if(x(b[0])&&x(b[1])&&(z.x+=b[0],z.y+=b[1],N)){var I=e.hoverData.dragDelta;I&&x(I[0])&&x(I[1])&&(z.x+=I[0],z.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=bt(h),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=i(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),b=!1,t.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(i,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(i,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Rt(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(Xt(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Xt(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Yt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Kt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Kt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},gu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Jt(3,0)),this.generateRoundPolygon("round-triangle",Jt(3,0)),this.generatePolygon("rectangle",Jt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Jt(5,0)),this.generateRoundPolygon("round-pentagon",Jt(5,0)),this.generatePolygon("hexagon",Jt(6,0)),this.generateRoundPolygon("round-hexagon",Jt(6,0)),this.generatePolygon("heptagon",Jt(7,0)),this.generateRoundPolygon("round-heptagon",Jt(7,0)),this.generatePolygon("octagon",Jt(8,0)),this.generateRoundPolygon("round-octagon",Jt(8,0));var r=new Array(20),i=tn(5,0),a=tn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},wu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;t(this,e),this.idsByKey=new $e,this.keyForId=new $e,this.cachesByLvl=new $e,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Je,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new $e,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Eu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ku=He({getKey:null,doesEleInvalidateKey:Le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=ku(t);L(this,n),this.lookup=new wu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=Eu,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rt((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(wt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=a.getElement(e,t,n,D,Eu.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ke(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ke(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ge(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ke(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Eu.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=Ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Ke(this.onDequeues,e)},Su.setupDequeueing=xu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ke(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=_t();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!Ot(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=we(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=we(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ke(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},k=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},C=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var S="yes"===t.pstyle("ghost").value;if(S){var P=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(P,D),b(_),k(_),e.translate(-P,-D)}else x();E(),b(),k(),w(),C(),n&&e.translate(l.x1,l.y1)}}},Wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xu.drawEdgeOverlay=Wu("overlay"),Xu.drawEdgeUnderlay=Wu("underlay"),Xu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Ku.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(wt(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Ku.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ku.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ue(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ku.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ue(o,"labelX",n),d=Ue(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ue(o,"labelWidth",n),v=Ue(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),T=2;if(E>0||C>0&&k>0){var _=c-S;switch(x){case"left":_-=g;break;case"center":_-=g/2}var M=d-v-S,B=g+2*S,N=v+2*S;if(E>0){var z=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",D?Gu(e,_,M,B,N,T):e.fillRect(_,M,B,N),e.fillStyle=z}if(C>0&&k>0){var A=e.strokeStyle,L=e.lineWidth,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*s+")",e.lineWidth=C,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?Gu(e,_,M,B,N,T,"stroke"):e.strokeRect(_,M,B,N),"double"===R){var V=C/2;D?Gu(e,_+V,M+V,B-2*V,N-2*V,T,"stroke"):e.strokeRect(_+V,M+V,B-2*V,N-2*V)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=A}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var j=Ue(o,"labelWrapCachedLines",n),q=Ue(o,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-g:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=g))),w){case"top":d-=(j.length-1)*q;break;case"center":case"bottom":d-=(j.length-1)*q}for(var W=0;W0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=q}else F>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(x(d.x)&&x(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),k=0,C=0;C0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;l.colorStrokeStyle(e,F[0],F[1],F[2],t)},G=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=_e("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},U=t.pstyle("shape").strValue,Z=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var $=G(r,i,U,Z);h=$.path,v=$.cacheHit}var Q=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i,X,c)}g?e.fill(h):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i,X,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},ne=function(){if(_>0){if(e.lineWidth=_,e.lineCap=I,e.lineJoin=z,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=O;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===N){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var a=l.getNodeShape(t),o=_;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,u=(r+o+(V+Y))/r,c=(i+o+(V+Y))/i,h=r*u,p=i*c,f=l.nodeShapes[a].points;if(g)s=G(h,p,a,f).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+Y+V):"round-heptagon"===a?(v=1.075*(o+Y+V),m=-(o/2+Y+V)/35):"round-hexagon"===a?v=1.12*(o+Y+V):"round-pentagon"===a?(v=1.13*(o+Y+V),m=-(o/2+Y+V)/15):"round-tag"===a?(v=1.12*(o+Y+V),y=.07*(o/2+V+Y)):"round-triangle"===a&&(v=(o+Y+V)*(Math.PI/2),m=-(o+Y/2+V)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=h/2,x=p/2,w=(X="auto"===X?rn(h,p):X)+(o+V+Y)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Uu.drawNodeOverlay=Zu("overlay"),Uu.drawNodeUnderlay=Zu("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var $u={};$u.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},$u.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Qu={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},ac.png=function(e){return sc(e,this.bufferCanvasImage(e),"image/png")},ac.jpg=function(e){return sc(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},uc=dc,cc=dc.prototype;function dc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(cc.CANVAS_LAYERS),contexts:new Array(cc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cc.CANVAS_LAYERS),bufferCanvases:new Array(cc.BUFFER_COUNT),bufferContexts:new Array(cc.CANVAS_LAYERS)};t.data.canvasContainer=n.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};c&&c.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var o=0;o{var m2={"explorer-head.mustache":` + + + + +{{{pageTitle}}} · {{{siteTitle}}} + + + + + +
    + {{{siteTitle}}} model explorer + + + +
    +
    + +`,"explorer-foot.mustache":`
    +
    Built from explorer.json by the metaobjects docs-site generator{{#stamp}} · {{{stamp}}}{{/stamp}}. Static: no server, no LLM call.
    + +{{#needsGraph}}{{/needsGraph}} + + + +`,"explorer-card.mustache":`
    +

    {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}{{{verdictHtml}}}

    +
    {{{statement}}}
    +
    {{{barHtml}}}
    {{{countsLine}}}
    + {{#hasChildren}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{glyphHtml}}}
    • {{/children}}
    {{/hasChildren}} +
    Summary from the levels below
    No summary is generated in this build.
    +
    +`,"explorer-overview.html.mustache":`

    {{{heading}}}

    +
    Built from {{{sourcesLine}}}. Every number below is computed from the project's metadata or the gate's own output.
    +
    +{{#tiles}}
    {{{n}}}
    {{{l}}}
    +{{/tiles}}
    +{{#hasRequirements}}{{{legendHtml}}}{{/hasRequirements}} +{{#hasRequirements}} +

    Features requirement.functional, by level

    +{{#hasFeatures}}
    +{{#featureCards}}{{> card}}{{/featureCards}} +
    {{/hasFeatures}} +{{^hasFeatures}}
    No requirement.functional is declared.
    {{/hasFeatures}} +

    Qualities requirement.architectural, the non-functional policies

    +{{#hasQualities}}
    +{{#qualityCards}}{{> card}}{{/qualityCards}} +
    {{/hasQualities}} +{{^hasQualities}}
    No requirement.architectural is declared.
    {{/hasQualities}} +{{/hasRequirements}} +{{^hasRequirements}} +
    This model declares no requirements yet, so this page cannot say what each part is for. Declare requirement.functional entries (levels 1 to 3 for the problem, 4 and 5 naming the model) and this page opens on them, with every entity traced to the feature it serves.
    +{{/hasRequirements}} +

    Packages what the model holds

    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-map.html.mustache":`

    Model map

    +
    Entities and the references between them. A slice is the set of model nodes a requirement subtree claims, a package holds, or a prompt reads and returns.
    +
    + + + + + + +
    +
    Click a node to see why it exists, what it holds and what was generated from it. Double-click to open its page.
    +
    + +`,"explorer-object.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}{{#isReadOnly}}read-only view{{/isReadOnly}}{{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}} · {{{storageLine}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#projection}} +

    Read model

    +
    + {{#basesHtml}}
    Surfaces fields of {{{basesHtml}}}.
    {{/basesHtml}} + {{#hasOrigins}}
    {{#origins}}{{/origins}}
    FieldOriginDefinition
    {{{field}}}{{{origin}}}{{{definitionHtml}}}
    {{/hasOrigins}} +
    + {{/projection}} + {{#report}} +

    Report

    +
    + {{#fromHtml}}{{/fromHtml}} + {{#spineHtml}}{{/spineHtml}} + {{#dimensionsHtml}}{{/dimensionsHtml}} + {{#measuresHtml}}{{/measuresHtml}} + {{#segmentHtml}}{{/segmentHtml}} + {{#filterHtml}}{{/filterHtml}} +
    From{{{fromHtml}}}
    Spine{{{spineHtml}}}
    Dimensions{{{dimensionsHtml}}}
    Measures{{{measuresHtml}}}
    Segment{{{segmentHtml}}}
    Filter{{{filterHtml}}}
    + {{/report}} + {{#hasFields}}

    Fields

    +
    {{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{#fields}}{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{/fields}}
    FieldTypeColumnFlagsClaimed at L5
    {{{name}}} {{{inheritedHtml}}}{{{type}}}{{{refHtml}}}{{{valuesHtml}}}{{{column}}}{{{flagsHtml}}}{{{claimsHtml}}}
    {{/hasFields}} + {{#hasKeys}}

    Keys and references

    +
    {{#keys}}{{/keys}}
    {{{kind}}} {{{name}}} {{{inheritedHtml}}}{{{shape}}}{{{targetHtml}}}
    {{/hasKeys}} + {{#hasReporting}}

    Reporting vocabulary

    +
    {{#reporting}}{{/reporting}}
    NameKindDefinition
    {{{name}}}{{{kind}}}{{{definitionHtml}}}
    {{/hasReporting}} + {{#hasLayouts}}

    Screens declared

    {{#layouts}}
    {{{kind}}} {{{name}}}{{#detailHtml}}: {{{detailHtml}}}{{/detailHtml}}
    {{/layouts}}{{/hasLayouts}} +
    + +
    +`,"explorer-node.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#hasAttrs}}

    Attributes

    +
    {{#attrs}}{{/attrs}}
    @{{{name}}}{{{valueHtml}}}
    {{/hasAttrs}} + {{#hasMembers}}

    Members

    +
    + {{#members}} + {{/members}}
    NameTypeAttributes
    {{{nameHtml}}}{{#below}} +{{below}}{{/below}}{{{kind}}}{{{attrsHtml}}}
    {{/hasMembers}} +
    + +
    +`,"explorer-prompt.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{attrsHtml}}}
    +
    +
    +

    Payload: {{{payloadHtml}}}

    + {{#hasPayload}}
    {{#payloadRows}}{{/payloadRows}}
    FieldTypeUsed in text
    {{{name}}} {{{requiredHtml}}}{{{type}}}{{{refHtml}}}{{{usedHtml}}}
    {{/hasPayload}} + {{^hasPayload}}
    No payload: the text renders from nothing typed.
    {{/hasPayload}} +

    Reply: {{{replyHtml}}}

    + {{#hasReply}}
    {{#replyRows}}{{/replyRows}}
    FieldType
    {{{name}}}{{{type}}}{{{valuesHtml}}}
    {{/hasReply}} + {{^hasReply}}
    Outbound only: no reply parser.
    {{/hasReply}} +

    Why it exists

    + {{#hasWhy}}
    {{#whyRows}}{{/whyRows}}
    CapabilityRequirementLevelStatus
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} +
    +
    +

    Text {{{textMeta}}}

    + {{#hasText}}
    {{{textHtml}}}
    {{/hasText}} + {{^hasText}}
    The text {{{textRef}}} was not found beside the model, so this page cannot show it.
    {{/hasText}} +

    Generated

    + {{#hasGenerated}}{{#generated}}
    {{{generator}}}{{#files}}
    {{{.}}}
    {{/files}}
    {{/generated}}{{/hasGenerated}} + {{^hasGenerated}}
    {{{generatedNote}}}
    {{/hasGenerated}} +
    Proven today: meta verify --templates fails if the text names a variable the payload lacks. This page shows the other direction too: payload fields the text never uses.
    +
    +
    +`,"explorer-prompts.html.mustache":`

    Prompts

    +
    Each declared template, its typed payload, its reply type, and the requirements that claim it.
    +{{#hasRows}}
    +{{#rows}} +{{/rows}}
    TemplatePayloadReplyClaimed by
    {{{linkHtml}}} {{{kind}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{payloadHtml}}}{{{replyHtml}}}{{{claimsHtml}}}
    {{/hasRows}} +{{^hasRows}}
    This model declares no template.*.
    {{/hasRows}} +`,"explorer-requirements.html.mustache":`

    Requirements

    +
    Hierarchy is nesting. L1 to L3 describe the problem; only L4 (an object or prompt) and L5 (a member) may name the model.
    + +{{{legendHtml}}} +{{#hasTree}}
    {{{treeHtml}}}
    {{/hasTree}} +{{^hasTree}}
    {{{emptyNote}}}
    {{/hasTree}} +`,"explorer-requirement.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{levelHtml}}}{{{name}}} {{{statusHtml}}}{{{dispositionHtml}}}{{{verdictHtml}}}

    + +
    {{{address}}}
    +
    +
    +

    Statement

    {{{statement}}}

    Counterexample

    {{{counterexample}}}{{#hasDescription}}

    Scope

    {{{description}}}
    {{/hasDescription}}
    +

    Implemented by

    + {{#hasLinks}}
    {{#linkRows}}{{/linkRows}}
    ReferenceKindResolves
    {{{refHtml}}}{{{kind}}}{{{resolvesHtml}}}
    {{/hasLinks}} + {{^hasLinks}}
    {{{linksEmpty}}}
    {{/hasLinks}} + {{#hasBelow}}

    Below ({{childCount}}){{#deeper}} {{belowCount}} in all{{/deeper}}

    {{{belowBarHtml}}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}
    • {{/children}}
    {{/hasBelow}} +
    {{#sliceHref}}Show this slice on the model map{{/sliceHref}}{{#sliceHref}}{{#traceHref}} · {{/traceHref}}{{/sliceHref}}{{#traceHref}}Trace to code{{/traceHref}}
    +
    +
    +

    What the build proves about this entry

    +
    {{#proof}}{{/proof}}
    {{{what}}}{{{verdictHtml}}}{{{howHtml}}}
    + {{#trackedHtml}}

    Tracked by

    {{{trackedHtml}}}{{/trackedHtml}} + {{#digest}}

    Statement digest

    {{{digest}}}
    Moves when the statement changes; a summary of this entry would be pinned to it.
    {{/digest}} +
    +
    +`,"explorer-matrix.html.mustache":`

    Traceability matrix

    +
    Rows are requirements that name the model; columns are stored entities and prompts, most claimed first. An empty column is a node nothing claims; a cell's colour and glyph are the row's declared status.
    +{{#hasRows}}
    {{{legendHtml}}}
    +
    {{{tableHtml}}}
    {{/hasRows}} +{{^hasRows}}
    {{#hasRequirements}}No requirement names the model yet: only L4 and L5 entries do.{{/hasRequirements}}{{^hasRequirements}}This model declares no requirements, so there is nothing to trace.{{/hasRequirements}}
    {{/hasRows}} +`,"explorer-trace.html.mustache":`

    Trace

    +
    From intent to code: requirement levels, then the model nodes they name, then the files generated from those nodes.
    +{{#hasStarts}}
    + +
    Hand-written modules that import the generated files are not scanned in this build, so the trace stops at the generated files. Click a requirement or a model node to open its page.
    {{/hasStarts}} +{{^hasStarts}}
    This model declares no requirements, so there is nothing to trace from. Every object's generated files are listed on its own page.
    {{/hasStarts}} +`,"explorer-gaps.html.mustache":`

    Gaps

    +
    What the model and the gate can already point at. Each card says whether it comes from the shipped gate or is a check this explorer adds.
    +
    +{{#cards}}

    {{{title}}} {{{count}}} {{{source}}}

    {{{whyHtml}}}
    {{{bodyHtml}}}
    +{{/cards}}
    +`,"explorer-api.html.mustache":`

    API

    +{{#recorded}}
    Every route the generated code mounts, by the object it serves: {{{summary}}}.
    +{{#hasGroups}}
    {{#groups}}

    {{{linkHtml}}} {{{kind}}}{{#isReadOnly}} read-only{{/isReadOnly}}

    {{#routes}}
    {{{method}}} {{{path}}}
    {{/routes}}
    {{/groups}}
    {{/hasGroups}} +{{^hasGroups}}
    The run generated no routes.
    {{/hasGroups}}{{/recorded}} +{{^recorded}}
    The run that built this site recorded no routes: it generated none, or ran without the routes generator.
    {{/recorded}} +`,"explorer-model.html.mustache":`

    Packages

    +
    Every package in the model and what it declares.
    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-package.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}}

    +
    +{{#rows}} +{{/rows}}
    NameKindStorageFieldsClaim
    {{{linkHtml}}} {{{abstractHtml}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{kind}}}{{{storage}}}{{fieldCount}}{{{statusHtml}}}
    +`};/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.css b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.css new file mode 100644 index 0000000000..aae678b023 --- /dev/null +++ b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.css @@ -0,0 +1,232 @@ +/* The model explorer's theme. `meta eject docs-site` copies this file to + codegen/docs-site/assets/, where an edit wins over the bundled copy. + + Colour rules (design report §4.2), which the classes below keep apart: + .s- a DECLARED status: filled chip, with its glyph in the text + .v- a GATE verdict: an outline (ring), never a fill + .bar .b-* a ROLL-UP of what sits below: a separate stacked bar + No class here colours a test result. */ + +:root { + --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f23; --muted: #5f6670; --line: #e2e3e0; + --accent: #3b5bdb; --accent-soft: #e8ecfd; --accent-ink: #ffffff; + --live: #2f9e44; --live-soft: #e3f5e7; --partial: #e8890c; --partial-soft: #fdf0dc; + --planned: #4c6ef5; --planned-soft: #e9edff; --retired: #868e96; --retired-soft: #eef0f2; + --bad: #e03131; --bad-soft: #fde8e8; --warn: #e8890c; --code: #f1f2ef; + --entity: #495057; --value: #7048e8; --prompt: #0c8599; --projection: #1971c2; --report: #c2255c; + --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); + --shadow-lift: 0 4px 14px rgba(16, 24, 40, .10); + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; + } +} +:root[data-theme="dark"] { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; +} + +* { box-sizing: border-box; } +html { -webkit-text-size-adjust: 100%; } +body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; } +code { background: var(--code); border-radius: 4px; padding: 0 4px; } +code.digest { display: block; overflow-wrap: anywhere; font-size: 11.5px; padding: 4px 6px; } +pre code, .mono code { background: none; padding: 0; } + +/* ── Header ─────────────────────────────────────────────────────────────── */ +header.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: center; padding: 10px 20px; flex-wrap: wrap; } +.brand { font-weight: 700; letter-spacing: .2px; color: var(--ink); white-space: nowrap; } +.brand:hover { text-decoration: none; } +.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; } +.nav { display: flex; gap: 4px; flex-wrap: wrap; } +.nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; } +.nav a:hover { background: var(--code); text-decoration: none; } +.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; } +#search { margin-left: auto; position: relative; } +#search input { width: 260px; max-width: 60vw; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; } +#search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); } +#results { position: absolute; right: 0; top: 36px; width: 420px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lift); display: none; } +#results a { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); } +#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; } +#results a small { color: var(--muted); display: block; } +#results .none { padding: 8px 12px; color: var(--muted); } +#theme { padding: 5px 9px; } + +/* ── Page ───────────────────────────────────────────────────────────────── */ +main { padding: 24px 20px 20px; max-width: 1400px; margin: 0 auto; } +h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } +h2 { font-size: 16px; margin: 26px 0 10px; } +h3 { font-size: 14px; margin: 16px 0 6px; } +h3.first { margin-top: 0; } +.h-sub { color: var(--muted); font-weight: 400; } +.sub { color: var(--muted); } +.small { font-size: 12px; } +.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; } +.meta-line { margin-top: 4px; } +.page { margin-top: 14px; } +.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; } +.grid { display: grid; gap: 12px; } +.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; } +a.tile { color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; } +a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); } +.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; } +.tile .l { color: var(--muted); font-size: 12.5px; line-height: 1.4; } +.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +.apis { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } +@media (max-width: 1000px) { .side { grid-template-columns: minmax(0, 1fr); } } +@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } } + +table { border-collapse: collapse; width: 100%; } +th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } +th { font-size: 12px; color: var(--muted); font-weight: 600; } +tr:target td { background: var(--accent-soft); } +table.kv th { width: 120px; } +.tablewrap { overflow-x: auto; } + +/* ── Status, verdict and roll-up ────────────────────────────────────────── */ +.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0; font-weight: 500; line-height: 1.6; } +h1 .chip { font-size: 12.5px; } +.s-live { background: var(--live-soft); color: var(--live); border-color: transparent; } +.s-partial { background: var(--partial-soft); color: var(--partial); border-color: transparent; } +.s-planned { background: var(--planned-soft); color: var(--planned); border-color: transparent; } +.s-retired { background: var(--retired-soft); color: var(--retired); border-color: transparent; text-decoration: line-through; } +.v-error, .v-unclaimed { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); } +.v-warn { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); } +.glyph { font-size: 12px; } +.g-live { color: var(--live); } .g-partial { color: var(--partial); } .g-planned { color: var(--planned); } .g-retired { color: var(--retired); } +.lvl { display: inline-block; min-width: 24px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; background: var(--code); color: var(--muted); padding: 0 4px; margin-right: 6px; line-height: 18px; } +h1 .lvl { font-size: 12px; line-height: 22px; } +.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--code); min-width: 80px; } +.bar span { display: block; height: 100%; } +.b-live { background: var(--live); } .b-partial { background: var(--partial); } .b-planned { background: var(--planned); } .b-retired { background: var(--retired); } +.minibar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 4px; } +.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin: 4px 0; } +.legend-row { margin: 10px 0; } +.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; } +.pill.gate { color: var(--accent); border-color: var(--accent); } +a.k-entity { color: var(--accent); font-weight: 500; } +span.k-entity { color: var(--entity); } .k-value { color: var(--value); } .k-prompt, .k-template { color: var(--prompt); } +.k-projection { color: var(--projection); } .k-report { color: var(--report); } +.kdot { font-size: 10px; } +.kdot.k-entity { color: var(--entity); } .kdot.k-value { color: var(--value); } .kdot.k-prompt { color: var(--prompt); } +.k-badge { color: var(--projection); } +.vals { color: var(--muted); font-size: 11.5px; } + +/* ── S1 cards ───────────────────────────────────────────────────────────── */ +.cap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; } +.cap .card h3 { margin-top: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.capcard .statement { margin: 2px 0 0; } +.rollup { margin: 10px 0 4px; } +.rollup .sub { margin-top: 3px; } +ul { padding-left: 18px; margin: 6px 0; } +.cap li, .kids li { margin: 4px 0; } +.members { margin-top: 8px; line-height: 1.9; } +details.summary { margin-top: 6px; } +details > summary { cursor: pointer; color: var(--muted); font-size: 12px; } +.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; } +.note.intro { margin: 4px 0 8px; font-size: 13.5px; } + +/* ── S5 tree ────────────────────────────────────────────────────────────── */ +.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } +.tabs a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); } +.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } +.tree { margin-top: 10px; } +.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 8px; } +.tree > ul { border-left: none; padding-left: 0; margin-left: 0; } +.tree li { margin: 4px 0; } +.tree .row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } +.tree .stmt { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-left: 30px; } + +/* ── Graphs ─────────────────────────────────────────────────────────────── */ +.graph { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; } +#cy { height: 640px; } #cymini { height: 260px; } #cytrace { height: 680px; } +.panel h3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.maplegend { margin-top: 8px; } +.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } +select, button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; max-width: 100%; } +button { cursor: pointer; } +button:hover { border-color: var(--accent); } +.layout, .gen, .route { margin: 4px 0; } +.gen .pill { margin-left: 0; } + +/* ── S4 text ────────────────────────────────────────────────────────────── */ +pre { background: var(--code); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; } +pre.text { max-height: 560px; } +.var { color: var(--prompt); } + +/* ── S6 proof ───────────────────────────────────────────────────────────── */ +.proof { font-size: 12.5px; } +.proof td:first-child { white-space: nowrap; font-weight: 500; } + +/* ── S7 matrix ──────────────────────────────────────────────────────────── */ +.mx { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } +.mx table { width: auto; border-collapse: separate; border-spacing: 0; } +/* The header row is sticky as a whole: a sticky cell per column would paint over the slanted + label of the column before it. */ +.mx thead { position: sticky; top: 0; z-index: 2; background: var(--panel); } +.mx th.col { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 0; } +.mx th.col.corner { position: sticky; left: 0; background: var(--panel); } +.mx th.col div { transform: rotate(-60deg); transform-origin: left bottom; width: 18px; margin-left: 12px; font-weight: 500; font-size: 11.5px; max-width: 18px; } +.mx th.col div a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +.mx th.col.unc div a { color: var(--bad); } +.mx td.c { width: 20px; min-width: 20px; height: 22px; padding: 0; text-align: center; font-size: 11px; border-right: 1px solid var(--line); } +.mx td.rh { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; } +.mx tr.grp td { background: var(--code); font-weight: 600; } +.mx td.c.live { background: var(--live-soft); } .mx td.c.planned { background: var(--planned-soft); } +.mx td.c.partial { background: var(--partial-soft); } .mx td.c.retired { background: var(--retired-soft); } + +/* ── S9 gaps, API ───────────────────────────────────────────────────────── */ +.gap h3 { display: flex; gap: 8px; align-items: center; margin-top: 0; flex-wrap: wrap; } +.gap .why { margin-bottom: 8px; } +.count { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--code); } +.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 4px; padding: 1px 4px; background: var(--code); color: var(--muted); } +.m-GET, .m-get { background: var(--live-soft); color: var(--live); } +.m-POST, .m-post { background: var(--planned-soft); color: var(--planned); } +.m-PUT, .m-put, .m-PATCH, .m-patch { background: var(--partial-soft); color: var(--partial); } +.m-DELETE, .m-delete { background: var(--bad-soft); color: var(--bad); } + +footer { color: var(--muted); font-size: 12px; padding: 24px 20px; text-align: center; } + +/* ── Phone ──────────────────────────────────────────────────────────────── */ +@media (max-width: 700px) { + header.top { gap: 8px 12px; padding: 10px 16px; } + .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } + .nav::-webkit-scrollbar { display: none; } + #search { order: 4; margin-left: 0; flex-basis: 100%; } + #search input { width: 100%; max-width: none; } + #results { left: 0; right: 0; width: auto; max-width: none; } + #theme { margin-left: auto; } + main { padding: 16px; } + h1 { font-size: 20px; } + .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .tile .n { font-size: 22px; } + .cap { grid-template-columns: minmax(0, 1fr); } + .apis { grid-template-columns: minmax(0, 1fr); } + #cy { height: 440px; } #cytrace { height: 520px; } + .mx { max-height: none; } + /* A wide table scrolls inside its own box, never the page. */ + main table { display: block; max-width: 100%; overflow-x: auto; } + .mx table { display: table; max-width: none; } + .tree .stmt { margin-left: 0; } + .tree ul { padding-left: 12px; margin-left: 4px; } +} +@media print { header.top, #search, #theme, .toolbar { display: none; } .card { box-shadow: none; } } diff --git a/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.js b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.js new file mode 100644 index 0000000000..61c4153d2e --- /dev/null +++ b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer.js @@ -0,0 +1,332 @@ +// The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. +// `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. +(function () { + "use strict"; + function run() { + var APP = window.MO_APP || null; + var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; + var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; + var $ = function (s, r) { return (r || document).querySelector(s); }; + var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; + var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; + var STATUS = ["live", "partial", "planned", "retired"]; + var GLYPH = { live: "●", partial: "◐", planned: "○", retired: "⊘" }; + var PAL = ["#1971c2", "#e8590c", "#2b8a3e", "#ae3ec9", "#c2255c", "#0b7285", "#5c940d", "#f08c00"]; + var byId = {}; + D.nodes.forEach(function (n) { byId[n.id] = n; }); + var reqById = {}; + D.reqs.forEach(function (r) { reqById[r.id] = r; }); + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; + var redraw = []; + + // ── Theme ─────────────────────────────────────────────────────────────── + var themeBtn = $("#theme"); + if (themeBtn) themeBtn.onclick = function () { + var cur = document.documentElement.getAttribute("data-theme"); + var dark = cur ? cur === "dark" : matchMedia("(prefers-color-scheme: dark)").matches; + var next = dark ? "light" : "dark"; + document.documentElement.setAttribute("data-theme", next); + try { localStorage.setItem("mo-theme", next); } catch (e) { /* private window: the toggle still works for this page */ } + redraw.forEach(function (f) { f(); }); + }; + + // ── Search ────────────────────────────────────────────────────────────── + // The built-in index ships in explorer-data.js and works from file://. When the site has been + // indexed with Pagefind (`npx pagefind --site `) and is served over http, Pagefind's + // full-text index answers instead. + var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; + function loadPagefind() { + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + pagefindTried = true; + // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every + // result URL carry the path the site is served under (a sub-path included). + var url = new URL(ROOT + "pagefind/pagefind.js", location.href).href; + return fetch(url, { method: "HEAD" }).then(function (r) { + if (!r.ok) return null; + return import(url).then(function (m) { pagefind = m; return m; }); + }).catch(function () { return null; }); + } + function show(items) { + sel = -1; + res.innerHTML = items.length ? items.map(function (x) { return '' + esc(x.t) + "" + esc(x.s) + ""; }).join("") : '
    No match
    '; + res.style.display = "block"; + } + function builtIn(v) { + var words = v.split(/\s+/).filter(Boolean); + return D.search.filter(function (x) { return words.every(function (w) { return x.k.indexOf(w) >= 0; }); }) + .sort(function (a, b) { return (a.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1) - (b.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1); }) + .slice(0, 25).map(function (x) { return { t: x.t, s: x.s, h: href(x.h) }; }); + } + if (q && res) { + q.addEventListener("input", function () { + var v = q.value.trim().toLowerCase(); + if (!v) { res.style.display = "none"; return; } + show(builtIn(v)); + loadPagefind().then(function (pf) { + if (!pf || q.value.trim().toLowerCase() !== v) return; + pf.search(v).then(function (r) { + return Promise.all(r.results.slice(0, 12).map(function (x) { return x.data(); })); + }).then(function (rows) { + if (q.value.trim().toLowerCase() !== v || !rows.length) return; + show(rows.map(function (d) { return { t: (d.meta && d.meta.title) || d.url, s: (d.excerpt || "").replace(/<[^>]+>/g, ""), h: d.url }; })); + }).catch(function () { /* keep the built-in results */ }); + }); + }); + q.addEventListener("keydown", function (e) { + var links = res.querySelectorAll("a"); + if (e.key === "ArrowDown" || e.key === "ArrowUp") { + e.preventDefault(); + sel = Math.max(0, Math.min(links.length - 1, sel + (e.key === "ArrowDown" ? 1 : -1))); + links.forEach(function (a, i) { a.classList.toggle("sel", i === sel); }); + } else if (e.key === "Enter" && links.length) { + location.href = links[Math.max(0, sel)].href; + } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } + }); + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { + if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } + }); + } + + if (typeof window.cytoscape !== "function") { + document.querySelectorAll(".graph").forEach(function (g) { + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; + }); + return; + } + + // ── Colours ───────────────────────────────────────────────────────────── + // Fill: the kind, the feature, or the DECLARED status of the claims on a node. + // Ring: a gate verdict (unclaimed). Never a test result. + function kindColour(n) { + return css({ entity: "--entity", value: "--value", prompt: "--prompt", template: "--prompt", projection: "--projection", report: "--report" }[n.kind] || "--entity"); + } + function fill(n, mode) { + if (n.abstract) return css("--retired"); + if (mode === "kind") return kindColour(n); + if (mode === "api") return n.api.length ? css("--accent") : css("--retired-soft"); + if (mode === "claims") return n.claims > 8 ? css("--live") : n.claims > 2 ? css("--partial") : n.claims > 0 ? css("--planned") : css("--retired-soft"); + if (mode === "cap") return n.feature >= 0 ? PAL[n.feature % PAL.length] : n.quality ? css("--retired") : css("--retired-soft"); + return n.status === "unclaimed" ? css("--retired-soft") : css("--" + n.status); + } + function legend(mode) { + var ring = D.hasClaims ? 'red ring: unclaimed (gate)' : ""; + if (mode === "cap") return '
    ' + D.features.map(function (f, i) { return '● ' + esc(f.label) + ""; }).join("") + '● qualities only○ no claim' + ring + "Fill is the feature (L1) with the most claims on the node; size is fields plus claims.
    "; + if (mode === "status") return '
    ' + STATUS.map(function (s) { return '' + GLYPH[s] + " " + s + ""; }).join("") + '○ no claim' + ring + "Fill is the best declared status among the requirements that claim the node.
    "; + if (mode === "api") return '
    ● mounted routes○ none
    '; + if (mode === "claims") return '
    ● more than 8 claims● 3 to 8● 1 or 2○ none' + ring + "
    "; + return '
    ' + ["entity", "value", "projection", "report", "prompt"].map(function (k) { return '● ' + k + ""; }).join("") + "Abstract bases are dashed and grey.
    "; + } + function shape(n) { return n.kind === "prompt" || n.kind === "template" ? "diamond" : n.kind === "value" ? "round-triangle" : n.kind === "projection" || n.kind === "report" ? "round-hexagon" : n.abstract ? "round-rectangle" : "ellipse"; } + function baseStyle() { + return [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", width: "data(size)", height: "data(size)", shape: "data(shape)", color: css("--ink"), "font-size": 10, "text-valign": "bottom", "text-margin-y": 3, "border-width": 1, "border-color": css("--line"), "text-wrap": "none" } }, + { selector: "node[dashed = 1]", style: { "border-style": "dashed", "border-width": 2, "background-opacity": 0.4 } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[faded = 1]", style: { opacity: 0.18 } }, + { selector: "edge", style: { width: 1.2, "line-color": css("--muted"), "target-arrow-color": css("--muted"), "target-arrow-shape": "triangle", "curve-style": "bezier", "arrow-scale": 0.7, opacity: 0.6 } }, + { selector: "edge[ext = 1]", style: { "line-style": "dashed", "target-arrow-shape": "triangle-tee" } }, + { selector: "edge[faded = 1]", style: { opacity: 0.08 } }, + { selector: ":selected", style: { "border-width": 3, "border-color": css("--accent") } }, + ]; + } + var bar = function (c) { + var t = STATUS.reduce(function (a, s) { return a + (c[s] || 0); }, 0); + if (!t) return '
    '; + return '
    ' + STATUS.filter(function (s) { return c[s]; }).map(function (s) { return ''; }).join("") + "
    "; + }; + var chip = function (s) { return s ? '' + (GLYPH[s] || "") + " " + esc(s) + "" : ""; }; + var nodeLink = function (id) { var n = byId[id]; return n ? '' + esc(n.name) + "" : esc(id); }; + + // ── S2: the model map ─────────────────────────────────────────────────── + // cose from a grid (not from one point) gives the same picture on every load. + var COSE = { name: "cose", animate: false, randomize: false, nodeRepulsion: 12000, nodeOverlap: 24, idealEdgeLength: 90, componentSpacing: 90, gravity: 0.6, padding: 24, nodeDimensionsIncludeLabels: true }; + function seedGrid(els) { + var nodes = els.filter(function (e) { return !e.data.source; }), cols = Math.ceil(Math.sqrt(nodes.length || 1)); + nodes.forEach(function (e, i) { e.position = { x: (i % cols) * 120, y: Math.floor(i / cols) * 100 }; }); + } + var cyEl = $("#cy"); + if (cyEl) { + var cy = null; + var params = new URLSearchParams(query()); + var sliceSel = $("#slice"), colourSel = $("#colour"); + if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); + if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); + var focus = params.get("focus"); + var promptSet = function () { + var s = {}; + D.nodes.forEach(function (n) { if (n.kind === "prompt" || n.kind === "template") s[n.id] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && (e.k === "payloadRef" || e.k === "responseRef")) s[e.t] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && byId[e.s] && byId[e.s].kind === "value" && e.k === "objectRef") s[e.t] = 1; }); + return s; + }; + var build = function (relayout) { + var slice = sliceSel.value, mode = colourSel.value, hide = $("#hideOut").checked, showExt = $("#showExt").checked; + $("#maplegend").innerHTML = legend(mode); + var inSlice = null; + if (slice === "@prompts") inSlice = promptSet(); + else if (slice && D.slices[slice]) { inSlice = {}; D.slices[slice].forEach(function (id) { inSlice[id] = 1; }); } + var showVals = $("#showValues").checked || slice === "@prompts" || (inSlice && Object.keys(inSlice).some(function (id) { return byId[id] && byId[id].kind !== "entity"; })); + var entityCount = D.nodes.filter(function (n) { return n.kind === "entity"; }).length; + if (!entityCount) showVals = true; + var nodes = D.nodes.filter(function (n) { return (n.kind === "entity" || showVals) && (!hide || !inSlice || inSlice[n.id]); }); + var ids = {}; + nodes.forEach(function (n) { ids[n.id] = 1; }); + var els = nodes.map(function (n) { + return { data: { id: n.id, label: n.name, col: fill(n, mode), size: 18 + Math.min(40, n.fields * 1.6 + n.claims * 2), shape: shape(n), faded: inSlice && !inSlice[n.id] ? 1 : 0, dashed: n.abstract, ring: n.unclaimed } }; + }); + D.edges.forEach(function (e, i) { + if (!ids[e.s] || !ids[e.t] || (!showExt && e.k === "extends")) return; + els.push({ data: { id: "e" + i, source: e.s, target: e.t, label: e.v || e.k, ext: e.k === "extends" ? 1 : 0, faded: inSlice && !(inSlice[e.s] && inSlice[e.t]) ? 1 : 0 } }); + }); + seedGrid(els); + var pan = cy && !relayout ? { pos: {} } : null; + if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); + if (cy) cy.destroy(); + var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); + cy = graph({ + container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), + layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, + }); + cy.on("tap", "node", function (ev) { showPanel(ev.target.id()); }); + cy.on("dbltap", "node", function (ev) { var n = byId[ev.target.id()]; if (n) location.href = href(n.href); }); + var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; + if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); + if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); + }; + ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); + $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; + redraw.push(function () { build(false); }); + build(true); + } + function slicePanel(r, nodes) { + return '
    Slice

    ' + (r.level ? "L" + r.level : "—") + '' + esc(r.label) + " " + chip(r.status) + "

    " + esc(r.statement) + "
    " + + "

    " + r.claimed + " model node" + (r.claimed === 1 ? "" : "s") + " claimed below

    " + nodes.map(nodeLink).join(", ") + + "

    Status below

    " + bar(r.rollup); + } + function showPanel(id) { + var n = byId[id], p = $("#panel"); + if (!n || !p) return; + var claims = D.reqs.filter(function (r) { return r.targets.indexOf(id) >= 0; }); + var byTop = {}; + claims.forEach(function (r) { var t = r; while (t.parent && reqById[t.parent]) t = reqById[t.parent]; (byTop[t.id] = byTop[t.id] || []).push(r); }); + var refs = D.edges.filter(function (e) { return e.s === id || e.t === id; }).length; + var gen = (D.generated[id] || []).map(function (g) { return '' + esc(g[0]) + " " + g[1]; }).join(" · "); + p.innerHTML = '
    ' + esc(n.pkg) + " · " + esc(n.kind) + (n.storage ? " · " + esc(n.storage) : "") + "
    " + + '

    ' + nodeLink(id) + (n.unclaimed ? ' unclaimed' : "") + "

    " + + "

    Why it exists (" + claims.length + " claim" + (claims.length === 1 ? "" : "s") + ")

    " + + (claims.length ? Object.keys(byTop).map(function (t) { + return "
    " + esc(reqById[t].label) + ": " + byTop[t].slice(0, 6).map(function (r) { return '' + (GLYPH[r.status] || "") + " " + esc(r.label) + ""; }).join(", ") + (byTop[t].length > 6 ? " +" + (byTop[t].length - 6) : "") + "
    "; + }).join("") : 'No requirement claims this node.') + + "

    Shape

    " + n.fields + " field" + (n.fields === 1 ? "" : "s") + ", " + refs + " reference" + (refs === 1 ? "" : "s") + + (n.api.length ? "

    API

    " + n.api.map(function (a) { return "
    " + esc(a) + "
    "; }).join("") : "") + + "

    Generated

    " + (gen || 'nothing traced'); + } + + // ── S3: the one-hop mini-map ──────────────────────────────────────────── + var mini = $("#cymini"); + if (mini) { + var me = mini.getAttribute("data-node"); + var drawMini = function () { + var es = D.edges.filter(function (e) { return e.s === me || e.t === me; }); + var ids = {}; + ids[me] = 1; + es.forEach(function (e) { ids[e.s] = 1; ids[e.t] = 1; }); + var els = Object.keys(ids).filter(function (id) { return byId[id]; }).sort().map(function (id) { + var n = byId[id]; + return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; + }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); + mini.innerHTML = ""; + var c = graph({ + container: mini, elements: els, maxZoom: 1.3, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[me = 1]", style: { width: 30, height: 30, "border-width": 3, "border-color": css("--accent") } }, + { selector: "edge", style: { width: 1, label: "data(label)", "font-size": 8, color: css("--muted"), "line-color": css("--muted"), "target-arrow-shape": "triangle", "target-arrow-color": css("--muted"), "curve-style": "bezier", "text-rotation": "autorotate", "text-background-color": css("--panel"), "text-background-opacity": 1, "text-background-padding": 2 } }, + ], + layout: { name: "concentric", concentric: function (n) { return n.data("me") ? 2 : 1; }, levelWidth: function () { return 1; }, startAngle: Math.PI, padding: 30, minNodeSpacing: 60 }, + }); + c.on("tap", "node", function (ev) { var n = byId[ev.target.id()]; if (n && n.id !== me) location.href = href(n.href); }); + }; + redraw.push(drawMini); + drawMini(); + } + + // ── S8: the trace ─────────────────────────────────────────────────────── + var tr = $("#cytrace"), tstart = $("#tstart"); + if (tr && tstart) { + var p2 = new URLSearchParams(query()).get("start"); + if (p2 && reqById[p2]) tstart.value = p2; + var drawTrace = function () { + var r0 = reqById[tstart.value]; + if (!r0) return; + var kids = {}; + D.reqs.forEach(function (r) { if (r.parent) (kids[r.parent] = kids[r.parent] || []).push(r); }); + var reqs = [], walk = function (r) { reqs.push(r); (kids[r.id] || []).forEach(walk); }; + walk(r0); + var cols = [[], [], [], []], els = [], seen = {}; + var add = function (id, label, col, data) { if (seen[id]) return; seen[id] = 1; cols[col].push(id); data.id = id; data.label = label; els.push({ data: data }); }; + reqs.forEach(function (r) { add("r:" + r.id, (r.level ? "L" + r.level + " " : "") + r.label, r.level >= 4 ? 1 : 0, { col: r.status ? css("--" + r.status) : css("--muted"), shape: "round-rectangle", go: r.href }); }); + reqs.forEach(function (r) { if (r.parent && seen["r:" + r.parent]) els.push({ data: { id: "pe:" + r.id, source: "r:" + r.parent, target: "r:" + r.id } }); }); + reqs.forEach(function (r) { + r.targets.forEach(function (t) { + var n = byId[t]; + if (!n) return; + add("o:" + t, n.name, 2, { col: kindColour(n), shape: shape(n), go: n.href, ring: n.unclaimed }); + if (!seen["le:" + r.id + ">" + t]) { seen["le:" + r.id + ">" + t] = 1; els.push({ data: { id: "le:" + r.id + ">" + t, source: "r:" + r.id, target: "o:" + t, col: r.status ? css("--" + r.status) : css("--muted") } }); } + }); + }); + cols[2].slice().forEach(function (oid) { + var id = oid.slice(2); + var gen = D.generated[id] || []; + if (!gen.length) return; + var total = gen.reduce(function (a, g) { return a + g[1]; }, 0); + var gid = "g:" + id; + add(gid, total + " generated (" + gen.map(function (g) { return g[0]; }).join(", ") + ")", 3, { col: css("--accent"), shape: "tag", go: byId[id].href }); + els.push({ data: { id: "ge:" + gid, source: oid, target: gid } }); + }); + var pos = {}; + cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); + tr.innerHTML = ""; + var c = graph({ + container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, + { selector: "node[ring = 1]", style: { "border-width": 2, "border-color": css("--bad") } }, + { selector: "edge", style: { width: 1, "line-color": "data(col)", opacity: 0.5, "curve-style": "unbundled-bezier" } }, + { selector: "edge[!col]", style: { "line-color": css("--muted") } }, + ], + layout: { name: "preset", positions: function (n) { return pos[n.id()]; }, fit: true, padding: 24 }, + }); + c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); + }; + tstart.onchange = function () { + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); + drawTrace(); + }; + redraw.push(drawTrace); + drawTrace(); + } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); +})(); diff --git a/server/python/src/metaobjects/documentation/explorer_app/index.html b/server/python/src/metaobjects/documentation/explorer_app/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/server/python/src/metaobjects/documentation/explorer_app/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/server/typescript/packages/cli/test/explorer-site-ledger.test.ts b/server/typescript/packages/cli/test/explorer-site-ledger.test.ts index 7c9a3b646c..0f17915cbc 100644 --- a/server/typescript/packages/cli/test/explorer-site-ledger.test.ts +++ b/server/typescript/packages/cli/test/explorer-site-ledger.test.ts @@ -29,7 +29,7 @@ async function site(files: Record): Promise<{ page: (p: string) if (verify === undefined) throw new Error("the model declares requirements"); const view = buildDocsView({ root, verify }); const out = join(dir, "site"); - generateExplorerSite({ view, outDir: out, title: "Ledger" }); + generateExplorerSite({ output: "static", view, outDir: out, title: "Ledger" }); return { page: (p) => readFileSync(join(out, p), "utf8"), undecided: verify.requirementCounts.undecided }; } diff --git a/server/typescript/packages/cli/test/gen-docs-generators.test.ts b/server/typescript/packages/cli/test/gen-docs-generators.test.ts index efbcd18b43..673d30c257 100644 --- a/server/typescript/packages/cli/test/gen-docs-generators.test.ts +++ b/server/typescript/packages/cli/test/gen-docs-generators.test.ts @@ -247,12 +247,14 @@ describe("meta gen writes the documentation the list declares", () => { const root = project({ config: base(`["entity", docsSiteFile()]`) }); expect(await run(["gen", "--cwd", root])).toBe(0); const site = join(root, "docs", "generated", "site"); - // The explorer is the default site: its main page, the data every page reads, a page per object. + // The explorer is the default site, as one browser app: its shell, the app, and the data it + // draws every page from. It writes no page of its own. const index = readFileSync(join(site, "index.html"), "utf8"); expect(index).toContain('content="metaobjects docs-site explorer"'); - // No date in the footer: the pages depend on the model alone. - expect(index).toContain("by the metaobjects docs-site generator. Static"); - expect(existsSync(join(site, "model", "app", "Talk.html"))).toBe(true); + expect(index).toContain(''); + expect(existsSync(join(site, "explorer-model.js"))).toBe(true); + expect(existsSync(join(site, "explorer-stamp.js"))).toBe(true); + expect(existsSync(join(site, "model", "app", "Talk.html"))).toBe(false); // It runs after the entity generator, so the files that run wrote are traced to their node. const view = JSON.parse(readFileSync(join(site, "explorer.json"), "utf8")) as { nodes: { id: string; files: { paths: string[] }[] }[] }; expect(view.nodes.find((x) => x.id === "app::Talk")?.files.flatMap((g) => g.paths)).toEqual( diff --git a/server/typescript/packages/cli/test/gen-docs-site.test.ts b/server/typescript/packages/cli/test/gen-docs-site.test.ts index a4c77584c9..3e4881c8af 100644 --- a/server/typescript/packages/cli/test/gen-docs-site.test.ts +++ b/server/typescript/packages/cli/test/gen-docs-site.test.ts @@ -55,7 +55,7 @@ export default defineConfig({ outDir: "out", dialect: "sqlite", targets: { docs: { outDir: "docs-out" } }, - generators: [docsSiteFile()], + generators: [docsSiteFile({ output: "static" })], PROVIDERS }); `; @@ -109,8 +109,8 @@ describe("meta gen with docsSiteFile()", () => { expect(await readFile(page, "utf8")).toContain("geopoint"); }); - test("docsSiteFile({ assetBase }) points the explorer's graph library at that base instead of jsDelivr", async () => { - const cfg = config("").replace("docsSiteFile()", `docsSiteFile({ assetBase: "/vendor/npm" })`); + test("docsSiteFile({ output: \"static\", assetBase }) points the explorer's graph library at that base instead of its own copy", async () => { + const cfg = config("").replace(`docsSiteFile({ output: "static" })`, `docsSiteFile({ output: "static", assetBase: "/vendor/npm" })`); const root = await project(META, cfg); expect(await run(["gen", "--cwd", root])).toBe(0); const html = await readFile(join(root, "docs-out", "site", "map.html"), "utf8"); @@ -119,7 +119,7 @@ describe("meta gen with docsSiteFile()", () => { }); test("docsSiteFile({ site: \"classic\", assetBase }) points the classic chrome at that base", async () => { - const cfg = config("").replace("docsSiteFile()", `docsSiteFile({ site: "classic", assetBase: "/vendor/npm" })`); + const cfg = config("").replace(`docsSiteFile({ output: "static" })`, `docsSiteFile({ site: "classic", assetBase: "/vendor/npm" })`); const root = await project(META, cfg); expect(await run(["gen", "--cwd", root])).toBe(0); const html = await readFile(join(root, "docs-out", "site", "index.html"), "utf8"); diff --git a/server/typescript/packages/cli/test/unit/rules-inert.test.ts b/server/typescript/packages/cli/test/unit/rules-inert.test.ts index d90beabf02..d727fc9a7a 100644 --- a/server/typescript/packages/cli/test/unit/rules-inert.test.ts +++ b/server/typescript/packages/cli/test/unit/rules-inert.test.ts @@ -27,6 +27,7 @@ import { pathToFileURL } from "node:url"; import { loadUris, TYPE_API, type DocsView, type MetaRoot } from "@metaobjectsdev/metadata"; import { runGen, buildProjectionViews, type Generator, type MetaobjectsGenConfig } from "@metaobjectsdev/codegen-ts"; import { buildExpectedSchema } from "@metaobjectsdev/migrate-ts"; +import { docsSiteFile } from "@metaobjectsdev/codegen-ts/generators"; import { composeCatalog } from "../../src/lib/catalog.js"; // test/unit → cli → packages → typescript → server → repo root @@ -175,8 +176,9 @@ describe("ADR-0066 the business-rules vocabulary is inert in every generator and } test("docs-site differs by exactly the new nodes: the data payload and the API's own page", async () => { - const expected = await emit(withoutRules, [catalog[DOCS_SITE]!.factory()]); - const actual = await emit(withRules, [catalog[DOCS_SITE]!.factory()]); + // The static export, so each page is a file the diff can name; the app draws the same pages. + const expected = await emit(withoutRules, [docsSiteFile({ output: "static" })]); + const actual = await emit(withRules, [docsSiteFile({ output: "static" })]); expect(expected[""]).toBeUndefined(); // Every top-level node gets an explorer page, so the declared API (`Purchasing`) adds its // own; no page the model already had goes away. The value objects its operations name in diff --git a/server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts b/server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts index a3824cdaf8..ba1db85f9e 100644 --- a/server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts +++ b/server/typescript/packages/codegen-ts/src/generators/docs-site-file.ts @@ -15,7 +15,9 @@ // `explorer.json`, which this generator builds from the effective model, the // requirement ledger the caller computed (`ctx.requirementLedger`), the files this // run wrote (`ctx.runOutput`) and the routes the run mounts. It runs after every -// other generator, so the files it lists are this run's. +// other generator, so the files it lists are this run's. By default it writes one +// browser app that draws the pages from that document (`output: "app"`), and +// `output: "static"` writes every page as HTML instead. // classic the site before the explorer: a page per package and per object with ER // diagrams. It loads the model with its own loader, from whole source DIRECTORIES // (one page group each), so it reads the collection's source roots off the context. @@ -24,7 +26,7 @@ import { readFileSync } from "node:fs"; import { basename, join, resolve } from "node:path"; import { existsSync } from "node:fs"; import { buildDocsView } from "@metaobjectsdev/metadata"; -import { generateExplorerSite, generateSite, readPromptTexts } from "@metaobjectsdev/docs-site"; +import { generateExplorerSite, generateSite, readPromptTexts, type ExplorerOutput } from "@metaobjectsdev/docs-site"; import type { EmittedFile, GenContext, Generator, GeneratorFactory } from "../generator.js"; import { DOCS_TARGET_NAME } from "../docs-run.js"; import { buildApiModelForRun } from "./api-model.js"; @@ -48,6 +50,10 @@ export interface DocsSiteFileOpts { /** Which site: `explorer` (default), the model explorer, or `classic`, the per-package site * with ER diagrams that shipped before it. */ site?: DocsSiteKind; + /** The explorer only: `app` (default) writes one browser app that draws every page from the + * docs view, runs from `file://` and follows a regenerated model while it is open; `static` + * writes a page per screen, for publishing without scripts or indexing for search. */ + output?: ExplorerOutput; /** A directory holding prompt `.mustache` sources outside `metaobjects/` and `templates/`, * relative to the project, so the site can show prompt TEXT. */ prompts?: string; @@ -59,11 +65,11 @@ export interface DocsSiteFileOpts { * depend on the model alone and `meta verify --codegen` can hold them to it. A date here * makes every day's run differ from the last. */ stamp?: string; - /** Where the pages load their third-party CSS and JS from: the explorer loads Cytoscape for - * its graphs, the classic site daisyUI, Tailwind's browser build, Mermaid and svg-pan-zoom. - * Default `https://cdn.jsdelivr.net/npm`, which needs network access to draw them; set it to - * your own mirror, or to a path you serve the files from. Give an absolute URL or a - * root-relative path. See `@metaobjectsdev/docs-site` for the files. */ + /** Where the pages load their third-party CSS and JS from. The classic site loads daisyUI, + * Tailwind's browser build, Mermaid and svg-pan-zoom, default `https://cdn.jsdelivr.net/npm`. + * The explorer ships its graph library (Cytoscape) with the site and ignores this, except + * that a static explorer (`output: "static"`) given one loads Cytoscape from it and ships no + * copy. Give an absolute URL or a root-relative path. See `@metaobjectsdev/docs-site`. */ assetBase?: string; /** Named output target. Default `"docs"`, which `targets` must declare. */ target?: string; @@ -218,6 +224,7 @@ async function explorerSite(ctx: GenContext, project: string, prefix: string, op title: opts?.title ?? (basename(project) || "Metadata"), stamp: opts?.stamp ?? "", texts, + ...(opts?.output !== undefined && { output: opts.output }), ...(opts?.assetBase !== undefined ? { assetBase: opts.assetBase } : {}), ...owned, }).files); diff --git a/server/typescript/packages/codegen-ts/test/docs-site-explorer.test.ts b/server/typescript/packages/codegen-ts/test/docs-site-explorer.test.ts index d9a8ff5be4..76a37ba2f5 100644 --- a/server/typescript/packages/codegen-ts/test/docs-site-explorer.test.ts +++ b/server/typescript/packages/codegen-ts/test/docs-site-explorer.test.ts @@ -44,7 +44,7 @@ const explorerOf = (): DocsView => describe("docsSiteFile() builds the model explorer", () => { test("declared first, it still sees what the code generators wrote, and the routes they mount", async () => { await runGen({ - config: config([docsSiteFile(), entityFile(), routesFile()]), + config: config([docsSiteFile({ output: "static" }), entityFile(), routesFile()]), metadata: root, projectRoot: tmp, sourceRoots: [sources], @@ -60,13 +60,21 @@ describe("docsSiteFile() builds the model explorer", () => { }); test("without a routes generator in the run, the site says no routes were recorded, not that none are mounted", async () => { - await runGen({ config: config([entityFile(), docsSiteFile()]), metadata: root, projectRoot: tmp, sourceRoots: [sources] }); + await runGen({ config: config([entityFile(), docsSiteFile({ output: "static" })]), metadata: root, projectRoot: tmp, sourceRoots: [sources] }); const ex = explorerOf(); expect(ex.sources.routes).toBe(false); expect(ex.nodes.every((n) => n.routes.length === 0)).toBe(true); expect(readFileSync(join(tmp, "docs", "site", "api.html"), "utf8")).toContain("recorded no routes"); }); + test("by default it writes the browser app and its data, and no page", async () => { + await runGen({ config: config([entityFile(), docsSiteFile()]), metadata: root, projectRoot: tmp, sourceRoots: [sources] }); + const site = join(tmp, "docs", "site"); + expect(readFileSync(join(site, "index.html"), "utf8")).toContain(''); + for (const f of ["assets/explorer-app.js", "assets/cytoscape.min.js", "explorer-model.js", "explorer-stamp.js", "explorer.json"]) expect(existsSync(join(site, f))).toBe(true); + expect(existsSync(join(site, "api.html"))).toBe(false); + }); + test("a requirement ledger that throws leaves the ledger out with a warning, and the site still builds", async () => { const result = await runGen({ config: config([docsSiteFile()]), diff --git a/server/typescript/packages/docs-site/README.md b/server/typescript/packages/docs-site/README.md index 97a1ba15bb..be809d828a 100644 --- a/server/typescript/packages/docs-site/README.md +++ b/server/typescript/packages/docs-site/README.md @@ -4,7 +4,9 @@ HTML documentation-site generator for metaobjects models. It builds two sites: - **The model explorer** (the default): what the software does, the model map with slices and colour-by, a page per object, prompt and requirement, the traceability matrix, the - trace, the API index and the gaps, all drawn from one `explorer.json`. See + trace, the API index and the gaps, all drawn from one `explorer.json`. By default it is one + browser app that runs from `file://` and follows the model while it is open; `output: + "static"` writes a page per screen. See [`docs/features/explorer-site.md`](../../../../docs/features/explorer-site.md). - **The classic site** (`site: "classic"`): package nav, Cmd+K search, per-object / package / prompt / output pages, and kind-aware ER diagrams that encode object kind by shape and @@ -30,17 +32,19 @@ export default defineConfig({ `meta gen` writes the site to `site/` under the target (`./docs/generated/site/`), beside whatever other documentation the config lists. Options: `site` (`"explorer"`, the -default, or `"classic"`), `subDir` (default `site`), +default, or `"classic"`), `output` (the explorer only: `"app"`, the default, or `"static"`), +`subDir` (default `site`), `prompts` (an extra directory of prompt `.mustache` sources), `title`, `stamp` (footer text; default none, so the pages depend on the model alone and `meta verify --codegen` can check them), `assetBase` (see below) and `target`. ## Offline use: `assetBase` -The explorer loads one third-party file, Cytoscape.js, from -`${assetBase}/cytoscape@3.30.2/dist/cytoscape.min.js`, and only on the pages that draw a graph -(the map, the object mini-maps, the trace). Without it every page still renders and the graphs -show a notice. The rest of this section is about the classic site. +The explorer needs no network access: it ships its one third-party file, Cytoscape.js +3.30.2 (MIT), as `assets/cytoscape.min.js`. A static explorer given an `assetBase` loads it +from `${assetBase}/cytoscape@3.30.2/dist/cytoscape.min.js` instead and ships no copy. Without +it every page still renders and the graphs show a notice. The rest of this section is about +the classic site. The classic page chrome loads five third-party files from jsDelivr (`https://cdn.jsdelivr.net/npm`): daisyUI's two stylesheets, Tailwind's browser build, Mermaid and svg-pan-zoom. A site opened @@ -117,7 +121,9 @@ meta gen ``` `docsSiteFile()` reads `codegen/docs-site/` and uses your owned copies; any -file you didn't override falls back to the bundled default. The engine +file you didn't override falls back to the bundled default. The explorer app carries your +owned templates in `explorer-model.js` and draws with them, and writes your owned CSS and JS +in place of its own. The engine (`@metaobjectsdev/docs-site`) stays a versioned dependency — you own only the theme. When calling `generateSite` or `generateExplorerSite` directly, pass `templatesDir` / `assetsDir` to point at your diff --git a/server/typescript/packages/docs-site/app-src/env.d.ts b/server/typescript/packages/docs-site/app-src/env.d.ts new file mode 100644 index 0000000000..e0128cbadd --- /dev/null +++ b/server/typescript/packages/docs-site/app-src/env.d.ts @@ -0,0 +1,5 @@ +// The explorer's templates by basename, which scripts/build-app.ts supplies to the bundle. +declare module "explorer-templates" { + const templates: Readonly>; + export default templates; +} diff --git a/server/typescript/packages/docs-site/app-src/index.html b/server/typescript/packages/docs-site/app-src/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/server/typescript/packages/docs-site/app-src/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/server/typescript/packages/docs-site/app-src/main.ts b/server/typescript/packages/docs-site/app-src/main.ts new file mode 100644 index 0000000000..c9195d0dac --- /dev/null +++ b/server/typescript/packages/docs-site/app-src/main.ts @@ -0,0 +1,194 @@ +// The model explorer as one browser app: every page is drawn when it is visited, by the same page +// code the static export runs (`src/explorer/core.ts`), from the docs view the generator wrote. +// +// It runs from `file://` with no server: the data arrives as classic scripts (`explorer-model.js` +// sets `window.MO_MODEL`, `explorer-stamp.js` sets `window.MO_STAMP`), and routes are hash routes, +// `index.html#/model/acme/shop/Order.html?…#anchor`. A page's own links are rewritten to routes +// as it is drawn, so a link can be opened in a new tab like any other. +// +// It follows the model on disk: once a second it reloads the stamp file, and when the stamp moves +// it reloads the model and draws the page it is on again. +// +// Built by `scripts/build-app.ts` into `explorer-app/assets/explorer-app.js` at the repository +// root. The bundle also sets `globalThis.MoExplorer`, so a script can render the same pages +// outside a browser (the static export, and the test that holds the bundle to its sources). + +import TEMPLATES from "explorer-templates"; +import type { DocsView } from "@metaobjectsdev/metadata"; +import { createExplorer, type ExplorerCore } from "../src/explorer/core.js"; + +interface Model { + stamp: string; + title: string; + footer: string; + texts: Record; + templates: Record; + view: DocsView; +} + +interface AppWindow { + MO_MODEL?: Model; + MO_STAMP?: string; + MO_THEME?: () => void; + MO_EXPLORER?: Record; + MO_APP?: unknown; +} + +/** Draw the explorer's pages from a model file's contents, outside any browser. */ +function explorerFor(model: Model): ExplorerCore { + return createExplorer({ + view: model.view, + title: model.title, + templates: { ...TEMPLATES, ...model.templates }, + texts: model.texts, + ...(model.footer !== "" && { stamp: model.footer }), + assetBase: "", + // The app loads Cytoscape once, in its shell; a drawn page's own script tags are dropped. + cytoscapeSrc: () => "", + }); +} + +(globalThis as Record).MoExplorer = { explorerFor, templates: TEMPLATES }; + +if (typeof document !== "undefined") startApp(window as unknown as AppWindow); + +function startApp(w: AppWindow): void { + const BASE = "http://explorer.invalid/"; + const HOME = "index.html"; + let site: ExplorerCore | undefined; + let loaded = ""; + let current = { path: "", search: "" }; + let leave: (() => void)[] = []; + + const parse = (hash: string): { path: string; search: string; anchor: string } => { + const raw = hash.replace(/^#\/?/, ""); + const u = new URL(raw === "" ? HOME : raw, BASE); + let path = u.pathname.slice(1); + try { + path = decodeURIComponent(path); + } catch { + // A malformed escape is looked up as written. + } + return { path: path === "" ? HOME : path, search: u.search, anchor: u.hash.slice(1) }; + }; + const route = (path: string, search: string, anchor = ""): string => `#/${path}${search}${anchor !== "" ? `#${anchor}` : ""}`; + + w.MO_APP = { + href: (rel: string): string => { + const r = parse(rel); + return route(r.path, r.search, r.anchor); + }, + search: (): string => current.search, + replaceQuery: (search: string): void => { + current = { path: current.path, search: search === "?" ? "" : search }; + history.replaceState(null, "", route(current.path, current.search)); + }, + listen: (type: string, f: EventListener): void => { + document.addEventListener(type, f); + leave.push(() => document.removeEventListener(type, f)); + }, + onLeave: (f: () => void): void => { + leave.push(f); + }, + }; + + const build = (): boolean => { + const model = w.MO_MODEL; + if (model === undefined) return false; + site = explorerFor(model); + w.MO_EXPLORER = site.graphData(); + loaded = model.stamp; + return true; + }; + + // A drawn page's links are relative to its own path; each becomes a route. + const rewrite = (root: ParentNode, path: string, search: string): void => { + for (const a of Array.from(root.querySelectorAll("a[href]"))) { + const raw = a.getAttribute("href")!; + if (/^[a-z][a-z0-9+.-]*:/i.test(raw)) continue; + if (raw.startsWith("#")) { + a.setAttribute("href", route(path, search, raw.slice(1))); + continue; + } + const u = new URL(raw, BASE + path); + a.setAttribute("href", route(u.pathname.slice(1), u.search, u.hash.slice(1))); + } + }; + + const show = (keepScroll: boolean): void => { + const r = parse(location.hash); + const draw = site?.pages.get(r.path); + for (const f of leave) f(); + leave = []; + current = { path: r.path, search: r.search }; + const html = + draw !== undefined + ? draw() + : `Not found

    No such page

    ${escapeHtml(r.path)} is not a page of this model.

    Overview

    `; + const doc = new DOMParser().parseFromString(html, "text/html"); + doc.querySelectorAll("script").forEach((s) => s.remove()); + rewrite(doc, r.path, r.search); + const y = window.scrollY; + document.title = doc.title; + for (const a of Array.from(document.body.attributes)) document.body.removeAttribute(a.name); + for (const a of Array.from(doc.body.attributes)) document.body.setAttribute(a.name, a.value); + document.body.replaceChildren(...Array.from(doc.body.childNodes).map((n) => document.importNode(n, true))); + if (draw !== undefined) w.MO_THEME?.(); + if (keepScroll) window.scrollTo(0, y); + else if (r.anchor !== "") document.getElementById(r.anchor)?.scrollIntoView(); + else window.scrollTo(0, 0); + document.documentElement.setAttribute("data-mo-route", r.path); + }; + + window.addEventListener("hashchange", () => { + const r = parse(location.hash); + // Only the anchor moved: scroll, do not draw again. + if (r.path === current.path && r.search === current.search) { + if (r.anchor !== "") document.getElementById(r.anchor)?.scrollIntoView(); + return; + } + show(false); + }); + + // The live view. A script tag (not fetch, which `file://` refuses) reloads the stamp; the model + // is reloaded only when the stamp moves, and taken only when it carries that stamp, so a model + // caught half-written is tried again on the next tick. + const load = (file: string, done: () => void): void => { + const s = document.createElement("script"); + s.src = `${file}?t=${Date.now()}`; + s.onload = () => { + s.remove(); + done(); + }; + s.onerror = () => { + s.remove(); + done(); + }; + document.head.appendChild(s); + }; + const poll = (): void => { + load("explorer-stamp.js", () => { + if (w.MO_STAMP === undefined || w.MO_STAMP === loaded) return void setTimeout(poll, 1000); + const want = w.MO_STAMP; + load("explorer-model.js", () => { + if (w.MO_MODEL?.stamp === want && build()) show(true); + setTimeout(poll, 1000); + }); + }); + }; + + const start = (): void => { + if (!build()) { + document.body.innerHTML = "

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    "; + } else { + show(false); + } + setTimeout(poll, 1000); + }; + if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start); + else start(); +} + +function escapeHtml(s: string): string { + return s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]!); +} diff --git a/server/typescript/packages/docs-site/app/assets/cytoscape.min.js b/server/typescript/packages/docs-site/app/assets/cytoscape.min.js new file mode 100644 index 0000000000..ff0d7c1796 --- /dev/null +++ b/server/typescript/packages/docs-site/app/assets/cytoscape.min.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016-2024, The Cytoscape Consortium. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the “Software”), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).cytoscape=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}var u="undefined"==typeof window?null:window,c=u?u.navigator:null;u&&u.document;var d=e(""),h=e({}),p=e((function(){})),f="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),g=function(e){return e&&e.instanceString&&y(e.instanceString)?e.instanceString():null},v=function(t){return null!=t&&e(t)==d},y=function(t){return null!=t&&e(t)===p},m=function(e){return!E(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},b=function(t){return null!=t&&e(t)===h&&!m(t)&&t.constructor===Object},x=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},w=function(e){return"undefined"===f?void 0:null!=e&&e instanceof HTMLElement},E=function(e){return k(e)||C(e)},k=function(e){return"collection"===g(e)&&e._private.single},C=function(e){return"collection"===g(e)&&!e._private.single},S=function(e){return"core"===g(e)},P=function(e){return"stylesheet"===g(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},T=function(t){return function(t){return null!=t&&e(t)===h}(t)&&y(t.then)},_=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},L=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,a]}return t}(e)},R={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},V=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||d&&e-u>=a}function v(){var e=H();if(g(e))return y(e);s=setTimeout(v,function(e){var n=t-(e-l);return d?ge(n,a-(e-u)):n}(e))}function y(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function m(){var e=H(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(v,t),p(l)}return void 0===s&&(s=setTimeout(v,t)),o}return t=pe(t)||0,j(n)&&(c=!!n.leading,a=(d="maxWait"in n)?fe(pe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),m.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?o:y(H())},m},ye=u?u.performance:null,me=ye&&ye.now?function(){return ye.now()}:function(){return Date.now()},be=function(){if(u){if(u.requestAnimationFrame)return function(e){u.requestAnimationFrame(e)};if(u.mozRequestAnimationFrame)return function(e){u.mozRequestAnimationFrame(e)};if(u.webkitRequestAnimationFrame)return function(e){u.webkitRequestAnimationFrame(e)};if(u.msRequestAnimationFrame)return function(e){u.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(me())}),1e3/60)}}(),xe=function(e){return be(e)},we=me,Ee=65599,ke=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=r*Ee+t.value|0;return r},Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return t*Ee+e|0},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},Pe=function(e){return 2097152*e[0]+e[1]},De=function(e,t){return[Ce(e[0],t[0]),Se(e[1],t[1])]},Te=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return ke({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},Ge=function(e){e.splice(0,e.length)},Ue=function(e,t,n){return n&&(t=N(n,t)),e[t]},Ze=function(e,t,n,r){n&&(t=N(n,t)),e[t]=r},$e="undefined"!=typeof Map?Map:function(){function e(){t(this,e),this._obj={}}return r(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Qe=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&S(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Je,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];m(t.classes)?l=t.classes:v(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;ag;0<=g?++h:--h)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var k=m.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},ot={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),u=l.id(),v.delete(u),w++,u===d){for(var E=[],k=i,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;DD&&(p[P]=D,m[P]=S,b[P]=w),!i){var T=S*u+C;!i&&p[T]>D&&(p[T]=D,m[T]=C,b[T]=w)}}}for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:a,r=b(e),i=[],o=r;;){if(null==o)return t.spawn();var l=m(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},pt=Math.sqrt(2),ft=function(e,t,n){0===n.length&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=ft(i,e,t),n--}return t},vt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/pt);if(!(i<2)){for(var l=[],u=0;u0?1:e<0?-1:0},kt=function(e,t){return Math.sqrt(Ct(e,t))},Ct=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},St=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Mt=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Bt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zt=function(e){var t,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=r=i=o[0];else if(2===o.length)t=r=o[0],i=n=o[1];else if(4===o.length){var s=a(o,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},It=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},At=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},Lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Ot=function(e,t){return Lt(e,t.x1,t.y1)&&Lt(e,t.x2,t.y2)},Rt=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,d=i/2,h=a/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=n-d+c-o,v=r-h-o,y=n+d-c+o,m=v;if((s=Zt(e,t,n,r,g,v,y,m,!1)).length>0)return s}if(f){var b=n+d+o,x=r-h+c-o,w=b,E=r+h-c+o;if((s=Zt(e,t,n,r,b,x,w,E,!1)).length>0)return s}if(p){var k=n-d+c-o,C=r+h+o,S=n+d-c+o,P=C;if((s=Zt(e,t,n,r,k,C,S,P,!1)).length>0)return s}if(f){var D=n-d-o,T=r-h+c-o,_=D,M=r+h-c+o;if((s=Zt(e,t,n,r,D,T,_,M,!1)).length>0)return s}var B=n-d+c,N=r-h+c;if((l=Gt(e,t,n,r,B,N,c+o)).length>0&&l[0]<=B&&l[1]<=N)return[l[0],l[1]];var z=n+d-c,I=r-h+c;if((l=Gt(e,t,n,r,z,I,c+o)).length>0&&l[0]>=z&&l[1]<=I)return[l[0],l[1]];var A=n+d-c,L=r+h-c;if((l=Gt(e,t,n,r,A,L,c+o)).length>0&&l[0]>=A&&l[1]>=L)return[l[0],l[1]];var O=n-d+c,R=r+h-c;return(l=Gt(e,t,n,r,O,R,c+o)).length>0&&l[0]<=O&&l[1]>=R?[l[0],l[1]]:[]},Vt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Ft=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,d=Math.min(r,s,a)-l,h=Math.max(r,s,a)+l;return!(ec||th)},jt=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var d,h,p,f=-1,g=0;g=0?pl?(e-i)*(e-i)+(t-a)*(t-a):u-d},Yt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Xt=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f0){var g=Ht(c,-l);d=Wt(g)}else d=c;return Yt(e,t,d)},Wt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},Ut=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Zt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?Ut(e,n,o)===o?[o,s]:Ut(e,n,i)===i?[i,a]:Ut(i,o,n)===n?[n,r]:[]:[]},$t=function(e,t,n,r,i,a,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=Ht(g,-s);u=Wt(m)}else u=g}else u=n;for(var b=0;bu&&(u=t)},d=function(e){return l[e]},h=0;h0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),h[m]>h[v]+w&&(h[m]=h[v]+w,p.nodes.indexOf(m)<0?p.push(m):p.updateItem(m),u[m]=0,l[m]=[]),h[m]==h[v]+w&&(u[m]=u[m]+u[v],l[m].push(v))}else for(var E=0;E0;){for(var P=n.pop(),D=0;D0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Cn,o=r,s=0;s=2?Mn(e,t,n,0,Dn,Tn):Mn(e,t,n,0,Pn)},squaredEuclidean:function(e,t,n){return Mn(e,t,n,0,Dn)},manhattan:function(e,t,n){return Mn(e,t,n,0,Pn)},max:function(e,t,n){return Mn(e,t,n,-1/0,_n)}};function Nn(e,t,n,r,i,a){var o;return o=y(e)?e:Bn[e]||Bn.euclidean,0===t&&y(e)?o(i,a):o(t,n,r,i,a)}Bn["squared-euclidean"]=Bn.squaredEuclidean,Bn.squaredeuclidean=Bn.squaredEuclidean;var zn=He({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),In=function(e){return zn(e)},An=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Nn(e,r.length,a,(function(e){return r[e](t)}),o,s)},Ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},jn=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N0?1:0;C[k%u.minIterations*t+R]=V,O+=V}if(O>0&&(k>=u.minIterations-1||k==u.maxIterations-1)){for(var F=0,j=0;j0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=rr(e,t,n),i=0;il&&(s=u,l=c)}n[i]=a[s]}return r=rr(e,t,n)}(t,r,Y),W={},H=0;H1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},lr=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),a=a.difference(d)}}(s)}})),{cut:a,components:r}},ur={};[nt,at,ot,lt,ct,ht,vt,sn,un,dn,pn,kn,Kn,Jn,ar,{hierholzer:function(e){if(!b(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=or(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=v(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},f=[],g=[];for(g=p(i);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var y in f.unshift(l.getElementById(g.shift())),c)if(c[y].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:sr,htbc:sr,htb:sr,hopcroftTarjanBiconnectedComponents:sr},{tarjanStronglyConnected:lr,tsc:lr,tscc:lr,tarjanStronglyConnectedComponents:lr}].forEach((function(e){L(ur,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var cr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};cr.prototype={fulfill:function(e){return dr(this,1,"fulfillValue",e)},reject:function(e){return dr(this,2,"rejectReason",e)},then:function(e,t){var n=new cr;return this.onFulfilled.push(fr(e,n,"fulfill")),this.onRejected.push(fr(t,n,"reject")),hr(this),n.proxy}};var dr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,hr(e)),e},hr=function(e){1===e.state?pr(e,"onFulfilled",e.fulfillValue):2===e.state&&pr(e,"onRejected",e.rejectReason)},pr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t-1};var ri=function(e,t){var n=this.__data__,r=Qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function ii(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){m(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};qi.className=qi.classNames=qi.classes;var Yi={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:I,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yi.variable="(?:[\\w-.]|(?:\\\\"+Yi.metaChar+"))+",Yi.className="(?:[\\w-]|(?:\\\\"+Yi.metaChar+"))+",Yi.value=Yi.string+"|"+Yi.number,Yi.id=Yi.variable,function(){var e,t,n;for(e=Yi.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Yi.comparatorOp+="|\\!"+t)}();var Xi=0,Wi=1,Hi=2,Ki=3,Gi=4,Ui=5,Zi=6,$i=7,Qi=8,Ji=9,ea=10,ta=11,na=12,ra=13,ia=14,aa=15,oa=16,sa=17,la=18,ua=19,ca=20,da=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*A(e,t)}(e.selector,t.selector)})),ha=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return je("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return je("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&je("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return v(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Xi:var l=e(s);return l.substring(0,l.length-1);case Ki:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ui:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case Gi:return"["+r.field+"]";case Zi:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case $i:return s;case Qi:return"#"+s;case Ji:return"."+s;case sa:case aa:return i(r.parent,a)+n(">")+i(r.child,a);case la:case oa:return i(r.ancestor,a)+" "+i(r.descendant,a);case ua:var f=i(r.left,a),g=i(r.subject,a),v=i(r.right,a);return f+(f.length>0?" ":"")+g+v;case ca:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ba(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Ba)},_a.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,Na)},_a.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ma(this,e,t,za)},_a.ancestors=_a.parents,(Pa=Da={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fi.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pa.data,Pa.removeAttr=Pa.removeData;var Ia,Aa,La=Da,Oa={};function Ra(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;at})),minIndegree:Va("indegree",(function(e,t){return et})),minOutdegree:Va("outdegree",(function(e,t){return et}))}),L(Oa,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,y=g;g&&(f=f[0]);var m=y?f.position():{x:0,y:0};void 0!==t?p.position(e,t+m[e]):void 0!==i&&p.position({x:i.x+m.x,y:i.y+m.y})}}else if(!a)return;return this}}).modelPosition=Ia.point=Ia.position,Ia.modelPositions=Ia.points=Ia.positions,Ia.renderedPoint=Ia.renderedPosition,Ia.relativePoint=Ia.relativePosition;var qa,Ya,Xa=Aa;qa=Ya={},Ya.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Ya.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Ya.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ka=function(e,t){return null==t?e:Ha(e,t.x1,t.y1,t.x2,t.y2)},Ga=function(e,t,n){return Ue(e,t,n)},Ua=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Nt(u,1),Ha(e,u.x1,u.y1,u.x2,u.y2)}}},Za=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=Ga(a,"labelWidth",n),p=Ga(a,"labelHeight",n),f=Ga(a,"labelX",n),g=Ga(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}o+=v-Math.max(x,w)-E-2,s+=v+Math.max(x,w)+E+2,l+=y-Math.max(x,w)-E-2,u+=y+Math.max(x,w)+E+2;var D=n||"main",T=i.labelBounds,_=T[D]=T[D]||{};_.x1=o,_.y1=l,_.x2=s,_.y2=u,_.w=s-o,_.h=u-l;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?Ga(i.rstyle,"labelAngle",n):b.pfValue,z=Math.cos(N),I=Math.sin(N),A=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":A=s;break;case"right":A=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var O=function(e,t){return{x:(e-=A)*z-(t-=L)*I+A,y:e*I+t*z+L}},R=O(o,l),V=O(o,u),F=O(s,l),j=O(s,u);o=Math.min(R.x,V.x,F.x,j.x),s=Math.max(R.x,V.x,F.x,j.x),l=Math.min(R.y,V.y,F.y,j.y),u=Math.max(R.y,V.y,F.y,j.y)}var q=D+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,Ha(e,o,l,s,u),Ha(i.labelBounds.all,o,l,s,u)}return e}},$a=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=_t(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;Ha(h,n=o-S,i=s-P,r=o+S,a=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,i,a=t.pstyle("outline-opacity").value,o=t.pstyle("outline-width").value;if(a>0&&o>0){var s=t.pstyle("outline-offset").value,l=t.pstyle("shape").value,u=o+s,c=(e.w+2*u)/e.w,d=(e.h+2*u)/e.h,h=0;["diamond","pentagon","round-triangle"].includes(l)?(c=(e.w+2.4*u)/e.w,h=-u/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(l)?c=(e.w+2.4*u)/e.w:"star"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.6*u)/e.h,h=-u/3.8):"triangle"===l?(c=(e.w+2.8*u)/e.w,d=(e.h+2.4*u)/e.h,h=-u/1.4):"vee"===l&&(c=(e.w+4.4*u)/e.w,d=(e.h+3.8*u)/e.h,h=.5*-u);var p=e.h*d-e.h,f=e.w*c-e.w;if(zt(e,[Math.ceil(p/2),Math.ceil(f/2)]),0!==h){var g=(r=0,i=h,{x1:(n=e).x1+r,x2:n.x2+r,y1:n.y1+i,y2:n.y2+i,w:n.w,h:n.h});Mt(e,g)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),Ha(h,n-=k,i-=k,r+=k,a+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,i=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(i>(a=T[1].y)){var M=i;i=a,a=M}Ha(h,n-k,i-k,r+k,a+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N(r=A.x)){var L=n;n=r,r=L}if((i=I.y)>(a=A.y)){var O=i;i=a,a=O}Ha(h,n-=k,i-=k,r+=k,a+=k)}if(c&&t.includeEdges&&g&&(Ua(h,e,"mid-source"),Ua(h,e,"mid-target"),Ua(h,e,"source"),Ua(h,e,"target")),c)if("yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;Ha(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};It(F,h),zt(F,y),Nt(F,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ha(h,n-E,i-E,r+E,a+E));var j=p.overlayBounds=p.overlayBounds||{};It(j,h),zt(j,y),Nt(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=_t(),c&&t.includeLabels&&(t.includeMainLabels&&Za(h,e,null),g&&(t.includeSourceLabels&&Za(h,e,"source"),t.includeTargetLabels&&Za(h,e,"target")))}return h.x1=Wa(h.x1),h.y1=Wa(h.y1),h.x2=Wa(h.x2),h.y2=Wa(h.y2),h.w=Wa(h.x2-h.x1),h.h=Wa(h.y2-h.y1),h.w>0&&h.h>0&&b&&(zt(h,y),Nt(h,1)),h},Qa=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:bo,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},wo.removeAllListeners=function(){return this.removeListener("*")},wo.emit=wo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,m(t)||(t=[t]),Co(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&v(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(b(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(v(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Go.neighbourhood=Go.neighborhood,Go.closedNeighbourhood=Go.closedNeighborhood,Go.openNeighbourhood=Go.openNeighborhood,L(Go,{source:Ta((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ta((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Qo({attr:"source"}),targets:Qo({attr:"target"})}),L(Go,{edgesWith:Ta(Jo(),"edgesWith"),edgesTo:Ta(Jo({thisIsSrc:!0}),"edgesTo")}),L(Go,{connectedEdges:Ta((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Go.componentsOf=Go.components;var ts=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new $e,a=!1;if(t){if(t.length>0&&b(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new Je,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var R=e.length===i.length?i:new ts(a,e),V=0;V0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var T=0;T1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),as=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!=typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var a=0;a0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},os={linear:function(e,t,n){return e+(t-e)*n},ease:as(.25,.1,.25,1),"ease-in":as(.42,0,1,1),"ease-out":as(0,0,.58,1),"ease-in-out":as(.42,0,.58,1),"ease-in-sine":as(.47,0,.745,.715),"ease-out-sine":as(.39,.575,.565,1),"ease-in-out-sine":as(.445,.05,.55,.95),"ease-in-quad":as(.55,.085,.68,.53),"ease-out-quad":as(.25,.46,.45,.94),"ease-in-out-quad":as(.455,.03,.515,.955),"ease-in-cubic":as(.55,.055,.675,.19),"ease-out-cubic":as(.215,.61,.355,1),"ease-in-out-cubic":as(.645,.045,.355,1),"ease-in-quart":as(.895,.03,.685,.22),"ease-out-quart":as(.165,.84,.44,1),"ease-in-out-quart":as(.77,0,.175,1),"ease-in-quint":as(.755,.05,.855,.06),"ease-out-quint":as(.23,1,.32,1),"ease-in-out-quint":as(.86,0,.07,1),"ease-in-expo":as(.95,.05,.795,.035),"ease-out-expo":as(.19,1,.22,1),"ease-in-out-expo":as(1,0,0,1),"ease-in-circ":as(.6,.04,.98,.335),"ease-out-circ":as(.075,.82,.165,1),"ease-in-out-circ":as(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return os.linear;var r=is(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":as};function ss(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function ls(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function us(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=ls(e,i),s=ls(t,i);if(x(o)&&x(s))return ss(a,o,s,n,r);if(m(o)&&m(s)){for(var l=[],u=0;u0?("spring"===d&&h.push(o.duration),o.easingImpl=os[d].apply(null,h)):o.easingImpl=os[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,y=o.position;if(y&&i&&!e.locked()){var m={};ds(g.x,y.x)&&(m.x=us(g.x,y.x,p,f)),ds(g.y,y.y)&&(m.y=us(g.y,y.y,p,f)),e.position(m)}var b=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ds(b.x,x.x)&&(w.x=us(b.x,x.x,p,f)),ds(b.y,x.y)&&(w.y=us(b.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ds(k,C)&&(a.zoom=Tt(a.minZoom,us(k,C,p,f),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&i){for(var D=0;D=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||hs(0,d,e),cs(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var fs={animate:Fi.animate(),animation:Fi.animation(),animated:Fi.animated(),clearQueue:Fi.clearQueue(),delay:Fi.delay(),delayAnimation:Fi.delayAnimation(),stop:Fi.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ps(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&xe((function(n){ps(n,e),t()}))}()}}},gs={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},vs=function(e){return v(e)?new ka(e):e},ys={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new xo(gs,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,vs(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,vs(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,vs(t),n),this},once:function(e,t,n){return this.emitter().one(e,vs(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fi.eventAliasesOn(ys);var ms={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ms.jpeg=ms.jpg;var bs={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=v(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(L({},e,{cy:this,eles:r}));return i}Ve("No such layout `"+t+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ve("A `name` must be specified to make a layout");else Ve("Layout options must be specified to make a layout")}};bs.createLayout=bs.makeLayout=bs.layout;var xs={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Es.invalidateDimensions=Es.resize;var ks={collection:function(e,t){return v(e)?this.$(e):E(e)?e.collection():m(e)?(t||(t={}),new ts(this,e,t.unique,t.removed)):new ts(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};ks.elements=ks.filter=ks.$;var Cs={};Cs.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var p=void 0;d&&h||d?p=l.properties:h&&(p=l.mappedProperties);for(var f=0;f1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],k=i.valueMin[1],C=i.valueMax[1],S=i.valueMin[2],P=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],_=[Math.round(w+(E-w)*g),Math.round(k+(C-k)*g),Math.round(S+(P-S)*g),Math.round(D+(T-D)*g)];n={bypass:i.bypass,name:i.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!s.number)return!1;var M=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,M,i.bypass,"mapping")}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var B=i.field.split("."),N=d.data,z=0;z0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cs.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cs.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cs.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cs.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ss={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){je("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new ka(l).invalid){je("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];;){if(n.match(/^\s*$/))break;var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){je("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var p=h[1],f=h[2];if(this.properties[p])this.parse(p,f)?(d.push({name:p,val:f}),o()):(je("Skipping property: Invalid property definition in: "+r),o());else je("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:l,strValue:""+t,mapped:d,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var h=o.mapData;if(!c.color&&!c.number)return!1;var p=this.parse(e,u[4]);if(!p||p.mapped)return!1;var f=this.parse(e,u[5]);if(!f||f.mapped)return!1;if(p.pfValue===f.pfValue||p.strValue===f.strValue)return je("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(c.color){var g=p.value,b=f.value;if(!(g[0]!==b[0]||g[1]!==b[1]||g[2]!==b[2]||g[3]!==b[3]&&(null!=g[3]&&1!==g[3]||null!=b[3]&&1!==b[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:p.value,valueMax:f.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var w;if(w=s?t.split(/\s+/):m(t)?t:[t],c.evenMultiple&&w.length%2!=0)return null;for(var E=[],k=[],C=[],S="",P=!1,D=0;D0?" ":"")+T.strValue}return c.validate&&!c.validate(E,k)?null:c.singleEnum&&P?1===E.length&&v(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:S,bypass:n,units:k}}var _,B,N=function(){for(var r=0;rc.max||c.strictMax&&t===c.max))return null;var V={name:e,value:t,strValue:""+t+(z||""),units:z,bypass:n};return c.unitless||"px"!==z&&"em"!==z?V.pfValue=t:V.pfValue="px"!==z&&z?this.getEmSizeInPixels()*t:t,"ms"!==z&&"s"!==z||(V.pfValue="ms"===z?t:1e3*t),"deg"!==z&&"rad"!==z||(V.pfValue="rad"===z?t:(_=t,Math.PI*_/180)),"%"===z&&(V.pfValue=t/100),V}if(c.propList){var F=[],j=""+t;if("none"===j);else{for(var q=j.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),x(e)?n=e:b(e)&&(n=e.level,null!=e.position?t=yt(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;x(l.x)&&(t.pan.x=l.x,o=!1),x(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(v(e)){var n=e;e=this.mutableElements().filter(n)}else E(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};As.centre=As.center,As.autolockNodes=As.autolock,As.autoungrabifyNodes=As.autoungrabify;var Ls={data:Fi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ls.attr=Ls.data,Ls.removeAttr=Ls.removeData;var Os=function(e){var t=this,n=(e=L({},e)).container;n&&!w(n)&&w(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==u&&void 0!==n&&!e.headless,o=e;o.layout=L({name:a?"grid":"null"},o.layout),o.renderer=L({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ts(this),listeners:[],aniEles:new ts(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:x(o.zoom)?o.zoom:1,pan:{x:b(o.pan)&&x(o.pan.x)?o.pan.x:0,y:b(o.pan)&&x(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var c=L({},o,o.renderer);t.initRenderer(c);!function(e,t){if(e.some(T))return vr.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(b(e)||m(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=L({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,y(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,u=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(E(n.roots))e=n.roots;else if(m(n.roots)){for(var c=[],d=0;d0;){var N=_.shift(),z=T(N,M);if(z)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===z){je("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var I=0;if(n.avoidOverlap)for(var L=0;L0&&b[0].length<=3?l/2:0),d=2*Math.PI/b[r].length*i;return 0===r&&1===b[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ws(e){this.options=L({},Xs,e)}Ws.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Hs,Ks={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gs(e){this.options=L({},Ks,e)}Gs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,z=0,I=0;I=e.numIter)&&(rl(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),xe(t)):(gl(r,e),s())}()}else{for(;u;)u=o(l),l++;gl(r,e),s()}return this},Zs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Zs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var $s=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=_t(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(E);for(u=0;ur.count?0:r.graph},Js=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(u=r.nodeOverlap*o)*i/(g=Math.sqrt(i*i+a*a)),l=u*a/g;else{var u,c=ll(e,i,a),d=ll(t,-1*i,-1*a),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},sl=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ll=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},ul=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},dl=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},fl=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},vl={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yl(e){this.options=L({},vl,e)}yl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=_t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l=o?d(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(B=0,M++)},z={},I=0;I(r=qt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=jt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ue(e,t,n)}function x(n,r){var i,a=n._private,o=f;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Yt(e,t,T))return v(n),!0}else if(Lt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=_t({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p0?-(Math.PI-a.ang):Math.PI+a.ang),Zl(t,n,Ul),zl=Gl.nx*Ul.ny-Gl.ny*Ul.nx,Il=Gl.nx*Ul.nx-Gl.ny*-Ul.ny,Ol=Math.asin(Math.max(-1,Math.min(1,zl))),Math.abs(Ol)<1e-6)return Bl=t.x,Nl=t.y,void(Vl=jl=0);Al=1,Ll=!1,Il<0?Ol<0?Ol=Math.PI+Ol:(Ol=Math.PI-Ol,Al=-1,Ll=!0):Ol>0&&(Al=-1,Ll=!0),jl=void 0!==t.radius?t.radius:r,Rl=Ol/2,ql=Math.min(Gl.len/2,Ul.len/2),i?(Fl=Math.abs(Math.cos(Rl)*jl/Math.sin(Rl)))>ql?(Fl=ql,Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))):Vl=jl:(Fl=Math.min(ql,jl),Vl=Math.abs(Fl*Math.sin(Rl)/Math.cos(Rl))),Wl=t.x+Ul.nx*Fl,Hl=t.y+Ul.ny*Fl,Bl=Wl-Ul.ny*Vl*Al,Nl=Hl+Ul.nx*Vl*Al,Yl=t.x+Gl.nx*Fl,Xl=t.y+Gl.ny*Fl,Kl=t};function Ql(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Jl(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:($l(e,t,n,r,i),{cx:Bl,cy:Nl,radius:Vl,startX:Yl,startY:Xl,stopX:Wl,stopY:Hl,startAngle:Gl.ang+Math.PI/2*Al,endAngle:Ul.ang-Math.PI/2*Al,counterClockwise:Ll})}var eu={};function tu(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},w=x(m,v),E=x(b,y),k=!1;"auto"===c?u=Math.abs(w)>Math.abs(E)?"horizontal":"vertical":"upward"===c||"downward"===c?(u="vertical",k=!0):"leftward"!==c&&"rightward"!==c||(u="horizontal",k=!0);var C,S="vertical"===u,P=S?E:w,D=S?b:m,T=Et(D),_=!1;(k&&(h||f)||!("downward"===c&&D<0||"upward"===c&&D>0||"leftward"===c&&D>0||"rightward"===c&&D<0)||(P=(T*=-1)*Math.abs(P),_=!0),h)?C=(p<0?1+p:p)*P:C=(p<0?P:0)+p*T;var M=function(e){return Math.abs(e)=Math.abs(P)},B=M(C),N=M(Math.abs(P)-Math.abs(C));if((B||N)&&!_)if(S){var z=Math.abs(D)<=a/2,I=Math.abs(m)<=o/2;if(z){var A=(r.x1+r.x2)/2,L=r.y1,O=r.y2;n.segpts=[A,L,A,O]}else if(I){var R=(r.y1+r.y2)/2,V=r.x1,F=r.x2;n.segpts=[V,R,F,R]}else n.segpts=[r.x1,r.y2]}else{var j=Math.abs(D)<=i/2,q=Math.abs(b)<=s/2;if(j){var Y=(r.y1+r.y2)/2,X=r.x1,W=r.x2;n.segpts=[X,Y,W,Y]}else if(q){var H=(r.x1+r.x2)/2,K=r.y1,G=r.y2;n.segpts=[H,K,H,G]}else n.segpts=[r.x2,r.y1]}else if(S){var U=r.y1+C+(l?a/2*T:0),Z=r.x1,$=r.x2;n.segpts=[Z,U,$,U]}else{var Q=r.x1+C+(l?i/2*T:0),J=r.y1,ee=r.y2;n.segpts=[Q,J,Q,ee]}if(n.isRound){var te=e.pstyle("taxi-radius").value,ne="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(te),n.isArcRadius=new Array(n.segpts.length/2).fill(ne)}},eu.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!x(n.startX)||!x(n.startY),v=!x(n.arrowStartX)||!x(n.arrowStartY),y=!x(n.endX)||!x(n.endY),m=!x(n.arrowEndX)||!x(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=kt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wh.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(d)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],k=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D0){var H=u,K=Ct(H,bt(t)),G=Ct(H,bt(W)),U=K;if(G2)Ct(H,{x:W[2],y:W[3]})0){var le=c,ue=Ct(le,bt(t)),ce=Ct(le,bt(se)),de=ue;if(ce2)Ct(le,{x:se[2],y:se[3]})=c||b){d={cp:v,segment:m};break}}if(d)break}var x=d.cp,w=d.segment,E=(c-p)/w.length,k=w.t1-w.t0,C=u?w.t0+k*E:w.t1-k*E;C=Tt(0,C,1),t=Dt(x.p0,x.p1,x.p2,C),l=function(e,t,n,r){var i=Tt(0,r-.001,1),a=Tt(0,r+.001,1),o=Dt(e,t,n,i),s=Dt(e,t,n,a);return su(o,s)}(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,P,D,T,_=0,M=r.allpts.length,B=0;B+3=c));B+=2);var N=(c-P)/S;N=Tt(0,N,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=kt(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(D,T,N),l=su(D,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},au.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},au.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ue(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,d=i.width,h=i.height+(l-1)*(a-1)*u;Ze(n.rstyle,"labelWidth",t,d),Ze(n.rscratch,"labelWidth",t,d),Ze(n.rstyle,"labelHeight",t,h),Ze(n.rscratch,"labelHeight",t,h),Ze(n.rscratch,"labelLineHeight",t,c)},au.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Ze(n.rscratch,e,t,r),r):Ue(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gd){var b,x="",w=0,E=l(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=d?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",u)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,i).widthD)break;T+=i[M],M===i.length-1&&(_=!0)}return _||(T+="…"),T}return i},au.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},au.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=Te(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var D=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};m?m.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:b[0]*s,y:b[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),m)if(v){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(d(w),m.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),w.emit("dragfree"))),T();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var z={x:0,y:0};if(x(b[0])&&x(b[1])&&(z.x+=b[0],z.y+=b[1],N)){var I=e.hoverData.dragDelta;I&&x(I[0])&&x(I[1])&&(z.x+=I[0],z.y+=I[1])}e.hoverData.draggingEles=!0,w.silentShift(z).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])}();n=!0}else if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=bt(h),e.redrawHint("select",!0),e.redraw())}}else T();m&&m.pannable()&&m.active()&&m.unactivate()}return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=i(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):a.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):a.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),b=!1,t.timeStamp-w<=a.multiClickDebounceTime()?(m&&clearTimeout(m),b=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(m=setTimeout((function(){b||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||h||a.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();d(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var k,C,S,P,D,T,_,M,B,N,z,I,A,L=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",L,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||L(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var O,R,V,F,j,q,Y,X=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},W=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",O=function(t){if(e.hasTouchStarted=!0,E(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();B=l[0],N=l[1],z=l[2],I=l[3],k=t.touches[0].clientX-B,C=t.touches[0].clientY-N,S=t.touches[1].clientX-B,P=t.touches[1].clientY-N,A=0<=k&&k<=z&&0<=S&&S<=z&&0<=C&&C<=I&&0<=P&&P<=I;var h=n.pan(),f=n.zoom();D=X(k,C,S,P),T=W(k,C,S,P),M=[((_=[(k+S)/2,(C+P)/2])[0]-h.x)/f,(_[1]-h.y)/f];if(T<4e4&&!t.touches[2]){var g=e.findNearestElement(i[0],i[1],!0,!0),v=e.findNearestElement(i[2],i[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),m=y[0];if(null!=m&&(m.activate(),e.touchData.start=m,e.touchData.starts=y,e.nodeIsGrabbable(m))){var b=e.dragData.touchDragEles=n.collection(),x=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),m.selected()?(x=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(x,{addToList:b})):c(m,{addToList:b}),s(m);var w=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};m.emit(w("grabon")),x?x.forEach((function(e){e.emit(w("grab"))})):m.emit(w("grab"))}r(m,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==m&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var L=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-B,_=t.touches[0].clientY-N,z=t.touches[1].clientX-B,I=t.touches[1].clientY-N,L=W(w,_,z,I);if(L/T>=2.25||L>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",V=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",F=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]){h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);u[2]=h[0],u[3]=h[1]}if(t.touches[2]){h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);u[4]=h[0],u[5]=h[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=i){var v=i._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(i.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),g.emit("dragfree"))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:u[0],y:u[1]}),j=!1,t.timeStamp-Y<=s.multiClickDebounceTime()?(q&&clearTimeout(q),j=!0,Y=null,r(i,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(q=setTimeout((function(){j||r(i,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Y=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g0)return g[0]}return null},p=Object.keys(d),f=0;f0?u:Rt(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(Xt(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Xt(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!Yt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!Kt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!Kt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},gu.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Jt(3,0)),this.generateRoundPolygon("round-triangle",Jt(3,0)),this.generatePolygon("rectangle",Jt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Jt(5,0)),this.generateRoundPolygon("round-pentagon",Jt(5,0)),this.generatePolygon("hexagon",Jt(6,0)),this.generateRoundPolygon("round-hexagon",Jt(6,0)),this.generatePolygon("heptagon",Jt(7,0)),this.generateRoundPolygon("round-heptagon",Jt(7,0)),this.generatePolygon("octagon",Jt(8,0)),this.generateRoundPolygon("round-octagon",Jt(8,0));var r=new Array(20),i=tn(5,0),a=tn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*(1e3/60))break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())}),i(t))}}},wu=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Le;t(this,e),this.idsByKey=new $e,this.keyForId=new $e,this.cachesByLvl=new $e,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return r(e,[{key:"getIdsFor",value:function(e){null==e&&Ve("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Je,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new $e,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Eu={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ku=He({getKey:null,doesEleInvalidateKey:Le,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Cu=function(e,t){this.renderer=e,this.onDequeues=[];var n=ku(t);L(this,n),this.lookup=new wu(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},Su=Cu.prototype;Su.reasons=Eu,Su.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},Su.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Su.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rt((function(e,t){return t.reqs-e.reqs}))},Su.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Su.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(wt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=a.getTextureQueue(p),v=g[g.length-2],y=function(){return a.recycleTexture(p,d)||a.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)S=a.getElement(e,t,n,D,Eu.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),a.checkTextureFullness(v),f},Su.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},Su.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ke(t,e):e.fullnessChecks++},Su.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ke(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Ge(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ke(r,a),n.push(a),a}},Su.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Su.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Eu.dequeue)}}return r},Su.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=Ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Su.onDequeue=function(e){this.onDequeues.push(e)},Su.offDequeue=function(e){Ke(this.onDequeues,e)},Su.setupDequeueing=xu({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ke(c,o)}}();var d=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=_t();for(var t=0;t16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var h=null,p=e.length/1,f=!a,g=0;g=p||!Ot(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Du.getEleLevelForLayerLevel=function(e,t){return e},Du.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},Du.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},Du.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},Du.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=we(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Du.invalidateLayer=function(e){if(this.lastInvalidationTime=we(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ke(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},k=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},C=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var S="yes"===t.pstyle("ghost").value;if(S){var P=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(P,D),b(_),k(_),e.translate(-P,-D)}else x();E(),b(),k(),w(),C(),n&&e.translate(l.x1,l.y1)}}},Wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Xu.drawEdgeOverlay=Wu("overlay"),Xu.drawEdgeUnderlay=Wu("underlay"),Xu.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(c),o.lineDashOffset=d;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Ku.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(wt(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,"source",f,a),o.drawText(e,t,"target",f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},Ku.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Ku.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=Ue(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Ku.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=Ue(o,"labelX",n),d=Ue(o,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(c)&&!isNaN(d)){this.setupTextStyle(e,t,i);var p,f=n?n+"-":"",g=Ue(o,"labelWidth",n),v=Ue(o,"labelHeight",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,d+=m,0!==(p=r?this.getTextAngle(t,n):0)&&(l=c,u=d,e.translate(l,u),e.rotate(p),c=0,d=0),w){case"top":break;case"center":d+=v/2;break;case"bottom":d+=v}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,D=0===P.indexOf("round"),T=2;if(E>0||C>0&&k>0){var _=c-S;switch(x){case"left":_-=g;break;case"center":_-=g/2}var M=d-v-S,B=g+2*S,N=v+2*S;if(E>0){var z=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",D?Gu(e,_,M,B,N,T):e.fillRect(_,M,B,N),e.fillStyle=z}if(C>0&&k>0){var A=e.strokeStyle,L=e.lineWidth,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*s+")",e.lineWidth=C,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?Gu(e,_,M,B,N,T,"stroke"):e.strokeRect(_,M,B,N),"double"===R){var V=C/2;D?Gu(e,_+V,M+V,B-2*V,N-2*V,T,"stroke"):e.strokeRect(_+V,M+V,B-2*V,N-2*V)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=A}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var j=Ue(o,"labelWrapCachedLines",n),q=Ue(o,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?c+=-g:"center"===X&&(c+=-Y):"center"===x?"left"===X?c+=-Y:"right"===X&&(c+=Y):"right"===x&&("center"===X?c+=Y:"right"===X&&(c+=g))),w){case"top":d-=(j.length-1)*q;break;case"center":case"bottom":d-=(j.length-1)*q}for(var W=0;W0&&e.strokeText(j[W],c,d),e.fillText(j[W],c,d),d+=q}else F>0&&e.strokeText(h,c,d),e.fillText(h,c,d);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var Uu={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(x(d.x)&&x(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),k=0,C=0;C0&&void 0!==arguments[0]?arguments[0]:M;l.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;l.colorStrokeStyle(e,F[0],F[1],F[2],t)},G=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=_e("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},U=t.pstyle("shape").strValue,Z=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var $=G(r,i,U,Z);h=$.path,v=$.cacheHit}var Q=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,i,X,c)}g?e.fill(h):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,i,X,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),g?e.fill(h):e.fill())},ne=function(){if(_>0){if(e.lineWidth=_,e.lineCap=I,e.lineJoin=z,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=O;break;case"solid":case"double":e.setLineDash([])}if("center"!==A){if(e.save(),e.lineWidth*=2,"inside"===A)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===N){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var a=l.getNodeShape(t),o=_;"inside"===A&&(o=0),"outside"===A&&(o*=2);var s,u=(r+o+(V+Y))/r,c=(i+o+(V+Y))/i,h=r*u,p=i*c,f=l.nodeShapes[a].points;if(g)s=G(h,p,a,f).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+Y+V):"round-heptagon"===a?(v=1.075*(o+Y+V),m=-(o/2+Y+V)/35):"round-hexagon"===a?v=1.12*(o+Y+V):"round-pentagon"===a?(v=1.13*(o+Y+V),m=-(o/2+Y+V)/15):"round-tag"===a?(v=1.12*(o+Y+V),y=.07*(o/2+V+Y)):"round-triangle"===a&&(v=(o+Y+V)*(Math.PI/2),m=-(o+Y/2+V)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=h/2,x=p/2,w=(X="auto"===X?rn(h,p):X)+(o+V+Y)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Uu.drawNodeOverlay=Zu("overlay"),Uu.drawNodeUnderlay=Zu("underlay"),Uu.hasPie=function(e){return(e=e[0])._private.hasPie},Uu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var $u={};$u.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},$u.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height);b=l.zoom();D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var z=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&I,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,z):o.drawLayeredElements(_,S.nondrag,s,z),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])){O=h&&!L[o.DRAG]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,z):o.drawCachedElements(_,S.drag,s,z),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Qu={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},ac.png=function(e){return sc(e,this.bufferCanvasImage(e),"image/png")},ac.jpg=function(e){return sc(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},uc=dc,cc=dc.prototype;function dc(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(cc.CANVAS_LAYERS),contexts:new Array(cc.CANVAS_LAYERS),canvasNeedsRedraw:new Array(cc.CANVAS_LAYERS),bufferCanvases:new Array(cc.BUFFER_COUNT),bufferContexts:new Array(cc.CANVAS_LAYERS)};t.data.canvasContainer=n.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};c&&c.userAgent.match(/msie|trident|edge/i)&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var o=0;o{var m2={"explorer-head.mustache":` + + + + +{{{pageTitle}}} · {{{siteTitle}}} + + + + + +
    + {{{siteTitle}}} model explorer + + + +
    +
    + +`,"explorer-foot.mustache":`
    +
    Built from explorer.json by the metaobjects docs-site generator{{#stamp}} · {{{stamp}}}{{/stamp}}. Static: no server, no LLM call.
    + +{{#needsGraph}}{{/needsGraph}} + + + +`,"explorer-card.mustache":`
    +

    {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}{{{verdictHtml}}}

    +
    {{{statement}}}
    +
    {{{barHtml}}}
    {{{countsLine}}}
    + {{#hasChildren}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{glyphHtml}}}
    • {{/children}}
    {{/hasChildren}} +
    Summary from the levels below
    No summary is generated in this build.
    +
    +`,"explorer-overview.html.mustache":`

    {{{heading}}}

    +
    Built from {{{sourcesLine}}}. Every number below is computed from the project's metadata or the gate's own output.
    +
    +{{#tiles}}
    {{{n}}}
    {{{l}}}
    +{{/tiles}}
    +{{#hasRequirements}}{{{legendHtml}}}{{/hasRequirements}} +{{#hasRequirements}} +

    Features requirement.functional, by level

    +{{#hasFeatures}}
    +{{#featureCards}}{{> card}}{{/featureCards}} +
    {{/hasFeatures}} +{{^hasFeatures}}
    No requirement.functional is declared.
    {{/hasFeatures}} +

    Qualities requirement.architectural, the non-functional policies

    +{{#hasQualities}}
    +{{#qualityCards}}{{> card}}{{/qualityCards}} +
    {{/hasQualities}} +{{^hasQualities}}
    No requirement.architectural is declared.
    {{/hasQualities}} +{{/hasRequirements}} +{{^hasRequirements}} +
    This model declares no requirements yet, so this page cannot say what each part is for. Declare requirement.functional entries (levels 1 to 3 for the problem, 4 and 5 naming the model) and this page opens on them, with every entity traced to the feature it serves.
    +{{/hasRequirements}} +

    Packages what the model holds

    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-map.html.mustache":`

    Model map

    +
    Entities and the references between them. A slice is the set of model nodes a requirement subtree claims, a package holds, or a prompt reads and returns.
    +
    + + + + + + +
    +
    Click a node to see why it exists, what it holds and what was generated from it. Double-click to open its page.
    +
    + +`,"explorer-object.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}{{#isReadOnly}}read-only view{{/isReadOnly}}{{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}} · {{{storageLine}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#projection}} +

    Read model

    +
    + {{#basesHtml}}
    Surfaces fields of {{{basesHtml}}}.
    {{/basesHtml}} + {{#hasOrigins}}
    {{#origins}}{{/origins}}
    FieldOriginDefinition
    {{{field}}}{{{origin}}}{{{definitionHtml}}}
    {{/hasOrigins}} +
    + {{/projection}} + {{#report}} +

    Report

    +
    + {{#fromHtml}}{{/fromHtml}} + {{#spineHtml}}{{/spineHtml}} + {{#dimensionsHtml}}{{/dimensionsHtml}} + {{#measuresHtml}}{{/measuresHtml}} + {{#segmentHtml}}{{/segmentHtml}} + {{#filterHtml}}{{/filterHtml}} +
    From{{{fromHtml}}}
    Spine{{{spineHtml}}}
    Dimensions{{{dimensionsHtml}}}
    Measures{{{measuresHtml}}}
    Segment{{{segmentHtml}}}
    Filter{{{filterHtml}}}
    + {{/report}} + {{#hasFields}}

    Fields

    +
    {{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{#fields}}{{#hasColumn}}{{/hasColumn}}{{#showClaims}}{{/showClaims}} + {{/fields}}
    FieldTypeColumnFlagsClaimed at L5
    {{{name}}} {{{inheritedHtml}}}{{{type}}}{{{refHtml}}}{{{valuesHtml}}}{{{column}}}{{{flagsHtml}}}{{{claimsHtml}}}
    {{/hasFields}} + {{#hasKeys}}

    Keys and references

    +
    {{#keys}}{{/keys}}
    {{{kind}}} {{{name}}} {{{inheritedHtml}}}{{{shape}}}{{{targetHtml}}}
    {{/hasKeys}} + {{#hasReporting}}

    Reporting vocabulary

    +
    {{#reporting}}{{/reporting}}
    NameKindDefinition
    {{{name}}}{{{kind}}}{{{definitionHtml}}}
    {{/hasReporting}} + {{#hasLayouts}}

    Screens declared

    {{#layouts}}
    {{{kind}}} {{{name}}}{{#detailHtml}}: {{{detailHtml}}}{{/detailHtml}}
    {{/layouts}}{{/hasLayouts}} +
    + +
    +`,"explorer-node.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isAbstract}}abstract{{/isAbstract}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{kindLabel}}}{{#extendsHtml}} · extends {{{extendsHtml}}}{{/extendsHtml}}
    +
    +
    +

    Why it exists

    + {{#hasWhy}}
    + {{#whyRows}} + {{/whyRows}}
    CapabilityRequirementLevelStatusOn
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}{{{onHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} + {{#hasAttrs}}

    Attributes

    +
    {{#attrs}}{{/attrs}}
    @{{{name}}}{{{valueHtml}}}
    {{/hasAttrs}} + {{#hasMembers}}

    Members

    +
    + {{#members}} + {{/members}}
    NameTypeAttributes
    {{{nameHtml}}}{{#below}} +{{below}}{{/below}}{{{kind}}}{{{attrsHtml}}}
    {{/hasMembers}} +
    + +
    +`,"explorer-prompt.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}} {{#isUnclaimed}}unclaimed{{/isUnclaimed}}

    + +{{#description}}
    {{{description}}}
    {{/description}} +
    {{{attrsHtml}}}
    +
    +
    +

    Payload: {{{payloadHtml}}}

    + {{#hasPayload}}
    {{#payloadRows}}{{/payloadRows}}
    FieldTypeUsed in text
    {{{name}}} {{{requiredHtml}}}{{{type}}}{{{refHtml}}}{{{usedHtml}}}
    {{/hasPayload}} + {{^hasPayload}}
    No payload: the text renders from nothing typed.
    {{/hasPayload}} +

    Reply: {{{replyHtml}}}

    + {{#hasReply}}
    {{#replyRows}}{{/replyRows}}
    FieldType
    {{{name}}}{{{type}}}{{{valuesHtml}}}
    {{/hasReply}} + {{^hasReply}}
    Outbound only: no reply parser.
    {{/hasReply}} +

    Why it exists

    + {{#hasWhy}}
    {{#whyRows}}{{/whyRows}}
    CapabilityRequirementLevelStatus
    {{{capabilityHtml}}}{{{reqHtml}}}
    {{{statement}}}
    {{{levelHtml}}}{{{statusHtml}}}
    {{/hasWhy}} + {{^hasWhy}}
    {{{whyEmptyHtml}}}
    {{/hasWhy}} +
    +
    +

    Text {{{textMeta}}}

    + {{#hasText}}
    {{{textHtml}}}
    {{/hasText}} + {{^hasText}}
    The text {{{textRef}}} was not found beside the model, so this page cannot show it.
    {{/hasText}} +

    Generated

    + {{#hasGenerated}}{{#generated}}
    {{{generator}}}{{#files}}
    {{{.}}}
    {{/files}}
    {{/generated}}{{/hasGenerated}} + {{^hasGenerated}}
    {{{generatedNote}}}
    {{/hasGenerated}} +
    Proven today: meta verify --templates fails if the text names a variable the payload lacks. This page shows the other direction too: payload fields the text never uses.
    +
    +
    +`,"explorer-prompts.html.mustache":`

    Prompts

    +
    Each declared template, its typed payload, its reply type, and the requirements that claim it.
    +{{#hasRows}}
    +{{#rows}} +{{/rows}}
    TemplatePayloadReplyClaimed by
    {{{linkHtml}}} {{{kind}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{payloadHtml}}}{{{replyHtml}}}{{{claimsHtml}}}
    {{/hasRows}} +{{^hasRows}}
    This model declares no template.*.
    {{/hasRows}} +`,"explorer-requirements.html.mustache":`

    Requirements

    +
    Hierarchy is nesting. L1 to L3 describe the problem; only L4 (an object or prompt) and L5 (a member) may name the model.
    + +{{{legendHtml}}} +{{#hasTree}}
    {{{treeHtml}}}
    {{/hasTree}} +{{^hasTree}}
    {{{emptyNote}}}
    {{/hasTree}} +`,"explorer-requirement.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{levelHtml}}}{{{name}}} {{{statusHtml}}}{{{dispositionHtml}}}{{{verdictHtml}}}

    + +
    {{{address}}}
    +
    +
    +

    Statement

    {{{statement}}}

    Counterexample

    {{{counterexample}}}{{#hasDescription}}

    Scope

    {{{description}}}
    {{/hasDescription}}
    +

    Implemented by

    + {{#hasLinks}}
    {{#linkRows}}{{/linkRows}}
    ReferenceKindResolves
    {{{refHtml}}}{{{kind}}}{{{resolvesHtml}}}
    {{/hasLinks}} + {{^hasLinks}}
    {{{linksEmpty}}}
    {{/hasLinks}} + {{#hasBelow}}

    Below ({{childCount}}){{#deeper}} {{belowCount}} in all{{/deeper}}

    {{{belowBarHtml}}}
      {{#children}}
    • {{{levelHtml}}}{{{linkHtml}}} {{{statusHtml}}}
    • {{/children}}
    {{/hasBelow}} +
    {{#sliceHref}}Show this slice on the model map{{/sliceHref}}{{#sliceHref}}{{#traceHref}} · {{/traceHref}}{{/sliceHref}}{{#traceHref}}Trace to code{{/traceHref}}
    +
    +
    +

    What the build proves about this entry

    +
    {{#proof}}{{/proof}}
    {{{what}}}{{{verdictHtml}}}{{{howHtml}}}
    + {{#trackedHtml}}

    Tracked by

    {{{trackedHtml}}}{{/trackedHtml}} + {{#digest}}

    Statement digest

    {{{digest}}}
    Moves when the statement changes; a summary of this entry would be pinned to it.
    {{/digest}} +
    +
    +`,"explorer-matrix.html.mustache":`

    Traceability matrix

    +
    Rows are requirements that name the model; columns are stored entities and prompts, most claimed first. An empty column is a node nothing claims; a cell's colour and glyph are the row's declared status.
    +{{#hasRows}}
    {{{legendHtml}}}
    +
    {{{tableHtml}}}
    {{/hasRows}} +{{^hasRows}}
    {{#hasRequirements}}No requirement names the model yet: only L4 and L5 entries do.{{/hasRequirements}}{{^hasRequirements}}This model declares no requirements, so there is nothing to trace.{{/hasRequirements}}
    {{/hasRows}} +`,"explorer-trace.html.mustache":`

    Trace

    +
    From intent to code: requirement levels, then the model nodes they name, then the files generated from those nodes.
    +{{#hasStarts}}
    + +
    Hand-written modules that import the generated files are not scanned in this build, so the trace stops at the generated files. Click a requirement or a model node to open its page.
    {{/hasStarts}} +{{^hasStarts}}
    This model declares no requirements, so there is nothing to trace from. Every object's generated files are listed on its own page.
    {{/hasStarts}} +`,"explorer-gaps.html.mustache":`

    Gaps

    +
    What the model and the gate can already point at. Each card says whether it comes from the shipped gate or is a check this explorer adds.
    +
    +{{#cards}}

    {{{title}}} {{{count}}} {{{source}}}

    {{{whyHtml}}}
    {{{bodyHtml}}}
    +{{/cards}}
    +`,"explorer-api.html.mustache":`

    API

    +{{#recorded}}
    Every route the generated code mounts, by the object it serves: {{{summary}}}.
    +{{#hasGroups}}
    {{#groups}}

    {{{linkHtml}}} {{{kind}}}{{#isReadOnly}} read-only{{/isReadOnly}}

    {{#routes}}
    {{{method}}} {{{path}}}
    {{/routes}}
    {{/groups}}
    {{/hasGroups}} +{{^hasGroups}}
    The run generated no routes.
    {{/hasGroups}}{{/recorded}} +{{^recorded}}
    The run that built this site recorded no routes: it generated none, or ran without the routes generator.
    {{/recorded}} +`,"explorer-model.html.mustache":`

    Packages

    +
    Every package in the model and what it declares.
    +
    +{{#packageCards}}

    {{{name}}}

    {{{kindLineHtml}}}
    {{{membersHtml}}}
    +{{/packageCards}}
    +`,"explorer-package.html.mustache":`
    {{{crumbsHtml}}}
    +

    {{{name}}}

    +
    +{{#rows}} +{{/rows}}
    NameKindStorageFieldsClaim
    {{{linkHtml}}} {{{abstractHtml}}}{{#description}}
    {{{description}}}
    {{/description}}
    {{{kind}}}{{{storage}}}{{fieldCount}}{{{statusHtml}}}
    +`};/*! + * mustache.js - Logic-less {{mustache}} templates with JavaScript + * http://github.com/janl/mustache.js + */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/typescript/packages/docs-site/app/assets/explorer.css b/server/typescript/packages/docs-site/app/assets/explorer.css new file mode 100644 index 0000000000..aae678b023 --- /dev/null +++ b/server/typescript/packages/docs-site/app/assets/explorer.css @@ -0,0 +1,232 @@ +/* The model explorer's theme. `meta eject docs-site` copies this file to + codegen/docs-site/assets/, where an edit wins over the bundled copy. + + Colour rules (design report §4.2), which the classes below keep apart: + .s- a DECLARED status: filled chip, with its glyph in the text + .v- a GATE verdict: an outline (ring), never a fill + .bar .b-* a ROLL-UP of what sits below: a separate stacked bar + No class here colours a test result. */ + +:root { + --bg: #f7f7f5; --panel: #ffffff; --ink: #1d1f23; --muted: #5f6670; --line: #e2e3e0; + --accent: #3b5bdb; --accent-soft: #e8ecfd; --accent-ink: #ffffff; + --live: #2f9e44; --live-soft: #e3f5e7; --partial: #e8890c; --partial-soft: #fdf0dc; + --planned: #4c6ef5; --planned-soft: #e9edff; --retired: #868e96; --retired-soft: #eef0f2; + --bad: #e03131; --bad-soft: #fde8e8; --warn: #e8890c; --code: #f1f2ef; + --entity: #495057; --value: #7048e8; --prompt: #0c8599; --projection: #1971c2; --report: #c2255c; + --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06); + --shadow-lift: 0 4px 14px rgba(16, 24, 40, .10); + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; + } +} +:root[data-theme="dark"] { + --bg: #15171a; --panel: #1d2024; --ink: #e7e9ec; --muted: #9aa2ab; --line: #2e3238; + --accent: #8da2fb; --accent-soft: #252c47; --accent-ink: #15171a; + --live: #51cf66; --live-soft: #1e3324; --partial: #ffa94d; --partial-soft: #3a2c17; + --planned: #91a7ff; --planned-soft: #232a45; --retired: #adb5bd; --retired-soft: #2a2d31; + --bad: #ff6b6b; --bad-soft: #3a1f1f; --warn: #ffa94d; --code: #24272c; + --entity: #ced4da; --value: #b197fc; --prompt: #3bc9db; --projection: #74c0fc; --report: #f783ac; + --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lift: 0 4px 14px rgba(0, 0, 0, .45); + color-scheme: dark; +} + +* { box-sizing: border-box; } +html { -webkit-text-size-adjust: 100%; } +body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } +a { color: var(--accent); text-decoration: none; } +a:hover { text-decoration: underline; } +code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; } +code { background: var(--code); border-radius: 4px; padding: 0 4px; } +code.digest { display: block; overflow-wrap: anywhere; font-size: 11.5px; padding: 4px 6px; } +pre code, .mono code { background: none; padding: 0; } + +/* ── Header ─────────────────────────────────────────────────────────────── */ +header.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: center; padding: 10px 20px; flex-wrap: wrap; } +.brand { font-weight: 700; letter-spacing: .2px; color: var(--ink); white-space: nowrap; } +.brand:hover { text-decoration: none; } +.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; } +.nav { display: flex; gap: 4px; flex-wrap: wrap; } +.nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; } +.nav a:hover { background: var(--code); text-decoration: none; } +.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; } +#search { margin-left: auto; position: relative; } +#search input { width: 260px; max-width: 60vw; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; } +#search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); } +#results { position: absolute; right: 0; top: 36px; width: 420px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lift); display: none; } +#results a { display: block; padding: 7px 12px; border-bottom: 1px solid var(--line); color: var(--ink); } +#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; } +#results a small { color: var(--muted); display: block; } +#results .none { padding: 8px 12px; color: var(--muted); } +#theme { padding: 5px 9px; } + +/* ── Page ───────────────────────────────────────────────────────────────── */ +main { padding: 24px 20px 20px; max-width: 1400px; margin: 0 auto; } +h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } +h2 { font-size: 16px; margin: 26px 0 10px; } +h3 { font-size: 14px; margin: 16px 0 6px; } +h3.first { margin-top: 0; } +.h-sub { color: var(--muted); font-weight: 400; } +.sub { color: var(--muted); } +.small { font-size: 12px; } +.crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; } +.meta-line { margin-top: 4px; } +.page { margin-top: 14px; } +.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; } +.grid { display: grid; gap: 12px; } +.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 18px 0; } +a.tile { color: var(--ink); transition: box-shadow .15s, border-color .15s, transform .15s; } +a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lift); transform: translateY(-1px); } +.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; } +.tile .l { color: var(--muted); font-size: 12.5px; line-height: 1.4; } +.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } +.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } +.apis { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } +@media (max-width: 1000px) { .side { grid-template-columns: minmax(0, 1fr); } } +@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } } + +table { border-collapse: collapse; width: 100%; } +th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; } +th { font-size: 12px; color: var(--muted); font-weight: 600; } +tr:target td { background: var(--accent-soft); } +table.kv th { width: 120px; } +.tablewrap { overflow-x: auto; } + +/* ── Status, verdict and roll-up ────────────────────────────────────────── */ +.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0; font-weight: 500; line-height: 1.6; } +h1 .chip { font-size: 12.5px; } +.s-live { background: var(--live-soft); color: var(--live); border-color: transparent; } +.s-partial { background: var(--partial-soft); color: var(--partial); border-color: transparent; } +.s-planned { background: var(--planned-soft); color: var(--planned); border-color: transparent; } +.s-retired { background: var(--retired-soft); color: var(--retired); border-color: transparent; text-decoration: line-through; } +.v-error, .v-unclaimed { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); } +.v-warn { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); } +.glyph { font-size: 12px; } +.g-live { color: var(--live); } .g-partial { color: var(--partial); } .g-planned { color: var(--planned); } .g-retired { color: var(--retired); } +.lvl { display: inline-block; min-width: 24px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; background: var(--code); color: var(--muted); padding: 0 4px; margin-right: 6px; line-height: 18px; } +h1 .lvl { font-size: 12px; line-height: 22px; } +.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--code); min-width: 80px; } +.bar span { display: block; height: 100%; } +.b-live { background: var(--live); } .b-partial { background: var(--partial); } .b-planned { background: var(--planned); } .b-retired { background: var(--retired); } +.minibar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 4px; } +.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; margin: 4px 0; } +.legend-row { margin: 10px 0; } +.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; white-space: nowrap; } +.pill.gate { color: var(--accent); border-color: var(--accent); } +a.k-entity { color: var(--accent); font-weight: 500; } +span.k-entity { color: var(--entity); } .k-value { color: var(--value); } .k-prompt, .k-template { color: var(--prompt); } +.k-projection { color: var(--projection); } .k-report { color: var(--report); } +.kdot { font-size: 10px; } +.kdot.k-entity { color: var(--entity); } .kdot.k-value { color: var(--value); } .kdot.k-prompt { color: var(--prompt); } +.k-badge { color: var(--projection); } +.vals { color: var(--muted); font-size: 11.5px; } + +/* ── S1 cards ───────────────────────────────────────────────────────────── */ +.cap { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; } +.cap .card h3 { margin-top: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.capcard .statement { margin: 2px 0 0; } +.rollup { margin: 10px 0 4px; } +.rollup .sub { margin-top: 3px; } +ul { padding-left: 18px; margin: 6px 0; } +.cap li, .kids li { margin: 4px 0; } +.members { margin-top: 8px; line-height: 1.9; } +details.summary { margin-top: 6px; } +details > summary { cursor: pointer; color: var(--muted); font-size: 12px; } +.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 8px 0; } +.note.intro { margin: 4px 0 8px; font-size: 13.5px; } + +/* ── S5 tree ────────────────────────────────────────────────────────────── */ +.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; } +.tabs a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--panel); } +.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } +.tree { margin-top: 10px; } +.tree ul { list-style: none; padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 8px; } +.tree > ul { border-left: none; padding-left: 0; margin-left: 0; } +.tree li { margin: 4px 0; } +.tree .row { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; } +.tree .stmt { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-left: 30px; } + +/* ── Graphs ─────────────────────────────────────────────────────────────── */ +.graph { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; } +#cy { height: 640px; } #cymini { height: 260px; } #cytrace { height: 680px; } +.panel h3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } +.maplegend { margin-top: 8px; } +.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } +select, button { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; max-width: 100%; } +button { cursor: pointer; } +button:hover { border-color: var(--accent); } +.layout, .gen, .route { margin: 4px 0; } +.gen .pill { margin-left: 0; } + +/* ── S4 text ────────────────────────────────────────────────────────────── */ +pre { background: var(--code); padding: 10px 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; } +pre.text { max-height: 560px; } +.var { color: var(--prompt); } + +/* ── S6 proof ───────────────────────────────────────────────────────────── */ +.proof { font-size: 12.5px; } +.proof td:first-child { white-space: nowrap; font-weight: 500; } + +/* ── S7 matrix ──────────────────────────────────────────────────────────── */ +.mx { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); } +.mx table { width: auto; border-collapse: separate; border-spacing: 0; } +/* The header row is sticky as a whole: a sticky cell per column would paint over the slanted + label of the column before it. */ +.mx thead { position: sticky; top: 0; z-index: 2; background: var(--panel); } +.mx th.col { height: 150px; white-space: nowrap; vertical-align: bottom; padding: 0; } +.mx th.col.corner { position: sticky; left: 0; background: var(--panel); } +.mx th.col div { transform: rotate(-60deg); transform-origin: left bottom; width: 18px; margin-left: 12px; font-weight: 500; font-size: 11.5px; max-width: 18px; } +.mx th.col div a { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; } +.mx th.col.unc div a { color: var(--bad); } +.mx td.c { width: 20px; min-width: 20px; height: 22px; padding: 0; text-align: center; font-size: 11px; border-right: 1px solid var(--line); } +.mx td.rh { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; } +.mx tr.grp td { background: var(--code); font-weight: 600; } +.mx td.c.live { background: var(--live-soft); } .mx td.c.planned { background: var(--planned-soft); } +.mx td.c.partial { background: var(--partial-soft); } .mx td.c.retired { background: var(--retired-soft); } + +/* ── S9 gaps, API ───────────────────────────────────────────────────────── */ +.gap h3 { display: flex; gap: 8px; align-items: center; margin-top: 0; flex-wrap: wrap; } +.gap .why { margin-bottom: 8px; } +.count { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 0 8px; background: var(--code); } +.method { display: inline-block; min-width: 52px; text-align: center; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 4px; padding: 1px 4px; background: var(--code); color: var(--muted); } +.m-GET, .m-get { background: var(--live-soft); color: var(--live); } +.m-POST, .m-post { background: var(--planned-soft); color: var(--planned); } +.m-PUT, .m-put, .m-PATCH, .m-patch { background: var(--partial-soft); color: var(--partial); } +.m-DELETE, .m-delete { background: var(--bad-soft); color: var(--bad); } + +footer { color: var(--muted); font-size: 12px; padding: 24px 20px; text-align: center; } + +/* ── Phone ──────────────────────────────────────────────────────────────── */ +@media (max-width: 700px) { + header.top { gap: 8px 12px; padding: 10px 16px; } + .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; } + .nav::-webkit-scrollbar { display: none; } + #search { order: 4; margin-left: 0; flex-basis: 100%; } + #search input { width: 100%; max-width: none; } + #results { left: 0; right: 0; width: auto; max-width: none; } + #theme { margin-left: auto; } + main { padding: 16px; } + h1 { font-size: 20px; } + .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } + .tile .n { font-size: 22px; } + .cap { grid-template-columns: minmax(0, 1fr); } + .apis { grid-template-columns: minmax(0, 1fr); } + #cy { height: 440px; } #cytrace { height: 520px; } + .mx { max-height: none; } + /* A wide table scrolls inside its own box, never the page. */ + main table { display: block; max-width: 100%; overflow-x: auto; } + .mx table { display: table; max-width: none; } + .tree .stmt { margin-left: 0; } + .tree ul { padding-left: 12px; margin-left: 4px; } +} +@media print { header.top, #search, #theme, .toolbar { display: none; } .card { box-shadow: none; } } diff --git a/server/typescript/packages/docs-site/app/assets/explorer.js b/server/typescript/packages/docs-site/app/assets/explorer.js new file mode 100644 index 0000000000..61c4153d2e --- /dev/null +++ b/server/typescript/packages/docs-site/app/assets/explorer.js @@ -0,0 +1,332 @@ +// The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. +// `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. +(function () { + "use strict"; + function run() { + var APP = window.MO_APP || null; + var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; + var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; + var $ = function (s, r) { return (r || document).querySelector(s); }; + var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; + var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; + var STATUS = ["live", "partial", "planned", "retired"]; + var GLYPH = { live: "●", partial: "◐", planned: "○", retired: "⊘" }; + var PAL = ["#1971c2", "#e8590c", "#2b8a3e", "#ae3ec9", "#c2255c", "#0b7285", "#5c940d", "#f08c00"]; + var byId = {}; + D.nodes.forEach(function (n) { byId[n.id] = n; }); + var reqById = {}; + D.reqs.forEach(function (r) { reqById[r.id] = r; }); + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; + var redraw = []; + + // ── Theme ─────────────────────────────────────────────────────────────── + var themeBtn = $("#theme"); + if (themeBtn) themeBtn.onclick = function () { + var cur = document.documentElement.getAttribute("data-theme"); + var dark = cur ? cur === "dark" : matchMedia("(prefers-color-scheme: dark)").matches; + var next = dark ? "light" : "dark"; + document.documentElement.setAttribute("data-theme", next); + try { localStorage.setItem("mo-theme", next); } catch (e) { /* private window: the toggle still works for this page */ } + redraw.forEach(function (f) { f(); }); + }; + + // ── Search ────────────────────────────────────────────────────────────── + // The built-in index ships in explorer-data.js and works from file://. When the site has been + // indexed with Pagefind (`npx pagefind --site `) and is served over http, Pagefind's + // full-text index answers instead. + var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; + function loadPagefind() { + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + pagefindTried = true; + // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every + // result URL carry the path the site is served under (a sub-path included). + var url = new URL(ROOT + "pagefind/pagefind.js", location.href).href; + return fetch(url, { method: "HEAD" }).then(function (r) { + if (!r.ok) return null; + return import(url).then(function (m) { pagefind = m; return m; }); + }).catch(function () { return null; }); + } + function show(items) { + sel = -1; + res.innerHTML = items.length ? items.map(function (x) { return '' + esc(x.t) + "" + esc(x.s) + ""; }).join("") : '
    No match
    '; + res.style.display = "block"; + } + function builtIn(v) { + var words = v.split(/\s+/).filter(Boolean); + return D.search.filter(function (x) { return words.every(function (w) { return x.k.indexOf(w) >= 0; }); }) + .sort(function (a, b) { return (a.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1) - (b.t.toLowerCase().indexOf(words[0]) === 0 ? 0 : 1); }) + .slice(0, 25).map(function (x) { return { t: x.t, s: x.s, h: href(x.h) }; }); + } + if (q && res) { + q.addEventListener("input", function () { + var v = q.value.trim().toLowerCase(); + if (!v) { res.style.display = "none"; return; } + show(builtIn(v)); + loadPagefind().then(function (pf) { + if (!pf || q.value.trim().toLowerCase() !== v) return; + pf.search(v).then(function (r) { + return Promise.all(r.results.slice(0, 12).map(function (x) { return x.data(); })); + }).then(function (rows) { + if (q.value.trim().toLowerCase() !== v || !rows.length) return; + show(rows.map(function (d) { return { t: (d.meta && d.meta.title) || d.url, s: (d.excerpt || "").replace(/<[^>]+>/g, ""), h: d.url }; })); + }).catch(function () { /* keep the built-in results */ }); + }); + }); + q.addEventListener("keydown", function (e) { + var links = res.querySelectorAll("a"); + if (e.key === "ArrowDown" || e.key === "ArrowUp") { + e.preventDefault(); + sel = Math.max(0, Math.min(links.length - 1, sel + (e.key === "ArrowDown" ? 1 : -1))); + links.forEach(function (a, i) { a.classList.toggle("sel", i === sel); }); + } else if (e.key === "Enter" && links.length) { + location.href = links[Math.max(0, sel)].href; + } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } + }); + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { + if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } + }); + } + + if (typeof window.cytoscape !== "function") { + document.querySelectorAll(".graph").forEach(function (g) { + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; + }); + return; + } + + // ── Colours ───────────────────────────────────────────────────────────── + // Fill: the kind, the feature, or the DECLARED status of the claims on a node. + // Ring: a gate verdict (unclaimed). Never a test result. + function kindColour(n) { + return css({ entity: "--entity", value: "--value", prompt: "--prompt", template: "--prompt", projection: "--projection", report: "--report" }[n.kind] || "--entity"); + } + function fill(n, mode) { + if (n.abstract) return css("--retired"); + if (mode === "kind") return kindColour(n); + if (mode === "api") return n.api.length ? css("--accent") : css("--retired-soft"); + if (mode === "claims") return n.claims > 8 ? css("--live") : n.claims > 2 ? css("--partial") : n.claims > 0 ? css("--planned") : css("--retired-soft"); + if (mode === "cap") return n.feature >= 0 ? PAL[n.feature % PAL.length] : n.quality ? css("--retired") : css("--retired-soft"); + return n.status === "unclaimed" ? css("--retired-soft") : css("--" + n.status); + } + function legend(mode) { + var ring = D.hasClaims ? 'red ring: unclaimed (gate)' : ""; + if (mode === "cap") return '
    ' + D.features.map(function (f, i) { return '● ' + esc(f.label) + ""; }).join("") + '● qualities only○ no claim' + ring + "Fill is the feature (L1) with the most claims on the node; size is fields plus claims.
    "; + if (mode === "status") return '
    ' + STATUS.map(function (s) { return '' + GLYPH[s] + " " + s + ""; }).join("") + '○ no claim' + ring + "Fill is the best declared status among the requirements that claim the node.
    "; + if (mode === "api") return '
    ● mounted routes○ none
    '; + if (mode === "claims") return '
    ● more than 8 claims● 3 to 8● 1 or 2○ none' + ring + "
    "; + return '
    ' + ["entity", "value", "projection", "report", "prompt"].map(function (k) { return '● ' + k + ""; }).join("") + "Abstract bases are dashed and grey.
    "; + } + function shape(n) { return n.kind === "prompt" || n.kind === "template" ? "diamond" : n.kind === "value" ? "round-triangle" : n.kind === "projection" || n.kind === "report" ? "round-hexagon" : n.abstract ? "round-rectangle" : "ellipse"; } + function baseStyle() { + return [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", width: "data(size)", height: "data(size)", shape: "data(shape)", color: css("--ink"), "font-size": 10, "text-valign": "bottom", "text-margin-y": 3, "border-width": 1, "border-color": css("--line"), "text-wrap": "none" } }, + { selector: "node[dashed = 1]", style: { "border-style": "dashed", "border-width": 2, "background-opacity": 0.4 } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[faded = 1]", style: { opacity: 0.18 } }, + { selector: "edge", style: { width: 1.2, "line-color": css("--muted"), "target-arrow-color": css("--muted"), "target-arrow-shape": "triangle", "curve-style": "bezier", "arrow-scale": 0.7, opacity: 0.6 } }, + { selector: "edge[ext = 1]", style: { "line-style": "dashed", "target-arrow-shape": "triangle-tee" } }, + { selector: "edge[faded = 1]", style: { opacity: 0.08 } }, + { selector: ":selected", style: { "border-width": 3, "border-color": css("--accent") } }, + ]; + } + var bar = function (c) { + var t = STATUS.reduce(function (a, s) { return a + (c[s] || 0); }, 0); + if (!t) return '
    '; + return '
    ' + STATUS.filter(function (s) { return c[s]; }).map(function (s) { return ''; }).join("") + "
    "; + }; + var chip = function (s) { return s ? '' + (GLYPH[s] || "") + " " + esc(s) + "" : ""; }; + var nodeLink = function (id) { var n = byId[id]; return n ? '' + esc(n.name) + "" : esc(id); }; + + // ── S2: the model map ─────────────────────────────────────────────────── + // cose from a grid (not from one point) gives the same picture on every load. + var COSE = { name: "cose", animate: false, randomize: false, nodeRepulsion: 12000, nodeOverlap: 24, idealEdgeLength: 90, componentSpacing: 90, gravity: 0.6, padding: 24, nodeDimensionsIncludeLabels: true }; + function seedGrid(els) { + var nodes = els.filter(function (e) { return !e.data.source; }), cols = Math.ceil(Math.sqrt(nodes.length || 1)); + nodes.forEach(function (e, i) { e.position = { x: (i % cols) * 120, y: Math.floor(i / cols) * 100 }; }); + } + var cyEl = $("#cy"); + if (cyEl) { + var cy = null; + var params = new URLSearchParams(query()); + var sliceSel = $("#slice"), colourSel = $("#colour"); + if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); + if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); + var focus = params.get("focus"); + var promptSet = function () { + var s = {}; + D.nodes.forEach(function (n) { if (n.kind === "prompt" || n.kind === "template") s[n.id] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && (e.k === "payloadRef" || e.k === "responseRef")) s[e.t] = 1; }); + D.edges.forEach(function (e) { if (s[e.s] && byId[e.s] && byId[e.s].kind === "value" && e.k === "objectRef") s[e.t] = 1; }); + return s; + }; + var build = function (relayout) { + var slice = sliceSel.value, mode = colourSel.value, hide = $("#hideOut").checked, showExt = $("#showExt").checked; + $("#maplegend").innerHTML = legend(mode); + var inSlice = null; + if (slice === "@prompts") inSlice = promptSet(); + else if (slice && D.slices[slice]) { inSlice = {}; D.slices[slice].forEach(function (id) { inSlice[id] = 1; }); } + var showVals = $("#showValues").checked || slice === "@prompts" || (inSlice && Object.keys(inSlice).some(function (id) { return byId[id] && byId[id].kind !== "entity"; })); + var entityCount = D.nodes.filter(function (n) { return n.kind === "entity"; }).length; + if (!entityCount) showVals = true; + var nodes = D.nodes.filter(function (n) { return (n.kind === "entity" || showVals) && (!hide || !inSlice || inSlice[n.id]); }); + var ids = {}; + nodes.forEach(function (n) { ids[n.id] = 1; }); + var els = nodes.map(function (n) { + return { data: { id: n.id, label: n.name, col: fill(n, mode), size: 18 + Math.min(40, n.fields * 1.6 + n.claims * 2), shape: shape(n), faded: inSlice && !inSlice[n.id] ? 1 : 0, dashed: n.abstract, ring: n.unclaimed } }; + }); + D.edges.forEach(function (e, i) { + if (!ids[e.s] || !ids[e.t] || (!showExt && e.k === "extends")) return; + els.push({ data: { id: "e" + i, source: e.s, target: e.t, label: e.v || e.k, ext: e.k === "extends" ? 1 : 0, faded: inSlice && !(inSlice[e.s] && inSlice[e.t]) ? 1 : 0 } }); + }); + seedGrid(els); + var pan = cy && !relayout ? { pos: {} } : null; + if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); + if (cy) cy.destroy(); + var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); + cy = graph({ + container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), + layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, + }); + cy.on("tap", "node", function (ev) { showPanel(ev.target.id()); }); + cy.on("dbltap", "node", function (ev) { var n = byId[ev.target.id()]; if (n) location.href = href(n.href); }); + var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; + if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); + if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); + }; + ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); + $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; + redraw.push(function () { build(false); }); + build(true); + } + function slicePanel(r, nodes) { + return '
    Slice

    ' + (r.level ? "L" + r.level : "—") + '' + esc(r.label) + " " + chip(r.status) + "

    " + esc(r.statement) + "
    " + + "

    " + r.claimed + " model node" + (r.claimed === 1 ? "" : "s") + " claimed below

    " + nodes.map(nodeLink).join(", ") + + "

    Status below

    " + bar(r.rollup); + } + function showPanel(id) { + var n = byId[id], p = $("#panel"); + if (!n || !p) return; + var claims = D.reqs.filter(function (r) { return r.targets.indexOf(id) >= 0; }); + var byTop = {}; + claims.forEach(function (r) { var t = r; while (t.parent && reqById[t.parent]) t = reqById[t.parent]; (byTop[t.id] = byTop[t.id] || []).push(r); }); + var refs = D.edges.filter(function (e) { return e.s === id || e.t === id; }).length; + var gen = (D.generated[id] || []).map(function (g) { return '' + esc(g[0]) + " " + g[1]; }).join(" · "); + p.innerHTML = '
    ' + esc(n.pkg) + " · " + esc(n.kind) + (n.storage ? " · " + esc(n.storage) : "") + "
    " + + '

    ' + nodeLink(id) + (n.unclaimed ? ' unclaimed' : "") + "

    " + + "

    Why it exists (" + claims.length + " claim" + (claims.length === 1 ? "" : "s") + ")

    " + + (claims.length ? Object.keys(byTop).map(function (t) { + return "
    " + esc(reqById[t].label) + ": " + byTop[t].slice(0, 6).map(function (r) { return '' + (GLYPH[r.status] || "") + " " + esc(r.label) + ""; }).join(", ") + (byTop[t].length > 6 ? " +" + (byTop[t].length - 6) : "") + "
    "; + }).join("") : 'No requirement claims this node.') + + "

    Shape

    " + n.fields + " field" + (n.fields === 1 ? "" : "s") + ", " + refs + " reference" + (refs === 1 ? "" : "s") + + (n.api.length ? "

    API

    " + n.api.map(function (a) { return "
    " + esc(a) + "
    "; }).join("") : "") + + "

    Generated

    " + (gen || 'nothing traced'); + } + + // ── S3: the one-hop mini-map ──────────────────────────────────────────── + var mini = $("#cymini"); + if (mini) { + var me = mini.getAttribute("data-node"); + var drawMini = function () { + var es = D.edges.filter(function (e) { return e.s === me || e.t === me; }); + var ids = {}; + ids[me] = 1; + es.forEach(function (e) { ids[e.s] = 1; ids[e.t] = 1; }); + var els = Object.keys(ids).filter(function (id) { return byId[id]; }).sort().map(function (id) { + var n = byId[id]; + return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; + }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); + mini.innerHTML = ""; + var c = graph({ + container: mini, elements: els, maxZoom: 1.3, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, + { selector: "node[ring = 1]", style: { "border-width": 3, "border-color": css("--bad") } }, + { selector: "node[me = 1]", style: { width: 30, height: 30, "border-width": 3, "border-color": css("--accent") } }, + { selector: "edge", style: { width: 1, label: "data(label)", "font-size": 8, color: css("--muted"), "line-color": css("--muted"), "target-arrow-shape": "triangle", "target-arrow-color": css("--muted"), "curve-style": "bezier", "text-rotation": "autorotate", "text-background-color": css("--panel"), "text-background-opacity": 1, "text-background-padding": 2 } }, + ], + layout: { name: "concentric", concentric: function (n) { return n.data("me") ? 2 : 1; }, levelWidth: function () { return 1; }, startAngle: Math.PI, padding: 30, minNodeSpacing: 60 }, + }); + c.on("tap", "node", function (ev) { var n = byId[ev.target.id()]; if (n && n.id !== me) location.href = href(n.href); }); + }; + redraw.push(drawMini); + drawMini(); + } + + // ── S8: the trace ─────────────────────────────────────────────────────── + var tr = $("#cytrace"), tstart = $("#tstart"); + if (tr && tstart) { + var p2 = new URLSearchParams(query()).get("start"); + if (p2 && reqById[p2]) tstart.value = p2; + var drawTrace = function () { + var r0 = reqById[tstart.value]; + if (!r0) return; + var kids = {}; + D.reqs.forEach(function (r) { if (r.parent) (kids[r.parent] = kids[r.parent] || []).push(r); }); + var reqs = [], walk = function (r) { reqs.push(r); (kids[r.id] || []).forEach(walk); }; + walk(r0); + var cols = [[], [], [], []], els = [], seen = {}; + var add = function (id, label, col, data) { if (seen[id]) return; seen[id] = 1; cols[col].push(id); data.id = id; data.label = label; els.push({ data: data }); }; + reqs.forEach(function (r) { add("r:" + r.id, (r.level ? "L" + r.level + " " : "") + r.label, r.level >= 4 ? 1 : 0, { col: r.status ? css("--" + r.status) : css("--muted"), shape: "round-rectangle", go: r.href }); }); + reqs.forEach(function (r) { if (r.parent && seen["r:" + r.parent]) els.push({ data: { id: "pe:" + r.id, source: "r:" + r.parent, target: "r:" + r.id } }); }); + reqs.forEach(function (r) { + r.targets.forEach(function (t) { + var n = byId[t]; + if (!n) return; + add("o:" + t, n.name, 2, { col: kindColour(n), shape: shape(n), go: n.href, ring: n.unclaimed }); + if (!seen["le:" + r.id + ">" + t]) { seen["le:" + r.id + ">" + t] = 1; els.push({ data: { id: "le:" + r.id + ">" + t, source: "r:" + r.id, target: "o:" + t, col: r.status ? css("--" + r.status) : css("--muted") } }); } + }); + }); + cols[2].slice().forEach(function (oid) { + var id = oid.slice(2); + var gen = D.generated[id] || []; + if (!gen.length) return; + var total = gen.reduce(function (a, g) { return a + g[1]; }, 0); + var gid = "g:" + id; + add(gid, total + " generated (" + gen.map(function (g) { return g[0]; }).join(", ") + ")", 3, { col: css("--accent"), shape: "tag", go: byId[id].href }); + els.push({ data: { id: "ge:" + gid, source: oid, target: gid } }); + }); + var pos = {}; + cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); + tr.innerHTML = ""; + var c = graph({ + container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, + style: [ + { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, + { selector: "node[ring = 1]", style: { "border-width": 2, "border-color": css("--bad") } }, + { selector: "edge", style: { width: 1, "line-color": "data(col)", opacity: 0.5, "curve-style": "unbundled-bezier" } }, + { selector: "edge[!col]", style: { "line-color": css("--muted") } }, + ], + layout: { name: "preset", positions: function (n) { return pos[n.id()]; }, fit: true, padding: 24 }, + }); + c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); + }; + tstart.onchange = function () { + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); + drawTrace(); + }; + redraw.push(drawTrace); + drawTrace(); + } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); +})(); diff --git a/server/typescript/packages/docs-site/app/index.html b/server/typescript/packages/docs-site/app/index.html new file mode 100644 index 0000000000..6a91a98f6b --- /dev/null +++ b/server/typescript/packages/docs-site/app/index.html @@ -0,0 +1,20 @@ + + + + + +Model explorer + + + + + +

    Loading the model…

    + + + + + + + + diff --git a/server/typescript/packages/docs-site/assets/explorer.js b/server/typescript/packages/docs-site/assets/explorer.js index 094bc5075f..61c4153d2e 100644 --- a/server/typescript/packages/docs-site/assets/explorer.js +++ b/server/typescript/packages/docs-site/assets/explorer.js @@ -1,11 +1,24 @@ // The model explorer's scripts: search, the theme toggle, and the three graphs (the model map, -// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which -// assets/explorer-data.js sets from explorer.json; nothing here derives a model fact. +// an object page's one-hop mini-map, the trace). They read window.MO_EXPLORER, which the +// explorer app computes from the docs view (or, on a static export, assets/explorer-data.js +// sets); nothing here derives a model fact. // `meta eject docs-site` copies this file to codegen/docs-site/assets/. +// +// On a static page this runs once, as it loads. In the explorer app (window.MO_APP is set) it +// runs again for every page the app draws, and the app supplies four things a page would +// otherwise take from its own URL: link targets, the query string, writing the query string +// back, and document listeners the app drops when the reader leaves the page. (function () { "use strict"; + function run() { + var APP = window.MO_APP || null; var D = window.MO_EXPLORER || { nodes: [], edges: [], slices: {}, features: [], reqs: [], generated: {}, search: [] }; var ROOT = document.body.getAttribute("data-root") || ""; + var query = function () { return APP ? APP.search() : location.search; }; + var setQuery = function (search) { if (APP) APP.replaceQuery(search); else history.replaceState(null, "", search ? location.pathname + search : location.pathname); }; + var listen = function (type, f) { if (APP) APP.listen(type, f); else document.addEventListener(type, f); }; + // A graph the app draws is destroyed when the reader leaves its page. + var graph = function (opts) { var c = cytoscape(opts); if (APP) APP.onLeave(function () { if (!c.destroyed()) c.destroy(); }); return c; }; var $ = function (s, r) { return (r || document).querySelector(s); }; var esc = function (s) { return String(s == null ? "" : s).replace(/[&<>"']/g, function (c) { return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]; }); }; var css = function (v) { return getComputedStyle(document.documentElement).getPropertyValue(v).trim(); }; @@ -16,7 +29,7 @@ D.nodes.forEach(function (n) { byId[n.id] = n; }); var reqById = {}; D.reqs.forEach(function (r) { reqById[r.id] = r; }); - var href = function (rel) { return ROOT + rel; }; + var href = function (rel) { return APP ? APP.href(rel) : ROOT + rel; }; var redraw = []; // ── Theme ─────────────────────────────────────────────────────────────── @@ -36,7 +49,8 @@ // full-text index answers instead. var q = $("#q"), res = $("#results"), pagefind = null, pagefindTried = false, sel = -1; function loadPagefind() { - if (pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); + // The app draws its own pages; a Pagefind index (of a static export) would link out of it. + if (APP || pagefindTried || !/^https?:$/.test(location.protocol)) return Promise.resolve(null); pagefindTried = true; // Pagefind takes its base URL from where pagefind.js loads, so loading it from ROOT makes every // result URL carry the path the site is served under (a sub-path included). @@ -82,15 +96,15 @@ location.href = links[Math.max(0, sel)].href; } else if (e.key === "Escape") { res.style.display = "none"; q.blur(); } }); - document.addEventListener("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); - document.addEventListener("keydown", function (e) { + listen("click", function (e) { if (!$("#search").contains(e.target)) res.style.display = "none"; }); + listen("keydown", function (e) { if (e.key === "/" && document.activeElement !== q && !/^(INPUT|SELECT|TEXTAREA)$/.test(document.activeElement.tagName)) { e.preventDefault(); q.focus(); } }); } if (typeof window.cytoscape !== "function") { document.querySelectorAll(".graph").forEach(function (g) { - g.innerHTML = '
    The graph library did not load (it comes from the site\'s assetBase). Every node still has its own page.
    '; + g.innerHTML = '
    The graph library did not load. Every node still has its own page.
    '; }); return; } @@ -148,7 +162,7 @@ var cyEl = $("#cy"); if (cyEl) { var cy = null; - var params = new URLSearchParams(location.search); + var params = new URLSearchParams(query()); var sliceSel = $("#slice"), colourSel = $("#colour"); if (params.get("slice") && sliceSel.querySelector('option[value="' + CSS.escape(params.get("slice")) + '"]')) sliceSel.value = params.get("slice"); if (params.get("colour") && colourSel.querySelector('option[value="' + CSS.escape(params.get("colour")) + '"]')) colourSel.value = params.get("colour"); @@ -184,7 +198,7 @@ if (pan) cy.nodes().forEach(function (n) { pan.pos[n.id()] = n.position(); }); if (cy) cy.destroy(); var keep = pan && els.every(function (el) { return el.data.source || pan.pos[el.data.id]; }); - cy = cytoscape({ + cy = graph({ container: cyEl, elements: els, wheelSensitivity: 0.3, maxZoom: 1.5, style: baseStyle(), layout: keep ? { name: "preset", positions: function (n) { return pan.pos[n.id()]; }, fit: true, padding: 20 } : COSE, }); @@ -193,10 +207,10 @@ var sliceReq = slice.indexOf("requirement:") === 0 ? reqById[slice.slice("requirement:".length)] : null; if (sliceReq) $("#panel").innerHTML = slicePanel(sliceReq, D.slices[slice] || []); if (focus && byId[focus] && cy.getElementById(focus).length) { cy.getElementById(focus).select(); showPanel(focus); focus = null; } - var u = new URL(location.href); - if (slice) u.searchParams.set("slice", slice); else u.searchParams.delete("slice"); - u.searchParams.set("colour", mode); - history.replaceState(null, "", u.search ? u.pathname + u.search : u.pathname); + var qs = new URLSearchParams(query()); + if (slice) qs.set("slice", slice); else qs.delete("slice"); + qs.set("colour", mode); + setQuery("?" + qs.toString()); }; ["#slice", "#colour", "#hideOut", "#showValues", "#showExt"].forEach(function (s) { $(s).onchange = function () { build(false); }; }); $("#relayout").onclick = function () { if (cy) cy.layout(Object.assign({}, COSE, { randomize: true })).run(); }; @@ -241,7 +255,7 @@ return { data: { id: id, label: n.name, col: fill(n, D.hasClaims ? "status" : "kind"), me: id === me ? 1 : 0, ring: n.unclaimed, shape: shape(n) } }; }).concat(es.map(function (e, i) { return { data: { id: "m" + i, source: e.s, target: e.t, label: e.v || e.k } }; })); mini.innerHTML = ""; - var c = cytoscape({ + var c = graph({ container: mini, elements: els, maxZoom: 1.3, style: [ { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 10, color: css("--ink"), "text-valign": "bottom", "text-margin-y": 2, width: 18, height: 18, "border-width": 1, "border-color": css("--line") } }, @@ -260,7 +274,7 @@ // ── S8: the trace ─────────────────────────────────────────────────────── var tr = $("#cytrace"), tstart = $("#tstart"); if (tr && tstart) { - var p2 = new URLSearchParams(location.search).get("start"); + var p2 = new URLSearchParams(query()).get("start"); if (p2 && reqById[p2]) tstart.value = p2; var drawTrace = function () { var r0 = reqById[tstart.value]; @@ -293,7 +307,7 @@ var pos = {}; cols.forEach(function (c, ci) { c.forEach(function (id, i) { pos[id] = { x: ci * 260, y: (i - c.length / 2) * 26 }; }); }); tr.innerHTML = ""; - var c = cytoscape({ + var c = graph({ container: tr, elements: els, wheelSensitivity: 0.3, maxZoom: 1.6, style: [ { selector: "node", style: { "background-color": "data(col)", label: "data(label)", shape: "data(shape)", "font-size": 11, color: css("--ink"), "text-halign": "right", "text-valign": "center", "text-margin-x": 6, width: 12, height: 12 } }, @@ -306,10 +320,13 @@ c.on("tap", "node", function (ev) { var go = ev.target.data("go"); if (go) location.href = href(go); }); }; tstart.onchange = function () { - var u = new URL(location.href); u.searchParams.set("start", tstart.value); history.replaceState(null, "", u.pathname + u.search); + var qs = new URLSearchParams(query()); qs.set("start", tstart.value); setQuery("?" + qs.toString()); drawTrace(); }; redraw.push(drawTrace); drawTrace(); } + } + window.MO_THEME = run; + if (!window.MO_APP) run(); })(); diff --git a/server/typescript/packages/docs-site/package.json b/server/typescript/packages/docs-site/package.json index 8dbf853723..ec8be02cb0 100644 --- a/server/typescript/packages/docs-site/package.json +++ b/server/typescript/packages/docs-site/package.json @@ -17,12 +17,13 @@ "src", "templates", "assets", + "app", "README.md", "LICENSE" ], "scripts": { "build": "tsc -p .", - "typecheck": "tsc -p tsconfig.typecheck.json", + "typecheck": "tsc -p tsconfig.typecheck.json && tsc -p tsconfig.app.json", "test": "bun test" }, "license": "Apache-2.0", diff --git a/server/typescript/packages/docs-site/scripts/build-app.ts b/server/typescript/packages/docs-site/scripts/build-app.ts new file mode 100644 index 0000000000..1a8eb1951c --- /dev/null +++ b/server/typescript/packages/docs-site/scripts/build-app.ts @@ -0,0 +1,87 @@ +// Build the model explorer app into the repository's canonical copy, `explorer-app/`. +// +// bun server/typescript/packages/docs-site/scripts/build-app.ts # rebuild +// bun server/typescript/packages/docs-site/scripts/build-app.ts --check # exit 1 when stale +// +// It bundles `app-src/main.ts` (the router around the explorer's page code, `src/explorer/`) with +// every explorer template for the browser, as one classic script, and copies the shell and the +// theme beside it. Cytoscape (`assets/cytoscape.min.js`) is vendored in `explorer-app/` and is +// not touched here. Run `scripts/sync-explorer-app.sh` afterwards to refresh every port's copy. + +import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { EXPLORER_ASSET_NAMES, EXPLORER_TEMPLATE_NAMES } from "../src/scaffold.js"; + +const PKG = resolve(import.meta.dir, ".."); +const REPO = resolve(PKG, "../../../.."); +const OUT = join(REPO, "explorer-app"); +const RENDER_SRC = resolve(PKG, "../render/src"); + +/** The bundle's files by path under `explorer-app/`. */ +export async function buildExplorerApp(): Promise> { + const templates: Record = {}; + for (const name of EXPLORER_TEMPLATE_NAMES) templates[name] = readFileSync(join(PKG, "templates", name), "utf8"); + const result = await Bun.build({ + entrypoints: [join(PKG, "app-src/main.ts")], + target: "browser", + format: "iife", + minify: true, + // Bundle the workspace packages from their sources (the `bun` export condition), never from + // a `dist/` that may be stale or missing. + conditions: ["bun"], + plugins: [ + { + name: "explorer-app", + setup(b) { + b.onResolve({ filter: /^explorer-templates$/ }, () => ({ path: "explorer-templates", namespace: "explorer-app" })); + b.onLoad({ filter: /.*/, namespace: "explorer-app" }, () => ({ contents: `export default ${JSON.stringify(templates)};`, loader: "js" })); + // The renderer's package root also exports its file-system provider; the app needs the + // Mustache renderer and the in-memory provider only. + b.onResolve({ filter: /^@metaobjectsdev\/render$/ }, () => ({ path: "render-shim", namespace: "explorer-app-render" })); + b.onLoad({ filter: /.*/, namespace: "explorer-app-render" }, () => ({ + contents: `export { render } from ${JSON.stringify(join(RENDER_SRC, "render.ts"))};\nexport { InMemoryProvider } from ${JSON.stringify(join(RENDER_SRC, "provider.ts"))};\n`, + loader: "ts", + resolveDir: RENDER_SRC, + })); + // Jinja is a prompt engine; the explorer's templates are Mustache, so the app never + // reaches it. + b.onResolve({ filter: /^nunjucks$/ }, () => ({ path: "nunjucks", namespace: "explorer-app-nunjucks" })); + b.onLoad({ filter: /.*/, namespace: "explorer-app-nunjucks" }, () => ({ + contents: `const unavailable = () => { throw new Error("the explorer app renders Mustache only"); };\nexport default new Proxy({}, { get: () => unavailable });\n`, + loader: "js", + })); + }, + }, + ], + }); + if (!result.success) throw new Error("explorer app build failed:\n" + result.logs.map(String).join("\n")); + const js = await result.outputs[0]!.text(); + const files = new Map(); + files.set("assets/explorer-app.js", js.endsWith("\n") ? js : js + "\n"); + files.set("index.html", readFileSync(join(PKG, "app-src/index.html"), "utf8")); + for (const a of EXPLORER_ASSET_NAMES) files.set(`assets/${a}`, readFileSync(join(PKG, "assets", a), "utf8")); + return files; +} + +if (import.meta.main) { + const check = process.argv.includes("--check"); + const files = await buildExplorerApp(); + const stale: string[] = []; + for (const [rel, content] of files) { + const abs = join(OUT, rel); + const same = existsSync(abs) && readFileSync(abs, "utf8") === content; + if (same) continue; + if (check) { + stale.push(rel); + continue; + } + mkdirSync(dirname(abs), { recursive: true }); + writeFileSync(abs, content); + console.log(`wrote explorer-app/${rel}`); + } + if (check && stale.length > 0) { + console.error(`explorer-app/ is stale (rebuild with scripts/build-app.ts): ${stale.join(", ")}`); + process.exit(1); + } + if (!check) console.log(`explorer app built: ${files.size} files under explorer-app/ (bundle ${files.get("assets/explorer-app.js")!.length} bytes)`); +} diff --git a/server/typescript/packages/docs-site/src/explorer/core.ts b/server/typescript/packages/docs-site/src/explorer/core.ts new file mode 100644 index 0000000000..9a373e9deb --- /dev/null +++ b/server/typescript/packages/docs-site/src/explorer/core.ts @@ -0,0 +1,241 @@ +// The explorer's page table, with no file system: one entry per page, rendered when asked for. +// +// Both ways the explorer reaches a reader go through this module: +// - the browser app (`app/main.ts`, bundled into `explorer-app.js`) renders a page when it is +// visited, from the docs view it loaded; +// - the static export (`generateExplorerSite` in `site.ts`) renders every page once and +// writes it. +// So a page is the same bytes either way. Nothing here imports Node: the app bundle carries it. + +import { render, InMemoryProvider } from "@metaobjectsdev/render"; +import { + DOC_ATTR_DESCRIPTION, + REQUIREMENT_SUBTYPE_ARCHITECTURAL, + REQUIREMENT_SUBTYPE_FUNCTIONAL, + TYPE_REQUIREMENT, +} from "@metaobjectsdev/metadata/constants"; +import type { DocsView } from "@metaobjectsdev/metadata"; +import { ViewIndex } from "./view-index.js"; +import { esc, legendHtml, relHref } from "./html.js"; +import { + PAGE_API, + PAGE_FEATURES, + PAGE_GAPS, + PAGE_MAP, + PAGE_MATRIX, + PAGE_MODEL, + PAGE_OVERVIEW, + PAGE_PROMPTS, + PAGE_QUALITIES, + PAGE_TRACE, + Pages, +} from "./pages.js"; + +/** The graph library the map, mini-maps and trace load, under a CDN-style base. */ +export const CYTOSCAPE_PATH = "cytoscape@3.30.2/dist/cytoscape.min.js"; + +/** The file name the app and the static export ship Cytoscape under, in `assets/`. */ +export const CYTOSCAPE_ASSET = "cytoscape.min.js"; + +interface NavItem { + key: string; + label: string; + href: string; +} + +const NAV: readonly NavItem[] = [ + { key: "overview", label: "Overview", href: PAGE_OVERVIEW }, + { key: "map", label: "Model map", href: PAGE_MAP }, + { key: "requirements", label: "Requirements", href: PAGE_FEATURES }, + { key: "matrix", label: "Matrix", href: PAGE_MATRIX }, + { key: "trace", label: "Trace", href: PAGE_TRACE }, + { key: "prompts", label: "Prompts", href: PAGE_PROMPTS }, + { key: "api", label: "API", href: PAGE_API }, + { key: "gaps", label: "Gaps", href: PAGE_GAPS }, +]; + +export interface ExplorerCoreOptions { + view: DocsView; + /** The project's name, as the header and the home page print it. */ + title: string; + /** Every explorer template by basename (`EXPLORER_TEMPLATE_NAMES`). */ + templates: Readonly>; + /** Prompt text by template node id. */ + texts?: ReadonlyMap | Readonly>; + /** Printed in every footer. */ + stamp?: string; + /** Where a graph page loads Cytoscape from, relative to the page or absolute. A function of + * the page's root-relative prefix (`relRoot`), since a relative path differs per page. */ + cytoscapeSrc: (relRoot: string) => string; + /** Kept on every page's payload for an owned template that reads it. */ + assetBase: string; +} + +export interface ExplorerCore { + /** Every page by its site-relative path, in the order the static export writes them. */ + pages: ReadonlyMap string>; + /** The data the map, mini-maps, trace and search read (`window.MO_EXPLORER`). */ + graphData(): Record; +} + +function textsMap(t: ExplorerCoreOptions["texts"]): ReadonlyMap { + if (t === undefined) return new Map(); + if (t instanceof Map) return t; + return new Map(Object.entries(t as Readonly>)); +} + +export function createExplorer(opts: ExplorerCoreOptions): ExplorerCore { + const ix = new ViewIndex(opts.view); + const pagesModel = new Pages(ix); + const texts = textsMap(opts.texts); + for (const [id, text] of texts) pagesModel.texts.set(id, text); + const tpl = (name: string): string => { + const t = opts.templates[name]; + if (t === undefined) throw new Error(`docs-site explorer: no template ${name}`); + return t; + }; + // The one partial: the requirement card S1 repeats (`{{> card}}`). + const provider = new InMemoryProvider({ card: tpl("explorer-card.mustache") }); + const head = tpl("explorer-head.mustache"); + const foot = tpl("explorer-foot.mustache"); + const legend = legendHtml(ix.hasClaims()); + const pages = new Map string>(); + + const page = (template: string, href: string, nav: string, pageTitle: string, data: () => Record, graph = false): void => { + // Two nodes that map to one page would silently keep only the last; refuse instead. + if (pages.has(href)) throw new Error(`docs-site explorer: two pages map to ${href}`); + const body = tpl(template); + pages.set(href, () => { + const relRoot = relHref(href, ""); + const payload = { + ...data(), + siteTitle: esc(opts.title), + pageTitle: esc(pageTitle), + stamp: esc(opts.stamp ?? ""), + relRoot, + assetBase: opts.assetBase, + cytoscapeSrc: opts.cytoscapeSrc(relRoot), + needsGraph: graph, + pageKey: nav, + nav: NAV.map((n) => ({ label: n.label, href: relHref(href, n.href), on: n.key === nav })), + legendHtml: legend, + }; + return render({ template: head + body + foot, payload, provider, format: "text" }); + }); + }; + + // S1 and the indexes. + page("explorer-overview.html.mustache", PAGE_OVERVIEW, "overview", "Overview", () => pagesModel.overview(opts.title)); + page("explorer-map.html.mustache", PAGE_MAP, "map", "Model map", () => pagesModel.map(), true); + page("explorer-requirements.html.mustache", PAGE_FEATURES, "requirements", "Features", () => pagesModel.requirements(REQUIREMENT_SUBTYPE_FUNCTIONAL, PAGE_FEATURES)); + page("explorer-requirements.html.mustache", PAGE_QUALITIES, "requirements", "Qualities", () => pagesModel.requirements(REQUIREMENT_SUBTYPE_ARCHITECTURAL, PAGE_QUALITIES)); + page("explorer-matrix.html.mustache", PAGE_MATRIX, "matrix", "Matrix", () => pagesModel.matrix()); + page("explorer-trace.html.mustache", PAGE_TRACE, "trace", "Trace", () => pagesModel.trace(), true); + page("explorer-prompts.html.mustache", PAGE_PROMPTS, "prompts", "Prompts", () => pagesModel.prompts()); + page("explorer-api.html.mustache", PAGE_API, "api", "API", () => pagesModel.api()); + page("explorer-gaps.html.mustache", PAGE_GAPS, "gaps", "Gaps", () => pagesModel.gaps()); + page("explorer-model.html.mustache", PAGE_MODEL, "map", "Packages", () => pagesModel.model()); + + for (const pkg of ix.packages) { + page("explorer-package.html.mustache", pagesModel.packagePage(pkg), "map", pkg === "" ? "(no package)" : pkg, () => pagesModel.packageIndex(pkg)); + } + for (const n of ix.objects) page("explorer-object.html.mustache", pagesModel.objectPage(n), "map", n.name, () => pagesModel.object(n), true); + for (const t of ix.templates) page("explorer-prompt.html.mustache", pagesModel.objectPage(t), "prompts", t.name, () => pagesModel.prompt(t, texts.get(t.id))); + for (const n of ix.others) page("explorer-node.html.mustache", pagesModel.objectPage(n), "map", n.name, () => pagesModel.node(n)); + for (const r of ix.requirements) page("explorer-requirement.html.mustache", pagesModel.reqPage(r), "requirements", pagesModel.reqLabel(r), () => pagesModel.requirement(r)); + + return { pages, graphData: () => graphData(ix, pagesModel) }; +} + +/** The data the map, mini-maps, trace and search read. Every value comes off the index. */ +function graphData(ix: ViewIndex, p: Pages): Record { + const features = ix.features(); + const top = [...ix.objects, ...ix.templates]; + const nodes = top.map((n) => { + const feature = ix.featureOf(n.id); + const claims = ix.claims(n.id); + return { + id: n.id, + name: n.name, + kind: ix.kindOf(n), + pkg: n.package, + href: p.objectPage(n), + abstract: n.abstract === true ? 1 : 0, + fields: ix.fields(n.id).length, + claims: claims.length, + status: ix.claimStatus(n.id), + feature: feature !== undefined ? features.indexOf(feature) : -1, + quality: claims.length > 0 && claims.every((c) => c.req.kind === REQUIREMENT_SUBTYPE_ARCHITECTURAL) ? 1 : 0, + unclaimed: p.unclaimedEntity(n) ? 1 : 0, + api: ix.routes(n.id).map((r) => `${r.method} ${r.path}`), + gen: ix.generated(n.id).length, + storage: ix.storage(n.id)?.kind ?? "", + }; + }); + const ids = new Set(top.map((n) => n.id)); + const slices: Record = {}; + for (const s of ix.view.slices) slices[s.id] = [...new Set(s.nodes.map((x) => ix.ownerOf(x)).filter((x) => ids.has(x)))].sort(); + const reqs = ix.requirements.map((r) => ({ + id: r.node.id, + label: p.reqLabel(r), + path: p.reqPath(r), + level: r.level ?? 0, + status: r.status, + kind: r.kind, + parent: r.parent?.node.id ?? "", + href: p.reqPage(r), + targets: ix.linkTargets(r).map((id) => ix.ownerOf(id)), + statement: r.req.statement, + rollup: ix.rollup(r), + claimed: ix.targetsOf(r).length, + })); + const generated: Record = {}; + for (const n of top) { + const by = new Map(); + for (const f of ix.generated(n.id)) by.set(f.generatedBy, (by.get(f.generatedBy) ?? 0) + 1); + if (by.size > 0) generated[n.id] = [...by.entries()].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)); + } + const search: { t: string; s: string; h: string; k: string }[] = []; + for (const n of top) { + const desc = typeof n.attrs[DOC_ATTR_DESCRIPTION] === "string" ? (n.attrs[DOC_ATTR_DESCRIPTION] as string) : ""; + search.push({ t: n.name, s: `${n.type}.${n.subType}${n.package !== "" ? ` · ${n.package}` : ""}`, h: p.objectPage(n), k: `${n.name} ${n.id} ${desc}`.toLowerCase() }); + for (const f of ix.fields(n.id)) { + if (f.inheritedFrom !== undefined) continue; + search.push({ t: `${n.name}.${f.name}`, s: `field.${f.subType}`, h: p.pageOf(f.id) ?? p.objectPage(n), k: `${n.name}.${f.name} ${f.id}`.toLowerCase() }); + } + } + for (const n of ix.others) { + const desc = typeof n.attrs[DOC_ATTR_DESCRIPTION] === "string" ? (n.attrs[DOC_ATTR_DESCRIPTION] as string) : ""; + search.push({ t: n.name, s: `${n.type}.${n.subType}${n.package !== "" ? ` · ${n.package}` : ""}`, h: p.objectPage(n), k: `${n.name} ${n.id} ${desc}`.toLowerCase() }); + } + for (const r of ix.requirements) { + search.push({ + t: p.reqLabel(r), + s: `${r.level !== undefined ? `L${r.level}` : "—"} ${r.kind}${r.status !== "" ? ` · ${r.status}` : ""} · ${p.reqPath(r)}`, + h: p.reqPage(r), + k: `${p.reqPath(r)} ${r.node.id} ${p.reqLabel(r)} ${r.req.statement}`.toLowerCase(), + }); + } + return { + nodes, + // Every reference the view lists between two nodes on the map, labelled by the attribute + // that carries it (a report's `@from` among them, so a report is not an island). The map + // draws objects and prompts, and an edge to a node it does not draw would not load. + edges: ix + .modelEdges() + .filter((e) => ids.has(e.from) && ids.has(e.to)) + .map((e) => ({ s: e.from, t: e.to, k: e.kind, ...(e.via !== undefined ? { v: localTail(e.via) } : {}) })), + slices, + features: features.map((f) => ({ id: f.node.id, label: p.reqLabel(f) })), + reqs, + generated, + search, + hasClaims: ix.hasClaims(), + requirementType: TYPE_REQUIREMENT, + }; +} + +function localTail(id: string): string { + const i = id.lastIndexOf("."); + return i < 0 ? id : id.slice(i + 1); +} diff --git a/server/typescript/packages/docs-site/src/explorer/html.ts b/server/typescript/packages/docs-site/src/explorer/html.ts index d6d2933b58..1c16c7b508 100644 --- a/server/typescript/packages/docs-site/src/explorer/html.ts +++ b/server/typescript/packages/docs-site/src/explorer/html.ts @@ -8,7 +8,7 @@ // - a ROLL-UP of the statuses below is a separate stacked bar, and never repaints the chip. // Nothing here colours a test result: the build does not read one. -import { REQUIREMENT_ATTR_DISPOSITION } from "@metaobjectsdev/metadata"; +import { REQUIREMENT_ATTR_DISPOSITION } from "@metaobjectsdev/metadata/constants"; import { STATUSES, STATUS_GLYPH, type ReqEntry, type Rollup } from "./view-index.js"; export function esc(s: unknown): string { diff --git a/server/typescript/packages/docs-site/src/explorer/pages.ts b/server/typescript/packages/docs-site/src/explorer/pages.ts index 812c696a99..f7041e73d9 100644 --- a/server/typescript/packages/docs-site/src/explorer/pages.ts +++ b/server/typescript/packages/docs-site/src/explorer/pages.ts @@ -81,7 +81,7 @@ import { REQUIREMENT_STATUSES_WITH_OUTSTANDING_WORK, REQUIREMENT_SUBTYPE_ARCHITECTURAL, REQUIREMENT_SUBTYPE_FUNCTIONAL, -} from "@metaobjectsdev/metadata"; +} from "@metaobjectsdev/metadata/constants"; import type { DocsViewAttrValue, DocsViewLink } from "@metaobjectsdev/metadata"; import type { PageNode, ReqEntry, ViewIndex } from "./view-index.js"; import { STATUSES } from "./view-index.js"; diff --git a/server/typescript/packages/docs-site/src/explorer/site.ts b/server/typescript/packages/docs-site/src/explorer/site.ts index e6c2d016f3..1b3893d954 100644 --- a/server/typescript/packages/docs-site/src/explorer/site.ts +++ b/server/typescript/packages/docs-site/src/explorer/site.ts @@ -1,8 +1,27 @@ -// generateExplorerSite(): the model explorer as a static site (design report §3.3, phase P1). +// generateExplorerSite(): the model explorer (design report §3.3), written one of two ways. // // It reads one docs view (`buildDocsView` in `@metaobjectsdev/metadata`, and, for the prompt -// pages, the prompt texts), renders a page per -// screen through the bundled Mustache templates, and writes: +// pages, the prompt texts). +// +// `output: "app"` (the default) writes a single-page browser app and the data it reads, and no +// pages at all. The app draws every page in the browser from the same page code (`core.ts`), +// works from `file://` with no server, and follows the model on disk: it polls the stamp file +// about once a second and reloads the data when the stamp moves, keeping the page it is on. +// +// index.html the app's shell (the same file for every project) +// assets/explorer-app.js the app: the page code, the templates and the router +// assets/explorer.css, explorer.js the theme (`meta eject docs-site` copies them) +// assets/cytoscape.min.js the graph library (MIT), so the graphs draw offline +// explorer-model.js the docs view, the prompt texts, the title and any owned +// templates, as one script the shell loads +// explorer-stamp.js the model file's hash, which the app polls +// explorer.json the docs view itself, byte for byte +// +// The app's files (everything but the three data files) are the canonical copy under +// `explorer-app/` at the repository root; every port ships the same bytes. +// +// `output: "static"` writes a page per screen instead, for a team that wants to publish the +// pages without scripts or index them for search: // // index.html S1 what the project does // map.html S2 the model map (slices, colour-by) @@ -14,45 +33,35 @@ // requirements/{features,qualities}.html S5 // requirements//.html S6 // matrix.html, trace.html, gaps.html, api.html, prompts.html, model/index.html, model//index.html -// assets/explorer.css, assets/explorer.js the theme (`meta eject docs-site` copies them) +// assets/explorer.css, assets/explorer.js the theme +// assets/cytoscape.min.js unless `assetBase` names a mirror to load it from // assets/explorer-data.js the graph and the search index the scripts read // explorer.json the docs view itself, byte for byte // -// The output depends on its inputs alone (no clock, no random layout seed in the files), so the -// site can sit under `meta verify --codegen`. Search works offline from explorer-data.js; when the -// published site has been indexed with Pagefind (`npx pagefind --site `), the search box uses -// that index instead. The pages carry Pagefind's markup for it. +// Either output depends on its inputs alone (no clock, no random layout seed in the files), so +// the site can sit under `meta verify --codegen`. Every build checks its own links. +import { createHash } from "node:crypto"; import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, isAbsolute, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; -import { render, InMemoryProvider } from "@metaobjectsdev/render"; -import { REQUIREMENT_SUBTYPE_ARCHITECTURAL, REQUIREMENT_SUBTYPE_FUNCTIONAL, serializeDocsView, type DocsView } from "@metaobjectsdev/metadata"; -import { TEMPLATE_ATTR_TEXT_REF, TYPE_REQUIREMENT, DOC_ATTR_DESCRIPTION } from "@metaobjectsdev/metadata/constants"; -import { checkLinks } from "../link-check.js"; -import { EXPLORER_ASSET_NAMES, EXPLORER_TEMPLATE_NAMES } from "../scaffold.js"; -import { ViewIndex } from "./view-index.js"; -import { esc, legendHtml, relHref } from "./html.js"; -import { - PAGE_API, - PAGE_FEATURES, - PAGE_GAPS, - PAGE_MAP, - PAGE_MATRIX, - PAGE_MODEL, - PAGE_OVERVIEW, - PAGE_PROMPTS, - PAGE_QUALITIES, - PAGE_TRACE, - Pages, -} from "./pages.js"; +import { serializeDocsView, type DocsView } from "@metaobjectsdev/metadata"; +import { TEMPLATE_ATTR_TEXT_REF } from "@metaobjectsdev/metadata/constants"; +import { checkLinks, checkLinksInMemory } from "../link-check.js"; +import { EXPLORER_APP_FILES, EXPLORER_ASSET_NAMES, EXPLORER_TEMPLATE_NAMES } from "../scaffold.js"; +import { CYTOSCAPE_ASSET, CYTOSCAPE_PATH, createExplorer } from "./core.js"; -export { EXPLORER_ASSET_NAMES, EXPLORER_TEMPLATE_NAMES }; +export { EXPLORER_APP_FILES, EXPLORER_ASSET_NAMES, EXPLORER_TEMPLATE_NAMES, CYTOSCAPE_PATH }; -/** The graph library the map, mini-maps and trace load from `assetBase`. */ -export const CYTOSCAPE_PATH = "cytoscape@3.30.2/dist/cytoscape.min.js"; +/** The two ways the explorer is written. */ +export const EXPLORER_OUTPUT_APP = "app"; +export const EXPLORER_OUTPUT_STATIC = "static"; +export type ExplorerOutput = typeof EXPLORER_OUTPUT_APP | typeof EXPLORER_OUTPUT_STATIC; -const DEFAULT_ASSET_BASE = "https://cdn.jsdelivr.net/npm"; +/** The data files the app reads, beside its shell. */ +export const EXPLORER_MODEL_FILE = "explorer-model.js"; +export const EXPLORER_STAMP_FILE = "explorer-stamp.js"; +export const EXPLORER_VIEW_FILE = "explorer.json"; export interface ExplorerSiteOptions { /** The docs view of the model (`buildDocsView`). */ @@ -60,6 +69,8 @@ export interface ExplorerSiteOptions { outDir: string; /** The project's name, as the header and the home page print it. */ title: string; + /** `app` (default): one browser app over the view. `static`: a page per screen. */ + output?: ExplorerOutput; /** Printed in every footer. Default none, so the pages depend on the model alone. */ stamp?: string; /** Prompt text by template node id, for the prompt pages and the unused-payload check. */ @@ -67,12 +78,15 @@ export interface ExplorerSiteOptions { /** Override dirs: a file of the same basename there wins over the bundled one. */ templatesDir?: string; assetsDir?: string; - /** Where Cytoscape is loaded from. Default `https://cdn.jsdelivr.net/npm`. */ + /** Static output only: where Cytoscape is loaded from, as a CDN-style base + * (`${assetBase}/cytoscape@3.30.2/dist/cytoscape.min.js`). Default: the copy the site ships + * in `assets/`. The app always uses its own copy. */ assetBase?: string; } export interface ExplorerSiteResult { - /** Every HTML page written, site-relative, in write order. */ + /** Every HTML page the site has, site-relative: written ones for `static`, the ones the app + * draws for `app`. */ pages: string[]; /** Every file written (pages, assets, data), site-relative, sorted. */ files: string[]; @@ -81,6 +95,8 @@ export interface ExplorerSiteResult { const SELF_DIR = dirname(fileURLToPath(import.meta.url)); const BUNDLED_TEMPLATES = resolve(SELF_DIR, "../../templates"); const BUNDLED_ASSETS = resolve(SELF_DIR, "../../assets"); +/** The package's copy of the repository's `explorer-app/` (scripts/sync-explorer-app.sh). */ +export const BUNDLED_APP = resolve(SELF_DIR, "../../app"); function loadFrom(bundled: string, name: string, overrideDir?: string): string { if (overrideDir !== undefined) { @@ -90,23 +106,6 @@ function loadFrom(bundled: string, name: string, overrideDir?: string): string { return readFileSync(join(bundled, name), "utf8"); } -interface NavItem { - key: string; - label: string; - href: string; -} - -const NAV: readonly NavItem[] = [ - { key: "overview", label: "Overview", href: PAGE_OVERVIEW }, - { key: "map", label: "Model map", href: PAGE_MAP }, - { key: "requirements", label: "Requirements", href: PAGE_FEATURES }, - { key: "matrix", label: "Matrix", href: PAGE_MATRIX }, - { key: "trace", label: "Trace", href: PAGE_TRACE }, - { key: "prompts", label: "Prompts", href: PAGE_PROMPTS }, - { key: "api", label: "API", href: PAGE_API }, - { key: "gaps", label: "Gaps", href: PAGE_GAPS }, -]; - /** Read each prompt's `.mustache` text from the directories the model's `@textRef` resolves in. */ export function readPromptTexts(view: DocsView, dirs: readonly string[]): Map { const out = new Map(); @@ -129,174 +128,100 @@ export function readPromptTexts(view: DocsView, dirs: readonly string[]): Map card}}`). - const provider = new InMemoryProvider({ card: loadFrom(BUNDLED_TEMPLATES, "explorer-card.mustache", opts.templatesDir) }); - const head = loadFrom(BUNDLED_TEMPLATES, "explorer-head.mustache", opts.templatesDir); - const foot = loadFrom(BUNDLED_TEMPLATES, "explorer-foot.mustache", opts.templatesDir); - const assetBase = (opts.assetBase ?? DEFAULT_ASSET_BASE).replace(/\/+$/, ""); - const legend = legendHtml(ix.hasClaims()); - const pages: string[] = []; + const output = opts.output ?? EXPLORER_OUTPUT_APP; + const templates: Record = {}; + for (const name of EXPLORER_TEMPLATE_NAMES) templates[name] = loadFrom(BUNDLED_TEMPLATES, name, opts.templatesDir); const files: string[] = []; - // Each body template is read once, not once per page it renders. - const bodies = new Map(); - const written = new Set(); const write = (rel: string, content: string): void => { - // Two nodes that map to one page would silently keep only the last; refuse instead. - if (written.has(rel)) throw new Error(`docs-site explorer: two pages map to ${rel}`); + if (written.has(rel)) throw new Error(`docs-site explorer: two files map to ${rel}`); written.add(rel); const abs = join(opts.outDir, rel); mkdirSync(dirname(abs), { recursive: true }); writeFileSync(abs, content); files.push(rel); }; - - const page = (template: string, href: string, nav: string, pageTitle: string, data: Record, graph = false): void => { - const relRoot = relHref(href, ""); - let body = bodies.get(template); - if (body === undefined) { - body = loadFrom(BUNDLED_TEMPLATES, template, opts.templatesDir); - bodies.set(template, body); - } - const payload = { - ...data, - siteTitle: esc(opts.title), - pageTitle: esc(pageTitle), - stamp: esc(opts.stamp ?? ""), - relRoot, - assetBase, - cytoscapeSrc: `${assetBase}/${CYTOSCAPE_PATH}`, - needsGraph: graph, - pageKey: nav, - nav: NAV.map((n) => ({ label: n.label, href: relHref(href, n.href), on: n.key === nav })), - legendHtml: legend, - }; - write(href, render({ template: head + body + foot, payload, provider, format: "text" })); - pages.push(href); + const assetBase = opts.assetBase?.replace(/\/+$/, ""); + const core = createExplorer({ + view: opts.view, + title: opts.title, + templates, + ...(opts.texts !== undefined && { texts: opts.texts }), + ...(opts.stamp !== undefined && { stamp: opts.stamp }), + assetBase: assetBase ?? "", + cytoscapeSrc: (relRoot) => (assetBase !== undefined ? `${assetBase}/${CYTOSCAPE_PATH}` : `${relRoot}assets/${CYTOSCAPE_ASSET}`), + }); + const pages = [...core.pages.keys()]; + const theme = (): void => { + for (const a of EXPLORER_ASSET_NAMES) write(`assets/${a}`, loadFrom(BUNDLED_ASSETS, a, opts.assetsDir)); }; - // S1 and the indexes. - page("explorer-overview.html.mustache", PAGE_OVERVIEW, "overview", "Overview", pagesModel.overview(opts.title)); - page("explorer-map.html.mustache", PAGE_MAP, "map", "Model map", pagesModel.map(), true); - page("explorer-requirements.html.mustache", PAGE_FEATURES, "requirements", "Features", pagesModel.requirements(REQUIREMENT_SUBTYPE_FUNCTIONAL, PAGE_FEATURES)); - page("explorer-requirements.html.mustache", PAGE_QUALITIES, "requirements", "Qualities", pagesModel.requirements(REQUIREMENT_SUBTYPE_ARCHITECTURAL, PAGE_QUALITIES)); - page("explorer-matrix.html.mustache", PAGE_MATRIX, "matrix", "Matrix", pagesModel.matrix()); - page("explorer-trace.html.mustache", PAGE_TRACE, "trace", "Trace", pagesModel.trace(), true); - page("explorer-prompts.html.mustache", PAGE_PROMPTS, "prompts", "Prompts", pagesModel.prompts()); - page("explorer-api.html.mustache", PAGE_API, "api", "API", pagesModel.api()); - page("explorer-gaps.html.mustache", PAGE_GAPS, "gaps", "Gaps", pagesModel.gaps()); - page("explorer-model.html.mustache", PAGE_MODEL, "map", "Packages", pagesModel.model()); - - for (const pkg of ix.packages) { - const data = pagesModel.packageIndex(pkg); - page("explorer-package.html.mustache", pagesModel.packagePage(pkg), "map", pkg === "" ? "(no package)" : pkg, data); + if (output === EXPLORER_OUTPUT_STATIC) { + for (const [href, draw] of core.pages) write(href, draw()); + theme(); + if (assetBase === undefined) write(`assets/${CYTOSCAPE_ASSET}`, readFileSync(join(BUNDLED_APP, "assets", CYTOSCAPE_ASSET), "utf8")); + write("assets/explorer-data.js", `window.MO_EXPLORER = ${JSON.stringify(core.graphData())};\n`); + write(EXPLORER_VIEW_FILE, serializeDocsView(opts.view)); + const dangling = checkLinks(opts.outDir, pages); + if (dangling.length > 0) throw new Error("explorer link check failed:\n" + dangling.join("\n")); + return { pages, files: [...files].sort() }; } - for (const n of ix.objects) page("explorer-object.html.mustache", pagesModel.objectPage(n), "map", n.name, pagesModel.object(n), true); - for (const t of ix.templates) page("explorer-prompt.html.mustache", pagesModel.objectPage(t), "prompts", t.name, pagesModel.prompt(t, opts.texts?.get(t.id))); - for (const n of ix.others) page("explorer-node.html.mustache", pagesModel.objectPage(n), "map", n.name, pagesModel.node(n)); - for (const r of ix.requirements) page("explorer-requirement.html.mustache", pagesModel.reqPage(r), "requirements", pagesModel.reqLabel(r), pagesModel.requirement(r)); - - for (const a of EXPLORER_ASSET_NAMES) write(`assets/${a}`, loadFrom(BUNDLED_ASSETS, a, opts.assetsDir)); - write("assets/explorer-data.js", `window.MO_EXPLORER = ${JSON.stringify(graphData(ix, pagesModel))};\n`); - write("explorer.json", serializeDocsView(opts.view)); - const dangling = checkLinks(opts.outDir, pages); + // The app draws the pages in the browser, so their links are checked here, in memory, before + // anything is written: a dangling link fails the build as it does for the static pages. + const drawn = new Map(); + for (const [href, draw] of core.pages) drawn.set(href, draw()); + // A page's head names the theme (`assets/explorer.css`), which the app ships. + const dangling = checkLinksInMemory(drawn, new Set([...EXPLORER_APP_FILES, EXPLORER_VIEW_FILE])); if (dangling.length > 0) throw new Error("explorer link check failed:\n" + dangling.join("\n")); - return { pages, files: [...files].sort() }; -} -/** The data the map, mini-maps, trace and search read. Every value comes off the index. */ -function graphData(ix: ViewIndex, p: Pages): Record { - const features = ix.features(); - const top = [...ix.objects, ...ix.templates]; - const nodes = top.map((n) => { - const feature = ix.featureOf(n.id); - const claims = ix.claims(n.id); - return { - id: n.id, - name: n.name, - kind: ix.kindOf(n), - pkg: n.package, - href: p.objectPage(n), - abstract: n.abstract === true ? 1 : 0, - fields: ix.fields(n.id).length, - claims: claims.length, - status: ix.claimStatus(n.id), - feature: feature !== undefined ? features.indexOf(feature) : -1, - quality: claims.length > 0 && claims.every((c) => c.req.kind === REQUIREMENT_SUBTYPE_ARCHITECTURAL) ? 1 : 0, - unclaimed: p.unclaimedEntity(n) ? 1 : 0, - api: ix.routes(n.id).map((r) => `${r.method} ${r.path}`), - gen: ix.generated(n.id).length, - storage: ix.storage(n.id)?.kind ?? "", - }; - }); - const ids = new Set(top.map((n) => n.id)); - const slices: Record = {}; - for (const s of ix.view.slices) slices[s.id] = [...new Set(s.nodes.map((x) => ix.ownerOf(x)).filter((x) => ids.has(x)))].sort(); - const reqs = ix.requirements.map((r) => ({ - id: r.node.id, - label: p.reqLabel(r), - path: p.reqPath(r), - level: r.level ?? 0, - status: r.status, - kind: r.kind, - parent: r.parent?.node.id ?? "", - href: p.reqPage(r), - targets: ix.linkTargets(r).map((id) => ix.ownerOf(id)), - statement: r.req.statement, - rollup: ix.rollup(r), - claimed: ix.targetsOf(r).length, - })); - const generated: Record = {}; - for (const n of top) { - const by = new Map(); - for (const f of ix.generated(n.id)) by.set(f.generatedBy, (by.get(f.generatedBy) ?? 0) + 1); - if (by.size > 0) generated[n.id] = [...by.entries()].sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)); - } - const search: { t: string; s: string; h: string; k: string }[] = []; - for (const n of top) { - const desc = typeof n.attrs[DOC_ATTR_DESCRIPTION] === "string" ? (n.attrs[DOC_ATTR_DESCRIPTION] as string) : ""; - search.push({ t: n.name, s: `${n.type}.${n.subType}${n.package !== "" ? ` · ${n.package}` : ""}`, h: p.objectPage(n), k: `${n.name} ${n.id} ${desc}`.toLowerCase() }); - for (const f of ix.fields(n.id)) { - if (f.inheritedFrom !== undefined) continue; - search.push({ t: `${n.name}.${f.name}`, s: `field.${f.subType}`, h: p.pageOf(f.id) ?? p.objectPage(n), k: `${n.name}.${f.name} ${f.id}`.toLowerCase() }); - } + for (const f of EXPLORER_APP_FILES) { + if (f === "assets/explorer.css" || f === "assets/explorer.js") continue; + write(f, readFileSync(join(BUNDLED_APP, f), "utf8")); } - for (const n of ix.others) { - const desc = typeof n.attrs[DOC_ATTR_DESCRIPTION] === "string" ? (n.attrs[DOC_ATTR_DESCRIPTION] as string) : ""; - search.push({ t: n.name, s: `${n.type}.${n.subType}${n.package !== "" ? ` · ${n.package}` : ""}`, h: p.objectPage(n), k: `${n.name} ${n.id} ${desc}`.toLowerCase() }); + theme(); + const owned: Record = {}; + if (opts.templatesDir !== undefined) { + for (const name of EXPLORER_TEMPLATE_NAMES) if (existsSync(join(opts.templatesDir, name))) owned[name] = templates[name]!; } - for (const r of ix.requirements) { - search.push({ - t: p.reqLabel(r), - s: `${r.level !== undefined ? `L${r.level}` : "—"} ${r.kind}${r.status !== "" ? ` · ${r.status}` : ""} · ${p.reqPath(r)}`, - h: p.reqPage(r), - k: `${p.reqPath(r)} ${r.node.id} ${p.reqLabel(r)} ${r.req.statement}`.toLowerCase(), - }); - } - return { - nodes, - // Every reference the view lists between two nodes on the map, labelled by the attribute - // that carries it (a report's `@from` among them, so a report is not an island). The map - // draws objects and prompts, and an edge to a node it does not draw would not load. - edges: ix - .modelEdges() - .filter((e) => ids.has(e.from) && ids.has(e.to)) - .map((e) => ({ s: e.from, t: e.to, k: e.kind, ...(e.via !== undefined ? { v: localTail(e.via) } : {}) })), - slices, - features: features.map((f) => ({ id: f.node.id, label: p.reqLabel(f) })), - reqs, - generated, - search, - hasClaims: ix.hasClaims(), - requirementType: TYPE_REQUIREMENT, - }; + const model = explorerModelScript({ + title: opts.title, + view: opts.view, + texts: opts.texts ?? new Map(), + ...(opts.stamp !== undefined && opts.stamp !== "" && { footer: opts.stamp }), + templates: owned, + }); + write(EXPLORER_MODEL_FILE, model.script); + write(EXPLORER_STAMP_FILE, stampScript(model.stamp)); + write(EXPLORER_VIEW_FILE, serializeDocsView(opts.view)); + return { pages, files: [...files].sort() }; +} + +export interface ExplorerModelInput { + title: string; + view: DocsView; + texts: ReadonlyMap; + /** Footer text (`stamp` on the generator). */ + footer?: string; + /** Owned templates by basename; the app uses them in place of its own. */ + templates?: Readonly>; +} + +/** The app's data file: one script setting `window.MO_MODEL`. Its `stamp` is the first 16 hex + * digits of the SHA-256 of the model's JSON without the stamp, and the stamp file repeats it, + * so the app knows the model it loaded is the one the stamp names. A port writes the same + * shape (the key order below, compact JSON). */ +export function explorerModelScript(m: ExplorerModelInput): { script: string; stamp: string } { + const texts: Record = {}; + for (const id of [...m.texts.keys()].sort()) texts[id] = m.texts.get(id)!; + const templates: Record = {}; + for (const name of Object.keys(m.templates ?? {}).sort()) templates[name] = m.templates![name]!; + const rest = JSON.stringify({ title: m.title, footer: m.footer ?? "", texts, templates, view: m.view }); + const stamp = createHash("sha256").update(rest).digest("hex").slice(0, 16); + return { script: `window.MO_MODEL = {"stamp":${JSON.stringify(stamp)},${rest.slice(1)};\n`, stamp }; } -function localTail(id: string): string { - const i = id.lastIndexOf("."); - return i < 0 ? id : id.slice(i + 1); +/** The file the app polls. */ +export function stampScript(stamp: string): string { + return `window.MO_STAMP = ${JSON.stringify(stamp)};\n`; } diff --git a/server/typescript/packages/docs-site/src/explorer/view-index.ts b/server/typescript/packages/docs-site/src/explorer/view-index.ts index dd63eff392..0df01ee1bf 100644 --- a/server/typescript/packages/docs-site/src/explorer/view-index.ts +++ b/server/typescript/packages/docs-site/src/explorer/view-index.ts @@ -20,8 +20,6 @@ import { TYPE_REQUIREMENT, TYPE_SOURCE, TYPE_TEMPLATE, -} from "@metaobjectsdev/metadata/constants"; -import { REQUIREMENT_SUBTYPE_ARCHITECTURAL, REQUIREMENT_SUBTYPE_FUNCTIONAL, REQUIREMENT_STATUSES, @@ -29,12 +27,14 @@ import { REQUIREMENT_STATUS_PARTIAL, REQUIREMENT_STATUS_PLANNED, REQUIREMENT_STATUS_RETIRED, - type DocsView, - type DocsViewMember, - type DocsViewNode, - type DocsViewRequirement, - type DocsViewRoute, - type DocsViewSlice, +} from "@metaobjectsdev/metadata/constants"; +import type { + DocsView, + DocsViewMember, + DocsViewNode, + DocsViewRequirement, + DocsViewRoute, + DocsViewSlice, } from "@metaobjectsdev/metadata"; /** The four declared statuses, in the order every bar and legend draws them: live first, since diff --git a/server/typescript/packages/docs-site/src/index.ts b/server/typescript/packages/docs-site/src/index.ts index 87a1cc6635..068c097203 100644 --- a/server/typescript/packages/docs-site/src/index.ts +++ b/server/typescript/packages/docs-site/src/index.ts @@ -4,5 +4,21 @@ export { SITE_TEMPLATE_NAMES, SITE_ASSET_NAMES, CLASSIC_TEMPLATE_NAMES, CLASSIC_ export type { MetaDataTypeProvider } from "@metaobjectsdev/metadata"; // The explorer reads the docs view, which `@metaobjectsdev/metadata` builds from the loaded model // (`buildDocsView`, `docs/features/docs-view.md`). -export { generateExplorerSite, readPromptTexts, EXPLORER_TEMPLATE_NAMES, EXPLORER_ASSET_NAMES, CYTOSCAPE_PATH } from "./explorer/site.js"; -export type { ExplorerSiteOptions, ExplorerSiteResult } from "./explorer/site.js"; +export { + generateExplorerSite, + readPromptTexts, + explorerModelScript, + stampScript, + EXPLORER_TEMPLATE_NAMES, + EXPLORER_ASSET_NAMES, + EXPLORER_APP_FILES, + EXPLORER_OUTPUT_APP, + EXPLORER_OUTPUT_STATIC, + EXPLORER_MODEL_FILE, + EXPLORER_STAMP_FILE, + EXPLORER_VIEW_FILE, + CYTOSCAPE_PATH, +} from "./explorer/site.js"; +export type { ExplorerSiteOptions, ExplorerSiteResult, ExplorerOutput, ExplorerModelInput } from "./explorer/site.js"; +export { createExplorer, CYTOSCAPE_ASSET } from "./explorer/core.js"; +export type { ExplorerCore, ExplorerCoreOptions } from "./explorer/core.js"; diff --git a/server/typescript/packages/docs-site/src/link-check.ts b/server/typescript/packages/docs-site/src/link-check.ts index f71405e812..0a0113913c 100644 --- a/server/typescript/packages/docs-site/src/link-check.ts +++ b/server/typescript/packages/docs-site/src/link-check.ts @@ -1,15 +1,45 @@ import { existsSync, readFileSync } from "node:fs"; -import { dirname, join, normalize } from "node:path"; +import { dirname, join, normalize, posix } from "node:path"; + +/** Every relative link on the written pages must name a file under `outDir`, and its anchor an + * id on that file. Returns `page -> href` for each that does not. */ export function checkLinks(outDir: string, pages: string[]): string[] { - const errs: string[] = []; const idCache = new Map>(); - const idsOf = (p: string) => { - if (!idCache.has(p)) idCache.set(p, new Set([...readFileSync(p, "utf8").matchAll(/id="([^"]+)"/g)].map((m) => m[1]!))); - return idCache.get(p)!; - }; + return checkLinkTargets(pages, (p) => readFileSync(join(outDir, p), "utf8"), (target) => { + const abs = join(outDir, target); + if (!existsSync(abs)) return undefined; + if (!idCache.has(abs)) idCache.set(abs, idsIn(readFileSync(abs, "utf8"))); + return idCache.get(abs)!; + }, (page, file) => normalize(join(dirname(page), file))); +} + +/** The same check over pages held in memory, keyed by site-relative path (the explorer app, + * which writes no pages). `files` names the other files the site ships, which a link may name + * but whose ids are not checked. */ +export function checkLinksInMemory(pages: ReadonlyMap, files: ReadonlySet = new Set()): string[] { + const idCache = new Map>(); + return checkLinkTargets([...pages.keys()], (p) => pages.get(p)!, (target) => { + const html = pages.get(target); + if (html === undefined) return files.has(target) ? new Set() : undefined; + if (!idCache.has(target)) idCache.set(target, idsIn(html)); + return idCache.get(target)!; + }, (page, file) => posix.normalize(posix.join(posix.dirname(page), file))); +} + +function idsIn(html: string): Set { + return new Set([...html.matchAll(/id="([^"]+)"/g)].map((m) => m[1]!)); +} + +function checkLinkTargets( + pages: readonly string[], + read: (page: string) => string, + ids: (target: string) => Set | undefined, + resolve: (page: string, file: string) => string, +): string[] { + const errs: string[] = []; for (const page of pages) { - const html = readFileSync(join(outDir, page), "utf8"); + const html = read(page); for (const m of html.matchAll(/href="([^"]+)"/g)) { const href = m[1]!; // A root-relative href is served from outside the site (an `assetBase` mirror); the site's @@ -18,10 +48,10 @@ export function checkLinks(outDir: string, pages: string[]): string[] { const [target0 = "", anchor] = href.split("#"); // A query string selects a view on the page (`map.html?slice=…`); the file is what must exist. const file = target0.split("?")[0] ?? ""; - const target = file === "" ? page : normalize(join(dirname(page), file)); - const abs = join(outDir, target); - if (!existsSync(abs)) { errs.push(`${page} -> ${href}`); continue; } - if (anchor && !idsOf(abs).has(anchor)) errs.push(`${page} -> ${href}`); + const target = file === "" ? page : resolve(page, file); + const found = ids(target); + if (found === undefined) { errs.push(`${page} -> ${href}`); continue; } + if (anchor && !found.has(anchor)) errs.push(`${page} -> ${href}`); } } return errs; diff --git a/server/typescript/packages/docs-site/src/scaffold.ts b/server/typescript/packages/docs-site/src/scaffold.ts index 5f0e68fa57..1fbf6132ca 100644 --- a/server/typescript/packages/docs-site/src/scaffold.ts +++ b/server/typescript/packages/docs-site/src/scaffold.ts @@ -42,6 +42,18 @@ export const EXPLORER_TEMPLATE_NAMES: readonly string[] = [ /** The explorer's themeable assets (basenames under assets/). */ export const EXPLORER_ASSET_NAMES: readonly string[] = ["explorer.css", "explorer.js"]; +/** The explorer app's files, relative to the site and to the app directory: the canonical copy + * is `explorer-app/` at the repository root, and every port ships the same bytes + * (`scripts/sync-explorer-app.sh`). The theme pair is the packaged copy of `assets/`; an owned + * copy replaces it in the site the generator writes. */ +export const EXPLORER_APP_FILES: readonly string[] = [ + "index.html", + "assets/explorer-app.js", + "assets/explorer.css", + "assets/explorer.js", + "assets/cytoscape.min.js", +]; + /** Every template `meta eject docs-site` copies: both sites' themes, so either can be owned. */ export const SITE_TEMPLATE_NAMES: readonly string[] = [...CLASSIC_TEMPLATE_NAMES, ...EXPLORER_TEMPLATE_NAMES]; diff --git a/server/typescript/packages/docs-site/test/explorer-app.test.ts b/server/typescript/packages/docs-site/test/explorer-app.test.ts new file mode 100644 index 0000000000..8a90a4ea64 --- /dev/null +++ b/server/typescript/packages/docs-site/test/explorer-app.test.ts @@ -0,0 +1,189 @@ +// The explorer as one browser app (`generateExplorerSite`'s default output): the files it writes, +// the data files a port writes beside them, and the COMMITTED bundle held page for page to the +// static export built from the same sources. The bundle runs here in a bare VM context, with no +// DOM, exactly as `globalThis.MoExplorer` documents. +import { afterAll, describe, expect, test } from "bun:test"; +import { mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join, relative, resolve } from "node:path"; +import { runInNewContext } from "node:vm"; +import { MetaDataLoader, buildDocsView, type DocsView } from "@metaobjectsdev/metadata"; +import { FileSource } from "@metaobjectsdev/metadata/core"; +import { + EXPLORER_APP_FILES, + EXPLORER_MODEL_FILE, + EXPLORER_STAMP_FILE, + EXPLORER_VIEW_FILE, + explorerModelScript, + generateExplorerSite, + readPromptTexts, +} from "../src/index.js"; +import { buildExplorerApp } from "../scripts/build-app.js"; +import { corpusView } from "./fixture/views.js"; + +const PKG = resolve(import.meta.dir, ".."); +const REPO = resolve(PKG, "../../../.."); +const ROOT_APP = join(REPO, "explorer-app"); +const PKG_APP = join(PKG, "app"); +const SHOP = join(REPO, "fixtures/explorer-conformance/shop"); +const FITNESS = join(REPO, "fixtures/persistence-conformance/canonical"); + +const dirs: string[] = []; +const scratch = (): string => { + const d = mkdtempSync(join(process.env.DEV_SCRATCH ?? tmpdir(), "explorer-app-")); + dirs.push(d); + return d; +}; +afterAll(() => { + for (const d of dirs) rmSync(d, { recursive: true, force: true }); +}); + +function filesUnder(dir: string): string[] { + return readdirSync(dir, { recursive: true, withFileTypes: true }) + .filter((f) => f.isFile()) + .map((f) => relative(dir, join(f.parentPath, f.name)).split("\\").join("/")) + .sort(); +} + +interface BundleExplorer { + pages: Map string>; + graphData(): Record; +} +interface Bundle { + explorerFor(model: unknown): BundleExplorer; +} + +/** The committed bundle, loaded as a browser would load it but with no document. */ +function loadBundle(file = join(PKG_APP, "assets/explorer-app.js")): Bundle { + const ctx: Record = {}; + runInNewContext(readFileSync(file, "utf8"), ctx); + return ctx.MoExplorer as Bundle; +} + +function parseModel(script: string): unknown { + const prefix = "window.MO_MODEL = "; + expect(script.startsWith(prefix)).toBe(true); + return JSON.parse(script.slice(prefix.length).replace(/;\n$/, "")); +} + +interface Case { + name: string; + view: DocsView; + title: string; + texts: Map; +} + +const shopView = await corpusView("shop"); +const fitnessRoot = (await new MetaDataLoader().load([new FileSource(join(FITNESS, "meta.fitness.json"))])).root; +const fitnessView = buildDocsView({ root: fitnessRoot }); +const CASES: Case[] = [ + { name: "shop", view: shopView, title: "Shop", texts: readPromptTexts(shopView, [join(SHOP, "project/prompts"), join(SHOP, "project")]) }, + { name: "crm", view: await corpusView("crm"), title: "Acme", texts: new Map() }, + { name: "fitness", view: fitnessView, title: "Fitness", texts: readPromptTexts(fitnessView, [join(FITNESS, "prompts"), FITNESS]) }, +]; + +describe("the explorer app's files", () => { + test("explorer-app/ is what the sources build", async () => { + const built = await buildExplorerApp(); + for (const [rel, content] of built) expect(readFileSync(join(ROOT_APP, rel), "utf8")).toBe(content); + }); + + test("the package's copy equals the repository's canonical copy", () => { + const want = filesUnder(ROOT_APP).filter((f) => f !== "README.md"); + expect(filesUnder(PKG_APP)).toEqual(want); + for (const f of want) expect(readFileSync(join(PKG_APP, f))).toEqual(readFileSync(join(ROOT_APP, f))); + expect([...EXPLORER_APP_FILES].sort()).toEqual(want); + }); +}); + +describe("explorer app output", () => { + const c = CASES[0]!; + const build = (opts: { templatesDir?: string; assetsDir?: string; stamp?: string; view?: DocsView } = {}) => { + const out = scratch(); + const r = generateExplorerSite({ view: opts.view ?? c.view, outDir: out, title: c.title, texts: c.texts, ...opts }); + return { out, ...r, file: (p: string) => readFileSync(join(out, p), "utf8") }; + }; + const site = build(); + + test("writes the app's files and three data files, and no page", () => { + expect(site.files).toEqual([...EXPLORER_APP_FILES, EXPLORER_MODEL_FILE, EXPLORER_STAMP_FILE, EXPLORER_VIEW_FILE].sort()); + expect(filesUnder(site.out)).toEqual(site.files); + for (const f of EXPLORER_APP_FILES) expect(site.file(f)).toBe(readFileSync(join(PKG_APP, f), "utf8")); + // The pages the app draws are listed, though none is written. + expect(site.pages).toContain("model/acme/shop/Order.html"); + }); + + test("the view file is the docs view, byte for byte, as the static export writes it", () => { + expect(site.file(EXPLORER_VIEW_FILE)).toBe(readFileSync(join(SHOP, "expected.json"), "utf8")); + }); + + test("the stamp file names the model it sits beside", () => { + const model = parseModel(site.file(EXPLORER_MODEL_FILE)) as { stamp: string; title: string; texts: Record }; + expect(site.file(EXPLORER_STAMP_FILE)).toBe(`window.MO_STAMP = ${JSON.stringify(model.stamp)};\n`); + expect(model.stamp).toMatch(/^[0-9a-f]{16}$/); + expect(model.title).toBe("Shop"); + expect(Object.keys(model.texts).length).toBeGreaterThan(0); + }); + + test("is deterministic, and the stamp moves when the model does", async () => { + const again = build(); + for (const f of site.files) expect(again.file(f)).toBe(site.file(f)); + const edited = await corpusView("shop", (input) => { + input.routes = []; + }); + const changed = build({ view: edited }); + expect(changed.file(EXPLORER_STAMP_FILE)).not.toBe(site.file(EXPLORER_STAMP_FILE)); + expect(build({ stamp: "v1" }).file(EXPLORER_STAMP_FILE)).not.toBe(site.file(EXPLORER_STAMP_FILE)); + }); + + test("an owned template travels in the model file and the app draws with it", () => { + const templatesDir = scratch(); + const head = readFileSync(join(PKG, "templates/explorer-head.mustache"), "utf8").replace("model explorer", "owned explorer"); + writeFileSync(join(templatesDir, "explorer-head.mustache"), head); + const owned = build({ templatesDir }); + const model = parseModel(owned.file(EXPLORER_MODEL_FILE)) as { templates: Record }; + expect(Object.keys(model.templates)).toEqual(["explorer-head.mustache"]); + expect(loadBundle().explorerFor(model).pages.get("index.html")!()).toContain("owned explorer"); + }); + + test("an owned theme replaces the packaged one in the written site", () => { + const assetsDir = scratch(); + writeFileSync(join(assetsDir, "explorer.css"), "/* owned */\n"); + expect(build({ assetsDir }).file("assets/explorer.css")).toBe("/* owned */\n"); + }); + + test("a dangling link fails the build as it does for the static pages", () => { + const templatesDir = scratch(); + writeFileSync(join(templatesDir, "explorer-gaps.html.mustache"), `x`); + expect(() => build({ templatesDir })).toThrow(/explorer link check failed:\ngaps.html -> nowhere.html/); + }); + + test("the model script is the documented shape", () => { + const { script, stamp } = explorerModelScript({ title: "T", view: c.view, texts: new Map([["b", "2"], ["a", "1"]]) }); + expect(script.startsWith(`window.MO_MODEL = {"stamp":"${stamp}","title":"T","footer":"","texts":{"a":"1","b":"2"},"templates":{},"view":{`)).toBe(true); + }); +}); + +describe("the committed bundle draws every page the static export writes, byte for byte", () => { + const bundle = loadBundle(); + for (const c of CASES) { + test(c.name, () => { + const out = scratch(); + const r = generateExplorerSite({ output: "static", view: c.view, outDir: out, title: c.title, texts: c.texts }); + const model = parseModel(explorerModelScript({ title: c.title, view: c.view, texts: c.texts }).script); + const app = bundle.explorerFor(model); + expect([...app.pages.keys()]).toEqual(r.pages); + let same = 0; + for (const p of r.pages) { + // The one deliberate difference: a static page loads Cytoscape itself, the app's shell + // loads it once for every page. + const want = readFileSync(join(out, p), "utf8").replace(/`); + expect(app.pages.get(p)!()).toBe(want); + same++; + } + expect(same).toBe(r.pages.length); + const data = readFileSync(join(out, "assets/explorer-data.js"), "utf8"); + expect(`window.MO_EXPLORER = ${JSON.stringify(app.graphData())};\n`).toBe(data); + }); + } +}); diff --git a/server/typescript/packages/docs-site/test/explorer-site.test.ts b/server/typescript/packages/docs-site/test/explorer-site.test.ts index 466949e18a..b35bf19ca0 100644 --- a/server/typescript/packages/docs-site/test/explorer-site.test.ts +++ b/server/typescript/packages/docs-site/test/explorer-site.test.ts @@ -37,6 +37,7 @@ const shopView = await corpusView("shop"); function buildShop(view: DocsView = shopView): { out: string; pages: string[]; files: string[]; page: (p: string) => string } { const out = scratch(); const r = generateExplorerSite({ + output: "static", view, outDir: out, title: "Shop", @@ -49,7 +50,7 @@ async function buildFitness(): Promise<{ page: (p: string) => string; files: str const root = (await new MetaDataLoader().load([new FileSource(join(FITNESS, "meta.fitness.json"))])).root; const view = buildDocsView({ root }); const out = scratch(); - const r = generateExplorerSite({ view, outDir: out, title: "Fitness", texts: readPromptTexts(view, [join(FITNESS, "prompts"), FITNESS]) }); + const r = generateExplorerSite({ output: "static", view, outDir: out, title: "Fitness", texts: readPromptTexts(view, [join(FITNESS, "prompts"), FITNESS]) }); return { files: r.files, page: (p) => readFileSync(join(out, p), "utf8") }; } @@ -127,7 +128,7 @@ describe("explorer site over explorer-conformance/shop", () => { }); const auditPage = (view: DocsView): string => { const out = scratch(); - generateExplorerSite({ view, outDir: out, title: "Shop" }); + generateExplorerSite({ output: "static", view, outDir: out, title: "Shop" }); return readFileSync(join(out, "model/acme/shop/AuditEntry.html"), "utf8"); }; expect(auditPage(await reworded("acme::shop::AuditEntry", "an entity is unclaimed"))).toContain("chip v-unclaimed"); @@ -173,10 +174,19 @@ describe("explorer site over explorer-conformance/shop", () => { } }); - test("the graph library loads only on the pages that draw a graph", () => { - expect(shop.page("map.html")).toContain("cytoscape@3.30.2/dist/cytoscape.min.js"); + test("the graph library loads only on the pages that draw a graph, from the copy the site ships", () => { + expect(shop.page("map.html")).toContain(''); + expect(shop.page("model/acme/shop/Order.html")).toContain(''); + expect(shop.files).toContain("assets/cytoscape.min.js"); expect(shop.page("gaps.html")).not.toContain("cytoscape"); }); + + test("an assetBase loads the graph library from that mirror and ships no copy", () => { + const out = scratch(); + const r = generateExplorerSite({ output: "static", view: shopView, outDir: out, title: "Shop", assetBase: "https://mirror.example/npm/" }); + expect(readFileSync(join(out, "map.html"), "utf8")).toContain(''); + expect(r.files).not.toContain("assets/cytoscape.min.js"); + }); }); describe("explorer site over the fitness model", async () => { @@ -207,7 +217,7 @@ describe("explorer site over application-owned vocabulary (explorer-conformance/ const view = await corpusView("crm"); const build = (): { pages: string[]; page: (p: string) => string } => { const out = scratch(); - const r = generateExplorerSite({ view, outDir: out, title: "Acme" }); + const r = generateExplorerSite({ output: "static", view, outDir: out, title: "Acme" }); return { pages: r.pages, page: (p) => readFileSync(join(out, p), "utf8") }; }; @@ -236,7 +246,7 @@ describe("explorer site over application-owned vocabulary (explorer-conformance/ test("the map draws only edges whose two ends it draws", () => { const out = scratch(); - generateExplorerSite({ view, outDir: out, title: "Acme" }); + generateExplorerSite({ output: "static", view, outDir: out, title: "Acme" }); const js = readFileSync(join(out, "assets/explorer-data.js"), "utf8"); const data = JSON.parse(js.slice(js.indexOf("=") + 1).trim().replace(/;$/, "")) as { nodes: { id: string }[]; edges: { s: string; t: string; k: string; v?: string }[] }; const drawn = new Set(data.nodes.map((n) => n.id)); @@ -267,7 +277,7 @@ describe("explorer site page paths", () => { test("an object named index does not take its package's index page", async () => { const out = scratch(); - const r = generateExplorerSite({ view: await inlineView(model("acme", [entity("index"), entity("Order")])), outDir: out, title: "T" }); + const r = generateExplorerSite({ output: "static", view: await inlineView(model("acme", [entity("index"), entity("Order")])), outDir: out, title: "T" }); expect(r.pages).toContain("model/acme/index.html"); expect(r.pages).toContain("model/acme/index.node.html"); expect(readFileSync(join(out, "model/acme/index.html"), "utf8")).toContain("Order"); @@ -275,7 +285,7 @@ describe("explorer site page paths", () => { test("a model with no package gets pages under a directory no package name can take", async () => { const out = scratch(); - const r = generateExplorerSite({ view: await inlineView(model(undefined, [entity("Order")])), outDir: out, title: "T" }); + const r = generateExplorerSite({ output: "static", view: await inlineView(model(undefined, [entity("Order")])), outDir: out, title: "T" }); expect(r.pages).toContain("model/-root/Order.html"); }); diff --git a/server/typescript/packages/docs-site/tsconfig.app.json b/server/typescript/packages/docs-site/tsconfig.app.json new file mode 100644 index 0000000000..ba5c0c6cf1 --- /dev/null +++ b/server/typescript/packages/docs-site/tsconfig.app.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { "noEmit": true, "rootDir": ".", "lib": ["ES2023", "DOM", "DOM.Iterable"] }, + "include": ["app-src/**/*", "scripts/**/*"], + "exclude": ["dist", "node_modules"] +} diff --git a/server/typescript/packages/metadata/src/constants.ts b/server/typescript/packages/metadata/src/constants.ts index 8b019202c0..77a14f0766 100644 --- a/server/typescript/packages/metadata/src/constants.ts +++ b/server/typescript/packages/metadata/src/constants.ts @@ -46,6 +46,7 @@ export * from "./core/index/index-constants.js"; export * from "./core/object/object-constants.js"; export * from "./core/query/query-constants.js"; export * from "./core/relationship/relationship-constants.js"; +export * from "./core/requirement/requirement-constants.js"; export * from "./core/transition/transition-constants.js"; export * from "./core/reporting/reporting-constants.js"; export * from "./core/validator/validator-constants.js"; From 3a2c6531a9dc287cd94b987ac5037ef53dbbeb32 Mon Sep 17 00:00:00 2001 From: Doug Mealing Date: Fri, 27 Nov 2026 18:05:49 -0500 Subject: [PATCH 02/10] no-mistakes(review): Gate explorer app after install; keep mustache notice --- changelog.d/explorer-app.md | 5 ++++ docs/features/explorer-site.md | 7 ++++++ explorer-app/README.md | 1 + explorer-app/assets/explorer-app.js | 25 ++++++++++++++----- scripts/ci-local.sh | 2 +- .../ExplorerApp/assets/explorer-app.js | 25 ++++++++++++++----- .../explorer-app/assets/explorer-app.js | 25 ++++++++++++++----- .../explorer_app/assets/explorer-app.js | 25 ++++++++++++++----- .../docs-site/app/assets/explorer-app.js | 25 ++++++++++++++----- .../packages/docs-site/scripts/build-app.ts | 16 ++++++++++++ 10 files changed, 125 insertions(+), 31 deletions(-) diff --git a/changelog.d/explorer-app.md b/changelog.d/explorer-app.md index 157d53cb87..2536a21b47 100644 --- a/changelog.d/explorer-app.md +++ b/changelog.d/explorer-app.md @@ -14,3 +14,8 @@ the other ports' docs-site generators are still to write them. Generated-output change: the next `meta gen` replaces the explorer's pages with the app's files, and `meta verify --codegen` holds the new files to the model as before. + If you ejected the theme on a 1.3.0 candidate, your `codegen/docs-site/assets/explorer.js` + predates the app, which calls `window.MO_THEME` each time it draws a page: without that hook + search, the theme toggle and the graphs do nothing. Copy it again with `meta eject docs-site + --force` and carry your edits into the new copy (the app also needs its `window.MO_APP` link, + query and listener hooks, so adding the one line is not enough). diff --git a/docs/features/explorer-site.md b/docs/features/explorer-site.md index 91b62bd4c4..02ae2a0b25 100644 --- a/docs/features/explorer-site.md +++ b/docs/features/explorer-site.md @@ -176,6 +176,13 @@ page with them, and writes your CSS and JS in place of its own. A project that e classic files; `meta gen` warns about it, and running `meta eject docs-site` again adds the explorer's files without touching the ones you own. +The app calls `window.MO_THEME` each time it draws a page, and the packaged `explorer.js` sets it +to the function that wires search, the theme toggle and the graphs. An `explorer.js` ejected +from a 1.3.0 candidate predates that hook, so those controls do nothing in the app. Copy it again +with `meta eject docs-site --force` and carry your edits into the new copy: the app also needs +the copy's `window.MO_APP` hooks for links, the query string and listeners, so adding the one +line is not enough. + ## Drift and determinism The site prints no date and no build time, its graph layouts start from fixed positions, and diff --git a/explorer-app/README.md b/explorer-app/README.md index 99b0d39545..63a9b9d6ed 100644 --- a/explorer-app/README.md +++ b/explorer-app/README.md @@ -22,6 +22,7 @@ stale or a port's copy differs from it. | `index.html` | The shell: loads the data, Cytoscape, the app and the theme | `server/typescript/packages/docs-site/app-src/index.html` | | `assets/explorer-app.js` | The app: the explorer's page code and templates, and the router around them, as one classic script | `app-src/main.ts`, `src/explorer/{core,pages,html,view-index}.ts`, `templates/explorer-*.mustache`, the Mustache renderer | | `assets/explorer.css`, `assets/explorer.js` | The theme (`meta eject docs-site` copies them; an owned copy replaces these in the written site) | `server/typescript/packages/docs-site/assets/` | +| `assets/explorer-app.js` (inlined) | [mustache.js](https://github.com/janl/mustache.js) 4.2.0, MIT (its licence is the file's header) | the npm package `mustache@4.2.0`, through `@metaobjectsdev/render` | | `assets/cytoscape.min.js` | [Cytoscape.js](https://js.cytoscape.org/) 3.30.2, MIT (its licence is the file's header), so the graphs draw offline | vendored from the npm package `cytoscape@3.30.2`, `dist/cytoscape.min.js` | ## Where each port keeps its copy diff --git a/explorer-app/assets/explorer-app.js b/explorer-app/assets/explorer-app.js index 559fb3f984..b7a2536318 100644 --- a/explorer-app/assets/explorer-app.js +++ b/explorer-app/assets/explorer-app.js @@ -1,4 +1,17 @@ -(()=>{var m2={"explorer-head.mustache":` +/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +(()=>{var m3={"explorer-head.mustache":` @@ -246,10 +259,10 @@ `};/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o3=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V3(m[0])+"\\s*"),Q=new RegExp("\\s*"+V3(m[1])),D=new RegExp("\\s*"+V3("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` -`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d3($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y3=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h2=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h2(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e3=(h)=>h,H2={text:e3,markdown:e3,html:y3,xml:y3,json:iH,csv:IH,spreadsheet:(h)=>h2(y3(h))};var q2="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $2(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z2(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$2(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$2(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z2=["mustache","jinja"],Uh="mustache",o="jinja";var b2=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K2(h,H,q){if(q!==void 0){if(!z2.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z2.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G3="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` `,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` -`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` -`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u3=new Proxy({},{get:()=>nH});var Zh=u3;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b2)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u3.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X2(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W2(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J2(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C3(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q2(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W2(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C3).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C3).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C3(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W2(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J2(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J2(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j2(h,H){if(H.includes("."))return!1;if(!H.startsWith(q2))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w2(h,H){return h&&H===lh}function m2(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m2(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v3(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y2(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u2(h){return G2(h)}function C2(h,H,q){if(q?.engine===o)return Q2(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V2(Q,B)&&!j2(Q,B)&&!w2(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V2(Q,B);if(!v){if(w2(k,B)){J(w,Q,D,k);break}if(j2(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d2(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y2(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d2(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y2(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v2(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v2(q,H)}function B2(h,H,q){let $=[];v2(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B2(K,H,[...q,Z])}}function D2(h,H,q,$,Z){return B2(h,$,H!==void 0?[H]:[]),X2(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F2(h,H,q,$){let Z=u2(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v3(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F2(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B3(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K2(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C2(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G3);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H2[h.format??"text"],Z=q===o?D2(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F2(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z2(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h3="relationship",Y2="layout",M2="source",D3="origin",H3="template",F3="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l2="summary";var uh="string";var k2="currency",Ah="enum",U2="uuid",g2="uri",S2="inet",L2="duration";var Y3="required";var M3="default",l3="maxLength";var x2="filterable",N2="sortable";var q3="objectRef";var k3="values";var U3="fields";var g3="references";var S3="entity",f2="value",O2="projection",P2="report";var $3="from",A2="dimensions",I2="measures",i2="segment",L3="filter",R2="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x3="like",N="isNull";var i1={string:[x,O,P,x3,N],[Ah]:[x,O,P,x3,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k2]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U2]:[x,O,P,N],[g2]:[x,O,P,x3,N],[S2]:[x,O,P,N],[L2]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c2="cardinality",s2="objectRef",p2="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z3="disposition",a2="trackedBy",Ch="statement",t2="counterexample";var Qh="planned",Ih="live",N3="partial",f3="retired",n2=["planned","live","partial","retired"];var _2=["planned","partial"];var O3=3,P3=4;var z3="from";var T2="agg",b3="of",A3="via",I3="filter";var i3="expr";var Vq=["count","sum","avg","min","max"];var E2="any",r2="all",dq="collect",E1=[...Vq,E2,r2,dq];var o2="of",e2="via",hH="grains",HH="agg";var R3="filter",qH="segment",$H="numerator",ZH="denominator";var c3="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s3="pageSize",JH="defaultSortField",p3="defaultSortOrder";var QH="columns";var a3="prompt";var ih="payloadRef",jH="textRef",K3="format";var X3="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N3,Qh,f3].filter((h)=>n2.includes(h)),t3={[Ih]:"●",[N3]:"◐",[Qh]:"○",[f3]:"⊘"},yH=(h,H)=>hH?1:0;class n3{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H3)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M2)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S3}isPrompt(h){return h.type===H3&&h.subType===a3}kindOf(h){if(h.type===H3)return h.subType===a3?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S3)return"entity";if(h.subType===f2)return"value";if(h.subType===O2)return"projection";if(h.subType===P2)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t3[h]??""} ${X(h)}`}function W3(h){if(h==="")return"";return`${t3[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J3(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _3(h){let H=h.node.attrs[Z3];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j3="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w3="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F3,h3,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E3{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l2])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j3,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T3(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T3(j.functional,"feature")}, ${T3(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J3(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W3(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F3||w.type===h3).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y2).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X3,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q3),Z=q.subType===Ah?r(q.attrs[k3]):[],z=[];if(q.attrs[Y3]===!0)z.push("required");if(q.attrs[x2]===!0)z.push("filterable");if(q.attrs[N2]===!0)z.push("sortable");if(q.attrs[l3]!==void 0)z.push(`max ${String(q.attrs[l3])}`);if(q.attrs[M3]!==void 0)z.push(`default ${Xh(q.attrs[M3])}`);if(this.ix.children(q.id).some((b)=>b.type===D3))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W3(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U3]),$=this.refHtml(h,H,g3)||this.refHtml(h,H,s2),Z=S(H.attrs[p2]),z=S(H.attrs[c2]),K=H.type===h3?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o2,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e2]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R3]!==void 0)$.push(`filter ${X(Xh(q[R3]))}`);if(q[c3]!==void 0)$.push(`default ${X(Xh(q[c3]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p3])!==void 0?` ${X(S(h.attrs[p3]))}`:""}`);if(typeof h.attrs[s3]==="number")H.push(`${h.attrs[s3]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D3)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z3))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T2]);if(z!==void 0)Z.push(`${X(z)}(${$(b3)})`);else if(q[b3]!==void 0)Z.push(`of ${$(b3)}`);if(q[z3]!==void 0)Z.push(`from ${$(z3)}`);if(q[A3]!==void 0)Z.push(`via ${X(Kh(String(q[A3])))}`);if(q[i3]!==void 0)Z.push(`${X(Xh(q[i3]))}`);if(q[I3]!==void 0)Z.push(`filter ${X(Xh(q[I3]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$3)[0]?.id??S(q[$3]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R2]);return{fromHtml:this.refHtml(h,H,$3),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A2]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I2]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i2]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L3]!==void 0?`${X(Xh(q[L3]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X3)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y3]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q3)!==""?` → ${this.refHtml($,G,q3)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k3]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K3,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K3])!==void 0?` · ${S(h.attrs[K3])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X3),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_3(H)}${J3(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P3,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O3)G=G.parent;let F=r(h.node.attrs[a2]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_3(h),verdictHtml:J3(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t2])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w3,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W3(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O3),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_2.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z3]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q3(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q3(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g3]!==void 0).flatMap((b)=>r(b.attrs[U3])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q3(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q3(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q3(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T3(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j3},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w3},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n3(h.view),q=new E3(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B3({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j3,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w3,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m3,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m3};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/scripts/ci-local.sh b/scripts/ci-local.sh index fb5df69289..5ac5652205 100755 --- a/scripts/ci-local.sh +++ b/scripts/ci-local.sh @@ -1511,7 +1511,6 @@ run_gates_offline() { if want gates; then step "hosted assess prompt builds" gate_assess_prompt; fi if want gates; then step "migration guides vs registry" gate_migration_guides; fi if want gates; then step "python agent-context copy" gate_python_agent_context_drift; fi - if want gates; then step_if bun "explorer app copies" gate_explorer_app_drift; fi } # Every gate below runs bun over workspace TypeScript, and on a FRESH CI checkout there is # no node_modules — so a bare `@metaobjectsdev/*` specifier either fails to resolve (what @@ -1539,6 +1538,7 @@ run_gates_bun() { if want gates; then step_if bun "metamodel scaffolder" gate_scaffold_metamodel; fi if want gates; then step_if bun "requirement harness" gate_requirement_harness; fi if want gates; then step_if bun "fixture-lint" gate_fixture_lint; fi + if want gates; then step_if bun "explorer app copies" gate_explorer_app_drift; fi } run_drift_gates() { if want gates; then step_if bun "doc-template drift" gate_doc_template_drift; fi diff --git a/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js index 559fb3f984..b7a2536318 100644 --- a/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js +++ b/server/csharp/MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js @@ -1,4 +1,17 @@ -(()=>{var m2={"explorer-head.mustache":` +/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +(()=>{var m3={"explorer-head.mustache":` @@ -246,10 +259,10 @@ `};/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o3=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V3(m[0])+"\\s*"),Q=new RegExp("\\s*"+V3(m[1])),D=new RegExp("\\s*"+V3("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` -`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d3($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y3=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h2=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h2(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e3=(h)=>h,H2={text:e3,markdown:e3,html:y3,xml:y3,json:iH,csv:IH,spreadsheet:(h)=>h2(y3(h))};var q2="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $2(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z2(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$2(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$2(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z2=["mustache","jinja"],Uh="mustache",o="jinja";var b2=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K2(h,H,q){if(q!==void 0){if(!z2.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z2.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G3="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` `,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` -`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` -`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u3=new Proxy({},{get:()=>nH});var Zh=u3;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b2)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u3.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X2(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W2(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J2(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C3(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q2(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W2(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C3).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C3).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C3(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W2(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J2(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J2(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j2(h,H){if(H.includes("."))return!1;if(!H.startsWith(q2))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w2(h,H){return h&&H===lh}function m2(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m2(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v3(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y2(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u2(h){return G2(h)}function C2(h,H,q){if(q?.engine===o)return Q2(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V2(Q,B)&&!j2(Q,B)&&!w2(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V2(Q,B);if(!v){if(w2(k,B)){J(w,Q,D,k);break}if(j2(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d2(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y2(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d2(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y2(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v2(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v2(q,H)}function B2(h,H,q){let $=[];v2(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B2(K,H,[...q,Z])}}function D2(h,H,q,$,Z){return B2(h,$,H!==void 0?[H]:[]),X2(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F2(h,H,q,$){let Z=u2(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v3(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F2(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B3(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K2(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C2(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G3);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H2[h.format??"text"],Z=q===o?D2(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F2(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z2(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h3="relationship",Y2="layout",M2="source",D3="origin",H3="template",F3="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l2="summary";var uh="string";var k2="currency",Ah="enum",U2="uuid",g2="uri",S2="inet",L2="duration";var Y3="required";var M3="default",l3="maxLength";var x2="filterable",N2="sortable";var q3="objectRef";var k3="values";var U3="fields";var g3="references";var S3="entity",f2="value",O2="projection",P2="report";var $3="from",A2="dimensions",I2="measures",i2="segment",L3="filter",R2="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x3="like",N="isNull";var i1={string:[x,O,P,x3,N],[Ah]:[x,O,P,x3,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k2]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U2]:[x,O,P,N],[g2]:[x,O,P,x3,N],[S2]:[x,O,P,N],[L2]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c2="cardinality",s2="objectRef",p2="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z3="disposition",a2="trackedBy",Ch="statement",t2="counterexample";var Qh="planned",Ih="live",N3="partial",f3="retired",n2=["planned","live","partial","retired"];var _2=["planned","partial"];var O3=3,P3=4;var z3="from";var T2="agg",b3="of",A3="via",I3="filter";var i3="expr";var Vq=["count","sum","avg","min","max"];var E2="any",r2="all",dq="collect",E1=[...Vq,E2,r2,dq];var o2="of",e2="via",hH="grains",HH="agg";var R3="filter",qH="segment",$H="numerator",ZH="denominator";var c3="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s3="pageSize",JH="defaultSortField",p3="defaultSortOrder";var QH="columns";var a3="prompt";var ih="payloadRef",jH="textRef",K3="format";var X3="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N3,Qh,f3].filter((h)=>n2.includes(h)),t3={[Ih]:"●",[N3]:"◐",[Qh]:"○",[f3]:"⊘"},yH=(h,H)=>hH?1:0;class n3{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H3)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M2)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S3}isPrompt(h){return h.type===H3&&h.subType===a3}kindOf(h){if(h.type===H3)return h.subType===a3?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S3)return"entity";if(h.subType===f2)return"value";if(h.subType===O2)return"projection";if(h.subType===P2)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t3[h]??""} ${X(h)}`}function W3(h){if(h==="")return"";return`${t3[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J3(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _3(h){let H=h.node.attrs[Z3];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j3="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w3="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F3,h3,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E3{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l2])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j3,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T3(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T3(j.functional,"feature")}, ${T3(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J3(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W3(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F3||w.type===h3).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y2).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X3,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q3),Z=q.subType===Ah?r(q.attrs[k3]):[],z=[];if(q.attrs[Y3]===!0)z.push("required");if(q.attrs[x2]===!0)z.push("filterable");if(q.attrs[N2]===!0)z.push("sortable");if(q.attrs[l3]!==void 0)z.push(`max ${String(q.attrs[l3])}`);if(q.attrs[M3]!==void 0)z.push(`default ${Xh(q.attrs[M3])}`);if(this.ix.children(q.id).some((b)=>b.type===D3))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W3(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U3]),$=this.refHtml(h,H,g3)||this.refHtml(h,H,s2),Z=S(H.attrs[p2]),z=S(H.attrs[c2]),K=H.type===h3?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o2,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e2]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R3]!==void 0)$.push(`filter ${X(Xh(q[R3]))}`);if(q[c3]!==void 0)$.push(`default ${X(Xh(q[c3]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p3])!==void 0?` ${X(S(h.attrs[p3]))}`:""}`);if(typeof h.attrs[s3]==="number")H.push(`${h.attrs[s3]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D3)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z3))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T2]);if(z!==void 0)Z.push(`${X(z)}(${$(b3)})`);else if(q[b3]!==void 0)Z.push(`of ${$(b3)}`);if(q[z3]!==void 0)Z.push(`from ${$(z3)}`);if(q[A3]!==void 0)Z.push(`via ${X(Kh(String(q[A3])))}`);if(q[i3]!==void 0)Z.push(`${X(Xh(q[i3]))}`);if(q[I3]!==void 0)Z.push(`filter ${X(Xh(q[I3]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$3)[0]?.id??S(q[$3]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R2]);return{fromHtml:this.refHtml(h,H,$3),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A2]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I2]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i2]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L3]!==void 0?`${X(Xh(q[L3]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X3)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y3]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q3)!==""?` → ${this.refHtml($,G,q3)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k3]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K3,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K3])!==void 0?` · ${S(h.attrs[K3])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X3),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_3(H)}${J3(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P3,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O3)G=G.parent;let F=r(h.node.attrs[a2]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_3(h),verdictHtml:J3(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t2])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w3,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W3(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O3),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_2.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z3]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q3(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q3(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g3]!==void 0).flatMap((b)=>r(b.attrs[U3])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q3(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q3(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q3(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T3(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j3},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w3},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n3(h.view),q=new E3(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B3({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j3,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w3,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m3,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m3};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer-app.js b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer-app.js index 559fb3f984..b7a2536318 100644 --- a/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer-app.js +++ b/server/java/codegen-base/src/main/resources/metaobjects/explorer-app/assets/explorer-app.js @@ -1,4 +1,17 @@ -(()=>{var m2={"explorer-head.mustache":` +/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +(()=>{var m3={"explorer-head.mustache":` @@ -246,10 +259,10 @@ `};/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o3=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V3(m[0])+"\\s*"),Q=new RegExp("\\s*"+V3(m[1])),D=new RegExp("\\s*"+V3("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` -`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d3($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y3=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h2=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h2(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e3=(h)=>h,H2={text:e3,markdown:e3,html:y3,xml:y3,json:iH,csv:IH,spreadsheet:(h)=>h2(y3(h))};var q2="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $2(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z2(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$2(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$2(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z2=["mustache","jinja"],Uh="mustache",o="jinja";var b2=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K2(h,H,q){if(q!==void 0){if(!z2.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z2.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G3="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` `,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` -`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` -`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u3=new Proxy({},{get:()=>nH});var Zh=u3;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b2)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u3.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X2(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W2(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J2(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C3(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q2(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W2(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C3).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C3).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C3(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W2(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J2(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J2(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j2(h,H){if(H.includes("."))return!1;if(!H.startsWith(q2))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w2(h,H){return h&&H===lh}function m2(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m2(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v3(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y2(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u2(h){return G2(h)}function C2(h,H,q){if(q?.engine===o)return Q2(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V2(Q,B)&&!j2(Q,B)&&!w2(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V2(Q,B);if(!v){if(w2(k,B)){J(w,Q,D,k);break}if(j2(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d2(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y2(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d2(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y2(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v2(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v2(q,H)}function B2(h,H,q){let $=[];v2(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B2(K,H,[...q,Z])}}function D2(h,H,q,$,Z){return B2(h,$,H!==void 0?[H]:[]),X2(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F2(h,H,q,$){let Z=u2(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v3(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F2(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B3(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K2(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C2(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G3);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H2[h.format??"text"],Z=q===o?D2(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F2(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z2(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h3="relationship",Y2="layout",M2="source",D3="origin",H3="template",F3="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l2="summary";var uh="string";var k2="currency",Ah="enum",U2="uuid",g2="uri",S2="inet",L2="duration";var Y3="required";var M3="default",l3="maxLength";var x2="filterable",N2="sortable";var q3="objectRef";var k3="values";var U3="fields";var g3="references";var S3="entity",f2="value",O2="projection",P2="report";var $3="from",A2="dimensions",I2="measures",i2="segment",L3="filter",R2="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x3="like",N="isNull";var i1={string:[x,O,P,x3,N],[Ah]:[x,O,P,x3,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k2]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U2]:[x,O,P,N],[g2]:[x,O,P,x3,N],[S2]:[x,O,P,N],[L2]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c2="cardinality",s2="objectRef",p2="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z3="disposition",a2="trackedBy",Ch="statement",t2="counterexample";var Qh="planned",Ih="live",N3="partial",f3="retired",n2=["planned","live","partial","retired"];var _2=["planned","partial"];var O3=3,P3=4;var z3="from";var T2="agg",b3="of",A3="via",I3="filter";var i3="expr";var Vq=["count","sum","avg","min","max"];var E2="any",r2="all",dq="collect",E1=[...Vq,E2,r2,dq];var o2="of",e2="via",hH="grains",HH="agg";var R3="filter",qH="segment",$H="numerator",ZH="denominator";var c3="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s3="pageSize",JH="defaultSortField",p3="defaultSortOrder";var QH="columns";var a3="prompt";var ih="payloadRef",jH="textRef",K3="format";var X3="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N3,Qh,f3].filter((h)=>n2.includes(h)),t3={[Ih]:"●",[N3]:"◐",[Qh]:"○",[f3]:"⊘"},yH=(h,H)=>hH?1:0;class n3{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H3)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M2)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S3}isPrompt(h){return h.type===H3&&h.subType===a3}kindOf(h){if(h.type===H3)return h.subType===a3?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S3)return"entity";if(h.subType===f2)return"value";if(h.subType===O2)return"projection";if(h.subType===P2)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t3[h]??""} ${X(h)}`}function W3(h){if(h==="")return"";return`${t3[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J3(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _3(h){let H=h.node.attrs[Z3];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j3="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w3="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F3,h3,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E3{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l2])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j3,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T3(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T3(j.functional,"feature")}, ${T3(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J3(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W3(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F3||w.type===h3).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y2).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X3,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q3),Z=q.subType===Ah?r(q.attrs[k3]):[],z=[];if(q.attrs[Y3]===!0)z.push("required");if(q.attrs[x2]===!0)z.push("filterable");if(q.attrs[N2]===!0)z.push("sortable");if(q.attrs[l3]!==void 0)z.push(`max ${String(q.attrs[l3])}`);if(q.attrs[M3]!==void 0)z.push(`default ${Xh(q.attrs[M3])}`);if(this.ix.children(q.id).some((b)=>b.type===D3))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W3(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U3]),$=this.refHtml(h,H,g3)||this.refHtml(h,H,s2),Z=S(H.attrs[p2]),z=S(H.attrs[c2]),K=H.type===h3?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o2,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e2]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R3]!==void 0)$.push(`filter ${X(Xh(q[R3]))}`);if(q[c3]!==void 0)$.push(`default ${X(Xh(q[c3]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p3])!==void 0?` ${X(S(h.attrs[p3]))}`:""}`);if(typeof h.attrs[s3]==="number")H.push(`${h.attrs[s3]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D3)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z3))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T2]);if(z!==void 0)Z.push(`${X(z)}(${$(b3)})`);else if(q[b3]!==void 0)Z.push(`of ${$(b3)}`);if(q[z3]!==void 0)Z.push(`from ${$(z3)}`);if(q[A3]!==void 0)Z.push(`via ${X(Kh(String(q[A3])))}`);if(q[i3]!==void 0)Z.push(`${X(Xh(q[i3]))}`);if(q[I3]!==void 0)Z.push(`filter ${X(Xh(q[I3]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$3)[0]?.id??S(q[$3]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R2]);return{fromHtml:this.refHtml(h,H,$3),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A2]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I2]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i2]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L3]!==void 0?`${X(Xh(q[L3]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X3)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y3]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q3)!==""?` → ${this.refHtml($,G,q3)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k3]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K3,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K3])!==void 0?` · ${S(h.attrs[K3])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X3),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_3(H)}${J3(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P3,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O3)G=G.parent;let F=r(h.node.attrs[a2]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_3(h),verdictHtml:J3(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t2])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w3,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W3(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O3),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_2.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z3]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q3(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q3(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g3]!==void 0).flatMap((b)=>r(b.attrs[U3])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q3(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q3(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q3(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T3(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j3},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w3},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n3(h.view),q=new E3(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B3({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j3,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w3,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m3,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m3};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/python/src/metaobjects/documentation/explorer_app/assets/explorer-app.js b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer-app.js index 559fb3f984..b7a2536318 100644 --- a/server/python/src/metaobjects/documentation/explorer_app/assets/explorer-app.js +++ b/server/python/src/metaobjects/documentation/explorer_app/assets/explorer-app.js @@ -1,4 +1,17 @@ -(()=>{var m2={"explorer-head.mustache":` +/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +(()=>{var m3={"explorer-head.mustache":` @@ -246,10 +259,10 @@ `};/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o3=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V3(m[0])+"\\s*"),Q=new RegExp("\\s*"+V3(m[1])),D=new RegExp("\\s*"+V3("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` -`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d3($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y3=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h2=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h2(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e3=(h)=>h,H2={text:e3,markdown:e3,html:y3,xml:y3,json:iH,csv:IH,spreadsheet:(h)=>h2(y3(h))};var q2="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $2(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z2(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$2(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$2(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z2=["mustache","jinja"],Uh="mustache",o="jinja";var b2=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K2(h,H,q){if(q!==void 0){if(!z2.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z2.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G3="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` `,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` -`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` -`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u3=new Proxy({},{get:()=>nH});var Zh=u3;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b2)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u3.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X2(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W2(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J2(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C3(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q2(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W2(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C3).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C3).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C3(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W2(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J2(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J2(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j2(h,H){if(H.includes("."))return!1;if(!H.startsWith(q2))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w2(h,H){return h&&H===lh}function m2(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m2(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v3(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y2(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u2(h){return G2(h)}function C2(h,H,q){if(q?.engine===o)return Q2(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V2(Q,B)&&!j2(Q,B)&&!w2(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V2(Q,B);if(!v){if(w2(k,B)){J(w,Q,D,k);break}if(j2(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d2(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y2(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d2(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y2(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v2(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v2(q,H)}function B2(h,H,q){let $=[];v2(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B2(K,H,[...q,Z])}}function D2(h,H,q,$,Z){return B2(h,$,H!==void 0?[H]:[]),X2(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F2(h,H,q,$){let Z=u2(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v3(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F2(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B3(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K2(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C2(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G3);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H2[h.format??"text"],Z=q===o?D2(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F2(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z2(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h3="relationship",Y2="layout",M2="source",D3="origin",H3="template",F3="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l2="summary";var uh="string";var k2="currency",Ah="enum",U2="uuid",g2="uri",S2="inet",L2="duration";var Y3="required";var M3="default",l3="maxLength";var x2="filterable",N2="sortable";var q3="objectRef";var k3="values";var U3="fields";var g3="references";var S3="entity",f2="value",O2="projection",P2="report";var $3="from",A2="dimensions",I2="measures",i2="segment",L3="filter",R2="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x3="like",N="isNull";var i1={string:[x,O,P,x3,N],[Ah]:[x,O,P,x3,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k2]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U2]:[x,O,P,N],[g2]:[x,O,P,x3,N],[S2]:[x,O,P,N],[L2]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c2="cardinality",s2="objectRef",p2="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z3="disposition",a2="trackedBy",Ch="statement",t2="counterexample";var Qh="planned",Ih="live",N3="partial",f3="retired",n2=["planned","live","partial","retired"];var _2=["planned","partial"];var O3=3,P3=4;var z3="from";var T2="agg",b3="of",A3="via",I3="filter";var i3="expr";var Vq=["count","sum","avg","min","max"];var E2="any",r2="all",dq="collect",E1=[...Vq,E2,r2,dq];var o2="of",e2="via",hH="grains",HH="agg";var R3="filter",qH="segment",$H="numerator",ZH="denominator";var c3="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s3="pageSize",JH="defaultSortField",p3="defaultSortOrder";var QH="columns";var a3="prompt";var ih="payloadRef",jH="textRef",K3="format";var X3="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N3,Qh,f3].filter((h)=>n2.includes(h)),t3={[Ih]:"●",[N3]:"◐",[Qh]:"○",[f3]:"⊘"},yH=(h,H)=>hH?1:0;class n3{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H3)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M2)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S3}isPrompt(h){return h.type===H3&&h.subType===a3}kindOf(h){if(h.type===H3)return h.subType===a3?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S3)return"entity";if(h.subType===f2)return"value";if(h.subType===O2)return"projection";if(h.subType===P2)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t3[h]??""} ${X(h)}`}function W3(h){if(h==="")return"";return`${t3[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J3(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _3(h){let H=h.node.attrs[Z3];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j3="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w3="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F3,h3,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E3{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l2])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j3,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T3(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T3(j.functional,"feature")}, ${T3(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J3(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W3(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F3||w.type===h3).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y2).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X3,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q3),Z=q.subType===Ah?r(q.attrs[k3]):[],z=[];if(q.attrs[Y3]===!0)z.push("required");if(q.attrs[x2]===!0)z.push("filterable");if(q.attrs[N2]===!0)z.push("sortable");if(q.attrs[l3]!==void 0)z.push(`max ${String(q.attrs[l3])}`);if(q.attrs[M3]!==void 0)z.push(`default ${Xh(q.attrs[M3])}`);if(this.ix.children(q.id).some((b)=>b.type===D3))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W3(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U3]),$=this.refHtml(h,H,g3)||this.refHtml(h,H,s2),Z=S(H.attrs[p2]),z=S(H.attrs[c2]),K=H.type===h3?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o2,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e2]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R3]!==void 0)$.push(`filter ${X(Xh(q[R3]))}`);if(q[c3]!==void 0)$.push(`default ${X(Xh(q[c3]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p3])!==void 0?` ${X(S(h.attrs[p3]))}`:""}`);if(typeof h.attrs[s3]==="number")H.push(`${h.attrs[s3]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D3)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z3))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T2]);if(z!==void 0)Z.push(`${X(z)}(${$(b3)})`);else if(q[b3]!==void 0)Z.push(`of ${$(b3)}`);if(q[z3]!==void 0)Z.push(`from ${$(z3)}`);if(q[A3]!==void 0)Z.push(`via ${X(Kh(String(q[A3])))}`);if(q[i3]!==void 0)Z.push(`${X(Xh(q[i3]))}`);if(q[I3]!==void 0)Z.push(`filter ${X(Xh(q[I3]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$3)[0]?.id??S(q[$3]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R2]);return{fromHtml:this.refHtml(h,H,$3),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A2]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I2]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i2]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L3]!==void 0?`${X(Xh(q[L3]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X3)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y3]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q3)!==""?` → ${this.refHtml($,G,q3)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k3]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K3,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K3])!==void 0?` · ${S(h.attrs[K3])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X3),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_3(H)}${J3(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P3,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O3)G=G.parent;let F=r(h.node.attrs[a2]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_3(h),verdictHtml:J3(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t2])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w3,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W3(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O3),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_2.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z3]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q3(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q3(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g3]!==void 0).flatMap((b)=>r(b.attrs[U3])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q3(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q3(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q3(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T3(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j3},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w3},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n3(h.view),q=new E3(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B3({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j3,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w3,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m3,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m3};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/typescript/packages/docs-site/app/assets/explorer-app.js b/server/typescript/packages/docs-site/app/assets/explorer-app.js index 559fb3f984..b7a2536318 100644 --- a/server/typescript/packages/docs-site/app/assets/explorer-app.js +++ b/server/typescript/packages/docs-site/app/assets/explorer-app.js @@ -1,4 +1,17 @@ -(()=>{var m2={"explorer-head.mustache":` +/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +(()=>{var m3={"explorer-head.mustache":` @@ -246,10 +259,10 @@ `};/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var BH=Object.prototype.toString,Gh=Array.isArray||function(H){return BH.call(H)==="[object Array]"};function d2(h){return typeof h==="function"}function DH(h){return Gh(h)?"array":typeof h}function V2(h){return h.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function r2(h,H){return h!=null&&typeof h==="object"&&H in h}function FH(h,H){return h!=null&&typeof h!=="object"&&h.hasOwnProperty&&h.hasOwnProperty(H)}var YH=RegExp.prototype.test;function MH(h,H){return YH.call(h,H)}var lH=/\S/;function kH(h){return!MH(lH,h)}var UH={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o2=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V2(m[0])+"\\s*"),Q=new RegExp("\\s*"+V2(m[1])),D=new RegExp("\\s*"+V2("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gH(h){return String(h).replace(/[&<>"'`=\/]/g,function(q){return UH[q]})}var SH=/\s*/,LH=/\s+/,o3=/\s*=/,xH=/\s*\}/,NH=/#|\^|\/|>|\{|&|=|!/;function fH(h,H){if(!h)return[];var q=!1,$=[],Z=[],z=[],K=!1,b=!1,J="",j=0;function W(){if(K&&!b)while(z.length)delete Z[z.pop()];else z=[];K=!1,b=!1}var d,Q,D;function k(m){if(typeof m==="string")m=m.split(LH,2);if(!Gh(m)||m.length!==2)throw Error("Invalid tags: "+m);d=new RegExp(V3(m[0])+"\\s*"),Q=new RegExp("\\s*"+V3(m[1])),D=new RegExp("\\s*"+V3("}"+m[1]))}k(H||c.tags);var u=new Mh(h),G,F,B,w,v,l;while(!u.eos()){if(G=u.pos,B=u.scanUntil(d),B)for(var hh=0,V=B.length;hh")v=[F,B,G,u.pos,J,j,q];else v=[F,B,G,u.pos];if(j++,Z.push(v),F==="#"||F==="^")$.push(v);else if(F==="/"){if(l=$.pop(),!l)throw Error('Unopened section "'+B+'" at '+G);if(l[1]!==B)throw Error('Unclosed section "'+l[1]+'" at '+G)}else if(F==="name"||F==="{"||F==="&")b=!0;else if(F==="=")k(B)}if(W(),l=$.pop(),l)throw Error('Unclosed section "'+l[1]+'" at '+u.pos);return PH(OH(Z))}function OH(h){var H=[],q,$;for(var Z=0,z=h.length;Z0?$[$.length-1][4]:H;break;default:q.push(Z)}return H}function Mh(h){this.string=h,this.tail=h,this.pos=0}Mh.prototype.eos=function(){return this.tail===""};Mh.prototype.scan=function(H){var q=this.tail.match(H);if(!q||q.index!==0)return"";var $=q[0];return this.tail=this.tail.substring($.length),this.pos+=$.length,$};Mh.prototype.scanUntil=function(H){var q=this.tail.search(H),$;switch(q){case-1:$=this.tail,this.tail="";break;case 0:$="";break;default:$=this.tail.substring(0,q),this.tail=this.tail.substring(q)}return this.pos+=$.length,$};function yh(h,H){this.view=h,this.cache={".":this.view},this.parent=H}yh.prototype.push=function(H){return new yh(H,this)};yh.prototype.lookup=function(H){var q=this.cache,$;if(q.hasOwnProperty(H))$=q[H];else{var Z=this,z,K,b,J=!1;while(Z){if(H.indexOf(".")>0){z=Z.view,K=H.split("."),b=0;while(z!=null&&b")j=this.renderPartial(b,q,$,z);else if(J==="&")j=this.unescapedValue(b,q);else if(J==="name")j=this.escapedValue(b,q,z);else if(J==="text")j=this.rawValue(b);if(j!==void 0)K+=j}return K};f.prototype.renderSection=function(H,q,$,Z,z){var K=this,b="",J=q.lookup(H[1]);function j(Q){return K.render(Q,q,$,z)}if(!J)return;if(Gh(J))for(var W=0,d=J.length;W0||!$))z[K]=Z+z[K];return z.join(` -`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d2($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y2=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h3=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h3(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e2=(h)=>h,H3={text:e2,markdown:e2,html:y2,xml:y2,json:iH,csv:IH,spreadsheet:(h)=>h3(y2(h))};var q3="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $3(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z3(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$3(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$3(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z3=["mustache","jinja"],Uh="mustache",o="jinja";var b3=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K3(h,H,q){if(q!==void 0){if(!z3.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z3.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G2="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` +`)};f.prototype.renderPartial=function(H,q,$,Z){if(!$)return;var z=this.getConfigTags(Z),K=d3($)?$(H[1]):$[H[1]];if(K!=null){var b=H[6],J=H[5],j=H[4],W=K;if(J==0&&j)W=this.indentPartial(K,j,b);var d=this.parse(W,z);return this.renderTokens(d,q,$,W,Z)}};f.prototype.unescapedValue=function(H,q){var $=q.lookup(H[1]);if($!=null)return $};f.prototype.escapedValue=function(H,q,$){var Z=this.getConfigEscape($)||c.escape,z=q.lookup(H[1]);if(z!=null)return typeof z==="number"&&Z===c.escape?String(z):Z(z)};f.prototype.rawValue=function(H){return H[1]};f.prototype.getConfigTags=function(H){if(Gh(H))return H;else if(H&&typeof H==="object")return H.tags;else return};f.prototype.getConfigEscape=function(H){if(H&&typeof H==="object"&&!Gh(H))return H.escape;else return};var c={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(h){Yh.templateCache=h},get templateCache(){return Yh.templateCache}},Yh=new f;c.clearCache=function(){return Yh.clearCache()};c.parse=function(H,q){return Yh.parse(H,q)};c.render=function(H,q,$,Z){if(typeof H!=="string")throw TypeError('Invalid template! Template should be a "string" but "'+DH(H)+'" was given as the first argument for mustache#render(template, view, partials)');return Yh.render(H,q,$,Z)};c.escape=gH;c.Scanner=Mh;c.Context=yh;c.Writer=f;var Hh=c;var y3=(h)=>h.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),AH=/^-?[0-9]+(\.[0-9]+)?$/,h2=(h)=>/^[=+\-@\t\r]/.test(h)&&!AH.test(h)?"'"+h:h,IH=(h)=>{let H=h2(h);return/[",\n\r]/.test(H)?`"${H.replace(/"/g,'""')}"`:H},iH=(h)=>JSON.stringify(h).slice(1,-1),e3=(h)=>h,H2={text:e3,markdown:e3,html:y3,xml:y3,json:iH,csv:IH,spreadsheet:(h)=>h2(y3(h))};var q2="has";function ah(h){return"has"+RH(h)}var lh="-last";function RH(h){if(h.length===0)return h;let H=h.charAt(0);if(H===H.toUpperCase()&&H!==H.toLowerCase())return h;return H.toUpperCase()+h.slice(1)}function $2(h){if(h===null||h===void 0)return!1;if(typeof h==="string")return h.trim().length>0;if(Array.isArray(h))return h.length>0;if(typeof h==="number"||typeof h==="boolean"||typeof h==="bigint")return;return typeof h==="object"}function Z2(h,H=0){return kh(h,H,void 0)}function kh(h,H,q){if(H>32)return h;if(Array.isArray(h)){let K=h.length-1;return h.map((b,J)=>kh(b,H+1,J===K))}if(h===null||typeof h!=="object")return h;let $=Object.getPrototypeOf(h);if($!==Object.prototype&&$!==null)return sH(h,H,q);let Z=h,z={};for(let[K,b]of Object.entries(Z))z[K]=kh(b,H+1,void 0);for(let[K,b]of Object.entries(Z)){let J=ah(K);if(Object.prototype.hasOwnProperty.call(Z,J))continue;let j=$2(b);if(j!==void 0)z[J]=j}if(q!==void 0&&!Object.prototype.hasOwnProperty.call(Z,lh))z[lh]=q;return z}function cH(h){return h.length===0?h:h.charAt(0).toLowerCase()+h.slice(1)}function sH(h,H,q){let $=new Map,Z=(K)=>{if($.has(K))return $.get(K);let b=Reflect.get(h,K,h),J=typeof b==="function"?(...j)=>kh(Reflect.apply(b,h,j),H+1,void 0):kh(b,H+1,void 0);return $.set(K,J),J},z=(K)=>{if(typeof K!=="string")return;if(K===lh)return q;if(!K.startsWith("has"))return;let b=K.slice(3);for(let J of[cH(b),b]){if(!(J in h)||ah(J)!==K)continue;let j=Reflect.get(h,J,h);if(typeof j==="function")continue;let W=$2(j);if(W!==void 0)return W}return};return new Proxy(Object.create(null),{has:(K,b)=>(b in h)||z(b)!==void 0,get:(K,b)=>(b in h)?Z(b):z(b)})}var z2=["mustache","jinja"],Uh="mustache",o="jinja";var b2=[".jinja",".j2",".jinja2"];function qh(h,H,q){let $=h.engineOf?.(H);return $!==void 0&&$!==q}function th(h,H){return`ERR_TEMPLATE_ENGINE_UNSUPPORTED: partial ${h} is not a ${H} template; a ${H} body includes only ${H} partials`}function K2(h,H,q){if(q!==void 0){if(!z2.includes(q))throw Error(`unknown template engine ${JSON.stringify(q)}; expected one of ${z2.join(", ")}`);return q}if(h!==void 0&&H!==void 0){let $=h.engineOf?.(H);if($!==void 0)return $}return"mustache"}var I="ERR_VAR_NOT_ON_PAYLOAD",gh="ERR_PARTIAL_UNRESOLVED",G3="ERR_REQUIRED_SLOT_UNUSED";var Sh="ERR_TEMPLATE_NOT_STATIC",$h="ERR_TEMPLATE_SYNTAX",Lh="ERR_TEMPLATE_ENGINE_UNSUPPORTED",a=32,pH=new Set([">"," ","\t",` `,"\r"]);function aH(h,H){let q=`<${H}`;for(let $=h.indexOf(q);$!==-1;$=h.indexOf(q,$+1)){let Z=h[$+q.length];if(Z!==void 0&&pH.has(Z))return!0}return!1}function tH(h,H){return h.includes(``)}function nh(h,H,q){let $=[];for(let z of q?.requiredSlots??[])if(!h.has(z))$.push({code:"ERR_REQUIRED_SLOT_UNUSED",path:z});let Z=q?.requiredTags??[];if(Z.length>0){let z=H.join(` -`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u2=new Proxy({},{get:()=>nH});var Zh=u2;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b3)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u2.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X3(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W3(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J3(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C2(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q3(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W3(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C2).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C2).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C2(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W3(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J3(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J3(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j3(h,H){if(H.includes("."))return!1;if(!H.startsWith(q3))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w3(h,H){return h&&H===lh}function m3(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m3(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v2(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y3(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u3(h){return G3(h)}function C3(h,H,q){if(q?.engine===o)return Q3(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V3(Q,B)&&!j3(Q,B)&&!w3(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V3(Q,B);if(!v){if(w3(k,B)){J(w,Q,D,k);break}if(j3(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d3(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y3(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d3(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y3(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v3(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v3(q,H)}function B3(h,H,q){let $=[];v3(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B3(K,H,[...q,Z])}}function D3(h,H,q,$,Z){return B3(h,$,H!==void 0?[H]:[]),X3(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F3(h,H,q,$){let Z=u3(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v2(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F3(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B2(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K3(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C3(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G2);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H3[h.format??"text"],Z=q===o?D3(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F3(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z3(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h2="relationship",Y3="layout",M3="source",D2="origin",H2="template",F2="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l3="summary";var uh="string";var k3="currency",Ah="enum",U3="uuid",g3="uri",S3="inet",L3="duration";var Y2="required";var M2="default",l2="maxLength";var x3="filterable",N3="sortable";var q2="objectRef";var k2="values";var U2="fields";var g2="references";var S2="entity",f3="value",O3="projection",P3="report";var $2="from",A3="dimensions",I3="measures",i3="segment",L2="filter",R3="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x2="like",N="isNull";var i1={string:[x,O,P,x2,N],[Ah]:[x,O,P,x2,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k3]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U3]:[x,O,P,N],[g3]:[x,O,P,x2,N],[S3]:[x,O,P,N],[L3]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c3="cardinality",s3="objectRef",p3="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z2="disposition",a3="trackedBy",Ch="statement",t3="counterexample";var Qh="planned",Ih="live",N2="partial",f2="retired",n3=["planned","live","partial","retired"];var _3=["planned","partial"];var O2=3,P2=4;var z2="from";var T3="agg",b2="of",A2="via",I2="filter";var i2="expr";var Vq=["count","sum","avg","min","max"];var E3="any",r3="all",dq="collect",E1=[...Vq,E3,r3,dq];var o3="of",e3="via",hH="grains",HH="agg";var R2="filter",qH="segment",$H="numerator",ZH="denominator";var c2="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s2="pageSize",JH="defaultSortField",p2="defaultSortOrder";var QH="columns";var a2="prompt";var ih="payloadRef",jH="textRef",K2="format";var X2="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N2,Qh,f2].filter((h)=>n3.includes(h)),t2={[Ih]:"●",[N2]:"◐",[Qh]:"○",[f2]:"⊘"},yH=(h,H)=>hH?1:0;class n2{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H2)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M3)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S2}isPrompt(h){return h.type===H2&&h.subType===a2}kindOf(h){if(h.type===H2)return h.subType===a2?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S2)return"entity";if(h.subType===f3)return"value";if(h.subType===O3)return"projection";if(h.subType===P3)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t2[h]??""} ${X(h)}`}function W2(h){if(h==="")return"";return`${t2[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J2(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _2(h){let H=h.node.attrs[Z2];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j2="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w2="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F2,h2,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E2{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l3])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j2,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T2(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T2(j.functional,"feature")}, ${T2(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J2(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W2(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F2||w.type===h2).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y3).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X2,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q2),Z=q.subType===Ah?r(q.attrs[k2]):[],z=[];if(q.attrs[Y2]===!0)z.push("required");if(q.attrs[x3]===!0)z.push("filterable");if(q.attrs[N3]===!0)z.push("sortable");if(q.attrs[l2]!==void 0)z.push(`max ${String(q.attrs[l2])}`);if(q.attrs[M2]!==void 0)z.push(`default ${Xh(q.attrs[M2])}`);if(this.ix.children(q.id).some((b)=>b.type===D2))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W2(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U2]),$=this.refHtml(h,H,g2)||this.refHtml(h,H,s3),Z=S(H.attrs[p3]),z=S(H.attrs[c3]),K=H.type===h2?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o3,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e3]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R2]!==void 0)$.push(`filter ${X(Xh(q[R2]))}`);if(q[c2]!==void 0)$.push(`default ${X(Xh(q[c2]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p2])!==void 0?` ${X(S(h.attrs[p2]))}`:""}`);if(typeof h.attrs[s2]==="number")H.push(`${h.attrs[s2]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D2)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z2))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T3]);if(z!==void 0)Z.push(`${X(z)}(${$(b2)})`);else if(q[b2]!==void 0)Z.push(`of ${$(b2)}`);if(q[z2]!==void 0)Z.push(`from ${$(z2)}`);if(q[A2]!==void 0)Z.push(`via ${X(Kh(String(q[A2])))}`);if(q[i2]!==void 0)Z.push(`${X(Xh(q[i2]))}`);if(q[I2]!==void 0)Z.push(`filter ${X(Xh(q[I2]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$2)[0]?.id??S(q[$2]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R3]);return{fromHtml:this.refHtml(h,H,$2),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A3]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I3]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i3]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L2]!==void 0?`${X(Xh(q[L2]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X2)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y2]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q2)!==""?` → ${this.refHtml($,G,q2)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k2]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` -`).length:0,D=[K2,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K2])!==void 0?` · ${S(h.attrs[K2])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X2),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_2(H)}${J2(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P2,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O2)G=G.parent;let F=r(h.node.attrs[a3]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_2(h),verdictHtml:J2(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t3])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w2,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W2(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O2),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_3.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z2]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q2(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q2(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g2]!==void 0).flatMap((b)=>r(b.attrs[U2])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q2(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q2(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q2(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T2(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j2},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w2},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n2(h.view),q=new E2(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B2({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j2,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w2,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m2,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m2};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); +`);for(let K of Z)if(!aH(z,K)||!tH(z,K))$.push({code:"ERR_OUTPUT_TAG_MISSING",path:K})}return $}var nH=()=>{throw Error("the explorer app renders Mustache only")},u3=new Proxy({},{get:()=>nH});var Zh=u3;function xh(h){return Zh.parser.parse(h)}function zh(h){return typeof h==="object"&&h!==null&&typeof h.typename==="string"}function A(h){let H=[],q=($)=>{if(Array.isArray($))$.forEach(q);else if(zh($))H.push($)};for(let $ of h.fields)q(h[$]);if(h.typename==="Set")q(h.body);return H}function Nh(h){for(let H of b2)if(h.toLowerCase().endsWith(H))return h.slice(0,-H.length);return h}function _H(h){return function(H,q){this._emit("runtime.markSafe("),h.call(this,H,q),this._emit(")")}}function TH(h){let H={getSource(q){let $=h.resolve(Nh(q));return $===void 0?null:{src:$,path:q,noCache:!0}}};return new u3.Environment(H,{autoescape:!0,throwOnUndefined:!0,trimBlocks:!1,lstripBlocks:!1})}function EH(h){if(h===void 0)throw Error(`render verify failed: ${I}`);return h}function X2(h,H,q,$){let Z=TH(q),z=Zh.compiler.Compiler.prototype,K=Zh.lib.escape,b=z.compileCapture,J=Zh.runtime.ensureDefined;Zh.runtime.ensureDefined=EH,Zh.lib.escape=(j)=>$(typeof j==="string"?j:String(j)),z.compileCapture=_H(b);try{return Z.renderString(h,H)}finally{Zh.lib.escape=K,z.compileCapture=b,Zh.runtime.ensureDefined=J}}var g={tag:"opaque"},rH=new Set(["range","cycler","joiner","namespace","dict","lipsum","super","self"]),oH=new Set(["first","last","random"]),eH=new Set(["sort","reverse","list","unique","selectattr","rejectattr","default","d"]),hq=new Map([["selectattr",0],["rejectattr",0],["groupby",0],["sum",0],["join",1],["min",1],["max",1],["unique",1],["sort",2]]),Hq="attribute";function W2(h,H){return{tag:"typed",fields:h.fields,isArray:h.isArray===!0,path:H}}function J2(h,H){if(h.tag==="opaque")return g;return{tag:"typed",fields:h.isArray?h.fields:void 0,isArray:!1,path:H}}function C3(h){if(h.kind==="key")return`.${h.key}`;if(h.kind==="index")return`[${h.index}]`;return"[*]"}function Q2(h,H,q){let $=[],Z=q?.provider,z=new Set,K=[h],b=(V,m)=>{$.push({code:V,path:m})};function J(V,m){for(let C=m.frames.length-1;C>=0;C--){let Y=m.frames[C].get(V);if(Y!==void 0)return Y}let y=m.root.find((C)=>C.name===V);if(y!==void 0){if(m.root===H)z.add(V);return W2(y,V)}return rH.has(V)?g:void 0}function j(V,m,y){V.frames[V.frames.length-1].set(m,y)}function W(V){return{...V,frames:[...V.frames,new Map]}}function d(V){let m=[],y=V;while(y.typename==="LookupVal"){let C=y.val;if(C.typename==="Literal"&&typeof C.value==="string")m.unshift({kind:"key",key:C.value});else if(C.typename==="Literal"&&typeof C.value==="number")m.unshift({kind:"index",index:C.value});else m.unshift({kind:"dynamic",node:C});y=y.target}return{base:y,segments:m}}function Q(V,m){let{base:y,segments:C}=d(V);for(let L of C)if(L.kind==="dynamic")v(L.node,m);let Y,M;if(y.typename==="Symbol"){M=y.value;let L=M+C.map(C3).join(""),R=J(M,m);if(R===void 0)return b(I,L),g;Y=R}else Y=v(y,m),M=Y.tag==="typed"?Y.path:"";let s=M+C.map(C3).join("");for(let L of C){if(Y.tag==="opaque")return g;if(M+=C3(L),L.kind==="key"){let R=Y.isArray?void 0:Y.fields?.find((dh)=>dh.name===L.key);if(R===void 0)return b(I,s),g;Y=W2(R,M)}else if(Y.isArray)Y={tag:"typed",fields:Y.fields,isArray:!1,path:M};else if(L.kind==="dynamic"&&Y.fields!==void 0)return b(Sh,s),g;else Y={tag:"typed",fields:Y.fields,isArray:!1,path:M}}return Y}function D(V,m,y){if(V.tag==="opaque"){v(m,y);return}if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,`${V.path}[*]`);return}let C=m.value,Y=V.fields;for(let M of C.split(".")){let s=Y?.find((L)=>L.name===M);if(s===void 0){b(I,`${V.path}.${C}`);return}Y=s.fields}}function k(V){let m=[],y=[];for(let C of V===void 0?[]:A(V))if(C.typename==="KeywordArgs")for(let Y of A(C)){let M=Y.key;y.push([String(M.value),Y.value])}else m.push(C);return{positional:m,keywords:y}}function u(V,m){let y=String(V.name.value),{positional:C,keywords:Y}=k(V.args),[M,...s]=C,L=M===void 0?g:v(M,m);s.forEach((R,dh)=>{if(dh===hq.get(y))D(L,R,m);else v(R,m)});for(let[R,dh]of Y)if(R===Hq)D(L,dh,m);else v(dh,m);if(oH.has(y))return L.tag==="typed"?J2(L,`${L.path}|${y}`):g;if(eH.has(y))return L;return g}function G(V,m){let y=V.name;if(y.typename==="LookupVal")v(y.target,m);else if(y.typename==="Symbol"){let M=y.value;if(J(M,m)===void 0)b(I,M)}else v(y,m);let{positional:C,keywords:Y}=k(V.args);return C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m)),g}function F(V,m){let y=W(m);for(let C of["caller","varargs","kwargs"])j(y,C,g);for(let C of A(V.args))if(C.typename==="Symbol")j(y,C.value,g);else if(C.typename==="KeywordArgs")for(let Y of A(C))v(Y.value,m),j(y,String(Y.key.value),g);l(V.body,y)}function B(V,m,y,C,Y=!1){if(m.typename!=="Literal"||typeof m.value!=="string"){v(m,y),b(Sh,V);return}if(Z===void 0)return;let M=Nh(m.value);if(y.seen.includes(M)||y.seen.length>=a)return;let s=Z.resolve(M);if(s===void 0){if(!Y)b(gh,M);return}if(qh(Z,M,o)){b(Lh,M);return}K.push(s);let L;try{L=xh(s)}catch(R){b($h,`${M}: ${R.message}`);return}l(L,C(y,M))}function w(V,m,y){if(V.typename==="Symbol")j(y,V.value,m);else for(let C of A(V))w(C,g,y)}function v(V,m){switch(V.typename){case"Symbol":case"LookupVal":return Q(V,m);case"Literal":case"TemplateData":return g;case"Group":{let y=A(V);if(y.length===1)return v(y[0],m);return y.forEach((C)=>v(C,m)),g}case"Filter":case"FilterAsync":return u(V,m);case"FunCall":return G(V,m);case"Caller":return F(V,m),g;case"Is":{v(V.left,m);let y=V.right;if(y.typename==="FunCall"){let{positional:C,keywords:Y}=k(y.args);C.forEach((M)=>v(M,m)),Y.forEach(([,M])=>v(M,m))}return g}case"Pair":{let y=V.key;if(y.typename!=="Symbol")v(y,m);return v(V.value,m),g}case"Capture":return l(V.body,m),g;default:for(let y of A(V))v(y,m);return g}}function l(V,m){switch(V.typename){case"Root":case"NodeList":for(let y of A(V))l(y,m);return;case"Output":for(let y of A(V))v(y,m);return;case"If":case"IfAsync":{if(v(V.cond,m),l(V.body,m),zh(V.else_))l(V.else_,m);return}case"For":case"AsyncEach":case"AsyncAll":{let y=v(V.arr,m),C=W(m);j(C,"loop",g);let Y=V.name;if(Y.typename==="Symbol"){let M=Y.value;j(C,M,J2(y,M))}else w(Y,g,C);if(l(V.body,C),zh(V.else_))l(V.else_,m);return}case"Set":{let y=V.targets.filter(zh),C=g;if(zh(V.value))C=v(V.value,m);else if(zh(V.body))v(V.body,m);for(let Y of y){let M=Y.value;j(m,M,C.tag==="typed"&&y.length===1?{...C,path:M}:g)}return}case"Macro":j(m,String(V.name.value),g),F(V,m);return;case"Include":B("include",V.template,m,(y,C)=>({...W(y),seen:[...y.seen,C]}),V.ignoreMissing===!0);return;case"Import":case"FromImport":{let y=V.withContext===!0;if(B("import",V.template,m,(C,Y)=>({frames:[new Map],root:y?H:[],seen:[...C.seen,Y]})),V.typename==="Import")j(m,String(V.target.value),g);else for(let C of A(V.names)){let Y=C.typename==="Pair"?C.value:C;j(m,String(Y.value),g)}return}case"Extends":B("extends",V.template,m,(y,C)=>({frames:[new Map],root:H,seen:[...y.seen,C]}));return;case"Block":l(V.body,m);return;case"Switch":{v(V.expr,m);for(let y of A(V.cases))v(y.cond,m),l(y.body,m);if(zh(V.default))l(V.default,m);return}default:v(V,m)}}let hh;try{hh=xh(h)}catch(V){return[{code:$h,path:V.message}]}return l(hh,{frames:[new Map],root:H,seen:[]}),$.push(...nh(z,K,q)),$}function j2(h,H){if(H.includes("."))return!1;if(!H.startsWith(q2))return!1;for(let q=h.length-1;q>=0;q--)for(let $ of h[q])if(H===ah($.name))return!0;return!1}function w2(h,H){return h&&H===lh}function m2(h,H){return h.find((q)=>q.name===H)}function qq(h,H){let q=H.split("."),$;for(let Z=h.length-1;Z>=0;Z--){let z=m2(h[Z],q[0]);if(z){$=z;break}}for(let Z=1;$&&ZH[0]===$q).map((H)=>[H[1],H[2],H[3]])}function bq(h){return Th(h).some((H)=>H[0]===zq)}function _h(h,H){if(!bq(h))return;return H??v3(h)[0]?.[0]}function Kq(h){return Th(h).filter((H)=>H[0]===Zq).map((H)=>[H[2],H[3]])}function y2(h,H){let q="",$=0;for(let[Z,z]of Kq(H))q+=h.slice($,Z),$=z;return q+h.slice($)}function Xq(h){return/^(?:Unopened|Unclosed) section "(.*)" at \d+$/.exec(h instanceof Error?h.message:"")?.[1]}function u2(h){return G2(h)}function C2(h,H,q){if(q?.engine===o)return Q2(h,H,q);let $=[],Z=q?.provider,z=H,K=new Set,b=[h];function J(d,Q,D,k=!1){let u=Q.length===1&&Q[0]===z;for(let G of d){let F=G[0],B=G[1];switch(F){case"name":case"&":case"{":{if(B===".")break;if(u)K.add(B.split(".")[0]);if(!V2(Q,B)&&!j2(Q,B)&&!w2(k,B))$.push({code:I,path:B});break}case"#":case"^":{let w=Array.isArray(G[4])?G[4]:[];if(B==="."){J(w,Q,D,k);break}if(u)K.add(B.split(".")[0]);let v=V2(Q,B);if(!v){if(w2(k,B)){J(w,Q,D,k);break}if(j2(Q,B)){J(w,Q,D,k);break}$.push({code:I,path:B});break}let l=F==="#"&&v.fields!==void 0,hh=F==="#"&&v.isArray===!0;J(w,l?[...Q,v.fields]:Q,D,hh?v.fields!==void 0:k);break}case">":{if(!Z)break;if(D.includes(B)||D.length>=a)break;let w=Z.resolve(B);if(w===void 0){$.push({code:gh,path:B});break}if(qh(Z,B,Uh)){$.push({code:Lh,path:B});break}let v=d2(w);if(!Array.isArray(v)){$.push(v);break}let l=_h(v,B);if(l!==void 0)$.push({code:$h,path:l});b.push(y2(w,v)),J(v,Q,[...D,B],k);break}default:break}}}let j=d2(h);if(!Array.isArray(j))return[j];let W=_h(j,void 0);if(W!==void 0)$.push({code:$h,path:W});return b[0]=y2(h,j),J(j,[z],[]),$.push(...nh(K,b,q)),$}var Wq=new Set(["Include","Import","FromImport","Extends"]);function v2(h,H){if(Wq.has(h.typename)){let q=h.template;if(q.typename==="Literal"&&typeof q.value==="string")H.push({ref:Nh(q.value),optional:h.ignoreMissing===!0})}for(let q of A(h))v2(q,H)}function B2(h,H,q){let $=[];v2(xh(h),$);for(let{ref:Z,optional:z}of $){if(q.includes(Z))throw Error(`partial cycle: ${[...q,Z].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${Z}`);let K=H.resolve(Z);if(K===void 0){if(z)continue;throw Error(`unresolved partial: ${Z}`)}if(qh(H,Z,o))throw Error(th(Z,o));B2(K,H,[...q,Z])}}function D2(h,H,q,$,Z){return B2(h,$,H!==void 0?[H]:[]),X2(h,typeof q==="object"&&q!==null?q:{},$,Z)}function F2(h,H,q,$){let Z=u2(h);if(_h(Z,$)!==void 0)throw Error("a template that uses partials cannot also change delimiters ({{=<% %>=}})");let z=v3(Z);if(z.length===0)return h;let K="",b=0;for(let[J,j,W]of z){if(q.includes(J))throw Error(`partial cycle: ${[...q,J].join(" -> ")}`);if(q.length>=a)throw Error(`partial depth exceeded ${a}: ${J}`);let d=H.resolve(J);if(d===void 0)throw Error(`unresolved partial: ${J}`);if(qh(H,J,Uh))throw Error(th(J,Uh));K+=h.slice(b,j)+F2(d,H,[...q,J],J),b=W}return K+h.slice(b)}function B3(h){let H=h.template??(h.ref!==void 0?h.provider.resolve(h.ref):void 0);if(H===void 0)throw Error(`unresolved ref: ${h.ref??"(none)"}`);let q=K2(h.provider,h.template===void 0?h.ref:void 0,h.engine);if(h.verify!==void 0){let z=C2(H,h.verify,{provider:h.provider,engine:q}).filter((K)=>K.code!==G3);if(z.length>0)throw Error(`render verify failed: ${z.map((K)=>`${K.code} (${K.path})`).join(", ")}`)}let $=H2[h.format??"text"],Z=q===o?D2(H,h.template===void 0?h.ref:void 0,h.payload,h.provider,$):Qq(H,h,$);if(h.maxChars!==void 0&&Z.length>h.maxChars)throw Error(`render exceeded maxChars budget: ${Z.length} > ${h.maxChars}`);return Z}function Jq(){let h=Hh.Writer.prototype,H={escapedValue:h.escapedValue,unescapedValue:h.unescapedValue};for(let q of["escapedValue","unescapedValue"]){let $=H[q];h[q]=function(Z,z,...K){let b=String(Z[1]);if(z.lookup(b)===void 0)throw Error(`render verify failed: ${I} (${b})`);return $.call(this,Z,z,...K)}}return()=>{h.escapedValue=H.escapedValue,h.unescapedValue=H.unescapedValue}}function Qq(h,H,q){let $=F2(h,H.provider,H.ref!==void 0?[H.ref]:[]),Z=Hh.escape;Hh.escape=(b)=>q(typeof b==="string"?b:String(b));let z,K=Jq();try{z=Hh.render($,Z2(H.payload),{})}finally{Hh.escape=Z,K()}return z}class Eh{map;engine;constructor(h,H={}){this.map=h;this.engine=H.engine}resolve(h){return Object.prototype.hasOwnProperty.call(this.map,h)?this.map[h]:void 0}engineOf(h){return this.resolve(h)===void 0?void 0:this.engine}}var rh="object",oh="field";var eh="identity",h3="relationship",Y2="layout",M2="source",D3="origin",H3="template",F3="index",bh="requirement",fh="dimension",Oh="measure",Ph="segment";var Wh="description",l2="summary";var uh="string";var k2="currency",Ah="enum",U2="uuid",g2="uri",S2="inet",L2="duration";var Y3="required";var M3="default",l3="maxLength";var x2="filterable",N2="sortable";var q3="objectRef";var k3="values";var U3="fields";var g3="references";var S3="entity",f2="value",O2="projection",P2="report";var $3="from",A2="dimensions",I2="measures",i2="segment",L3="filter",R2="spine";var x="eq",O="ne",t="gt",n="gte",_="lt",T="lte",P="in",x3="like",N="isNull";var i1={string:[x,O,P,x3,N],[Ah]:[x,O,P,x3,N],int:[x,O,t,n,_,T,P,N],long:[x,O,t,n,_,T,P,N],double:[x,O,t,n,_,T,P,N],float:[x,O,t,n,_,T,P,N],decimal:[x,O,t,n,_,T,P,N],[k2]:[x,O,t,n,_,T,P,N],boolean:[x,N],date:[x,O,t,n,_,T,P,N],time:[x,O,t,n,_,T,P,N],timestamp:[x,O,t,n,_,T,P,N],[U2]:[x,O,P,N],[g2]:[x,O,P,x3,N],[S2]:[x,O,P,N],[L2]:[x,O,t,n,_,T,P,N]};var jq="association",wq="aggregation",mq="composition";var c2="cardinality",s2="objectRef",p2="through";var s1={[mq]:"cascade",[wq]:"set-null",[jq]:"restrict"};var i="functional",Jh="architectural";var Z3="disposition",a2="trackedBy",Ch="statement",t2="counterexample";var Qh="planned",Ih="live",N3="partial",f3="retired",n2=["planned","live","partial","retired"];var _2=["planned","partial"];var O3=3,P3=4;var z3="from";var T2="agg",b3="of",A3="via",I3="filter";var i3="expr";var Vq=["count","sum","avg","min","max"];var E2="any",r2="all",dq="collect",E1=[...Vq,E2,r2,dq];var o2="of",e2="via",hH="grains",HH="agg";var R3="filter",qH="segment",$H="numerator",ZH="denominator";var c3="default";var zH="column";var yq="uuid",Gq="jsonb";var uq="text",Cq="varchar",vq="character varying";var Z4={[yq]:[uh],[Gq]:[uh],[uq]:[uh],[Cq]:[uh],[vq]:[uh]};var bH="table",KH="view";var XH="kind";var WH="view";var s3="pageSize",JH="defaultSortField",p3="defaultSortOrder";var QH="columns";var a3="prompt";var ih="payloadRef",jH="textRef",K3="format";var X3="responseRef",wH="maxTokens";var mH="model";var VH="promptStyle";var dH="responseFormat";var jh=[Ih,N3,Qh,f3].filter((h)=>n2.includes(h)),t3={[Ih]:"●",[N3]:"◐",[Qh]:"○",[f3]:"⊘"},yH=(h,H)=>hH?1:0;class n3{view;byId=new Map;kids=new Map;objects=[];templates=[];others=[];requirements=[];reqById=new Map;topRequirements=[];packages;topOf=new Map;constructor(h){this.view=h;for(let H of h.nodes){let q=this.file(H,H.package,void 0);this.topOf.set(H.id,H);for(let $ of H.memberGroups)for(let Z of $.members)this.fileMember(Z,H.package,q.id);if(H.type===rh)this.objects.push(q);else if(H.type===H3)this.templates.push(q);else if(H.type!==bh)this.others.push(q)}for(let H of this.kids.values())H.sort((q,$)=>q.order-$.order||yH(q.id,$.id));this.packages=h.packages.map((H)=>H.name);for(let H of h.requirements){let q=this.byId.get(H.id);if(q===void 0)continue;let $=H.parent!==null?this.reqById.get(H.parent.id):void 0,Z={node:q,req:H,...$!==void 0?{parent:$}:{},children:[],...H.level!==null?{level:H.level}:{},status:H.status,kind:H.subType};if(this.requirements.push(Z),this.reqById.set(H.id,Z),$!==void 0)$.children.push(Z);else this.topRequirements.push(Z)}}file(h,H,q){let $={};for(let K of h.attrs)$[K.name]=K.value;let Z="declaredOn"in h?h.declaredOn:null,z={id:h.id,type:h.type,subType:h.subType,name:h.name,package:H,order:h.order,...q!==void 0?{parent:q}:{},path:h.path,anchor:"anchor"in h?h.anchor:"",...h.extends!==null&&!h.extends.unresolved?{extends:h.extends.id}:{},abstract:h.abstract,isArray:"isArray"in h?h.isArray:!1,...Z!==null&&!Z.unresolved?{inheritedFrom:Z.id}:{},attrs:$,view:h};if(this.byId.set(z.id,z),q!==void 0)this.kids.set(q,[...this.kids.get(q)??[],z]);return z}fileMember(h,H,q){this.file(h,H,q);for(let $ of h.memberGroups)for(let Z of $.members)this.fileMember(Z,H,h.id)}children(h){return this.kids.get(h)??[]}ownerOf(h){let H=this.byId.get(h);while(H?.parent!==void 0)H=this.byId.get(H.parent);return H?.id??h}top(h){return this.topOf.get(h)}fields(h){return this.children(h).filter((H)=>H.type===oh)}source(h){return this.children(h).find((H)=>H.type===M2)}storage(h){let H=this.source(h);if(H===void 0)return;let q=H.attrs[KH],$=H.attrs[bH],Z=H.attrs[XH]===WH||typeof q==="string",z=typeof q==="string"?q:typeof $==="string"?$:void 0;return{kind:Z?"view":"table",...z!==void 0?{name:z}:{}}}isEntity(h){return h.type===rh&&h.subType===S3}isPrompt(h){return h.type===H3&&h.subType===a3}kindOf(h){if(h.type===H3)return h.subType===a3?"prompt":"template";if(h.type!==rh)return"other";if(h.subType===S3)return"entity";if(h.subType===f2)return"value";if(h.subType===O2)return"projection";if(h.subType===P2)return"report";return"object"}storedEntities(){return this.objects.filter((h)=>this.isEntity(h)&&!h.abstract)}claims(h){let H=this.byId.get(h)?.view;if(H===void 0)return[];return H.claims.flatMap((q)=>{let $=this.reqById.get(q.requirement.id);return $===void 0?[]:[{req:$,...q.member!==""?{member:q.member}:{}}]})}generated(h){return(this.topOf.get(h)?.files??[]).flatMap((H)=>H.paths.map((q)=>({path:q,generatedBy:H.generatedBy})))}routes(h){return this.topOf.get(h)?.routes??[]}hasRequirements(){return this.requirements.length>0}hasClaims(){return this.view.counts.claims>0}subtree(h){let H=[],q=($)=>{H.push($);for(let Z of $.children)q(Z)};return q(h),H}below(h){return this.subtree(h).slice(1)}rollup(h){let H={};for(let q of h.req.rollup)if(q.count>0)H[q.status]=q.count;return H}targetsOf(h){return h.req.targets.map((H)=>H.id)}linkTargets(h){return h.req.implementedBy.filter((H)=>H.resolves&&this.byId.has(H.target.id)).map((H)=>H.target.id)}featureOf(h){let H=new Map;for(let $ of this.claims(h)){let Z=$.req;while(Z.parent!==void 0)Z=Z.parent;if(Z.kind!==i)continue;H.set(Z,(H.get(Z)??0)+1)}let q;for(let $ of this.features()){let Z=H.get($)??0;if(Z>0&&(q===void 0||Z>(H.get(q)??0)))q=$}return q}features(){return this.topRequirements.filter((h)=>h.kind===i)}qualities(){return this.topRequirements.filter((h)=>h.kind===Jh)}claimStatus(h){let H=this.claims(h);if(H.length===0)return"unclaimed";for(let q of jh)if(H.some(($)=>$.req.status===q))return q;return"unclaimed"}modelEdges(){let h=[],H=new Set;for(let q of this.view.nodes){if(q.type===bh)continue;for(let $ of q.refs){let Z=this.ownerOf($.target.id),z=this.byId.get(Z);if(Z===q.id||z===void 0||z.type===bh)continue;let K=`${$.attr}\x00${q.id}\x00${Z}`;if(H.has(K))continue;H.add(K),h.push({kind:$.attr,from:q.id,to:Z,...$.via!==null?{via:$.via.id}:{}})}}return h.sort((q,$)=>yH(`${q.kind}\x00${q.from}\x00${q.to}`,`${$.kind}\x00${$.from}\x00${$.to}`))}slice(h){return this.view.slices.find((H)=>H.id===h)}}function X(h){return String(h??"").replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}function p(h){if(h==="")return"";return`${t3[h]??""} ${X(h)}`}function W3(h){if(h==="")return"";return`${t3[h]??""}`}function E(h){return h.level!==void 0?`L${h.level}`:'—'}var vh="gate";function J3(h){let H=h.req.diagnostics.filter((z)=>z.source===vh);if(H.length===0)return"";let q=H.some((z)=>z.severity==="error")?"error":"warn",$=H.map((z)=>z.code).join(", "),Z=H.length;return`${q==="error"?"✕":"!"} ${Z} gate ${q==="error"?Z===1?"error":"errors":Z===1?"warning":"warnings"}`}function _3(h){let H=h.node.attrs[Z3];return typeof H==="string"?`${X(H)}`:""}function Rh(h){let H=jh.reduce((Z,z)=>Z+(h[z]??0),0),q=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>`${h[Z]} ${Z}`).join(", ");if(H===0)return'
    ';let $=jh.filter((Z)=>(h[Z]??0)>0).map((Z)=>``).join("");return``}function Bq(h){return`${(Math.round(h*1e4)/100).toString()}%`}function GH(h){return`
    ${jh.map(($)=>p($)).join("")}${h?'unclaimed':""}! gate findingFill and glyph are the declared @status; outlines are meta verify findings; bars roll up what sits below. No colour here reports a test result.
    `}function U(h,H){let q=h.split("/").length-1;return"../".repeat(q)+H}var j3="index.html",mh="map.html",Vh="requirements/features.html",ch="requirements/qualities.html",w3="matrix.html",sh="trace.html",Dh="prompts.html",Fh="api.html",ph="gaps.html",Bh="model/index.html",Dq=new Set([oh,eh,F3,h3,fh,Oh,Ph]),Fq=new Set(["ERR_REQUIREMENT_BAD_LEVEL","ERR_REQUIREMENT_LEVEL_NESTING","ERR_REQUIREMENT_LINK_ABOVE_FLOOR"]),Yq="WARN_REQUIREMENT_OBJECT_UNCLAIMED",wh=(h,H)=>hH?1:0,S=(h)=>typeof h==="string"?h:void 0,r=(h)=>Array.isArray(h)?h.filter((H)=>typeof H==="string"):typeof h==="string"?[h]:[];function Mq(h){return h===""?"-root":h.split("::").join("/")}function Kh(h){let H=h.lastIndexOf("::");return H<0?h:h.slice(H+2)}class E3{ix;constructor(h){this.ix=h}objectPage(h){return h.path}packagePage(h){return`model/${Mq(h)}/index.html`}reqPage(h){return h.req.path}reqPath(h){return h.req.address}reqLabel(h){return h.req.label}pageOf(h){let H=this.ix.byId.get(h)?.path;return H===void 0||H===""?void 0:H}implLinks(h){return h.req.implementedBy.map((H)=>({ref:H.ref,resolves:H.resolves,...H.resolves&&this.ix.byId.has(H.target.id)?{target:H.target.id}:{}}))}attrValues(h,H){return h.view.attrs.find((q)=>q.name===H)?.values??[]}refLinks(h,H){return this.attrValues(h,H).flatMap((q)=>q.link!==null&&!q.link.unresolved?[q.link]:[])}refHtml(h,H,q,$){return this.attrValues(H,q).filter((Z)=>Z.link!==null).map((Z)=>this.viewLink(h,Z.link,$?.(Z.text))).join(", ")}viewLink(h,H,q){return H.unresolved?`${X(q??Kh(H.label))} (unresolved)`:this.link(h,H.id,q)}memberAnchors(h,H){return this.ix.children(h.id).filter((q)=>!H.has(q.type)&&q.anchor!=="").map((q)=>``).join("")}kindClass(h){return`k-${this.ix.kindOf(h)}`}link(h,H,q){let $=this.pageOf(H),Z=this.ix.byId.get(this.ix.ownerOf(H));if($===void 0||Z===void 0)return`${X(q??Kh(H))} (unresolved)`;let z=this.ix.reqById.get(H),K=q??(z!==void 0?this.reqLabel(z):H===Z.id?Z.name:`${Z.name}.${H.slice(Z.id.length+1)}`);return`${X(K)}`}reqLink(h,H){return`${X(this.reqLabel(H))}`}description(h){return X(S(h.attrs[Wh])??S(h.attrs[l2])??"")}topOf(h){let H=h;while(H.parent!==void 0)H=H.parent;return H}overview(h){let H=this.ix,q=j3,$=H.storedEntities(),Z=H.objects.filter((Q)=>H.isEntity(Q)&&Q.abstract===!0).length,z=H.templates.filter((Q)=>H.isPrompt(Q)),K=H.objects.filter((Q)=>H.kindOf(Q)==="value").length,b=H.objects.filter((Q)=>H.kindOf(Q)==="projection").length,J=H.objects.filter((Q)=>H.kindOf(Q)==="report").length,j=H.view.counts,W=[];if(W.push({n:`${$.length}`,l:`stored entities${Z>0?` (${Z} abstract base${Z===1?"":"s"})`:""}`,href:U(q,mh)}),W.push({n:`${z.length}`,l:`declared prompt${z.length===1?"":"s"}, ${T3(K,"payload or reply type","payload and reply types")}`,href:U(q,Dh)}),H.hasRequirements())W.push({n:`${j.requirements}`,l:`requirements: ${T3(j.functional,"feature")}, ${T3(j.architectural,"quality","qualities")}`,href:U(q,Vh)});else W.push({n:`${b+J}`,l:`read models: ${b} projection${b===1?"":"s"}, ${J} report${J===1?"":"s"}`,href:U(q,Bh)});if(j.coverageMeasured&&j.entitiesTotal>0)W.push({n:`${j.entitiesClaimed}/${j.entitiesTotal}`,l:"entities claimed by a requirement (gate)",href:U(q,ph)});else W.push({n:`${H.packages.length}`,l:`package${H.packages.length===1?"":"s"} in the model`,href:U(q,Bh)});if(H.view.sources.routes){let Q=H.objects.filter((D)=>H.routes(D.id).length>0).length;W.push({n:`${Q}`,l:"objects with mounted REST routes",href:U(q,Fh)})}else W.push({n:"—",l:"REST routes: none recorded by this run",href:U(q,Fh)});W.push({n:H.view.sources.files?`${j.files}`:"—",l:H.view.sources.files?"generated files traced to a node":"generated files: no manifest read",href:U(q,sh)});let d=["the effective model"];if(H.view.sources.requirements)d.push("the requirement gate's ledger");if(H.view.sources.files)d.push("the generation manifest");return{heading:X(`What ${h} does`),sourcesLine:X(lq(d)),tiles:W.map((Q)=>({n:X(Q.n),l:X(Q.l),href:X(Q.href)})),hasRequirements:H.hasRequirements(),featureCards:H.features().map((Q)=>this.capCard(q,Q)),qualityCards:H.qualities().map((Q)=>this.capCard(q,Q)),hasFeatures:H.features().length>0,hasQualities:H.qualities().length>0,packageCards:H.packages.map((Q)=>this.packageCard(q,Q))}}capCard(h,H){let q=this.ix.below(H).length,$=this.ix.targetsOf(H).length;return{levelHtml:E(H),linkHtml:this.reqLink(h,H),statusHtml:p(H.status),verdictHtml:J3(H),statement:X(S(H.node.attrs[Ch])??""),barHtml:Rh(this.ix.rollup(H)),countsLine:X(`${q} requirement${q===1?"":"s"} below · ${$} model node${$===1?"":"s"} claimed`),children:H.children.map((Z)=>({levelHtml:E(Z),linkHtml:this.reqLink(h,Z),glyphHtml:W3(Z.status)})),hasChildren:H.children.length>0}}packageCard(h,H){let q=[...this.ix.objects,...this.ix.templates,...this.ix.others].filter((b)=>b.package===H),$=new Map;for(let b of q)$.set(this.ix.kindOf(b),($.get(this.ix.kindOf(b))??0)+1);let z=["entity","value","projection","report","prompt","template","object","other"].filter((b)=>$.has(b)).map((b)=>`● ${$.get(b)} ${kq(b,$.get(b)??0)}`).join(" · "),K=q.slice(0,12);return{name:X(H===""?"(no package)":H),href:X(U(h,this.packagePage(H))),kindLineHtml:z,membersHtml:K.map((b)=>this.link(h,b.id)).join(", ")+(q.length>K.length?` +${q.length-K.length}`:"")}}map(){let h=this.ix,H=[],q=[{value:"",label:"Whole model"}];if(h.templates.some(($)=>h.isPrompt($)))q.push({value:"@prompts",label:"Prompts and their payloads"});H.push({label:"Model",options:q});for(let $ of h.topRequirements){let Z=[];for(let z of[$,...$.children]){let K=h.slice(`requirement:${z.node.id}`);if(K===void 0)continue;let b=z===$?"":" ";Z.push({value:K.id,label:`${b}${z.level!==void 0?`L${z.level} `:""}${this.reqLabel(z)} (${h.targetsOf(z).length})`})}if(Z.length>0)H.push({label:`${$.kind===i?"Feature":"Quality"}: ${this.reqLabel($)}`,options:Z})}if(h.packages.length>1)H.push({label:"Package",options:h.packages.map(($)=>({value:`package:${$}`,label:$===""?"(no package)":$}))});return{sliceGroups:H.map(($)=>({label:X($.label),options:$.options.map((Z)=>({value:X(Z.value),label:X(Z.label)}))})),hasRequirements:h.hasRequirements()}}object(h){let H=this.ix,q=this.objectPage(h),$=H.kindOf(h),Z=H.claims(h.id),z=H.storage(h.id),K=z===void 0?$==="value"?"value object: no storage":"no source":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`,b=H.fields(h.id).map((w)=>this.fieldRow(q,h,w)),J=b.some((w)=>w.column!==""),j=H.children(h.id).filter((w)=>w.type===eh||w.type===F3||w.type===h3).map((w)=>this.keyRow(q,w)),W=H.children(h.id).filter((w)=>w.type===fh||w.type===Oh||w.type===Ph).map((w)=>this.reportingRow(q,w)),d=H.children(h.id).filter((w)=>w.type===Y2).map((w)=>this.layoutRow(w)),Q=this.unclaimedEntity(h),D=this.whyRows(q,h),k=H.top(h.id)?.referencedBy??[],u=(w)=>w===ih||w===X3,G=[...new Set(k.filter((w)=>u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),F=[...new Set(k.filter((w)=>!u(w.attr)).map((w)=>w.from.id))].sort(wh).map((w)=>this.link(q,w)),B=h.extends!==void 0?this.link(q,h.extends):"";return{id:X(h.id),name:X(h.name),kindLabel:X(`object.${h.subType}`),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › object.${X(h.subType)}${this.memberAnchors(h,Dq)}`,isAbstract:h.abstract===!0,isUnclaimed:Q,isReadOnly:z?.kind==="view",kindBadge:X($),description:this.description(h),storageLine:X(K),extendsHtml:B,whyRows:D,hasWhy:D.length>0,whyEmptyHtml:this.whyEmpty(h),fields:b,hasFields:b.length>0,hasColumn:J,showClaims:this.ix.hasRequirements(),keys:j,hasKeys:j.length>0,reporting:W,hasReporting:W.length>0,layouts:d,hasLayouts:d.length>0,projection:$==="projection"?this.projectionBlock(q,h):void 0,report:$==="report"?this.reportBlock(q,h):void 0,routes:H.routes(h.id).map((w)=>({method:X(w.method),path:X(w.path)})),hasRoutes:H.routes(h.id).length>0,routesNote:!H.view.sources.routes?"This run recorded no routes.":"No generated routes are mounted for it.",usedByHtml:G.join(", "),referencedByHtml:F.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",claimCount:Z.length}}unclaimedEntity(h){let H=this.ix;if(!H.isEntity(h)||h.abstract===!0)return!1;return H.top(h.id)?.unclaimed===!0}whyRows(h,H){let q=[...this.ix.claims(H.id)].sort((z,K)=>this.ix.requirements.indexOf(z.req)-this.ix.requirements.indexOf(K.req)),$=[],Z;for(let z of q){let K=this.topOf(z.req);$.push({capabilityHtml:K===Z?"":this.reqLink(h,K),reqHtml:this.reqLink(h,z.req),statement:X(S(z.req.node.attrs[Ch])??""),levelHtml:E(z.req),statusHtml:p(z.req.status),onHtml:z.member!==void 0?`${X(z.member)}`:'whole object'}),Z=K}return $}whyEmpty(h){if(!this.ix.hasRequirements())return`This model declares no requirements, so nothing states why ${X(h.name)} exists.`;if(this.unclaimedEntity(h))return`No requirement claims ${X(h.name)}. The gate reports this as ${Yq}.`;return`No requirement claims ${X(h.name)}.`}fieldRow(h,H,q){let $=this.refHtml(h,q,q3),Z=q.subType===Ah?r(q.attrs[k3]):[],z=[];if(q.attrs[Y3]===!0)z.push("required");if(q.attrs[x2]===!0)z.push("filterable");if(q.attrs[N2]===!0)z.push("sortable");if(q.attrs[l3]!==void 0)z.push(`max ${String(q.attrs[l3])}`);if(q.attrs[M3]!==void 0)z.push(`default ${Xh(q.attrs[M3])}`);if(this.ix.children(q.id).some((b)=>b.type===D3))z.push("derived");let K=this.ix.claims(H.id).filter((b)=>b.member!==void 0&&b.member.split(".")[0]===q.name);return{anchor:X(q.anchor),name:X(q.name),inheritedHtml:q.inheritedFrom!==void 0?`inherited`:"",type:X(`${q.subType}${q.isArray===!0?"[]":""}`),refHtml:$!==""?` → ${$}`:"",valuesHtml:Z.length>0?`
    ${Z.map(X).join(" | ")}
    `:"",column:X(S(q.attrs[zH])??""),flagsHtml:z.map((b)=>`${X(b)}`).join(""),claimsHtml:K.map((b)=>`${W3(b.req.status)} ${X(this.reqLabel(b.req))}`).join("
    ")}}keyRow(h,H){let q=r(H.attrs[U3]),$=this.refHtml(h,H,g3)||this.refHtml(h,H,s2),Z=S(H.attrs[p2]),z=S(H.attrs[c2]),K=H.type===h3?[z,Z!==void 0?`through ${Kh(Z)}`:void 0].filter((b)=>b!==void 0).join(", "):`(${q.join(", ")})`;return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),inheritedHtml:H.inheritedFrom!==void 0?'inherited':"",shape:X(K),targetHtml:$!==""?`→ ${$}`:""}}reportingRow(h,H){let q=H.attrs,$=[],Z=S(q[HH]),z=this.refHtml(h,H,o2,Kh);if(Z!==void 0)$.push(`${X(Z)}(${z})`);else if(z!=="")$.push(`of ${z}`);let K=S(q[$H]),b=S(q[ZH]);if(K!==void 0&&b!==void 0)$.push(`${X(K)} ÷ ${X(b)}`);let J=S(q[e2]);if(J!==void 0)$.push(`via ${X(Kh(J))}`);let j=r(q[hH]);if(j.length>0)$.push(`grains ${j.map((d)=>`${X(d)}`).join(" ")}`);let W=S(q[qH]);if(W!==void 0)$.push(`segment ${X(W)}`);if(q[R3]!==void 0)$.push(`filter ${X(Xh(q[R3]))}`);if(q[c3]!==void 0)$.push(`default ${X(Xh(q[c3]))}`);return{anchor:X(H.anchor),kind:X(`${H.type}.${H.subType}`),name:X(H.name),definitionHtml:$.join(" · ")}}layoutRow(h){let H=[],q=r(h.attrs[QH]);if(q.length>0)H.push(`columns ${q.map((Z)=>`${X(Z)}`).join(", ")}`);let $=S(h.attrs[JH]);if($!==void 0)H.push(`sorted by ${X($)}${S(h.attrs[p3])!==void 0?` ${X(S(h.attrs[p3]))}`:""}`);if(typeof h.attrs[s3]==="number")H.push(`${h.attrs[s3]} per page`);return{kind:X(`${h.type}.${h.subType}`),name:X(h.name),detailHtml:H.join(", ")}}projectionBlock(h,H){let q=this.ix,$=[],Z=new Set;for(let z of q.fields(H.id)){if(z.extends!==void 0)Z.add(q.ownerOf(z.extends));for(let K of q.children(z.id).filter((b)=>b.type===D3)){let b=this.originDefinition(h,K);for(let J of this.refLinks(K,z3))Z.add(q.ownerOf(J.id));$.push({field:X(z.name),origin:X(`origin.${K.subType}`),definitionHtml:b})}}return{basesHtml:[...Z].filter((z)=>z!==H.id).sort(wh).map((z)=>this.link(h,z)).join(", "),origins:$,hasOrigins:$.length>0}}originDefinition(h,H){let q=H.attrs,$=(K)=>this.attrValues(H,K).map((b)=>b.link!==null&&!b.link.unresolved?this.link(h,b.link.id,Kh(b.text)):`${X(Kh(b.text))}`).join(", "),Z=[],z=S(q[T2]);if(z!==void 0)Z.push(`${X(z)}(${$(b3)})`);else if(q[b3]!==void 0)Z.push(`of ${$(b3)}`);if(q[z3]!==void 0)Z.push(`from ${$(z3)}`);if(q[A3]!==void 0)Z.push(`via ${X(Kh(String(q[A3])))}`);if(q[i3]!==void 0)Z.push(`${X(Xh(q[i3]))}`);if(q[I3]!==void 0)Z.push(`filter ${X(Xh(q[I3]))}`);return Z.join(" · ")}reportBlock(h,H){let q=H.attrs,$=this.refLinks(H,$3)[0]?.id??S(q[$3]),Z=(K,b)=>{let j=[$!==void 0?`${$}.${K}`:void 0,`${H.package===""?"":`${H.package}::`}${K}`].filter((W)=>W!==void 0).find((W)=>this.ix.byId.get(W)?.type===b||this.ix.byId.has(W)&&K.includes("."));return j!==void 0?this.link(h,j,K):`${X(K)}`},z=S(q[R2]);return{fromHtml:this.refHtml(h,H,$3),spineHtml:z!==void 0?`${X(z)}`:"",dimensionsHtml:r(q[A2]).map((K)=>Z(K,fh)).join(", "),measuresHtml:r(q[I2]).map((K)=>Z(K,Oh)).join(", "),segmentHtml:r(q[i2]).map((K)=>Z(K,Ph)).join(", "),filterHtml:q[L3]!==void 0?`${X(Xh(q[L3]))}`:""}}generatedGroups(h){let H=new Map;for(let q of this.ix.generated(h))H.set(q.generatedBy,[...H.get(q.generatedBy)??[],q.path]);return[...H.keys()].sort(wh).map((q)=>({generator:X(q),files:(H.get(q)??[]).map(($)=>X($))}))}node(h){let H=this.ix,q=this.objectPage(h),$=`${h.type}.${h.subType}`,Z=this.whyRows(q,h),z=this.attrRows(q,h),K=[...(H.top(h.id)?.referencedBy??[]).map((J)=>J.from.id),...H.claims(h.id).map((J)=>this.topOf(J.req).node.id)],b=[...new Set(K.filter((J)=>J!==h.id))].sort(wh).map((J)=>this.link(q,J));return{id:X(h.id),name:X(h.name),kindLabel:X($),crumbsHtml:`Model › ${X(h.package===""?"(no package)":h.package)} › ${X($)}`,isAbstract:h.abstract===!0,description:this.description(h),extendsHtml:h.extends!==void 0?this.link(q,h.extends):"",attrs:z,hasAttrs:z.length>0,members:H.children(h.id).map((J)=>({anchor:X(J.anchor),kind:X(`${J.type}.${J.subType}`),nameHtml:H.reqById.has(J.id)?this.link(q,J.id):X(J.name===""?`#${J.order}`:J.name),attrsHtml:this.attrRows(q,J).map((j)=>`@${j.name} ${j.valueHtml}`).join("
    "),below:H.children(J.id).length})),hasMembers:H.children(h.id).length>0,whyRows:Z,hasWhy:Z.length>0,whyEmptyHtml:this.whyEmpty(h),referencedByHtml:b.join(", "),generated:this.generatedGroups(h.id),hasGenerated:H.generated(h.id).length>0,generatedNote:!H.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it."}}attrRows(h,H){return H.view.attrs.map((q)=>{let $=q.values.filter((Z)=>Z.link!==null&&!Z.link.unresolved);return{name:X(q.name),valueHtml:$.length>0&&$.length===q.values.length?$.map((Z)=>this.link(h,Z.link.id)).join(", "):`${X(Xh(q.value))}`}})}prompt(h,H){let q=this.ix,$=this.objectPage(h),Z=this.refLinks(h,ih)[0]?.id,z=this.refLinks(h,X3)[0]?.id,K=H!==void 0?uH(H):void 0,b=Z!==void 0?q.byId.get(Z):void 0,J=z!==void 0?q.byId.get(z):void 0,j=b!==void 0?q.fields(b.id).map((G)=>({name:X(G.name),requiredHtml:G.attrs[Y3]===!0?'required':"",type:X(`${G.subType}${G.isArray===!0?"[]":""}`),refHtml:this.refHtml($,G,q3)!==""?` → ${this.refHtml($,G,q3)}`:"",usedHtml:K===void 0?'text not read':K.has(G.name)?"yes":'no'})):[],W=J!==void 0?q.fields(J.id).map((G)=>({name:X(G.name),type:X(`${G.subType}${G.isArray===!0?"[]":""}`),valuesHtml:G.subType===Ah?`
    ${r(G.attrs[k3]).map(X).join(" | ")}
    `:""})):[],d=S(h.attrs[jH])??"",Q=H!==void 0?H.replace(/\n$/,"").split(` +`).length:0,D=[K3,dH,VH,mH,wH].filter((G)=>h.attrs[G]!==void 0).map((G)=>`@${X(G)} ${X(Xh(h.attrs[G]))}`).join(""),k=q.claims(h.id),u=this.whyRows($,h);return{name:X(h.name),kindLabel:X(`template.${h.subType}`),crumbsHtml:`Prompts › ${X(h.package===""?"(no package)":h.package)} › template.${X(h.subType)}${this.memberAnchors(h,new Set)}`,isUnclaimed:q.hasClaims()&&k.length===0,description:this.description(h),attrsHtml:D,payloadHtml:b!==void 0?this.link($,b.id):"none",payloadRows:j,hasPayload:b!==void 0,replyHtml:J!==void 0?this.link($,J.id):"none",replyRows:W,hasReply:J!==void 0,textRef:X(d),textMeta:X(H!==void 0?`${d}.mustache · ${Q} line${Q===1?"":"s"}${S(h.attrs[K3])!==void 0?` · ${S(h.attrs[K3])}`:""}`:`${d}.mustache`),textHtml:H!==void 0?gq(H):"",hasText:H!==void 0,generated:this.generatedGroups(h.id),hasGenerated:q.generated(h.id).length>0,generatedNote:!q.view.sources.files?"No generation manifest was read.":"Nothing generated is traced to it.",whyRows:u,hasWhy:u.length>0,whyEmptyHtml:q.hasRequirements()?`No requirement claims ${X(h.name)}. The gate counts entity coverage only, so this shows here and on the gaps page, not in meta verify.`:"This model declares no requirements."}}prompts(){let h=Dh,H=this.ix.templates.map((q)=>{let $=this.refHtml(h,q,ih),Z=this.refHtml(h,q,X3),z=this.ix.claims(q.id);return{linkHtml:this.link(h,q.id),kind:X(`template.${q.subType}`),description:this.description(q),payloadHtml:$!==""?$:'none',replyHtml:Z!==""?Z:'none (outbound only)',claimsHtml:z.length>0?z.map((K)=>p(K.req.status)).join(""):this.ix.hasClaims()?'unclaimed':'—'}});return{rows:H,hasRows:H.length>0}}requirements(h,H){let q=this.ix.topRequirements.filter((Z)=>Z.kind===h),$=q.length>0?`
      ${q.map((Z)=>this.treeNode(H,Z)).join("")}
    `:"";return{isFeatures:h===i,featuresHref:X(U(H,Vh)),qualitiesHref:X(U(H,ch)),featureCount:this.ix.requirements.filter((Z)=>Z.kind===i).length,qualityCount:this.ix.requirements.filter((Z)=>Z.kind===Jh).length,treeHtml:$,hasTree:q.length>0,emptyNote:h===i?"No requirement.functional is declared.":"No requirement.architectural is declared."}}treeNode(h,H){let q=this.implLinks(H).map((z)=>{if(z.target!==void 0)return`${this.link(h,z.target,z.ref)}`;return H.status===Qh?`${X(z.ref)} (not yet)`:`${X(z.ref)} (dangling)`}),$=H.children.length>0?`${Rh(this.ix.rollup(H))}`:"";return`
  • ${`
    ${E(H)}${this.reqLink(h,H)} ${p(H.status)}${_3(H)}${J3(H)}${$}${q.join("")}
    ${X(S(H.node.attrs[Ch])??"")}
    `}${H.children.length>0?`
      ${H.children.map((z)=>this.treeNode(h,z)).join("")}
    `:""}
  • `}requirement(h){let H=this.ix,q=this.reqPage(h),$=[];for(let w=h;w!==void 0;w=w.parent)$.unshift(w);let Z=h.kind===i?{href:Vh,label:"Features"}:{href:ch,label:"Qualities"},z=h.req.inLedger,K=h.req.diagnostics,b=this.implLinks(h),J=b.map((w)=>{let v=w.target!==void 0?H.byId.get(w.target):void 0;return{refHtml:v!==void 0?this.link(q,v.id,w.ref):`${X(w.ref)}`,kind:X(v!==void 0?`${v.type}.${v.subType}`:""),resolvesHtml:w.resolves?'resolves':h.status===Qh?'not yet (allowed on planned)':'dangling'}}),j=K.filter((w)=>w.source===vh),W=K.filter((w)=>w.source!==vh),d=K.some((w)=>Fq.has(w.code)),Q=h.kind===i&&(h.level??0)>=P3,D=b.length===0?"none":b.every((w)=>w.resolves)?"yes":"no",k=H.below(h),u=H.slice(`requirement:${h.node.id}`),G=h;while(G!==void 0&&(G.level??0)>O3)G=G.parent;let F=r(h.node.attrs[a2]),B=this.description(h.node);return{crumbsHtml:`${Z.label} › ${$.map((w)=>w===h?X(this.reqLabel(w)):this.reqLink(q,w)).join(" › ")}`,levelHtml:E(h),name:X(this.reqLabel(h)),statusHtml:p(h.status),dispositionHtml:_3(h),verdictHtml:J3(h),address:X(`${h.req.qualifiedPath} · requirement.${h.kind}`),statement:X(S(h.node.attrs[Ch])??""),counterexample:X(S(h.node.attrs[t2])??""),description:B,hasDescription:B!=="",linkRows:J,hasLinks:J.length>0,linksEmpty:h.level!==void 0&&h.levelh.children.length,hasBelow:h.children.length>0,belowBarHtml:Rh(H.rollup(h)),children:h.children.map((w)=>({levelHtml:E(w),linkHtml:this.reqLink(q,w),statusHtml:p(w.status)})),sliceHref:u!==void 0?X(`${U(q,mh)}?slice=${encodeURIComponent(u.id)}`):"",traceHref:G!==void 0?X(`${U(q,sh)}?start=${encodeURIComponent(G.node.id)}`):"",proof:[{what:"Loads",verdictHtml:'yes',how:"The loader enforces the closed @status enum and the required statement and counterexample."},{what:"Links resolve",verdictHtml:D==="none"?'no links':D==="yes"?'yes':'no',how:"ERR_REQUIREMENT_DANGLING_REF fails the build on live or partial; a planned entry may point ahead."},{what:"Level rules",verdictHtml:d?'no':'yes',how:"Nesting agrees with level, and links sit only at L4 and L5."},{what:"Gate findings",verdictHtml:j.length>0?`${j.length}`:z?'none':'not read',how:j.length>0?j.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"Nothing reported for this entry.":"This build read no meta verify output."},{what:"Authoring advisories",verdictHtml:z?`${W.length}`:'not read',how:W.length>0?W.map((w)=>`${X(w.code)} ${X(w.message)}`).join("
    "):z?"None. The authoring lint never fails a build.":"This build read no meta verify output."},{what:"Test exists",verdictHtml:Q?'by generator':'not by default',how:Q?"The stock requirement-tests generator writes a test for this entry, and the codegen drift gate holds the test set to the ledger.":"The stock requirement-tests generator selects functional L4 and L5 entries only."},{what:"Test passes",verdictHtml:'not read',how:"verify never reads test results, so nothing here is coloured by one."},{what:"Status is true",verdictHtml:'unprovable',how:"No gate can prove the status. The colour is the author's claim, held to referential integrity."}].map((w)=>({what:X(w.what),verdictHtml:w.verdictHtml,howHtml:w.how})),trackedHtml:F.map((w)=>`${X(w)}`).join(" "),digest:X(h.req.digest)}}matrix(){let h=this.ix,H=w3,q=h.requirements.flatMap((b)=>this.implLinks(b).flatMap((J)=>J.target!==void 0?[h.ownerOf(J.target)]:[])),$=new Set([...h.storedEntities(),...h.templates.filter((b)=>h.isPrompt(b))].map((b)=>b.id));for(let b of q)if(h.byId.get(b)?.parent===void 0&&h.byId.get(b)?.type!==bh)$.add(b);let Z=[...$].map((b)=>h.byId.get(b)).sort((b,J)=>h.claims(J.id).length-h.claims(b.id).length||wh(b.name,J.name)||wh(b.id,J.id)),z=`${Z.map((b)=>`
    ${this.link(H,b.id)}
    `).join("")}`,K=[];for(let b of h.topRequirements){let J=h.subtree(b).filter((j)=>j.req.implementedBy.length>0);if(J.length===0)continue;K.push(`${b.kind===i?"Feature":"Quality"}: ${this.reqLink(H,b)}${Z.map(()=>'').join("")}`);for(let j of J){let W=new Set(this.implLinks(j).filter((Q)=>Q.target!==void 0).map((Q)=>h.ownerOf(Q.target))),d=this.reqPath(j).split(".").slice(1).join(".")||this.reqLabel(j);K.push(`${E(j)}${X(d)}${Z.map((Q)=>W.has(Q.id)?`${W3(j.status)}`:'').join("")}`)}}return{tableHtml:K.length>0?`${z}${K.join("")}
    `:"",hasRows:K.length>0,hasRequirements:h.hasRequirements()}}trace(){let h=this.ix.requirements.filter((q)=>q.level!==void 0&&q.level<=O3),H=h.length===0?this.ix.topRequirements:[];return{options:[...h,...H].map((q)=>({value:X(q.node.id),label:X(`${" ".repeat(Math.max(0,(q.level??1)-1))}${q.level!==void 0?`L${q.level} `:""}${this.reqLabel(q)}`)})),hasStarts:h.length+H.length>0,hasUsage:!1}}gaps(){let h=this.ix,H=ph,q=[],$=(z,K,b,J,j)=>{q.push({title:X(z),count:X(String(K)),source:X(b),isGate:b==="meta verify",whyHtml:J,bodyHtml:j})};if(h.view.sources.requirements){let z=(Q)=>[...h.requirements.flatMap((D)=>D.req.diagnostics.filter((k)=>k.source===vh===Q).map((k)=>({req:D,d:k}))),...h.view.advisories.filter((D)=>D.path===""&&D.source===vh===Q).map((D)=>({d:D}))],K=(Q,D)=>Q.length===0?'
    None.
    ':`${Q.map(({req:k,d:u})=>``).join("")}
    ${X(u.code)}${k!==void 0?this.reqLink(H,k):""}
    ${X(u.message)}
    `,b=z(!0);$("Gate findings",b.length,"meta verify","Printed by every run of the requirement gate.",K(b,(Q)=>`chip v-${Q==="error"?"error":"warn"}`));let J=z(!1);$("Authoring advisories",J.length,"authoring lint","Printed beside the gate's findings, and never able to fail a build.",K(J,()=>"chip"));let j=h.storedEntities().filter((Q)=>this.unclaimedEntity(Q));$("Entities no requirement claims",j.length,"meta verify","The gate's coverage warning. Each is a capability nobody has written down.",j.length>0?j.map((Q)=>this.link(H,Q.id)).join(", "):'
    None.
    ');let W=(Q)=>_2.includes(Q.status),d=h.requirements.filter((Q)=>W(Q)&&Q.node.attrs[Z3]===void 0&&!h.below(Q).some(W));$("Undecided gaps",h.view.counts.undecided,"meta verify","A partial or planned entry with no @disposition and no outstanding work below it: a gap nobody has ruled on. A roll-up parent is left out, since a ruling on it settles nothing. The gate counts these.",Q3(d.map((Q)=>`${E(Q)}${this.reqLink(H,Q)} ${p(Q.status)}`)))}if(h.hasRequirements()){let z=h.requirements.filter((b)=>b.status===Qh&&h.below(b).some((J)=>J.status===Ih));$("Planned, with live work below",z.length,"explorer check","L1 to L3 status is written by hand and never rolled up. Either the parent should say partial, or it is right and its children are ahead of it.",Q3(z.map((b)=>`${E(b)}${this.reqLink(H,b)} ${p(b.status)} ${Rh(h.rollup(b))}`)));let K=h.templates.filter((b)=>h.isPrompt(b)&&h.claims(b.id).length===0);$("Prompts no requirement claims",K.length,"explorer check","The gate counts entity coverage only. An L4 may claim a prompt.",K.length>0?K.map((b)=>this.link(H,b.id)).join(", "):'
    None.
    ')}$("Generated modules nothing imports","—","explorer check","Needs a scan of hand-written imports, which this build does not run.",'
    Not scanned.
    ');let Z=h.storedEntities().flatMap((z)=>{let K=new Set(h.children(z.id).filter((b)=>b.type===eh&&b.attrs[g3]!==void 0).flatMap((b)=>r(b.attrs[U3])));return h.fields(z.id).filter((b)=>/[a-z]Id$/.test(b.name)&&!K.has(b.name))});if($("Fields that look like references but are not declared",Z.length,"explorer check","A field named like a foreign key with no identity.reference: the database does not enforce it and the map draws no line. Some are deliberate.",Q3(Z.map((z)=>`${this.link(H,z.id)} ${X(z.subType)}`))),h.templates.length>0){let z=this.unusedPayload();$("Payload fields the prompt text never uses",z===void 0?"—":z.length,"explorer check","The template gate fails a variable the payload lacks; this is the other direction, payload bloat. Nested sections are not followed, so treat each as a lead.",z===void 0?'
    No prompt text was read.
    ':Q3(z.map(({p:K,f:b})=>`${this.link(H,K.id)}: ${this.link(H,b.id,b.name)}`)))}return{cards:q}}texts=new Map;unusedPayload(){let h=[],H=!1;for(let q of this.ix.templates){let $=this.texts.get(q.id),Z=this.refLinks(q,ih)[0]?.id;if($===void 0||Z===void 0)continue;H=!0;let z=uH($);for(let K of this.ix.fields(Z))if(!z.has(K.name))h.push({p:q,f:K})}return H?h:void 0}api(){let h=this.ix,H=Fh,q=h.objects.filter((Z)=>h.routes(Z.id).length>0).map((Z)=>({linkHtml:this.link(H,Z.id),kind:X(h.kindOf(Z)),isReadOnly:h.storage(Z.id)?.kind==="view",routes:h.routes(Z.id).map((z)=>({method:X(z.method),methodClass:X(z.method.toLowerCase()),path:X(z.path)}))})),$=q.reduce((Z,z)=>Z+z.routes.length,0);return{groups:q,hasGroups:q.length>0,recorded:h.view.sources.routes,summary:X(`${$} route${$===1?"":"s"} on ${q.length} object${q.length===1?"":"s"}`)}}model(){return{packageCards:this.ix.packages.map((h)=>this.packageCard(Bh,h))}}packageIndex(h){let H=this.ix,q=this.packagePage(h),$=[...H.objects,...H.templates,...H.others].filter((Z)=>Z.package===h).map((Z)=>{let z=H.storage(Z.id),K=H.claimStatus(Z.id);return{linkHtml:this.link(q,Z.id),kind:X(`${Z.type}.${Z.subType}`),abstractHtml:Z.abstract===!0?'abstract':"",storage:X(z===void 0?"":`${z.kind}${z.name!==void 0?` ${z.name}`:""}`),fieldCount:H.fields(Z.id).length,statusHtml:K==="unclaimed"?this.unclaimedEntity(Z)?'unclaimed':"":p(K),description:this.description(Z)}});return{name:X(h===""?"(no package)":h),crumbsHtml:`Model › ${X(h===""?"(no package)":h)}`,rows:$}}}function Q3(h){return h.length===0?'
    None.
    ':`
      ${h.map((H)=>`
    • ${H}
    • `).join("")}
    `}function Xh(h){return typeof h==="string"?h:JSON.stringify(h)}function lq(h){return h.length<=1?h[0]??"":`${h.slice(0,-1).join(", ")} and ${h[h.length-1]}`}function T3(h,H,q=`${H}s`){return`${h} ${h===1?H:q}`}function kq(h,H){if(H===1)return h;return h==="entity"?"entities":`${h}s`}var Uq=/\{\{\s*([#^/&{]?)\s*([A-Za-z_][\w.]*)\s*\}?\}\}/g;function uH(h){let H=new Set;for(let q of h.matchAll(Uq))if(q[1]!=="/")H.add(q[2].split(".")[0]);return H}function gq(h){let H="",q=0;for(let $ of h.matchAll(/\{\{[^}]*\}?\}\}/g))H+=X(h.slice(q,$.index)),H+=`${X($[0])}`,q=$.index+$[0].length;return H+X(h.slice(q))}var Sq=[{key:"overview",label:"Overview",href:j3},{key:"map",label:"Model map",href:mh},{key:"requirements",label:"Requirements",href:Vh},{key:"matrix",label:"Matrix",href:w3},{key:"trace",label:"Trace",href:sh},{key:"prompts",label:"Prompts",href:Dh},{key:"api",label:"API",href:Fh},{key:"gaps",label:"Gaps",href:ph}];function Lq(h){if(h===void 0)return new Map;if(h instanceof Map)return h;return new Map(Object.entries(h))}function CH(h){let H=new n3(h.view),q=new E3(H),$=Lq(h.texts);for(let[d,Q]of $)q.texts.set(d,Q);let Z=(d)=>{let Q=h.templates[d];if(Q===void 0)throw Error(`docs-site explorer: no template ${d}`);return Q},z=new Eh({card:Z("explorer-card.mustache")}),K=Z("explorer-head.mustache"),b=Z("explorer-foot.mustache"),J=GH(H.hasClaims()),j=new Map,W=(d,Q,D,k,u,G=!1)=>{if(j.has(Q))throw Error(`docs-site explorer: two pages map to ${Q}`);let F=Z(d);j.set(Q,()=>{let B=U(Q,""),w={...u(),siteTitle:X(h.title),pageTitle:X(k),stamp:X(h.stamp??""),relRoot:B,assetBase:h.assetBase,cytoscapeSrc:h.cytoscapeSrc(B),needsGraph:G,pageKey:D,nav:Sq.map((v)=>({label:v.label,href:U(Q,v.href),on:v.key===D})),legendHtml:J};return B3({template:K+F+b,payload:w,provider:z,format:"text"})})};W("explorer-overview.html.mustache",j3,"overview","Overview",()=>q.overview(h.title)),W("explorer-map.html.mustache",mh,"map","Model map",()=>q.map(),!0),W("explorer-requirements.html.mustache",Vh,"requirements","Features",()=>q.requirements(i,Vh)),W("explorer-requirements.html.mustache",ch,"requirements","Qualities",()=>q.requirements(Jh,ch)),W("explorer-matrix.html.mustache",w3,"matrix","Matrix",()=>q.matrix()),W("explorer-trace.html.mustache",sh,"trace","Trace",()=>q.trace(),!0),W("explorer-prompts.html.mustache",Dh,"prompts","Prompts",()=>q.prompts()),W("explorer-api.html.mustache",Fh,"api","API",()=>q.api()),W("explorer-gaps.html.mustache",ph,"gaps","Gaps",()=>q.gaps()),W("explorer-model.html.mustache",Bh,"map","Packages",()=>q.model());for(let d of H.packages)W("explorer-package.html.mustache",q.packagePage(d),"map",d===""?"(no package)":d,()=>q.packageIndex(d));for(let d of H.objects)W("explorer-object.html.mustache",q.objectPage(d),"map",d.name,()=>q.object(d),!0);for(let d of H.templates)W("explorer-prompt.html.mustache",q.objectPage(d),"prompts",d.name,()=>q.prompt(d,$.get(d.id)));for(let d of H.others)W("explorer-node.html.mustache",q.objectPage(d),"map",d.name,()=>q.node(d));for(let d of H.requirements)W("explorer-requirement.html.mustache",q.reqPage(d),"requirements",q.reqLabel(d),()=>q.requirement(d));return{pages:j,graphData:()=>xq(H,q)}}function xq(h,H){let q=h.features(),$=[...h.objects,...h.templates],Z=$.map((W)=>{let d=h.featureOf(W.id),Q=h.claims(W.id);return{id:W.id,name:W.name,kind:h.kindOf(W),pkg:W.package,href:H.objectPage(W),abstract:W.abstract===!0?1:0,fields:h.fields(W.id).length,claims:Q.length,status:h.claimStatus(W.id),feature:d!==void 0?q.indexOf(d):-1,quality:Q.length>0&&Q.every((D)=>D.req.kind===Jh)?1:0,unclaimed:H.unclaimedEntity(W)?1:0,api:h.routes(W.id).map((D)=>`${D.method} ${D.path}`),gen:h.generated(W.id).length,storage:h.storage(W.id)?.kind??""}}),z=new Set($.map((W)=>W.id)),K={};for(let W of h.view.slices)K[W.id]=[...new Set(W.nodes.map((d)=>h.ownerOf(d)).filter((d)=>z.has(d)))].sort();let b=h.requirements.map((W)=>({id:W.node.id,label:H.reqLabel(W),path:H.reqPath(W),level:W.level??0,status:W.status,kind:W.kind,parent:W.parent?.node.id??"",href:H.reqPage(W),targets:h.linkTargets(W).map((d)=>h.ownerOf(d)),statement:W.req.statement,rollup:h.rollup(W),claimed:h.targetsOf(W).length})),J={};for(let W of $){let d=new Map;for(let Q of h.generated(W.id))d.set(Q.generatedBy,(d.get(Q.generatedBy)??0)+1);if(d.size>0)J[W.id]=[...d.entries()].sort((Q,D)=>Q[0]D[0]?1:0)}let j=[];for(let W of $){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()});for(let Q of h.fields(W.id)){if(Q.inheritedFrom!==void 0)continue;j.push({t:`${W.name}.${Q.name}`,s:`field.${Q.subType}`,h:H.pageOf(Q.id)??H.objectPage(W),k:`${W.name}.${Q.name} ${Q.id}`.toLowerCase()})}}for(let W of h.others){let d=typeof W.attrs[Wh]==="string"?W.attrs[Wh]:"";j.push({t:W.name,s:`${W.type}.${W.subType}${W.package!==""?` · ${W.package}`:""}`,h:H.objectPage(W),k:`${W.name} ${W.id} ${d}`.toLowerCase()})}for(let W of h.requirements)j.push({t:H.reqLabel(W),s:`${W.level!==void 0?`L${W.level}`:"—"} ${W.kind}${W.status!==""?` · ${W.status}`:""} · ${H.reqPath(W)}`,h:H.reqPage(W),k:`${H.reqPath(W)} ${W.node.id} ${H.reqLabel(W)} ${W.req.statement}`.toLowerCase()});return{nodes:Z,edges:h.modelEdges().filter((W)=>z.has(W.from)&&z.has(W.to)).map((W)=>({s:W.from,t:W.to,k:W.kind,...W.via!==void 0?{v:Nq(W.via)}:{}})),slices:K,features:q.map((W)=>({id:W.node.id,label:H.reqLabel(W)})),reqs:b,generated:J,search:j,hasClaims:h.hasClaims(),requirementType:bh}}function Nq(h){let H=h.lastIndexOf(".");return H<0?h:h.slice(H+1)}function vH(h){return CH({view:h.view,title:h.title,templates:{...m3,...h.templates},texts:h.texts,...h.footer!==""&&{stamp:h.footer},assetBase:"",cytoscapeSrc:()=>""})}globalThis.MoExplorer={explorerFor:vH,templates:m3};if(typeof document<"u")fq(window);function fq(h){let $,Z="",z={path:"",search:""},K=[],b=(u)=>{let G=u.replace(/^#\/?/,""),F=new URL(G===""?"index.html":G,"http://explorer.invalid/"),B=F.pathname.slice(1);try{B=decodeURIComponent(B)}catch{}return{path:B===""?"index.html":B,search:F.search,anchor:F.hash.slice(1)}},J=(u,G,F="")=>`#/${u}${G}${F!==""?`#${F}`:""}`;h.MO_APP={href:(u)=>{let G=b(u);return J(G.path,G.search,G.anchor)},search:()=>z.search,replaceQuery:(u)=>{z={path:z.path,search:u==="?"?"":u},history.replaceState(null,"",J(z.path,z.search))},listen:(u,G)=>{document.addEventListener(u,G),K.push(()=>document.removeEventListener(u,G))},onLeave:(u)=>{K.push(u)}};let j=()=>{let u=h.MO_MODEL;if(u===void 0)return!1;return $=vH(u),h.MO_EXPLORER=$.graphData(),Z=u.stamp,!0},W=(u,G,F)=>{for(let B of Array.from(u.querySelectorAll("a[href]"))){let w=B.getAttribute("href");if(/^[a-z][a-z0-9+.-]*:/i.test(w))continue;if(w.startsWith("#")){B.setAttribute("href",J(G,F,w.slice(1)));continue}let v=new URL(w,"http://explorer.invalid/"+G);B.setAttribute("href",J(v.pathname.slice(1),v.search,v.hash.slice(1)))}},d=(u)=>{let G=b(location.hash),F=$?.pages.get(G.path);for(let l of K)l();K=[],z={path:G.path,search:G.search};let B=F!==void 0?F():`Not found

    No such page

    ${Oq(G.path)} is not a page of this model.

    Overview

    `,w=new DOMParser().parseFromString(B,"text/html");w.querySelectorAll("script").forEach((l)=>l.remove()),W(w,G.path,G.search);let v=window.scrollY;document.title=w.title;for(let l of Array.from(document.body.attributes))document.body.removeAttribute(l.name);for(let l of Array.from(w.body.attributes))document.body.setAttribute(l.name,l.value);if(document.body.replaceChildren(...Array.from(w.body.childNodes).map((l)=>document.importNode(l,!0))),F!==void 0)h.MO_THEME?.();if(u)window.scrollTo(0,v);else if(G.anchor!=="")document.getElementById(G.anchor)?.scrollIntoView();else window.scrollTo(0,0);document.documentElement.setAttribute("data-mo-route",G.path)};window.addEventListener("hashchange",()=>{let u=b(location.hash);if(u.path===z.path&&u.search===z.search){if(u.anchor!=="")document.getElementById(u.anchor)?.scrollIntoView();return}d(!1)});let Q=(u,G)=>{let F=document.createElement("script");F.src=`${u}?t=${Date.now()}`,F.onload=()=>{F.remove(),G()},F.onerror=()=>{F.remove(),G()},document.head.appendChild(F)},D=()=>{Q("explorer-stamp.js",()=>{if(h.MO_STAMP===void 0||h.MO_STAMP===Z)return void setTimeout(D,1000);let u=h.MO_STAMP;Q("explorer-model.js",()=>{if(h.MO_MODEL?.stamp===u&&j())d(!0);setTimeout(D,1000)})})},k=()=>{if(!j())document.body.innerHTML="

    No model

    explorer-model.js did not load. Run meta gen to write it beside this page.

    ";else d(!1);setTimeout(D,1000)};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function Oq(h){return h.replace(/[&<>"']/g,(H)=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[H])}})(); diff --git a/server/typescript/packages/docs-site/scripts/build-app.ts b/server/typescript/packages/docs-site/scripts/build-app.ts index 1a8eb1951c..4d82c2d4d6 100644 --- a/server/typescript/packages/docs-site/scripts/build-app.ts +++ b/server/typescript/packages/docs-site/scripts/build-app.ts @@ -17,6 +17,21 @@ const REPO = resolve(PKG, "../../../.."); const OUT = join(REPO, "explorer-app"); const RENDER_SRC = resolve(PKG, "../render/src"); +// The bundle inlines mustache.js, whose MIT licence asks for its notice in every copy. +const MUSTACHE_NOTICE = `/*! + * mustache.js, inlined in this bundle. The MIT License + * + * Copyright (c) 2009 Chris Wanstrath (Ruby) + * Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) + * Copyright (c) 2010-2015 The mustache.js community + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */`; + /** The bundle's files by path under `explorer-app/`. */ export async function buildExplorerApp(): Promise> { const templates: Record = {}; @@ -26,6 +41,7 @@ export async function buildExplorerApp(): Promise> { target: "browser", format: "iife", minify: true, + banner: MUSTACHE_NOTICE, // Bundle the workspace packages from their sources (the `bun` export condition), never from // a `dist/` that may be stale or missing. conditions: ["bun"], From 47aad49e02a759128af8be893f18fba4a73fd624 Mon Sep 17 00:00:00 2001 From: Doug Mealing Date: Fri, 27 Nov 2026 18:08:38 -0500 Subject: [PATCH 03/10] no-mistakes(review): Fix not-found Overview link; document app head limits --- docs/features/explorer-site.md | 5 ++++- explorer-app/assets/explorer-app.js | 2 +- .../MetaObjects.Codegen/ExplorerApp/assets/explorer-app.js | 2 +- .../metaobjects/explorer-app/assets/explorer-app.js | 2 +- .../documentation/explorer_app/assets/explorer-app.js | 2 +- server/typescript/packages/docs-site/README.md | 4 +++- server/typescript/packages/docs-site/app-src/main.ts | 2 +- .../typescript/packages/docs-site/app/assets/explorer-app.js | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/features/explorer-site.md b/docs/features/explorer-site.md index 02ae2a0b25..d380c6b082 100644 --- a/docs/features/explorer-site.md +++ b/docs/features/explorer-site.md @@ -172,7 +172,10 @@ copies the templates of both sites to `codegen/docs-site/templates/` (the explor (`explorer.css`, `explorer.js`). Only files that are not there yet are written (`--force` overwrites). `docsSiteFile()` renders with your copies, and a file you did not copy falls back to the packaged one. The app carries your templates in `explorer-model.js` and draws every -page with them, and writes your CSS and JS in place of its own. A project that ejected the theme before the explorer existed has only the +page with them, and writes your CSS and JS in place of its own. The app keeps only each drawn +page's title and body, so what an owned `explorer-head.mustache` adds to `` (a stylesheet, +a `