Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
feat(workflow): add constraint-driven compiler (#146)
Friend A8b2aed2a6f0c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b0a5e870..147559e4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,8 +7,12 @@ All notable changes are documented here. Format loosely follows [Keep a ChangeloDevelopment identity: `v2.16.0-dev.0`### Added-- **Optional embedded Skill update awareness.** The packaged Skill can perform a cached, notification-only stable-release check with a fixed trusted manifest URL, strict identity and response bounds, SemVer downgrade protection, per-installed-version state, two-stage visible-notice acknowledgement, and a one-second fail-silent timeout. It never downloads, installs, executes, or overwrites an update; the user remains the sole update decision owner. Release identity, final ZIP contents, stable tag/tree/archive digests, and cross-platform packaged execution are gated in tests and release automation.+- **Constraint-driven Workflow Compiler (#126).** Workflow schema v2 adds the `readable-v2` contract: columns `0..5` remain logical ranks while one measured scene owns node placement, phase/group frames, routes, semantic labels, content bounds, diagnostics, and SVG serialization. Valid schema v1 workflows stay on byte-stable `fixed-v1` geometry, `validate workflow ... --layout-json` exposes a stable author-facing compiler receipt, and `migrate workflow <source> <destination> --to-schema 2 --json` maps absolute coordinates non-destructively before writing only a fully checked destination. Adjacent-column capacity failures now report one causal diagnosis instead of cascading through short-edge, endpoint-direction, and label-overlap symptoms.- **Bounded Viewer localization.** All five renderers accept the optional `meta.locale` values `en` and `zh-CN`, localizing renderer-owned Viewer UI, accessibility copy, default legends, document titles, and language metadata without translating authored content. Omitted locale remains backward-compatible English, while unsupported authored languages retain their requested authored copy with an explicitly disclosed English Viewer fallback.+- **Optional embedded Skill update awareness.** The packaged Skill can perform a cached, notification-only stable-release check with a fixed trusted manifest URL, strict identity and response bounds, SemVer downgrade protection, per-installed-version state, two-stage visible-notice acknowledgement, and a one-second fail-silent timeout. It never downloads, installs, executes, or overwrites an update; the user remains the sole update decision owner. Release identity, final ZIP contents, stable tag/tree/archive digests, and cross-platform packaged execution are gated in tests and release automation.++### Changed+- Workflow authoring now preserves semantic edge labels and repairs measured spacing or route constraints rather than treating label deletion as a geometry workaround. Documentation also makes `--repo-root` architecture-only, defines lifecycle event/terminal column `N` as aligned with main column `N + 2`, and warns that `visual-check` after failed delivery would inspect the preserved previous artifact.### Fixed- Skill packaging now stages only tracked regular files through one symlink-safe path shared by the release ZIP and DeepSeek Harness bundle, while preserving legitimate nested runtime test directories and rejecting stale or dependency-bearing artifacts.diff --git a/archify.zip b/archify.zipindex b3ba88ff..9e48d6f1 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/SKILL.md b/archify/SKILL.mdindex 0e3810c8..b130e5cb 100644--- a/archify/SKILL.md+++ b/archify/SKILL.md@@ -17,7 +17,7 @@ Create a self-contained, interactive HTML diagram from a small typed JSON specifUse this bounded path for ordinary generation. Do not read the optional Viewer Runtime reference unless the user asks about those features.1. Choose `architecture`, `workflow`, `sequence`, `dataflow`, or `lifecycle` from the question.-2. Read one matching schema in `schemas/`, `schemas/common.schema.json`, and one matching JSON example in `examples/`. Read only those files. Fresh authorship means new stable IDs, domain wording, and layout; use the example for field shape, not facts. When real product identity matters, query `node bin/archify.mjs brands "<name>" --json`; read `references/brand-marks.md` only for an unknown brand with a user-provided URL.+2. Read one matching schema in `schemas/`, `schemas/common.schema.json`, and one matching JSON example in `examples/`. Read only those files. Fresh authorship means new stable IDs, domain wording, and layout; use the example for field shape, not facts. New workflow sources use `schema_version: 2` and its readable layout contract; keep `schema_version: 1` only when preserving an existing workflow's fixed geometry. When real product identity matters, query `node bin/archify.mjs brands "<name>" --json`; read `references/brand-marks.md` only for an unknown brand with a user-provided URL.3. Artifact first: the next tool action must write the candidate. Write the candidate before inspecting renderer internals. Do not plan exact coordinates in prose. Start with one clear main path, short side branches, sparse labels, and at most 12 primary nodes. Set `meta.quality_profile` to `"showcase"` unless the user explicitly requests a dense `standard` map. Start with automatic routes and labels. Do not add `via`, `channelX`, `channelY`, or `labelAt` before a diagnostic calls for one; apply at most one diagnosed geometry control per repair.4. Validate after every candidate edit and immediately before handoff:@@ -25,14 +25,14 @@ Use this bounded path for ordinary generation. Do not read the optional Viewer Rnode bin/archify.mjs validate <type> <candidate.json> --quality showcase --json```- A receipt with only 4 artifact checks is basic validation, never showcase acceptance. A showcase pass must report all 9 artifact checks with 0 composition errors and 0 warnings. If the candidate omits or misspells the exact `meta.quality_profile` field, fix it before geometry. A passing final validation freezes the candidate: never edit it afterward.+ A receipt with only 4 artifact checks is basic validation, never showcase acceptance. A showcase pass must report all 9 artifact checks with 0 composition errors and 0 warnings. If the candidate omits or misspells the exact `meta.quality_profile` field, fix it before geometry. For a workflow v2 geometry diagnosis, run `node bin/archify.mjs validate workflow <candidate.json> --layout-json` and use the stable compiler receipt; solver internals are not authoring controls. A passing final validation freezes the candidate: never edit it afterward.5. For a delivered HTML, `deliver` is the final acceptance command:```bashnode bin/archify.mjs deliver <type> <candidate.json> <output.html> --quality showcase --json```- A non-zero exit can never be described as success. If validation fails, change only the diagnosed `subject`, verify `evidence`, choose from `supportedFixes`, and rerun. Continue focused correction while the objective error count reaches a new minimum. If two consecutive rounds do not improve that best count, stop and report the unresolved diagnostics truthfully.+ A non-zero exit can never be described as success. A failed delivery preserves any previous output, so do not run `visual-check` on that path: it would inspect the stale last-good artifact, not the failed candidate. If validation fails, change only the diagnosed `subject`, verify `evidence`, choose from `supportedFixes`, and rerun. Continue focused correction while the objective error count reaches a new minimum. If two consecutive rounds do not improve that best count, stop and report the unresolved diagnostics truthfully.## Update awareness@@ -45,7 +45,12 @@ The notice is information, not permission. Keep the installed version unchanged;Do not read `renderers/shared/geometry.mjs`, renderer source, validator source, tests, or benchmarks before the first candidate. Inspect implementation only for an unsupported internal diagnostic or after two focused repairs fail.-Lifecycle note: phase columns `0..4` occupy the main rail; event/outcome columns `0..2` align beneath later phases. A recoverable state uses `type: "failure"` plus a real transition back to the active state.+Workflow note: use schema v2 for new workflows; preserve schema v1 when an+existing source needs fixed legacy geometry. Keep semantic edge labels and act+on the compiler diagnostic. The canonical layout, pin, migration, and receipt+contract is in [`renderers/workflow/README.md`](renderers/workflow/README.md#layout-contracts).++Lifecycle note: phase columns `0..4` occupy the main rail; event/terminal column `N` in `0..2` aligns exactly beneath main column `N + 2`. A recoverable state uses `type: "failure"` plus a real transition back to the active state.## Type router@@ -79,9 +84,9 @@ Read Mermaid for topology and meaning, then author fresh Archify JSON; do not me- Brand identity is optional and explicit. Put a canonical built-in ID in `brand` when the node names that real product. If no preset matches and the user supplied the official HTTP(S) URL, first run `node bin/archify.mjs brands capture "<url>" --json`, then author the returned digest-pinned `brand` object. Render and validate never perform an unpinned capture. Otherwise omit `brand`. Never infer a brand from a vague role such as "database", and never let a badge replace the semantic `type`, label, or relationship facts.- For sequence diagrams, omit `meta.column_fit` for the stable `fixed` layout. Set it to `"spread"` when a wide viewBox would otherwise leave unused horizontal space or when meaningful participant labels do not fit the fixed boxes; do not shorten semantic labels before trying `spread`.- Component types are `frontend`, `backend`, `database`, `cloud`, `security`, `messagebus`, and `external`; variants are `default`, `emphasis`, `security`, and `dashed`.-- Relationship labels are semantic data. When one collides, move the label, adjust the route or spacing, then shorten the wording while preserving meaning. Only delete a label when both endpoints fully imply the relationship and it contains no protocol, action, direction, synchronous/asynchronous behavior, or cross-boundary mechanism; explain why the deleted label is redundant. Never delete a meaningful label merely to pass `showcase`.+- Relationship labels are semantic data. When one collides, move the label, adjust the route or spacing, then shorten the wording while preserving meaning. Omit only wording that is already fully implied by both endpoints and contains no protocol, action, direction, synchronous/asynchronous behavior, or cross-boundary mechanism. Preserve every meaningful label; deleting it is not a geometry repair. If a relationship starts unlabeled because its endpoints fully imply it, explain why the wording is redundant; this is a semantic authoring choice, not a geometry repair.- Omit `meta.engineering_profile` by default. Region, cluster, and security boundary wording do not by themselves enable it. Enable `deployment-ownership` only when the user explicitly asks for a production deployment topology, ownership handoff, or fail-closed deployment review and the source facts are known. Once enabled, must not remove the engineering profile merely to pass validation; repair the facts or report the diagnostics truthfully.-- Spacing means clear gap, not center distance. For a relationship label, clear gap must exceed its measured mask width; use the label-preserving repair order before considering deletion.+- Spacing means clear gap, not center distance. For a relationship label, clear gap must exceed its measured mask width; follow the label-preserving repair order.- Automatic routes own their endpoint sides. A side is a direction contract: the first and final segment must leave/enter perpendicular to that side.- Automatic Port Spread is a default renderer behavior for architecture, workflow, data-flow, and lifecycle. It skips single relationships and explicit `via`, `channelX`, `channelY`, `labelAt`, or non-`auto` routes. Near parallel ports use an outside bridge so automatic routing cannot create a sub-8px segment or sub-16px interior turn. Architecture separately keeps unobstructed facing automatic ports (`left`/`right` or `top`/`bottom`) on one shared axis when their offset is under 16px and both ports retain corner clearance. If exactly one endpoint was spread, only the unshared endpoint may move onto that axis; if both endpoints were spread, keep the outside bridge so competing ports remain distinct.- Never accept an edge crossing an unrelated opaque node, an ambiguous shared corridor, or a relationship label masking another route.diff --git a/archify/bin/archify.mjs b/archify/bin/archify.mjsindex 3bf02a7e..5fb2cbb9 100755--- a/archify/bin/archify.mjs+++ b/archify/bin/archify.mjs@@ -14,11 +14,12 @@ const TYPES = new Set(['architecture', 'workflow', 'sequence', 'dataflow', 'lifefunction usage() {return `Usage:- archify render <type> <input.json> [output.html] [--quality standard|showcase] [--repo-root path]+ archify render <type> <input.json> [output.html] [--quality standard|showcase] [--repo-root path (architecture only)]archify compare architecture <base.json> <head.json> [output.html] [--receipt path] [--json] [--quality standard|showcase] [--repo-root path]- archify deliver <type> <input.json> [output.html] [--json] [--open] [--quality standard|showcase] [--repo-root path]- archify preview <type> <input.json> [output.html] [--no-open] [--quality standard|showcase] [--repo-root path]- archify validate <type> <input.json> [--json] [--layout-json] [--quality standard|showcase] [--repo-root path]+ archify deliver <type> <input.json> [output.html] [--json] [--open] [--quality standard|showcase] [--repo-root path (architecture only)]+ archify preview <type> <input.json> [output.html] [--no-open] [--quality standard|showcase] [--repo-root path (architecture only)]+ archify validate <type> <input.json> [--json] [--layout-json] [--quality standard|showcase] [--repo-root path (architecture only)]+ archify migrate workflow <old.json> <new.json> --to-schema 2 [--json]archify inspect <type> <input.json>archify check <output.html>archify visual-check <output.html> [--json]@@ -1475,29 +1476,372 @@ function commandDemo(args) {console.log(' archify render architecture <input.json> <output.html>');}+function migrationPathDiagnostics(error, sourcePath, destinationPath) {+ if (Array.isArray(error?.archifyDiagnostics) && error.archifyDiagnostics.length) {+ return error.archifyDiagnostics.map((entry) => ({+ ...entry,+ subject: { ...(entry.subject || {}) },+ evidence: { ...(entry.evidence || {}) },+ supportedFixes: [...(entry.supportedFixes || [])],+ }));+ }+ return [diagnostic({+ code: 'migration/path-preflight',+ message: 'Could not verify that the workflow migration paths are distinct.',+ subject: { source: sourcePath, destination: destinationPath },+ evidence: {+ ...(error?.code ? { systemCode: error.code } : {}),+ reason: error?.message || String(error),+ },+ supportedFixes: ['remove unsafe path aliases or choose a different destination path'],+ })];+}++function migrationReport({+ ok,+ sourcePath,+ destinationPath,+ sourceBytes,+ destinationBytes,+ fromSchemaVersion,+ preExistingDiagnostics = [],+ migrationDiagnostics = [],+ newSchemaDiagnostics = [],+ changedCoordinates = [],+ oldRequiredViewBox = null,+ newRequiredViewBox = null,+}) {+ const report = {+ ok,+ command: 'migrate',+ type: 'workflow',+ source: {+ path: sourcePath,+ ...(sourceBytes ? {+ sha256: createHash('sha256').update(sourceBytes).digest('hex'),+ bytes: sourceBytes.length,+ } : {}),+ },+ destination: {+ path: destinationPath,+ ...(destinationBytes ? {+ sha256: createHash('sha256').update(destinationBytes).digest('hex'),+ bytes: destinationBytes.length,+ } : {}),+ },+ fromSchemaVersion: fromSchemaVersion ?? null,+ toSchemaVersion: 2,+ preExistingDiagnostics,+ migrationDiagnostics,+ newSchemaDiagnostics,+ changedCoordinates,+ oldRequiredViewBox,+ newRequiredViewBox,+ };+ if (!ok) {+ report.diagnostics = [+ ...migrationDiagnostics,+ ...newSchemaDiagnostics,+ ...preExistingDiagnostics,+ ];+ if (!report.diagnostics.length) {+ report.diagnostics.push(diagnostic({+ code: 'migration/internal',+ message: 'Workflow migration failed without a classified diagnostic.',+ }));+ }+ report.error = report.diagnostics[0].message;+ }+ return report;+}++function extractMigrationOptions(args) {+ const positional = [];+ let json = false;+ let toSchema;+ for (let index = 0; index < args.length; index += 1) {+ const arg = args[index];+ if (arg === '--json') {+ json = true;+ continue;+ }+ if (arg === '--to-schema') {+ toSchema = args[index + 1];+ if (!toSchema || toSchema.startsWith('--')) fail('--to-schema requires a schema version.');+ index += 1;+ continue;+ }+ if (arg.startsWith('--to-schema=')) {+ toSchema = arg.slice('--to-schema='.length);+ if (!toSchema) fail('--to-schema requires a schema version.');+ continue;+ }+ if (arg.startsWith('--')) fail(`Unknown migrate option "${arg}".`);+ positional.push(arg);+ }+ return { positional, json, toSchema };+}++async function commandMigrate(args) {+ const options = extractMigrationOptions(args);+ const [type, sourceArgument, destinationArgument] = options.positional;+ if (+ type !== 'workflow'+ || !sourceArgument+ || !destinationArgument+ || options.positional.length !== 3+ || options.toSchema !== '2'+ ) {+ fail('Usage: archify migrate workflow <old.json> <new.json> --to-schema 2 [--json]');+ }++ const sourcePath = path.resolve(sourceArgument);+ const destinationPath = path.resolve(destinationArgument);+ let sourceBytes;+ let sourceDocument;+ const reportMigrationFailure = ({ status = 1, ...details }) => {+ const report = migrationReport({+ ...details,+ ok: false,+ sourcePath,+ destinationPath,+ sourceBytes,+ fromSchemaVersion: sourceDocument?.schema_version,+ });+ if (options.json) console.log(JSON.stringify(report, null, 2));+ else console.error(formatDiagnostics(report.error, report.diagnostics));+ process.exitCode = status;+ };+ try {+ sourceBytes = fs.readFileSync(sourcePath);+ sourceDocument = JSON.parse(sourceBytes.toString('utf8'));+ } catch (error) {+ reportMigrationFailure({+ preExistingDiagnostics: [inputDiagnostic(error, sourcePath)],+ });+ return;+ }+ // Unlike render/validate, migrate has no --quality override. Pin every stage+ // to the document's durable policy and scrub any ambient profile from the+ // staged renderer by passing this value explicitly.+ const activeQualityProfile = sourceDocument?.meta?.quality_profile || 'standard';++ const { pathsAlias } = await import('../renderers/shared/output-path.mjs');+ let sourceDestinationAlias;+ try {+ sourceDestinationAlias = pathsAlias(sourcePath, destinationPath);+ } catch (error) {+ reportMigrationFailure({+ migrationDiagnostics: migrationPathDiagnostics(error, sourcePath, destinationPath),+ });+ return;+ }+ if (sourceDestinationAlias) {+ reportMigrationFailure({+ migrationDiagnostics: [diagnostic({+ code: 'migration/source-destination',+ message: 'Workflow migration source and destination must be different files.',+ subject: { source: sourcePath, destination: destinationPath },+ supportedFixes: ['choose a different destination path and keep the source unchanged'],+ })],+ });+ return;+ }++ const { migrateWorkflowDocument, serializeMigratedWorkflow } = await import('../migrations/workflow-v2.mjs');+ let migration;+ try {+ migration = migrateWorkflowDocument(sourceDocument);+ } catch (error) {+ migration = {+ ok: false,+ migrationDiagnostics: [diagnostic({+ code: 'migration/internal',+ message: 'Workflow migration failed unexpectedly.',+ evidence: { reason: error.message },+ supportedFixes: ['report the source workflow and this diagnostic to the Archify maintainers'],+ })],+ };+ }++ if (!migration.ok) {+ reportMigrationFailure(migration);+ return;+ }++ if (fs.existsSync(destinationPath) && !fs.lstatSync(destinationPath).isFile()) {+ reportMigrationFailure({+ ...migration,+ migrationDiagnostics: [...migration.migrationDiagnostics, diagnostic({+ code: 'migration/destination-type',+ message: 'Workflow migration destination must be a regular file path.',+ subject: { destination: destinationPath },+ supportedFixes: ['choose a destination path that is absent or names a regular file'],+ })],+ });+ return;+ }++ const destinationDirectory = path.dirname(destinationPath);+ let stagingDirectory;+ try {+ fs.mkdirSync(destinationDirectory, { recursive: true });+ stagingDirectory = fs.mkdtempSync(path.join(destinationDirectory, '.archify-migration-'));+ } catch (error) {+ reportMigrationFailure({+ ...migration,+ migrationDiagnostics: [...migration.migrationDiagnostics, diagnostic({+ code: 'migration/prepare-destination',+ message: 'Could not prepare the workflow migration destination.',+ subject: { destination: destinationPath },+ evidence: { ...(error?.code ? { systemCode: error.code } : {}), reason: error.message },+ supportedFixes: ['choose a writable destination directory'],+ })],+ });+ return;+ }++ const candidatePath = path.join(stagingDirectory, 'candidate.workflow.json');+ const artifactPath = path.join(stagingDirectory, 'migration-check.html');+ const destinationBytes = Buffer.from(serializeMigratedWorkflow(migration.document));+ try {+ fs.writeFileSync(candidatePath, destinationBytes, { flag: 'wx' });+ const render = runNode([rendererPath('workflow'), candidatePath, artifactPath], {+ stdio: 'pipe',+ env: rendererEnv(activeQualityProfile, undefined, true),+ });+ if (render.status !== 0) {+ const failure = rendererFailure(render);+ reportMigrationFailure({+ ...migration,+ newSchemaDiagnostics: [...migration.newSchemaDiagnostics, ...failure.diagnostics],+ status: render.status ?? 1,+ });+ return;+ }++ const check = runNode([path.join(skillRoot, 'scripts/check-render-output.mjs'), artifactPath], {+ stdio: 'pipe',+ });+ if (check.status !== 0) {+ let checker;+ try {+ checker = JSON.parse(check.stdout);+ } catch {+ checker = null;+ }+ reportMigrationFailure({+ ...migration,+ newSchemaDiagnostics: [+ ...migration.newSchemaDiagnostics,+ ...checkerDiagnostics(checker),+ ],+ status: check.status ?? 1,+ });+ return;+ }++ if (pathsAlias(sourcePath, destinationPath)) {+ reportMigrationFailure({+ ...migration,+ migrationDiagnostics: [...migration.migrationDiagnostics, diagnostic({+ code: 'migration/source-destination',+ message: 'Workflow migration source and destination resolved to the same file before commit.',+ subject: { source: sourcePath, destination: destinationPath },+ supportedFixes: ['choose a different destination path and retry'],+ })],+ });+ return;+ }+ const currentSourceBytes = fs.readFileSync(sourcePath);+ if (!currentSourceBytes.equals(sourceBytes)) {+ reportMigrationFailure({+ ...migration,+ migrationDiagnostics: [...migration.migrationDiagnostics, diagnostic({+ code: 'migration/source-changed',+ message: 'Workflow migration source changed while the destination was being verified.',+ subject: { source: sourcePath },+ supportedFixes: ['retry the migration from a stable workflow source file'],+ })],+ });+ return;+ }++ fs.renameSync(candidatePath, destinationPath);+ const report = migrationReport({+ ...migration,+ sourcePath,+ destinationPath,+ sourceBytes,+ destinationBytes,+ fromSchemaVersion: sourceDocument.schema_version,+ });+ if (options.json) console.log(JSON.stringify(report, null, 2));+ else if (sourceDocument.schema_version === 1) {+ console.log(`migrated workflow schema v1→v2: ${sourcePath} → ${destinationPath}`);+ } else {+ console.log(`verified workflow schema v2 migration: ${sourcePath} → ${destinationPath}`);+ }+ } catch (error) {+ const migrationDiagnostics = Array.isArray(error?.archifyDiagnostics)+ ? migrationPathDiagnostics(error, sourcePath, destinationPath)+ : [diagnostic({+ code: 'migration/commit',+ message: 'Could not commit the verified workflow migration.',+ subject: { destination: destinationPath },+ evidence: { ...(error?.code ? { systemCode: error.code } : {}), reason: error.message },+ supportedFixes: ['choose a writable regular-file destination and retry'],+ })];+ reportMigrationFailure({+ ...migration,+ migrationDiagnostics: [...migration.migrationDiagnostics, ...migrationDiagnostics],+ });+ } finally {+ try {+ fs.rmSync(stagingDirectory, { recursive: true, force: true });+ } catch (error) {+ console.error(`Warning: could not remove workflow migration staging directory "${stagingDirectory}": ${error.message}`);+ }+ }+}+function commandValidate(args) {const qualityArgs = extractQualityArgs(args);const repoArgs = extractRepoRootArgs(qualityArgs.rest);args = repoArgs.rest;const quality = qualityArgs.quality;const repoRoot = repoArgs.repoRoot;+ const knownOptions = new Set(['--json', '--layout-json']);+ const unknown = args.filter((arg) => arg.startsWith('--') && !knownOptions.has(arg));+ if (unknown.length) fail(`Unknown validate option "${unknown[0]}".`);const json = args.includes('--json');const layoutJson = args.includes('--layout-json');- const rest = args.filter((arg) => arg !== '--json' && arg !== '--layout-json');+ const rest = args.filter((arg) => !knownOptions.has(arg));const [type, input] = rest;- if (!type || !input) fail(usage());+ if (!type || !input || rest.length !== 2) fail(usage());assertEvidenceType(type, repoRoot);const renderer = rendererPath(type);if (layoutJson) {- if (type !== 'architecture') {- fail('--layout-json is currently supported for architecture diagrams only.');+ if (!['architecture', 'workflow'].includes(type)) {+ fail('--layout-json is currently supported for architecture and workflow diagrams only.');}const result = runNode([renderer, input, '/dev/null', '--layout-json'], {stdio: 'pipe',env: rendererEnv(quality, repoRoot, true),});if (result.status !== 0) {+ try {+ const receipt = JSON.parse(result.stdout);+ if (receipt?.contract && Array.isArray(receipt.diagnostics)) {+ process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`);+ process.exitCode = result.status ?? 1;+ return;+ }+ } catch {+ // Fall through to the renderer failure contract when no compiler+ // receipt was produced (for example, input JSON could not be read).+ }const failure = rendererFailure(result);reportValidateFailure({json,@@ -1609,7 +1953,13 @@ switch (command) {case 'validate':commandValidate(args);break;+ case 'migrate':+ await commandMigrate(args);+ break;case 'inspect':+ if (args[0] !== 'architecture') {+ fail('inspect is currently supported for architecture diagrams only.');+ }commandValidate([...args, '--layout-json']);break;case 'check':diff --git a/archify/examples/agent-tool-call.workflow.json b/archify/examples/agent-tool-call.workflow.jsonindex 1144e1d5..c8c31995 100644--- a/archify/examples/agent-tool-call.workflow.json+++ b/archify/examples/agent-tool-call.workflow.json@@ -1,5 +1,5 @@{- "schema_version": 1,+ "schema_version": 2,"diagram_type": "workflow","meta": {"title": "Agent Tool Call Workflow",@@ -26,16 +26,13 @@"note": "Isolate the durable trace and context path behind the visible answer."}],- "output": "examples/workflow-agent-tool-call-rendered.html",- "viewBox": [720, 900]+ "output": "examples/workflow-agent-tool-call-rendered.html"},"lanes": [{ "id": "ui", "label": "User Interface" },{ "id": "agent", "label": "Agent Runtime" },- { "id": "policy", "label": "Policy Boundary" },- { "id": "exceptions", "label": "Exception Handling", "variant": "exception" },- { "id": "tools", "label": "Tool Execution" },- { "id": "trace", "label": "Observability" }+ { "id": "policy", "label": "Policy & Recovery", "variant": "exception" },+ { "id": "tools", "label": "Tool Execution & Evidence" }],"phases": [{ "id": "intake", "label": "Intake", "fromCol": 0, "toCol": 1 },@@ -44,66 +41,53 @@],"groups": [{ "id": "agent_loop", "label": "Planning loop", "lane": "agent", "fromCol": 2, "toCol": 3, "variant": "emphasis" },- { "id": "tool_work", "label": "Tool work", "lane": "tools", "fromCol": 4, "toCol": 5, "variant": "dashed" },- { "id": "exception_path", "label": "Human or policy stop", "lane": "exceptions", "fromCol": 3, "toCol": 5, "variant": "security" }+ { "id": "exception_path", "label": "Human or policy stop", "lane": "policy", "fromCol": 3, "toCol": 5, "variant": "security" },+ { "id": "evidence_path", "label": "Evidence path", "lane": "tools", "fromCol": 1, "toCol": 2, "variant": "dashed" },+ { "id": "tool_work", "label": "Tool work", "lane": "tools", "fromCol": 4, "toCol": 5, "variant": "dashed" }],"mainPath": ["user", "chat", "planner", "router", "approval", "tool", "external", "final"],"nodes": [- { "id": "user", "lane": "ui", "col": 0, "type": "external", "label": "User", "sublabel": "asks for work" },- { "id": "chat", "lane": "ui", "col": 1, "type": "frontend", "label": "Chat Surface", "sublabel": "thread + files" },- { "id": "final", "lane": "ui", "col": 5, "type": "backend", "label": "Final Reply", "sublabel": "answer + changes" },- { "id": "planner", "lane": "agent", "col": 2, "type": "backend", "label": "Agent Planner", "sublabel": "plan next step", "tag": "context aware" },- { "id": "router", "lane": "agent", "col": 3, "type": "backend", "label": "Tool Router", "sublabel": "choose capability" },- { "id": "approval", "lane": "policy", "col": 3, "type": "security", "label": "Approval Gate", "sublabel": "scope + consent", "tag": "block risky ops" },- { "id": "blocked", "lane": "exceptions", "col": 4, "type": "security", "label": "Blocked", "sublabel": "wait or reject" },- { "id": "retry", "lane": "exceptions", "col": 5, "type": "messagebus", "label": "Retry Path", "sublabel": "revise request" },- { "id": "tool", "lane": "tools", "col": 4, "type": "messagebus", "label": "Tool Call", "sublabel": "shell / browser / MCP", "tag": "structured result" },- { "id": "external", "lane": "tools", "col": 5, "type": "cloud", "label": "External API", "sublabel": "network service" },- { "id": "store", "lane": "trace", "col": 1, "type": "database", "label": "Context Store", "sublabel": "repo + memory" },- { "id": "trace", "lane": "trace", "col": 4, "type": "database", "label": "Trace Log", "sublabel": "events + output" }+ { "id": "user", "lane": "ui", "col": 0, "type": "external", "label": "User", "sublabel": "asks for work", "width": 132 },+ { "id": "chat", "lane": "ui", "col": 1, "type": "frontend", "label": "Chat Surface", "sublabel": "thread + files", "width": 132 },+ { "id": "final", "lane": "ui", "col": 5, "type": "backend", "label": "Final Reply", "sublabel": "answer + changes", "width": 132 },+ { "id": "planner", "lane": "agent", "col": 2, "type": "backend", "label": "Agent Planner", "sublabel": "plan next step", "tag": "context aware", "width": 132 },+ { "id": "router", "lane": "agent", "col": 3, "type": "backend", "label": "Tool Router", "sublabel": "choose capability", "width": 132 },+ { "id": "approval", "lane": "policy", "col": 3, "type": "security", "label": "Approval Gate", "sublabel": "scope + consent", "tag": "block risky ops", "width": 132 },+ { "id": "blocked", "lane": "policy", "col": 4, "type": "security", "label": "Blocked", "sublabel": "wait or reject", "width": 132 },+ { "id": "retry", "lane": "policy", "col": 5, "type": "messagebus", "label": "Retry Path", "sublabel": "revise request", "width": 132 },+ { "id": "tool", "lane": "tools", "col": 4, "type": "messagebus", "label": "Tool Call", "sublabel": "shell / browser / MCP", "tag": "structured result", "width": 132 },+ { "id": "external", "lane": "tools", "col": 5, "type": "cloud", "label": "External API", "sublabel": "network service", "width": 132 },+ { "id": "store", "lane": "tools", "col": 1, "type": "database", "label": "Context Store", "sublabel": "repo + memory", "width": 132 },+ { "id": "trace", "lane": "tools", "col": 2, "type": "database", "label": "Trace Log", "sublabel": "events + output", "width": 132 }],"edges": [{ "id": "request-chat", "from": "user", "to": "chat", "variant": "default" },- { "id": "plan-request", "from": "chat", "to": "planner", "label": "plan", "variant": "emphasis", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 1 },+ { "id": "plan-request", "from": "chat", "to": "planner", "label": "plan", "variant": "emphasis" },{ "id": "planner-route", "from": "planner", "to": "router", "variant": "default" },- { "id": "approval-check", "from": "router", "to": "approval", "label": "needs approval?", "variant": "security", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 0, "labelDx": 34, "labelDy": 18 },- { "id": "approved-tool", "from": "approval", "to": "tool", "variant": "emphasis", "fromSide": "left", "toSide": "left", "route": "return-left" },- { "id": "approval-denied", "from": "approval", "to": "blocked", "label": "denied", "variant": "security", "role": "error", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 1, "labelDy": 12 },+ { "id": "approval-check", "from": "router", "to": "approval", "label": "needs approval?", "variant": "security" },+ { "id": "approved-tool", "from": "approval", "to": "tool", "variant": "emphasis" },+ { "id": "approval-denied", "from": "approval", "to": "blocked", "label": "denied", "variant": "security", "role": "error" },{ "id": "retry-request", "from": "blocked", "to": "retry", "variant": "dashed", "role": "branch" },{ "id": "tool-external-call", "from": "tool", "to": "external", "variant": "default" },{ "id": "external-reply", "from": "external", "to": "final", "variant": "emphasis", "role": "return", "fromSide": "right", "toSide": "right", "route": "outside-right", "width": 1.2 },{ "id": "record-result", "from": "external", "to": "trace", "label": "record result", "variant": "dashed", "fromSide": "bottom", "toSide": "bottom", "route": "bottom-channel", "labelSegment": 1 },- { "id": "write-trace-memory", "from": "store", "to": "trace", "label": "trace + memory", "variant": "dashed", "labelAt": [365, 735] }+ { "id": "write-trace-memory", "from": "store", "to": "trace", "label": "trace + memory", "variant": "dashed" }],"cards": [{"dot": "cyan",- "title": "Renderer Rules",+ "title": "Compiler Contract","items": ["Lanes and columns determine node placement",- "Edges attach to explicit node anchors",- "Cross-lane paths use orthogonal routing",- "Short adjacent links stay unlabeled"+ "Labels reserve clearance; routes stay orthogonal"]},{"dot": "rose",- "title": "Workflow Semantics",+ "title": "Runtime Semantics","items": [- "Approval is a first-class policy step",- "Consent gates are visible in the main path",- "External calls stay inside the tool lane",- "Trace writes are separate from the hot path"- ]- },- {- "dot": "emerald",- "title": "Why It Matters",- "items": [- "This is closer to a diagram_type renderer",- "The graph can be edited without SVG surgery",- "Layout rules can be tested and improved",- "A future IR can reuse this shape directly"+ "Approval gates risky work before tool execution",+ "Evidence returns through isolated trace and memory"]}]diff --git a/archify/examples/workflow-agent-tool-call-rendered.html b/archify/examples/workflow-agent-tool-call-rendered.htmlindex b5ea59d3..bc9f6211 100644--- a/archify/examples/workflow-agent-tool-call-rendered.html+++ b/archify/examples/workflow-agent-tool-call-rendered.html@@ -5004,7 +5004,7 @@<!-- Main Diagram --><div class="diagram-container" data-detail-level="read"data-preset-badge-editorial-plate="ARCHIFY / PLATE 04">- <svg viewBox="0 0 720 900" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase">+ <svg viewBox="0 0 1096 684" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase"><title id="archify-diagram-title">Agent Tool Call Workflow</title><desc id="archify-diagram-description">A workflow diagram generated by Archify.</desc><!-- Definitions -->@@ -5030,237 +5030,263 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Swimlanes -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="1028" height="106" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="74" class="t-dim" font-size="10" font-weight="600">01 / User Interface</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="176" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="198" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="178" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="200" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="300" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="322" class="t-dim" font-size="10" font-weight="600">03 / Policy Boundary</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="312" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-2-exception" x="46" y="318" width="1016" height="102" rx="8" class="c-security-group" stroke-width="1"/>+ <text x="54" y="334" class="t-security" font-size="10" font-weight="600">EX / Policy & Recovery</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="424" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-3-exception" x="46" y="430" width="628" height="92" rx="8" class="c-security-group" stroke-width="1"/>- <text x="54" y="446" class="t-security" font-size="10" font-weight="600">EX / Exception Handling</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-4" x="40" y="548" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="570" class="t-dim" font-size="10" font-weight="600">05 / Tool Execution</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-5" x="40" y="672" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="694" class="t-dim" font-size="10" font-weight="600">06 / Observability</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="446" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="468" class="t-dim" font-size="10" font-weight="600">04 / Tool Execution & Evidence</text><!-- Phase headers -->- <line x1="42" y1="35" x2="266" y2="35" class="a-default" stroke-width="1.1"/>- <rect x="42" y="27" width="224" height="16" rx="4" class="c-mask"/>- <text x="154" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>- <line x1="254" y1="35" x2="476" y2="35" class="a-emphasis" stroke-width="1.1"/>- <rect x="254" y="27" width="222" height="16" rx="4" class="c-mask"/>- <text x="365" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>- <line x1="454" y1="35" x2="671" y2="35" class="a-dashed" stroke-width="1.1"/>- <rect x="454" y="27" width="217" height="16" rx="4" class="c-mask"/>- <text x="562.5" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text>+ <line x1="68" y1="35" x2="320" y2="35" class="a-default" stroke-width="1.1"/>+ <rect x="68" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="194" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>+ <line x1="445.20000000000005" y1="35" x2="697.2" y2="35" class="a-emphasis" stroke-width="1.1"/>+ <rect x="445.20000000000005" y="27" width="252.00000000000006" height="16" rx="4" class="c-mask"/>+ <text x="571.2" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>+ <line x1="784" y1="35" x2="1036" y2="35" class="a-dashed" stroke-width="1.1"/>+ <rect x="784" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="910" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text><!-- Workflow groups -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="250" y="214" width="230" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="260" y="228" class="t-backend" font-size="7" font-weight="600">Planning loop</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="450" y="586" width="225" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="460" y="600" class="t-messagebus" font-size="7" font-weight="600">Tool work</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="380" y="462" width="295" height="58" rx="9" class="c-security-group" stroke-width="1"/>- <text x="390" y="476" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="421.2" y="216" width="300.00000000000006" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="431.2" y="214" class="t-backend" font-size="7" font-weight="600">Planning loop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="581.2" y="350" width="478.79999999999995" height="72" rx="9" class="c-security-group" stroke-width="1"/>+ <text x="591.2" y="348" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="204" y="484" width="357.20000000000005" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="214" y="482" class="t-messagebus" font-size="7" font-weight="600">Evidence path</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-3" x="760" y="484" width="300" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="770" y="482" class="t-messagebus" font-size="7" font-weight="600">Tool work</text><!-- Edge paths -->- <path data-edge-from="user" data-edge-to="chat" data-edge-key="0" data-edge-id="request-chat" data-composition-points="134,119;174,119" d="M 134 119 L 174 119" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request" data-composition-points="220,145;220,166;300,166;300,209" d="M 220 145 L 220 166 L 300 166 L 300 209" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="planner" data-edge-to="router" data-edge-key="2" data-edge-id="planner-route" data-composition-points="346,243;384,243" d="M 346 243 L 384 243" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check" data-composition-points="430,269;430,290;430,290;430,333" d="M 430 269 L 430 290 L 430 290 L 430 333" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="approval" data-edge-to="tool" data-edge-key="4" data-edge-id="approved-tool" data-composition-points="384,367;356,367;356,615;454,615" d="M 384 367 L 356 367 L 356 615 L 454 615" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied" data-composition-points="430,401;430,414;500,414;500,465" d="M 430 401 L 430 414 L 500 414 L 500 465" class="a-security" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="6" data-edge-id="retry-request" data-composition-points="546,491;579,491" d="M 546 491 L 579 491" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="tool" data-edge-to="external" data-edge-key="7" data-edge-id="tool-external-call" data-composition-points="546,615;579,615" d="M 546 615 L 579 615" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="external" data-edge-to="final" data-edge-key="8" data-edge-id="external-reply" data-composition-points="671,615;692,615;692,119;671,119" d="M 671 615 L 692 615 L 692 119 L 671 119" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result" data-composition-points="625,641;625,797;500,797;500,765" d="M 625 641 L 625 797 L 500 797 L 500 765" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="266,739;454,739" d="M 266 739 L 454 739" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check" data-composition-points="651.2,279;651.2,302;569.2,302;569.2,387;585.2,387" d="M 651.2 279 L 651.2 302 L 569.2 302 L 569.2 387 L 585.2 387" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied" data-composition-points="651.2,421;651.2,442;830,442;830,413" d="M 651.2 421 L 651.2 442 L 830 442 L 830 413" class="a-security" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="tool" data-edge-key="2" data-edge-id="approved-tool" data-composition-points="651.2,421;651.2,521;764,521" d="M 651.2 421 L 651.2 521 L 764 521" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="external" data-edge-to="final" data-edge-key="3" data-edge-id="external-reply" data-composition-points="1056,521;1080,521;1080,120;1056,120" d="M 1056 521 L 1080 521 L 1080 120 L 1056 120" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request" data-composition-points="274,146;274,253;425.2,253" d="M 274 146 L 274 253 L 425.2 253" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="planner" data-edge-to="router" data-edge-key="5" data-edge-id="planner-route" data-composition-points="557.2,253;585.2,253" d="M 557.2 253 L 585.2 253" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result" data-composition-points="990,547;990,579;491.2,579;491.2,547" d="M 990 547 L 990 579 L 491.2 579 L 491.2 547" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="user" data-edge-to="chat" data-edge-key="7" data-edge-id="request-chat" data-composition-points="180,120;208,120" d="M 180 120 L 208 120" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="8" data-edge-id="retry-request" data-composition-points="896,387;924,387" d="M 896 387 L 924 387" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="tool" data-edge-to="external" data-edge-key="9" data-edge-id="tool-external-call" data-composition-points="896,521;924,521" d="M 896 521 L 924 521" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="340,521;425.2,521" d="M 340 521 L 425.2 521" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><!-- Nodes --><g id="node-user" data-node-id="user" data-node-label="User" tabindex="0" role="button" aria-label="Focus User, asks for work, User Interface › Intake" aria-pressed="false" data-node-kind="external" data-node-sublabel="asks for work" data-node-context="User Interface › Intake"><title>User · asks for work · User Interface › Intake</title>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(48 99) scale(0.6875)">+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(54 100) scale(0.6875)"><rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/><path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/></g>- <text data-node-label="" data-detail-anchor="" x="88" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>- <text data-detail="context" x="88" y="131" class="t-muted" font-size="8" text-anchor="middle">asks for work</text>+ <text data-node-label="" data-detail-anchor="" x="114" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>+ <text data-detail="context" x="114" y="132" class="t-muted" font-size="8" text-anchor="middle">asks for work</text></g><g id="node-chat" data-node-id="chat" data-node-label="Chat Surface" tabindex="0" role="button" aria-label="Focus Chat Surface, thread + files, User Interface › Intake" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="thread + files" data-node-context="User Interface › Intake"><title>Chat Surface · thread + files · User Interface › Intake</title>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(180 99) scale(0.6875)">+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(214 100) scale(0.6875)"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M2 6.5h12"/><circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/><circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>- <text data-detail="context" x="220" y="131" class="t-muted" font-size="8" text-anchor="middle">thread + files</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>+ <text data-detail="context" x="274" y="132" class="t-muted" font-size="8" text-anchor="middle">thread + files</text></g><g id="node-final" data-node-id="final" data-node-label="Final Reply" tabindex="0" role="button" aria-label="Focus Final Reply, answer + changes, User Interface › Execute + report" aria-pressed="false" data-node-kind="backend" data-node-sublabel="answer + changes" data-node-context="User Interface › Execute + report"><title>Final Reply · answer + changes · User Interface › Execute + report</title>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(585 99) scale(0.6875)">+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(930 100) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>- <text data-detail="context" x="625" y="131" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>+ <text data-detail="context" x="990" y="132" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text></g><g id="node-planner" data-node-id="planner" data-node-label="Agent Planner" tabindex="0" role="button" aria-label="Focus Agent Planner, plan next step, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="plan next step" data-node-tag="context aware" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Agent Planner · plan next step · Agent Runtime › Planning loop › Plan + route · context aware</title>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-mask"/>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(260 215) scale(0.6875)">+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(431.2 225) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="300" y="230" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Agent Planner</text>- <text data-detail="context" x="300" y="247" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>- <text data-detail="fine" x="300" y="265" class="t-backend" font-size="7" text-anchor="middle">context aware</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="240" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Planner</text>+ <text data-detail="context" x="491.2" y="257" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>+ <text data-detail="fine" x="491.2" y="275" class="t-backend" font-size="7" text-anchor="middle">context aware</text></g><g id="node-router" data-node-id="router" data-node-label="Tool Router" tabindex="0" role="button" aria-label="Focus Tool Router, choose capability, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="choose capability" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Tool Router · choose capability · Agent Runtime › Planning loop › Plan + route</title>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-mask"/>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(390 223) scale(0.6875)">+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(591.2 233) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>- <text data-detail="context" x="430" y="255" class="t-muted" font-size="8" text-anchor="middle">choose capability</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="248" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>+ <text data-detail="context" x="651.2" y="265" class="t-muted" font-size="8" text-anchor="middle">choose capability</text></g>- <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy Boundary › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy Boundary › Plan + route">- <title>Approval Gate · scope + consent · Policy Boundary › Plan + route · block risky ops</title>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-mask"/>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(390 339) scale(0.6875)">+ <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy & Recovery › Human or policy stop › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy & Recovery › Human or policy stop › Plan + route">+ <title>Approval Gate · scope + consent · Policy & Recovery › Human or policy stop › Plan + route · block risky ops</title>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(591.2 359) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="354" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Approval Gate</text>- <text data-detail="context" x="430" y="371" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>- <text data-detail="fine" x="430" y="389" class="t-security" font-size="7" text-anchor="middle">block risky ops</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="374" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Approval Gate</text>+ <text data-detail="context" x="651.2" y="391" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>+ <text data-detail="fine" x="651.2" y="409" class="t-security" font-size="7" text-anchor="middle">block risky ops</text></g>- <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Blocked · wait or reject · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(460 471) scale(0.6875)">+ <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Blocked · wait or reject · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(770 367) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>- <text data-detail="context" x="500" y="503" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>+ <text data-detail="context" x="830" y="399" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text></g>- <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Retry Path · revise request · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(585 471) scale(0.6875)">+ <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Retry Path · revise request · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(930 367) scale(0.6875)"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/><circle cx="5" cy="4.5" r="1" class="sigil-fill"/><circle cx="10.5" cy="8" r="1" class="sigil-fill"/><circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>- <text data-detail="context" x="625" y="503" class="t-muted" font-size="8" text-anchor="middle">revise request</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>+ <text data-detail="context" x="990" y="399" class="t-muted" font-size="8" text-anchor="middle">revise request</text></g>- <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution › Tool work › Execute + report">- <title>Tool Call · shell / browser / MCP · Tool Execution › Tool work › Execute + report · structured result</title>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-mask"/>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(460 587) scale(0.6875)">- <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>- <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>- <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>- <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Tool Execution & Evidence › Evidence path › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Tool Execution & Evidence › Evidence path › Intake">+ <title>Context Store · repo + memory · Tool Execution & Evidence › Evidence path › Intake</title>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(214 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="602" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>- <text data-detail="context" x="500" y="619" class="t-muted" font-size="6.6" text-anchor="middle">shell / browser / MCP</text>- <text data-detail="fine" x="500" y="637" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Context Store</text>+ <text data-detail="context" x="274" y="533" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text></g>- <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution › Tool work › Execute + report">- <title>External API · network service · Tool Execution › Tool work › Execute + report</title>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(585 595) scale(0.6875)">- <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Tool Execution & Evidence › Evidence path › Plan + route" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Tool Execution & Evidence › Evidence path › Plan + route">+ <title>Trace Log · events + output · Tool Execution & Evidence › Evidence path › Plan + route</title>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(431.2 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="610" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>- <text data-detail="context" x="625" y="627" class="t-muted" font-size="8" text-anchor="middle">network service</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>+ <text data-detail="context" x="491.2" y="533" class="t-muted" font-size="8" text-anchor="middle">events + output</text></g>- <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Observability › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Observability › Intake">- <title>Context Store · repo + memory · Observability › Intake</title>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(180 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>Tool Call · shell / browser / MCP · Tool Execution & Evidence › Tool work › Execute + report · structured result</title>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(770 493) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="734" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Context Store</text>- <text data-detail="context" x="220" y="751" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="508" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>+ <text data-detail="context" x="830" y="525" class="t-muted" font-size="8" text-anchor="middle">shell / browser / MCP</text>+ <text data-detail="fine" x="830" y="543" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text></g>- <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Observability › Execute + report" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Observability › Execute + report">- <title>Trace Log · events + output · Observability › Execute + report</title>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(460 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>External API · network service · Tool Execution & Evidence › Tool work › Execute + report</title>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(930 501) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>- <text data-detail="context" x="500" y="751" class="t-muted" font-size="8" text-anchor="middle">events + output</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>+ <text data-detail="context" x="990" y="533" class="t-muted" font-size="8" text-anchor="middle">network service</text></g><!-- Edge labels -->-- <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request">- <rect x="245" y="146" width="30" height="14" rx="3" class="c-mask"/>- <text x="260" y="156" class="t-backend" font-size="8" text-anchor="middle">plan</text>+ <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check">+ <rect x="569.2" y="282" width="82" height="14" rx="3" class="c-mask"/>+ <text x="610.2" y="292" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>+ </g>+ <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied">+ <rect x="721.2" y="422" width="38.8" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="432" class="t-security" font-size="8" text-anchor="middle">denied</text></g>- <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check">- <rect x="423" y="277.5" width="82" height="14" rx="3" class="c-mask"/>- <text x="464" y="287.5" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>++ <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request">+ <rect x="334.6" y="233" width="30" height="14" rx="3" class="c-mask"/>+ <text x="349.6" y="243" class="t-backend" font-size="8" text-anchor="middle">plan</text></g>- <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied">- <rect x="445.6" y="406" width="38.8" height="14" rx="3" class="c-mask"/>- <text x="465" y="416" class="t-security" font-size="8" text-anchor="middle">denied</text>+ <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result">+ <rect x="704.4" y="559" width="72.4" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="569" class="t-database" font-size="8" text-anchor="middle">record result</text></g>- <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result">- <rect x="526.3" y="777" width="72.4" height="14" rx="3" class="c-mask"/>- <text x="562.5" y="787" class="t-database" font-size="8" text-anchor="middle">record result</text>- </g><g data-detail="context" data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory">- <rect x="326.4" y="725" width="77.2" height="14" rx="3" class="c-mask"/>- <text x="365" y="735" class="t-database" font-size="8" text-anchor="middle">trace + memory</text>+ <rect x="344" y="501" width="77.2" height="14" rx="3" class="c-mask"/>+ <text x="382.6" y="511" class="t-database" font-size="8" text-anchor="middle">trace + memory</text></g><!-- Legend -->-+ <g data-legend="" data-legend-bridge="">+ <text x="20" y="584" class="t-primary" font-size="12" font-weight="650">Legend</text>+ <g data-legend-semantic-kind="frontend" data-legend-kind="frontend" data-legend-label="User UI" data-legend-x="20" data-legend-baseline="604" data-legend-width="74">+ <rect x="20" y="596" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="42" y="604" class="t-muted" font-size="7.5" font-weight="500">User UI</text>+ </g>+ <g data-legend-semantic-kind="backend" data-legend-kind="backend" data-legend-label="Agent logic" data-legend-x="101" data-legend-baseline="604" data-legend-width="91">+ <rect x="101" y="596" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="123" y="604" class="t-muted" font-size="7.5" font-weight="500">Agent logic</text>+ </g>+ <g data-legend-semantic-kind="security" data-legend-kind="security" data-legend-label="Policy" data-legend-x="199" data-legend-baseline="604" data-legend-width="70">+ <rect x="199" y="596" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="221" y="604" class="t-muted" font-size="7.5" font-weight="500">Policy</text>+ </g>+ <g data-legend-semantic-kind="messagebus" data-legend-kind="messagebus" data-legend-label="Tool action" data-legend-x="276" data-legend-baseline="604" data-legend-width="91">+ <rect x="276" y="596" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="298" y="604" class="t-muted" font-size="7.5" font-weight="500">Tool action</text>+ </g>+ <g data-legend-semantic-kind="database" data-legend-kind="database" data-legend-label="Context / trace" data-legend-x="374" data-legend-baseline="604" data-legend-width="109">+ <rect x="374" y="596" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>+ <text x="396" y="604" class="t-muted" font-size="7.5" font-weight="500">Context / trace</text>+ </g>+ <g data-legend-semantic-kind="cloud" data-legend-kind="cloud" data-legend-label="Cloud service" data-legend-x="490" data-legend-baseline="604" data-legend-width="100">+ <rect x="490" y="596" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="512" y="604" class="t-muted" font-size="7.5" font-weight="500">Cloud service</text>+ </g>+ <g data-legend-semantic-kind="external" data-legend-kind="external" data-legend-label="External system" data-legend-x="597" data-legend-baseline="604" data-legend-width="109">+ <rect x="597" y="596" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="619" y="604" class="t-muted" font-size="7.5" font-weight="500">External system</text>+ </g>+ </g></svg><p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p><div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">@@ -5450,39 +5476,22 @@<div class="card"><div class="card-header"><div class="card-dot cyan"></div>- <h3>Renderer Rules</h3>+ <h3>Compiler Contract</h3></div><ul><li>• Lanes and columns determine node placement</li>- <li>• Edges attach to explicit node anchors</li>- <li>• Cross-lane paths use orthogonal routing</li>- <li>• Short adjacent links stay unlabeled</li>+ <li>• Labels reserve clearance; routes stay orthogonal</li></ul></div><div class="card"><div class="card-header"><div class="card-dot rose"></div>- <h3>Workflow Semantics</h3>- </div>- <ul>- <li>• Approval is a first-class policy step</li>- <li>• Consent gates are visible in the main path</li>- <li>• External calls stay inside the tool lane</li>- <li>• Trace writes are separate from the hot path</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>Why It Matters</h3>+ <h3>Runtime Semantics</h3></div><ul>- <li>• This is closer to a diagram_type renderer</li>- <li>• The graph can be edited without SVG surgery</li>- <li>• Layout rules can be tested and improved</li>- <li>• A future IR can reuse this shape directly</li>+ <li>• Approval gates risky work before tool execution</li>+ <li>• Evidence returns through isolated trace and memory</li></ul></div></div>diff --git a/archify/migrations/workflow-v2.mjs b/archify/migrations/workflow-v2.mjsnew file mode 100644index 00000000..85ba80cb--- /dev/null+++ b/archify/migrations/workflow-v2.mjs@@ -0,0 +1,279 @@+import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';+import {+ createMappedWorkflowCandidate,+ intrinsicWorkflow,+ planningWorkflow,+} from '../renderers/workflow/workflow-migration-geometry.mjs';+import { validateSchema } from '../renderers/shared/validator.mjs';++export { createHorizontalRankMapper } from '../renderers/workflow/workflow-migration-geometry.mjs';++const TARGET_SCHEMA_VERSION = 2;++function clone(value) {+ return JSON.parse(JSON.stringify(value));+}++function diagnostic({ code, message, subject = {}, evidence = {}, supportedFixes = [] }) {+ return {+ code,+ severity: 'error',+ message,+ subject,+ evidence,+ supportedFixes,+ };+}++function schemaDiagnostics(workflow) {+ try {+ validateSchema('workflow', workflow);+ return [];+ } catch (error) {+ if (Array.isArray(error?.archifyDiagnostics)) {+ return error.archifyDiagnostics.map((entry) => ({ ...entry }));+ }+ throw error;+ }+}++function legacyLayoutProbe(workflow, qualityProfile) {+ // The probe discovers fixed-v1 rank centers, not authored canvas capacity.+ // Omitting viewBox lets a capacity-only legacy failure reach the v2 compiler,+ // which can measure and monotonically expand the real migrated document.+ const probe = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: workflow.meta.title,+ ...(workflow.meta.locale ? { locale: workflow.meta.locale } : {}),+ legend: { mode: 'hidden' },+ },+ lanes: clone(workflow.lanes),+ nodes: [{+ id: 'migration_probe',+ lane: workflow.lanes[0].id,+ col: 0,+ type: 'backend',+ label: 'Probe',+ }],+ edges: [],+ };+ return compileWorkflow({ workflow: probe, qualityProfile });+}++function legacyRequirementProbe(workflow, qualityProfile) {+ // Measure the complete fixed-v1 document without treating an authored+ // viewBox as its intrinsic requirement. The authored viewBox remains a+ // migration capacity and is preserved separately on the migrated document.+ const probe = clone(workflow);+ delete probe.meta.viewBox;+ return compileWorkflow({ workflow: probe, qualityProfile });+}++function requiredViewBoxFrom(result) {+ if (Array.isArray(result?.receipt?.requiredViewBox)) {+ return [...result.receipt.requiredViewBox];+ }+ const required = result?.diagnostics+ ?.map((entry) => entry?.evidence?.requiredViewBox)+ .find((candidate) => Array.isArray(candidate) && candidate.length === 2);+ return required ? [...required] : null;+}++function expandableViewBox(result) {+ if (result.ok || !result.diagnostics?.length) return null;+ if (!result.diagnostics.every((entry) => entry.code === 'workflow/viewbox-capacity')) return null;+ return requiredViewBoxFrom(result);+}++function result({+ ok,+ document,+ fromSchemaVersion = 1,+ preExistingDiagnostics = [],+ migrationDiagnostics = [],+ newSchemaDiagnostics = [],+ changedCoordinates = [],+ oldRequiredViewBox = null,+ newRequiredViewBox = null,+}) {+ return {+ ok,+ ...(document ? { document } : {}),+ fromSchemaVersion,+ toSchemaVersion: TARGET_SCHEMA_VERSION,+ preExistingDiagnostics,+ migrationDiagnostics,+ newSchemaDiagnostics,+ changedCoordinates,+ oldRequiredViewBox,+ newRequiredViewBox,+ };+}++export function migrateWorkflowDocument(inputWorkflow) {+ if (!inputWorkflow || typeof inputWorkflow !== 'object' || Array.isArray(inputWorkflow)) {+ return result({+ ok: false,+ migrationDiagnostics: [diagnostic({+ code: 'migration/source-document',+ message: 'Workflow migration requires one parsed JSON object.',+ supportedFixes: ['provide one workflow schema v1 JSON document'],+ })],+ });+ }+ // Migration has no quality override: the authored policy (or effective+ // standard default) must validate the document after it leaves this process.+ const qualityProfile = inputWorkflow.meta?.quality_profile || 'standard';++ const workflow = clone(inputWorkflow);+ const preExistingDiagnostics = schemaDiagnostics(workflow);+ if (preExistingDiagnostics.length) {+ return result({+ ok: false,+ fromSchemaVersion: workflow.schema_version,+ preExistingDiagnostics,+ });+ }+ if (workflow.schema_version === TARGET_SCHEMA_VERSION) {+ const compiled = compileWorkflow({ workflow: clone(workflow), qualityProfile });+ const requiredViewBox = requiredViewBoxFrom(compiled);+ if (!compiled.ok) {+ return result({+ ok: false,+ fromSchemaVersion: TARGET_SCHEMA_VERSION,+ preExistingDiagnostics: compiled.diagnostics,+ oldRequiredViewBox: requiredViewBox,+ newRequiredViewBox: requiredViewBox,+ });+ }+ return result({+ ok: true,+ document: workflow,+ fromSchemaVersion: TARGET_SCHEMA_VERSION,+ oldRequiredViewBox: requiredViewBox,+ newRequiredViewBox: requiredViewBox,+ });+ }+ if (workflow.schema_version !== 1) {+ return result({+ ok: false,+ fromSchemaVersion: workflow.schema_version,+ migrationDiagnostics: [diagnostic({+ code: 'migration/source-schema-version',+ message: 'Workflow migration to schema v2 requires a schema v1 or v2 source.',+ subject: { path: '/schema_version' },+ evidence: { actual: workflow.schema_version, expected: [1, 2] },+ supportedFixes: ['use an unchanged schema v1 workflow or an already migrated schema v2 workflow as the source'],+ })],+ });+ }++ const legacy = compileWorkflow({ workflow: clone(workflow), qualityProfile });+ const legacyProbe = legacyLayoutProbe(workflow, qualityProfile);+ if (!legacyProbe.ok) {+ return result({+ ok: false,+ preExistingDiagnostics: legacy.ok ? [] : legacy.diagnostics,+ migrationDiagnostics: legacyProbe.diagnostics,+ });+ }+ const legacyRequirement = legacyRequirementProbe(workflow, qualityProfile);+ const oldRequiredViewBox = requiredViewBoxFrom(legacyRequirement)+ || requiredViewBoxFrom(legacyProbe)+ || requiredViewBoxFrom(legacy);+ const preExistingLayoutDiagnostics = legacy.ok ? [] : legacy.diagnostics;++ let planned = compileWorkflow({ workflow: intrinsicWorkflow(workflow), qualityProfile });+ if (!planned.ok) {+ // Old absolute pins can be invalid at the new rank centers before their X+ // coordinates are mapped. Obtain the same rank plan from an automatic-route+ // projection, then validate every authored pin again after mapping.+ planned = compileWorkflow({ workflow: planningWorkflow(workflow), qualityProfile });+ }+ if (!planned.ok) {+ return result({+ ok: false,+ preExistingDiagnostics: preExistingLayoutDiagnostics,+ newSchemaDiagnostics: planned.diagnostics,+ oldRequiredViewBox,+ newRequiredViewBox: requiredViewBoxFrom(planned),+ });+ }++ let mappedCandidate;+ try {+ mappedCandidate = createMappedWorkflowCandidate(+ workflow,+ legacyProbe.receipt.columns,+ planned.receipt.columns,+ );+ } catch (error) {+ return result({+ ok: false,+ preExistingDiagnostics: preExistingLayoutDiagnostics,+ migrationDiagnostics: [diagnostic({+ code: 'migration/rank-mapping',+ message: 'Could not construct a stable horizontal rank mapping.',+ evidence: { reason: error.message },+ supportedFixes: ['report the workflow and compiler receipts to the Archify maintainers'],+ })],+ oldRequiredViewBox,+ newRequiredViewBox: requiredViewBoxFrom(planned),+ });+ }++ const { document: migrated, changedCoordinates } = mappedCandidate;++ let compiled = compileWorkflow({ workflow: migrated, qualityProfile });+ const requiredExpansion = migrated.meta.viewBox ? expandableViewBox(compiled) : null;+ if (requiredExpansion) {+ const current = migrated.meta.viewBox;+ const expanded = [+ Math.max(current[0], requiredExpansion[0]),+ Math.max(current[1], requiredExpansion[1]),+ ];+ if (expanded[0] > current[0] || expanded[1] > current[1]) {+ migrated.meta.viewBox = expanded;+ compiled = compileWorkflow({ workflow: migrated, qualityProfile });+ }+ }++ const newRequiredViewBox = requiredViewBoxFrom(compiled) || requiredViewBoxFrom(planned);+ if (!compiled.ok) {+ return result({+ ok: false,+ preExistingDiagnostics: preExistingLayoutDiagnostics,+ newSchemaDiagnostics: compiled.diagnostics,+ changedCoordinates,+ oldRequiredViewBox,+ newRequiredViewBox,+ });+ }++ const migratedSchemaDiagnostics = schemaDiagnostics(migrated);+ if (migratedSchemaDiagnostics.length) {+ return result({+ ok: false,+ preExistingDiagnostics: preExistingLayoutDiagnostics,+ newSchemaDiagnostics: migratedSchemaDiagnostics,+ changedCoordinates,+ oldRequiredViewBox,+ newRequiredViewBox,+ });+ }++ return result({+ ok: true,+ document: migrated,+ preExistingDiagnostics: preExistingLayoutDiagnostics,+ changedCoordinates,+ oldRequiredViewBox,+ newRequiredViewBox,+ });+}++export function serializeMigratedWorkflow(workflow) {+ return `${JSON.stringify(workflow, null, 2)}\n`;+}diff --git a/archify/references/authoring-contract.md b/archify/references/authoring-contract.mdindex 762399a3..890d5c6e 100644--- a/archify/references/authoring-contract.md+++ b/archify/references/authoring-contract.md@@ -12,6 +12,16 @@ Read both the mode schema and `schemas/common.schema.json`. The mode schemas useDo not invent fields. Use the nearest matching example for structure, then author fresh IDs, wording, facts, and layout.+## Workflow layout contracts++Use schema v2 for new workflows and keep schema v1 when an existing source must+retain fixed geometry. In both versions, `col` stays in `0..5` and semantic+edge labels are never deleted as a spacing repair. Do not change only+`schema_version` when absolute coordinates exist: follow the canonical+[migration and layout-receipt contract](../renderers/workflow/README.md#migration-and-layout-receipt).+The complete normative invariants live in the workflow renderer's+[layout contracts](../renderers/workflow/README.md#layout-contracts).+## Legend contractOmit `meta.legend` for the truthful default: `auto` lists only semantic kinds@@ -115,12 +125,15 @@ CJK characters count as two unitsRelationship labels are semantic data. If the gap is too small, move the label,adjust the route or spacing, then shorten the wording while preserving meaning.-Only delete a label when both endpoints fully imply the relationship and it-contains no protocol, action, direction, synchronous/asynchronous behavior, or-cross-boundary mechanism. Explain why a deleted label is redundant. Never-delete a meaningful label merely to pass `showcase`. Apply a diagnosed-`labelAt`, `labelDx`/`labelDy`, or `labelSegment` before guessing several-geometry controls at once.+Omit only wording already fully implied by both endpoints and carrying no+protocol, action, direction, synchronous/asynchronous behavior, or+cross-boundary mechanism. Preserve every meaningful label.+Deleting it is not a spacing repair. If a relationship starts unlabeled because+its endpoints fully imply it, explain why the wording is redundant; this is a+semantic authoring choice, not a spacing repair. In workflow v2, let the compiler+allocate its measured mask before applying a diagnosed `labelAt`,+`labelDx`/`labelDy`, or `labelSegment`. Apply one diagnosed geometry control at+a time.### Repair order@@ -142,7 +155,11 @@ Grid placement is preferred when the schema supports it. Free positions are appr### Workflow-Lanes express responsibility or phase. Columns express progression. Keep the happy path monotonic; route retries and exception returns outside the main lane corridor.+Lanes express responsibility or phase. Columns `0..5` express logical+progression. Start new workflows on `readable-v2`; retain `fixed-v1` only for+legacy geometry compatibility. Keep the happy path monotonic, preserve semantic+edge labels, and route retries and exception returns outside the main lane+corridor.### Sequence@@ -154,11 +171,20 @@ Stages express transformation or custody. Rows separate parallel streams. Label### Lifecycle-Main phases use columns `0..4`; event and terminal bands use columns `0..2`. A recoverable failure needs a real transition back to an active state. A card or guided view saying “retry” is not topology.+Main phases use columns `0..4`; event and terminal bands use columns `0..2`.+Event/terminal column `N` aligns to the same x coordinate as main column+`N + 2`. A recoverable failure needs a real transition back to an active state.+A card or guided view saying “retry” is not topology.## Repository evidence-When the diagram must reflect real code, inspect repository entrypoints, runtime boundaries, storage, transports, and deployment configuration before authoring. Record only evidence you actually verified. Use `--repo-root <path>` when the chosen renderer supports evidence receipts. Never infer runtime causality from file proximity or naming alone.+When an architecture diagram must reflect real code, inspect repository+entrypoints, runtime boundaries, storage, transports, and deployment+configuration before authoring. Record only evidence you actually verified.+`--repo-root <path>` is architecture-only and is accepted by architecture+`render`, `validate`, `deliver`, `preview`, and `compare`; workflow, sequence,+dataflow, and lifecycle reject it. Never infer runtime causality from file+proximity or naming alone.## Hand-placed fallbackdiff --git a/archify/references/delivery-contract.md b/archify/references/delivery-contract.mdindex f111809d..0181abfc 100644--- a/archify/references/delivery-contract.md+++ b/archify/references/delivery-contract.md@@ -10,6 +10,12 @@ node bin/archify.mjs deliver <type> <candidate.json> <output.html> --quality shoDeliver reads the specification once, writes those exact bytes to a private same-directory candidate snapshot, renders that snapshot, runs the complete artifact checker, and only replaces the target after all artifact checks pass. The JSON receipt includes SHA-256 and byte counts for both `specification` and `artifact`. Renderer, checker, receipt, or commit failure exits non-zero, removes private state, preserves the previous trusted artifact, and never invokes an opener.+Run `visual-check` only after `deliver` exits zero for the current candidate. If+delivery fails and the output path already exists, that path still names the+previous trusted artifact; running `visual-check` then would measure and capture+stale output, not the rejected candidate. Report the delivery diagnostics and+repair the source before collecting new visual evidence.+The deterministic receipt proves byte identity and automated checks. Never claim that the deterministic receipt includes visual review.## Automated visual evidencediff --git a/archify/renderers/architecture/render-architecture.mjs b/archify/renderers/architecture/render-architecture.mjsindex 59d5f196..b21ac8e4 100644--- a/archify/renderers/architecture/render-architecture.mjs+++ b/archify/renderers/architecture/render-architecture.mjs@@ -518,13 +518,11 @@ function validateArchitecture() {}));problems.push(...cleanFlowProblems({relations: arch.connections,- endpointIds: new Set(components.keys()),obstacles: components.values(),pathFor,diagramType: 'architecture',relationCollection: 'connections',obstacleKind: 'component',- profile: arch.meta?.quality_profile,routeHint: 'adjust fromSide/toSide, set route/via, or move the component'}));problems.push(...cleanCrossingProblems({diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjsindex 7434f2bc..f49b4471 100644--- a/archify/renderers/dataflow/render-dataflow.mjs+++ b/archify/renderers/dataflow/render-dataflow.mjs@@ -204,13 +204,11 @@ function validateDataflow() {}));problems.push(...cleanFlowProblems({relations: dataflow.flows,- endpointIds: new Set(nodes.keys()),obstacles: nodes.values(),pathFor,diagramType: 'dataflow',relationCollection: 'flows',obstacleKind: 'node',- profile: dataflow.meta?.quality_profile,routeHint: 'adjust fromSide/toSide, set route/via or channelX/channelY, or move the node to another stage/row'}));problems.push(...cleanCrossingProblems({diff --git a/archify/renderers/lifecycle/README.md b/archify/renderers/lifecycle/README.mdindex ad39bb0e..b66a7ddf 100644--- a/archify/renderers/lifecycle/README.md+++ b/archify/renderers/lifecycle/README.md@@ -61,6 +61,11 @@ backed by rendered states receive Semantic Legend controls.| Event | any other id | 278 | `col` 0–2 → x = 402, 556, 710 | 126×58 || Outcome | `terminal` | 450 | `col` 0–2 → x = 402, 556, 710 | 118×58 |+Event and terminal columns are intentionally offset from the main rail:+event/terminal `col: N` uses the same x coordinate as main `col: N + 2`.+For example, lower-band columns 0, 1, and 2 align beneath main columns 2, 3,+and 4 respectively.+| Constant | Value ||----------|-------|| viewBox | default `[980, 660]`; schema minimum `[420, 566]` |diff --git a/archify/renderers/lifecycle/render-lifecycle.mjs b/archify/renderers/lifecycle/render-lifecycle.mjsindex 5b692d5c..eb7922c4 100644--- a/archify/renderers/lifecycle/render-lifecycle.mjs+++ b/archify/renderers/lifecycle/render-lifecycle.mjs@@ -239,13 +239,11 @@ function validateLifecycle() {}));problems.push(...cleanFlowProblems({relations: lifecycle.transitions,- endpointIds: new Set(states.keys()),obstacles: states.values(),pathFor,diagramType: 'lifecycle',relationCollection: 'transitions',obstacleKind: 'state',- profile: lifecycle.meta?.quality_profile,routeHint: 'adjust fromSide/toSide, set route/via or channelX/channelY, or move the state with col/yOffset'}));problems.push(...cleanCrossingProblems({diff --git a/archify/renderers/sequence/render-sequence.mjs b/archify/renderers/sequence/render-sequence.mjsindex bfa4c01e..02d77817 100644--- a/archify/renderers/sequence/render-sequence.mjs+++ b/archify/renderers/sequence/render-sequence.mjs@@ -175,13 +175,11 @@ function validateSequence() {// segment bands remain intentional pass-through geometry and are excluded.problems.push(...cleanFlowProblems({relations: sequence.messages,- endpointIds: new Set(participants.keys()),obstacles: participants.values(),pathFor: messagePath,diagramType: 'sequence',relationCollection: 'messages',obstacleKind: 'participant header',- profile: sequence.meta?.quality_profile,clearance: 0,routeHint: 'move the message y below the participant headers or reorder participants'}));diff --git a/archify/renderers/shared/diagnostics.mjs b/archify/renderers/shared/diagnostics.mjsindex f392f038..03cf6aa3 100644--- a/archify/renderers/shared/diagnostics.mjs+++ b/archify/renderers/shared/diagnostics.mjs@@ -5,6 +5,7 @@ const DIAGNOSTIC_MODE = process.env.ARCHIFY_DIAGNOSTIC_FORMAT === 'json';const recorded = [];const recordedMessages = new Set();const boundaryKey = Symbol.for('archify.renderer-diagnostic-boundary');+let recordingSuppressionDepth = 0;function plainObject(value) {if (!value || typeof value !== 'object' || Array.isArray(value)) return {};@@ -22,17 +23,29 @@ function normalizedDiagnostic(diagnostic) {supportedFixes: Array.isArray(diagnostic?.supportedFixes)? [...new Set(diagnostic.supportedFixes.map((fix) => String(fix).trim()).filter(Boolean))]: [],+ ...(Array.isArray(diagnostic?.suppresses) ? {+ suppresses: [...new Set(diagnostic.suppresses.map((code) => String(code).trim()).filter(Boolean))],+ } : {}),};}export function recordDiagnostic(diagnostic) {- if (!DIAGNOSTIC_MODE) return;+ if (!DIAGNOSTIC_MODE || recordingSuppressionDepth > 0) return;const normalized = normalizedDiagnostic(diagnostic);if (recordedMessages.has(normalized.message)) return;recordedMessages.add(normalized.message);recorded.push(normalized);}+export function withDiagnosticRecordingSuppressed(callback) {+ recordingSuppressionDepth += 1;+ try {+ return callback();+ } finally {+ recordingSuppressionDepth -= 1;+ }+}+export function throwDiagnosticError(message, diagnostics) {for (const diagnostic of diagnostics || []) recordDiagnostic(diagnostic);const error = new Error(message);@@ -42,17 +55,15 @@ export function throwDiagnosticError(message, diagnostics) {export function throwDiagnosticProblems(prefix, problems, { code = 'layout/constraint', subject = {} } = {}) {const messages = (problems || []).map((problem) => String(problem));- for (const message of messages) {- recordDiagnostic({+ const diagnostics = messages.map((message) => normalizedDiagnostic({code,severity: 'error',message,subject,evidence: {},supportedFixes: [],- });- }- throw new Error(`${prefix}:\n- ${messages.join('\n- ')}`);+ }));+ throwDiagnosticError(`${prefix}:\n- ${messages.join('\n- ')}`, diagnostics);}function fallbackDiagnostic(error) {diff --git a/archify/renderers/shared/generated-validators.mjs b/archify/renderers/shared/generated-validators.mjsindex 05741c9c..3a525ccd 100644--- a/archify/renderers/shared/generated-validators.mjs+++ b/archify/renderers/shared/generated-validators.mjs@@ -1,5 +1,5 @@// Generated by scripts/generate-validators.mjs. Do not edit by hand.-"use strict";export const workflow = validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/workflow.schema.json","title":"Archify Workflow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","nodes","edges"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"workflow"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":700},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"variant":{"enum":["normal","exception"]}}}},"phases":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"$ref":"common.schema.json#/$defs/variant"}}}},"groups":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","lane","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"lane":{"$ref":"common.schema.json#/$defs/id"},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"$ref":"common.schema.json#/$defs/variant"}}}},"mainPath":{"type":"array","minItems":2,"items":{"$ref":"common.schema.json#/$defs/id"}},"nodes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","lane","col","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":5},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"width":{"type":"number","minimum":32},"height":{"type":"number","minimum":32},"yOffset":{"type":"number"}}}},"edges":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"role":{"enum":["main","branch","async","return","error"]},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"route":{"enum":["auto","straight","drop","outside-right","return-left","bottom-channel","up-channel"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"channelX":{"type":"number"},"channelY":{"type":"number"},"bias":{"type":"number","minimum":0,"maximum":1},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};const schema33 = {"enum":["en","zh-CN"]};const schema34 = {"enum":["trace","none"]};const schema35 = {"enum":["classic","signal-flow","blueprint","editorial"]};const schema36 = {"enum":["standard","showcase"]};const schema40 = {"enum":["auto","all","hidden"]};const schema41 = {"type":"object","additionalProperties":false,"minProperties":1,"properties":{"label":{"type":"string","minLength":1,"maxLength":80},"visible":{"type":"boolean"}}};const schema38 = {"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]*$"};const schema50 = {"enum":["default","emphasis","security","dashed"]};const schema57 = {"enum":["frontend","backend","database","cloud","security","messagebus","external"]};const schema58 = {"oneOf":[{"type":"string","minLength":1,"maxLength":2048,"anyOf":[{"maxLength":80,"pattern":"^[^\\r\\n]+$"},{"pattern":"^https?://"}]},{"type":"object","additionalProperties":false,"required":["url","sha256"],"properties":{"url":{"type":"string","minLength":8,"maxLength":2048,"pattern":"^https?://"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}]};const schema63 = {"enum":["left","right","top","bottom"]};const schema65 = {"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2};const schema67 = {"type":"number","minimum":0.5};const schema68 = {"type":"array","items":{"type":"object","additionalProperties":false,"required":["dot","title","items"],"properties":{"dot":{"enum":["cyan","emerald","violet","amber","rose","orange","slate"]},"title":{"type":"string","minLength":1},"items":{"type":"array","items":{"type":"string"}}}}};const func1 = Object.prototype.hasOwnProperty;const func3 = function ucs2length(str) {+"use strict";export const workflow = validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/workflow.schema.json","title":"Archify Workflow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","nodes","edges"],"properties":{"schema_version":{"enum":[1,2]},"diagram_type":{"const":"workflow"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"enum":["trace","none"]},"visual_preset":{"enum":["classic","signal-flow","blueprint","editorial"]},"quality_profile":{"enum":["standard","showcase"]},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":700},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"variant":{"enum":["normal","exception"]}}}},"phases":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"groups":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","lane","fromCol","toCol"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"lane":{"$ref":"common.schema.json#/$defs/id"},"fromCol":{"type":"integer","minimum":0,"maximum":5},"toCol":{"type":"integer","minimum":0,"maximum":5},"variant":{"enum":["default","emphasis","security","dashed"]}}}},"mainPath":{"type":"array","minItems":2,"items":{"$ref":"common.schema.json#/$defs/id"}},"semanticChecks":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"allowedRoots":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"allowedTerminals":{"type":"array","items":{"$ref":"common.schema.json#/$defs/id"}},"requiredEdges":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}},"requiredPaths":{"type":"array","items":{"$ref":"#/$defs/semanticRelation"}}}},"nodes":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","lane","col","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":5},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"width":{"type":"number","minimum":32},"height":{"type":"number","minimum":32},"yOffset":{"type":"number"}}}},"edges":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"role":{"enum":["main","branch","async","return","error"]},"fromSide":{"$ref":"#/$defs/side"},"toSide":{"$ref":"#/$defs/side"},"route":{"enum":["auto","straight","drop","outside-right","return-left","bottom-channel","up-channel"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"channelX":{"type":"number"},"channelY":{"type":"number"},"bias":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0.5}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}},"$defs":{"semanticRelation":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}},"side":{"enum":["left","right","top","bottom"]}}};const schema33 = {"enum":["en","zh-CN"]};const schema37 = {"enum":["auto","all","hidden"]};const schema38 = {"type":"object","additionalProperties":false,"minProperties":1,"properties":{"label":{"type":"string","minLength":1,"maxLength":80},"visible":{"type":"boolean"}}};const schema35 = {"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]*$"};const schema57 = {"enum":["frontend","backend","database","cloud","security","messagebus","external"]};const schema58 = {"oneOf":[{"type":"string","minLength":1,"maxLength":2048,"anyOf":[{"maxLength":80,"pattern":"^[^\\r\\n]+$"},{"pattern":"^https?://"}]},{"type":"object","additionalProperties":false,"required":["url","sha256"],"properties":{"url":{"type":"string","minLength":8,"maxLength":2048,"pattern":"^https?://"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}]};const schema62 = {"enum":["default","emphasis","security","dashed"]};const schema63 = {"enum":["left","right","top","bottom"]};const schema65 = {"type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false,"minItems":2,"maxItems":2};const schema67 = {"type":"array","items":{"type":"object","additionalProperties":false,"required":["dot","title","items"],"properties":{"dot":{"enum":["cyan","emerald","violet","amber","rose","orange","slate"]},"title":{"type":"string","minLength":1},"items":{"type":"array","items":{"type":"string"}}}}};const func1 = Object.prototype.hasOwnProperty;const func3 = function ucs2length(str) {const len = str.length;let length = 0;let pos = 0;@@ -10,4 +10,4 @@&& (str.charCodeAt(pos) & 0xfc00) === 0xdc00) pos += 1;}return length;-};const schema37 = {"type":"array","maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["id","label","focus"],"properties":{"id":{"$ref":"#/$defs/id"},"label":{"type":"string","minLength":1,"maxLength":48},"focus":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/id"}},"note":{"type":"string","maxLength":140}}}};const pattern4 = new RegExp("^[a-zA-Z][a-zA-Z0-9_-]*$", "u");function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate22.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate22.errors = vErrors;return errors === 0;}validate22.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};const pattern13 = new RegExp("^[^\\r\\n]+$", "u");const pattern14 = new RegExp("^https?://", "u");const pattern16 = new RegExp("^[a-f0-9]{64}$", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/workflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.edges === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "edges"},message:"must have required property '"+"edges"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(func1.call(schema31.properties, key0))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("workflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "workflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema31.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema34.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema35.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema36.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate22(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((((key3 === "frontend") || (key3 === "backend")) || (key3 === "database")) || (key3 === "cloud")) || (key3 === "security")) || (key3 === "messagebus")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.frontend !== undefined){let data14 = data13.frontend;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.backend !== undefined){let data17 = data13.backend;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.database !== undefined){let data20 = data13.database;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.cloud !== undefined){let data23 = data13.cloud;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.security !== undefined){let data26 = data13.security;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.messagebus !== undefined){let data29 = data13.messagebus;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.external !== undefined){let data32 = data13.external;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data2.viewBox !== undefined){let data35 = data2.viewBox;if(Array.isArray(data35)){if(data35.length > 2){const err73 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(data35.length < 2){const err74 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}const len0 = data35.length;if(len0 > 0){let data36 = data35[0];if((typeof data36 == "number") && (isFinite(data36))){if(data36 < 700 || isNaN(data36)){const err75 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 700},message:"must be >= 700"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}else {const err76 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(len0 > 1){let data37 = data35[1];if((typeof data37 == "number") && (isFinite(data37))){if(data37 < 240 || isNaN(data37)){const err77 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}else {const err78 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}const len1 = data35.length;if(!(len1 <= 2)){const err79 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}else {const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}}else {const err81 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data.lanes !== undefined){let data38 = data.lanes;if(Array.isArray(data38)){if(data38.length < 1){const err82 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}const len2 = data38.length;for(let i0=0; i0<len2; i0++){let data39 = data38[i0];if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.id === undefined){const err83 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(data39.label === undefined){const err84 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}for(const key11 in data39){if(!(((key11 === "id") || (key11 === "label")) || (key11 === "variant"))){const err85 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data39.id !== undefined){let data40 = data39.id;if(typeof data40 === "string"){if(!pattern4.test(data40)){const err86 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data39.label !== undefined){let data41 = data39.label;if(typeof data41 === "string"){if(func3(data41) < 1){const err88 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}else {const err89 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data39.variant !== undefined){let data42 = data39.variant;if(!((data42 === "normal") || (data42 === "exception"))){const err90 = {instancePath:instancePath+"/lanes/" + i0+"/variant",schemaPath:"#/properties/lanes/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.lanes.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}}else {const err91 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}else {const err92 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data.phases !== undefined){let data43 = data.phases;if(Array.isArray(data43)){const len3 = data43.length;for(let i1=0; i1<len3; i1++){let data44 = data43[i1];if(data44 && typeof data44 == "object" && !Array.isArray(data44)){if(data44.id === undefined){const err93 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}if(data44.label === undefined){const err94 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(data44.fromCol === undefined){const err95 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "fromCol"},message:"must have required property '"+"fromCol"+"'"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}if(data44.toCol === undefined){const err96 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "toCol"},message:"must have required property '"+"toCol"+"'"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}for(const key12 in data44){if(!(((((key12 === "id") || (key12 === "label")) || (key12 === "fromCol")) || (key12 === "toCol")) || (key12 === "variant"))){const err97 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}if(data44.id !== undefined){let data45 = data44.id;if(typeof data45 === "string"){if(!pattern4.test(data45)){const err98 = {instancePath:instancePath+"/phases/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/phases/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data44.label !== undefined){let data46 = data44.label;if(typeof data46 === "string"){if(func3(data46) < 1){const err100 = {instancePath:instancePath+"/phases/" + i1+"/label",schemaPath:"#/properties/phases/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/phases/" + i1+"/label",schemaPath:"#/properties/phases/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data44.fromCol !== undefined){let data47 = data44.fromCol;if(!(((typeof data47 == "number") && (!(data47 % 1) && !isNaN(data47))) && (isFinite(data47)))){const err102 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if((typeof data47 == "number") && (isFinite(data47))){if(data47 > 5 || isNaN(data47)){const err103 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(data47 < 0 || isNaN(data47)){const err104 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}}if(data44.toCol !== undefined){let data48 = data44.toCol;if(!(((typeof data48 == "number") && (!(data48 % 1) && !isNaN(data48))) && (isFinite(data48)))){const err105 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if((typeof data48 == "number") && (isFinite(data48))){if(data48 > 5 || isNaN(data48)){const err106 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data48 < 0 || isNaN(data48)){const err107 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}if(data44.variant !== undefined){let data49 = data44.variant;if(!((((data49 === "default") || (data49 === "emphasis")) || (data49 === "security")) || (data49 === "dashed"))){const err108 = {instancePath:instancePath+"/phases/" + i1+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}else {const err110 = {instancePath:instancePath+"/phases",schemaPath:"#/properties/phases/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.groups !== undefined){let data50 = data.groups;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2<len4; i2++){let data51 = data50[i2];if(data51 && typeof data51 == "object" && !Array.isArray(data51)){if(data51.id === undefined){const err111 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data51.label === undefined){const err112 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data51.lane === undefined){const err113 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}if(data51.fromCol === undefined){const err114 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "fromCol"},message:"must have required property '"+"fromCol"+"'"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(data51.toCol === undefined){const err115 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "toCol"},message:"must have required property '"+"toCol"+"'"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}for(const key13 in data51){if(!((((((key13 === "id") || (key13 === "label")) || (key13 === "lane")) || (key13 === "fromCol")) || (key13 === "toCol")) || (key13 === "variant"))){const err116 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data51.id !== undefined){let data52 = data51.id;if(typeof data52 === "string"){if(!pattern4.test(data52)){const err117 = {instancePath:instancePath+"/groups/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}else {const err118 = {instancePath:instancePath+"/groups/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data51.label !== undefined){let data53 = data51.label;if(typeof data53 === "string"){if(func3(data53) < 1){const err119 = {instancePath:instancePath+"/groups/" + i2+"/label",schemaPath:"#/properties/groups/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/groups/" + i2+"/label",schemaPath:"#/properties/groups/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data51.lane !== undefined){let data54 = data51.lane;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err121 = {instancePath:instancePath+"/groups/" + i2+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/groups/" + i2+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data51.fromCol !== undefined){let data55 = data51.fromCol;if(!(((typeof data55 == "number") && (!(data55 % 1) && !isNaN(data55))) && (isFinite(data55)))){const err123 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}if((typeof data55 == "number") && (isFinite(data55))){if(data55 > 5 || isNaN(data55)){const err124 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(data55 < 0 || isNaN(data55)){const err125 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}if(data51.toCol !== undefined){let data56 = data51.toCol;if(!(((typeof data56 == "number") && (!(data56 % 1) && !isNaN(data56))) && (isFinite(data56)))){const err126 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if((typeof data56 == "number") && (isFinite(data56))){if(data56 > 5 || isNaN(data56)){const err127 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if(data56 < 0 || isNaN(data56)){const err128 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}}if(data51.variant !== undefined){let data57 = data51.variant;if(!((((data57 === "default") || (data57 === "emphasis")) || (data57 === "security")) || (data57 === "dashed"))){const err129 = {instancePath:instancePath+"/groups/" + i2+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}else {const err131 = {instancePath:instancePath+"/groups",schemaPath:"#/properties/groups/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data.mainPath !== undefined){let data58 = data.mainPath;if(Array.isArray(data58)){if(data58.length < 2){const err132 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}const len5 = data58.length;for(let i3=0; i3<len5; i3++){let data59 = data58[i3];if(typeof data59 === "string"){if(!pattern4.test(data59)){const err133 = {instancePath:instancePath+"/mainPath/" + i3,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/mainPath/" + i3,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}}else {const err135 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data.nodes !== undefined){let data60 = data.nodes;if(Array.isArray(data60)){if(data60.length < 1){const err136 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}const len6 = data60.length;for(let i4=0; i4<len6; i4++){let data61 = data60[i4];if(data61 && typeof data61 == "object" && !Array.isArray(data61)){if(data61.id === undefined){const err137 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(data61.lane === undefined){const err138 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data61.col === undefined){const err139 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "col"},message:"must have required property '"+"col"+"'"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if(data61.type === undefined){const err140 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data61.label === undefined){const err141 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}for(const key14 in data61){if(!(func1.call(schema31.properties.nodes.items.properties, key14))){const err142 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data61.id !== undefined){let data62 = data61.id;if(typeof data62 === "string"){if(!pattern4.test(data62)){const err143 = {instancePath:instancePath+"/nodes/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}else {const err144 = {instancePath:instancePath+"/nodes/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data61.lane !== undefined){let data63 = data61.lane;if(typeof data63 === "string"){if(!pattern4.test(data63)){const err145 = {instancePath:instancePath+"/nodes/" + i4+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/nodes/" + i4+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data61.col !== undefined){let data64 = data61.col;if(!(((typeof data64 == "number") && (!(data64 % 1) && !isNaN(data64))) && (isFinite(data64)))){const err147 = {instancePath:instancePath+"/nodes/" + i4+"/col",schemaPath:"#/properties/nodes/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data64 == "number") && (isFinite(data64))){if(data64 > 5 || isNaN(data64)){const err148 = {instancePath:instancePath+"/nodes/" + i4+"/col",schemaPath:"#/properties/nodes/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}if(data64 < 0 || isNaN(data64)){const err149 = {instancePath:instancePath+"/nodes/" + i4+"/col",schemaPath:"#/properties/nodes/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}}if(data61.type !== undefined){let data65 = data61.type;if(!(((((((data65 === "frontend") || (data65 === "backend")) || (data65 === "database")) || (data65 === "cloud")) || (data65 === "security")) || (data65 === "messagebus")) || (data65 === "external"))){const err150 = {instancePath:instancePath+"/nodes/" + i4+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(data61.label !== undefined){let data66 = data61.label;if(typeof data66 === "string"){if(func3(data66) < 1){const err151 = {instancePath:instancePath+"/nodes/" + i4+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}else {const err152 = {instancePath:instancePath+"/nodes/" + i4+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}if(data61.sublabel !== undefined){if(typeof data61.sublabel !== "string"){const err153 = {instancePath:instancePath+"/nodes/" + i4+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}if(data61.tag !== undefined){if(typeof data61.tag !== "string"){const err154 = {instancePath:instancePath+"/nodes/" + i4+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data61.brand !== undefined){let data69 = data61.brand;const _errs166 = errors;let valid49 = false;let passing0 = null;const _errs167 = errors;const _errs169 = errors;let valid50 = false;const _errs170 = errors;if(typeof data69 === "string"){if(func3(data69) > 80){const err155 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}if(!pattern13.test(data69)){const err156 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}var _valid1 = _errs170 === errors;valid50 = valid50 || _valid1;const _errs171 = errors;if(typeof data69 === "string"){if(!pattern14.test(data69)){const err157 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}var _valid1 = _errs171 === errors;valid50 = valid50 || _valid1;if(!valid50){const err158 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}else {errors = _errs169;if(vErrors !== null){if(_errs169){vErrors.length = _errs169;}else {vErrors = null;}}}if(typeof data69 === "string"){if(func3(data69) > 2048){const err159 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(func3(data69) < 1){const err160 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}else {const err161 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}var _valid0 = _errs167 === errors;if(_valid0){valid49 = true;passing0 = 0;}const _errs172 = errors;if(data69 && typeof data69 == "object" && !Array.isArray(data69)){if(data69.url === undefined){const err162 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(data69.sha256 === undefined){const err163 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}for(const key15 in data69){if(!((key15 === "url") || (key15 === "sha256"))){const err164 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data69.url !== undefined){let data70 = data69.url;if(typeof data70 === "string"){if(func3(data70) > 2048){const err165 = {instancePath:instancePath+"/nodes/" + i4+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}if(func3(data70) < 8){const err166 = {instancePath:instancePath+"/nodes/" + i4+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(!pattern14.test(data70)){const err167 = {instancePath:instancePath+"/nodes/" + i4+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}else {const err168 = {instancePath:instancePath+"/nodes/" + i4+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}if(data69.sha256 !== undefined){let data71 = data69.sha256;if(typeof data71 === "string"){if(!pattern16.test(data71)){const err169 = {instancePath:instancePath+"/nodes/" + i4+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}else {const err170 = {instancePath:instancePath+"/nodes/" + i4+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}}else {const err171 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}var _valid0 = _errs172 === errors;if(_valid0 && valid49){valid49 = false;passing0 = [passing0, 1];}else {if(_valid0){valid49 = true;passing0 = 1;}}if(!valid49){const err172 = {instancePath:instancePath+"/nodes/" + i4+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}else {errors = _errs166;if(vErrors !== null){if(_errs166){vErrors.length = _errs166;}else {vErrors = null;}}}}if(data61.width !== undefined){let data72 = data61.width;if((typeof data72 == "number") && (isFinite(data72))){if(data72 < 32 || isNaN(data72)){const err173 = {instancePath:instancePath+"/nodes/" + i4+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}else {const err174 = {instancePath:instancePath+"/nodes/" + i4+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}if(data61.height !== undefined){let data73 = data61.height;if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 32 || isNaN(data73)){const err175 = {instancePath:instancePath+"/nodes/" + i4+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}else {const err176 = {instancePath:instancePath+"/nodes/" + i4+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(data61.yOffset !== undefined){let data74 = data61.yOffset;if(!((typeof data74 == "number") && (isFinite(data74)))){const err177 = {instancePath:instancePath+"/nodes/" + i4+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}}else {const err178 = {instancePath:instancePath+"/nodes/" + i4,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}else {const err179 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data.edges !== undefined){let data75 = data.edges;if(Array.isArray(data75)){const len7 = data75.length;for(let i5=0; i5<len7; i5++){let data76 = data75[i5];if(data76 && typeof data76 == "object" && !Array.isArray(data76)){if(data76.from === undefined){const err180 = {instancePath:instancePath+"/edges/" + i5,schemaPath:"#/properties/edges/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}if(data76.to === undefined){const err181 = {instancePath:instancePath+"/edges/" + i5,schemaPath:"#/properties/edges/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}for(const key16 in data76){if(!(func1.call(schema31.properties.edges.items.properties, key16))){const err182 = {instancePath:instancePath+"/edges/" + i5,schemaPath:"#/properties/edges/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}if(data76.id !== undefined){let data77 = data76.id;if(typeof data77 === "string"){if(!pattern4.test(data77)){const err183 = {instancePath:instancePath+"/edges/" + i5+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}else {const err184 = {instancePath:instancePath+"/edges/" + i5+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}if(data76.from !== undefined){let data78 = data76.from;if(typeof data78 === "string"){if(!pattern4.test(data78)){const err185 = {instancePath:instancePath+"/edges/" + i5+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}else {const err186 = {instancePath:instancePath+"/edges/" + i5+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data76.to !== undefined){let data79 = data76.to;if(typeof data79 === "string"){if(!pattern4.test(data79)){const err187 = {instancePath:instancePath+"/edges/" + i5+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}else {const err188 = {instancePath:instancePath+"/edges/" + i5+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}if(data76.label !== undefined){if(typeof data76.label !== "string"){const err189 = {instancePath:instancePath+"/edges/" + i5+"/label",schemaPath:"#/properties/edges/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}if(data76.variant !== undefined){let data81 = data76.variant;if(!((((data81 === "default") || (data81 === "emphasis")) || (data81 === "security")) || (data81 === "dashed"))){const err190 = {instancePath:instancePath+"/edges/" + i5+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data76.role !== undefined){let data82 = data76.role;if(!(((((data82 === "main") || (data82 === "branch")) || (data82 === "async")) || (data82 === "return")) || (data82 === "error"))){const err191 = {instancePath:instancePath+"/edges/" + i5+"/role",schemaPath:"#/properties/edges/items/properties/role/enum",keyword:"enum",params:{allowedValues: schema31.properties.edges.items.properties.role.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}if(data76.fromSide !== undefined){let data83 = data76.fromSide;if(!((((data83 === "left") || (data83 === "right")) || (data83 === "top")) || (data83 === "bottom"))){const err192 = {instancePath:instancePath+"/edges/" + i5+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}if(data76.toSide !== undefined){let data84 = data76.toSide;if(!((((data84 === "left") || (data84 === "right")) || (data84 === "top")) || (data84 === "bottom"))){const err193 = {instancePath:instancePath+"/edges/" + i5+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data76.route !== undefined){let data85 = data76.route;if(!(((((((data85 === "auto") || (data85 === "straight")) || (data85 === "drop")) || (data85 === "outside-right")) || (data85 === "return-left")) || (data85 === "bottom-channel")) || (data85 === "up-channel"))){const err194 = {instancePath:instancePath+"/edges/" + i5+"/route",schemaPath:"#/properties/edges/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema31.properties.edges.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}if(data76.via !== undefined){let data86 = data76.via;if(Array.isArray(data86)){const len8 = data86.length;for(let i6=0; i6<len8; i6++){let data87 = data86[i6];if(Array.isArray(data87)){if(data87.length > 2){const err195 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}if(data87.length < 2){const err196 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}const len9 = data87.length;if(len9 > 0){let data88 = data87[0];if(!((typeof data88 == "number") && (isFinite(data88)))){const err197 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}if(len9 > 1){let data89 = data87[1];if(!((typeof data89 == "number") && (isFinite(data89)))){const err198 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}const len10 = data87.length;if(!(len10 <= 2)){const err199 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}else {const err200 = {instancePath:instancePath+"/edges/" + i5+"/via/" + i6,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}}else {const err201 = {instancePath:instancePath+"/edges/" + i5+"/via",schemaPath:"#/properties/edges/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data76.labelAt !== undefined){let data90 = data76.labelAt;if(Array.isArray(data90)){if(data90.length > 2){const err202 = {instancePath:instancePath+"/edges/" + i5+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}if(data90.length < 2){const err203 = {instancePath:instancePath+"/edges/" + i5+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}const len11 = data90.length;if(len11 > 0){let data91 = data90[0];if(!((typeof data91 == "number") && (isFinite(data91)))){const err204 = {instancePath:instancePath+"/edges/" + i5+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}if(len11 > 1){let data92 = data90[1];if(!((typeof data92 == "number") && (isFinite(data92)))){const err205 = {instancePath:instancePath+"/edges/" + i5+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}const len12 = data90.length;if(!(len12 <= 2)){const err206 = {instancePath:instancePath+"/edges/" + i5+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}}else {const err207 = {instancePath:instancePath+"/edges/" + i5+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}if(data76.labelDx !== undefined){let data93 = data76.labelDx;if(!((typeof data93 == "number") && (isFinite(data93)))){const err208 = {instancePath:instancePath+"/edges/" + i5+"/labelDx",schemaPath:"#/properties/edges/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(data76.labelDy !== undefined){let data94 = data76.labelDy;if(!((typeof data94 == "number") && (isFinite(data94)))){const err209 = {instancePath:instancePath+"/edges/" + i5+"/labelDy",schemaPath:"#/properties/edges/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}if(data76.labelSegment !== undefined){let data95 = data76.labelSegment;if(!(((typeof data95 == "number") && (!(data95 % 1) && !isNaN(data95))) && (isFinite(data95)))){const err210 = {instancePath:instancePath+"/edges/" + i5+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}if((typeof data95 == "number") && (isFinite(data95))){if(data95 < 0 || isNaN(data95)){const err211 = {instancePath:instancePath+"/edges/" + i5+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}}if(data76.channelX !== undefined){let data96 = data76.channelX;if(!((typeof data96 == "number") && (isFinite(data96)))){const err212 = {instancePath:instancePath+"/edges/" + i5+"/channelX",schemaPath:"#/properties/edges/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}if(data76.channelY !== undefined){let data97 = data76.channelY;if(!((typeof data97 == "number") && (isFinite(data97)))){const err213 = {instancePath:instancePath+"/edges/" + i5+"/channelY",schemaPath:"#/properties/edges/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}}if(data76.bias !== undefined){let data98 = data76.bias;if((typeof data98 == "number") && (isFinite(data98))){if(data98 > 1 || isNaN(data98)){const err214 = {instancePath:instancePath+"/edges/" + i5+"/bias",schemaPath:"#/properties/edges/items/properties/bias/maximum",keyword:"maximum",params:{comparison: "<=", limit: 1},message:"must be <= 1"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}if(data98 < 0 || isNaN(data98)){const err215 = {instancePath:instancePath+"/edges/" + i5+"/bias",schemaPath:"#/properties/edges/items/properties/bias/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}else {const err216 = {instancePath:instancePath+"/edges/" + i5+"/bias",schemaPath:"#/properties/edges/items/properties/bias/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}if(data76.width !== undefined){let data99 = data76.width;if((typeof data99 == "number") && (isFinite(data99))){if(data99 < 0.5 || isNaN(data99)){const err217 = {instancePath:instancePath+"/edges/" + i5+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}else {const err218 = {instancePath:instancePath+"/edges/" + i5+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}}else {const err219 = {instancePath:instancePath+"/edges/" + i5,schemaPath:"#/properties/edges/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}}else {const err220 = {instancePath:instancePath+"/edges",schemaPath:"#/properties/edges/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data.cards !== undefined){let data100 = data.cards;if(Array.isArray(data100)){const len13 = data100.length;for(let i7=0; i7<len13; i7++){let data101 = data100[i7];if(data101 && typeof data101 == "object" && !Array.isArray(data101)){if(data101.dot === undefined){const err221 = {instancePath:instancePath+"/cards/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if(data101.title === undefined){const err222 = {instancePath:instancePath+"/cards/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}if(data101.items === undefined){const err223 = {instancePath:instancePath+"/cards/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}for(const key17 in data101){if(!(((key17 === "dot") || (key17 === "title")) || (key17 === "items"))){const err224 = {instancePath:instancePath+"/cards/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key17},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}if(data101.dot !== undefined){let data102 = data101.dot;if(!(((((((data102 === "cyan") || (data102 === "emerald")) || (data102 === "violet")) || (data102 === "amber")) || (data102 === "rose")) || (data102 === "orange")) || (data102 === "slate"))){const err225 = {instancePath:instancePath+"/cards/" + i7+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema68.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}if(data101.title !== undefined){let data103 = data101.title;if(typeof data103 === "string"){if(func3(data103) < 1){const err226 = {instancePath:instancePath+"/cards/" + i7+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}}else {const err227 = {instancePath:instancePath+"/cards/" + i7+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}if(data101.items !== undefined){let data104 = data101.items;if(Array.isArray(data104)){const len14 = data104.length;for(let i8=0; i8<len14; i8++){if(typeof data104[i8] !== "string"){const err228 = {instancePath:instancePath+"/cards/" + i7+"/items/" + i8,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}}else {const err229 = {instancePath:instancePath+"/cards/" + i7+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}}else {const err230 = {instancePath:instancePath+"/cards/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}}else {const err231 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}}else {const err232 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const sequence = validate24;const schema69 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/sequence.schema.json","title":"Archify Sequence Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","participants","messages"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"sequence"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"column_fit":{"description":"Horizontal participant layout. Omit this field or use fixed for the stable 86px boxes and 108px gap. Use spread when a wide viewBox would leave unused horizontal space or meaningful participant labels do not fit the fixed boxes; spread derives wider boxes and gaps from the viewBox without changing participant order or message semantics.","enum":["fixed","spread"]},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"default":{"$ref":"common.schema.json#/$defs/legendEntry"},"emphasis":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"dashed":{"$ref":"common.schema.json#/$defs/legendEntry"},"return":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":480},{"type":"number","minimum":480}],"items":false,"minItems":2,"maxItems":2}}},"participants":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"}}}},"segments":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to","label"],"properties":{"from":{"type":"number"},"to":{"type":"number"},"label":{"type":"string","minLength":1}}}},"messages":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["from","to","y","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"y":{"type":"number","minimum":160},"label":{"type":"string","minLength":1},"variant":{"enum":["default","emphasis","security","dashed","return"]},"note":{"type":"string"}}}},"activations":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["participant","from","to"],"properties":{"participant":{"$ref":"common.schema.json#/$defs/id"},"from":{"type":"number"},"to":{"type":"number"},"type":{"$ref":"common.schema.json#/$defs/componentType"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};function validate25(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate25.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate25.errors = vErrors;return errors === 0;}validate25.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/sequence.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate24.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.participants === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "participants"},message:"must have required property '"+"participants"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.messages === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messages"},message:"must have required property '"+"messages"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "participants")) || (key0 === "segments")) || (key0 === "messages")) || (key0 === "activations")) || (key0 === "cards"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err6 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.diagram_type !== undefined){if("sequence" !== data.diagram_type){const err7 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "sequence"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key1 in data2){if(!(func1.call(schema69.properties.meta.properties, key1))){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err12 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err13 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err14 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err15 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema34.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err16 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema35.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err17 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema36.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.column_fit !== undefined){let data10 = data2.column_fit;if(!((data10 === "fixed") || (data10 === "spread"))){const err18 = {instancePath:instancePath+"/meta/column_fit",schemaPath:"#/properties/meta/properties/column_fit/enum",keyword:"enum",params:{allowedValues: schema69.properties.meta.properties.column_fit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate25(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate25.errors : vErrors.concat(validate25.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data12 = data2.legend;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){for(const key2 in data12){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data12.mode !== undefined){let data13 = data12.mode;if(!(((data13 === "auto") || (data13 === "all")) || (data13 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data12.entries !== undefined){let data14 = data12.entries;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){for(const key3 in data14){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "return"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data14.default !== undefined){let data15 = data14.default;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(Object.keys(data15).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data15){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data15.label !== undefined){let data16 = data15.label;if(typeof data16 === "string"){if(func3(data16) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data16) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data15.visible !== undefined){if(typeof data15.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data14.emphasis !== undefined){let data18 = data14.emphasis;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(Object.keys(data18).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data18){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data18.label !== undefined){let data19 = data18.label;if(typeof data19 === "string"){if(func3(data19) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data19) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data18.visible !== undefined){if(typeof data18.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data14.security !== undefined){let data21 = data14.security;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data21){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data22) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data14.dashed !== undefined){let data24 = data14.dashed;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data24){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data25) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data14.return !== undefined){let data27 = data14.return;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data27){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data28) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/return/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data30 = data2.viewBox;if(Array.isArray(data30)){if(data30.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data30.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data30.length;if(len0 > 0){let data31 = data30[0];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 480 || isNaN(data31)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data32 = data30[1];if((typeof data32 == "number") && (isFinite(data32))){if(data32 < 480 || isNaN(data32)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data30.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.participants !== undefined){let data33 = data.participants;if(Array.isArray(data33)){if(data33.length < 2){const err68 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}const len2 = data33.length;for(let i0=0; i0<len2; i0++){let data34 = data33[i0];if(data34 && typeof data34 == "object" && !Array.isArray(data34)){if(data34.id === undefined){const err69 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(data34.type === undefined){const err70 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(data34.label === undefined){const err71 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key9 in data34){if(!(((((key9 === "id") || (key9 === "type")) || (key9 === "label")) || (key9 === "sublabel")) || (key9 === "brand"))){const err72 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data34.id !== undefined){let data35 = data34.id;if(typeof data35 === "string"){if(!pattern4.test(data35)){const err73 = {instancePath:instancePath+"/participants/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}else {const err74 = {instancePath:instancePath+"/participants/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data34.type !== undefined){let data36 = data34.type;if(!(((((((data36 === "frontend") || (data36 === "backend")) || (data36 === "database")) || (data36 === "cloud")) || (data36 === "security")) || (data36 === "messagebus")) || (data36 === "external"))){const err75 = {instancePath:instancePath+"/participants/" + i0+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data34.label !== undefined){let data37 = data34.label;if(typeof data37 === "string"){if(func3(data37) < 1){const err76 = {instancePath:instancePath+"/participants/" + i0+"/label",schemaPath:"#/properties/participants/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/participants/" + i0+"/label",schemaPath:"#/properties/participants/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data34.sublabel !== undefined){if(typeof data34.sublabel !== "string"){const err78 = {instancePath:instancePath+"/participants/" + i0+"/sublabel",schemaPath:"#/properties/participants/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}if(data34.brand !== undefined){let data39 = data34.brand;const _errs93 = errors;let valid26 = false;let passing0 = null;const _errs94 = errors;const _errs96 = errors;let valid27 = false;const _errs97 = errors;if(typeof data39 === "string"){if(func3(data39) > 80){const err79 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(!pattern13.test(data39)){const err80 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}var _valid1 = _errs97 === errors;valid27 = valid27 || _valid1;const _errs98 = errors;if(typeof data39 === "string"){if(!pattern14.test(data39)){const err81 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}var _valid1 = _errs98 === errors;valid27 = valid27 || _valid1;if(!valid27){const err82 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}else {errors = _errs96;if(vErrors !== null){if(_errs96){vErrors.length = _errs96;}else {vErrors = null;}}}if(typeof data39 === "string"){if(func3(data39) > 2048){const err83 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(func3(data39) < 1){const err84 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}var _valid0 = _errs94 === errors;if(_valid0){valid26 = true;passing0 = 0;}const _errs99 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.url === undefined){const err86 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}if(data39.sha256 === undefined){const err87 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key10 in data39){if(!((key10 === "url") || (key10 === "sha256"))){const err88 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data39.url !== undefined){let data40 = data39.url;if(typeof data40 === "string"){if(func3(data40) > 2048){const err89 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data40) < 8){const err90 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern14.test(data40)){const err91 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}else {const err92 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data39.sha256 !== undefined){let data41 = data39.sha256;if(typeof data41 === "string"){if(!pattern16.test(data41)){const err93 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}else {const err94 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}}else {const err95 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}var _valid0 = _errs99 === errors;if(_valid0 && valid26){valid26 = false;passing0 = [passing0, 1];}else {if(_valid0){valid26 = true;passing0 = 1;}}if(!valid26){const err96 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}else {errors = _errs93;if(vErrors !== null){if(_errs93){vErrors.length = _errs93;}else {vErrors = null;}}}}}else {const err97 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}}else {const err98 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data.segments !== undefined){let data42 = data.segments;if(Array.isArray(data42)){const len3 = data42.length;for(let i1=0; i1<len3; i1++){let data43 = data42[i1];if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.from === undefined){const err99 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(data43.to === undefined){const err100 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(data43.label === undefined){const err101 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}for(const key11 in data43){if(!(((key11 === "from") || (key11 === "to")) || (key11 === "label"))){const err102 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data43.from !== undefined){let data44 = data43.from;if(!((typeof data44 == "number") && (isFinite(data44)))){const err103 = {instancePath:instancePath+"/segments/" + i1+"/from",schemaPath:"#/properties/segments/items/properties/from/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data43.to !== undefined){let data45 = data43.to;if(!((typeof data45 == "number") && (isFinite(data45)))){const err104 = {instancePath:instancePath+"/segments/" + i1+"/to",schemaPath:"#/properties/segments/items/properties/to/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data43.label !== undefined){let data46 = data43.label;if(typeof data46 === "string"){if(func3(data46) < 1){const err105 = {instancePath:instancePath+"/segments/" + i1+"/label",schemaPath:"#/properties/segments/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}else {const err106 = {instancePath:instancePath+"/segments/" + i1+"/label",schemaPath:"#/properties/segments/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}}else {const err107 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}else {const err108 = {instancePath:instancePath+"/segments",schemaPath:"#/properties/segments/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data.messages !== undefined){let data47 = data.messages;if(Array.isArray(data47)){if(data47.length < 1){const err109 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}const len4 = data47.length;for(let i2=0; i2<len4; i2++){let data48 = data47[i2];if(data48 && typeof data48 == "object" && !Array.isArray(data48)){if(data48.from === undefined){const err110 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(data48.to === undefined){const err111 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data48.y === undefined){const err112 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "y"},message:"must have required property '"+"y"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data48.label === undefined){const err113 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}for(const key12 in data48){if(!(((((((key12 === "id") || (key12 === "from")) || (key12 === "to")) || (key12 === "y")) || (key12 === "label")) || (key12 === "variant")) || (key12 === "note"))){const err114 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data48.id !== undefined){let data49 = data48.id;if(typeof data49 === "string"){if(!pattern4.test(data49)){const err115 = {instancePath:instancePath+"/messages/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}else {const err116 = {instancePath:instancePath+"/messages/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data48.from !== undefined){let data50 = data48.from;if(typeof data50 === "string"){if(!pattern4.test(data50)){const err117 = {instancePath:instancePath+"/messages/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}else {const err118 = {instancePath:instancePath+"/messages/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data48.to !== undefined){let data51 = data48.to;if(typeof data51 === "string"){if(!pattern4.test(data51)){const err119 = {instancePath:instancePath+"/messages/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/messages/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data48.y !== undefined){let data52 = data48.y;if((typeof data52 == "number") && (isFinite(data52))){if(data52 < 160 || isNaN(data52)){const err121 = {instancePath:instancePath+"/messages/" + i2+"/y",schemaPath:"#/properties/messages/items/properties/y/minimum",keyword:"minimum",params:{comparison: ">=", limit: 160},message:"must be >= 160"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/messages/" + i2+"/y",schemaPath:"#/properties/messages/items/properties/y/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data48.label !== undefined){let data53 = data48.label;if(typeof data53 === "string"){if(func3(data53) < 1){const err123 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data48.variant !== undefined){let data54 = data48.variant;if(!(((((data54 === "default") || (data54 === "emphasis")) || (data54 === "security")) || (data54 === "dashed")) || (data54 === "return"))){const err125 = {instancePath:instancePath+"/messages/" + i2+"/variant",schemaPath:"#/properties/messages/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema69.properties.messages.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}if(data48.note !== undefined){if(typeof data48.note !== "string"){const err126 = {instancePath:instancePath+"/messages/" + i2+"/note",schemaPath:"#/properties/messages/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}}else {const err127 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}}else {const err128 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data.activations !== undefined){let data56 = data.activations;if(Array.isArray(data56)){const len5 = data56.length;for(let i3=0; i3<len5; i3++){let data57 = data56[i3];if(data57 && typeof data57 == "object" && !Array.isArray(data57)){if(data57.participant === undefined){const err129 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "participant"},message:"must have required property '"+"participant"+"'"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(data57.from === undefined){const err130 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}if(data57.to === undefined){const err131 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}for(const key13 in data57){if(!((((key13 === "participant") || (key13 === "from")) || (key13 === "to")) || (key13 === "type"))){const err132 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data57.participant !== undefined){let data58 = data57.participant;if(typeof data58 === "string"){if(!pattern4.test(data58)){const err133 = {instancePath:instancePath+"/activations/" + i3+"/participant",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/activations/" + i3+"/participant",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data57.from !== undefined){let data59 = data57.from;if(!((typeof data59 == "number") && (isFinite(data59)))){const err135 = {instancePath:instancePath+"/activations/" + i3+"/from",schemaPath:"#/properties/activations/items/properties/from/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data57.to !== undefined){let data60 = data57.to;if(!((typeof data60 == "number") && (isFinite(data60)))){const err136 = {instancePath:instancePath+"/activations/" + i3+"/to",schemaPath:"#/properties/activations/items/properties/to/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}if(data57.type !== undefined){let data61 = data57.type;if(!(((((((data61 === "frontend") || (data61 === "backend")) || (data61 === "database")) || (data61 === "cloud")) || (data61 === "security")) || (data61 === "messagebus")) || (data61 === "external"))){const err137 = {instancePath:instancePath+"/activations/" + i3+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}else {const err138 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}}else {const err139 = {instancePath:instancePath+"/activations",schemaPath:"#/properties/activations/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data.cards !== undefined){let data62 = data.cards;if(Array.isArray(data62)){const len6 = data62.length;for(let i4=0; i4<len6; i4++){let data63 = data62[i4];if(data63 && typeof data63 == "object" && !Array.isArray(data63)){if(data63.dot === undefined){const err140 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data63.title === undefined){const err141 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}if(data63.items === undefined){const err142 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}for(const key14 in data63){if(!(((key14 === "dot") || (key14 === "title")) || (key14 === "items"))){const err143 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data63.dot !== undefined){let data64 = data63.dot;if(!(((((((data64 === "cyan") || (data64 === "emerald")) || (data64 === "violet")) || (data64 === "amber")) || (data64 === "rose")) || (data64 === "orange")) || (data64 === "slate"))){const err144 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema68.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data63.title !== undefined){let data65 = data63.title;if(typeof data65 === "string"){if(func3(data65) < 1){const err145 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data63.items !== undefined){let data66 = data63.items;if(Array.isArray(data66)){const len7 = data66.length;for(let i5=0; i5<len7; i5++){if(typeof data66[i5] !== "string"){const err147 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}}else {const err148 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}else {const err149 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}}else {const err150 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}else {const err151 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}validate24.errors = vErrors;return errors === 0;}validate24.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const dataflow = validate27;const schema92 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/dataflow.schema.json","title":"Archify Data Flow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","stages","nodes","flows"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"dataflow"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"default":{"$ref":"common.schema.json#/$defs/legendEntry"},"emphasis":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"dashed":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":360},{"type":"number","minimum":360}],"items":false,"minItems":2,"maxItems":2}}},"stages":{"type":"array","minItems":2,"maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["label"],"properties":{"label":{"type":"string","minLength":1}}}},"nodes":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label","stage","row"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"stage":{"type":"integer","minimum":0},"row":{"type":"integer","minimum":0},"width":{"type":"number","minimum":48},"height":{"type":"number","minimum":36},"yOffset":{"type":"number"}}}},"flows":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"classification":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"route":{"enum":["auto","straight","vertical-channel","bottom-channel","top-channel"]},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"channelX":{"type":"number"},"channelY":{"type":"number"},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};function validate28(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate28.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate28.errors = vErrors;return errors === 0;}validate28.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/dataflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate27.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.stages === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "stages"},message:"must have required property '"+"stages"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.flows === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "flows"},message:"must have required property '"+"flows"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "stages")) || (key0 === "nodes")) || (key0 === "flows")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("dataflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "dataflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema92.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema34.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema35.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema36.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate28(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate28.errors : vErrors.concat(validate28.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "database"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.default !== undefined){let data14 = data13.default;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.emphasis !== undefined){let data17 = data13.emphasis;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.security !== undefined){let data20 = data13.security;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.dashed !== undefined){let data23 = data13.dashed;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.database !== undefined){let data26 = data13.database;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data29 = data2.viewBox;if(Array.isArray(data29)){if(data29.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data29.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data29.length;if(len0 > 0){let data30 = data29[0];if((typeof data30 == "number") && (isFinite(data30))){if(data30 < 360 || isNaN(data30)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data31 = data29[1];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 360 || isNaN(data31)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data29.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.stages !== undefined){let data32 = data.stages;if(Array.isArray(data32)){if(data32.length > 5){const err68 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(data32.length < 2){const err69 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}const len2 = data32.length;for(let i0=0; i0<len2; i0++){let data33 = data32[i0];if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.label === undefined){const err70 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}for(const key9 in data33){if(!(key9 === "label")){const err71 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) < 1){const err72 = {instancePath:instancePath+"/stages/" + i0+"/label",schemaPath:"#/properties/stages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}else {const err73 = {instancePath:instancePath+"/stages/" + i0+"/label",schemaPath:"#/properties/stages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}}else {const err74 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}}else {const err75 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data.nodes !== undefined){let data35 = data.nodes;if(Array.isArray(data35)){if(data35.length < 2){const err76 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}const len3 = data35.length;for(let i1=0; i1<len3; i1++){let data36 = data35[i1];if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(data36.id === undefined){const err77 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data36.type === undefined){const err78 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data36.label === undefined){const err79 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(data36.stage === undefined){const err80 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "stage"},message:"must have required property '"+"stage"+"'"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data36.row === undefined){const err81 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "row"},message:"must have required property '"+"row"+"'"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}for(const key10 in data36){if(!(func1.call(schema92.properties.nodes.items.properties, key10))){const err82 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}if(data36.id !== undefined){let data37 = data36.id;if(typeof data37 === "string"){if(!pattern4.test(data37)){const err83 = {instancePath:instancePath+"/nodes/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/nodes/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data36.type !== undefined){let data38 = data36.type;if(!(((((((data38 === "frontend") || (data38 === "backend")) || (data38 === "database")) || (data38 === "cloud")) || (data38 === "security")) || (data38 === "messagebus")) || (data38 === "external"))){const err85 = {instancePath:instancePath+"/nodes/" + i1+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data36.label !== undefined){let data39 = data36.label;if(typeof data39 === "string"){if(func3(data39) < 1){const err86 = {instancePath:instancePath+"/nodes/" + i1+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/nodes/" + i1+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data36.sublabel !== undefined){if(typeof data36.sublabel !== "string"){const err88 = {instancePath:instancePath+"/nodes/" + i1+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data36.tag !== undefined){if(typeof data36.tag !== "string"){const err89 = {instancePath:instancePath+"/nodes/" + i1+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data36.brand !== undefined){let data42 = data36.brand;const _errs101 = errors;let valid29 = false;let passing0 = null;const _errs102 = errors;const _errs104 = errors;let valid30 = false;const _errs105 = errors;if(typeof data42 === "string"){if(func3(data42) > 80){const err90 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern13.test(data42)){const err91 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}var _valid1 = _errs105 === errors;valid30 = valid30 || _valid1;const _errs106 = errors;if(typeof data42 === "string"){if(!pattern14.test(data42)){const err92 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}var _valid1 = _errs106 === errors;valid30 = valid30 || _valid1;if(!valid30){const err93 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}else {errors = _errs104;if(vErrors !== null){if(_errs104){vErrors.length = _errs104;}else {vErrors = null;}}}if(typeof data42 === "string"){if(func3(data42) > 2048){const err94 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(func3(data42) < 1){const err95 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}else {const err96 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}var _valid0 = _errs102 === errors;if(_valid0){valid29 = true;passing0 = 0;}const _errs107 = errors;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.url === undefined){const err97 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(data42.sha256 === undefined){const err98 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}for(const key11 in data42){if(!((key11 === "url") || (key11 === "sha256"))){const err99 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data42.url !== undefined){let data43 = data42.url;if(typeof data43 === "string"){if(func3(data43) > 2048){const err100 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func3(data43) < 8){const err101 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(!pattern14.test(data43)){const err102 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data42.sha256 !== undefined){let data44 = data42.sha256;if(typeof data44 === "string"){if(!pattern16.test(data44)){const err104 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}else {const err106 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}var _valid0 = _errs107 === errors;if(_valid0 && valid29){valid29 = false;passing0 = [passing0, 1];}else {if(_valid0){valid29 = true;passing0 = 1;}}if(!valid29){const err107 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}else {errors = _errs101;if(vErrors !== null){if(_errs101){vErrors.length = _errs101;}else {vErrors = null;}}}}if(data36.stage !== undefined){let data45 = data36.stage;if(!(((typeof data45 == "number") && (!(data45 % 1) && !isNaN(data45))) && (isFinite(data45)))){const err108 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}if((typeof data45 == "number") && (isFinite(data45))){if(data45 < 0 || isNaN(data45)){const err109 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}if(data36.row !== undefined){let data46 = data36.row;if(!(((typeof data46 == "number") && (!(data46 % 1) && !isNaN(data46))) && (isFinite(data46)))){const err110 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if((typeof data46 == "number") && (isFinite(data46))){if(data46 < 0 || isNaN(data46)){const err111 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}}if(data36.width !== undefined){let data47 = data36.width;if((typeof data47 == "number") && (isFinite(data47))){if(data47 < 48 || isNaN(data47)){const err112 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}else {const err113 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data36.height !== undefined){let data48 = data36.height;if((typeof data48 == "number") && (isFinite(data48))){if(data48 < 36 || isNaN(data48)){const err114 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}else {const err115 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data36.yOffset !== undefined){let data49 = data36.yOffset;if(!((typeof data49 == "number") && (isFinite(data49)))){const err116 = {instancePath:instancePath+"/nodes/" + i1+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}else {const err118 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data.flows !== undefined){let data50 = data.flows;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2<len4; i2++){let data51 = data50[i2];if(data51 && typeof data51 == "object" && !Array.isArray(data51)){if(data51.from === undefined){const err119 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}if(data51.to === undefined){const err120 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}if(data51.label === undefined){const err121 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}for(const key12 in data51){if(!(func1.call(schema92.properties.flows.items.properties, key12))){const err122 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data51.id !== undefined){let data52 = data51.id;if(typeof data52 === "string"){if(!pattern4.test(data52)){const err123 = {instancePath:instancePath+"/flows/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/flows/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data51.from !== undefined){let data53 = data51.from;if(typeof data53 === "string"){if(!pattern4.test(data53)){const err125 = {instancePath:instancePath+"/flows/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}else {const err126 = {instancePath:instancePath+"/flows/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}if(data51.to !== undefined){let data54 = data51.to;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err127 = {instancePath:instancePath+"/flows/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}else {const err128 = {instancePath:instancePath+"/flows/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data51.label !== undefined){let data55 = data51.label;if(typeof data55 === "string"){if(func3(data55) < 1){const err129 = {instancePath:instancePath+"/flows/" + i2+"/label",schemaPath:"#/properties/flows/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}else {const err130 = {instancePath:instancePath+"/flows/" + i2+"/label",schemaPath:"#/properties/flows/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}if(data51.classification !== undefined){if(typeof data51.classification !== "string"){const err131 = {instancePath:instancePath+"/flows/" + i2+"/classification",schemaPath:"#/properties/flows/items/properties/classification/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data51.variant !== undefined){let data57 = data51.variant;if(!((((data57 === "default") || (data57 === "emphasis")) || (data57 === "security")) || (data57 === "dashed"))){const err132 = {instancePath:instancePath+"/flows/" + i2+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data51.route !== undefined){let data58 = data51.route;if(!(((((data58 === "auto") || (data58 === "straight")) || (data58 === "vertical-channel")) || (data58 === "bottom-channel")) || (data58 === "top-channel"))){const err133 = {instancePath:instancePath+"/flows/" + i2+"/route",schemaPath:"#/properties/flows/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema92.properties.flows.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(data51.fromSide !== undefined){let data59 = data51.fromSide;if(!((((data59 === "left") || (data59 === "right")) || (data59 === "top")) || (data59 === "bottom"))){const err134 = {instancePath:instancePath+"/flows/" + i2+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data51.toSide !== undefined){let data60 = data51.toSide;if(!((((data60 === "left") || (data60 === "right")) || (data60 === "top")) || (data60 === "bottom"))){const err135 = {instancePath:instancePath+"/flows/" + i2+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data51.channelX !== undefined){let data61 = data51.channelX;if(!((typeof data61 == "number") && (isFinite(data61)))){const err136 = {instancePath:instancePath+"/flows/" + i2+"/channelX",schemaPath:"#/properties/flows/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}if(data51.channelY !== undefined){let data62 = data51.channelY;if(!((typeof data62 == "number") && (isFinite(data62)))){const err137 = {instancePath:instancePath+"/flows/" + i2+"/channelY",schemaPath:"#/properties/flows/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}if(data51.labelAt !== undefined){let data63 = data51.labelAt;if(Array.isArray(data63)){if(data63.length > 2){const err138 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data63.length < 2){const err139 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}const len5 = data63.length;if(len5 > 0){let data64 = data63[0];if(!((typeof data64 == "number") && (isFinite(data64)))){const err140 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(len5 > 1){let data65 = data63[1];if(!((typeof data65 == "number") && (isFinite(data65)))){const err141 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}const len6 = data63.length;if(!(len6 <= 2)){const err142 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}else {const err143 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data51.labelDx !== undefined){let data66 = data51.labelDx;if(!((typeof data66 == "number") && (isFinite(data66)))){const err144 = {instancePath:instancePath+"/flows/" + i2+"/labelDx",schemaPath:"#/properties/flows/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data51.labelDy !== undefined){let data67 = data51.labelDy;if(!((typeof data67 == "number") && (isFinite(data67)))){const err145 = {instancePath:instancePath+"/flows/" + i2+"/labelDy",schemaPath:"#/properties/flows/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data51.labelSegment !== undefined){let data68 = data51.labelSegment;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err146 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err147 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}}if(data51.via !== undefined){let data69 = data51.via;if(Array.isArray(data69)){const len7 = data69.length;for(let i3=0; i3<len7; i3++){let data70 = data69[i3];if(Array.isArray(data70)){if(data70.length > 2){const err148 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}if(data70.length < 2){const err149 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}const len8 = data70.length;if(len8 > 0){let data71 = data70[0];if(!((typeof data71 == "number") && (isFinite(data71)))){const err150 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(len8 > 1){let data72 = data70[1];if(!((typeof data72 == "number") && (isFinite(data72)))){const err151 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}const len9 = data70.length;if(!(len9 <= 2)){const err152 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}}else {const err154 = {instancePath:instancePath+"/flows/" + i2+"/via",schemaPath:"#/properties/flows/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data51.width !== undefined){let data73 = data51.width;if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 0.5 || isNaN(data73)){const err155 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}else {const err156 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}}else {const err157 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}}else {const err158 = {instancePath:instancePath+"/flows",schemaPath:"#/properties/flows/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}if(data.cards !== undefined){let data74 = data.cards;if(Array.isArray(data74)){const len10 = data74.length;for(let i4=0; i4<len10; i4++){let data75 = data74[i4];if(data75 && typeof data75 == "object" && !Array.isArray(data75)){if(data75.dot === undefined){const err159 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data75.title === undefined){const err160 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(data75.items === undefined){const err161 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}for(const key13 in data75){if(!(((key13 === "dot") || (key13 === "title")) || (key13 === "items"))){const err162 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}if(data75.dot !== undefined){let data76 = data75.dot;if(!(((((((data76 === "cyan") || (data76 === "emerald")) || (data76 === "violet")) || (data76 === "amber")) || (data76 === "rose")) || (data76 === "orange")) || (data76 === "slate"))){const err163 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema68.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data75.title !== undefined){let data77 = data75.title;if(typeof data77 === "string"){if(func3(data77) < 1){const err164 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data75.items !== undefined){let data78 = data75.items;if(Array.isArray(data78)){const len11 = data78.length;for(let i5=0; i5<len11; i5++){if(typeof data78[i5] !== "string"){const err166 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}}else {const err167 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}}else {const err168 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}}else {const err169 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}}else {const err170 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}validate27.errors = vErrors;return errors === 0;}validate27.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const lifecycle = validate30;const schema119 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json","title":"Archify Lifecycle Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","states","transitions"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"lifecycle"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"start":{"$ref":"common.schema.json#/$defs/legendEntry"},"active":{"$ref":"common.schema.json#/$defs/legendEntry"},"waiting":{"$ref":"common.schema.json#/$defs/legendEntry"},"decision":{"$ref":"common.schema.json#/$defs/legendEntry"},"success":{"$ref":"common.schema.json#/$defs/legendEntry"},"failure":{"$ref":"common.schema.json#/$defs/legendEntry"},"neutral":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":420},{"type":"number","minimum":566}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1}}}},"states":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label","lane","col"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"enum":["start","active","waiting","decision","success","failure","neutral","external"]},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"step":{"type":"string"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":4},"width":{"type":"number","minimum":48},"height":{"type":"number","minimum":36},"yOffset":{"type":"number"}}}},"transitions":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"note":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"route":{"enum":["auto","straight","drop","bottom-channel","top-channel","right-channel","left-channel"]},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"channelX":{"type":"number"},"channelY":{"type":"number"},"cornerRadius":{"type":"number","minimum":0},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};function validate31(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate31.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate31.errors = vErrors;return errors === 0;}validate31.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate30.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.states === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "states"},message:"must have required property '"+"states"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.transitions === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transitions"},message:"must have required property '"+"transitions"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "lanes")) || (key0 === "states")) || (key0 === "transitions")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("lifecycle" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "lifecycle"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema119.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema34.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema35.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema36.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate31(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!((((((((key3 === "start") || (key3 === "active")) || (key3 === "waiting")) || (key3 === "decision")) || (key3 === "success")) || (key3 === "failure")) || (key3 === "neutral")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.start !== undefined){let data14 = data13.start;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/start/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.active !== undefined){let data17 = data13.active;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/active/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.waiting !== undefined){let data20 = data13.waiting;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/waiting/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.decision !== undefined){let data23 = data13.decision;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/decision/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.success !== undefined){let data26 = data13.success;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/success/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.failure !== undefined){let data29 = data13.failure;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/failure/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.neutral !== undefined){let data32 = data13.neutral;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/neutral/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data13.external !== undefined){let data35 = data13.external;if(data35 && typeof data35 == "object" && !Array.isArray(data35)){if(Object.keys(data35).length < 1){const err71 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key11 in data35){if(!((key11 === "label") || (key11 === "visible"))){const err72 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data35.label !== undefined){let data36 = data35.label;if(typeof data36 === "string"){if(func3(data36) > 80){const err73 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(func3(data36) < 1){const err74 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data35.visible !== undefined){if(typeof data35.visible !== "boolean"){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data2.viewBox !== undefined){let data38 = data2.viewBox;if(Array.isArray(data38)){if(data38.length > 2){const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data38.length < 2){const err81 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}const len0 = data38.length;if(len0 > 0){let data39 = data38[0];if((typeof data39 == "number") && (isFinite(data39))){if(data39 < 420 || isNaN(data39)){const err82 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 420},message:"must be >= 420"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(len0 > 1){let data40 = data38[1];if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 566 || isNaN(data40)){const err84 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 566},message:"must be >= 566"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}const len1 = data38.length;if(!(len1 <= 2)){const err86 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}else {const err88 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.lanes !== undefined){let data41 = data.lanes;if(Array.isArray(data41)){if(data41.length > 4){const err89 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(data41.length < 1){const err90 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}const len2 = data41.length;for(let i0=0; i0<len2; i0++){let data42 = data41[i0];if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.id === undefined){const err91 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}if(data42.label === undefined){const err92 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}for(const key12 in data42){if(!((key12 === "id") || (key12 === "label"))){const err93 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data42.id !== undefined){let data43 = data42.id;if(typeof data43 === "string"){if(!pattern4.test(data43)){const err94 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}else {const err95 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data42.label !== undefined){let data44 = data42.label;if(typeof data44 === "string"){if(func3(data44) < 1){const err96 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}else {const err97 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}}else {const err98 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}}else {const err99 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data.states !== undefined){let data45 = data.states;if(Array.isArray(data45)){if(data45.length < 2){const err100 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}const len3 = data45.length;for(let i1=0; i1<len3; i1++){let data46 = data45[i1];if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.id === undefined){const err101 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(data46.type === undefined){const err102 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(data46.label === undefined){const err103 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(data46.lane === undefined){const err104 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(data46.col === undefined){const err105 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "col"},message:"must have required property '"+"col"+"'"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}for(const key13 in data46){if(!(func1.call(schema119.properties.states.items.properties, key13))){const err106 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data46.id !== undefined){let data47 = data46.id;if(typeof data47 === "string"){if(!pattern4.test(data47)){const err107 = {instancePath:instancePath+"/states/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/states/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data46.type !== undefined){let data48 = data46.type;if(!((((((((data48 === "start") || (data48 === "active")) || (data48 === "waiting")) || (data48 === "decision")) || (data48 === "success")) || (data48 === "failure")) || (data48 === "neutral")) || (data48 === "external"))){const err109 = {instancePath:instancePath+"/states/" + i1+"/type",schemaPath:"#/properties/states/items/properties/type/enum",keyword:"enum",params:{allowedValues: schema119.properties.states.items.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data46.label !== undefined){let data49 = data46.label;if(typeof data49 === "string"){if(func3(data49) < 1){const err110 = {instancePath:instancePath+"/states/" + i1+"/label",schemaPath:"#/properties/states/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}else {const err111 = {instancePath:instancePath+"/states/" + i1+"/label",schemaPath:"#/properties/states/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data46.sublabel !== undefined){if(typeof data46.sublabel !== "string"){const err112 = {instancePath:instancePath+"/states/" + i1+"/sublabel",schemaPath:"#/properties/states/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data46.tag !== undefined){if(typeof data46.tag !== "string"){const err113 = {instancePath:instancePath+"/states/" + i1+"/tag",schemaPath:"#/properties/states/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data46.brand !== undefined){let data52 = data46.brand;const _errs127 = errors;let valid35 = false;let passing0 = null;const _errs128 = errors;const _errs130 = errors;let valid36 = false;const _errs131 = errors;if(typeof data52 === "string"){if(func3(data52) > 80){const err114 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(!pattern13.test(data52)){const err115 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}var _valid1 = _errs131 === errors;valid36 = valid36 || _valid1;const _errs132 = errors;if(typeof data52 === "string"){if(!pattern14.test(data52)){const err116 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}var _valid1 = _errs132 === errors;valid36 = valid36 || _valid1;if(!valid36){const err117 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}else {errors = _errs130;if(vErrors !== null){if(_errs130){vErrors.length = _errs130;}else {vErrors = null;}}}if(typeof data52 === "string"){if(func3(data52) > 2048){const err118 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(func3(data52) < 1){const err119 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}var _valid0 = _errs128 === errors;if(_valid0){valid35 = true;passing0 = 0;}const _errs133 = errors;if(data52 && typeof data52 == "object" && !Array.isArray(data52)){if(data52.url === undefined){const err121 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(data52.sha256 === undefined){const err122 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}for(const key14 in data52){if(!((key14 === "url") || (key14 === "sha256"))){const err123 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}if(data52.url !== undefined){let data53 = data52.url;if(typeof data53 === "string"){if(func3(data53) > 2048){const err124 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(func3(data53) < 8){const err125 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(!pattern14.test(data53)){const err126 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}else {const err127 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data52.sha256 !== undefined){let data54 = data52.sha256;if(typeof data54 === "string"){if(!pattern16.test(data54)){const err128 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}else {const err129 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}var _valid0 = _errs133 === errors;if(_valid0 && valid35){valid35 = false;passing0 = [passing0, 1];}else {if(_valid0){valid35 = true;passing0 = 1;}}if(!valid35){const err131 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}else {errors = _errs127;if(vErrors !== null){if(_errs127){vErrors.length = _errs127;}else {vErrors = null;}}}}if(data46.step !== undefined){if(typeof data46.step !== "string"){const err132 = {instancePath:instancePath+"/states/" + i1+"/step",schemaPath:"#/properties/states/items/properties/step/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data46.lane !== undefined){let data56 = data46.lane;if(typeof data56 === "string"){if(!pattern4.test(data56)){const err133 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data46.col !== undefined){let data57 = data46.col;if(!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))){const err135 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 > 4 || isNaN(data57)){const err136 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4},message:"must be <= 4"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data57 < 0 || isNaN(data57)){const err137 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}if(data46.width !== undefined){let data58 = data46.width;if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 48 || isNaN(data58)){const err138 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data46.height !== undefined){let data59 = data46.height;if((typeof data59 == "number") && (isFinite(data59))){if(data59 < 36 || isNaN(data59)){const err140 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}else {const err141 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data46.yOffset !== undefined){let data60 = data46.yOffset;if(!((typeof data60 == "number") && (isFinite(data60)))){const err142 = {instancePath:instancePath+"/states/" + i1+"/yOffset",schemaPath:"#/properties/states/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}}else {const err144 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data.transitions !== undefined){let data61 = data.transitions;if(Array.isArray(data61)){const len4 = data61.length;for(let i2=0; i2<len4; i2++){let data62 = data61[i2];if(data62 && typeof data62 == "object" && !Array.isArray(data62)){if(data62.from === undefined){const err145 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}if(data62.to === undefined){const err146 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}for(const key15 in data62){if(!(func1.call(schema119.properties.transitions.items.properties, key15))){const err147 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}if(data62.id !== undefined){let data63 = data62.id;if(typeof data63 === "string"){if(!pattern4.test(data63)){const err148 = {instancePath:instancePath+"/transitions/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}else {const err149 = {instancePath:instancePath+"/transitions/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data62.from !== undefined){let data64 = data62.from;if(typeof data64 === "string"){if(!pattern4.test(data64)){const err150 = {instancePath:instancePath+"/transitions/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}else {const err151 = {instancePath:instancePath+"/transitions/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}if(data62.to !== undefined){let data65 = data62.to;if(typeof data65 === "string"){if(!pattern4.test(data65)){const err152 = {instancePath:instancePath+"/transitions/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/transitions/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}if(data62.label !== undefined){if(typeof data62.label !== "string"){const err154 = {instancePath:instancePath+"/transitions/" + i2+"/label",schemaPath:"#/properties/transitions/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data62.note !== undefined){if(typeof data62.note !== "string"){const err155 = {instancePath:instancePath+"/transitions/" + i2+"/note",schemaPath:"#/properties/transitions/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}if(data62.variant !== undefined){let data68 = data62.variant;if(!((((data68 === "default") || (data68 === "emphasis")) || (data68 === "security")) || (data68 === "dashed"))){const err156 = {instancePath:instancePath+"/transitions/" + i2+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}if(data62.route !== undefined){let data69 = data62.route;if(!(((((((data69 === "auto") || (data69 === "straight")) || (data69 === "drop")) || (data69 === "bottom-channel")) || (data69 === "top-channel")) || (data69 === "right-channel")) || (data69 === "left-channel"))){const err157 = {instancePath:instancePath+"/transitions/" + i2+"/route",schemaPath:"#/properties/transitions/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema119.properties.transitions.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}if(data62.fromSide !== undefined){let data70 = data62.fromSide;if(!((((data70 === "left") || (data70 === "right")) || (data70 === "top")) || (data70 === "bottom"))){const err158 = {instancePath:instancePath+"/transitions/" + i2+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}if(data62.toSide !== undefined){let data71 = data62.toSide;if(!((((data71 === "left") || (data71 === "right")) || (data71 === "top")) || (data71 === "bottom"))){const err159 = {instancePath:instancePath+"/transitions/" + i2+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}if(data62.channelX !== undefined){let data72 = data62.channelX;if(!((typeof data72 == "number") && (isFinite(data72)))){const err160 = {instancePath:instancePath+"/transitions/" + i2+"/channelX",schemaPath:"#/properties/transitions/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}if(data62.channelY !== undefined){let data73 = data62.channelY;if(!((typeof data73 == "number") && (isFinite(data73)))){const err161 = {instancePath:instancePath+"/transitions/" + i2+"/channelY",schemaPath:"#/properties/transitions/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data62.cornerRadius !== undefined){let data74 = data62.cornerRadius;if((typeof data74 == "number") && (isFinite(data74))){if(data74 < 0 || isNaN(data74)){const err162 = {instancePath:instancePath+"/transitions/" + i2+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/transitions/" + i2+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data62.labelAt !== undefined){let data75 = data62.labelAt;if(Array.isArray(data75)){if(data75.length > 2){const err164 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if(data75.length < 2){const err165 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}const len5 = data75.length;if(len5 > 0){let data76 = data75[0];if(!((typeof data76 == "number") && (isFinite(data76)))){const err166 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}if(len5 > 1){let data77 = data75[1];if(!((typeof data77 == "number") && (isFinite(data77)))){const err167 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}const len6 = data75.length;if(!(len6 <= 2)){const err168 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(data62.labelDx !== undefined){let data78 = data62.labelDx;if(!((typeof data78 == "number") && (isFinite(data78)))){const err170 = {instancePath:instancePath+"/transitions/" + i2+"/labelDx",schemaPath:"#/properties/transitions/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}if(data62.labelDy !== undefined){let data79 = data62.labelDy;if(!((typeof data79 == "number") && (isFinite(data79)))){const err171 = {instancePath:instancePath+"/transitions/" + i2+"/labelDy",schemaPath:"#/properties/transitions/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(data62.labelSegment !== undefined){let data80 = data62.labelSegment;if(!(((typeof data80 == "number") && (!(data80 % 1) && !isNaN(data80))) && (isFinite(data80)))){const err172 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}if((typeof data80 == "number") && (isFinite(data80))){if(data80 < 0 || isNaN(data80)){const err173 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}if(data62.via !== undefined){let data81 = data62.via;if(Array.isArray(data81)){const len7 = data81.length;for(let i3=0; i3<len7; i3++){let data82 = data81[i3];if(Array.isArray(data82)){if(data82.length > 2){const err174 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(data82.length < 2){const err175 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}const len8 = data82.length;if(len8 > 0){let data83 = data82[0];if(!((typeof data83 == "number") && (isFinite(data83)))){const err176 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(len8 > 1){let data84 = data82[1];if(!((typeof data84 == "number") && (isFinite(data84)))){const err177 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}const len9 = data82.length;if(!(len9 <= 2)){const err178 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}else {const err179 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}}else {const err180 = {instancePath:instancePath+"/transitions/" + i2+"/via",schemaPath:"#/properties/transitions/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data62.width !== undefined){let data85 = data62.width;if((typeof data85 == "number") && (isFinite(data85))){if(data85 < 0.5 || isNaN(data85)){const err181 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}}else {const err183 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/transitions",schemaPath:"#/properties/transitions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}if(data.cards !== undefined){let data86 = data.cards;if(Array.isArray(data86)){const len10 = data86.length;for(let i4=0; i4<len10; i4++){let data87 = data86[i4];if(data87 && typeof data87 == "object" && !Array.isArray(data87)){if(data87.dot === undefined){const err185 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}if(data87.title === undefined){const err186 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if(data87.items === undefined){const err187 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}for(const key16 in data87){if(!(((key16 === "dot") || (key16 === "title")) || (key16 === "items"))){const err188 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}if(data87.dot !== undefined){let data88 = data87.dot;if(!(((((((data88 === "cyan") || (data88 === "emerald")) || (data88 === "violet")) || (data88 === "amber")) || (data88 === "rose")) || (data88 === "orange")) || (data88 === "slate"))){const err189 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema68.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}if(data87.title !== undefined){let data89 = data87.title;if(typeof data89 === "string"){if(func3(data89) < 1){const err190 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}else {const err191 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}if(data87.items !== undefined){let data90 = data87.items;if(Array.isArray(data90)){const len11 = data90.length;for(let i5=0; i5<len11; i5++){if(typeof data90[i5] !== "string"){const err192 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}}else {const err193 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}}else {const err194 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}}else {const err195 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}}else {const err196 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}validate30.errors = vErrors;return errors === 0;}validate30.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const architecture = validate33;const schema150 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/architecture.schema.json","title":"Archify Architecture Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","components"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"architecture"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"engineering_profile":{"enum":["deployment-ownership"]},"repository":{"type":"object","additionalProperties":false,"required":["url","revision"],"properties":{"url":{"type":"string","pattern":"^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"},"revision":{"type":"string","pattern":"^[a-fA-F0-9]{40}$"}}},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":320},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"layout":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"enum":["grid"]},"origin":{"$ref":"common.schema.json#/$defs/point"},"cols":{"type":"integer","minimum":1,"maximum":12},"gapX":{"type":"number","minimum":0},"gapY":{"type":"number","minimum":0},"cellW":{"type":"number","minimum":40},"cellH":{"type":"number","minimum":24}}},"components":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"sources":{"type":"array","minItems":1,"maxItems":3,"items":{"type":"object","additionalProperties":false,"required":["path"],"properties":{"path":{"type":"string","minLength":1,"maxLength":240},"line":{"type":"integer","minimum":1},"end_line":{"type":"integer","minimum":1},"label":{"type":"string","minLength":1,"maxLength":48}}}},"row":{"type":"integer","minimum":0},"col":{"type":"integer","minimum":0},"pos":{"$ref":"common.schema.json#/$defs/point"},"size":{"type":"array","prefixItems":[{"type":"number","exclusiveMinimum":0},{"type":"number","exclusiveMinimum":0}],"items":false,"minItems":2,"maxItems":2}}}},"boundaries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","label","wraps"],"properties":{"kind":{"enum":["region","security-group"]},"label":{"type":"string","minLength":1},"wraps":{"type":"array","minItems":1,"items":{"$ref":"common.schema.json#/$defs/id"}},"pad":{"type":"number","minimum":0}}}},"connections":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"route":{"enum":["auto","straight","orthogonal-h","orthogonal-v"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};const pattern53 = new RegExp("^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$", "u");const pattern54 = new RegExp("^[a-fA-F0-9]{40}$", "u");function validate34(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate34.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate34.errors = vErrors;return errors === 0;}validate34.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate33(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/architecture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate33.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.components === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "components"},message:"must have required property '"+"components"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "layout")) || (key0 === "components")) || (key0 === "boundaries")) || (key0 === "connections")) || (key0 === "cards"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err5 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.diagram_type !== undefined){if("architecture" !== data.diagram_type){const err6 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "architecture"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err7 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key1 in data2){if(!(func1.call(schema150.properties.meta.properties, key1))){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err9 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err11 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err12 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err13 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err14 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema34.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err15 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema35.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err16 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema36.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.engineering_profile !== undefined){if(!(data2.engineering_profile === "deployment-ownership")){const err17 = {instancePath:instancePath+"/meta/engineering_profile",schemaPath:"#/properties/meta/properties/engineering_profile/enum",keyword:"enum",params:{allowedValues: schema150.properties.meta.properties.engineering_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.repository !== undefined){let data11 = data2.repository;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.url === undefined){const err18 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(data11.revision === undefined){const err19 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}for(const key2 in data11){if(!((key2 === "url") || (key2 === "revision"))){const err20 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.url !== undefined){let data12 = data11.url;if(typeof data12 === "string"){if(!pattern53.test(data12)){const err21 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/pattern",keyword:"pattern",params:{pattern: "^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"},message:"must match pattern \""+"^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data11.revision !== undefined){let data13 = data11.revision;if(typeof data13 === "string"){if(!pattern54.test(data13)){const err23 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}else {const err25 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data2.views !== undefined){if(!(validate34(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data15 = data2.legend;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){for(const key3 in data15){if(!((key3 === "mode") || (key3 === "entries"))){const err26 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data15.mode !== undefined){let data16 = data15.mode;if(!(((data16 === "auto") || (data16 === "all")) || (data16 === "hidden"))){const err27 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema40.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data15.entries !== undefined){let data17 = data15.entries;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){for(const key4 in data17){if(!(((((((key4 === "frontend") || (key4 === "backend")) || (key4 === "database")) || (key4 === "cloud")) || (key4 === "security")) || (key4 === "messagebus")) || (key4 === "external"))){const err28 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data17.frontend !== undefined){let data18 = data17.frontend;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(Object.keys(data18).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data18){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data18.label !== undefined){let data19 = data18.label;if(typeof data19 === "string"){if(func3(data19) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data19) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data18.visible !== undefined){if(typeof data18.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data17.backend !== undefined){let data21 = data17.backend;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data21){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data22) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data17.database !== undefined){let data24 = data17.database;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data24){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data25) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data17.cloud !== undefined){let data27 = data17.cloud;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data27){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data28) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data17.security !== undefined){let data30 = data17.security;if(data30 && typeof data30 == "object" && !Array.isArray(data30)){if(Object.keys(data30).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data30){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data30.label !== undefined){let data31 = data30.label;if(typeof data31 === "string"){if(func3(data31) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data31) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data30.visible !== undefined){if(typeof data30.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data17.messagebus !== undefined){let data33 = data17.messagebus;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(Object.keys(data33).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data33){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data34) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data33.visible !== undefined){if(typeof data33.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data17.external !== undefined){let data36 = data17.external;if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(Object.keys(data36).length < 1){const err71 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key11 in data36){if(!((key11 === "label") || (key11 === "visible"))){const err72 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data36.label !== undefined){let data37 = data36.label;if(typeof data37 === "string"){if(func3(data37) > 80){const err73 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(func3(data37) < 1){const err74 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data36.visible !== undefined){if(typeof data36.visible !== "boolean"){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data2.viewBox !== undefined){let data39 = data2.viewBox;if(Array.isArray(data39)){if(data39.length > 2){const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data39.length < 2){const err81 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}const len0 = data39.length;if(len0 > 0){let data40 = data39[0];if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 320 || isNaN(data40)){const err82 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 320},message:"must be >= 320"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(len0 > 1){let data41 = data39[1];if((typeof data41 == "number") && (isFinite(data41))){if(data41 < 240 || isNaN(data41)){const err84 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}const len1 = data39.length;if(!(len1 <= 2)){const err86 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}else {const err88 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.layout !== undefined){let data42 = data.layout;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.mode === undefined){const err89 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}for(const key12 in data42){if(!(((((((key12 === "mode") || (key12 === "origin")) || (key12 === "cols")) || (key12 === "gapX")) || (key12 === "gapY")) || (key12 === "cellW")) || (key12 === "cellH"))){const err90 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}if(data42.mode !== undefined){if(!(data42.mode === "grid")){const err91 = {instancePath:instancePath+"/layout/mode",schemaPath:"#/properties/layout/properties/mode/enum",keyword:"enum",params:{allowedValues: schema150.properties.layout.properties.mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data42.origin !== undefined){let data44 = data42.origin;if(Array.isArray(data44)){if(data44.length > 2){const err92 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}if(data44.length < 2){const err93 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}const len2 = data44.length;if(len2 > 0){let data45 = data44[0];if(!((typeof data45 == "number") && (isFinite(data45)))){const err94 = {instancePath:instancePath+"/layout/origin/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}if(len2 > 1){let data46 = data44[1];if(!((typeof data46 == "number") && (isFinite(data46)))){const err95 = {instancePath:instancePath+"/layout/origin/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}const len3 = data44.length;if(!(len3 <= 2)){const err96 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}else {const err97 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}if(data42.cols !== undefined){let data47 = data42.cols;if(!(((typeof data47 == "number") && (!(data47 % 1) && !isNaN(data47))) && (isFinite(data47)))){const err98 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}if((typeof data47 == "number") && (isFinite(data47))){if(data47 > 12 || isNaN(data47)){const err99 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/maximum",keyword:"maximum",params:{comparison: "<=", limit: 12},message:"must be <= 12"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(data47 < 1 || isNaN(data47)){const err100 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}}if(data42.gapX !== undefined){let data48 = data42.gapX;if((typeof data48 == "number") && (isFinite(data48))){if(data48 < 0 || isNaN(data48)){const err101 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}else {const err102 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data42.gapY !== undefined){let data49 = data42.gapY;if((typeof data49 == "number") && (isFinite(data49))){if(data49 < 0 || isNaN(data49)){const err103 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data42.cellW !== undefined){let data50 = data42.cellW;if((typeof data50 == "number") && (isFinite(data50))){if(data50 < 40 || isNaN(data50)){const err105 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/minimum",keyword:"minimum",params:{comparison: ">=", limit: 40},message:"must be >= 40"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}else {const err106 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data42.cellH !== undefined){let data51 = data42.cellH;if((typeof data51 == "number") && (isFinite(data51))){if(data51 < 24 || isNaN(data51)){const err107 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/minimum",keyword:"minimum",params:{comparison: ">=", limit: 24},message:"must be >= 24"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data.components !== undefined){let data52 = data.components;if(Array.isArray(data52)){if(data52.length < 1){const err110 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}const len4 = data52.length;for(let i0=0; i0<len4; i0++){let data53 = data52[i0];if(data53 && typeof data53 == "object" && !Array.isArray(data53)){if(data53.id === undefined){const err111 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data53.type === undefined){const err112 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data53.label === undefined){const err113 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}for(const key13 in data53){if(!(func1.call(schema150.properties.components.items.properties, key13))){const err114 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data53.id !== undefined){let data54 = data53.id;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err115 = {instancePath:instancePath+"/components/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}else {const err116 = {instancePath:instancePath+"/components/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data53.type !== undefined){let data55 = data53.type;if(!(((((((data55 === "frontend") || (data55 === "backend")) || (data55 === "database")) || (data55 === "cloud")) || (data55 === "security")) || (data55 === "messagebus")) || (data55 === "external"))){const err117 = {instancePath:instancePath+"/components/" + i0+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}if(data53.label !== undefined){let data56 = data53.label;if(typeof data56 === "string"){if(func3(data56) < 1){const err118 = {instancePath:instancePath+"/components/" + i0+"/label",schemaPath:"#/properties/components/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}else {const err119 = {instancePath:instancePath+"/components/" + i0+"/label",schemaPath:"#/properties/components/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data53.sublabel !== undefined){if(typeof data53.sublabel !== "string"){const err120 = {instancePath:instancePath+"/components/" + i0+"/sublabel",schemaPath:"#/properties/components/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data53.tag !== undefined){if(typeof data53.tag !== "string"){const err121 = {instancePath:instancePath+"/components/" + i0+"/tag",schemaPath:"#/properties/components/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}if(data53.brand !== undefined){let data59 = data53.brand;const _errs139 = errors;let valid34 = false;let passing0 = null;const _errs140 = errors;const _errs142 = errors;let valid35 = false;const _errs143 = errors;if(typeof data59 === "string"){if(func3(data59) > 80){const err122 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if(!pattern13.test(data59)){const err123 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}var _valid1 = _errs143 === errors;valid35 = valid35 || _valid1;const _errs144 = errors;if(typeof data59 === "string"){if(!pattern14.test(data59)){const err124 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}var _valid1 = _errs144 === errors;valid35 = valid35 || _valid1;if(!valid35){const err125 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}else {errors = _errs142;if(vErrors !== null){if(_errs142){vErrors.length = _errs142;}else {vErrors = null;}}}if(typeof data59 === "string"){if(func3(data59) > 2048){const err126 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if(func3(data59) < 1){const err127 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}else {const err128 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}var _valid0 = _errs140 === errors;if(_valid0){valid34 = true;passing0 = 0;}const _errs145 = errors;if(data59 && typeof data59 == "object" && !Array.isArray(data59)){if(data59.url === undefined){const err129 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(data59.sha256 === undefined){const err130 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}for(const key14 in data59){if(!((key14 === "url") || (key14 === "sha256"))){const err131 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data59.url !== undefined){let data60 = data59.url;if(typeof data60 === "string"){if(func3(data60) > 2048){const err132 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(func3(data60) < 8){const err133 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}if(!pattern14.test(data60)){const err134 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}else {const err135 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data59.sha256 !== undefined){let data61 = data59.sha256;if(typeof data61 === "string"){if(!pattern16.test(data61)){const err136 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}else {const err137 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}else {const err138 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}var _valid0 = _errs145 === errors;if(_valid0 && valid34){valid34 = false;passing0 = [passing0, 1];}else {if(_valid0){valid34 = true;passing0 = 1;}}if(!valid34){const err139 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}else {errors = _errs139;if(vErrors !== null){if(_errs139){vErrors.length = _errs139;}else {vErrors = null;}}}}if(data53.sources !== undefined){let data62 = data53.sources;if(Array.isArray(data62)){if(data62.length > 3){const err140 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data62.length < 1){const err141 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}const len5 = data62.length;for(let i1=0; i1<len5; i1++){let data63 = data62[i1];if(data63 && typeof data63 == "object" && !Array.isArray(data63)){if(data63.path === undefined){const err142 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/required",keyword:"required",params:{missingProperty: "path"},message:"must have required property '"+"path"+"'"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}for(const key15 in data63){if(!((((key15 === "path") || (key15 === "line")) || (key15 === "end_line")) || (key15 === "label"))){const err143 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data63.path !== undefined){let data64 = data63.path;if(typeof data64 === "string"){if(func3(data64) > 240){const err144 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}if(func3(data64) < 1){const err145 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data63.line !== undefined){let data65 = data63.line;if(!(((typeof data65 == "number") && (!(data65 % 1) && !isNaN(data65))) && (isFinite(data65)))){const err147 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data65 == "number") && (isFinite(data65))){if(data65 < 1 || isNaN(data65)){const err148 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}if(data63.end_line !== undefined){let data66 = data63.end_line;if(!(((typeof data66 == "number") && (!(data66 % 1) && !isNaN(data66))) && (isFinite(data66)))){const err149 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}if((typeof data66 == "number") && (isFinite(data66))){if(data66 < 1 || isNaN(data66)){const err150 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}if(data63.label !== undefined){let data67 = data63.label;if(typeof data67 === "string"){if(func3(data67) > 48){const err151 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}if(func3(data67) < 1){const err152 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}}else {const err154 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}}else {const err155 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}if(data53.row !== undefined){let data68 = data53.row;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err156 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err157 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}}if(data53.col !== undefined){let data69 = data53.col;if(!(((typeof data69 == "number") && (!(data69 % 1) && !isNaN(data69))) && (isFinite(data69)))){const err158 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}if((typeof data69 == "number") && (isFinite(data69))){if(data69 < 0 || isNaN(data69)){const err159 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}}if(data53.pos !== undefined){let data70 = data53.pos;if(Array.isArray(data70)){if(data70.length > 2){const err160 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(data70.length < 2){const err161 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}const len6 = data70.length;if(len6 > 0){let data71 = data70[0];if(!((typeof data71 == "number") && (isFinite(data71)))){const err162 = {instancePath:instancePath+"/components/" + i0+"/pos/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}if(len6 > 1){let data72 = data70[1];if(!((typeof data72 == "number") && (isFinite(data72)))){const err163 = {instancePath:instancePath+"/components/" + i0+"/pos/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}const len7 = data70.length;if(!(len7 <= 2)){const err164 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data53.size !== undefined){let data73 = data53.size;if(Array.isArray(data73)){if(data73.length > 2){const err166 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(data73.length < 2){const err167 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}const len8 = data73.length;if(len8 > 0){let data74 = data73[0];if((typeof data74 == "number") && (isFinite(data74))){if(data74 <= 0 || isNaN(data74)){const err168 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(len8 > 1){let data75 = data73[1];if((typeof data75 == "number") && (isFinite(data75))){if(data75 <= 0 || isNaN(data75)){const err170 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}else {const err171 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}const len9 = data73.length;if(!(len9 <= 2)){const err172 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}else {const err173 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}else {const err174 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}}else {const err175 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data.boundaries !== undefined){let data76 = data.boundaries;if(Array.isArray(data76)){const len10 = data76.length;for(let i2=0; i2<len10; i2++){let data77 = data76[i2];if(data77 && typeof data77 == "object" && !Array.isArray(data77)){if(data77.kind === undefined){const err176 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(data77.label === undefined){const err177 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(data77.wraps === undefined){const err178 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "wraps"},message:"must have required property '"+"wraps"+"'"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}for(const key16 in data77){if(!((((key16 === "kind") || (key16 === "label")) || (key16 === "wraps")) || (key16 === "pad"))){const err179 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data77.kind !== undefined){let data78 = data77.kind;if(!((data78 === "region") || (data78 === "security-group"))){const err180 = {instancePath:instancePath+"/boundaries/" + i2+"/kind",schemaPath:"#/properties/boundaries/items/properties/kind/enum",keyword:"enum",params:{allowedValues: schema150.properties.boundaries.items.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data77.label !== undefined){let data79 = data77.label;if(typeof data79 === "string"){if(func3(data79) < 1){const err181 = {instancePath:instancePath+"/boundaries/" + i2+"/label",schemaPath:"#/properties/boundaries/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/boundaries/" + i2+"/label",schemaPath:"#/properties/boundaries/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}if(data77.wraps !== undefined){let data80 = data77.wraps;if(Array.isArray(data80)){if(data80.length < 1){const err183 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps",schemaPath:"#/properties/boundaries/items/properties/wraps/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}const len11 = data80.length;for(let i3=0; i3<len11; i3++){let data81 = data80[i3];if(typeof data81 === "string"){if(!pattern4.test(data81)){const err184 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps/" + i3,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}else {const err185 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps/" + i3,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}}else {const err186 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps",schemaPath:"#/properties/boundaries/items/properties/wraps/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data77.pad !== undefined){let data82 = data77.pad;if((typeof data82 == "number") && (isFinite(data82))){if(data82 < 0 || isNaN(data82)){const err187 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}else {const err188 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}else {const err190 = {instancePath:instancePath+"/boundaries",schemaPath:"#/properties/boundaries/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data.connections !== undefined){let data83 = data.connections;if(Array.isArray(data83)){const len12 = data83.length;for(let i4=0; i4<len12; i4++){let data84 = data83[i4];if(data84 && typeof data84 == "object" && !Array.isArray(data84)){if(data84.from === undefined){const err191 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(data84.to === undefined){const err192 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}for(const key17 in data84){if(!(func1.call(schema150.properties.connections.items.properties, key17))){const err193 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key17},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data84.id !== undefined){let data85 = data84.id;if(typeof data85 === "string"){if(!pattern4.test(data85)){const err194 = {instancePath:instancePath+"/connections/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/connections/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data84.from !== undefined){let data86 = data84.from;if(typeof data86 === "string"){if(!pattern4.test(data86)){const err196 = {instancePath:instancePath+"/connections/" + i4+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}else {const err197 = {instancePath:instancePath+"/connections/" + i4+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}if(data84.to !== undefined){let data87 = data84.to;if(typeof data87 === "string"){if(!pattern4.test(data87)){const err198 = {instancePath:instancePath+"/connections/" + i4+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}else {const err199 = {instancePath:instancePath+"/connections/" + i4+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}if(data84.label !== undefined){if(typeof data84.label !== "string"){const err200 = {instancePath:instancePath+"/connections/" + i4+"/label",schemaPath:"#/properties/connections/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}if(data84.variant !== undefined){let data89 = data84.variant;if(!((((data89 === "default") || (data89 === "emphasis")) || (data89 === "security")) || (data89 === "dashed"))){const err201 = {instancePath:instancePath+"/connections/" + i4+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema50.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data84.fromSide !== undefined){let data90 = data84.fromSide;if(!((((data90 === "left") || (data90 === "right")) || (data90 === "top")) || (data90 === "bottom"))){const err202 = {instancePath:instancePath+"/connections/" + i4+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}if(data84.toSide !== undefined){let data91 = data84.toSide;if(!((((data91 === "left") || (data91 === "right")) || (data91 === "top")) || (data91 === "bottom"))){const err203 = {instancePath:instancePath+"/connections/" + i4+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}if(data84.route !== undefined){let data92 = data84.route;if(!((((data92 === "auto") || (data92 === "straight")) || (data92 === "orthogonal-h")) || (data92 === "orthogonal-v"))){const err204 = {instancePath:instancePath+"/connections/" + i4+"/route",schemaPath:"#/properties/connections/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema150.properties.connections.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}if(data84.via !== undefined){let data93 = data84.via;if(Array.isArray(data93)){const len13 = data93.length;for(let i5=0; i5<len13; i5++){let data94 = data93[i5];if(Array.isArray(data94)){if(data94.length > 2){const err205 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}if(data94.length < 2){const err206 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}const len14 = data94.length;if(len14 > 0){let data95 = data94[0];if(!((typeof data95 == "number") && (isFinite(data95)))){const err207 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}if(len14 > 1){let data96 = data94[1];if(!((typeof data96 == "number") && (isFinite(data96)))){const err208 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}const len15 = data94.length;if(!(len15 <= 2)){const err209 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}else {const err210 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}else {const err211 = {instancePath:instancePath+"/connections/" + i4+"/via",schemaPath:"#/properties/connections/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}if(data84.labelAt !== undefined){let data97 = data84.labelAt;if(Array.isArray(data97)){if(data97.length > 2){const err212 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}if(data97.length < 2){const err213 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}const len16 = data97.length;if(len16 > 0){let data98 = data97[0];if(!((typeof data98 == "number") && (isFinite(data98)))){const err214 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}if(len16 > 1){let data99 = data97[1];if(!((typeof data99 == "number") && (isFinite(data99)))){const err215 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}const len17 = data97.length;if(!(len17 <= 2)){const err216 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}else {const err217 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}if(data84.labelDx !== undefined){let data100 = data84.labelDx;if(!((typeof data100 == "number") && (isFinite(data100)))){const err218 = {instancePath:instancePath+"/connections/" + i4+"/labelDx",schemaPath:"#/properties/connections/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}if(data84.labelDy !== undefined){let data101 = data84.labelDy;if(!((typeof data101 == "number") && (isFinite(data101)))){const err219 = {instancePath:instancePath+"/connections/" + i4+"/labelDy",schemaPath:"#/properties/connections/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}if(data84.labelSegment !== undefined){let data102 = data84.labelSegment;if(!(((typeof data102 == "number") && (!(data102 % 1) && !isNaN(data102))) && (isFinite(data102)))){const err220 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}if((typeof data102 == "number") && (isFinite(data102))){if(data102 < 0 || isNaN(data102)){const err221 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}}}if(data84.width !== undefined){let data103 = data84.width;if((typeof data103 == "number") && (isFinite(data103))){if(data103 < 0.5 || isNaN(data103)){const err222 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}else {const err223 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}}else {const err224 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}}else {const err225 = {instancePath:instancePath+"/connections",schemaPath:"#/properties/connections/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}if(data.cards !== undefined){let data104 = data.cards;if(Array.isArray(data104)){const len18 = data104.length;for(let i6=0; i6<len18; i6++){let data105 = data104[i6];if(data105 && typeof data105 == "object" && !Array.isArray(data105)){if(data105.dot === undefined){const err226 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data105.title === undefined){const err227 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}if(data105.items === undefined){const err228 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}for(const key18 in data105){if(!(((key18 === "dot") || (key18 === "title")) || (key18 === "items"))){const err229 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key18},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}if(data105.dot !== undefined){let data106 = data105.dot;if(!(((((((data106 === "cyan") || (data106 === "emerald")) || (data106 === "violet")) || (data106 === "amber")) || (data106 === "rose")) || (data106 === "orange")) || (data106 === "slate"))){const err230 = {instancePath:instancePath+"/cards/" + i6+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema68.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(data105.title !== undefined){let data107 = data105.title;if(typeof data107 === "string"){if(func3(data107) < 1){const err231 = {instancePath:instancePath+"/cards/" + i6+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}else {const err232 = {instancePath:instancePath+"/cards/" + i6+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}if(data105.items !== undefined){let data108 = data105.items;if(Array.isArray(data108)){const len19 = data108.length;for(let i7=0; i7<len19; i7++){if(typeof data108[i7] !== "string"){const err233 = {instancePath:instancePath+"/cards/" + i6+"/items/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}}else {const err234 = {instancePath:instancePath+"/cards/" + i6+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}}}else {const err235 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}}}else {const err236 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}}}else {const err237 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}validate33.errors = vErrors;return errors === 0;}validate33.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};+};const schema34 = {"type":"array","maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["id","label","focus"],"properties":{"id":{"$ref":"#/$defs/id"},"label":{"type":"string","minLength":1,"maxLength":48},"focus":{"type":"array","minItems":1,"items":{"$ref":"#/$defs/id"}},"note":{"type":"string","maxLength":140}}}};const pattern4 = new RegExp("^[a-zA-Z][a-zA-Z0-9_-]*$", "u");function validate22(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate22.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate22.errors = vErrors;return errors === 0;}validate22.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};const schema52 = {"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"}}};function validate24(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate24.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.from === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.to === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!((key0 === "from") || (key0 === "to"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.from !== undefined){let data0 = data.from;if(typeof data0 === "string"){if(!pattern4.test(data0)){const err3 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.to !== undefined){let data1 = data.to;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate24.errors = vErrors;return errors === 0;}validate24.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const pattern17 = new RegExp("^[^\\r\\n]+$", "u");const pattern18 = new RegExp("^https?://", "u");const pattern20 = new RegExp("^[a-f0-9]{64}$", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/workflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.edges === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "edges"},message:"must have required property '"+"edges"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(func1.call(schema31.properties, key0))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){let data0 = data.schema_version;if(!((data0 === 1) || (data0 === 2))){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/enum",keyword:"enum",params:{allowedValues: schema31.properties.schema_version.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("workflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "workflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema31.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"#/properties/meta/properties/animation/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.animation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"#/properties/meta/properties/visual_preset/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.visual_preset.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"#/properties/meta/properties/quality_profile/enum",keyword:"enum",params:{allowedValues: schema31.properties.meta.properties.quality_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate22(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate22.errors : vErrors.concat(validate22.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((((key3 === "frontend") || (key3 === "backend")) || (key3 === "database")) || (key3 === "cloud")) || (key3 === "security")) || (key3 === "messagebus")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.frontend !== undefined){let data14 = data13.frontend;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.backend !== undefined){let data17 = data13.backend;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.database !== undefined){let data20 = data13.database;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.cloud !== undefined){let data23 = data13.cloud;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.security !== undefined){let data26 = data13.security;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.messagebus !== undefined){let data29 = data13.messagebus;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.external !== undefined){let data32 = data13.external;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data2.viewBox !== undefined){let data35 = data2.viewBox;if(Array.isArray(data35)){if(data35.length > 2){const err73 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(data35.length < 2){const err74 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}const len0 = data35.length;if(len0 > 0){let data36 = data35[0];if((typeof data36 == "number") && (isFinite(data36))){if(data36 < 700 || isNaN(data36)){const err75 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 700},message:"must be >= 700"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}else {const err76 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(len0 > 1){let data37 = data35[1];if((typeof data37 == "number") && (isFinite(data37))){if(data37 < 240 || isNaN(data37)){const err77 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}else {const err78 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}const len1 = data35.length;if(!(len1 <= 2)){const err79 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}else {const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}}else {const err81 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data.lanes !== undefined){let data38 = data.lanes;if(Array.isArray(data38)){if(data38.length < 1){const err82 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}const len2 = data38.length;for(let i0=0; i0<len2; i0++){let data39 = data38[i0];if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.id === undefined){const err83 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(data39.label === undefined){const err84 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}for(const key11 in data39){if(!(((key11 === "id") || (key11 === "label")) || (key11 === "variant"))){const err85 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data39.id !== undefined){let data40 = data39.id;if(typeof data40 === "string"){if(!pattern4.test(data40)){const err86 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data39.label !== undefined){let data41 = data39.label;if(typeof data41 === "string"){if(func3(data41) < 1){const err88 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}else {const err89 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data39.variant !== undefined){let data42 = data39.variant;if(!((data42 === "normal") || (data42 === "exception"))){const err90 = {instancePath:instancePath+"/lanes/" + i0+"/variant",schemaPath:"#/properties/lanes/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.lanes.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}}else {const err91 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}else {const err92 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data.phases !== undefined){let data43 = data.phases;if(Array.isArray(data43)){const len3 = data43.length;for(let i1=0; i1<len3; i1++){let data44 = data43[i1];if(data44 && typeof data44 == "object" && !Array.isArray(data44)){if(data44.id === undefined){const err93 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}if(data44.label === undefined){const err94 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(data44.fromCol === undefined){const err95 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "fromCol"},message:"must have required property '"+"fromCol"+"'"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}if(data44.toCol === undefined){const err96 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/required",keyword:"required",params:{missingProperty: "toCol"},message:"must have required property '"+"toCol"+"'"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}for(const key12 in data44){if(!(((((key12 === "id") || (key12 === "label")) || (key12 === "fromCol")) || (key12 === "toCol")) || (key12 === "variant"))){const err97 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}if(data44.id !== undefined){let data45 = data44.id;if(typeof data45 === "string"){if(!pattern4.test(data45)){const err98 = {instancePath:instancePath+"/phases/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/phases/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data44.label !== undefined){let data46 = data44.label;if(typeof data46 === "string"){if(func3(data46) < 1){const err100 = {instancePath:instancePath+"/phases/" + i1+"/label",schemaPath:"#/properties/phases/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/phases/" + i1+"/label",schemaPath:"#/properties/phases/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data44.fromCol !== undefined){let data47 = data44.fromCol;if(!(((typeof data47 == "number") && (!(data47 % 1) && !isNaN(data47))) && (isFinite(data47)))){const err102 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if((typeof data47 == "number") && (isFinite(data47))){if(data47 > 5 || isNaN(data47)){const err103 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(data47 < 0 || isNaN(data47)){const err104 = {instancePath:instancePath+"/phases/" + i1+"/fromCol",schemaPath:"#/properties/phases/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}}if(data44.toCol !== undefined){let data48 = data44.toCol;if(!(((typeof data48 == "number") && (!(data48 % 1) && !isNaN(data48))) && (isFinite(data48)))){const err105 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if((typeof data48 == "number") && (isFinite(data48))){if(data48 > 5 || isNaN(data48)){const err106 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data48 < 0 || isNaN(data48)){const err107 = {instancePath:instancePath+"/phases/" + i1+"/toCol",schemaPath:"#/properties/phases/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}if(data44.variant !== undefined){let data49 = data44.variant;if(!((((data49 === "default") || (data49 === "emphasis")) || (data49 === "security")) || (data49 === "dashed"))){const err108 = {instancePath:instancePath+"/phases/" + i1+"/variant",schemaPath:"#/properties/phases/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.phases.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/phases/" + i1,schemaPath:"#/properties/phases/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}else {const err110 = {instancePath:instancePath+"/phases",schemaPath:"#/properties/phases/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.groups !== undefined){let data50 = data.groups;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2<len4; i2++){let data51 = data50[i2];if(data51 && typeof data51 == "object" && !Array.isArray(data51)){if(data51.id === undefined){const err111 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data51.label === undefined){const err112 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data51.lane === undefined){const err113 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}if(data51.fromCol === undefined){const err114 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "fromCol"},message:"must have required property '"+"fromCol"+"'"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(data51.toCol === undefined){const err115 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/required",keyword:"required",params:{missingProperty: "toCol"},message:"must have required property '"+"toCol"+"'"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}for(const key13 in data51){if(!((((((key13 === "id") || (key13 === "label")) || (key13 === "lane")) || (key13 === "fromCol")) || (key13 === "toCol")) || (key13 === "variant"))){const err116 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data51.id !== undefined){let data52 = data51.id;if(typeof data52 === "string"){if(!pattern4.test(data52)){const err117 = {instancePath:instancePath+"/groups/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}else {const err118 = {instancePath:instancePath+"/groups/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data51.label !== undefined){let data53 = data51.label;if(typeof data53 === "string"){if(func3(data53) < 1){const err119 = {instancePath:instancePath+"/groups/" + i2+"/label",schemaPath:"#/properties/groups/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/groups/" + i2+"/label",schemaPath:"#/properties/groups/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data51.lane !== undefined){let data54 = data51.lane;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err121 = {instancePath:instancePath+"/groups/" + i2+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/groups/" + i2+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data51.fromCol !== undefined){let data55 = data51.fromCol;if(!(((typeof data55 == "number") && (!(data55 % 1) && !isNaN(data55))) && (isFinite(data55)))){const err123 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}if((typeof data55 == "number") && (isFinite(data55))){if(data55 > 5 || isNaN(data55)){const err124 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(data55 < 0 || isNaN(data55)){const err125 = {instancePath:instancePath+"/groups/" + i2+"/fromCol",schemaPath:"#/properties/groups/items/properties/fromCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}if(data51.toCol !== undefined){let data56 = data51.toCol;if(!(((typeof data56 == "number") && (!(data56 % 1) && !isNaN(data56))) && (isFinite(data56)))){const err126 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if((typeof data56 == "number") && (isFinite(data56))){if(data56 > 5 || isNaN(data56)){const err127 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if(data56 < 0 || isNaN(data56)){const err128 = {instancePath:instancePath+"/groups/" + i2+"/toCol",schemaPath:"#/properties/groups/items/properties/toCol/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}}if(data51.variant !== undefined){let data57 = data51.variant;if(!((((data57 === "default") || (data57 === "emphasis")) || (data57 === "security")) || (data57 === "dashed"))){const err129 = {instancePath:instancePath+"/groups/" + i2+"/variant",schemaPath:"#/properties/groups/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema31.properties.groups.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/groups/" + i2,schemaPath:"#/properties/groups/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}else {const err131 = {instancePath:instancePath+"/groups",schemaPath:"#/properties/groups/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data.mainPath !== undefined){let data58 = data.mainPath;if(Array.isArray(data58)){if(data58.length < 2){const err132 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}const len5 = data58.length;for(let i3=0; i3<len5; i3++){let data59 = data58[i3];if(typeof data59 === "string"){if(!pattern4.test(data59)){const err133 = {instancePath:instancePath+"/mainPath/" + i3,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/mainPath/" + i3,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}}else {const err135 = {instancePath:instancePath+"/mainPath",schemaPath:"#/properties/mainPath/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data.semanticChecks !== undefined){let data60 = data.semanticChecks;if(data60 && typeof data60 == "object" && !Array.isArray(data60)){if(Object.keys(data60).length < 1){const err136 = {instancePath:instancePath+"/semanticChecks",schemaPath:"#/properties/semanticChecks/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}for(const key14 in data60){if(!((((key14 === "allowedRoots") || (key14 === "allowedTerminals")) || (key14 === "requiredEdges")) || (key14 === "requiredPaths"))){const err137 = {instancePath:instancePath+"/semanticChecks",schemaPath:"#/properties/semanticChecks/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}if(data60.allowedRoots !== undefined){let data61 = data60.allowedRoots;if(Array.isArray(data61)){const len6 = data61.length;for(let i4=0; i4<len6; i4++){let data62 = data61[i4];if(typeof data62 === "string"){if(!pattern4.test(data62)){const err138 = {instancePath:instancePath+"/semanticChecks/allowedRoots/" + i4,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/semanticChecks/allowedRoots/" + i4,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}}else {const err140 = {instancePath:instancePath+"/semanticChecks/allowedRoots",schemaPath:"#/properties/semanticChecks/properties/allowedRoots/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(data60.allowedTerminals !== undefined){let data63 = data60.allowedTerminals;if(Array.isArray(data63)){const len7 = data63.length;for(let i5=0; i5<len7; i5++){let data64 = data63[i5];if(typeof data64 === "string"){if(!pattern4.test(data64)){const err141 = {instancePath:instancePath+"/semanticChecks/allowedTerminals/" + i5,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}else {const err142 = {instancePath:instancePath+"/semanticChecks/allowedTerminals/" + i5,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath:instancePath+"/semanticChecks/allowedTerminals",schemaPath:"#/properties/semanticChecks/properties/allowedTerminals/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data60.requiredEdges !== undefined){let data65 = data60.requiredEdges;if(Array.isArray(data65)){const len8 = data65.length;for(let i6=0; i6<len8; i6++){if(!(validate24(data65[i6], {instancePath:instancePath+"/semanticChecks/requiredEdges/" + i6,parentData:data65,parentDataProperty:i6,rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}}}else {const err144 = {instancePath:instancePath+"/semanticChecks/requiredEdges",schemaPath:"#/properties/semanticChecks/properties/requiredEdges/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data60.requiredPaths !== undefined){let data67 = data60.requiredPaths;if(Array.isArray(data67)){const len9 = data67.length;for(let i7=0; i7<len9; i7++){if(!(validate24(data67[i7], {instancePath:instancePath+"/semanticChecks/requiredPaths/" + i7,parentData:data67,parentDataProperty:i7,rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate24.errors : vErrors.concat(validate24.errors);errors = vErrors.length;}}}else {const err145 = {instancePath:instancePath+"/semanticChecks/requiredPaths",schemaPath:"#/properties/semanticChecks/properties/requiredPaths/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}}else {const err146 = {instancePath:instancePath+"/semanticChecks",schemaPath:"#/properties/semanticChecks/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data.nodes !== undefined){let data69 = data.nodes;if(Array.isArray(data69)){if(data69.length < 1){const err147 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}const len10 = data69.length;for(let i8=0; i8<len10; i8++){let data70 = data69[i8];if(data70 && typeof data70 == "object" && !Array.isArray(data70)){if(data70.id === undefined){const err148 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}if(data70.lane === undefined){const err149 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}if(data70.col === undefined){const err150 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "col"},message:"must have required property '"+"col"+"'"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}if(data70.type === undefined){const err151 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}if(data70.label === undefined){const err152 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}for(const key15 in data70){if(!(func1.call(schema31.properties.nodes.items.properties, key15))){const err153 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}if(data70.id !== undefined){let data71 = data70.id;if(typeof data71 === "string"){if(!pattern4.test(data71)){const err154 = {instancePath:instancePath+"/nodes/" + i8+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}else {const err155 = {instancePath:instancePath+"/nodes/" + i8+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}if(data70.lane !== undefined){let data72 = data70.lane;if(typeof data72 === "string"){if(!pattern4.test(data72)){const err156 = {instancePath:instancePath+"/nodes/" + i8+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}else {const err157 = {instancePath:instancePath+"/nodes/" + i8+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}if(data70.col !== undefined){let data73 = data70.col;if(!(((typeof data73 == "number") && (!(data73 % 1) && !isNaN(data73))) && (isFinite(data73)))){const err158 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}if((typeof data73 == "number") && (isFinite(data73))){if(data73 > 5 || isNaN(data73)){const err159 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 5},message:"must be <= 5"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data73 < 0 || isNaN(data73)){const err160 = {instancePath:instancePath+"/nodes/" + i8+"/col",schemaPath:"#/properties/nodes/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}}if(data70.type !== undefined){let data74 = data70.type;if(!(((((((data74 === "frontend") || (data74 === "backend")) || (data74 === "database")) || (data74 === "cloud")) || (data74 === "security")) || (data74 === "messagebus")) || (data74 === "external"))){const err161 = {instancePath:instancePath+"/nodes/" + i8+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data70.label !== undefined){let data75 = data70.label;if(typeof data75 === "string"){if(func3(data75) < 1){const err162 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/nodes/" + i8+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data70.sublabel !== undefined){if(typeof data70.sublabel !== "string"){const err164 = {instancePath:instancePath+"/nodes/" + i8+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data70.tag !== undefined){if(typeof data70.tag !== "string"){const err165 = {instancePath:instancePath+"/nodes/" + i8+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data70.brand !== undefined){let data78 = data70.brand;const _errs180 = errors;let valid55 = false;let passing0 = null;const _errs181 = errors;const _errs183 = errors;let valid56 = false;const _errs184 = errors;if(typeof data78 === "string"){if(func3(data78) > 80){const err166 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(!pattern17.test(data78)){const err167 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}var _valid1 = _errs184 === errors;valid56 = valid56 || _valid1;const _errs185 = errors;if(typeof data78 === "string"){if(!pattern18.test(data78)){const err168 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}var _valid1 = _errs185 === errors;valid56 = valid56 || _valid1;if(!valid56){const err169 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}else {errors = _errs183;if(vErrors !== null){if(_errs183){vErrors.length = _errs183;}else {vErrors = null;}}}if(typeof data78 === "string"){if(func3(data78) > 2048){const err170 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(func3(data78) < 1){const err171 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}else {const err172 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}var _valid0 = _errs181 === errors;if(_valid0){valid55 = true;passing0 = 0;}const _errs186 = errors;if(data78 && typeof data78 == "object" && !Array.isArray(data78)){if(data78.url === undefined){const err173 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}if(data78.sha256 === undefined){const err174 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}for(const key16 in data78){if(!((key16 === "url") || (key16 === "sha256"))){const err175 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data78.url !== undefined){let data79 = data78.url;if(typeof data79 === "string"){if(func3(data79) > 2048){const err176 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(func3(data79) < 8){const err177 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(!pattern18.test(data79)){const err178 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}else {const err179 = {instancePath:instancePath+"/nodes/" + i8+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data78.sha256 !== undefined){let data80 = data78.sha256;if(typeof data80 === "string"){if(!pattern20.test(data80)){const err180 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}else {const err181 = {instancePath:instancePath+"/nodes/" + i8+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}}else {const err182 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}var _valid0 = _errs186 === errors;if(_valid0 && valid55){valid55 = false;passing0 = [passing0, 1];}else {if(_valid0){valid55 = true;passing0 = 1;}}if(!valid55){const err183 = {instancePath:instancePath+"/nodes/" + i8+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}else {errors = _errs180;if(vErrors !== null){if(_errs180){vErrors.length = _errs180;}else {vErrors = null;}}}}if(data70.width !== undefined){let data81 = data70.width;if((typeof data81 == "number") && (isFinite(data81))){if(data81 < 32 || isNaN(data81)){const err184 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}else {const err185 = {instancePath:instancePath+"/nodes/" + i8+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}if(data70.height !== undefined){let data82 = data70.height;if((typeof data82 == "number") && (isFinite(data82))){if(data82 < 32 || isNaN(data82)){const err186 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 32},message:"must be >= 32"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}else {const err187 = {instancePath:instancePath+"/nodes/" + i8+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}if(data70.yOffset !== undefined){let data83 = data70.yOffset;if(!((typeof data83 == "number") && (isFinite(data83)))){const err188 = {instancePath:instancePath+"/nodes/" + i8+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {instancePath:instancePath+"/nodes/" + i8,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}else {const err190 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data.edges !== undefined){let data84 = data.edges;if(Array.isArray(data84)){const len11 = data84.length;for(let i9=0; i9<len11; i9++){let data85 = data84[i9];if(data85 && typeof data85 == "object" && !Array.isArray(data85)){if(data85.from === undefined){const err191 = {instancePath:instancePath+"/edges/" + i9,schemaPath:"#/properties/edges/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(data85.to === undefined){const err192 = {instancePath:instancePath+"/edges/" + i9,schemaPath:"#/properties/edges/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}for(const key17 in data85){if(!(func1.call(schema31.properties.edges.items.properties, key17))){const err193 = {instancePath:instancePath+"/edges/" + i9,schemaPath:"#/properties/edges/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key17},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data85.id !== undefined){let data86 = data85.id;if(typeof data86 === "string"){if(!pattern4.test(data86)){const err194 = {instancePath:instancePath+"/edges/" + i9+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/edges/" + i9+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data85.from !== undefined){let data87 = data85.from;if(typeof data87 === "string"){if(!pattern4.test(data87)){const err196 = {instancePath:instancePath+"/edges/" + i9+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}else {const err197 = {instancePath:instancePath+"/edges/" + i9+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}if(data85.to !== undefined){let data88 = data85.to;if(typeof data88 === "string"){if(!pattern4.test(data88)){const err198 = {instancePath:instancePath+"/edges/" + i9+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}else {const err199 = {instancePath:instancePath+"/edges/" + i9+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}if(data85.label !== undefined){if(typeof data85.label !== "string"){const err200 = {instancePath:instancePath+"/edges/" + i9+"/label",schemaPath:"#/properties/edges/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}if(data85.variant !== undefined){let data90 = data85.variant;if(!((((data90 === "default") || (data90 === "emphasis")) || (data90 === "security")) || (data90 === "dashed"))){const err201 = {instancePath:instancePath+"/edges/" + i9+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema62.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data85.role !== undefined){let data91 = data85.role;if(!(((((data91 === "main") || (data91 === "branch")) || (data91 === "async")) || (data91 === "return")) || (data91 === "error"))){const err202 = {instancePath:instancePath+"/edges/" + i9+"/role",schemaPath:"#/properties/edges/items/properties/role/enum",keyword:"enum",params:{allowedValues: schema31.properties.edges.items.properties.role.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}if(data85.fromSide !== undefined){let data92 = data85.fromSide;if(!((((data92 === "left") || (data92 === "right")) || (data92 === "top")) || (data92 === "bottom"))){const err203 = {instancePath:instancePath+"/edges/" + i9+"/fromSide",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}if(data85.toSide !== undefined){let data93 = data85.toSide;if(!((((data93 === "left") || (data93 === "right")) || (data93 === "top")) || (data93 === "bottom"))){const err204 = {instancePath:instancePath+"/edges/" + i9+"/toSide",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema63.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}if(data85.route !== undefined){let data94 = data85.route;if(!(((((((data94 === "auto") || (data94 === "straight")) || (data94 === "drop")) || (data94 === "outside-right")) || (data94 === "return-left")) || (data94 === "bottom-channel")) || (data94 === "up-channel"))){const err205 = {instancePath:instancePath+"/edges/" + i9+"/route",schemaPath:"#/properties/edges/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema31.properties.edges.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}if(data85.via !== undefined){let data95 = data85.via;if(Array.isArray(data95)){const len12 = data95.length;for(let i10=0; i10<len12; i10++){let data96 = data95[i10];if(Array.isArray(data96)){if(data96.length > 2){const err206 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}if(data96.length < 2){const err207 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}const len13 = data96.length;if(len13 > 0){let data97 = data96[0];if(!((typeof data97 == "number") && (isFinite(data97)))){const err208 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(len13 > 1){let data98 = data96[1];if(!((typeof data98 == "number") && (isFinite(data98)))){const err209 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}const len14 = data96.length;if(!(len14 <= 2)){const err210 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}else {const err211 = {instancePath:instancePath+"/edges/" + i9+"/via/" + i10,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}}else {const err212 = {instancePath:instancePath+"/edges/" + i9+"/via",schemaPath:"#/properties/edges/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}if(data85.labelAt !== undefined){let data99 = data85.labelAt;if(Array.isArray(data99)){if(data99.length > 2){const err213 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}if(data99.length < 2){const err214 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}const len15 = data99.length;if(len15 > 0){let data100 = data99[0];if(!((typeof data100 == "number") && (isFinite(data100)))){const err215 = {instancePath:instancePath+"/edges/" + i9+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}if(len15 > 1){let data101 = data99[1];if(!((typeof data101 == "number") && (isFinite(data101)))){const err216 = {instancePath:instancePath+"/edges/" + i9+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}const len16 = data99.length;if(!(len16 <= 2)){const err217 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}else {const err218 = {instancePath:instancePath+"/edges/" + i9+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}if(data85.labelDx !== undefined){let data102 = data85.labelDx;if(!((typeof data102 == "number") && (isFinite(data102)))){const err219 = {instancePath:instancePath+"/edges/" + i9+"/labelDx",schemaPath:"#/properties/edges/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}if(data85.labelDy !== undefined){let data103 = data85.labelDy;if(!((typeof data103 == "number") && (isFinite(data103)))){const err220 = {instancePath:instancePath+"/edges/" + i9+"/labelDy",schemaPath:"#/properties/edges/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data85.labelSegment !== undefined){let data104 = data85.labelSegment;if(!(((typeof data104 == "number") && (!(data104 % 1) && !isNaN(data104))) && (isFinite(data104)))){const err221 = {instancePath:instancePath+"/edges/" + i9+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if((typeof data104 == "number") && (isFinite(data104))){if(data104 < 0 || isNaN(data104)){const err222 = {instancePath:instancePath+"/edges/" + i9+"/labelSegment",schemaPath:"#/properties/edges/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}}if(data85.channelX !== undefined){let data105 = data85.channelX;if(!((typeof data105 == "number") && (isFinite(data105)))){const err223 = {instancePath:instancePath+"/edges/" + i9+"/channelX",schemaPath:"#/properties/edges/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}if(data85.channelY !== undefined){let data106 = data85.channelY;if(!((typeof data106 == "number") && (isFinite(data106)))){const err224 = {instancePath:instancePath+"/edges/" + i9+"/channelY",schemaPath:"#/properties/edges/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}if(data85.bias !== undefined){let data107 = data85.bias;if((typeof data107 == "number") && (isFinite(data107))){if(data107 > 1 || isNaN(data107)){const err225 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/maximum",keyword:"maximum",params:{comparison: "<=", limit: 1},message:"must be <= 1"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}if(data107 < 0 || isNaN(data107)){const err226 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}}else {const err227 = {instancePath:instancePath+"/edges/" + i9+"/bias",schemaPath:"#/properties/edges/items/properties/bias/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}if(data85.width !== undefined){let data108 = data85.width;if((typeof data108 == "number") && (isFinite(data108))){if(data108 < 0.5 || isNaN(data108)){const err228 = {instancePath:instancePath+"/edges/" + i9+"/width",schemaPath:"#/properties/edges/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}else {const err229 = {instancePath:instancePath+"/edges/" + i9+"/width",schemaPath:"#/properties/edges/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}}else {const err230 = {instancePath:instancePath+"/edges/" + i9,schemaPath:"#/properties/edges/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}}else {const err231 = {instancePath:instancePath+"/edges",schemaPath:"#/properties/edges/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}if(data.cards !== undefined){let data109 = data.cards;if(Array.isArray(data109)){const len17 = data109.length;for(let i11=0; i11<len17; i11++){let data110 = data109[i11];if(data110 && typeof data110 == "object" && !Array.isArray(data110)){if(data110.dot === undefined){const err232 = {instancePath:instancePath+"/cards/" + i11,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}if(data110.title === undefined){const err233 = {instancePath:instancePath+"/cards/" + i11,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}if(data110.items === undefined){const err234 = {instancePath:instancePath+"/cards/" + i11,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}for(const key18 in data110){if(!(((key18 === "dot") || (key18 === "title")) || (key18 === "items"))){const err235 = {instancePath:instancePath+"/cards/" + i11,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key18},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}}if(data110.dot !== undefined){let data111 = data110.dot;if(!(((((((data111 === "cyan") || (data111 === "emerald")) || (data111 === "violet")) || (data111 === "amber")) || (data111 === "rose")) || (data111 === "orange")) || (data111 === "slate"))){const err236 = {instancePath:instancePath+"/cards/" + i11+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema67.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}}if(data110.title !== undefined){let data112 = data110.title;if(typeof data112 === "string"){if(func3(data112) < 1){const err237 = {instancePath:instancePath+"/cards/" + i11+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}}else {const err238 = {instancePath:instancePath+"/cards/" + i11+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}if(data110.items !== undefined){let data113 = data110.items;if(Array.isArray(data113)){const len18 = data113.length;for(let i12=0; i12<len18; i12++){if(typeof data113[i12] !== "string"){const err239 = {instancePath:instancePath+"/cards/" + i11+"/items/" + i12,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}}else {const err240 = {instancePath:instancePath+"/cards/" + i11+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}}else {const err241 = {instancePath:instancePath+"/cards/" + i11,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}}}else {const err242 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}}}else {const err243 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const sequence = validate27;const schema68 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/sequence.schema.json","title":"Archify Sequence Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","participants","messages"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"sequence"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"column_fit":{"description":"Horizontal participant layout. Omit this field or use fixed for the stable 86px boxes and 108px gap. Use spread when a wide viewBox would leave unused horizontal space or meaningful participant labels do not fit the fixed boxes; spread derives wider boxes and gaps from the viewBox without changing participant order or message semantics.","enum":["fixed","spread"]},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"default":{"$ref":"common.schema.json#/$defs/legendEntry"},"emphasis":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"dashed":{"$ref":"common.schema.json#/$defs/legendEntry"},"return":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":480},{"type":"number","minimum":480}],"items":false,"minItems":2,"maxItems":2}}},"participants":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"}}}},"segments":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to","label"],"properties":{"from":{"type":"number"},"to":{"type":"number"},"label":{"type":"string","minLength":1}}}},"messages":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["from","to","y","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"y":{"type":"number","minimum":160},"label":{"type":"string","minLength":1},"variant":{"enum":["default","emphasis","security","dashed","return"]},"note":{"type":"string"}}}},"activations":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["participant","from","to"],"properties":{"participant":{"$ref":"common.schema.json#/$defs/id"},"from":{"type":"number"},"to":{"type":"number"},"type":{"$ref":"common.schema.json#/$defs/componentType"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};const schema70 = {"enum":["trace","none"]};const schema71 = {"enum":["classic","signal-flow","blueprint","editorial"]};const schema72 = {"enum":["standard","showcase"]};function validate28(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate28.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate28.errors = vErrors;return errors === 0;}validate28.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate27(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/sequence.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate27.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.participants === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "participants"},message:"must have required property '"+"participants"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.messages === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messages"},message:"must have required property '"+"messages"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "participants")) || (key0 === "segments")) || (key0 === "messages")) || (key0 === "activations")) || (key0 === "cards"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err6 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.diagram_type !== undefined){if("sequence" !== data.diagram_type){const err7 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "sequence"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key1 in data2){if(!(func1.call(schema68.properties.meta.properties, key1))){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err12 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err13 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err14 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err15 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err16 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err17 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.column_fit !== undefined){let data10 = data2.column_fit;if(!((data10 === "fixed") || (data10 === "spread"))){const err18 = {instancePath:instancePath+"/meta/column_fit",schemaPath:"#/properties/meta/properties/column_fit/enum",keyword:"enum",params:{allowedValues: schema68.properties.meta.properties.column_fit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate28(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate28.errors : vErrors.concat(validate28.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data12 = data2.legend;if(data12 && typeof data12 == "object" && !Array.isArray(data12)){for(const key2 in data12){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data12.mode !== undefined){let data13 = data12.mode;if(!(((data13 === "auto") || (data13 === "all")) || (data13 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data12.entries !== undefined){let data14 = data12.entries;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){for(const key3 in data14){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "return"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data14.default !== undefined){let data15 = data14.default;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(Object.keys(data15).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data15){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data15.label !== undefined){let data16 = data15.label;if(typeof data16 === "string"){if(func3(data16) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data16) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data15.visible !== undefined){if(typeof data15.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data14.emphasis !== undefined){let data18 = data14.emphasis;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(Object.keys(data18).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data18){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data18.label !== undefined){let data19 = data18.label;if(typeof data19 === "string"){if(func3(data19) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data19) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data18.visible !== undefined){if(typeof data18.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data14.security !== undefined){let data21 = data14.security;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data21){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data22) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data14.dashed !== undefined){let data24 = data14.dashed;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data24){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data25) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data14.return !== undefined){let data27 = data14.return;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data27){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data28) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/return/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/return/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/return",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data30 = data2.viewBox;if(Array.isArray(data30)){if(data30.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data30.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data30.length;if(len0 > 0){let data31 = data30[0];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 480 || isNaN(data31)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data32 = data30[1];if((typeof data32 == "number") && (isFinite(data32))){if(data32 < 480 || isNaN(data32)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 480},message:"must be >= 480"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data30.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.participants !== undefined){let data33 = data.participants;if(Array.isArray(data33)){if(data33.length < 2){const err68 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}const len2 = data33.length;for(let i0=0; i0<len2; i0++){let data34 = data33[i0];if(data34 && typeof data34 == "object" && !Array.isArray(data34)){if(data34.id === undefined){const err69 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(data34.type === undefined){const err70 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(data34.label === undefined){const err71 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key9 in data34){if(!(((((key9 === "id") || (key9 === "type")) || (key9 === "label")) || (key9 === "sublabel")) || (key9 === "brand"))){const err72 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data34.id !== undefined){let data35 = data34.id;if(typeof data35 === "string"){if(!pattern4.test(data35)){const err73 = {instancePath:instancePath+"/participants/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}else {const err74 = {instancePath:instancePath+"/participants/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data34.type !== undefined){let data36 = data34.type;if(!(((((((data36 === "frontend") || (data36 === "backend")) || (data36 === "database")) || (data36 === "cloud")) || (data36 === "security")) || (data36 === "messagebus")) || (data36 === "external"))){const err75 = {instancePath:instancePath+"/participants/" + i0+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data34.label !== undefined){let data37 = data34.label;if(typeof data37 === "string"){if(func3(data37) < 1){const err76 = {instancePath:instancePath+"/participants/" + i0+"/label",schemaPath:"#/properties/participants/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}else {const err77 = {instancePath:instancePath+"/participants/" + i0+"/label",schemaPath:"#/properties/participants/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}if(data34.sublabel !== undefined){if(typeof data34.sublabel !== "string"){const err78 = {instancePath:instancePath+"/participants/" + i0+"/sublabel",schemaPath:"#/properties/participants/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}if(data34.brand !== undefined){let data39 = data34.brand;const _errs93 = errors;let valid26 = false;let passing0 = null;const _errs94 = errors;const _errs96 = errors;let valid27 = false;const _errs97 = errors;if(typeof data39 === "string"){if(func3(data39) > 80){const err79 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(!pattern17.test(data39)){const err80 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}var _valid1 = _errs97 === errors;valid27 = valid27 || _valid1;const _errs98 = errors;if(typeof data39 === "string"){if(!pattern18.test(data39)){const err81 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}var _valid1 = _errs98 === errors;valid27 = valid27 || _valid1;if(!valid27){const err82 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}else {errors = _errs96;if(vErrors !== null){if(_errs96){vErrors.length = _errs96;}else {vErrors = null;}}}if(typeof data39 === "string"){if(func3(data39) > 2048){const err83 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(func3(data39) < 1){const err84 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}var _valid0 = _errs94 === errors;if(_valid0){valid26 = true;passing0 = 0;}const _errs99 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.url === undefined){const err86 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}if(data39.sha256 === undefined){const err87 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}for(const key10 in data39){if(!((key10 === "url") || (key10 === "sha256"))){const err88 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data39.url !== undefined){let data40 = data39.url;if(typeof data40 === "string"){if(func3(data40) > 2048){const err89 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(func3(data40) < 8){const err90 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern18.test(data40)){const err91 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}else {const err92 = {instancePath:instancePath+"/participants/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data39.sha256 !== undefined){let data41 = data39.sha256;if(typeof data41 === "string"){if(!pattern20.test(data41)){const err93 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}else {const err94 = {instancePath:instancePath+"/participants/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}}else {const err95 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}var _valid0 = _errs99 === errors;if(_valid0 && valid26){valid26 = false;passing0 = [passing0, 1];}else {if(_valid0){valid26 = true;passing0 = 1;}}if(!valid26){const err96 = {instancePath:instancePath+"/participants/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}else {errors = _errs93;if(vErrors !== null){if(_errs93){vErrors.length = _errs93;}else {vErrors = null;}}}}}else {const err97 = {instancePath:instancePath+"/participants/" + i0,schemaPath:"#/properties/participants/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}}else {const err98 = {instancePath:instancePath+"/participants",schemaPath:"#/properties/participants/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data.segments !== undefined){let data42 = data.segments;if(Array.isArray(data42)){const len3 = data42.length;for(let i1=0; i1<len3; i1++){let data43 = data42[i1];if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.from === undefined){const err99 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(data43.to === undefined){const err100 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(data43.label === undefined){const err101 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}for(const key11 in data43){if(!(((key11 === "from") || (key11 === "to")) || (key11 === "label"))){const err102 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data43.from !== undefined){let data44 = data43.from;if(!((typeof data44 == "number") && (isFinite(data44)))){const err103 = {instancePath:instancePath+"/segments/" + i1+"/from",schemaPath:"#/properties/segments/items/properties/from/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data43.to !== undefined){let data45 = data43.to;if(!((typeof data45 == "number") && (isFinite(data45)))){const err104 = {instancePath:instancePath+"/segments/" + i1+"/to",schemaPath:"#/properties/segments/items/properties/to/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data43.label !== undefined){let data46 = data43.label;if(typeof data46 === "string"){if(func3(data46) < 1){const err105 = {instancePath:instancePath+"/segments/" + i1+"/label",schemaPath:"#/properties/segments/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}else {const err106 = {instancePath:instancePath+"/segments/" + i1+"/label",schemaPath:"#/properties/segments/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}}else {const err107 = {instancePath:instancePath+"/segments/" + i1,schemaPath:"#/properties/segments/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}}else {const err108 = {instancePath:instancePath+"/segments",schemaPath:"#/properties/segments/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data.messages !== undefined){let data47 = data.messages;if(Array.isArray(data47)){if(data47.length < 1){const err109 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}const len4 = data47.length;for(let i2=0; i2<len4; i2++){let data48 = data47[i2];if(data48 && typeof data48 == "object" && !Array.isArray(data48)){if(data48.from === undefined){const err110 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(data48.to === undefined){const err111 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data48.y === undefined){const err112 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "y"},message:"must have required property '"+"y"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data48.label === undefined){const err113 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}for(const key12 in data48){if(!(((((((key12 === "id") || (key12 === "from")) || (key12 === "to")) || (key12 === "y")) || (key12 === "label")) || (key12 === "variant")) || (key12 === "note"))){const err114 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data48.id !== undefined){let data49 = data48.id;if(typeof data49 === "string"){if(!pattern4.test(data49)){const err115 = {instancePath:instancePath+"/messages/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}else {const err116 = {instancePath:instancePath+"/messages/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data48.from !== undefined){let data50 = data48.from;if(typeof data50 === "string"){if(!pattern4.test(data50)){const err117 = {instancePath:instancePath+"/messages/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}else {const err118 = {instancePath:instancePath+"/messages/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data48.to !== undefined){let data51 = data48.to;if(typeof data51 === "string"){if(!pattern4.test(data51)){const err119 = {instancePath:instancePath+"/messages/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/messages/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data48.y !== undefined){let data52 = data48.y;if((typeof data52 == "number") && (isFinite(data52))){if(data52 < 160 || isNaN(data52)){const err121 = {instancePath:instancePath+"/messages/" + i2+"/y",schemaPath:"#/properties/messages/items/properties/y/minimum",keyword:"minimum",params:{comparison: ">=", limit: 160},message:"must be >= 160"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/messages/" + i2+"/y",schemaPath:"#/properties/messages/items/properties/y/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data48.label !== undefined){let data53 = data48.label;if(typeof data53 === "string"){if(func3(data53) < 1){const err123 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/messages/" + i2+"/label",schemaPath:"#/properties/messages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data48.variant !== undefined){let data54 = data48.variant;if(!(((((data54 === "default") || (data54 === "emphasis")) || (data54 === "security")) || (data54 === "dashed")) || (data54 === "return"))){const err125 = {instancePath:instancePath+"/messages/" + i2+"/variant",schemaPath:"#/properties/messages/items/properties/variant/enum",keyword:"enum",params:{allowedValues: schema68.properties.messages.items.properties.variant.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}if(data48.note !== undefined){if(typeof data48.note !== "string"){const err126 = {instancePath:instancePath+"/messages/" + i2+"/note",schemaPath:"#/properties/messages/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}}else {const err127 = {instancePath:instancePath+"/messages/" + i2,schemaPath:"#/properties/messages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}}else {const err128 = {instancePath:instancePath+"/messages",schemaPath:"#/properties/messages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data.activations !== undefined){let data56 = data.activations;if(Array.isArray(data56)){const len5 = data56.length;for(let i3=0; i3<len5; i3++){let data57 = data56[i3];if(data57 && typeof data57 == "object" && !Array.isArray(data57)){if(data57.participant === undefined){const err129 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "participant"},message:"must have required property '"+"participant"+"'"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(data57.from === undefined){const err130 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}if(data57.to === undefined){const err131 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}for(const key13 in data57){if(!((((key13 === "participant") || (key13 === "from")) || (key13 === "to")) || (key13 === "type"))){const err132 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data57.participant !== undefined){let data58 = data57.participant;if(typeof data58 === "string"){if(!pattern4.test(data58)){const err133 = {instancePath:instancePath+"/activations/" + i3+"/participant",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/activations/" + i3+"/participant",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data57.from !== undefined){let data59 = data57.from;if(!((typeof data59 == "number") && (isFinite(data59)))){const err135 = {instancePath:instancePath+"/activations/" + i3+"/from",schemaPath:"#/properties/activations/items/properties/from/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data57.to !== undefined){let data60 = data57.to;if(!((typeof data60 == "number") && (isFinite(data60)))){const err136 = {instancePath:instancePath+"/activations/" + i3+"/to",schemaPath:"#/properties/activations/items/properties/to/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}if(data57.type !== undefined){let data61 = data57.type;if(!(((((((data61 === "frontend") || (data61 === "backend")) || (data61 === "database")) || (data61 === "cloud")) || (data61 === "security")) || (data61 === "messagebus")) || (data61 === "external"))){const err137 = {instancePath:instancePath+"/activations/" + i3+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}else {const err138 = {instancePath:instancePath+"/activations/" + i3,schemaPath:"#/properties/activations/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}}else {const err139 = {instancePath:instancePath+"/activations",schemaPath:"#/properties/activations/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data.cards !== undefined){let data62 = data.cards;if(Array.isArray(data62)){const len6 = data62.length;for(let i4=0; i4<len6; i4++){let data63 = data62[i4];if(data63 && typeof data63 == "object" && !Array.isArray(data63)){if(data63.dot === undefined){const err140 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data63.title === undefined){const err141 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}if(data63.items === undefined){const err142 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}for(const key14 in data63){if(!(((key14 === "dot") || (key14 === "title")) || (key14 === "items"))){const err143 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data63.dot !== undefined){let data64 = data63.dot;if(!(((((((data64 === "cyan") || (data64 === "emerald")) || (data64 === "violet")) || (data64 === "amber")) || (data64 === "rose")) || (data64 === "orange")) || (data64 === "slate"))){const err144 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema67.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data63.title !== undefined){let data65 = data63.title;if(typeof data65 === "string"){if(func3(data65) < 1){const err145 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data63.items !== undefined){let data66 = data63.items;if(Array.isArray(data66)){const len7 = data66.length;for(let i5=0; i5<len7; i5++){if(typeof data66[i5] !== "string"){const err147 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}}else {const err148 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}else {const err149 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}}else {const err150 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}else {const err151 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}validate27.errors = vErrors;return errors === 0;}validate27.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const dataflow = validate30;const schema91 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/dataflow.schema.json","title":"Archify Data Flow Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","stages","nodes","flows"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"dataflow"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"default":{"$ref":"common.schema.json#/$defs/legendEntry"},"emphasis":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"dashed":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":360},{"type":"number","minimum":360}],"items":false,"minItems":2,"maxItems":2}}},"stages":{"type":"array","minItems":2,"maxItems":5,"items":{"type":"object","additionalProperties":false,"required":["label"],"properties":{"label":{"type":"string","minLength":1}}}},"nodes":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label","stage","row"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"stage":{"type":"integer","minimum":0},"row":{"type":"integer","minimum":0},"width":{"type":"number","minimum":48},"height":{"type":"number","minimum":36},"yOffset":{"type":"number"}}}},"flows":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1},"classification":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"route":{"enum":["auto","straight","vertical-channel","bottom-channel","top-channel"]},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"channelX":{"type":"number"},"channelY":{"type":"number"},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};const schema112 = {"enum":["left","right","top","bottom"]};const schema116 = {"type":"number","minimum":0.5};function validate31(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate31.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate31.errors = vErrors;return errors === 0;}validate31.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate30(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/dataflow.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate30.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.stages === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "stages"},message:"must have required property '"+"stages"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.nodes === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "nodes"},message:"must have required property '"+"nodes"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.flows === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "flows"},message:"must have required property '"+"flows"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "stages")) || (key0 === "nodes")) || (key0 === "flows")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("dataflow" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "dataflow"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema91.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate31(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate31.errors : vErrors.concat(validate31.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!(((((key3 === "default") || (key3 === "emphasis")) || (key3 === "security")) || (key3 === "dashed")) || (key3 === "database"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.default !== undefined){let data14 = data13.default;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/default/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/default/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/default",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.emphasis !== undefined){let data17 = data13.emphasis;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/emphasis/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/emphasis/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/emphasis",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.security !== undefined){let data20 = data13.security;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.dashed !== undefined){let data23 = data13.dashed;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/dashed/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/dashed/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/dashed",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.database !== undefined){let data26 = data13.database;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data2.viewBox !== undefined){let data29 = data2.viewBox;if(Array.isArray(data29)){if(data29.length > 2){const err59 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data29.length < 2){const err60 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}const len0 = data29.length;if(len0 > 0){let data30 = data29[0];if((typeof data30 == "number") && (isFinite(data30))){if(data30 < 360 || isNaN(data30)){const err61 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(len0 > 1){let data31 = data29[1];if((typeof data31 == "number") && (isFinite(data31))){if(data31 < 360 || isNaN(data31)){const err63 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 360},message:"must be >= 360"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}const len1 = data29.length;if(!(len1 <= 2)){const err65 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}else {const err66 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}}else {const err67 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data.stages !== undefined){let data32 = data.stages;if(Array.isArray(data32)){if(data32.length > 5){const err68 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(data32.length < 2){const err69 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}const len2 = data32.length;for(let i0=0; i0<len2; i0++){let data33 = data32[i0];if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.label === undefined){const err70 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}for(const key9 in data33){if(!(key9 === "label")){const err71 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) < 1){const err72 = {instancePath:instancePath+"/stages/" + i0+"/label",schemaPath:"#/properties/stages/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}else {const err73 = {instancePath:instancePath+"/stages/" + i0+"/label",schemaPath:"#/properties/stages/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}}else {const err74 = {instancePath:instancePath+"/stages/" + i0,schemaPath:"#/properties/stages/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}}else {const err75 = {instancePath:instancePath+"/stages",schemaPath:"#/properties/stages/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data.nodes !== undefined){let data35 = data.nodes;if(Array.isArray(data35)){if(data35.length < 2){const err76 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}const len3 = data35.length;for(let i1=0; i1<len3; i1++){let data36 = data35[i1];if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(data36.id === undefined){const err77 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data36.type === undefined){const err78 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data36.label === undefined){const err79 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(data36.stage === undefined){const err80 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "stage"},message:"must have required property '"+"stage"+"'"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data36.row === undefined){const err81 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/required",keyword:"required",params:{missingProperty: "row"},message:"must have required property '"+"row"+"'"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}for(const key10 in data36){if(!(func1.call(schema91.properties.nodes.items.properties, key10))){const err82 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}if(data36.id !== undefined){let data37 = data36.id;if(typeof data37 === "string"){if(!pattern4.test(data37)){const err83 = {instancePath:instancePath+"/nodes/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/nodes/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data36.type !== undefined){let data38 = data36.type;if(!(((((((data38 === "frontend") || (data38 === "backend")) || (data38 === "database")) || (data38 === "cloud")) || (data38 === "security")) || (data38 === "messagebus")) || (data38 === "external"))){const err85 = {instancePath:instancePath+"/nodes/" + i1+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data36.label !== undefined){let data39 = data36.label;if(typeof data39 === "string"){if(func3(data39) < 1){const err86 = {instancePath:instancePath+"/nodes/" + i1+"/label",schemaPath:"#/properties/nodes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/nodes/" + i1+"/label",schemaPath:"#/properties/nodes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data36.sublabel !== undefined){if(typeof data36.sublabel !== "string"){const err88 = {instancePath:instancePath+"/nodes/" + i1+"/sublabel",schemaPath:"#/properties/nodes/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data36.tag !== undefined){if(typeof data36.tag !== "string"){const err89 = {instancePath:instancePath+"/nodes/" + i1+"/tag",schemaPath:"#/properties/nodes/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data36.brand !== undefined){let data42 = data36.brand;const _errs101 = errors;let valid29 = false;let passing0 = null;const _errs102 = errors;const _errs104 = errors;let valid30 = false;const _errs105 = errors;if(typeof data42 === "string"){if(func3(data42) > 80){const err90 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(!pattern17.test(data42)){const err91 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}var _valid1 = _errs105 === errors;valid30 = valid30 || _valid1;const _errs106 = errors;if(typeof data42 === "string"){if(!pattern18.test(data42)){const err92 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}var _valid1 = _errs106 === errors;valid30 = valid30 || _valid1;if(!valid30){const err93 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}else {errors = _errs104;if(vErrors !== null){if(_errs104){vErrors.length = _errs104;}else {vErrors = null;}}}if(typeof data42 === "string"){if(func3(data42) > 2048){const err94 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(func3(data42) < 1){const err95 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}else {const err96 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}var _valid0 = _errs102 === errors;if(_valid0){valid29 = true;passing0 = 0;}const _errs107 = errors;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.url === undefined){const err97 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(data42.sha256 === undefined){const err98 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}for(const key11 in data42){if(!((key11 === "url") || (key11 === "sha256"))){const err99 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data42.url !== undefined){let data43 = data42.url;if(typeof data43 === "string"){if(func3(data43) > 2048){const err100 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func3(data43) < 8){const err101 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(!pattern18.test(data43)){const err102 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/nodes/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data42.sha256 !== undefined){let data44 = data42.sha256;if(typeof data44 === "string"){if(!pattern20.test(data44)){const err104 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/nodes/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}else {const err106 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}var _valid0 = _errs107 === errors;if(_valid0 && valid29){valid29 = false;passing0 = [passing0, 1];}else {if(_valid0){valid29 = true;passing0 = 1;}}if(!valid29){const err107 = {instancePath:instancePath+"/nodes/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}else {errors = _errs101;if(vErrors !== null){if(_errs101){vErrors.length = _errs101;}else {vErrors = null;}}}}if(data36.stage !== undefined){let data45 = data36.stage;if(!(((typeof data45 == "number") && (!(data45 % 1) && !isNaN(data45))) && (isFinite(data45)))){const err108 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}if((typeof data45 == "number") && (isFinite(data45))){if(data45 < 0 || isNaN(data45)){const err109 = {instancePath:instancePath+"/nodes/" + i1+"/stage",schemaPath:"#/properties/nodes/items/properties/stage/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}if(data36.row !== undefined){let data46 = data36.row;if(!(((typeof data46 == "number") && (!(data46 % 1) && !isNaN(data46))) && (isFinite(data46)))){const err110 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if((typeof data46 == "number") && (isFinite(data46))){if(data46 < 0 || isNaN(data46)){const err111 = {instancePath:instancePath+"/nodes/" + i1+"/row",schemaPath:"#/properties/nodes/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}}if(data36.width !== undefined){let data47 = data36.width;if((typeof data47 == "number") && (isFinite(data47))){if(data47 < 48 || isNaN(data47)){const err112 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}else {const err113 = {instancePath:instancePath+"/nodes/" + i1+"/width",schemaPath:"#/properties/nodes/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data36.height !== undefined){let data48 = data36.height;if((typeof data48 == "number") && (isFinite(data48))){if(data48 < 36 || isNaN(data48)){const err114 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}else {const err115 = {instancePath:instancePath+"/nodes/" + i1+"/height",schemaPath:"#/properties/nodes/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data36.yOffset !== undefined){let data49 = data36.yOffset;if(!((typeof data49 == "number") && (isFinite(data49)))){const err116 = {instancePath:instancePath+"/nodes/" + i1+"/yOffset",schemaPath:"#/properties/nodes/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/nodes/" + i1,schemaPath:"#/properties/nodes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}else {const err118 = {instancePath:instancePath+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}if(data.flows !== undefined){let data50 = data.flows;if(Array.isArray(data50)){const len4 = data50.length;for(let i2=0; i2<len4; i2++){let data51 = data50[i2];if(data51 && typeof data51 == "object" && !Array.isArray(data51)){if(data51.from === undefined){const err119 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}if(data51.to === undefined){const err120 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}if(data51.label === undefined){const err121 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}for(const key12 in data51){if(!(func1.call(schema91.properties.flows.items.properties, key12))){const err122 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data51.id !== undefined){let data52 = data51.id;if(typeof data52 === "string"){if(!pattern4.test(data52)){const err123 = {instancePath:instancePath+"/flows/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/flows/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data51.from !== undefined){let data53 = data51.from;if(typeof data53 === "string"){if(!pattern4.test(data53)){const err125 = {instancePath:instancePath+"/flows/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}else {const err126 = {instancePath:instancePath+"/flows/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}if(data51.to !== undefined){let data54 = data51.to;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err127 = {instancePath:instancePath+"/flows/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}else {const err128 = {instancePath:instancePath+"/flows/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data51.label !== undefined){let data55 = data51.label;if(typeof data55 === "string"){if(func3(data55) < 1){const err129 = {instancePath:instancePath+"/flows/" + i2+"/label",schemaPath:"#/properties/flows/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}else {const err130 = {instancePath:instancePath+"/flows/" + i2+"/label",schemaPath:"#/properties/flows/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}if(data51.classification !== undefined){if(typeof data51.classification !== "string"){const err131 = {instancePath:instancePath+"/flows/" + i2+"/classification",schemaPath:"#/properties/flows/items/properties/classification/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data51.variant !== undefined){let data57 = data51.variant;if(!((((data57 === "default") || (data57 === "emphasis")) || (data57 === "security")) || (data57 === "dashed"))){const err132 = {instancePath:instancePath+"/flows/" + i2+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema62.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data51.route !== undefined){let data58 = data51.route;if(!(((((data58 === "auto") || (data58 === "straight")) || (data58 === "vertical-channel")) || (data58 === "bottom-channel")) || (data58 === "top-channel"))){const err133 = {instancePath:instancePath+"/flows/" + i2+"/route",schemaPath:"#/properties/flows/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema91.properties.flows.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(data51.fromSide !== undefined){let data59 = data51.fromSide;if(!((((data59 === "left") || (data59 === "right")) || (data59 === "top")) || (data59 === "bottom"))){const err134 = {instancePath:instancePath+"/flows/" + i2+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data51.toSide !== undefined){let data60 = data51.toSide;if(!((((data60 === "left") || (data60 === "right")) || (data60 === "top")) || (data60 === "bottom"))){const err135 = {instancePath:instancePath+"/flows/" + i2+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data51.channelX !== undefined){let data61 = data51.channelX;if(!((typeof data61 == "number") && (isFinite(data61)))){const err136 = {instancePath:instancePath+"/flows/" + i2+"/channelX",schemaPath:"#/properties/flows/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}if(data51.channelY !== undefined){let data62 = data51.channelY;if(!((typeof data62 == "number") && (isFinite(data62)))){const err137 = {instancePath:instancePath+"/flows/" + i2+"/channelY",schemaPath:"#/properties/flows/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}if(data51.labelAt !== undefined){let data63 = data51.labelAt;if(Array.isArray(data63)){if(data63.length > 2){const err138 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data63.length < 2){const err139 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}const len5 = data63.length;if(len5 > 0){let data64 = data63[0];if(!((typeof data64 == "number") && (isFinite(data64)))){const err140 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(len5 > 1){let data65 = data63[1];if(!((typeof data65 == "number") && (isFinite(data65)))){const err141 = {instancePath:instancePath+"/flows/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}const len6 = data63.length;if(!(len6 <= 2)){const err142 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}else {const err143 = {instancePath:instancePath+"/flows/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data51.labelDx !== undefined){let data66 = data51.labelDx;if(!((typeof data66 == "number") && (isFinite(data66)))){const err144 = {instancePath:instancePath+"/flows/" + i2+"/labelDx",schemaPath:"#/properties/flows/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data51.labelDy !== undefined){let data67 = data51.labelDy;if(!((typeof data67 == "number") && (isFinite(data67)))){const err145 = {instancePath:instancePath+"/flows/" + i2+"/labelDy",schemaPath:"#/properties/flows/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data51.labelSegment !== undefined){let data68 = data51.labelSegment;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err146 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err147 = {instancePath:instancePath+"/flows/" + i2+"/labelSegment",schemaPath:"#/properties/flows/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}}if(data51.via !== undefined){let data69 = data51.via;if(Array.isArray(data69)){const len7 = data69.length;for(let i3=0; i3<len7; i3++){let data70 = data69[i3];if(Array.isArray(data70)){if(data70.length > 2){const err148 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}if(data70.length < 2){const err149 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}const len8 = data70.length;if(len8 > 0){let data71 = data70[0];if(!((typeof data71 == "number") && (isFinite(data71)))){const err150 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(len8 > 1){let data72 = data70[1];if(!((typeof data72 == "number") && (isFinite(data72)))){const err151 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}const len9 = data70.length;if(!(len9 <= 2)){const err152 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/flows/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}}else {const err154 = {instancePath:instancePath+"/flows/" + i2+"/via",schemaPath:"#/properties/flows/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data51.width !== undefined){let data73 = data51.width;if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 0.5 || isNaN(data73)){const err155 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}else {const err156 = {instancePath:instancePath+"/flows/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}}else {const err157 = {instancePath:instancePath+"/flows/" + i2,schemaPath:"#/properties/flows/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}}else {const err158 = {instancePath:instancePath+"/flows",schemaPath:"#/properties/flows/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}if(data.cards !== undefined){let data74 = data.cards;if(Array.isArray(data74)){const len10 = data74.length;for(let i4=0; i4<len10; i4++){let data75 = data74[i4];if(data75 && typeof data75 == "object" && !Array.isArray(data75)){if(data75.dot === undefined){const err159 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}if(data75.title === undefined){const err160 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(data75.items === undefined){const err161 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}for(const key13 in data75){if(!(((key13 === "dot") || (key13 === "title")) || (key13 === "items"))){const err162 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}if(data75.dot !== undefined){let data76 = data75.dot;if(!(((((((data76 === "cyan") || (data76 === "emerald")) || (data76 === "violet")) || (data76 === "amber")) || (data76 === "rose")) || (data76 === "orange")) || (data76 === "slate"))){const err163 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema67.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data75.title !== undefined){let data77 = data75.title;if(typeof data77 === "string"){if(func3(data77) < 1){const err164 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data75.items !== undefined){let data78 = data75.items;if(Array.isArray(data78)){const len11 = data78.length;for(let i5=0; i5<len11; i5++){if(typeof data78[i5] !== "string"){const err166 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}}else {const err167 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}}else {const err168 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}}else {const err169 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}}else {const err170 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}validate30.errors = vErrors;return errors === 0;}validate30.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const lifecycle = validate33;const schema118 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json","title":"Archify Lifecycle Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","lanes","states","transitions"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"lifecycle"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"start":{"$ref":"common.schema.json#/$defs/legendEntry"},"active":{"$ref":"common.schema.json#/$defs/legendEntry"},"waiting":{"$ref":"common.schema.json#/$defs/legendEntry"},"decision":{"$ref":"common.schema.json#/$defs/legendEntry"},"success":{"$ref":"common.schema.json#/$defs/legendEntry"},"failure":{"$ref":"common.schema.json#/$defs/legendEntry"},"neutral":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":420},{"type":"number","minimum":566}],"items":false,"minItems":2,"maxItems":2}}},"lanes":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","additionalProperties":false,"required":["id","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string","minLength":1}}}},"states":{"type":"array","minItems":2,"items":{"type":"object","additionalProperties":false,"required":["id","type","label","lane","col"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"enum":["start","active","waiting","decision","success","failure","neutral","external"]},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"step":{"type":"string"},"lane":{"$ref":"common.schema.json#/$defs/id"},"col":{"type":"integer","minimum":0,"maximum":4},"width":{"type":"number","minimum":48},"height":{"type":"number","minimum":36},"yOffset":{"type":"number"}}}},"transitions":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"note":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"route":{"enum":["auto","straight","drop","bottom-channel","top-channel","right-channel","left-channel"]},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"channelX":{"type":"number"},"channelY":{"type":"number"},"cornerRadius":{"type":"number","minimum":0},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};function validate34(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate34.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate34.errors = vErrors;return errors === 0;}validate34.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate33(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/lifecycle.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate33.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.lanes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "lanes"},message:"must have required property '"+"lanes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.states === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "states"},message:"must have required property '"+"states"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.transitions === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transitions"},message:"must have required property '"+"transitions"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "lanes")) || (key0 === "states")) || (key0 === "transitions")) || (key0 === "cards"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err7 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.diagram_type !== undefined){if("lifecycle" !== data.diagram_type){const err8 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "lifecycle"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err9 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}for(const key1 in data2){if(!(func1.call(schema118.properties.meta.properties, key1))){const err10 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err11 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err13 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err14 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err15 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err16 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err17 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err18 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data2.views !== undefined){if(!(validate34(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate34.errors : vErrors.concat(validate34.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data11 = data2.legend;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){for(const key2 in data11){if(!((key2 === "mode") || (key2 === "entries"))){const err19 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data11.mode !== undefined){let data12 = data11.mode;if(!(((data12 === "auto") || (data12 === "all")) || (data12 === "hidden"))){const err20 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.entries !== undefined){let data13 = data11.entries;if(data13 && typeof data13 == "object" && !Array.isArray(data13)){for(const key3 in data13){if(!((((((((key3 === "start") || (key3 === "active")) || (key3 === "waiting")) || (key3 === "decision")) || (key3 === "success")) || (key3 === "failure")) || (key3 === "neutral")) || (key3 === "external"))){const err21 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data13.start !== undefined){let data14 = data13.start;if(data14 && typeof data14 == "object" && !Array.isArray(data14)){if(Object.keys(data14).length < 1){const err22 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}for(const key4 in data14){if(!((key4 === "label") || (key4 === "visible"))){const err23 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data14.label !== undefined){let data15 = data14.label;if(typeof data15 === "string"){if(func3(data15) > 80){const err24 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(func3(data15) < 1){const err25 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/meta/legend/entries/start/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data14.visible !== undefined){if(typeof data14.visible !== "boolean"){const err27 = {instancePath:instancePath+"/meta/legend/entries/start/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/meta/legend/entries/start",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data13.active !== undefined){let data17 = data13.active;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(Object.keys(data17).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data17){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data17.label !== undefined){let data18 = data17.label;if(typeof data18 === "string"){if(func3(data18) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data18) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/active/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data17.visible !== undefined){if(typeof data17.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/active/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/active",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data13.waiting !== undefined){let data20 = data13.waiting;if(data20 && typeof data20 == "object" && !Array.isArray(data20)){if(Object.keys(data20).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data20){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data20.label !== undefined){let data21 = data20.label;if(typeof data21 === "string"){if(func3(data21) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data21) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/waiting/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data20.visible !== undefined){if(typeof data20.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/waiting/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/waiting",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data13.decision !== undefined){let data23 = data13.decision;if(data23 && typeof data23 == "object" && !Array.isArray(data23)){if(Object.keys(data23).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data23){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data23.label !== undefined){let data24 = data23.label;if(typeof data24 === "string"){if(func3(data24) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data24) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/decision/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data23.visible !== undefined){if(typeof data23.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/decision/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/decision",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data13.success !== undefined){let data26 = data13.success;if(data26 && typeof data26 == "object" && !Array.isArray(data26)){if(Object.keys(data26).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data26){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data26.label !== undefined){let data27 = data26.label;if(typeof data27 === "string"){if(func3(data27) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data27) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/success/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data26.visible !== undefined){if(typeof data26.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/success/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/success",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data13.failure !== undefined){let data29 = data13.failure;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(Object.keys(data29).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data29){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data29.label !== undefined){let data30 = data29.label;if(typeof data30 === "string"){if(func3(data30) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data30) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/failure/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data29.visible !== undefined){if(typeof data29.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/failure/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/failure",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data13.neutral !== undefined){let data32 = data13.neutral;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(Object.keys(data32).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data32){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data32.label !== undefined){let data33 = data32.label;if(typeof data33 === "string"){if(func3(data33) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data33) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/neutral/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data32.visible !== undefined){if(typeof data32.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/neutral/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/neutral",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data13.external !== undefined){let data35 = data13.external;if(data35 && typeof data35 == "object" && !Array.isArray(data35)){if(Object.keys(data35).length < 1){const err71 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key11 in data35){if(!((key11 === "label") || (key11 === "visible"))){const err72 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data35.label !== undefined){let data36 = data35.label;if(typeof data36 === "string"){if(func3(data36) > 80){const err73 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(func3(data36) < 1){const err74 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data35.visible !== undefined){if(typeof data35.visible !== "boolean"){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data2.viewBox !== undefined){let data38 = data2.viewBox;if(Array.isArray(data38)){if(data38.length > 2){const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data38.length < 2){const err81 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}const len0 = data38.length;if(len0 > 0){let data39 = data38[0];if((typeof data39 == "number") && (isFinite(data39))){if(data39 < 420 || isNaN(data39)){const err82 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 420},message:"must be >= 420"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(len0 > 1){let data40 = data38[1];if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 566 || isNaN(data40)){const err84 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 566},message:"must be >= 566"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}const len1 = data38.length;if(!(len1 <= 2)){const err86 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}else {const err88 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.lanes !== undefined){let data41 = data.lanes;if(Array.isArray(data41)){if(data41.length > 4){const err89 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(data41.length < 1){const err90 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}const len2 = data41.length;for(let i0=0; i0<len2; i0++){let data42 = data41[i0];if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.id === undefined){const err91 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}if(data42.label === undefined){const err92 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}for(const key12 in data42){if(!((key12 === "id") || (key12 === "label"))){const err93 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}if(data42.id !== undefined){let data43 = data42.id;if(typeof data43 === "string"){if(!pattern4.test(data43)){const err94 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}else {const err95 = {instancePath:instancePath+"/lanes/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data42.label !== undefined){let data44 = data42.label;if(typeof data44 === "string"){if(func3(data44) < 1){const err96 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}else {const err97 = {instancePath:instancePath+"/lanes/" + i0+"/label",schemaPath:"#/properties/lanes/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}}else {const err98 = {instancePath:instancePath+"/lanes/" + i0,schemaPath:"#/properties/lanes/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}}else {const err99 = {instancePath:instancePath+"/lanes",schemaPath:"#/properties/lanes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data.states !== undefined){let data45 = data.states;if(Array.isArray(data45)){if(data45.length < 2){const err100 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}const len3 = data45.length;for(let i1=0; i1<len3; i1++){let data46 = data45[i1];if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.id === undefined){const err101 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(data46.type === undefined){const err102 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(data46.label === undefined){const err103 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(data46.lane === undefined){const err104 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "lane"},message:"must have required property '"+"lane"+"'"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(data46.col === undefined){const err105 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/required",keyword:"required",params:{missingProperty: "col"},message:"must have required property '"+"col"+"'"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}for(const key13 in data46){if(!(func1.call(schema118.properties.states.items.properties, key13))){const err106 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data46.id !== undefined){let data47 = data46.id;if(typeof data47 === "string"){if(!pattern4.test(data47)){const err107 = {instancePath:instancePath+"/states/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/states/" + i1+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data46.type !== undefined){let data48 = data46.type;if(!((((((((data48 === "start") || (data48 === "active")) || (data48 === "waiting")) || (data48 === "decision")) || (data48 === "success")) || (data48 === "failure")) || (data48 === "neutral")) || (data48 === "external"))){const err109 = {instancePath:instancePath+"/states/" + i1+"/type",schemaPath:"#/properties/states/items/properties/type/enum",keyword:"enum",params:{allowedValues: schema118.properties.states.items.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data46.label !== undefined){let data49 = data46.label;if(typeof data49 === "string"){if(func3(data49) < 1){const err110 = {instancePath:instancePath+"/states/" + i1+"/label",schemaPath:"#/properties/states/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}else {const err111 = {instancePath:instancePath+"/states/" + i1+"/label",schemaPath:"#/properties/states/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data46.sublabel !== undefined){if(typeof data46.sublabel !== "string"){const err112 = {instancePath:instancePath+"/states/" + i1+"/sublabel",schemaPath:"#/properties/states/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data46.tag !== undefined){if(typeof data46.tag !== "string"){const err113 = {instancePath:instancePath+"/states/" + i1+"/tag",schemaPath:"#/properties/states/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data46.brand !== undefined){let data52 = data46.brand;const _errs127 = errors;let valid35 = false;let passing0 = null;const _errs128 = errors;const _errs130 = errors;let valid36 = false;const _errs131 = errors;if(typeof data52 === "string"){if(func3(data52) > 80){const err114 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(!pattern17.test(data52)){const err115 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}var _valid1 = _errs131 === errors;valid36 = valid36 || _valid1;const _errs132 = errors;if(typeof data52 === "string"){if(!pattern18.test(data52)){const err116 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}var _valid1 = _errs132 === errors;valid36 = valid36 || _valid1;if(!valid36){const err117 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}else {errors = _errs130;if(vErrors !== null){if(_errs130){vErrors.length = _errs130;}else {vErrors = null;}}}if(typeof data52 === "string"){if(func3(data52) > 2048){const err118 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(func3(data52) < 1){const err119 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}else {const err120 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}var _valid0 = _errs128 === errors;if(_valid0){valid35 = true;passing0 = 0;}const _errs133 = errors;if(data52 && typeof data52 == "object" && !Array.isArray(data52)){if(data52.url === undefined){const err121 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}if(data52.sha256 === undefined){const err122 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}for(const key14 in data52){if(!((key14 === "url") || (key14 === "sha256"))){const err123 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}if(data52.url !== undefined){let data53 = data52.url;if(typeof data53 === "string"){if(func3(data53) > 2048){const err124 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if(func3(data53) < 8){const err125 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(!pattern18.test(data53)){const err126 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}else {const err127 = {instancePath:instancePath+"/states/" + i1+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data52.sha256 !== undefined){let data54 = data52.sha256;if(typeof data54 === "string"){if(!pattern20.test(data54)){const err128 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}else {const err129 = {instancePath:instancePath+"/states/" + i1+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}}}else {const err130 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}var _valid0 = _errs133 === errors;if(_valid0 && valid35){valid35 = false;passing0 = [passing0, 1];}else {if(_valid0){valid35 = true;passing0 = 1;}}if(!valid35){const err131 = {instancePath:instancePath+"/states/" + i1+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}else {errors = _errs127;if(vErrors !== null){if(_errs127){vErrors.length = _errs127;}else {vErrors = null;}}}}if(data46.step !== undefined){if(typeof data46.step !== "string"){const err132 = {instancePath:instancePath+"/states/" + i1+"/step",schemaPath:"#/properties/states/items/properties/step/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}if(data46.lane !== undefined){let data56 = data46.lane;if(typeof data56 === "string"){if(!pattern4.test(data56)){const err133 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}else {const err134 = {instancePath:instancePath+"/states/" + i1+"/lane",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}if(data46.col !== undefined){let data57 = data46.col;if(!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))){const err135 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 > 4 || isNaN(data57)){const err136 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4},message:"must be <= 4"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data57 < 0 || isNaN(data57)){const err137 = {instancePath:instancePath+"/states/" + i1+"/col",schemaPath:"#/properties/states/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}if(data46.width !== undefined){let data58 = data46.width;if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 48 || isNaN(data58)){const err138 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/minimum",keyword:"minimum",params:{comparison: ">=", limit: 48},message:"must be >= 48"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/states/" + i1+"/width",schemaPath:"#/properties/states/items/properties/width/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data46.height !== undefined){let data59 = data46.height;if((typeof data59 == "number") && (isFinite(data59))){if(data59 < 36 || isNaN(data59)){const err140 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/minimum",keyword:"minimum",params:{comparison: ">=", limit: 36},message:"must be >= 36"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}else {const err141 = {instancePath:instancePath+"/states/" + i1+"/height",schemaPath:"#/properties/states/items/properties/height/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data46.yOffset !== undefined){let data60 = data46.yOffset;if(!((typeof data60 == "number") && (isFinite(data60)))){const err142 = {instancePath:instancePath+"/states/" + i1+"/yOffset",schemaPath:"#/properties/states/items/properties/yOffset/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath:instancePath+"/states/" + i1,schemaPath:"#/properties/states/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}}else {const err144 = {instancePath:instancePath+"/states",schemaPath:"#/properties/states/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}if(data.transitions !== undefined){let data61 = data.transitions;if(Array.isArray(data61)){const len4 = data61.length;for(let i2=0; i2<len4; i2++){let data62 = data61[i2];if(data62 && typeof data62 == "object" && !Array.isArray(data62)){if(data62.from === undefined){const err145 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}if(data62.to === undefined){const err146 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}for(const key15 in data62){if(!(func1.call(schema118.properties.transitions.items.properties, key15))){const err147 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}if(data62.id !== undefined){let data63 = data62.id;if(typeof data63 === "string"){if(!pattern4.test(data63)){const err148 = {instancePath:instancePath+"/transitions/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}else {const err149 = {instancePath:instancePath+"/transitions/" + i2+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data62.from !== undefined){let data64 = data62.from;if(typeof data64 === "string"){if(!pattern4.test(data64)){const err150 = {instancePath:instancePath+"/transitions/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}else {const err151 = {instancePath:instancePath+"/transitions/" + i2+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}}if(data62.to !== undefined){let data65 = data62.to;if(typeof data65 === "string"){if(!pattern4.test(data65)){const err152 = {instancePath:instancePath+"/transitions/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/transitions/" + i2+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}if(data62.label !== undefined){if(typeof data62.label !== "string"){const err154 = {instancePath:instancePath+"/transitions/" + i2+"/label",schemaPath:"#/properties/transitions/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}if(data62.note !== undefined){if(typeof data62.note !== "string"){const err155 = {instancePath:instancePath+"/transitions/" + i2+"/note",schemaPath:"#/properties/transitions/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}if(data62.variant !== undefined){let data68 = data62.variant;if(!((((data68 === "default") || (data68 === "emphasis")) || (data68 === "security")) || (data68 === "dashed"))){const err156 = {instancePath:instancePath+"/transitions/" + i2+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema62.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}}if(data62.route !== undefined){let data69 = data62.route;if(!(((((((data69 === "auto") || (data69 === "straight")) || (data69 === "drop")) || (data69 === "bottom-channel")) || (data69 === "top-channel")) || (data69 === "right-channel")) || (data69 === "left-channel"))){const err157 = {instancePath:instancePath+"/transitions/" + i2+"/route",schemaPath:"#/properties/transitions/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema118.properties.transitions.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}if(data62.fromSide !== undefined){let data70 = data62.fromSide;if(!((((data70 === "left") || (data70 === "right")) || (data70 === "top")) || (data70 === "bottom"))){const err158 = {instancePath:instancePath+"/transitions/" + i2+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}if(data62.toSide !== undefined){let data71 = data62.toSide;if(!((((data71 === "left") || (data71 === "right")) || (data71 === "top")) || (data71 === "bottom"))){const err159 = {instancePath:instancePath+"/transitions/" + i2+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}if(data62.channelX !== undefined){let data72 = data62.channelX;if(!((typeof data72 == "number") && (isFinite(data72)))){const err160 = {instancePath:instancePath+"/transitions/" + i2+"/channelX",schemaPath:"#/properties/transitions/items/properties/channelX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}if(data62.channelY !== undefined){let data73 = data62.channelY;if(!((typeof data73 == "number") && (isFinite(data73)))){const err161 = {instancePath:instancePath+"/transitions/" + i2+"/channelY",schemaPath:"#/properties/transitions/items/properties/channelY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data62.cornerRadius !== undefined){let data74 = data62.cornerRadius;if((typeof data74 == "number") && (isFinite(data74))){if(data74 < 0 || isNaN(data74)){const err162 = {instancePath:instancePath+"/transitions/" + i2+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/transitions/" + i2+"/cornerRadius",schemaPath:"#/properties/transitions/items/properties/cornerRadius/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data62.labelAt !== undefined){let data75 = data62.labelAt;if(Array.isArray(data75)){if(data75.length > 2){const err164 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if(data75.length < 2){const err165 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}const len5 = data75.length;if(len5 > 0){let data76 = data75[0];if(!((typeof data76 == "number") && (isFinite(data76)))){const err166 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}if(len5 > 1){let data77 = data75[1];if(!((typeof data77 == "number") && (isFinite(data77)))){const err167 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}const len6 = data75.length;if(!(len6 <= 2)){const err168 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/transitions/" + i2+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(data62.labelDx !== undefined){let data78 = data62.labelDx;if(!((typeof data78 == "number") && (isFinite(data78)))){const err170 = {instancePath:instancePath+"/transitions/" + i2+"/labelDx",schemaPath:"#/properties/transitions/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}if(data62.labelDy !== undefined){let data79 = data62.labelDy;if(!((typeof data79 == "number") && (isFinite(data79)))){const err171 = {instancePath:instancePath+"/transitions/" + i2+"/labelDy",schemaPath:"#/properties/transitions/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(data62.labelSegment !== undefined){let data80 = data62.labelSegment;if(!(((typeof data80 == "number") && (!(data80 % 1) && !isNaN(data80))) && (isFinite(data80)))){const err172 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}if((typeof data80 == "number") && (isFinite(data80))){if(data80 < 0 || isNaN(data80)){const err173 = {instancePath:instancePath+"/transitions/" + i2+"/labelSegment",schemaPath:"#/properties/transitions/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}if(data62.via !== undefined){let data81 = data62.via;if(Array.isArray(data81)){const len7 = data81.length;for(let i3=0; i3<len7; i3++){let data82 = data81[i3];if(Array.isArray(data82)){if(data82.length > 2){const err174 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(data82.length < 2){const err175 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}const len8 = data82.length;if(len8 > 0){let data83 = data82[0];if(!((typeof data83 == "number") && (isFinite(data83)))){const err176 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}if(len8 > 1){let data84 = data82[1];if(!((typeof data84 == "number") && (isFinite(data84)))){const err177 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}const len9 = data82.length;if(!(len9 <= 2)){const err178 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}else {const err179 = {instancePath:instancePath+"/transitions/" + i2+"/via/" + i3,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}}else {const err180 = {instancePath:instancePath+"/transitions/" + i2+"/via",schemaPath:"#/properties/transitions/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data62.width !== undefined){let data85 = data62.width;if((typeof data85 == "number") && (isFinite(data85))){if(data85 < 0.5 || isNaN(data85)){const err181 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/transitions/" + i2+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}}else {const err183 = {instancePath:instancePath+"/transitions/" + i2,schemaPath:"#/properties/transitions/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/transitions",schemaPath:"#/properties/transitions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}if(data.cards !== undefined){let data86 = data.cards;if(Array.isArray(data86)){const len10 = data86.length;for(let i4=0; i4<len10; i4++){let data87 = data86[i4];if(data87 && typeof data87 == "object" && !Array.isArray(data87)){if(data87.dot === undefined){const err185 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}if(data87.title === undefined){const err186 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if(data87.items === undefined){const err187 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}for(const key16 in data87){if(!(((key16 === "dot") || (key16 === "title")) || (key16 === "items"))){const err188 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}if(data87.dot !== undefined){let data88 = data87.dot;if(!(((((((data88 === "cyan") || (data88 === "emerald")) || (data88 === "violet")) || (data88 === "amber")) || (data88 === "rose")) || (data88 === "orange")) || (data88 === "slate"))){const err189 = {instancePath:instancePath+"/cards/" + i4+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema67.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}if(data87.title !== undefined){let data89 = data87.title;if(typeof data89 === "string"){if(func3(data89) < 1){const err190 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}else {const err191 = {instancePath:instancePath+"/cards/" + i4+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}if(data87.items !== undefined){let data90 = data87.items;if(Array.isArray(data90)){const len11 = data90.length;for(let i5=0; i5<len11; i5++){if(typeof data90[i5] !== "string"){const err192 = {instancePath:instancePath+"/cards/" + i4+"/items/" + i5,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}}else {const err193 = {instancePath:instancePath+"/cards/" + i4+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}}else {const err194 = {instancePath:instancePath+"/cards/" + i4,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}}else {const err195 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}}else {const err196 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}validate33.errors = vErrors;return errors === 0;}validate33.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};export const architecture = validate36;const schema149 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://github.com/tt-a1i/archify/schemas/architecture.schema.json","title":"Archify Architecture Diagram","type":"object","additionalProperties":false,"required":["schema_version","diagram_type","meta","components"],"properties":{"schema_version":{"const":1},"diagram_type":{"const":"architecture"},"meta":{"type":"object","additionalProperties":false,"required":["title"],"properties":{"title":{"type":"string","minLength":1},"locale":{"$ref":"common.schema.json#/$defs/locale"},"subtitle":{"type":"string"},"output":{"type":"string"},"animation":{"$ref":"common.schema.json#/$defs/animation"},"visual_preset":{"$ref":"common.schema.json#/$defs/visualPreset"},"quality_profile":{"$ref":"common.schema.json#/$defs/qualityProfile"},"engineering_profile":{"enum":["deployment-ownership"]},"repository":{"type":"object","additionalProperties":false,"required":["url","revision"],"properties":{"url":{"type":"string","pattern":"^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"},"revision":{"type":"string","pattern":"^[a-fA-F0-9]{40}$"}}},"views":{"$ref":"common.schema.json#/$defs/guidedViews"},"legend":{"type":"object","additionalProperties":false,"properties":{"mode":{"$ref":"common.schema.json#/$defs/legendMode"},"entries":{"type":"object","additionalProperties":false,"properties":{"frontend":{"$ref":"common.schema.json#/$defs/legendEntry"},"backend":{"$ref":"common.schema.json#/$defs/legendEntry"},"database":{"$ref":"common.schema.json#/$defs/legendEntry"},"cloud":{"$ref":"common.schema.json#/$defs/legendEntry"},"security":{"$ref":"common.schema.json#/$defs/legendEntry"},"messagebus":{"$ref":"common.schema.json#/$defs/legendEntry"},"external":{"$ref":"common.schema.json#/$defs/legendEntry"}}}}},"viewBox":{"type":"array","prefixItems":[{"type":"number","minimum":320},{"type":"number","minimum":240}],"items":false,"minItems":2,"maxItems":2}}},"layout":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"enum":["grid"]},"origin":{"$ref":"common.schema.json#/$defs/point"},"cols":{"type":"integer","minimum":1,"maximum":12},"gapX":{"type":"number","minimum":0},"gapY":{"type":"number","minimum":0},"cellW":{"type":"number","minimum":40},"cellH":{"type":"number","minimum":24}}},"components":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["id","type","label"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"type":{"$ref":"common.schema.json#/$defs/componentType"},"label":{"type":"string","minLength":1},"sublabel":{"type":"string"},"tag":{"type":"string"},"brand":{"$ref":"common.schema.json#/$defs/brandMark"},"sources":{"type":"array","minItems":1,"maxItems":3,"items":{"type":"object","additionalProperties":false,"required":["path"],"properties":{"path":{"type":"string","minLength":1,"maxLength":240},"line":{"type":"integer","minimum":1},"end_line":{"type":"integer","minimum":1},"label":{"type":"string","minLength":1,"maxLength":48}}}},"row":{"type":"integer","minimum":0},"col":{"type":"integer","minimum":0},"pos":{"$ref":"common.schema.json#/$defs/point"},"size":{"type":"array","prefixItems":[{"type":"number","exclusiveMinimum":0},{"type":"number","exclusiveMinimum":0}],"items":false,"minItems":2,"maxItems":2}}}},"boundaries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["kind","label","wraps"],"properties":{"kind":{"enum":["region","security-group"]},"label":{"type":"string","minLength":1},"wraps":{"type":"array","minItems":1,"items":{"$ref":"common.schema.json#/$defs/id"}},"pad":{"type":"number","minimum":0}}}},"connections":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["from","to"],"properties":{"id":{"$ref":"common.schema.json#/$defs/id"},"from":{"$ref":"common.schema.json#/$defs/id"},"to":{"$ref":"common.schema.json#/$defs/id"},"label":{"type":"string"},"variant":{"$ref":"common.schema.json#/$defs/variant"},"fromSide":{"$ref":"common.schema.json#/$defs/side"},"toSide":{"$ref":"common.schema.json#/$defs/side"},"route":{"enum":["auto","straight","orthogonal-h","orthogonal-v"]},"via":{"type":"array","items":{"$ref":"common.schema.json#/$defs/point"}},"labelAt":{"$ref":"common.schema.json#/$defs/point"},"labelDx":{"type":"number"},"labelDy":{"type":"number"},"labelSegment":{"type":"integer","minimum":0},"width":{"$ref":"common.schema.json#/$defs/relationshipWidth"}}}},"cards":{"$ref":"common.schema.json#/$defs/cards"}}};const pattern57 = new RegExp("^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$", "u");const pattern58 = new RegExp("^[a-fA-F0-9]{40}$", "u");function validate37(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate37.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(Array.isArray(data)){if(data.length > 5){const err0 = {instancePath,schemaPath:"#/maxItems",keyword:"maxItems",params:{limit: 5},message:"must NOT have more than 5 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}const len0 = data.length;for(let i0=0; i0<len0; i0++){let data0 = data[i0];if(data0 && typeof data0 == "object" && !Array.isArray(data0)){if(data0.id === undefined){const err1 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data0.label === undefined){const err2 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data0.focus === undefined){const err3 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/required",keyword:"required",params:{missingProperty: "focus"},message:"must have required property '"+"focus"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data0){if(!((((key0 === "id") || (key0 === "label")) || (key0 === "focus")) || (key0 === "note"))){const err4 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data0.id !== undefined){let data1 = data0.id;if(typeof data1 === "string"){if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/" + i0+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data0.label !== undefined){let data2 = data0.label;if(typeof data2 === "string"){if(func3(data2) > 48){const err7 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func3(data2) < 1){const err8 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/" + i0+"/label",schemaPath:"#/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data0.focus !== undefined){let data3 = data0.focus;if(Array.isArray(data3)){if(data3.length < 1){const err10 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}const len1 = data3.length;for(let i1=0; i1<len1; i1++){let data4 = data3[i1];if(typeof data4 === "string"){if(!pattern4.test(data4)){const err11 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/" + i0+"/focus/" + i1,schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}else {const err13 = {instancePath:instancePath+"/" + i0+"/focus",schemaPath:"#/items/properties/focus/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data0.note !== undefined){let data5 = data0.note;if(typeof data5 === "string"){if(func3(data5) > 140){const err14 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/maxLength",keyword:"maxLength",params:{limit: 140},message:"must NOT have more than 140 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/" + i0+"/note",schemaPath:"#/items/properties/note/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/" + i0,schemaPath:"#/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate37.errors = vErrors;return errors === 0;}validate37.evaluated = {"items":true,"dynamicProps":false,"dynamicItems":false};function validate36(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://github.com/tt-a1i/archify/schemas/architecture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate36.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema_version === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema_version"},message:"must have required property '"+"schema_version"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.diagram_type === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "diagram_type"},message:"must have required property '"+"diagram_type"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.meta === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "meta"},message:"must have required property '"+"meta"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.components === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "components"},message:"must have required property '"+"components"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema_version") || (key0 === "diagram_type")) || (key0 === "meta")) || (key0 === "layout")) || (key0 === "components")) || (key0 === "boundaries")) || (key0 === "connections")) || (key0 === "cards"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema_version !== undefined){if(1 !== data.schema_version){const err5 = {instancePath:instancePath+"/schema_version",schemaPath:"#/properties/schema_version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.diagram_type !== undefined){if("architecture" !== data.diagram_type){const err6 = {instancePath:instancePath+"/diagram_type",schemaPath:"#/properties/diagram_type/const",keyword:"const",params:{allowedValue: "architecture"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.meta !== undefined){let data2 = data.meta;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.title === undefined){const err7 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key1 in data2){if(!(func1.call(schema149.properties.meta.properties, key1))){const err8 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data2.title !== undefined){let data3 = data2.title;if(typeof data3 === "string"){if(func3(data3) < 1){const err9 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/meta/title",schemaPath:"#/properties/meta/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data2.locale !== undefined){let data4 = data2.locale;if(!((data4 === "en") || (data4 === "zh-CN"))){const err11 = {instancePath:instancePath+"/meta/locale",schemaPath:"common.schema.json#/$defs/locale/enum",keyword:"enum",params:{allowedValues: schema33.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data2.subtitle !== undefined){if(typeof data2.subtitle !== "string"){const err12 = {instancePath:instancePath+"/meta/subtitle",schemaPath:"#/properties/meta/properties/subtitle/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data2.output !== undefined){if(typeof data2.output !== "string"){const err13 = {instancePath:instancePath+"/meta/output",schemaPath:"#/properties/meta/properties/output/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data2.animation !== undefined){let data7 = data2.animation;if(!((data7 === "trace") || (data7 === "none"))){const err14 = {instancePath:instancePath+"/meta/animation",schemaPath:"common.schema.json#/$defs/animation/enum",keyword:"enum",params:{allowedValues: schema70.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data2.visual_preset !== undefined){let data8 = data2.visual_preset;if(!((((data8 === "classic") || (data8 === "signal-flow")) || (data8 === "blueprint")) || (data8 === "editorial"))){const err15 = {instancePath:instancePath+"/meta/visual_preset",schemaPath:"common.schema.json#/$defs/visualPreset/enum",keyword:"enum",params:{allowedValues: schema71.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.quality_profile !== undefined){let data9 = data2.quality_profile;if(!((data9 === "standard") || (data9 === "showcase"))){const err16 = {instancePath:instancePath+"/meta/quality_profile",schemaPath:"common.schema.json#/$defs/qualityProfile/enum",keyword:"enum",params:{allowedValues: schema72.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.engineering_profile !== undefined){if(!(data2.engineering_profile === "deployment-ownership")){const err17 = {instancePath:instancePath+"/meta/engineering_profile",schemaPath:"#/properties/meta/properties/engineering_profile/enum",keyword:"enum",params:{allowedValues: schema149.properties.meta.properties.engineering_profile.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.repository !== undefined){let data11 = data2.repository;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.url === undefined){const err18 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(data11.revision === undefined){const err19 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}for(const key2 in data11){if(!((key2 === "url") || (key2 === "revision"))){const err20 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data11.url !== undefined){let data12 = data11.url;if(typeof data12 === "string"){if(!pattern57.test(data12)){const err21 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/pattern",keyword:"pattern",params:{pattern: "^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"},message:"must match pattern \""+"^https://github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+(?:\\.git)?/?$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/meta/repository/url",schemaPath:"#/properties/meta/properties/repository/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data11.revision !== undefined){let data13 = data11.revision;if(typeof data13 === "string"){if(!pattern58.test(data13)){const err23 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/pattern",keyword:"pattern",params:{pattern: "^[a-fA-F0-9]{40}$"},message:"must match pattern \""+"^[a-fA-F0-9]{40}$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/meta/repository/revision",schemaPath:"#/properties/meta/properties/repository/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}else {const err25 = {instancePath:instancePath+"/meta/repository",schemaPath:"#/properties/meta/properties/repository/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data2.views !== undefined){if(!(validate37(data2.views, {instancePath:instancePath+"/meta/views",parentData:data2,parentDataProperty:"views",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate37.errors : vErrors.concat(validate37.errors);errors = vErrors.length;}}if(data2.legend !== undefined){let data15 = data2.legend;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){for(const key3 in data15){if(!((key3 === "mode") || (key3 === "entries"))){const err26 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data15.mode !== undefined){let data16 = data15.mode;if(!(((data16 === "auto") || (data16 === "all")) || (data16 === "hidden"))){const err27 = {instancePath:instancePath+"/meta/legend/mode",schemaPath:"common.schema.json#/$defs/legendMode/enum",keyword:"enum",params:{allowedValues: schema37.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data15.entries !== undefined){let data17 = data15.entries;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){for(const key4 in data17){if(!(((((((key4 === "frontend") || (key4 === "backend")) || (key4 === "database")) || (key4 === "cloud")) || (key4 === "security")) || (key4 === "messagebus")) || (key4 === "external"))){const err28 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data17.frontend !== undefined){let data18 = data17.frontend;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){if(Object.keys(data18).length < 1){const err29 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}for(const key5 in data18){if(!((key5 === "label") || (key5 === "visible"))){const err30 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data18.label !== undefined){let data19 = data18.label;if(typeof data19 === "string"){if(func3(data19) > 80){const err31 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func3(data19) < 1){const err32 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/meta/legend/entries/frontend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data18.visible !== undefined){if(typeof data18.visible !== "boolean"){const err34 = {instancePath:instancePath+"/meta/legend/entries/frontend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/meta/legend/entries/frontend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data17.backend !== undefined){let data21 = data17.backend;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){if(Object.keys(data21).length < 1){const err36 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}for(const key6 in data21){if(!((key6 === "label") || (key6 === "visible"))){const err37 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data21.label !== undefined){let data22 = data21.label;if(typeof data22 === "string"){if(func3(data22) > 80){const err38 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func3(data22) < 1){const err39 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/meta/legend/entries/backend/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data21.visible !== undefined){if(typeof data21.visible !== "boolean"){const err41 = {instancePath:instancePath+"/meta/legend/entries/backend/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {instancePath:instancePath+"/meta/legend/entries/backend",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data17.database !== undefined){let data24 = data17.database;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(Object.keys(data24).length < 1){const err43 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key7 in data24){if(!((key7 === "label") || (key7 === "visible"))){const err44 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data24.label !== undefined){let data25 = data24.label;if(typeof data25 === "string"){if(func3(data25) > 80){const err45 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func3(data25) < 1){const err46 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/meta/legend/entries/database/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data24.visible !== undefined){if(typeof data24.visible !== "boolean"){const err48 = {instancePath:instancePath+"/meta/legend/entries/database/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}}else {const err49 = {instancePath:instancePath+"/meta/legend/entries/database",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data17.cloud !== undefined){let data27 = data17.cloud;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(Object.keys(data27).length < 1){const err50 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}for(const key8 in data27){if(!((key8 === "label") || (key8 === "visible"))){const err51 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key8},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data27.label !== undefined){let data28 = data27.label;if(typeof data28 === "string"){if(func3(data28) > 80){const err52 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(func3(data28) < 1){const err53 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/meta/legend/entries/cloud/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data27.visible !== undefined){if(typeof data27.visible !== "boolean"){const err55 = {instancePath:instancePath+"/meta/legend/entries/cloud/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/meta/legend/entries/cloud",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data17.security !== undefined){let data30 = data17.security;if(data30 && typeof data30 == "object" && !Array.isArray(data30)){if(Object.keys(data30).length < 1){const err57 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}for(const key9 in data30){if(!((key9 === "label") || (key9 === "visible"))){const err58 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key9},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data30.label !== undefined){let data31 = data30.label;if(typeof data31 === "string"){if(func3(data31) > 80){const err59 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func3(data31) < 1){const err60 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/meta/legend/entries/security/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data30.visible !== undefined){if(typeof data30.visible !== "boolean"){const err62 = {instancePath:instancePath+"/meta/legend/entries/security/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}}else {const err63 = {instancePath:instancePath+"/meta/legend/entries/security",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data17.messagebus !== undefined){let data33 = data17.messagebus;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(Object.keys(data33).length < 1){const err64 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}for(const key10 in data33){if(!((key10 === "label") || (key10 === "visible"))){const err65 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key10},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data33.label !== undefined){let data34 = data33.label;if(typeof data34 === "string"){if(func3(data34) > 80){const err66 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func3(data34) < 1){const err67 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}else {const err68 = {instancePath:instancePath+"/meta/legend/entries/messagebus/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data33.visible !== undefined){if(typeof data33.visible !== "boolean"){const err69 = {instancePath:instancePath+"/meta/legend/entries/messagebus/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath:instancePath+"/meta/legend/entries/messagebus",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}if(data17.external !== undefined){let data36 = data17.external;if(data36 && typeof data36 == "object" && !Array.isArray(data36)){if(Object.keys(data36).length < 1){const err71 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/minProperties",keyword:"minProperties",params:{limit: 1},message:"must NOT have fewer than 1 properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}for(const key11 in data36){if(!((key11 === "label") || (key11 === "visible"))){const err72 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key11},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data36.label !== undefined){let data37 = data36.label;if(typeof data37 === "string"){if(func3(data37) > 80){const err73 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(func3(data37) < 1){const err74 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/meta/legend/entries/external/label",schemaPath:"common.schema.json#/$defs/legendEntry/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data36.visible !== undefined){if(typeof data36.visible !== "boolean"){const err76 = {instancePath:instancePath+"/meta/legend/entries/external/visible",schemaPath:"common.schema.json#/$defs/legendEntry/properties/visible/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}}else {const err77 = {instancePath:instancePath+"/meta/legend/entries/external",schemaPath:"common.schema.json#/$defs/legendEntry/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}else {const err78 = {instancePath:instancePath+"/meta/legend/entries",schemaPath:"#/properties/meta/properties/legend/properties/entries/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {instancePath:instancePath+"/meta/legend",schemaPath:"#/properties/meta/properties/legend/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data2.viewBox !== undefined){let data39 = data2.viewBox;if(Array.isArray(data39)){if(data39.length > 2){const err80 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data39.length < 2){const err81 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}const len0 = data39.length;if(len0 > 0){let data40 = data39[0];if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 320 || isNaN(data40)){const err82 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 320},message:"must be >= 320"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}}else {const err83 = {instancePath:instancePath+"/meta/viewBox/0",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}if(len0 > 1){let data41 = data39[1];if((typeof data41 == "number") && (isFinite(data41))){if(data41 < 240 || isNaN(data41)){const err84 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/minimum",keyword:"minimum",params:{comparison: ">=", limit: 240},message:"must be >= 240"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}else {const err85 = {instancePath:instancePath+"/meta/viewBox/1",schemaPath:"#/properties/meta/properties/viewBox/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}const len1 = data39.length;if(!(len1 <= 2)){const err86 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}else {const err87 = {instancePath:instancePath+"/meta/viewBox",schemaPath:"#/properties/meta/properties/viewBox/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}else {const err88 = {instancePath:instancePath+"/meta",schemaPath:"#/properties/meta/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.layout !== undefined){let data42 = data.layout;if(data42 && typeof data42 == "object" && !Array.isArray(data42)){if(data42.mode === undefined){const err89 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/required",keyword:"required",params:{missingProperty: "mode"},message:"must have required property '"+"mode"+"'"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}for(const key12 in data42){if(!(((((((key12 === "mode") || (key12 === "origin")) || (key12 === "cols")) || (key12 === "gapX")) || (key12 === "gapY")) || (key12 === "cellW")) || (key12 === "cellH"))){const err90 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key12},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}}if(data42.mode !== undefined){if(!(data42.mode === "grid")){const err91 = {instancePath:instancePath+"/layout/mode",schemaPath:"#/properties/layout/properties/mode/enum",keyword:"enum",params:{allowedValues: schema149.properties.layout.properties.mode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}if(data42.origin !== undefined){let data44 = data42.origin;if(Array.isArray(data44)){if(data44.length > 2){const err92 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}if(data44.length < 2){const err93 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}const len2 = data44.length;if(len2 > 0){let data45 = data44[0];if(!((typeof data45 == "number") && (isFinite(data45)))){const err94 = {instancePath:instancePath+"/layout/origin/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}if(len2 > 1){let data46 = data44[1];if(!((typeof data46 == "number") && (isFinite(data46)))){const err95 = {instancePath:instancePath+"/layout/origin/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}const len3 = data44.length;if(!(len3 <= 2)){const err96 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}else {const err97 = {instancePath:instancePath+"/layout/origin",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}if(data42.cols !== undefined){let data47 = data42.cols;if(!(((typeof data47 == "number") && (!(data47 % 1) && !isNaN(data47))) && (isFinite(data47)))){const err98 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}if((typeof data47 == "number") && (isFinite(data47))){if(data47 > 12 || isNaN(data47)){const err99 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/maximum",keyword:"maximum",params:{comparison: "<=", limit: 12},message:"must be <= 12"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(data47 < 1 || isNaN(data47)){const err100 = {instancePath:instancePath+"/layout/cols",schemaPath:"#/properties/layout/properties/cols/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}}if(data42.gapX !== undefined){let data48 = data42.gapX;if((typeof data48 == "number") && (isFinite(data48))){if(data48 < 0 || isNaN(data48)){const err101 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}else {const err102 = {instancePath:instancePath+"/layout/gapX",schemaPath:"#/properties/layout/properties/gapX/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data42.gapY !== undefined){let data49 = data42.gapY;if((typeof data49 == "number") && (isFinite(data49))){if(data49 < 0 || isNaN(data49)){const err103 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/layout/gapY",schemaPath:"#/properties/layout/properties/gapY/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data42.cellW !== undefined){let data50 = data42.cellW;if((typeof data50 == "number") && (isFinite(data50))){if(data50 < 40 || isNaN(data50)){const err105 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/minimum",keyword:"minimum",params:{comparison: ">=", limit: 40},message:"must be >= 40"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}else {const err106 = {instancePath:instancePath+"/layout/cellW",schemaPath:"#/properties/layout/properties/cellW/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data42.cellH !== undefined){let data51 = data42.cellH;if((typeof data51 == "number") && (isFinite(data51))){if(data51 < 24 || isNaN(data51)){const err107 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/minimum",keyword:"minimum",params:{comparison: ">=", limit: 24},message:"must be >= 24"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/layout/cellH",schemaPath:"#/properties/layout/properties/cellH/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}else {const err109 = {instancePath:instancePath+"/layout",schemaPath:"#/properties/layout/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data.components !== undefined){let data52 = data.components;if(Array.isArray(data52)){if(data52.length < 1){const err110 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}const len4 = data52.length;for(let i0=0; i0<len4; i0++){let data53 = data52[i0];if(data53 && typeof data53 == "object" && !Array.isArray(data53)){if(data53.id === undefined){const err111 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if(data53.type === undefined){const err112 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(data53.label === undefined){const err113 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}for(const key13 in data53){if(!(func1.call(schema149.properties.components.items.properties, key13))){const err114 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key13},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data53.id !== undefined){let data54 = data53.id;if(typeof data54 === "string"){if(!pattern4.test(data54)){const err115 = {instancePath:instancePath+"/components/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}else {const err116 = {instancePath:instancePath+"/components/" + i0+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data53.type !== undefined){let data55 = data53.type;if(!(((((((data55 === "frontend") || (data55 === "backend")) || (data55 === "database")) || (data55 === "cloud")) || (data55 === "security")) || (data55 === "messagebus")) || (data55 === "external"))){const err117 = {instancePath:instancePath+"/components/" + i0+"/type",schemaPath:"common.schema.json#/$defs/componentType/enum",keyword:"enum",params:{allowedValues: schema57.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}if(data53.label !== undefined){let data56 = data53.label;if(typeof data56 === "string"){if(func3(data56) < 1){const err118 = {instancePath:instancePath+"/components/" + i0+"/label",schemaPath:"#/properties/components/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}else {const err119 = {instancePath:instancePath+"/components/" + i0+"/label",schemaPath:"#/properties/components/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data53.sublabel !== undefined){if(typeof data53.sublabel !== "string"){const err120 = {instancePath:instancePath+"/components/" + i0+"/sublabel",schemaPath:"#/properties/components/items/properties/sublabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}}if(data53.tag !== undefined){if(typeof data53.tag !== "string"){const err121 = {instancePath:instancePath+"/components/" + i0+"/tag",schemaPath:"#/properties/components/items/properties/tag/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}if(data53.brand !== undefined){let data59 = data53.brand;const _errs139 = errors;let valid34 = false;let passing0 = null;const _errs140 = errors;const _errs142 = errors;let valid35 = false;const _errs143 = errors;if(typeof data59 === "string"){if(func3(data59) > 80){const err122 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if(!pattern17.test(data59)){const err123 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/0/pattern",keyword:"pattern",params:{pattern: "^[^\\r\\n]+$"},message:"must match pattern \""+"^[^\\r\\n]+$"+"\""};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}var _valid1 = _errs143 === errors;valid35 = valid35 || _valid1;const _errs144 = errors;if(typeof data59 === "string"){if(!pattern18.test(data59)){const err124 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf/1/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}var _valid1 = _errs144 === errors;valid35 = valid35 || _valid1;if(!valid35){const err125 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}else {errors = _errs142;if(vErrors !== null){if(_errs142){vErrors.length = _errs142;}else {vErrors = null;}}}if(typeof data59 === "string"){if(func3(data59) > 2048){const err126 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if(func3(data59) < 1){const err127 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}else {const err128 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}var _valid0 = _errs140 === errors;if(_valid0){valid34 = true;passing0 = 0;}const _errs145 = errors;if(data59 && typeof data59 == "object" && !Array.isArray(data59)){if(data59.url === undefined){const err129 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "url"},message:"must have required property '"+"url"+"'"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(data59.sha256 === undefined){const err130 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/required",keyword:"required",params:{missingProperty: "sha256"},message:"must have required property '"+"sha256"+"'"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}for(const key14 in data59){if(!((key14 === "url") || (key14 === "sha256"))){const err131 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key14},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data59.url !== undefined){let data60 = data59.url;if(typeof data60 === "string"){if(func3(data60) > 2048){const err132 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(func3(data60) < 8){const err133 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/minLength",keyword:"minLength",params:{limit: 8},message:"must NOT have fewer than 8 characters"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}if(!pattern18.test(data60)){const err134 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}else {const err135 = {instancePath:instancePath+"/components/" + i0+"/brand/url",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/url/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(data59.sha256 !== undefined){let data61 = data59.sha256;if(typeof data61 === "string"){if(!pattern20.test(data61)){const err136 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/pattern",keyword:"pattern",params:{pattern: "^[a-f0-9]{64}$"},message:"must match pattern \""+"^[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}}else {const err137 = {instancePath:instancePath+"/components/" + i0+"/brand/sha256",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/properties/sha256/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}}}else {const err138 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}var _valid0 = _errs145 === errors;if(_valid0 && valid34){valid34 = false;passing0 = [passing0, 1];}else {if(_valid0){valid34 = true;passing0 = 1;}}if(!valid34){const err139 = {instancePath:instancePath+"/components/" + i0+"/brand",schemaPath:"common.schema.json#/$defs/brandMark/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}else {errors = _errs139;if(vErrors !== null){if(_errs139){vErrors.length = _errs139;}else {vErrors = null;}}}}if(data53.sources !== undefined){let data62 = data53.sources;if(Array.isArray(data62)){if(data62.length > 3){const err140 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/maxItems",keyword:"maxItems",params:{limit: 3},message:"must NOT have more than 3 items"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data62.length < 1){const err141 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}const len5 = data62.length;for(let i1=0; i1<len5; i1++){let data63 = data62[i1];if(data63 && typeof data63 == "object" && !Array.isArray(data63)){if(data63.path === undefined){const err142 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/required",keyword:"required",params:{missingProperty: "path"},message:"must have required property '"+"path"+"'"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}for(const key15 in data63){if(!((((key15 === "path") || (key15 === "line")) || (key15 === "end_line")) || (key15 === "label"))){const err143 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key15},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data63.path !== undefined){let data64 = data63.path;if(typeof data64 === "string"){if(func3(data64) > 240){const err144 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}if(func3(data64) < 1){const err145 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/path",schemaPath:"#/properties/components/items/properties/sources/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data63.line !== undefined){let data65 = data63.line;if(!(((typeof data65 == "number") && (!(data65 % 1) && !isNaN(data65))) && (isFinite(data65)))){const err147 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data65 == "number") && (isFinite(data65))){if(data65 < 1 || isNaN(data65)){const err148 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/line",schemaPath:"#/properties/components/items/properties/sources/items/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}if(data63.end_line !== undefined){let data66 = data63.end_line;if(!(((typeof data66 == "number") && (!(data66 % 1) && !isNaN(data66))) && (isFinite(data66)))){const err149 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}if((typeof data66 == "number") && (isFinite(data66))){if(data66 < 1 || isNaN(data66)){const err150 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/end_line",schemaPath:"#/properties/components/items/properties/sources/items/properties/end_line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}}if(data63.label !== undefined){let data67 = data63.label;if(typeof data67 === "string"){if(func3(data67) > 48){const err151 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 48},message:"must NOT have more than 48 characters"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}if(func3(data67) < 1){const err152 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}}else {const err153 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1+"/label",schemaPath:"#/properties/components/items/properties/sources/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}}else {const err154 = {instancePath:instancePath+"/components/" + i0+"/sources/" + i1,schemaPath:"#/properties/components/items/properties/sources/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}}else {const err155 = {instancePath:instancePath+"/components/" + i0+"/sources",schemaPath:"#/properties/components/items/properties/sources/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}if(data53.row !== undefined){let data68 = data53.row;if(!(((typeof data68 == "number") && (!(data68 % 1) && !isNaN(data68))) && (isFinite(data68)))){const err156 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}if((typeof data68 == "number") && (isFinite(data68))){if(data68 < 0 || isNaN(data68)){const err157 = {instancePath:instancePath+"/components/" + i0+"/row",schemaPath:"#/properties/components/items/properties/row/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}}}if(data53.col !== undefined){let data69 = data53.col;if(!(((typeof data69 == "number") && (!(data69 % 1) && !isNaN(data69))) && (isFinite(data69)))){const err158 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}if((typeof data69 == "number") && (isFinite(data69))){if(data69 < 0 || isNaN(data69)){const err159 = {instancePath:instancePath+"/components/" + i0+"/col",schemaPath:"#/properties/components/items/properties/col/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}}if(data53.pos !== undefined){let data70 = data53.pos;if(Array.isArray(data70)){if(data70.length > 2){const err160 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(data70.length < 2){const err161 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}const len6 = data70.length;if(len6 > 0){let data71 = data70[0];if(!((typeof data71 == "number") && (isFinite(data71)))){const err162 = {instancePath:instancePath+"/components/" + i0+"/pos/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}if(len6 > 1){let data72 = data70[1];if(!((typeof data72 == "number") && (isFinite(data72)))){const err163 = {instancePath:instancePath+"/components/" + i0+"/pos/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}const len7 = data70.length;if(!(len7 <= 2)){const err164 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}else {const err165 = {instancePath:instancePath+"/components/" + i0+"/pos",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}if(data53.size !== undefined){let data73 = data53.size;if(Array.isArray(data73)){if(data73.length > 2){const err166 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(data73.length < 2){const err167 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}const len8 = data73.length;if(len8 > 0){let data74 = data73[0];if((typeof data74 == "number") && (isFinite(data74))){if(data74 <= 0 || isNaN(data74)){const err168 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/components/" + i0+"/size/0",schemaPath:"#/properties/components/items/properties/size/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(len8 > 1){let data75 = data73[1];if((typeof data75 == "number") && (isFinite(data75))){if(data75 <= 0 || isNaN(data75)){const err170 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison: ">", limit: 0},message:"must be > 0"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}else {const err171 = {instancePath:instancePath+"/components/" + i0+"/size/1",schemaPath:"#/properties/components/items/properties/size/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}const len9 = data73.length;if(!(len9 <= 2)){const err172 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}else {const err173 = {instancePath:instancePath+"/components/" + i0+"/size",schemaPath:"#/properties/components/items/properties/size/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}}else {const err174 = {instancePath:instancePath+"/components/" + i0,schemaPath:"#/properties/components/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}}else {const err175 = {instancePath:instancePath+"/components",schemaPath:"#/properties/components/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data.boundaries !== undefined){let data76 = data.boundaries;if(Array.isArray(data76)){const len10 = data76.length;for(let i2=0; i2<len10; i2++){let data77 = data76[i2];if(data77 && typeof data77 == "object" && !Array.isArray(data77)){if(data77.kind === undefined){const err176 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(data77.label === undefined){const err177 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(data77.wraps === undefined){const err178 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/required",keyword:"required",params:{missingProperty: "wraps"},message:"must have required property '"+"wraps"+"'"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}for(const key16 in data77){if(!((((key16 === "kind") || (key16 === "label")) || (key16 === "wraps")) || (key16 === "pad"))){const err179 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key16},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data77.kind !== undefined){let data78 = data77.kind;if(!((data78 === "region") || (data78 === "security-group"))){const err180 = {instancePath:instancePath+"/boundaries/" + i2+"/kind",schemaPath:"#/properties/boundaries/items/properties/kind/enum",keyword:"enum",params:{allowedValues: schema149.properties.boundaries.items.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data77.label !== undefined){let data79 = data77.label;if(typeof data79 === "string"){if(func3(data79) < 1){const err181 = {instancePath:instancePath+"/boundaries/" + i2+"/label",schemaPath:"#/properties/boundaries/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}else {const err182 = {instancePath:instancePath+"/boundaries/" + i2+"/label",schemaPath:"#/properties/boundaries/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}if(data77.wraps !== undefined){let data80 = data77.wraps;if(Array.isArray(data80)){if(data80.length < 1){const err183 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps",schemaPath:"#/properties/boundaries/items/properties/wraps/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}const len11 = data80.length;for(let i3=0; i3<len11; i3++){let data81 = data80[i3];if(typeof data81 === "string"){if(!pattern4.test(data81)){const err184 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps/" + i3,schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}else {const err185 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps/" + i3,schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}}else {const err186 = {instancePath:instancePath+"/boundaries/" + i2+"/wraps",schemaPath:"#/properties/boundaries/items/properties/wraps/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data77.pad !== undefined){let data82 = data77.pad;if((typeof data82 == "number") && (isFinite(data82))){if(data82 < 0 || isNaN(data82)){const err187 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}else {const err188 = {instancePath:instancePath+"/boundaries/" + i2+"/pad",schemaPath:"#/properties/boundaries/items/properties/pad/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {instancePath:instancePath+"/boundaries/" + i2,schemaPath:"#/properties/boundaries/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}else {const err190 = {instancePath:instancePath+"/boundaries",schemaPath:"#/properties/boundaries/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data.connections !== undefined){let data83 = data.connections;if(Array.isArray(data83)){const len12 = data83.length;for(let i4=0; i4<len12; i4++){let data84 = data83[i4];if(data84 && typeof data84 == "object" && !Array.isArray(data84)){if(data84.from === undefined){const err191 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/required",keyword:"required",params:{missingProperty: "from"},message:"must have required property '"+"from"+"'"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(data84.to === undefined){const err192 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/required",keyword:"required",params:{missingProperty: "to"},message:"must have required property '"+"to"+"'"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}for(const key17 in data84){if(!(func1.call(schema149.properties.connections.items.properties, key17))){const err193 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key17},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data84.id !== undefined){let data85 = data84.id;if(typeof data85 === "string"){if(!pattern4.test(data85)){const err194 = {instancePath:instancePath+"/connections/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/connections/" + i4+"/id",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data84.from !== undefined){let data86 = data84.from;if(typeof data86 === "string"){if(!pattern4.test(data86)){const err196 = {instancePath:instancePath+"/connections/" + i4+"/from",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}else {const err197 = {instancePath:instancePath+"/connections/" + i4+"/from",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}if(data84.to !== undefined){let data87 = data84.to;if(typeof data87 === "string"){if(!pattern4.test(data87)){const err198 = {instancePath:instancePath+"/connections/" + i4+"/to",schemaPath:"common.schema.json#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[a-zA-Z][a-zA-Z0-9_-]*$"},message:"must match pattern \""+"^[a-zA-Z][a-zA-Z0-9_-]*$"+"\""};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}else {const err199 = {instancePath:instancePath+"/connections/" + i4+"/to",schemaPath:"common.schema.json#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}if(data84.label !== undefined){if(typeof data84.label !== "string"){const err200 = {instancePath:instancePath+"/connections/" + i4+"/label",schemaPath:"#/properties/connections/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}if(data84.variant !== undefined){let data89 = data84.variant;if(!((((data89 === "default") || (data89 === "emphasis")) || (data89 === "security")) || (data89 === "dashed"))){const err201 = {instancePath:instancePath+"/connections/" + i4+"/variant",schemaPath:"common.schema.json#/$defs/variant/enum",keyword:"enum",params:{allowedValues: schema62.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data84.fromSide !== undefined){let data90 = data84.fromSide;if(!((((data90 === "left") || (data90 === "right")) || (data90 === "top")) || (data90 === "bottom"))){const err202 = {instancePath:instancePath+"/connections/" + i4+"/fromSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}if(data84.toSide !== undefined){let data91 = data84.toSide;if(!((((data91 === "left") || (data91 === "right")) || (data91 === "top")) || (data91 === "bottom"))){const err203 = {instancePath:instancePath+"/connections/" + i4+"/toSide",schemaPath:"common.schema.json#/$defs/side/enum",keyword:"enum",params:{allowedValues: schema112.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}if(data84.route !== undefined){let data92 = data84.route;if(!((((data92 === "auto") || (data92 === "straight")) || (data92 === "orthogonal-h")) || (data92 === "orthogonal-v"))){const err204 = {instancePath:instancePath+"/connections/" + i4+"/route",schemaPath:"#/properties/connections/items/properties/route/enum",keyword:"enum",params:{allowedValues: schema149.properties.connections.items.properties.route.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}if(data84.via !== undefined){let data93 = data84.via;if(Array.isArray(data93)){const len13 = data93.length;for(let i5=0; i5<len13; i5++){let data94 = data93[i5];if(Array.isArray(data94)){if(data94.length > 2){const err205 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}if(data94.length < 2){const err206 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}const len14 = data94.length;if(len14 > 0){let data95 = data94[0];if(!((typeof data95 == "number") && (isFinite(data95)))){const err207 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}if(len14 > 1){let data96 = data94[1];if(!((typeof data96 == "number") && (isFinite(data96)))){const err208 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5+"/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}const len15 = data94.length;if(!(len15 <= 2)){const err209 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}else {const err210 = {instancePath:instancePath+"/connections/" + i4+"/via/" + i5,schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}else {const err211 = {instancePath:instancePath+"/connections/" + i4+"/via",schemaPath:"#/properties/connections/items/properties/via/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}if(data84.labelAt !== undefined){let data97 = data84.labelAt;if(Array.isArray(data97)){if(data97.length > 2){const err212 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/maxItems",keyword:"maxItems",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}if(data97.length < 2){const err213 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/minItems",keyword:"minItems",params:{limit: 2},message:"must NOT have fewer than 2 items"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}const len16 = data97.length;if(len16 > 0){let data98 = data97[0];if(!((typeof data98 == "number") && (isFinite(data98)))){const err214 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/0",schemaPath:"common.schema.json#/$defs/point/prefixItems/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}if(len16 > 1){let data99 = data97[1];if(!((typeof data99 == "number") && (isFinite(data99)))){const err215 = {instancePath:instancePath+"/connections/" + i4+"/labelAt/1",schemaPath:"common.schema.json#/$defs/point/prefixItems/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}const len17 = data97.length;if(!(len17 <= 2)){const err216 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/items",keyword:"items",params:{limit: 2},message:"must NOT have more than 2 items"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}else {const err217 = {instancePath:instancePath+"/connections/" + i4+"/labelAt",schemaPath:"common.schema.json#/$defs/point/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}if(data84.labelDx !== undefined){let data100 = data84.labelDx;if(!((typeof data100 == "number") && (isFinite(data100)))){const err218 = {instancePath:instancePath+"/connections/" + i4+"/labelDx",schemaPath:"#/properties/connections/items/properties/labelDx/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}if(data84.labelDy !== undefined){let data101 = data84.labelDy;if(!((typeof data101 == "number") && (isFinite(data101)))){const err219 = {instancePath:instancePath+"/connections/" + i4+"/labelDy",schemaPath:"#/properties/connections/items/properties/labelDy/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}if(data84.labelSegment !== undefined){let data102 = data84.labelSegment;if(!(((typeof data102 == "number") && (!(data102 % 1) && !isNaN(data102))) && (isFinite(data102)))){const err220 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}if((typeof data102 == "number") && (isFinite(data102))){if(data102 < 0 || isNaN(data102)){const err221 = {instancePath:instancePath+"/connections/" + i4+"/labelSegment",schemaPath:"#/properties/connections/items/properties/labelSegment/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}}}if(data84.width !== undefined){let data103 = data84.width;if((typeof data103 == "number") && (isFinite(data103))){if(data103 < 0.5 || isNaN(data103)){const err222 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0.5},message:"must be >= 0.5"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}else {const err223 = {instancePath:instancePath+"/connections/" + i4+"/width",schemaPath:"common.schema.json#/$defs/relationshipWidth/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}}else {const err224 = {instancePath:instancePath+"/connections/" + i4,schemaPath:"#/properties/connections/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}}else {const err225 = {instancePath:instancePath+"/connections",schemaPath:"#/properties/connections/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}if(data.cards !== undefined){let data104 = data.cards;if(Array.isArray(data104)){const len18 = data104.length;for(let i6=0; i6<len18; i6++){let data105 = data104[i6];if(data105 && typeof data105 == "object" && !Array.isArray(data105)){if(data105.dot === undefined){const err226 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "dot"},message:"must have required property '"+"dot"+"'"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data105.title === undefined){const err227 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}if(data105.items === undefined){const err228 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/required",keyword:"required",params:{missingProperty: "items"},message:"must have required property '"+"items"+"'"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}for(const key18 in data105){if(!(((key18 === "dot") || (key18 === "title")) || (key18 === "items"))){const err229 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key18},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}if(data105.dot !== undefined){let data106 = data105.dot;if(!(((((((data106 === "cyan") || (data106 === "emerald")) || (data106 === "violet")) || (data106 === "amber")) || (data106 === "rose")) || (data106 === "orange")) || (data106 === "slate"))){const err230 = {instancePath:instancePath+"/cards/" + i6+"/dot",schemaPath:"common.schema.json#/$defs/cards/items/properties/dot/enum",keyword:"enum",params:{allowedValues: schema67.items.properties.dot.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(data105.title !== undefined){let data107 = data105.title;if(typeof data107 === "string"){if(func3(data107) < 1){const err231 = {instancePath:instancePath+"/cards/" + i6+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}else {const err232 = {instancePath:instancePath+"/cards/" + i6+"/title",schemaPath:"common.schema.json#/$defs/cards/items/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}if(data105.items !== undefined){let data108 = data105.items;if(Array.isArray(data108)){const len19 = data108.length;for(let i7=0; i7<len19; i7++){if(typeof data108[i7] !== "string"){const err233 = {instancePath:instancePath+"/cards/" + i6+"/items/" + i7,schemaPath:"common.schema.json#/$defs/cards/items/properties/items/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}}else {const err234 = {instancePath:instancePath+"/cards/" + i6+"/items",schemaPath:"common.schema.json#/$defs/cards/items/properties/items/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}}}else {const err235 = {instancePath:instancePath+"/cards/" + i6,schemaPath:"common.schema.json#/$defs/cards/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}}}else {const err236 = {instancePath:instancePath+"/cards",schemaPath:"common.schema.json#/$defs/cards/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}}}else {const err237 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}validate36.errors = vErrors;return errors === 0;}validate36.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};diff --git a/archify/renderers/shared/geometry.mjs b/archify/renderers/shared/geometry.mjsindex 7b091f1c..733129c2 100644--- a/archify/renderers/shared/geometry.mjs+++ b/archify/renderers/shared/geometry.mjs@@ -344,7 +344,6 @@ export function cleanFlowProblems({diagramType,relationCollection,obstacleKind,- profile,clearance = 2,routeHint = 'adjust fromSide/toSide, set route/via or channel coordinates, or move the obstacle'}) {@@ -399,6 +398,85 @@ export function cleanFlowProblems({return problems;}+// Build a read-only analysis copy of a polyline with straight-through+// waypoints removed. A waypoint on a forward-collinear run is not a visual+// endpoint, so treating it as one would hide a proper X that lands exactly on+// that waypoint. Reversals and real bends stay split: their shared point can+// still be an authored touch rather than a crossing. The source points are+// retained on every merged segment so diagnostics can name the authored+// segment that contains a hit without changing rendered/receipt geometry.+export function forwardCollinearAnalysisSegments(points) {+ const segments = [];+ for (let segmentIndex = 0; segmentIndex < asArray(points).length - 1; segmentIndex += 1) {+ const authoredStart = points[segmentIndex];+ const authoredEnd = points[segmentIndex + 1];+ const start = Array.isArray(authoredStart) ? [...authoredStart] : authoredStart;+ const end = Array.isArray(authoredEnd) ? [...authoredEnd] : authoredEnd;+ const sourceSegment = { start, end, segmentIndex };+ const previous = segments.at(-1);+ if (previous && segmentsContinueForward(previous.start, previous.end, start, end)) {+ previous.end = end;+ previous.sourceSegments.push(sourceSegment);+ continue;+ }+ segments.push({+ start,+ end,+ segmentIndex,+ sourceSegments: [sourceSegment],+ });+ }+ return segments;+}++export function sourceSegmentIndexAtPoint(segment, point) {+ const source = asArray(segment?.sourceSegments).find(({ start, end }) => (+ pointLiesOnSegment(point, start, end)+ ));+ return source?.segmentIndex ?? segment?.segmentIndex ?? 0;+}++function authoredAnalysisSegments(points) {+ return asArray(points).slice(0, -1).map((start, segmentIndex) => ({+ start,+ end: points[segmentIndex + 1],+ segmentIndex,+ sourceSegments: [{ start, end: points[segmentIndex + 1], segmentIndex }],+ }));+}++function segmentsContinueForward(firstStart, firstEnd, secondStart, secondEnd) {+ if (![firstStart, firstEnd, secondStart, secondEnd].every((point) => (+ Array.isArray(point) && point.length === 2 && isFinitePoint(...point)+ ))) return false;+ const epsilon = 0.0001;+ if (Math.abs(firstEnd[0] - secondStart[0]) > epsilon+ || Math.abs(firstEnd[1] - secondStart[1]) > epsilon) return false;+ const firstVector = [firstEnd[0] - firstStart[0], firstEnd[1] - firstStart[1]];+ const secondVector = [secondEnd[0] - secondStart[0], secondEnd[1] - secondStart[1]];+ const firstLength = Math.hypot(...firstVector);+ const secondLength = Math.hypot(...secondVector);+ if (firstLength <= epsilon || secondLength <= epsilon) return false;+ const cross = firstVector[0] * secondVector[1] - firstVector[1] * secondVector[0];+ if (Math.abs(cross) > epsilon) return false;+ const dot = firstVector[0] * secondVector[0] + firstVector[1] * secondVector[1];+ return dot > epsilon;+}++function pointLiesOnSegment(point, start, end) {+ if (![point, start, end].every((candidate) => (+ Array.isArray(candidate) && candidate.length === 2 && isFinitePoint(...candidate)+ ))) return false;+ const epsilon = 0.0001;+ const length = Math.hypot(end[0] - start[0], end[1] - start[1]);+ if (length <= epsilon) return Math.hypot(point[0] - start[0], point[1] - start[1]) <= epsilon;+ if (Math.abs(crossProduct(start, end, point)) > epsilon * length) return false;+ return point[0] >= Math.min(start[0], end[0]) - epsilon+ && point[0] <= Math.max(start[0], end[0]) + epsilon+ && point[1] >= Math.min(start[1], end[1]) - epsilon+ && point[1] <= Math.max(start[1], end[1]) + epsilon;+}+// Reject only a proper interior X between relationships that share no semantic// endpoint. Endpoint touches, branch/merge ports, and collinear shared// corridors are intentionally outside this contract because geometry alone@@ -410,17 +488,24 @@ export function cleanCrossingProblems({diagramType,relationCollection,profile = 'standard',+ profileIsAuthoritative = false,+ mergeForwardCollinearWaypoints = false,routeHint = 'adjust route/via or channel coordinates so the relationships use separate corridors'}) {- const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || profile;- const activeProfile = requestedProfile === 'showcase' ? 'showcase' : 'standard';- if (activeProfile !== 'showcase') return [];+ if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return [];const routed = asArray(relations).map((relation, index) => {if (!relation || !endpointIds.has(relation.from) || !endpointIds.has(relation.to)) return null;const points = pathFor(relation)?.points;if (!Array.isArray(points) || points.length < 2) return null;if (!points.every((point) => Array.isArray(point) && point.length === 2 && isFinitePoint(...point))) return null;- return { relation, index, points };+ return {+ relation,+ index,+ points,+ analysisSegments: mergeForwardCollinearWaypoints+ ? forwardCollinearAnalysisSegments(points)+ : authoredAnalysisSegments(points),+ };}).filter(Boolean);const problems = [];@@ -431,16 +516,21 @@ export function cleanCrossingProblems({if ([left.relation.from, left.relation.to].some((id) => id === right.relation.from || id === right.relation.to)) continue;let hit = null;- for (let leftSegment = 0; leftSegment < left.points.length - 1 && !hit; leftSegment += 1) {- for (let rightSegment = 0; rightSegment < right.points.length - 1; rightSegment += 1) {+ for (const leftSegment of left.analysisSegments) {+ if (hit) break;+ for (const rightSegment of right.analysisSegments) {const point = properSegmentIntersection(- left.points[leftSegment],- left.points[leftSegment + 1],- right.points[rightSegment],- right.points[rightSegment + 1]+ leftSegment.start,+ leftSegment.end,+ rightSegment.start,+ rightSegment.end);if (point) {- hit = { point, leftSegment, rightSegment };+ hit = {+ point,+ leftSegment: sourceSegmentIndexAtPoint(leftSegment, point),+ rightSegment: sourceSegmentIndexAtPoint(rightSegment, point),+ };break;}}@@ -536,16 +626,12 @@ export function cleanAmbiguousCorridorProblems({diagramType,relationCollection,profile = 'standard',+ profileIsAuthoritative = false,routeHint = 'adjust route/via or channel coordinates so the relationships use separate corridors',minOverlapPx = 8,}) {- const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || profile;- if (requestedProfile !== 'showcase') return [];- const routedRelations = asArray(relations).map((relation, relationIndex) => {- if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;- if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;- return { relation, relationIndex, points: pathFor(relation)?.points };- }).filter(Boolean);+ if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return [];+ const routedRelations = collectEligibleRoutedRelations({ relations, endpointIds, pathFor });return collectAmbiguousCorridors({ routedRelations, minOverlapPx }).map((hit) => {const describe = ({ relation, relationIndex }) => {@@ -634,14 +720,11 @@ export function cleanBorderRunProblems({diagramType,relationCollection,profile,+ profileIsAuthoritative = false,routeHint = 'adjust route/via or channel coordinates so the relationship crosses the frame perpendicularly through a clear opening'}) {- if (!process.env.ARCHIFY_QUALITY_PROFILE && !profile) return [];- const routedRelations = asArray(relations).map((relation, relationIndex) => {- if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;- if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;- return { relation, relationIndex, points: pathFor(relation)?.points };- }).filter(Boolean);+ if (!qualityProfileForGate(profile, profileIsAuthoritative)) return [];+ const routedRelations = collectEligibleRoutedRelations({ relations, endpointIds, pathFor });return collectBorderRuns({ routedRelations, frames }).map((hit) => {const relation = hit.relation || {};const relationId = relation.id ? ` id "${relation.id}"` : '';@@ -779,17 +862,13 @@ export function cleanRouteRhythmProblems({diagramType,relationCollection,profile,+ profileIsAuthoritative = false,routeHint = 'move the channel/via point to remove the cramped turn or give the route more corridor space',interiorSegmentPx = 16,microSegmentPx = 8,}) {- const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || profile;- if (requestedProfile !== 'showcase') return [];- const routedRelations = asArray(relations).map((relation, relationIndex) => {- if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;- if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;- return { relation, relationIndex, points: pathFor(relation)?.points };- }).filter(Boolean);+ if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return [];+ const routedRelations = collectEligibleRoutedRelations({ relations, endpointIds, pathFor });return collectRouteRhythmIssues({ routedRelations, interiorSegmentPx, microSegmentPx }).map((hit) => {const relation = hit.relation || {};const relationId = relation.id ? ` id "${relation.id}"` : '';@@ -827,16 +906,12 @@ export function cleanLabelRouteClearanceProblems({diagramType,relationCollection,profile,+ profileIsAuthoritative = false,threshold = 4,routeHint = 'adjust labelAt, labelDx, labelDy, or labelSegment; otherwise adjust the other relationship route/via/channel',}) {- const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || profile;- if (requestedProfile !== 'showcase') return [];- const routedRelations = asArray(relations).map((relation, relationIndex) => {- if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;- if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;- return { relation, relationIndex, points: pathFor(relation)?.points };- }).filter(Boolean);+ if (qualityProfileForGate(profile, profileIsAuthoritative) !== 'showcase') return [];+ const routedRelations = collectEligibleRoutedRelations({ relations, endpointIds, pathFor });return collectLabelRouteClearance({ labels, routedRelations, threshold }).map((hit) => {const describe = (relation, relationIndex) => {const relationId = relation?.id ? ` id "${relation.id}"` : '';@@ -868,6 +943,20 @@ export function cleanLabelRouteClearanceProblems({});}+function qualityProfileForGate(profile, profileIsAuthoritative) {+ return profileIsAuthoritative+ ? profile+ : process.env.ARCHIFY_QUALITY_PROFILE || profile;+}++function collectEligibleRoutedRelations({ relations, endpointIds, pathFor }) {+ return asArray(relations).map((relation, relationIndex) => {+ if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;+ if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;+ return { relation, relationIndex, points: pathFor(relation)?.points };+ }).filter(Boolean);+}+function segmentPosition(index, segmentCount) {if (index === 0) return 'source-stub';if (index === segmentCount - 1) return 'target-stub';@@ -1319,7 +1408,7 @@ export function suggestLabelObstacleFix(labelRect, lx, ly, obstacle, obstacleKinexport function suggestLabelPairFix(a, b) {return [` "${a.label}" ${formatRect(a)}; "${b.label}" ${formatRect(b)}`,- ' Suggested fix: add labelDy +24 on one edge, adjust labelDx, or remove one label',+ ' Suggested fix: adjust labelDx/labelDy/labelSegment, or route one relationship through a separate corridor',].join('\n');}diff --git a/archify/renderers/workflow/README.md b/archify/renderers/workflow/README.mdindex a2a1f10e..186d7b6b 100644--- a/archify/renderers/workflow/README.md+++ b/archify/renderers/workflow/README.md@@ -29,7 +29,7 @@ Workflow JSON files must set:```json{- "schema_version": 1,+ "schema_version": 2,"diagram_type": "workflow","meta": {"title": "Agent Tool Call Workflow"@@ -44,10 +44,17 @@ Workflow JSON files must set:}```-Omit `meta.viewBox` for the common case: the width is fixed at 720 and the-height is derived from the lane count, so lanes and legend always fit. A-complete worked example lives at-`archify/examples/agent-tool-call.workflow.json`.+Use `schema_version: 2` for new workflows. Its readable layout compiler treats+every `col` as a logical rank in `0..5` and derives geometry from the measured+document. `schema_version: 1` remains the fixed legacy contract for existing+sources; valid v1 output is preserved byte-for-byte and never silently+reinterpreted as v2.++Omit `meta.viewBox` for the common v2 case so the compiler can use intrinsic+measured bounds. In v1, the omitted width remains fixed at 720 and height is+derived from lane count. A complete worked example lives at+`archify/examples/agent-tool-call.workflow.json`; its `schema_version` selects+the applicable contract.The schema lives at:@@ -55,6 +62,34 @@ The schema lives at:archify/schemas/workflow.schema.json```+## Migration and layout receipt++Migrate an existing v1 source into a separate v2 file:++```bash+node archify/bin/archify.mjs migrate workflow old.json new.json --to-schema 2 --json+```++Running the command again with its schema-v2 output as the new source is an+idempotent verification pass: the destination bytes and geometry stay unchanged.++The command never overwrites the source by default. It maps absolute+`via[*][0]`, `labelAt[0]`, and `channelX` values from legacy to solved rank+space, preserves y coordinates unless a reported vertical constraint needs+author input, expands an explicit viewBox only for an unambiguous containment+repair, and writes the destination only after v2 compilation and artifact+checks pass. Ambiguous explicit pins fail without producing the destination.++Inspect the stable author-facing v2 plan with:++```bash+node archify/bin/archify.mjs validate workflow input.workflow.json --layout-json+```++The receipt reports the selected contract, measured `viewBox` and+`requiredViewBox`, solved columns, nodes, edges, labels, and causal diagnostics.+It deliberately omits solver iterations and candidate scores.+## LegendThe default legend derives component kinds from `nodes[].type`. Supported@@ -63,7 +98,9 @@ The default legend derives component kinds from `nodes[].type`. Supportedvisibility may be overridden through the shared legend contract; only kindsbacked by rendered nodes receive Semantic Legend controls.-## Layout budget+## Layout contracts++### Fixed v1| Constant | Value ||----------|-------|@@ -81,8 +118,38 @@ backed by rendered nodes receive Semantic Legend controls.| Legend row | y = lane bottom + 44; viewBox height must be ≥ legend y + 18 |Column-center gaps are 132 / 80 / 130 / 70 / 125 px: columns 1↔2 (80px) and-3↔4 (70px) cannot both hold default-width 92px nodes in the same lane — skip a-column or reduce `width`.+3↔4 (70px) cannot both hold default-width 92px nodes in the same lane. Such an+invalid v1 source receives one causal `workflow/column-capacity` diagnostic and+a verified migration-to-v2 repair; v1 never falls through to adaptive layout.++### Readable v2++| Invariant | Contract |+|----------|----------|+| Logical columns | `col` is an integer in `0..5`; pixel centers are measured output |+| Adjacent-rank baseline | 120px center distance before document-specific constraints |+| Same-lane node clearance | ≥8px when vertical node intervals overlap |+| Facing direct edge | clear gap ≥`max(28px, measured label mask width + 8px)` |+| Automatic route rhythm | direct segment ≥28px; endpoint stub ≥8px; interior turn segment ≥16px |+| Implicit viewBox | intrinsic content bounds plus contract padding |+| Explicit viewBox | containment capacity; too-small input reports exact `requiredViewBox` and contributors |++The compiler applies constraints only to actual related or overlapping+same-lane nodes, so a wide node in an unrelated lane does not expand every+rank. Legacy centers are a soft preference after correctness constraints, not+a geometry promise. Phase and group frames derive from the solved rank bands.+Automatic routes are normalized once and the same final scene drives+validation and SVG serialization. Long automatic labels compare direct-gutter+growth with a legal channel instead of widening every downstream rank. Measured+multi-row legends participate in intrinsic height and explicit viewBox+capacity.++Authored `via`, `labelAt`, `channelX`, and `channelY` are absolute hard pins in+v2; an infeasible pin returns `workflow/explicit-pin-conflict` rather than being+silently moved. `fromSide` and `toSide` remain direction constraints. A route+preset restricts the automatic candidate family but is not itself an absolute+coordinate pin. When either endpoint side is omitted, the v2 compiler chooses+a feasible side; an authored side restricts that endpoint to the named port.## Design Rules@@ -91,15 +158,44 @@ column or reduce `width`.- Use groups for parallel checks, branch handling, or bounded work within a lane; every group must contain at least one node.- Use `lane.variant: "exception"` for human wait, denial, retry, fallback, and failure lanes instead of mixing those paths into the happy path.- Set `mainPath` when the diagram has a clear happy path; the renderer validates that consecutive ids have matching edges and move left-to-right.-- Place nodes with lane IDs and column indexes, not raw SVG coordinates.-- Leave short adjacent links unlabeled; the arrow is enough.-- Use labels for cross-lane decisions, approvals, async traces, and return paths.+- Place nodes with lane IDs and `col` indexes in `0..5`, not raw SVG coordinates.+- Preserve semantic edge labels. Readable v2 allocates measured label clearance;+ when a label does not fit, repair the reported capacity or route constraint+ instead of deleting meaning.+- Use labels for decisions, approvals, protocols, async traces, return paths,+ and any other relationship meaning not fully implied by its endpoints.- Prefer route presets — `drop` (bend between lanes; `bias` 0–1 picks where),`outside-right`, `return-left`, `bottom-channel`, and `up-channel` — beforeusing raw `via` points. `straight` and the default `auto` cover the rest.- Keep workflow examples compact enough to render well in narrow chat/browserpreviews.+### Optional semantic checks++Layout validation cannot infer domain truth from labels or cards. When source+evidence establishes roots, terminals, mandatory direct relationships, or+mandatory directed reachability, encode those facts in `semanticChecks`:++```json+"semanticChecks": {+ "allowedRoots": ["request", "resource_catalog"],+ "allowedTerminals": ["reply", "audit_log"],+ "requiredEdges": [+ { "from": "dispatch", "to": "dispatch_ledger" }+ ],+ "requiredPaths": [+ { "from": "event_ledger", "to": "runtime_host" }+ ]+}+```++When `allowedRoots` or `allowedTerminals` is present, it is the complete allow+list for zero-incoming or zero-outgoing nodes respectively. `requiredEdges`+requires one exact authored direction; `requiredPaths` permits intermediate+nodes but follows authored edge direction. These checks run before layout, do+not alter SVG or receipt bytes, and must not be weakened merely to resolve a+route or composition diagnostic. Omit fields whose domain facts are unknown.+Schema violations exit non-zero with path-prefixed messages annotated with theelement's id or label. The renderer additionally fails when it can detectlayout problems, including node overlap, nodes outside their lanes, invalid@@ -111,6 +207,12 @@ nodes with 2px clearance; lanes, phases, and groups remain intentionalpass-through containers. Text width is estimated CJK-aware: fullwidth glyphscount as two units.+Diagnostics are causal: a rank-capacity failure suppresses derivative short+edge, endpoint-direction, and label-overlap findings. Every+`supportedFixes[]` entry is verified by replanning the proposed edit, and a+diagnostic never proposes removing a semantic label when label presence does+not cause the failed invariant.+Set `meta.quality_profile` to `showcase` for polished delivery. Unrelated properX crossings then fail with `composition/proper-crossing`; default `standard`keeps them as artifact-receipt warnings. Collinear lane corridors are outsidediff --git a/archify/renderers/workflow/render-workflow.mjs b/archify/renderers/workflow/render-workflow.mjsindex fb3cf70c..27bfa14b 100644--- a/archify/renderers/workflow/render-workflow.mjs+++ b/archify/renderers/workflow/render-workflow.mjs@@ -1,41 +1,8 @@import path from 'node:path';import { fileURLToPath } from 'node:url';-import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs';-import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagramWithBrandMarks, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs';-import { throwDiagnosticProblems } from '../shared/diagnostics.mjs';-import { resolveLegend, renderLegend as renderResolvedLegend } from '../shared/legend.mjs';-import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs';-import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs';-import { translateMessage as i18nText } from '../shared/i18n.mjs';-import {- asArray,- isFinitePoint,- rectsOverlap,- segmentIntersectsRect,- cleanEndpointSideProblems,- cleanFlowProblems,- cleanCrossingProblems,- cleanAmbiguousCorridorProblems,- cleanBorderRunProblems,- cleanRouteRhythmProblems,- cleanLabelRouteClearanceProblems,- suggestLabelObstacleFix,- suggestLabelPairFix,- anchor,- automaticPortSpread,- defaultFromSide,- defaultToSide,- chosenSide,- normalizeRoutePoints,- routeHonorsEndpointSides,- polylinePath,- routePointsValue,- labelPoint,- componentFill,- componentText,- arrowClassMap,- variantAccent-} from '../shared/geometry.mjs';+import { loadDiagramWithBrandMarks, writeDiagram } from '../shared/cli.mjs';+import { throwDiagnosticError } from '../shared/diagnostics.mjs';+import { compileWorkflow } from './workflow-compiler.mjs';const __dirname = path.dirname(fileURLToPath(import.meta.url));const { diagram: workflow, template, outPath } = await loadDiagramWithBrandMarks({@@ -44,670 +11,25 @@ const { diagram: workflow, template, outPath } = await loadDiagramWithBrandMarksdefaultExample: 'agent-tool-call.workflow.json'});-const layout = {- laneX: 40,- laneY: 52,- laneW: 640,- laneH: 104,- laneGap: 20,- laneTitleH: 30,- colXs: [88, 220, 300, 430, 500, 625],- nodeW: 92,- nodeH: 52-};--// Content is 680px wide (laneX + laneW); auto height fits the lanes plus legend.-const autoHeight = layout.laneY- + (workflow.lanes?.length || 1) * layout.laneH- + ((workflow.lanes?.length || 1) - 1) * layout.laneGap- + 124;-const viewBox = workflow.meta?.viewBox || [720, autoHeight];--const laneIndex = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index]));-const laneLabels = new Map(asArray(workflow.lanes).map((lane) => [lane.id, lane.label]));--function nodeContext(node) {- const group = asArray(workflow.groups).find((candidate) => (- candidate.lane === node.lane && node.col >= candidate.fromCol && node.col <= candidate.toCol- ));- const phase = asArray(workflow.phases).find((candidate) => (- node.col >= candidate.fromCol && node.col <= candidate.toCol- ));- return [laneLabels.get(node.lane), group?.label, phase?.label].filter(Boolean).join(' › ')- || i18nText(workflow.meta.locale, 'node.context.workflow');-}--function laneTop(id) {- return layout.laneY + laneIndex.get(id) * (layout.laneH + layout.laneGap);-}--function lastLaneBottom() {- return layout.laneY + workflow.lanes.length * layout.laneH + (workflow.lanes.length - 1) * layout.laneGap;-}--function legendY() {- return lastLaneBottom() + 44;-}--function measureNode(node) {- const width = node.width || layout.nodeW;- const height = node.height || (node.tag ? 68 : layout.nodeH);- const cx = layout.colXs[node.col];- const contentH = layout.laneH - layout.laneTitleH;- const y = laneTop(node.lane) + layout.laneTitleH + (contentH - height) / 2 + (node.yOffset || 0);- return {- ...node,- width,- height,- x: cx - width / 2,- y,- cx,- cy: y + height / 2- };-}--// Font sizes for this renderer's node text; the fitting geometry is shared.-const nodeTextFit = {- labelPreferred: 11,- labelMinimum: 9,- sublabelPreferred: 8,- sublabelMinimum: 6,- tagPreferred: 7,- tagMinimum: 6,-};--const nodes = new Map(asArray(workflow.nodes).map((node) => [node.id, measureNode(node)]));--function workflowCompositionFrames() {- const frames = [];- for (const [index, lane] of asArray(workflow.lanes).entries()) {- const y = layout.laneY + index * (layout.laneH + layout.laneGap);- frames.push({ id: `lane-${index}`, label: lane.label, kind: 'lane', x: layout.laneX, y, width: layout.laneW, height: layout.laneH, radius: 10 });- if (lane.variant === 'exception') {- frames.push({ id: `lane-${index}-exception`, label: `${lane.label} exception`, kind: 'exception-lane', x: layout.laneX + 6, y: y + 6, width: layout.laneW - 12, height: layout.laneH - 12, radius: 8 });- }- }- for (const [index, group] of asArray(workflow.groups).entries()) {- const span = spanForCols(group.fromCol, group.toCol, 50);- frames.push({- id: `group-${index}`,- label: group.label,- kind: 'group',- x: span.x,- y: laneTop(group.lane) + layout.laneTitleH + 8,- width: span.width,- height: layout.laneH - layout.laneTitleH - 16,- radius: 9,- });- }- return frames;-}--const mainPathSteps = new Map(asArray(workflow.mainPath).map((id, index) => [id, index]));-const edgeSteps = new Map(asArray(workflow.edges).map((edge, index) => {- const fromStep = mainPathSteps.get(edge.from);- const toStep = mainPathSteps.get(edge.to);- const mainStep = Number.isInteger(fromStep) && toStep === fromStep + 1 ? fromStep : null;- return [edge, mainStep ?? asArray(workflow.mainPath).length + index];-}));--function nodeStep(node) {- return mainPathSteps.get(node.id) ?? asArray(workflow.mainPath).length + asArray(workflow.nodes).findIndex((item) => item.id === node.id);-}--function validateWorkflow() {- const problems = [];- const laneIds = new Set(workflow.lanes.map((lane) => lane.id));- if (laneIds.size !== workflow.lanes.length) {- problems.push('Lane ids must be unique.');- }- if (nodes.size !== workflow.nodes.length) {- problems.push('Node ids must be unique.');- }- const phaseIds = new Set(asArray(workflow.phases).map((phase) => phase.id));- if (phaseIds.size !== asArray(workflow.phases).length) {- problems.push('Phase ids must be unique.');- }- const groupIds = new Set(asArray(workflow.groups).map((group) => group.id));- if (groupIds.size !== asArray(workflow.groups).length) {- problems.push('Group ids must be unique.');- }-- for (const node of nodes.values()) {- if (!laneIds.has(node.lane)) {- problems.push(`Node "${node.id}" uses unknown lane "${node.lane}".`);- continue;- }- if (!Number.isInteger(node.col) || node.col < 0 || node.col >= layout.colXs.length) {- problems.push(`Node "${node.id}" uses column ${node.col}, but valid columns are integers 0..${layout.colXs.length - 1}.`);- continue;- }- if (!isFinitePoint(node.x, node.y, node.cx, node.cy)) {- problems.push(`Node "${node.id}" produced non-finite coordinates — check col, width, height, and yOffset are numbers.`);- continue;- }- const estLabelW = textUnits(node.label) * 6.8;- if (estLabelW > node.width + 6) {- problems.push(`Label "${node.label}" (~${Math.round(estLabelW)}px) is wider than node "${node.id}" (${node.width}px) — shorten the label or increase node.width.`);- }- const brandRailProblem = brandTopRailProblem(node, node.width, nodeTextFit.labelMinimum);- if (brandRailProblem) problems.push(brandRailProblem);- const availableTextW = availableNodeTextWidth(node.width);- for (const [field, value, minimum] of [- ['Sublabel', node.sublabel, nodeTextFit.sublabelMinimum],- ['Tag', node.tag, nodeTextFit.tagMinimum],- ]) {- if (!value) continue;- const minimumW = minimumNodeTextWidth(value, minimum);- if (minimumW > availableTextW) {- problems.push(`${field} "${value}" needs ~${Math.ceil(minimumW)}px at the ${minimum}px legible minimum, but node "${node.id}" provides ${availableTextW}px — shorten the ${field.toLowerCase()} or increase node.width.`);- }- }-- const top = laneTop(node.lane);- const contentTop = top + layout.laneTitleH;- const laneRight = layout.laneX + layout.laneW;- if (node.x < layout.laneX || node.x + node.width > laneRight) {- problems.push(`Node "${node.id}" exceeds the horizontal bounds of lane "${node.lane}".`);- }- if (node.y < contentTop || node.y + node.height > top + layout.laneH) {- problems.push(`Node "${node.id}" collides with the title or boundary of lane "${node.lane}".`);- }- }-- const phaseRanges = [];- for (const phase of asArray(workflow.phases)) {- if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)) {- problems.push(`Phase "${phase.id}" must use integer fromCol/toCol values.`);- continue;- }- if (phase.fromCol < 0 || phase.toCol >= layout.colXs.length || phase.fromCol > phase.toCol) {- problems.push(`Phase "${phase.id}" uses invalid columns ${phase.fromCol}..${phase.toCol}; use an ordered range within 0..${layout.colXs.length - 1}.`);- } else {- phaseRanges.push(phase);- }- const estLabelW = textUnits(phase.label) * 5.6;- const width = spanForCols(phase.fromCol, phase.toCol).width;- if (estLabelW > width + 8) {- problems.push(`Phase label "${phase.label}" (~${Math.round(estLabelW)}px) is wider than its ${Math.round(width)}px span — shorten the label or widen the phase range.`);- }- }- phaseRanges.sort((a, b) => a.fromCol - b.fromCol || a.toCol - b.toCol);- for (let i = 0; i < phaseRanges.length; i += 1) {- for (let j = i + 1; j < phaseRanges.length; j += 1) {- const earlier = phaseRanges[i];- const later = phaseRanges[j];- if (later.fromCol > earlier.toCol) break;- problems.push(`Phase "${later.id}" (${later.fromCol}..${later.toCol}) overlaps phase "${earlier.id}" (${earlier.fromCol}..${earlier.toCol}) — start at col ${earlier.toCol + 1} or later, or end the earlier phase at col ${later.fromCol - 1}.`);- }- }-- for (const group of asArray(workflow.groups)) {- if (!laneIds.has(group.lane)) {- problems.push(`Group "${group.id}" uses unknown lane "${group.lane}".`);- continue;- }- if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)) {- problems.push(`Group "${group.id}" must use integer fromCol/toCol values.`);- continue;- }- if (group.fromCol < 0 || group.toCol >= layout.colXs.length || group.fromCol > group.toCol) {- problems.push(`Group "${group.id}" uses invalid columns ${group.fromCol}..${group.toCol}; use an ordered range within 0..${layout.colXs.length - 1}.`);- }- const contained = [...nodes.values()].some((node) => node.lane === group.lane && node.col >= group.fromCol && node.col <= group.toCol);- if (!contained) {- problems.push(`Group "${group.id}" does not contain any nodes — align its lane/columns with the parallel or branch work it frames.`);- }- }-- const byLane = new Map();- for (const node of nodes.values()) {- byLane.set(node.lane, [...(byLane.get(node.lane) || []), node]);- }- for (const [lane, laneNodes] of byLane) {- for (let i = 0; i < laneNodes.length; i += 1) {- for (let j = i + 1; j < laneNodes.length; j += 1) {- if (rectsOverlap(laneNodes[i], laneNodes[j], 8)) {- problems.push(`Nodes "${laneNodes[i].id}" and "${laneNodes[j].id}" are less than 8px apart in lane "${lane}" — move one to another col, adjust yOffset, or reduce width/height.`);- }- }- }- }-- for (const edge of workflow.edges) {- if (!nodes.has(edge.from)) problems.push(`Edge "${edge.label || edge.from}" references unknown source "${edge.from}".`);- if (!nodes.has(edge.to)) problems.push(`Edge "${edge.label || edge.to}" references unknown target "${edge.to}".`);- if (nodes.has(edge.from) && nodes.has(edge.to)) {- const routed = pathFor(edge);- if (routed.points.length === 2) {- const [start, end] = routed.points;- const segmentLength = Math.hypot(end[0] - start[0], end[1] - start[1]);- if (segmentLength < 28) {- problems.push(`Edge "${edge.from}" -> "${edge.to}" is too short (${Math.round(segmentLength)}px; minimum 28px) — drop its label or route it through a channel.`);- }- }- }- }-- problems.push(...cleanEndpointSideProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- fromSideFor: (edge) => edgeSides(edge).fromSide,- toSideFor: (edge) => edgeSides(edge).toSide,- routeHint: 'keep automatic routing, or choose fromSide/toSide and via points whose first and final segments cross node borders perpendicularly',- }));- problems.push(...cleanFlowProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- obstacles: nodes.values(),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- obstacleKind: 'node',- profile: workflow.meta?.quality_profile,- routeHint: 'adjust fromSide/toSide, set route/via or channel coordinates, or move the node to a clearer lane/column'- }));- problems.push(...cleanCrossingProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- profile: workflow.meta?.quality_profile,- routeHint: 'adjust route/via, bias, or channel coordinates so the edges use separate lane corridors'- }));- problems.push(...cleanAmbiguousCorridorProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- profile: workflow.meta?.quality_profile,- routeHint: 'adjust route/via, bias, or channel coordinates so unrelated edges do not visually merge'- }));- problems.push(...cleanBorderRunProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- frames: workflowCompositionFrames(),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- profile: workflow.meta?.quality_profile,- routeHint: 'adjust route/via, bias, or channel coordinates so the edge crosses the lane or group perpendicularly instead of following its border'- }));- problems.push(...cleanRouteRhythmProblems({- relations: workflow.edges,- endpointIds: new Set(nodes.keys()),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- profile: workflow.meta?.quality_profile,- routeHint: 'adjust route/via, bias, or channel coordinates so each turn has a readable run-up'- }));-- if (Array.isArray(workflow.mainPath)) {- for (const id of workflow.mainPath) {- if (!nodes.has(id)) {- problems.push(`mainPath references unknown node "${id}".`);- }- }- for (let i = 0; i < workflow.mainPath.length - 1; i += 1) {- const fromId = workflow.mainPath[i];- const toId = workflow.mainPath[i + 1];- const from = nodes.get(fromId);- const to = nodes.get(toId);- if (!from || !to) continue;- const linked = workflow.edges.some((edge) => edge.from === fromId && edge.to === toId);- if (!linked) {- problems.push(`mainPath step "${fromId}" -> "${toId}" has no matching edge — add the edge or remove the pair from mainPath.`);- }- if (to.col < from.col) {- problems.push(`mainPath step "${fromId}" -> "${toId}" moves backward from col ${from.col} to ${to.col} — use a return edge outside mainPath for loops.`);- }- }- }-- const labelRects = [];- for (const [edgeIndex, edge] of workflow.edges.entries()) {- if (!edge.label || !nodes.has(edge.from) || !nodes.has(edge.to)) continue;- const [lx, ly] = workflowEdgeLabelPoint(edge, pathFor(edge).points);- const width = Math.max(30, textUnits(edge.label) * 4.8 + 10);- labelRects.push({ relation: edge, relationIndex: edgeIndex, label: edge.label, x: lx - width / 2, y: ly - 10, width, height: 14, lx, ly });- }- for (const rect of labelRects) {- for (const node of nodes.values()) {- if (rectsOverlap(rect, node, -2)) {- problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node')}`);- }- }- }- for (let i = 0; i < labelRects.length; i += 1) {- for (let j = i + 1; j < labelRects.length; j += 1) {- if (rectsOverlap(labelRects[i], labelRects[j], -2)) {- problems.push(`Labels "${labelRects[i].label}" and "${labelRects[j].label}" overlap — adjust labelDx/labelDy or remove one label.\n${suggestLabelPairFix(labelRects[i], labelRects[j])}`);- }- }- }- problems.push(...cleanLabelRouteClearanceProblems({- relations: workflow.edges,- labels: labelRects,- endpointIds: new Set(nodes.keys()),- pathFor,- diagramType: 'workflow',- relationCollection: 'edges',- profile: workflow.meta?.quality_profile,- }));-- if (viewBox[0] < layout.laneX + layout.laneW + 16) {- problems.push(`viewBox width ${viewBox[0]} clips the ${layout.laneW}px lanes — set meta.viewBox[0] to at least ${layout.laneX + layout.laneW + 16}.`);- }- if (legendY() + 18 > viewBox[1]) {- problems.push(`Legend exceeds viewBox height ${viewBox[1]} — set meta.viewBox[1] to at least ${legendY() + 18}.`);- }-- if (problems.length) {- throwDiagnosticProblems('Workflow layout validation failed', problems, {- subject: { diagramType: 'workflow' },- });- }-}--function gapYBetween(fromLane, toLane, bias = 0.5) {- const a = laneTop(fromLane) + layout.laneH;- const b = laneTop(toLane);- return a + (b - a) * bias;-}--function spanForCols(fromCol, toCol, pad = 46) {- const start = layout.colXs[fromCol] - pad;- const end = layout.colXs[toCol] + pad;- return { x: start, width: end - start, cx: (start + end) / 2 };-}--function sameLaneAutoVia(start, end) {- if (start[0] === end[0] || start[1] === end[1]) return [];- const midX = (start[0] + end[0]) / 2;- return [[midX, start[1]], [midX, end[1]]];-}--function routeClearsUnrelatedNodes(edge, points, clearance = 2) {- const endpointIds = new Set([edge.from, edge.to]);- for (const node of nodes.values()) {- if (endpointIds.has(node.id)) continue;- for (let index = 0; index < points.length - 1; index += 1) {- if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, node, clearance)) {- return false;- }- }- }- return true;-}--function oneBendCrossLaneVia(edge, start, end, fromSide, toSide) {- const fromVertical = fromSide === 'top' || fromSide === 'bottom';- const toVertical = toSide === 'top' || toSide === 'bottom';- if (fromVertical === toVertical) return null;-- const corner = fromVertical ? [start[0], end[1]] : [end[0], start[1]];- const points = normalizeRoutePoints([start, corner, end]);- if (points.length !== 3 || !routeHonorsEndpointSides(points, fromSide, toSide)) return null;-- const segmentsAreReadable = points.slice(0, -1).every((point, index) => (- Math.hypot(- points[index + 1][0] - point[0],- points[index + 1][1] - point[1],- ) >= 8- ));- if (!segmentsAreReadable || !routeClearsUnrelatedNodes(edge, points)) return null;- return points.slice(1, -1);-}--function automaticOneBendSides(edge, from, to) {- const automaticRoute = !edge.via && (!edge.route || edge.route === 'auto');- const automaticFrom = !edge.fromSide || edge.fromSide === 'auto';- const automaticTo = !edge.toSide || edge.toSide === 'auto';- if (!automaticRoute || !automaticFrom || !automaticTo || from.lane === to.lane) return null;- if (from.cx === to.cx || from.cy === to.cy) return null;- const verticalFrom = to.cy < from.cy ? 'top' : 'bottom';- const horizontalTo = to.cx < from.cx ? 'right' : 'left';- const horizontalFrom = to.cx < from.cx ? 'left' : 'right';- const verticalTo = to.cy < from.cy ? 'bottom' : 'top';- const candidates = [- { fromSide: verticalFrom, toSide: horizontalTo },- { fromSide: horizontalFrom, toSide: verticalTo },- ];-- return candidates.find(({ fromSide, toSide }) => {- const start = anchor(from, fromSide);- const end = anchor(to, toSide);- return oneBendCrossLaneVia(edge, start, end, fromSide, toSide);- }) || null;-}--function routeVia(edge, from, to, start, end, fromSide, toSide) {- if (edge.via) return edge.via;- switch (edge.route || 'auto') {- case 'straight':- return [];- case 'drop': {- const y = gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);- return [[start[0], y], [end[0], y]];- }- case 'outside-right': {- const x = edge.channelX ?? layout.laneX + layout.laneW + 12;- return [[x, start[1]], [x, end[1]]];- }- case 'return-left': {- const x = edge.channelX ?? Math.min(from.x, to.x) - 28;- return [[x, start[1]], [x, end[1]]];- }- case 'bottom-channel': {- const y = edge.channelY ?? Math.max(from.y + from.height, to.y + to.height) + 32;- return [[start[0], y], [end[0], y]];- }- case 'up-channel': {- const y = edge.channelY ?? Math.min(from.y, to.y) - 28;- return [[start[0], y], [end[0], y]];- }- case 'auto':- default: {- if (from.lane === to.lane) return sameLaneAutoVia(start, end);- const oneBendVia = oneBendCrossLaneVia(edge, start, end, fromSide, toSide);- if (oneBendVia) return oneBendVia;- const y = gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);- return [[start[0], y], [end[0], y]];- }- }-}--const pathCache = new Map();--function workflowEdgeLabelPoint(edge, points) {- if (edge.labelAt || Number.isInteger(edge.labelSegment) || points.length !== 3) {- return labelPoint(edge, points);- }- const segmentLengths = [0, 1].map((index) => Math.hypot(- points[index + 1][0] - points[index][0],- points[index + 1][1] - points[index][1],- ));- const labelSegment = segmentLengths[0] >= segmentLengths[1] ? 0 : 1;- const point = labelPoint({ ...edge, labelSegment }, points);- if (points[labelSegment][0] === points[labelSegment + 1][0]) point[1] += 10;- return point;-}--function edgeSides(edge) {- const from = nodes.get(edge.from);- const to = nodes.get(edge.to);- const oneBendSides = automaticOneBendSides(edge, from, to);- if (oneBendSides) return oneBendSides;- return {- fromSide: chosenSide(edge.fromSide, defaultFromSide(from, to)),- toSide: chosenSide(edge.toSide, defaultToSide(from, to)),- };-}--const automaticPorts = automaticPortSpread(workflow.edges, nodes, {- sideFor: (edge, endpoint) => edgeSides(edge)[endpoint === 'source' ? 'fromSide' : 'toSide'],+const compiled = compileWorkflow({+ workflow,+ qualityProfile: process.env.ARCHIFY_QUALITY_PROFILE || workflow.meta?.quality_profile,});-function pathFor(edge) {- if (pathCache.has(edge)) return pathCache.get(edge);- const from = nodes.get(edge.from);- const to = nodes.get(edge.to);- const ports = automaticPorts.get(edge);- const { fromSide, toSide } = edgeSides(edge);- const start = ports?.from || anchor(from, fromSide);- const end = ports?.to || anchor(to, toSide);- const points = [start, ...routeVia(edge, from, to, start, end, fromSide, toSide), end];- const routed = { d: polylinePath(points), points };- pathCache.set(edge, routed);- return routed;-}--function renderLane(lane, index) {- const y = layout.laneY + index * (layout.laneH + layout.laneGap);- const exception = lane.variant === 'exception'- ? `\n <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-${index}-exception" x="${layout.laneX + 6}" y="${y + 6}" width="${layout.laneW - 12}" height="${layout.laneH - 12}" rx="8" class="c-security-group" stroke-width="1"/>`- : '';- const labelClass = lane.variant === 'exception' ? 't-security' : 't-dim';- const prefix = lane.variant === 'exception' ? 'EX' : String(index + 1).padStart(2, '0');- return ` <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-${index}" x="${layout.laneX}" y="${y}" width="${layout.laneW}" height="${layout.laneH}" rx="10" class="c-lane" stroke-width="1"/>${exception}- <text x="${layout.laneX + 14}" y="${y + 22}" class="${labelClass}" font-size="10" font-weight="600">${prefix} / ${esc(lane.label)}</text>`;-}--function renderPhase(phase) {- const span = spanForCols(phase.fromCol, phase.toCol, 46);- const accent = variantAccent(phase.variant);- const [lineClass] = arrowClassMap[phase.variant || 'default'] || arrowClassMap.default;- return ` <line x1="${span.x}" y1="35" x2="${span.x + span.width}" y2="35" class="${lineClass}" stroke-width="1.1"/>- <rect x="${span.x}" y="27" width="${span.width}" height="16" rx="4" class="c-mask"/>- <text x="${span.cx}" y="39" class="${accent}" font-size="8" font-weight="600" text-anchor="middle">${esc(phase.label)}</text>`;-}--function renderGroup(group, index) {- const span = spanForCols(group.fromCol, group.toCol, 50);- const y = laneTop(group.lane) + layout.laneTitleH + 8;- const height = layout.laneH - layout.laneTitleH - 16;- const cls = group.variant === 'security' ? 'c-security-group' : 'c-lane';- const textClass = variantAccent(group.variant);- return ` <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-${index}" x="${span.x}" y="${y}" width="${span.width}" height="${height}" rx="9" class="${cls}" stroke-width="1"/>- <text x="${span.x + 10}" y="${y + 14}" class="${textClass}" font-size="7" font-weight="600">${esc(group.label)}</text>`;-}--function renderNode(node) {- const fill = componentFill[node.type] || 'c-external';- const accent = componentText[node.type] || 't-muted';- const hasSub = node.sublabel != null && node.sublabel !== '';- const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), nodeTextFit.labelPreferred, nodeTextFit.labelMinimum);- const sublabelFontSize = hasSub- ? fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum)- : nodeTextFit.sublabelPreferred;- const sub = hasSub- ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + 38}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(node.sublabel)}</text>`- : '';- const tag = node.tag- ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + node.height - 12}" class="${accent}" font-size="${fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum)}" text-anchor="middle">${esc(node.tag)}</text>`- : '';- const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 });- const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context: nodeContext(node), ...brandMetadataFor(node) };- return ` <g ${focusNodeAttrs(node.id, node.label, passport, workflow.meta.locale)}>- ${focusNodeTitle(node.label, passport)}- <rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="c-mask"/>- <rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="${fill}"${animateAttr(workflow.meta, 'node', nodeStep(node))} stroke-width="1.5"/>- ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''}- <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.cx}" y="${node.y + 21}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}- </g>`;-}--function renderEdgePath(edge, index) {- const [cls, marker] = arrowClassMap[edge.variant || 'default'] || arrowClassMap.default;- const routed = pathFor(edge);- const strokeWidth = edge.width || (edge.variant === 'emphasis' ? 1.8 : 1.4);- return ` <path ${focusEdgeAttrs(edge.from, edge.to, edge.label, index, edge.id)} data-composition-points="${routePointsValue(routed.points)}" d="${routed.d}" class="${cls}"${animateAttr(workflow.meta, 'edge', edgeSteps.get(edge))} stroke-width="${strokeWidth}" marker-end="url(#${marker})"/>`;-}--function renderEdgeLabel(edge, index) {- if (!edge.label) return '';- const routed = pathFor(edge);- const [lx, ly] = workflowEdgeLabelPoint(edge, routed.points);- const labelW = Math.max(30, textUnits(edge.label) * 4.8 + 10);- return ` <g data-detail="context" ${focusEdgeAttrs(edge.from, edge.to, edge.label, index, edge.id)}>- <rect x="${lx - labelW / 2}" y="${ly - 10}" width="${labelW}" height="14" rx="3" class="c-mask"/>- <text x="${lx}" y="${ly}" class="${variantAccent(edge.variant, { dashed: 't-database' })}" font-size="8" text-anchor="middle">${esc(edge.label)}</text>- </g>`;-}--const LEGEND_CATALOG = [- 'frontend',- 'backend',- 'security',- 'messagebus',- 'database',- 'cloud',- 'external',-].map((kind) => ({ kind, label: i18nText(workflow.meta.locale, `legend.workflow.${kind}`) }));--function renderLegend() {- const presentKinds = new Set([...nodes.values()].map((node) => node.type));- const entries = resolveLegend(workflow.meta?.legend, LEGEND_CATALOG, presentKinds);- return renderResolvedLegend({- entries,- locale: workflow.meta.locale,- layout: {- x: 20,- baselineY: legendY(),- width: viewBox[0] - 40,- fontSize: 7,- itemGap: 7,- minTitleY: lastLaneBottom() + 8,- unfit: workflow.meta?.legend === undefined ? 'hide' : 'error',- diagramType: 'workflow',- },- renderSwatch: (entry) => `<rect x="${entry.x}" y="${entry.baseline - 8}" width="14" height="9" rx="2" class="${componentFill[entry.kind] || 'c-external'}" stroke-width="1"/>`,+const layoutJson = process.argv.includes('--layout-json');++if (layoutJson) {+ process.stdout.write(`${JSON.stringify(compiled.receipt, null, 2)}\n`);+ if (!compiled.ok) process.exitCode = 1;+} else if (!compiled.ok) {+ throwDiagnosticError(compiled.error || 'Workflow compilation failed.', compiled.diagnostics);+} else {+ writeDiagram({+ outPath,+ template,+ diagramType: 'workflow',+ meta: workflow.meta,+ svg: compiled.svg,+ cards: workflow.cards,});}--function renderSvg() {- return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}" ${svgRootAttrs(workflow.meta)}>-${svgAccessibleText(workflow.meta, 'workflow')}-${renderDefinitions()}-- <!-- Background Grid -->- <rect width="100%" height="100%" fill="url(#grid)" />-- <!-- Swimlanes -->-${workflow.lanes.map(renderLane).join('\n\n')}-- <!-- Phase headers -->-${asArray(workflow.phases).map(renderPhase).join('\n')}-- <!-- Workflow groups -->-${asArray(workflow.groups).map(renderGroup).join('\n')}-- <!-- Edge paths -->-${workflow.edges.map(renderEdgePath).join('\n')}-- <!-- Nodes -->-${[...nodes.values()].map(renderNode).join('\n\n')}-- <!-- Edge labels -->-${workflow.edges.map(renderEdgeLabel).join('\n')}-- <!-- Legend -->-${renderLegend()}- </svg>`;-}--validateWorkflow();-writeDiagram({- outPath,- template,- diagramType: 'workflow',- meta: workflow.meta,- svg: renderSvg(),- cards: workflow.cards,-});diff --git a/archify/renderers/workflow/workflow-compiler.mjs b/archify/renderers/workflow/workflow-compiler.mjsnew file mode 100644index 00000000..81ba79a1--- /dev/null+++ b/archify/renderers/workflow/workflow-compiler.mjs@@ -0,0 +1,4400 @@+import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs';+import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs';+import {+ throwDiagnosticError,+ throwDiagnosticProblems,+ withDiagnosticRecordingSuppressed,+} from '../shared/diagnostics.mjs';+import { validateSchema } from '../shared/validator.mjs';+import {+ legendFootprint,+ measureLegend,+ relationshipLegendObstacles,+ resolveLegend,+ renderLegend as renderResolvedLegend,+} from '../shared/legend.mjs';+import { availableNodeTextWidth, fittedNodeFontSize, minimumNodeTextWidth } from '../shared/text-fit.mjs';+import { brandLabelFitWidth, brandMetadataFor, brandTopRailProblem, renderBrandMark } from '../shared/brand-marks.mjs';+import { translateMessage as i18nText } from '../shared/i18n.mjs';+import {+ createMappedWorkflowCandidate,+ intrinsicWorkflow,+ planningWorkflow,+} from './workflow-migration-geometry.mjs';+import {+ asArray,+ isFinitePoint,+ rectsOverlap,+ segmentIntersectsRect,+ segmentRectClearance,+ cleanEndpointSideProblems,+ cleanFlowProblems,+ cleanCrossingProblems,+ cleanAmbiguousCorridorProblems,+ cleanBorderRunProblems,+ cleanRouteRhythmProblems,+ cleanLabelRouteClearanceProblems,+ collectAmbiguousCorridors,+ collectLabelRouteClearance,+ collectBorderRuns,+ forwardCollinearAnalysisSegments,+ sourceSegmentIndexAtPoint,+ suggestLabelObstacleFix,+ suggestLabelPairFix,+ anchor,+ automaticPortSpread,+ defaultFromSide,+ defaultToSide,+ chosenSide,+ normalizeRoutePoints,+ routeHonorsEndpointSides,+ polylinePath,+ routePointsValue,+ labelPoint,+ componentFill,+ componentText,+ arrowClassMap,+ variantAccent+} from '../shared/geometry.mjs';++const LEGACY_COLUMN_CENTERS = Object.freeze([88, 220, 300, 430, 500, 625]);+const READABLE_CANDIDATE_COST_PRIORITY = Object.freeze([+ 'automaticForwardReversePx',+ 'properCrossingCount',+ 'sharedCorridorPx',+ 'labelRouteClearanceDeficit',+ 'interiorPreferred28Deficit',+ 'bendCount',+ 'stretchMilli',+ 'canvasGrowthPx',+ 'portDisplacementMilli',+ 'legacyCoordinateDisplacement',+ 'stableCandidateOrdinal',+]);+const MAX_READABLE_LAYOUT_FEEDBACK_ROUNDS = 3;+const GROUP_FRAME_TOP_INSET = 8;+const GROUP_FRAME_BOTTOM_INSET = 4;+const GROUP_LABEL_BASELINE_OFFSET = -2;+const GROUP_LABEL_MASK_ASCENT = 10;+const GROUP_LABEL_MASK_H = 14;+const GROUP_NODE_INSET = 4;++class WorkflowLayoutFeedback extends Error {+ constructor(request) {+ super(`Workflow layout requires ${request.kind} feedback.`);+ this.name = 'WorkflowLayoutFeedback';+ this.request = request;+ }+}++function createLegacyLayout() {+ return {+ contract: 'fixed-v1',+ laneX: 40,+ laneY: 52,+ laneW: 640,+ laneH: 104,+ laneGap: 20,+ laneTitleH: 30,+ colXs: [...LEGACY_COLUMN_CENTERS],+ nodeW: 92,+ nodeH: 52,+ defaultViewBoxWidth: 720,+ };+}++function authoredNodeWidth(node) {+ return Number.isFinite(node?.width) ? node.width : 92;+}++function nodeWidthContributor(node) {+ return `node ${node.id} width ${authoredNodeWidth(node)}px`;+}++function authoredNodeHeight(node) {+ if (Number.isFinite(node?.height)) return node.height;+ return node?.tag ? 68 : 52;+}++function workflowLabelWidth(label) {+ return Math.max(30, textUnits(label) * 4.8 + 10);+}++function readableGroupBounds(workflow, group, colXs) {+ if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)+ || group.fromCol < 0 || group.fromCol > group.toCol || group.toCol >= colXs.length) {+ return { x: 0, width: 0, cx: 0 };+ }+ const start = colXs[group.fromCol] - 50;+ const end = colXs[group.toCol] + 50;+ const naturalWidth = end - start;+ const minimumWidth = textUnits(group.label) * 5.6 + 20;+ let width = Math.max(naturalWidth, minimumWidth);+ let left = group.fromCol === group.toCol && width > naturalWidth+ ? start+ : (start + end - width) / 2;+ let right = left + width;+ for (const node of asArray(workflow.nodes)) {+ if (node.lane !== group.lane+ || !Number.isInteger(node.col)+ || node.col < group.fromCol+ || node.col > group.toCol+ || node.col < 0+ || node.col >= colXs.length) continue;+ const halfWidth = authoredNodeWidth(node) / 2;+ left = Math.min(left, colXs[node.col] - halfWidth - GROUP_NODE_INSET);+ right = Math.max(right, colXs[node.col] + halfWidth + GROUP_NODE_INSET);+ }+ width = right - left;+ return { x: left, width, cx: left + width / 2 };+}++function verticalIntervalsOverlap(a, b, clearance = 0) {+ const aCenter = Number(a?.yOffset) || 0;+ const bCenter = Number(b?.yOffset) || 0;+ return Math.abs(aCenter - bCenter)+ < authoredNodeHeight(a) / 2 + authoredNodeHeight(b) / 2 + clearance;+}++function createReadableLayout(workflow, layoutFeedback = {}) {+ const columnCount = 6;+ const baselinePitch = 120;+ const columnStart = 94;+ const maxLayoutIterations = 3;+ const channelDetourBudgetPx = 4 * 28;+ const constraints = [];+ const feedbackConstraints = [];+ const channelLabelEdgeKeys = new Set();+ const widthContributors = new Set();+ const heightContributors = new Set();+ const nodes = asArray(workflow.nodes);+ const nodesById = new Map(nodes.map((node) => [node.id, node]));++ for (let col = 0; col < columnCount - 1; col += 1) {+ constraints.push({ from: col, to: col + 1, minimum: baselinePitch });+ }+ for (const [key, minimum] of Object.entries(layoutFeedback.rankGapMinimums || {}).sort()) {+ const [from, to] = key.split(':').map(Number);+ constraints.push({+ from,+ to,+ minimum,+ contributors: layoutFeedback.rankGapContributors?.[key]+ || [`rank ${from}→${to} route clearance`],+ });+ }++ for (let leftIndex = 0; leftIndex < nodes.length; leftIndex += 1) {+ for (let rightIndex = leftIndex + 1; rightIndex < nodes.length; rightIndex += 1) {+ const leftNode = nodes[leftIndex];+ const rightNode = nodes[rightIndex];+ if (leftNode.lane !== rightNode.lane || leftNode.col === rightNode.col) continue;+ if (!verticalIntervalsOverlap(leftNode, rightNode, 8)) continue;+ const fromNode = leftNode.col < rightNode.col ? leftNode : rightNode;+ const toNode = fromNode === leftNode ? rightNode : leftNode;+ constraints.push({+ from: fromNode.col,+ to: toNode.col,+ minimum: authoredNodeWidth(fromNode) / 2 + 8 + authoredNodeWidth(toNode) / 2,+ contributors: [+ `rank ${fromNode.col}→${toNode.col} node width clearance`,+ nodeWidthContributor(fromNode),+ nodeWidthContributor(toNode),+ ],+ });+ }+ }++ for (const edge of asArray(workflow.edges)) {+ const fromNode = nodesById.get(edge.from);+ const toNode = nodesById.get(edge.to);+ if (!fromNode || !toNode || fromNode.lane !== toNode.lane || fromNode.col === toNode.col) continue;+ if (edge.via || edge.channelX !== undefined || edge.channelY !== undefined+ || !['auto', 'straight'].includes(edge.route || 'auto')) continue;+ if ((Number(fromNode.yOffset) || 0) !== (Number(toNode.yOffset) || 0)) continue;+ const earlier = fromNode.col < toNode.col ? fromNode : toNode;+ const later = earlier === fromNode ? toNode : fromNode;+ const labeledDirectClearance = edge.label && !edge.labelAt+ ? Math.max(28, workflowLabelWidth(edge.label) + 8)+ : 28;+ const directLabelExpansionCost = Math.max(0, labeledDirectClearance - 28);+ const canUseAutomaticLabelChannel = edge.label+ && !edge.labelAt+ && (edge.route || 'auto') === 'auto'+ && !edge.fromSide+ && !edge.toSide+ && edge.channelX === undefined+ && edge.channelY === undefined;+ const preferLabelChannel = canUseAutomaticLabelChannel+ && directLabelExpansionCost > channelDetourBudgetPx;+ if (preferLabelChannel) channelLabelEdgeKeys.add(stableValueKey(edge));+ constraints.push({+ from: earlier.col,+ to: later.col,+ minimum: authoredNodeWidth(earlier) / 2 + 28 + authoredNodeWidth(later) / 2,+ contributors: [+ `rank ${earlier.col}→${later.col} direct clearance`,+ `rank ${earlier.col}→${later.col} node width clearance`,+ nodeWidthContributor(earlier),+ nodeWidthContributor(later),+ ],+ });+ if (!preferLabelChannel && labeledDirectClearance > 28) {+ const labelConstraintMinimum = authoredNodeWidth(earlier) / 2+ + labeledDirectClearance+ + authoredNodeWidth(later) / 2;+ feedbackConstraints.push({+ from: earlier.col,+ to: later.col,+ minimum: labelConstraintMinimum,+ contributors: [+ `rank ${earlier.col}→${later.col} direct clearance`,+ `edge ${workflowEdgeName(edge)} label mask`,+ nodeWidthContributor(earlier),+ nodeWidthContributor(later),+ ],+ });+ }+ }++ for (const phase of asArray(workflow.phases)) {+ if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)+ || phase.fromCol < 0 || phase.fromCol > phase.toCol || phase.toCol >= columnCount) continue;+ const minimumWidth = textUnits(phase.label) * 5.6 + 8;+ if (phase.fromCol === phase.toCol) {+ if (phase.toCol < columnCount - 1) {+ constraints.push({+ from: phase.toCol,+ to: phase.toCol + 1,+ minimum: baselinePitch + Math.max(0, minimumWidth - 92),+ contributors: [`phase ${phase.id || phase.label} label span`],+ });+ }+ continue;+ }+ constraints.push({+ from: phase.fromCol,+ to: phase.toCol,+ minimum: Math.max(0, minimumWidth - 92),+ contributors: [`phase ${phase.id || phase.label} label span`],+ });+ }++ for (const group of asArray(workflow.groups)) {+ if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)+ || group.fromCol < 0 || group.fromCol > group.toCol || group.toCol >= columnCount) continue;+ const minimumWidth = textUnits(group.label) * 5.6 + 20;+ if (group.fromCol === group.toCol) {+ if (group.toCol < columnCount - 1) {+ constraints.push({+ from: group.toCol,+ to: group.toCol + 1,+ minimum: baselinePitch + Math.max(0, minimumWidth - 100),+ contributors: [`group ${group.id || group.label} label span`],+ });+ }+ continue;+ }+ constraints.push({+ from: group.fromCol,+ to: group.toCol,+ minimum: Math.max(0, minimumWidth - 100),+ contributors: [`group ${group.id || group.label} label span`],+ });+ }++ let activeConstraints = [...constraints];+ let colXs;+ let colProvenance;+ for (let iteration = 0; iteration < maxLayoutIterations; iteration += 1) {+ colXs = Array.from({ length: columnCount }, (_, col) => columnStart + col * baselinePitch);+ colProvenance = Array.from({ length: columnCount }, () => new Set());+ const orderedConstraints = activeConstraints+ .filter(({ from, to, minimum }) => (+ Number.isInteger(from) && Number.isInteger(to)+ && from >= 0 && from < to && to < columnCount+ && Number.isFinite(minimum)+ ))+ .sort((a, b) => a.to - b.to || a.from - b.from || a.minimum - b.minimum);+ for (let to = 1; to < columnCount; to += 1) {+ for (const constraint of orderedConstraints) {+ if (constraint.to !== to) continue;+ const candidate = colXs[constraint.from] + constraint.minimum;+ const candidateProvenance = new Set([+ ...colProvenance[constraint.from],+ ...asArray(constraint.contributors),+ ]);+ if (candidate > colXs[to] + 0.0001) {+ colXs[to] = candidate;+ colProvenance[to] = candidateProvenance;+ } else if (Math.abs(candidate - colXs[to]) <= 0.0001+ && candidate > columnStart + to * baselinePitch + 0.0001) {+ for (const contributor of candidateProvenance) colProvenance[to].add(contributor);+ }+ }+ }+ if (iteration > 0 || !feedbackConstraints.length) break;+ activeConstraints = [...activeConstraints, ...feedbackConstraints];+ }++ const firstRankNodes = nodes.filter((node) => node.col === 0);+ const firstExtent = firstRankNodes.reduce(+ (maximum, node) => Math.max(maximum, authoredNodeWidth(node) / 2),+ 46,+ );+ const leftInset = 8;+ const leftShift = Math.max(0, 40 + leftInset + firstExtent - colXs[0]);+ if (leftShift) {+ for (let col = 0; col < colXs.length; col += 1) colXs[col] += leftShift;+ for (const node of firstRankNodes) {+ if (Math.abs(authoredNodeWidth(node) / 2 - firstExtent) > 0.0001) continue;+ for (const provenance of colProvenance) provenance.add(nodeWidthContributor(node));+ }+ }++ const unpinnedTopEndpointIds = new Set();+ for (const edge of asArray(workflow.edges)) {+ const preservesHorizontalPins = Array.isArray(edge.via) || edge.channelX !== undefined;+ if (preservesHorizontalPins) continue;+ if (edge.fromSide === 'top') unpinnedTopEndpointIds.add(edge.from);+ if (edge.toSide === 'top') unpinnedTopEndpointIds.add(edge.to);+ }+ const laneOrder = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index]));+ let laneHeaderShift = 0;+ const laneHeaderShiftContributors = new Set();+ for (const nodeId of unpinnedTopEndpointIds) {+ const node = nodesById.get(nodeId);+ if (!node || !Number.isInteger(node.col) || node.col < 0 || node.col >= columnCount) continue;+ const lanePosition = laneOrder.get(node.lane);+ const lane = asArray(workflow.lanes)[lanePosition];+ if (!lane) continue;+ const prefix = lane.variant === 'exception'+ ? 'EX'+ : String(lanePosition + 1).padStart(2, '0');+ const laneHeaderRight = 40 + 14 + textUnits(`${prefix} / ${lane.label}`) * 6.2;+ const requiredShift = laneHeaderRight + 2 - colXs[node.col];+ if (requiredShift > laneHeaderShift + 0.0001) {+ laneHeaderShift = requiredShift;+ laneHeaderShiftContributors.clear();+ laneHeaderShiftContributors.add(`lane ${lane.id} label width`);+ } else if (requiredShift > 0 && Math.abs(requiredShift - laneHeaderShift) <= 0.0001) {+ laneHeaderShiftContributors.add(`lane ${lane.id} label width`);+ }+ }+ if (laneHeaderShift > 0) {+ for (let col = 0; col < colXs.length; col += 1) colXs[col] += laneHeaderShift;+ for (const provenance of colProvenance) {+ for (const contributor of laneHeaderShiftContributors) provenance.add(contributor);+ }+ }++ let measuredContentLeftShift = asArray(workflow.edges).reduce((maximum, edge) => {+ if (!channelLabelEdgeKeys.has(stableValueKey(edge))) return maximum;+ const fromNode = nodesById.get(edge.from);+ const toNode = nodesById.get(edge.to);+ if (!fromNode || !toNode) return maximum;+ const labelCenter = (colXs[fromNode.col] + colXs[toNode.col]) / 2;+ const labelLeft = labelCenter - workflowLabelWidth(edge.label) / 2;+ return Math.max(maximum, 16 - labelLeft);+ }, 0);+ for (const phase of asArray(workflow.phases)) {+ if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)) continue;+ const width = Math.max(+ colXs[phase.toCol] - colXs[phase.fromCol] + 92,+ textUnits(phase.label) * 5.6 + 8,+ );+ const left = phase.fromCol === phase.toCol+ ? colXs[phase.fromCol] - 46+ : (colXs[phase.fromCol] + colXs[phase.toCol] - width) / 2;+ measuredContentLeftShift = Math.max(measuredContentLeftShift, 16 - left);+ }+ for (const group of asArray(workflow.groups)) {+ if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)) continue;+ const bounds = readableGroupBounds(workflow, group, colXs);+ measuredContentLeftShift = Math.max(measuredContentLeftShift, 44 - bounds.x);+ }+ if (measuredContentLeftShift > 0) {+ for (let col = 0; col < colXs.length; col += 1) colXs[col] += measuredContentLeftShift;+ }++ let rightmost = colXs.at(-1) + 50;+ let rightmostContributors = new Set(colProvenance.at(-1));+ for (const node of nodes) {+ if (!Number.isInteger(node.col) || node.col < 0 || node.col >= columnCount) continue;+ const nodeRight = colXs[node.col] + authoredNodeWidth(node) / 2;+ const nodeContributors = new Set([+ ...colProvenance[node.col],+ nodeWidthContributor(node),+ ]);+ if (nodeRight > rightmost + 0.0001) {+ rightmost = nodeRight;+ rightmostContributors = nodeContributors;+ } else if (Math.abs(nodeRight - rightmost) <= 0.0001) {+ for (const contributor of nodeContributors) rightmostContributors.add(contributor);+ }+ }+ for (const group of asArray(workflow.groups)) {+ if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)) continue;+ const bounds = readableGroupBounds(workflow, group, colXs);+ const groupRight = bounds.x + bounds.width;+ const groupContributors = new Set([+ ...colProvenance[group.fromCol],+ ...colProvenance[group.toCol],+ `group ${group.id || group.label} label span`,+ ...nodes+ .filter((node) => node.lane === group.lane+ && node.col >= group.fromCol && node.col <= group.toCol)+ .map(nodeWidthContributor),+ ]);+ if (groupRight > rightmost + 0.0001) {+ rightmost = groupRight;+ rightmostContributors = groupContributors;+ } else if (Math.abs(groupRight - rightmost) <= 0.0001) {+ for (const contributor of groupContributors) rightmostContributors.add(contributor);+ }+ }+ const widestLaneLabel = asArray(workflow.lanes).reduce((widest, lane, index) => {+ const width = textUnits(`${String(index + 1).padStart(2, '0')} / ${lane.label}`) * 6.2 + 30;+ return width > widest.width ? { width, lane } : widest;+ }, { width: 0, lane: null });+ const laneLabelWidth = widestLaneLabel.width;+ const rightmostLaneWidth = Math.ceil(rightmost - 40 + 8);+ const laneW = Math.max(+ 640,+ rightmostLaneWidth,+ Math.ceil(laneLabelWidth),+ );+ if (laneW > 640) {+ if (rightmostLaneWidth === laneW) {+ for (const contributor of rightmostContributors) widthContributors.add(contributor);+ }+ if (Math.ceil(laneLabelWidth) === laneW && widestLaneLabel.lane) {+ widthContributors.add(`lane ${widestLaneLabel.lane.id || widestLaneLabel.lane.label} label width`);+ }+ }+ let maxVerticalExtent = 0;+ const verticalExtentContributors = new Set();+ for (const node of nodes) {+ const yOffset = Number(node.yOffset) || 0;+ const extent = authoredNodeHeight(node) / 2 + Math.abs(yOffset);+ const contributor = `node ${node.id} height ${authoredNodeHeight(node)}px${yOffset ? ` with yOffset ${yOffset}px` : ''}`;+ if (extent > maxVerticalExtent + 0.0001) {+ maxVerticalExtent = extent;+ verticalExtentContributors.clear();+ verticalExtentContributors.add(contributor);+ } else if (Math.abs(extent - maxVerticalExtent) <= 0.0001) {+ verticalExtentContributors.add(contributor);+ }+ }+ const baseContentH = Math.max(74, Math.ceil(maxVerticalExtent * 2 + 8));+ const laneH = 30 + baseContentH;+ const groupsByLane = new Map();+ for (const group of asArray(workflow.groups)) {+ groupsByLane.set(group.lane, [...(groupsByLane.get(group.lane) || []), group]);+ }+ const groupLaneReserves = asArray(workflow.lanes).map((lane) => {+ let header = 0;+ let footer = 0;+ for (const group of groupsByLane.get(lane.id) || []) {+ const bounds = readableGroupBounds(workflow, group, colXs);+ const labelLeft = bounds.x + 10;+ const labelRight = labelLeft + textUnits(group.label) * 5.6;+ for (const node of nodes) {+ if (node.lane !== group.lane+ || !Number.isInteger(node.col)+ || node.col < group.fromCol+ || node.col > group.toCol+ || node.col < 0+ || node.col >= colXs.length) continue;+ const halfWidth = authoredNodeWidth(node) / 2;+ const nodeLeft = colXs[node.col] - halfWidth;+ const nodeRight = colXs[node.col] + halfWidth;+ const overlapsLabel = nodeRight > labelLeft && nodeLeft < labelRight;+ const topOffset = (baseContentH - authoredNodeHeight(node)) / 2+ + (Number(node.yOffset) || 0);+ const minimumTopOffset = overlapsLabel ? 11 : 9;+ header = Math.max(header, Math.ceil(minimumTopOffset - topOffset));+ const bottomMargin = baseContentH - GROUP_FRAME_BOTTOM_INSET+ - topOffset - authoredNodeHeight(node);+ footer = Math.max(footer, Math.ceil(1 - bottomMargin));+ }+ }+ return { header: Math.max(0, header), footer: Math.max(0, footer) };+ });+ const groupHeaderHeights = groupLaneReserves.map(({ header }) => header);+ const groupFooterHeights = groupLaneReserves.map(({ footer }) => footer);+ const laneHeights = groupLaneReserves.map(({ header, footer }) => laneH + header + footer);+ const laneGap = Math.max(20, Math.ceil(layoutFeedback.laneGapMin || 0));+ for (const [index, reserve] of groupHeaderHeights.entries()) {+ if (!reserve) continue;+ const lane = asArray(workflow.lanes)[index];+ heightContributors.add(`lane ${lane.id || lane.label} group label clearance ${reserve}px`);+ }+ for (const [index, reserve] of groupFooterHeights.entries()) {+ if (!reserve) continue;+ const lane = asArray(workflow.lanes)[index];+ heightContributors.add(`lane ${lane.id || lane.label} group frame containment ${reserve}px`);+ }+ if (laneH > 104) {+ for (const contributor of verticalExtentContributors) heightContributors.add(contributor);+ }+ if (laneGap > 20) {+ for (const contributor of asArray(layoutFeedback.laneGapContributors)) {+ heightContributors.add(contributor);+ }+ }+ const requiredWidth = 40 + laneW + 16;++ return {+ contract: 'readable-v2',+ laneX: 40,+ laneY: 52,+ laneW,+ laneH,+ laneHeights,+ laneGap,+ laneTitleH: 30,+ groupHeaderHeights,+ groupFooterHeights,+ colXs,+ nodeW: 92,+ nodeH: 52,+ defaultViewBoxWidth: requiredWidth,+ channelLabelEdgeKeys,+ widthContributors: [...widthContributors].sort(stableCompare),+ heightContributors: [...heightContributors].sort(stableCompare),+ };+}++function compilerFailure(contract, diagnostics, error = diagnostics.map(({ message }) => message).join('\n')) {+ return {+ ok: false,+ error,+ diagnostics,+ receipt: { contract, diagnostics },+ };+}++function workflowEdgeName(edge) {+ return edge.id || `${edge.from}->${edge.to}`;+}++function stableText(value) {+ return value == null ? '' : String(value);+}++function stableCompare(left, right) {+ const a = stableText(left);+ const b = stableText(right);+ return a < b ? -1 : a > b ? 1 : 0;+}++function stableValueKey(value) {+ if (Array.isArray(value)) return `[${value.map(stableValueKey).join(',')}]`;+ if (value && typeof value === 'object') {+ return `{${Object.keys(value).sort(stableCompare).map((key) => `${JSON.stringify(key)}:${stableValueKey(value[key])}`).join(',')}}`;+ }+ return JSON.stringify(value);+}++function cloneWorkflow(value) {+ return JSON.parse(JSON.stringify(value));+}++function canonicalReadableWorkflow(workflow) {+ if (workflow.schema_version !== 2) return workflow;+ const laneOrder = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index]));+ const nodes = [...asArray(workflow.nodes)].sort((left, right) => (+ (laneOrder.get(left.lane) ?? Number.MAX_SAFE_INTEGER) - (laneOrder.get(right.lane) ?? Number.MAX_SAFE_INTEGER)+ || left.col - right.col+ || stableCompare(left.id, right.id)+ ));+ const edges = [...asArray(workflow.edges)].sort((left, right) => (+ stableCompare(left.id, right.id)+ || stableCompare(left.from, right.from)+ || stableCompare(left.to, right.to)+ || stableCompare(left.label, right.label)+ || stableCompare(left.route, right.route)+ || stableCompare(stableValueKey(left), stableValueKey(right))+ ));+ const phases = workflow.phases === undefined ? undefined : [...asArray(workflow.phases)].sort((left, right) => (+ left.fromCol - right.fromCol || left.toCol - right.toCol+ || stableCompare(left.id, right.id)+ ));+ const groups = workflow.groups === undefined ? undefined : [...asArray(workflow.groups)].sort((left, right) => (+ (laneOrder.get(left.lane) ?? Number.MAX_SAFE_INTEGER) - (laneOrder.get(right.lane) ?? Number.MAX_SAFE_INTEGER)+ || left.fromCol - right.fromCol || left.toCol - right.toCol+ || stableCompare(left.id, right.id)+ ));+ return {+ ...workflow,+ nodes,+ edges,+ ...(phases ? { phases } : {}),+ ...(groups ? { groups } : {}),+ };+}++function semanticContractDiagnostics(workflow) {+ const checks = workflow.semanticChecks;+ if (!checks) return [];++ const nodeIds = new Set(asArray(workflow.nodes).map((node) => node.id));+ const incoming = new Map([...nodeIds].map((id) => [id, 0]));+ const outgoing = new Map([...nodeIds].map((id) => [id, 0]));+ const adjacency = new Map([...nodeIds].map((id) => [id, new Set()]));+ for (const edge of asArray(workflow.edges)) {+ if (!nodeIds.has(edge.from) || !nodeIds.has(edge.to)) continue;+ outgoing.set(edge.from, outgoing.get(edge.from) + 1);+ incoming.set(edge.to, incoming.get(edge.to) + 1);+ adjacency.get(edge.from).add(edge.to);+ }++ const diagnostics = [];+ const diagnostic = (code, message, subject, evidence, supportedFixes) => ({+ code,+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', ...subject },+ evidence,+ supportedFixes,+ });+ const referencedNodes = [+ ...asArray(checks.allowedRoots).map((id, index) => ({ id, path: `/semanticChecks/allowedRoots/${index}` })),+ ...asArray(checks.allowedTerminals).map((id, index) => ({ id, path: `/semanticChecks/allowedTerminals/${index}` })),+ ...asArray(checks.requiredEdges).flatMap((relation, index) => [+ { id: relation.from, path: `/semanticChecks/requiredEdges/${index}/from` },+ { id: relation.to, path: `/semanticChecks/requiredEdges/${index}/to` },+ ]),+ ...asArray(checks.requiredPaths).flatMap((relation, index) => [+ { id: relation.from, path: `/semanticChecks/requiredPaths/${index}/from` },+ { id: relation.to, path: `/semanticChecks/requiredPaths/${index}/to` },+ ]),+ ];+ for (const { id, path } of referencedNodes) {+ if (nodeIds.has(id)) continue;+ diagnostics.push(diagnostic(+ 'workflow/semantic-node-reference',+ `Workflow semantic contract references unknown node "${id}" at ${path}.`,+ { node: id, path },+ { knownNodes: [...nodeIds] },+ [`replace "${id}" with an existing node id`, 'add the missing node before compiling'],+ ));+ }+ if (diagnostics.length) return diagnostics;++ if (checks.allowedRoots !== undefined) {+ const allowed = new Set(checks.allowedRoots);+ for (const [node, count] of incoming) {+ if (count > 0 || allowed.has(node)) continue;+ diagnostics.push(diagnostic(+ 'workflow/unexpected-root',+ `Workflow node "${node}" has no incoming edge and is not declared in semanticChecks.allowedRoots.`,+ { node, path: '/semanticChecks/allowedRoots' },+ { incomingEdges: 0, allowedRoots: [...allowed] },+ [`add the missing incoming edge to "${node}"`, `declare "${node}" in semanticChecks.allowedRoots if it is an intentional source`],+ ));+ }+ }++ if (checks.allowedTerminals !== undefined) {+ const allowed = new Set(checks.allowedTerminals);+ for (const [node, count] of outgoing) {+ if (count > 0 || allowed.has(node)) continue;+ diagnostics.push(diagnostic(+ 'workflow/unexpected-terminal',+ `Workflow node "${node}" has no outgoing edge and is not declared in semanticChecks.allowedTerminals.`,+ { node, path: '/semanticChecks/allowedTerminals' },+ { outgoingEdges: 0, allowedTerminals: [...allowed] },+ [`add the missing outgoing edge from "${node}"`, `declare "${node}" in semanticChecks.allowedTerminals if it is an intentional sink`],+ ));+ }+ }++ const authoredEdges = new Set(asArray(workflow.edges).map((edge) => `${edge.from}\u0000${edge.to}`));+ for (const [index, relation] of asArray(checks.requiredEdges).entries()) {+ if (authoredEdges.has(`${relation.from}\u0000${relation.to}`)) continue;+ diagnostics.push(diagnostic(+ 'workflow/required-edge',+ `Workflow semantic contract requires edge "${relation.from}" -> "${relation.to}", but no authored edge matches it.`,+ { from: relation.from, to: relation.to, path: `/semanticChecks/requiredEdges/${index}` },+ { authoredEdgeCount: asArray(workflow.edges).length },+ [`add an edge from "${relation.from}" to "${relation.to}" without deleting the semantic requirement`],+ ));+ }++ function reachable(from, to) {+ const visited = new Set([from]);+ const pending = [from];+ while (pending.length) {+ const current = pending.shift();+ if (current === to) return true;+ for (const next of adjacency.get(current) || []) {+ if (visited.has(next)) continue;+ visited.add(next);+ pending.push(next);+ }+ }+ return false;+ }++ for (const [index, relation] of asArray(checks.requiredPaths).entries()) {+ if (reachable(relation.from, relation.to)) continue;+ diagnostics.push(diagnostic(+ 'workflow/required-path',+ `Workflow semantic contract requires a directed path from "${relation.from}" to "${relation.to}", but none exists.`,+ { from: relation.from, to: relation.to, path: `/semanticChecks/requiredPaths/${index}` },+ { reachableNodes: [...new Set([relation.from, ...(adjacency.get(relation.from) || [])])] },+ [`restore a directed path from "${relation.from}" to "${relation.to}" without weakening the semantic requirement`],+ ));+ }++ return diagnostics;+}++function compileWorkflowInternal({+ workflow: inputWorkflow,+ qualityProfile,+ discoverFixes = true,+ layoutFeedback = {},+} = {}) {+ if (!inputWorkflow || typeof inputWorkflow !== 'object' || Array.isArray(inputWorkflow)) {+ const diagnostics = [{+ code: 'workflow/input-contract',+ severity: 'error',+ message: 'compileWorkflow requires one parsed workflow document object.',+ subject: { diagramType: 'workflow', path: '/' },+ evidence: {},+ supportedFixes: [],+ }];+ return compilerFailure('fixed-v1', diagnostics, diagnostics[0].message);+ }+ const resolvedQualityProfile = qualityProfile || inputWorkflow.meta?.quality_profile;+ const authoredQualityProfile = inputWorkflow.meta?.quality_profile;+ const qualityResolvedWorkflow = resolvedQualityProfile && resolvedQualityProfile !== inputWorkflow.meta?.quality_profile+ ? { ...inputWorkflow, meta: { ...inputWorkflow.meta, quality_profile: resolvedQualityProfile } }+ : inputWorkflow;+ let inputDiagnostics = [];+ try {+ validateSchema('workflow', qualityResolvedWorkflow);+ } catch (error) {+ inputDiagnostics = Array.isArray(error?.archifyDiagnostics)+ ? error.archifyDiagnostics.map((diagnostic) => ({+ ...diagnostic,+ supportedFixes: [],+ }))+ : [{+ code: 'workflow/input-contract',+ severity: 'error',+ message: 'Workflow schema validation failed unexpectedly.',+ subject: { diagramType: 'workflow', path: '/' },+ evidence: { reason: error?.message || String(error) },+ supportedFixes: [],+ }];+ }+ if (inputDiagnostics.length) {+ return compilerFailure(+ inputWorkflow.schema_version === 2 ? 'readable-v2' : 'fixed-v1',+ inputDiagnostics,+ );+ }+ const workflow = canonicalReadableWorkflow(qualityResolvedWorkflow);+ const semanticDiagnostics = semanticContractDiagnostics(workflow);+ if (semanticDiagnostics.length) {+ return compilerFailure(+ workflow.schema_version === 2 ? 'readable-v2' : 'fixed-v1',+ semanticDiagnostics,+ );+ }+ const sourceIndexes = {+ lanes: new Map(asArray(qualityResolvedWorkflow.lanes).map((lane, index) => [lane, index])),+ nodes: new Map(asArray(qualityResolvedWorkflow.nodes).map((node, index) => [node, index])),+ edges: new Map(asArray(qualityResolvedWorkflow.edges).map((edge, index) => [edge, index])),+ };+ const layout = workflow.schema_version === 2+ ? createReadableLayout(workflow, layoutFeedback)+ : createLegacyLayout();++const LEGEND_CATALOG = [+ 'frontend',+ 'backend',+ 'security',+ 'messagebus',+ 'database',+ 'cloud',+ 'external',+].map((kind) => ({ kind, label: i18nText(workflow.meta.locale, `legend.workflow.${kind}`) }));+const presentLegendKinds = new Set(asArray(workflow.nodes).map((node) => node.type));+const workflowLegendEntries = resolveLegend(+ workflow.meta?.legend,+ LEGEND_CATALOG,+ presentLegendKinds,+);+const legendFootprintOptions = { fontSize: 7, itemGap: 7 };+const oneRowLegendFootprint = legendFootprint(workflowLegendEntries, {+ ...legendFootprintOptions,+ width: Number.MAX_SAFE_INTEGER,+});+const minimumCanvasWidth = workflow.schema_version === 2+ ? Math.max(layout.defaultViewBoxWidth, oneRowLegendFootprint.minWidth + 40)+ : layout.defaultViewBoxWidth;+const legendPackingWidth = Math.max(+ 1,+ (workflow.schema_version === 2+ ? minimumCanvasWidth+ : (workflow.meta?.viewBox?.[0] ?? minimumCanvasWidth)) - 40,+);+const packedLegendFootprint = legendFootprint(workflowLegendEntries, {+ ...legendFootprintOptions,+ width: legendPackingWidth,+});+const legendExtraHeight = workflow.schema_version === 2+ ? packedLegendFootprint.extraHeight+ : 0;++// Content is 680px wide (laneX + laneW); auto height fits the lanes plus legend.+const autoHeight = layout.laneY+ + (layout.laneHeights?.reduce((total, height) => total + height, 0)+ ?? (workflow.lanes?.length || 1) * layout.laneH)+ + ((workflow.lanes?.length || 1) - 1) * layout.laneGap+ + 124+ + legendExtraHeight;+let viewBox = workflow.meta?.viewBox || [minimumCanvasWidth, autoHeight];+let requiredViewBox = [...viewBox];++const laneIndex = new Map(asArray(workflow.lanes).map((lane, index) => [lane.id, index]));+const laneLabels = new Map(asArray(workflow.lanes).map((lane) => [lane.id, lane.label]));++function nodeContext(node) {+ const group = asArray(workflow.groups).find((candidate) => (+ candidate.lane === node.lane && node.col >= candidate.fromCol && node.col <= candidate.toCol+ ));+ const phase = asArray(workflow.phases).find((candidate) => (+ node.col >= candidate.fromCol && node.col <= candidate.toCol+ ));+ return [laneLabels.get(node.lane), group?.label, phase?.label].filter(Boolean).join(' › ')+ || i18nText(workflow.meta.locale, 'node.context.workflow');+}++function laneHeight(idOrIndex) {+ const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex);+ return layout.laneHeights?.[index] ?? layout.laneH;+}++function laneGroupHeaderH(idOrIndex) {+ const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex);+ return layout.groupHeaderHeights?.[index] ?? 0;+}++function laneGroupFooterH(idOrIndex) {+ const index = typeof idOrIndex === 'number' ? idOrIndex : laneIndex.get(idOrIndex);+ return layout.groupFooterHeights?.[index] ?? 0;+}++function laneTop(id) {+ const index = laneIndex.get(id);+ const precedingHeight = asArray(workflow.lanes).slice(0, index)+ .reduce((total, _lane, lanePosition) => total + laneHeight(lanePosition), 0);+ return layout.laneY + precedingHeight + index * layout.laneGap;+}++function lastLaneBottom() {+ return layout.laneY+ + asArray(workflow.lanes).reduce((total, _lane, index) => total + laneHeight(index), 0)+ + (workflow.lanes.length - 1) * layout.laneGap;+}++function legendY() {+ return lastLaneBottom() + 44 + legendExtraHeight;+}++function workflowLegendLayout(obstacles = []) {+ return {+ x: 20,+ baselineY: legendY(),+ width: workflow.schema_version === 2 ? legendPackingWidth : viewBox[0] - 40,+ fontSize: 7,+ itemGap: 7,+ minTitleY: lastLaneBottom() + 8,+ obstacles,+ unfit: workflow.meta?.legend === undefined ? 'hide' : 'error',+ diagramType: 'workflow',+ };+}++function workflowLegendRects() {+ if (!workflowLegendEntries.length) return [];+ const measured = measureLegend(workflowLegendEntries, workflowLegendLayout());+ if (!measured) return [];+ return [+ { kind: 'title', x: 20, y: measured.titleY - 10, width: 48, height: 14 },+ ...measured.entries.map((entry) => ({+ kind: entry.kind,+ x: entry.x,+ y: entry.baseline - 10,+ width: entry.width,+ height: 14,+ })),+ ];+}++function measureNode(node) {+ const width = node.width || layout.nodeW;+ const height = node.height || (node.tag ? 68 : layout.nodeH);+ const cx = layout.colXs[node.col];+ const groupHeaderH = laneGroupHeaderH(node.lane);+ const contentH = laneHeight(node.lane) - layout.laneTitleH+ - groupHeaderH - laneGroupFooterH(node.lane);+ const y = laneTop(node.lane) + layout.laneTitleH + groupHeaderH+ + (contentH - height) / 2 + (node.yOffset || 0);+ return {+ ...node,+ width,+ height,+ x: cx - width / 2,+ y,+ cx,+ cy: y + height / 2+ };+}++// Font sizes for this renderer's node text; the fitting geometry is shared.+const nodeTextFit = {+ labelPreferred: 11,+ labelMinimum: 9,+ sublabelPreferred: 8,+ sublabelMinimum: 6,+ tagPreferred: 7,+ tagMinimum: 6,+};++const nodes = new Map(asArray(workflow.nodes).map((node) => [node.id, measureNode(node)]));++function workflowCompositionFrames() {+ const frames = [];+ for (const [index, lane] of asArray(workflow.lanes).entries()) {+ const y = laneTop(lane.id);+ const height = laneHeight(index);+ frames.push({ id: `lane-${index}`, label: lane.label, kind: 'lane', x: layout.laneX, y, width: layout.laneW, height, radius: 10 });+ if (lane.variant === 'exception') {+ frames.push({ id: `lane-${index}-exception`, label: `${lane.label} exception`, kind: 'exception-lane', x: layout.laneX + 6, y: y + 6, width: layout.laneW - 12, height: height - 12, radius: 8 });+ }+ }+ for (const [index, group] of asArray(workflow.groups).entries()) {+ const span = groupSpan(group);+ frames.push({+ id: `group-${index}`,+ label: group.label,+ kind: 'group',+ x: span.x,+ y: laneTop(group.lane) + layout.laneTitleH + GROUP_FRAME_TOP_INSET,+ width: span.width,+ height: workflow.schema_version === 2+ ? laneHeight(group.lane) - layout.laneTitleH+ - GROUP_FRAME_TOP_INSET - GROUP_FRAME_BOTTOM_INSET+ : layout.laneH - layout.laneTitleH - 16,+ radius: 9,+ });+ }+ return frames;+}++function workflowSceneLabelObstacles() {+ const obstacles = [];+ for (const [index, lane] of asArray(workflow.lanes).entries()) {+ const prefix = lane.variant === 'exception' ? 'EX' : String(index + 1).padStart(2, '0');+ const label = `${prefix} / ${lane.label}`;+ obstacles.push({+ kind: 'lane-header',+ id: lane.id,+ x: layout.laneX + 14,+ y: laneTop(lane.id) + 12,+ width: textUnits(label) * 6.2,+ height: 14,+ });+ }+ for (const phase of asArray(workflow.phases)) {+ if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)+ || phase.fromCol < 0 || phase.toCol >= layout.colXs.length || phase.fromCol > phase.toCol) continue;+ const span = phaseSpan(phase);+ obstacles.push({+ kind: 'phase-header',+ id: phase.id ?? null,+ x: span.x,+ y: 27,+ width: span.width,+ height: 16,+ });+ }+ for (const group of asArray(workflow.groups)) {+ if (!laneIndex.has(group.lane)+ || !Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)+ || group.fromCol < 0 || group.toCol >= layout.colXs.length || group.fromCol > group.toCol) continue;+ const span = groupSpan(group);+ const frameY = laneTop(group.lane) + layout.laneTitleH + GROUP_FRAME_TOP_INSET;+ const labelBaseline = frameY + GROUP_LABEL_BASELINE_OFFSET;+ obstacles.push({+ kind: 'group-label',+ id: group.id ?? null,+ x: span.x + 10,+ y: labelBaseline - GROUP_LABEL_MASK_ASCENT,+ width: textUnits(group.label) * 5.6,+ height: GROUP_LABEL_MASK_H,+ });+ }+ return obstacles;+}++const mainPathSteps = new Map(asArray(workflow.mainPath).map((id, index) => [id, index]));+const edgeSteps = new Map(asArray(workflow.edges).map((edge, index) => {+ const fromStep = mainPathSteps.get(edge.from);+ const toStep = mainPathSteps.get(edge.to);+ const mainStep = Number.isInteger(fromStep) && toStep === fromStep + 1 ? fromStep : null;+ return [edge, mainStep ?? asArray(workflow.mainPath).length + index];+}));++function nodeStep(node) {+ return mainPathSteps.get(node.id) ?? asArray(workflow.mainPath).length + asArray(workflow.nodes).findIndex((item) => item.id === node.id);+}++ function acceptsFix(mutator) {+ if (!discoverFixes) return false;+ const candidate = cloneWorkflow(workflow);+ mutator(candidate);+ return withDiagnosticRecordingSuppressed(() => compileWorkflowWithFeedback({+ workflow: candidate,+ qualityProfile: resolvedQualityProfile,+ discoverFixes: false,+ }).ok);+ }++ function verifiedLegacyAlternative(edge, from, to, requiredClearance) {+ const occupied = [...nodes.values()].filter((node) => node.lane === to.lane && node.id !== to.id);+ const candidates = layout.colXs.map((center, col) => ({ center, col }))+ .filter(({ col }) => col !== to.col)+ .sort((a, b) => Math.abs(a.col - to.col) - Math.abs(b.col - to.col) || a.col - b.col);+ for (const candidate of candidates) {+ const candidateRect = { ...to, col: candidate.col, cx: candidate.center, x: candidate.center - to.width / 2 };+ if (occupied.some((node) => rectsOverlap(candidateRect, node, 8))) continue;+ const centerDistance = Math.abs(candidate.center - from.cx);+ const signedClearance = centerDistance - from.width / 2 - to.width / 2;+ if (signedClearance < requiredClearance) continue;+ if (acceptsFix((document) => {+ document.nodes.find((node) => node.id === to.id).col = candidate.col;+ })) return candidate.col;+ }+ return null;+ }++ function readableMigrationProvidesCapacity(from, to, requiredClearance) {+ const readable = createReadableLayout({ ...workflow, schema_version: 2 });+ const centerDistance = Math.abs(readable.colXs[to.col] - readable.colXs[from.col]);+ if (centerDistance - from.width / 2 - to.width / 2 < requiredClearance) return false;+ if (!discoverFixes) return false;++ return withDiagnosticRecordingSuppressed(() => {+ const migrationQualityProfile = authoredQualityProfile;+ let planned = compileWorkflowWithFeedback({+ workflow: intrinsicWorkflow(workflow),+ qualityProfile: migrationQualityProfile,+ discoverFixes: false,+ });+ if (!planned.ok) {+ planned = compileWorkflowWithFeedback({+ workflow: planningWorkflow(workflow),+ qualityProfile: migrationQualityProfile,+ discoverFixes: false,+ });+ }+ if (!planned.ok || !Array.isArray(planned.receipt?.columns)) return false;++ let candidate;+ try {+ candidate = createMappedWorkflowCandidate(+ workflow,+ LEGACY_COLUMN_CENTERS,+ planned.receipt.columns,+ ).document;+ } catch {+ return false;+ }+ let compiled = compileWorkflowWithFeedback({+ workflow: candidate,+ qualityProfile: migrationQualityProfile,+ discoverFixes: false,+ });+ const requiredViewBox = compiled.diagnostics?.length+ && compiled.diagnostics.every(({ code }) => code === 'workflow/viewbox-capacity')+ ? compiled.diagnostics.find(({ evidence }) => Array.isArray(evidence?.requiredViewBox))+ ?.evidence.requiredViewBox+ : null;+ if (!compiled.ok && Array.isArray(candidate.meta?.viewBox) && requiredViewBox) {+ candidate.meta.viewBox = [+ Math.max(candidate.meta.viewBox[0], requiredViewBox[0]),+ Math.max(candidate.meta.viewBox[1], requiredViewBox[1]),+ ];+ compiled = compileWorkflowWithFeedback({+ workflow: candidate,+ qualityProfile: migrationQualityProfile,+ discoverFixes: false,+ });+ }+ return compiled.ok;+ });+ }++function verifiedReducedWidths(from, to, requiredClearance) {+ const widthBudget = 2 * (Math.abs(to.cx - from.cx) - requiredClearance);+ if (widthBudget < 64) return null;+ const widths = [from.width, to.width];+ let excess = widths[0] + widths[1] - widthBudget;+ for (const index of widths[0] >= widths[1] ? [0, 1] : [1, 0]) {+ const reduction = Math.min(excess, widths[index] - 32);+ widths[index] -= reduction;+ excess -= reduction;+ }+ if (excess > 0.0001) return null;+ const candidates = [from, to];+ const labelsFit = candidates.every((node, index) => (+ textUnits(node.label) * 6.8 <= widths[index] + 6+ && (!node.sublabel || minimumNodeTextWidth(node.sublabel, nodeTextFit.sublabelMinimum) <= availableNodeTextWidth(widths[index]))+ && (!node.tag || minimumNodeTextWidth(node.tag, nodeTextFit.tagMinimum) <= availableNodeTextWidth(widths[index]))+ ));+ if (!labelsFit) return null;+ const serializedWidths = widths.map((width) => Math.floor((width + 1e-9) * 100) / 100);+ const signedClearance = Math.abs(to.cx - from.cx)+ - serializedWidths[0] / 2 - serializedWidths[1] / 2;+ if (signedClearance + 0.0001 < requiredClearance) return null;+ const accepted = acceptsFix((document) => {+ document.nodes.find((node) => node.id === from.id).width = serializedWidths[0];+ document.nodes.find((node) => node.id === to.id).width = serializedWidths[1];+ });+ return accepted ? serializedWidths : null;+}++function enforceLegacyColumnCapacity() {+ if (workflow.schema_version !== 1) return;+ for (const edge of workflow.edges) {+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ if (!from || !to || from.lane !== to.lane || from.col === to.col) continue;+ if (!verticalIntervalsOverlap(from, to, 8)) continue;+ const centerDistance = Math.abs(to.cx - from.cx);+ const actualSignedClearance = centerDistance - from.width / 2 - to.width / 2;+ const direct = !edge.via && ['auto', 'straight'].includes(edge.route || 'auto')+ && Math.abs(from.cy - to.cy) < 0.0001;+ const requiredDirectClearance = direct ? 28 : 8;+ if (actualSignedClearance >= requiredDirectClearance) continue;+ const alternative = verifiedLegacyAlternative(edge, from, to, requiredDirectClearance);+ const reducedWidths = verifiedReducedWidths(from, to, requiredDirectClearance);+ const capacity = actualSignedClearance < 0+ ? `overlap by ${Math.abs(Math.round(actualSignedClearance))}px`+ : `leave only ${Math.round(actualSignedClearance)}px of direct clearance`;+ const message = `Workflow columns ${from.col}→${to.col} place nodes "${from.id}" and "${to.id}" so they ${capacity} under the fixed-v1 layout.`;+ const supportedFixes = [];+ if (readableMigrationProvidesCapacity(from, to, requiredDirectClearance)) {+ supportedFixes.push('migrate this workflow to schema_version 2');+ }+ if (alternative !== null) supportedFixes.push(`move node "${to.id}" to verified free column ${alternative}`);+ if (reducedWidths) {+ supportedFixes.push(`set node widths "${from.id}"=${Math.round(reducedWidths[0] * 100) / 100}px and "${to.id}"=${Math.round(reducedWidths[1] * 100) / 100}px`);+ }+ throwDiagnosticError(message, [{+ code: 'workflow/column-capacity',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ fromCol: from.col,+ toCol: to.col,+ },+ evidence: {+ centerDistancePx: centerDistance,+ nodeWidthsPx: [from.width, to.width],+ actualSignedClearancePx: actualSignedClearance,+ requiredDirectClearancePx: requiredDirectClearance,+ },+ supportedFixes,+ suppresses: [+ 'workflow/short-edge',+ 'clean-flow/endpoint-side-direction',+ 'workflow/label-node-overlap',+ ],+ }]);+ }+}++function verifiedEdgeFix(edge, message, mutator) {+ const edgeIndex = workflow.edges.indexOf(edge);+ if (edgeIndex < 0) return null;+ const accepted = acceptsFix((document) => mutator(document.edges[edgeIndex], document));+ return accepted ? message : null;+}++function verifiedAutomaticRouteFix(edge, { clearSides = false } = {}) {+ const edgeName = workflowEdgeName(edge);+ return verifiedEdgeFix(+ edge,+ clearSides+ ? `remove explicit route geometry and endpoint sides from edge "${edgeName}" so readable-v2 can use its verified automatic candidate`+ : `remove explicit route geometry from edge "${edgeName}" so readable-v2 can use its verified automatic candidate`,+ (candidate) => {+ delete candidate.via;+ delete candidate.channelX;+ delete candidate.channelY;+ delete candidate.route;+ if (clearSides) {+ delete candidate.fromSide;+ delete candidate.toSide;+ }+ },+ );+}++function authoredPinEvidence(edge, field) {+ const authoredEdgeIndex = sourceIndexes.edges.get(edge);+ const value = Array.isArray(edge[field])+ ? edge[field].map((item) => (Array.isArray(item) ? [...item] : item))+ : edge[field];+ return {+ edge: workflowEdgeName(edge),+ field,+ ...(Number.isInteger(authoredEdgeIndex) ? { path: `/edges/${authoredEdgeIndex}/${field}` } : {}),+ value,+ };+}++function combinations(values, size, start = 0, prefix = [], output = []) {+ if (prefix.length === size) {+ output.push([...prefix]);+ return output;+ }+ for (let index = start; index <= values.length - (size - prefix.length); index += 1) {+ prefix.push(values[index]);+ combinations(values, size, index + 1, prefix, output);+ prefix.pop();+ }+ return output;+}++function verifiedPinRemovalAlternatives(edge, fields, reason) {+ if (!discoverFixes) return { removalSets: [], supportedFixes: [] };+ const edgeIndex = workflow.edges.indexOf(edge);+ if (edgeIndex < 0) return { removalSets: [], supportedFixes: [] };+ const uniqueFields = [...new Set(fields.filter((field) => edge[field] !== undefined))];+ for (let size = 1; size <= uniqueFields.length; size += 1) {+ const removalSets = combinations(uniqueFields, size).filter((fieldSet) => (+ acceptsFix((document) => {+ for (const field of fieldSet) delete document.edges[edgeIndex][field];+ })+ ));+ if (!removalSets.length) continue;+ const edgeName = workflowEdgeName(edge);+ return {+ removalSets,+ supportedFixes: removalSets.map((fieldSet) => (+ `remove ${fieldSet.join(' and ')} from edge "${edgeName}" ${reason}`+ )),+ };+ }+ return { removalSets: [], supportedFixes: [] };+}++function conflictPinsFromRemovalSets(edge, removalSets, fallbackFields = []) {+ const fields = removalSets.length+ ? [...new Set(removalSets.flat())]+ : [...new Set(fallbackFields)];+ return fields.map((field) => authoredPinEvidence(edge, field));+}++function authoredRouteAssertionFields(edge) {+ return [+ ...(Array.isArray(edge?.via) ? ['via'] : []),+ ...(edge?.channelX !== undefined ? ['channelX'] : []),+ ...(edge?.channelY !== undefined ? ['channelY'] : []),+ ...(edge?.route && edge.route !== 'auto' ? ['route'] : []),+ ...(edge?.fromSide && edge.fromSide !== 'auto' ? ['fromSide'] : []),+ ...(edge?.toSide && edge.toSide !== 'auto' ? ['toSide'] : []),+ ];+}++function hasAuthoredRouteAssertions(edge) {+ return authoredRouteAssertionFields(edge).length > 0;+}++function verifiedPinReferenceAlternatives(candidateRefs, reason) {+ const seenRefs = new Set();+ const refs = candidateRefs.filter(({ edge, edgeIndex, field }) => {+ if (edgeIndex < 0 || edge?.[field] === undefined) return false;+ const key = `${edgeIndex}:${field}`;+ if (seenRefs.has(key)) return false;+ seenRefs.add(key);+ return true;+ });+ const fallbackPins = refs.map(({ edge, field }) => authoredPinEvidence(edge, field));+ if (!discoverFixes) {+ return {+ removalSets: [], conflictingRefs: refs, conflictingPins: fallbackPins, repairs: [], supportedFixes: [],+ };+ }++ for (let size = 1; size <= refs.length; size += 1) {+ const removalSets = combinations(refs, size).filter((removalSet) => (+ acceptsFix((document) => {+ for (const { edgeIndex, field } of removalSet) delete document.edges[edgeIndex][field];+ })+ ));+ if (!removalSets.length) continue;+ const conflictingRefs = [];+ const conflictingPins = [];+ const seenPins = new Set();+ for (const removalSet of removalSets) {+ for (const { edge, field } of removalSet) {+ const key = `${workflow.edges.indexOf(edge)}:${field}`;+ if (seenPins.has(key)) continue;+ seenPins.add(key);+ conflictingRefs.push({ edge, edgeIndex: workflow.edges.indexOf(edge), field });+ conflictingPins.push(authoredPinEvidence(edge, field));+ }+ }+ const repairs = removalSets.map((removalSet) => {+ const grouped = [];+ for (const ref of removalSet) {+ let group = grouped.find(({ edge }) => edge === ref.edge);+ if (!group) {+ group = { edge: ref.edge, fields: [] };+ grouped.push(group);+ }+ group.fields.push(ref.field);+ }+ const removals = grouped.map(({ edge, fields }) => (+ `remove ${fields.join(' and ')} from edge "${workflowEdgeName(edge)}"`+ ));+ return { removalSet, message: `${removals.join(' and ')} ${reason}` };+ });+ return {+ removalSets,+ conflictingRefs,+ conflictingPins,+ repairs,+ supportedFixes: repairs.map(({ message }) => message),+ };+ }+ return {+ removalSets: [], conflictingRefs: refs, conflictingPins: fallbackPins, repairs: [], supportedFixes: [],+ };+}++function verifiedRoutePairPinAlternatives(leftEdge, rightEdge, reason) {+ const refs = [leftEdge, rightEdge].flatMap((edge) => {+ const edgeIndex = workflow.edges.indexOf(edge);+ return authoredRouteAssertionFields(edge).map((field) => ({ edge, edgeIndex, field }));+ });+ return verifiedPinReferenceAlternatives(refs, reason);+}++function verifiedLabelRoutePinAlternatives(labelEdge, routeEdge) {+ const refs = [];+ const labelEdgeIndex = workflow.edges.indexOf(labelEdge);+ if (Array.isArray(labelEdge?.labelAt)) {+ refs.push({ edge: labelEdge, edgeIndex: labelEdgeIndex, field: 'labelAt' });+ }+ const routeEdgeIndex = workflow.edges.indexOf(routeEdge);+ for (const field of authoredRouteAssertionFields(routeEdge)) {+ refs.push({ edge: routeEdge, edgeIndex: routeEdgeIndex, field });+ }+ return verifiedPinReferenceAlternatives(+ refs,+ Array.isArray(labelEdge?.labelAt)+ ? 'so readable-v2 can replan the remaining authored label-route pins'+ : 'so readable-v2 can replan the remaining authored route assertions',+ );+}++function verifiedLabelPairPinAlternatives(leftEdge, rightEdge) {+ return verifiedPinReferenceAlternatives(+ [leftEdge, rightEdge].flatMap((edge) => (+ Array.isArray(edge?.labelAt)+ ? [{ edge, edgeIndex: workflow.edges.indexOf(edge), field: 'labelAt' }]+ : []+ )),+ 'so readable-v2 can replan the remaining authored label pins',+ );+}++function verifiedRepairsWithLabelNudges(alternatives) {+ return alternatives.repairs.flatMap(({ removalSet, message }) => {+ if (removalSet.length !== 1 || removalSet[0].field !== 'labelAt') return [message];+ const nudges = verifiedLabelAtAlternatives(removalSet[0].edge);+ return nudges.length ? nudges : [message];+ });+}++function throwExplicitPinConflict(edge, invariant, evidence, supportedFixes = []) {+ const message = `Workflow edge "${workflowEdgeName(edge)}" has explicit geometry that violates ${invariant}.`;+ const [onlyPin] = asArray(evidence?.conflictingPins);+ const authoredEdgeIndex = sourceIndexes.edges.get(edge);+ const pinPath = asArray(evidence?.conflictingPins).length === 1+ && Number.isInteger(authoredEdgeIndex)+ && onlyPin?.field+ ? onlyPin.path || `/edges/${authoredEdgeIndex}/${onlyPin.field}`+ : null;+ throwDiagnosticError(message, [{+ code: 'workflow/explicit-pin-conflict',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ ...(pinPath ? { path: pinPath } : {}),+ },+ evidence: { invariant, ...evidence },+ supportedFixes: supportedFixes.filter(Boolean),+ }]);+}++function hasAbsoluteRoutePins(edge) {+ return Array.isArray(edge?.via)+ || edge?.channelX !== undefined+ || edge?.channelY !== undefined;+}++function presentRouteGeometryFields(edge) {+ return [+ ...(Array.isArray(edge?.via) ? ['via'] : []),+ ...(edge?.channelX !== undefined ? ['channelX'] : []),+ ...(edge?.channelY !== undefined ? ['channelY'] : []),+ ];+}++function verifiedRouteGeometryPinAlternatives(+ edge,+ reason = 'so readable-v2 can replan the remaining explicit route assertions',+) {+ const edgeIndex = workflow.edges.indexOf(edge);+ return verifiedPinReferenceAlternatives(+ authoredRouteAssertionFields(edge).map((field) => ({ edge, edgeIndex, field })),+ reason,+ );+}++function properOrthogonalIntersection(leftStart, leftEnd, rightStart, rightEnd) {+ const leftOrientation = segmentOrientation(leftStart, leftEnd);+ const rightOrientation = segmentOrientation(rightStart, rightEnd);+ if (leftOrientation === rightOrientation+ || leftOrientation === 'diagonal'+ || rightOrientation === 'diagonal') return null;+ const horizontalStart = leftOrientation === 'horizontal' ? leftStart : rightStart;+ const horizontalEnd = leftOrientation === 'horizontal' ? leftEnd : rightEnd;+ const verticalStart = leftOrientation === 'vertical' ? leftStart : rightStart;+ const verticalEnd = leftOrientation === 'vertical' ? leftEnd : rightEnd;+ const point = [verticalStart[0], horizontalStart[1]];+ const epsilon = 0.0001;+ const insideHorizontal = point[0] > Math.min(horizontalStart[0], horizontalEnd[0]) + epsilon+ && point[0] < Math.max(horizontalStart[0], horizontalEnd[0]) - epsilon;+ const insideVertical = point[1] > Math.min(verticalStart[1], verticalEnd[1]) + epsilon+ && point[1] < Math.max(verticalStart[1], verticalEnd[1]) - epsilon;+ return insideHorizontal && insideVertical ? point : null;+}++function verifiedLabelAtAlternatives(edge) {+ if (!Array.isArray(edge.labelAt)) return [];+ const [x, y] = edge.labelAt;+ return [+ [0, 24], [0, -24], [24, 0], [-24, 0],+ [0, 48], [0, -48], [48, 0], [-48, 0],+ ].map(([dx, dy]) => {+ const next = [x + dx, y + dy];+ return verifiedEdgeFix(+ edge,+ `set labelAt on edge "${workflowEdgeName(edge)}" to [${next[0]}, ${next[1]}]`,+ (candidate) => { candidate.labelAt = next; },+ );+ }).filter(Boolean);+}++function verifiedLabelAtNudge(edge) {+ const [alternative] = verifiedLabelAtAlternatives(edge);+ if (alternative) return alternative;+ return verifiedEdgeFix(+ edge,+ `remove labelAt from edge "${workflowEdgeName(edge)}" so readable-v2 can use verified automatic label placement`,+ (candidate) => { delete candidate.labelAt; },+ );+}++function throwReadableLabelRoutePinConflict(hit, routePoints = null) {+ const labelEdge = hit.labelRelation;+ const routeEdge = hit.otherRelation;+ const labelPinned = Array.isArray(labelEdge?.labelAt);+ const routePinned = hasAuthoredRouteAssertions(routeEdge);+ if (!labelPinned && !routePinned) return false;+ const alternatives = verifiedLabelRoutePinAlternatives(labelEdge, routeEdge);+ const actualRoutePoints = routePoints+ || pathCache.get(routeEdge)?.points+ || pathFor(routeEdge).points;+ const diagnosticEdge = alternatives.conflictingRefs[0]?.edge+ || (labelPinned ? labelEdge : routeEdge);+ throwExplicitPinConflict(diagnosticEdge, 'explicit label-route clearance', {+ conflictingPins: alternatives.conflictingPins,+ ...(labelPinned ? { labelAt: [...labelEdge.labelAt] } : {}),+ labelRect: {+ x: hit.rect.x,+ y: hit.rect.y,+ width: hit.rect.width,+ height: hit.rect.height,+ },+ collidedRoute: {+ edge: routeEdge.id || `${routeEdge.from}->${routeEdge.to}`,+ from: routeEdge.from,+ to: routeEdge.to,+ points: actualRoutePoints.map((point) => [...point]),+ },+ routeSegmentIndex: hit.segmentIndex,+ routeSegment: { from: [...hit.start], to: [...hit.end] },+ clearancePx: Math.round(hit.clearance * 10) / 10,+ minimumPx: hit.threshold,+ }, [+ ...verifiedRepairsWithLabelNudges(alternatives),+ ]);+ return true;+}++function throwReadableLabelLabelPinConflict(left, right) {+ const leftEdge = left.relation;+ const rightEdge = right.relation;+ const pinnedEdges = [leftEdge, rightEdge].filter((edge) => Array.isArray(edge?.labelAt));+ if (!pinnedEdges.length) return false;+ const alternatives = verifiedLabelPairPinAlternatives(leftEdge, rightEdge);+ const causalLabelEdges = [...new Set(alternatives.conflictingRefs.map(({ edge }) => edge))];+ const diagnosticEdge = causalLabelEdges[0] || pinnedEdges[0];+ throwExplicitPinConflict(diagnosticEdge, 'explicit label-label clearance', {+ conflictingPins: alternatives.conflictingPins,+ labelRects: [left, right].map((rect) => ({+ edge: rect.relation.id ?? null,+ x: rect.x,+ y: rect.y,+ width: rect.width,+ height: rect.height,+ })),+ minimumGapPx: -2,+ }, verifiedRepairsWithLabelNudges(alternatives));+ return true;+}++function classifyFailedAutomaticCandidatePins(edge, rawCandidates) {+ const relationIndex = workflow.edges.indexOf(edge);+ const priorRoutes = [...pathCache.entries()]+ .filter(([otherEdge]) => otherEdge !== edge)+ .map(([relation, routed]) => ({+ relation,+ relationIndex: workflow.edges.indexOf(relation),+ points: routed.points,+ }));+ if (!priorRoutes.length) return;+ const priorLabels = priorRoutes.map(({ relation, relationIndex }) => (+ labelRectFor(relation, relationIndex)+ )).filter(Boolean);++ for (const { points } of rawCandidates) {+ const candidateRect = candidateLabelRect(edge, points);+ const candidateLabel = candidateRect+ ? { ...candidateRect, relation: edge, relationIndex, label: edge.label }+ : null;+ if (candidateLabel) {+ const priorLabel = priorLabels.find((otherLabel) => (+ rectsOverlap(candidateLabel, otherLabel, -2)+ && (Array.isArray(edge.labelAt) || Array.isArray(otherLabel.relation?.labelAt))+ ));+ if (priorLabel) throwReadableLabelLabelPinConflict(candidateLabel, priorLabel);++ const labelRouteHit = collectLabelRouteClearance({+ labels: [candidateLabel],+ routedRelations: priorRoutes,+ threshold: 4,+ }).find((hit) => (+ Array.isArray(edge.labelAt) || hasAbsoluteRoutePins(hit.otherRelation)+ ));+ if (labelRouteHit) {+ const collidedRoute = priorRoutes.find(({ relation }) => relation === labelRouteHit.otherRelation);+ throwReadableLabelRoutePinConflict(labelRouteHit, collidedRoute?.points);+ }+ }++ const reverseHit = collectLabelRouteClearance({+ labels: priorLabels,+ routedRelations: [{ relation: edge, relationIndex, points }],+ threshold: 4,+ }).find((hit) => Array.isArray(hit.labelRelation?.labelAt));+ if (reverseHit) throwReadableLabelRoutePinConflict(reverseHit, points);+ }+}++function validateReadablePairwisePinConflicts() {+ const labels = workflow.edges.map((edge, relationIndex) => (+ labelRectFor(edge, relationIndex)+ )).filter(Boolean);+ const routedRelations = workflow.edges.map((edge, relationIndex) => (+ nodes.has(edge.from) && nodes.has(edge.to)+ ? { relation: edge, relationIndex, points: pathFor(edge).points }+ : null+ )).filter(Boolean);++ const labelRouteHit = collectLabelRouteClearance({+ labels,+ routedRelations,+ threshold: 4,+ }).find((hit) => (+ Array.isArray(hit.labelRelation?.labelAt) || hasAuthoredRouteAssertions(hit.otherRelation)+ ));+ if (labelRouteHit) throwReadableLabelRoutePinConflict(labelRouteHit);++ for (let leftIndex = 0; leftIndex < labels.length; leftIndex += 1) {+ for (let rightIndex = leftIndex + 1; rightIndex < labels.length; rightIndex += 1) {+ const left = labels[leftIndex];+ const right = labels[rightIndex];+ if (!rectsOverlap(left, right, -2)) continue;+ throwReadableLabelLabelPinConflict(left, right);+ }+ }++ const requestedProfile = workflow.meta?.quality_profile;+ if (requestedProfile !== 'showcase') return;+ for (let leftIndex = 0; leftIndex < routedRelations.length; leftIndex += 1) {+ const left = routedRelations[leftIndex];+ for (let rightIndex = leftIndex + 1; rightIndex < routedRelations.length; rightIndex += 1) {+ const right = routedRelations[rightIndex];+ const leftPinned = hasAuthoredRouteAssertions(left.relation);+ const rightPinned = hasAuthoredRouteAssertions(right.relation);+ if (!leftPinned && !rightPinned) continue;+ if ([left.relation.from, left.relation.to].some((id) => (+ id === right.relation.from || id === right.relation.to+ ))) continue;+ const leftAnalysis = forwardCollinearAnalysisSegments(left.points);+ const rightAnalysis = forwardCollinearAnalysisSegments(right.points);+ for (const leftSegment of leftAnalysis) {+ for (const rightSegment of rightAnalysis) {+ const point = properOrthogonalIntersection(+ leftSegment.start,+ leftSegment.end,+ rightSegment.start,+ rightSegment.end,+ );+ if (!point) continue;+ const leftSourceIndex = sourceSegmentIndexAtPoint(leftSegment, point);+ const rightSourceIndex = sourceSegmentIndexAtPoint(rightSegment, point);+ const leftSource = {+ from: left.points[leftSourceIndex],+ to: left.points[leftSourceIndex + 1],+ };+ const rightSource = {+ from: right.points[rightSourceIndex],+ to: right.points[rightSourceIndex + 1],+ };+ const alternatives = verifiedRoutePairPinAlternatives(+ left.relation,+ right.relation,+ 'so readable-v2 can replan the remaining authored route assertions',+ );+ const diagnosticEdge = leftPinned ? left.relation : right.relation;+ throwExplicitPinConflict(diagnosticEdge, 'explicit route-route crossing', {+ conflictingPins: alternatives.conflictingPins,+ point,+ segmentIndex: leftSourceIndex,+ otherSegmentIndex: rightSourceIndex,+ routeSegments: [+ { edge: left.relation.id ?? null, from: [...leftSegment.start], to: [...leftSegment.end] },+ { edge: right.relation.id ?? null, from: [...rightSegment.start], to: [...rightSegment.end] },+ ],+ sourceRouteSegments: [+ { edge: left.relation.id ?? null, from: [...leftSource.from], to: [...leftSource.to] },+ { edge: right.relation.id ?? null, from: [...rightSource.from], to: [...rightSource.to] },+ ],+ }, alternatives.supportedFixes);+ }+ }+ }+ }++ const corridorHit = collectAmbiguousCorridors({+ routedRelations,+ minOverlapPx: 8,+ }).find((hit) => (+ hasAuthoredRouteAssertions(hit.left.relation)+ || hasAuthoredRouteAssertions(hit.right.relation)+ ));+ if (corridorHit) {+ const leftSegment = {+ from: corridorHit.left.points[corridorHit.leftSegment],+ to: corridorHit.left.points[corridorHit.leftSegment + 1],+ };+ const rightSegment = {+ from: corridorHit.right.points[corridorHit.rightSegment],+ to: corridorHit.right.points[corridorHit.rightSegment + 1],+ };+ const leftPinned = hasAuthoredRouteAssertions(corridorHit.left.relation);+ const alternatives = verifiedRoutePairPinAlternatives(+ corridorHit.left.relation,+ corridorHit.right.relation,+ 'so readable-v2 can replan the remaining authored route assertions',+ );+ const diagnosticEdge = leftPinned ? corridorHit.left.relation : corridorHit.right.relation;+ throwExplicitPinConflict(diagnosticEdge, 'explicit route-route corridor clearance', {+ conflictingPins: alternatives.conflictingPins,+ segmentIndex: corridorHit.leftSegment,+ otherSegmentIndex: corridorHit.rightSegment,+ routeSegments: [+ {+ edge: corridorHit.left.relation.id ?? null,+ from: [...leftSegment.from],+ to: [...leftSegment.to],+ },+ {+ edge: corridorHit.right.relation.id ?? null,+ from: [...rightSegment.from],+ to: [...rightSegment.to],+ },+ ],+ overlapStart: [...corridorHit.overlapStart],+ overlapEnd: [...corridorHit.overlapEnd],+ overlapLengthPx: corridorHit.overlapLength,+ minimumClearancePx: 8,+ }, alternatives.supportedFixes);+ }+}++const READABLE_PRESET_PIN_FIELDS = Object.freeze({+ straight: [],+ drop: ['channelY'],+ 'outside-right': ['channelX'],+ 'return-left': ['channelX'],+ 'bottom-channel': ['channelY'],+ 'up-channel': ['channelY'],+});++function presentChannelPins(edge) {+ return ['channelX', 'channelY'].filter((field) => edge[field] !== undefined);+}++function validateReadableRouteControls(edge) {+ const channelPins = presentChannelPins(edge);+ const preset = edge.route || 'auto';+ if (preset === 'auto') return;+ const allowedPins = new Set(READABLE_PRESET_PIN_FIELDS[preset] || []);+ const conflictingPins = channelPins.filter((field) => !allowedPins.has(field));+ if (!conflictingPins.length) return;+ const edgeIndex = workflow.edges.indexOf(edge);+ const alternatives = verifiedPinReferenceAlternatives([+ { edge, edgeIndex, field: 'route' },+ ...conflictingPins.map((field) => ({ edge, edgeIndex, field })),+ ], 'and keep the remaining verified route assertions');+ throwExplicitPinConflict(edge, 'route preset compatibility', {+ route: preset,+ allowedPins: [...allowedPins],+ conflictingPins: alternatives.conflictingPins,+ }, alternatives.supportedFixes);+}++function segmentOrientation(start, end) {+ if (Math.abs(start[0] - end[0]) <= 0.0001) return 'vertical';+ if (Math.abs(start[1] - end[1]) <= 0.0001) return 'horizontal';+ return 'diagonal';+}++function routeSegments(points) {+ return points.slice(0, -1).map((start, index) => ({+ start,+ end: points[index + 1],+ orientation: segmentOrientation(start, points[index + 1]),+ }));+}++function endpointSideIsHonored(points, side, endpoint) {+ if (!side || side === 'auto' || points.length < 2) return true;+ const source = endpoint === 'source';+ const from = source ? points[0] : points.at(-2);+ const to = source ? points[1] : points.at(-1);+ const dx = to[0] - from[0];+ const dy = to[1] - from[1];+ if (source) {+ if (side === 'right') return dx > 0 && Math.abs(dy) <= 0.0001;+ if (side === 'left') return dx < 0 && Math.abs(dy) <= 0.0001;+ if (side === 'bottom') return dy > 0 && Math.abs(dx) <= 0.0001;+ if (side === 'top') return dy < 0 && Math.abs(dx) <= 0.0001;+ return false;+ }+ if (side === 'right') return dx < 0 && Math.abs(dy) <= 0.0001;+ if (side === 'left') return dx > 0 && Math.abs(dy) <= 0.0001;+ if (side === 'bottom') return dy < 0 && Math.abs(dx) <= 0.0001;+ if (side === 'top') return dy > 0 && Math.abs(dx) <= 0.0001;+ return false;+}++function corridorTopologyMatches(points, axis, coordinate) {+ const collapsed = normalizeRoutePoints(points.map((point) => [...point]));+ const start = collapsed[0];+ const end = collapsed.at(-1);+ const via = axis === 'x'+ ? [[coordinate, start[1]], [coordinate, end[1]]]+ : [[start[0], coordinate], [end[0], coordinate]];+ const expected = normalizeRoutePoints([start, ...via, end]);+ const actualPattern = routeSegments(collapsed).map(({ orientation }) => orientation);+ const expectedPattern = routeSegments(expected).map(({ orientation }) => orientation);+ return actualPattern.length === expectedPattern.length+ && actualPattern.every((orientation, index) => orientation === expectedPattern[index])+ && routeContainsChannelPin(+ collapsed,+ axis === 'x' ? 'channelX' : 'channelY',+ coordinate,+ );+}++function routeMatchesPresetFamily(preset, points, from, to) {+ const collapsed = normalizeRoutePoints(points.map((point) => [...point]));+ const segments = routeSegments(collapsed);+ if (preset === 'straight') return collapsed.length === 2;+ if (preset === 'drop') {+ if (from.lane === to.lane) return false;+ if (collapsed.length === 2 && segments[0]?.orientation === 'vertical') return true;+ const upper = from.cy <= to.cy ? from : to;+ const lower = upper === from ? to : from;+ return segments.some(({ start, orientation }) => (+ orientation === 'horizontal'+ && start[1] >= upper.y + upper.height - 0.0001+ && start[1] <= lower.y + 0.0001+ && corridorTopologyMatches(points, 'y', start[1])+ ));+ }+ if (preset === 'outside-right' || preset === 'return-left') {+ const boundary = preset === 'outside-right'+ ? Math.max(from.x + from.width, to.x + to.width)+ : Math.min(from.x, to.x);+ return segments.some(({ start, orientation }) => (+ orientation === 'vertical'+ && (preset === 'outside-right'+ ? start[0] > boundary + 0.0001+ : start[0] < boundary - 0.0001)+ && corridorTopologyMatches(points, 'x', start[0])+ ));+ }+ if (preset === 'bottom-channel' || preset === 'up-channel') {+ const boundary = preset === 'bottom-channel'+ ? Math.max(from.y + from.height, to.y + to.height)+ : Math.min(from.y, to.y);+ return segments.some(({ start, orientation }) => (+ orientation === 'horizontal'+ && (preset === 'bottom-channel'+ ? start[1] > boundary + 0.0001+ : start[1] < boundary - 0.0001)+ && corridorTopologyMatches(points, 'y', start[1])+ ));+ }+ return false;+}++function routeContainsChannelPin(points, field, value) {+ return points.slice(0, -1).some((start, index) => {+ const end = points[index + 1];+ if (field === 'channelX') {+ return start[0] === value+ && end[0] === value+ && Math.abs(end[1] - start[1]) > 0.0001;+ }+ return start[1] === value+ && end[1] === value+ && Math.abs(end[0] - start[0]) > 0.0001;+ });+}++function validateReadablePinnedGeometry() {+ if (workflow.schema_version !== 2) return;+ for (const edge of workflow.edges) {+ if (!nodes.has(edge.from) || !nodes.has(edge.to)) continue;+ validateReadableRouteControls(edge);+ const edgeName = workflowEdgeName(edge);+ const edgeIndex = sourceIndexes.edges.get(edge);+ if (Array.isArray(edge.labelAt)) {+ const rect = labelRectFor(edge, workflow.edges.indexOf(edge));+ if (rect && (rect.x < 0 || rect.y < 0)) {+ throwExplicitPinConflict(edge, 'viewBox-origin containment', {+ conflictingPins: [{+ edge: edgeName,+ field: 'labelAt',+ path: `/edges/${edgeIndex}/labelAt`,+ value: [...edge.labelAt],+ }],+ offendingRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },+ minimumCoordinate: 0,+ }, [verifiedLabelAtNudge(edge)]);+ }+ }+ const negativeViaIndex = asArray(edge.via).findIndex(([x, y]) => x < 0 || y < 0);+ const negativeRoutePin = negativeViaIndex >= 0+ ? {+ field: 'via',+ path: `/edges/${edgeIndex}/via/${negativeViaIndex}`,+ value: [...edge.via[negativeViaIndex]],+ }+ : edge.channelX < 0+ ? { field: 'channelX', path: `/edges/${edgeIndex}/channelX`, value: edge.channelX }+ : edge.channelY < 0+ ? { field: 'channelY', path: `/edges/${edgeIndex}/channelY`, value: edge.channelY }+ : null;+ if (negativeRoutePin) {+ throwExplicitPinConflict(edge, 'viewBox-origin containment', {+ conflictingPins: [{ edge: edgeName, ...negativeRoutePin }],+ minimumCoordinate: 0,+ }, [+ verifiedAutomaticRouteFix(edge),+ verifiedAutomaticRouteFix(edge, { clearSides: true }),+ ]);+ }+ const hasPinnedRoute = Array.isArray(edge.via)+ || edge.channelX !== undefined+ || edge.channelY !== undefined;+ const points = pathFor(edge).points;+ if (hasPinnedRoute) {+ const invalidPointIndex = points.findIndex((point) => (+ !Array.isArray(point) || point.length !== 2 || !isFinitePoint(...point)+ ));+ if (invalidPointIndex !== -1) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'finite route coordinates', {+ conflictingPins: alternatives.conflictingPins,+ pointIndex: invalidPointIndex,+ point: points[invalidPointIndex],+ }, alternatives.supportedFixes);+ }+ for (let segmentIndex = 0; segmentIndex < points.length - 1; segmentIndex += 1) {+ const start = points[segmentIndex];+ const end = points[segmentIndex + 1];+ const dx = Math.abs(end[0] - start[0]);+ const dy = Math.abs(end[1] - start[1]);+ if (dx <= 0.0001 && dy <= 0.0001) {+ const duplicateFix = Array.isArray(edge.via) && edge.via.length+ ? verifiedEdgeFix(+ edge,+ `remove duplicate via[${Math.min(segmentIndex, edge.via.length - 1)}] and keep the remaining authored pins unchanged`,+ (candidate) => candidate.via.splice(Math.min(segmentIndex, candidate.via.length - 1), 1),+ )+ : verifiedAutomaticRouteFix(edge);+ const alternatives = Array.isArray(edge.via)+ ? null+ : verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'non-zero route segments', {+ conflictingPins: alternatives?.conflictingPins+ || [authoredPinEvidence(edge, 'via')],+ segmentIndex,+ from: start,+ to: end,+ }, alternatives?.supportedFixes || [duplicateFix]);+ }+ if (dx > 0.0001 && dy > 0.0001) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'orthogonal route segments', {+ conflictingPins: alternatives.conflictingPins,+ segmentIndex,+ from: start,+ to: end,+ }, alternatives.supportedFixes);+ }+ const endpoint = segmentIndex === 0 || segmentIndex === points.length - 2;+ const minimumPx = points.length === 2 ? 28 : endpoint ? 8 : 16;+ const lengthPx = dx + dy;+ if (lengthPx + 0.0001 < minimumPx) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, endpoint ? '8px endpoint stub clearance' : '16px interior turn clearance', {+ conflictingPins: alternatives.conflictingPins,+ segmentIndex,+ position: segmentIndex === 0 ? 'source-stub' : segmentIndex === points.length - 2 ? 'target-stub' : 'interior',+ from: start,+ to: end,+ lengthPx,+ minimumPx,+ }, alternatives.supportedFixes);+ }+ }+ const { fromSide, toSide } = edgeSides(edge);+ if (Array.isArray(edge.via)) {+ const missingChannelPins = presentChannelPins(edge).filter((field) => (+ !routeContainsChannelPin(points, field, edge[field])+ ));+ if (missingChannelPins.length) {+ const candidateFields = ['via', ...missingChannelPins];+ const alternatives = verifiedPinRemovalAlternatives(+ edge,+ candidateFields,+ 'and replan the remaining explicit route assertions',+ );+ throwExplicitPinConflict(edge, 'channel pin preservation', {+ route: edge.route || 'auto',+ conflictingPins: conflictPinsFromRemovalSets(+ edge,+ alternatives.removalSets,+ candidateFields,+ ),+ points: points.map((point) => [...point]),+ }, alternatives.supportedFixes);+ }+ }+ if (edge.route+ && edge.route !== 'auto'+ && !routeMatchesPresetFamily(+ edge.route,+ points,+ nodes.get(edge.from),+ nodes.get(edge.to),+ )) {+ const authoredEdgeIndex = workflow.edges.indexOf(edge);+ const alternatives = verifiedPinReferenceAlternatives([+ { edge, edgeIndex: authoredEdgeIndex, field: 'route' },+ ...presentRouteGeometryFields(edge)+ .map((field) => ({ edge, edgeIndex: authoredEdgeIndex, field })),+ ], 'and keep the remaining verified route assertions');+ throwExplicitPinConflict(edge, 'route preset compatibility', {+ route: edge.route,+ conflictingPins: alternatives.conflictingPins,+ points: points.map((point) => [...point]),+ }, alternatives.supportedFixes);+ }+ if (!routeHonorsEndpointSides(points, fromSide, toSide)) {+ const mismatchedSideFields = [+ ...(edge.fromSide && edge.fromSide !== 'auto'+ && !endpointSideIsHonored(points, fromSide, 'source') ? ['fromSide'] : []),+ ...(edge.toSide && edge.toSide !== 'auto'+ && !endpointSideIsHonored(points, toSide, 'target') ? ['toSide'] : []),+ ];+ const candidateFields = [+ ...mismatchedSideFields,+ ...presentRouteGeometryFields(edge),+ ];+ const alternatives = verifiedPinRemovalAlternatives(+ edge,+ candidateFields,+ 'and replan the remaining explicit pins',+ );+ throwExplicitPinConflict(edge, 'perpendicular endpoint-side direction', {+ conflictingPins: conflictPinsFromRemovalSets(+ edge,+ alternatives.removalSets,+ candidateFields,+ ),+ points: points.map((point) => [...point]),+ fromSide,+ toSide,+ }, alternatives.supportedFixes);+ }+ const nodeCollision = firstRouteNodeCollision(edge, points);+ if (nodeCollision) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'node clearance', {+ conflictingPins: alternatives.conflictingPins,+ ...nodeCollision,+ }, alternatives.supportedFixes);+ }+ const legendObstacle = workflowLegendRects().find((rect) => points.slice(0, -1).some((point, index) => (+ segmentIntersectsRect({ start: point, end: points[index + 1] }, rect)+ )));+ if (legendObstacle) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'legend clearance', {+ conflictingPins: alternatives.conflictingPins,+ points: points.map((point) => [...point]),+ legendObstacle,+ }, alternatives.supportedFixes);+ }+ const compositionObstacle = workflowSceneLabelObstacles().find((rect) => (+ points.slice(0, -1).some((point, index) => (+ segmentIntersectsRect({ start: point, end: points[index + 1] }, rect)+ ))+ ));+ if (compositionObstacle) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'lane/phase/group label clearance', {+ conflictingPins: alternatives.conflictingPins,+ points: points.map((point) => [...point]),+ compositionObstacle,+ }, alternatives.supportedFixes);+ }+ const [frameRun] = collectBorderRuns({+ routedRelations: [{ points }],+ frames: workflowCompositionFrames(),+ });+ if (frameRun) {+ const alternatives = verifiedRouteGeometryPinAlternatives(edge);+ throwExplicitPinConflict(edge, 'structural-frame border clearance', {+ conflictingPins: alternatives.conflictingPins,+ points: points.map((point) => [...point]),+ frame: frameRun.frame?.id ?? frameRun.frameIndex,+ side: frameRun.side,+ overlapLengthPx: frameRun.overlapLength,+ }, alternatives.supportedFixes);+ }+ }++ if (edge.labelAt) {+ const rect = labelRectFor(edge, workflow.edges.indexOf(edge));+ const obstacle = rect && [...nodes.values()].find((node) => rectsOverlap(rect, node, -2));+ if (obstacle) {+ throwExplicitPinConflict(edge, 'edge-label node clearance', {+ conflictingPins: [authoredPinEvidence(edge, 'labelAt')],+ labelAt: [...edge.labelAt],+ labelRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },+ obstacleNode: obstacle.id,+ }, [verifiedEdgeFix(+ edge,+ 'remove labelAt so readable-v2 can use its verified automatic label placement',+ (candidate) => { delete candidate.labelAt; },+ )]);+ }+ const legendObstacle = rect && workflowLegendRects().find((legendRect) => (+ rectsOverlap(rect, legendRect)+ ));+ if (legendObstacle) {+ throwExplicitPinConflict(edge, 'edge-label legend clearance', {+ conflictingPins: [authoredPinEvidence(edge, 'labelAt')],+ labelAt: [...edge.labelAt],+ labelRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },+ legendObstacle,+ }, [verifiedEdgeFix(+ edge,+ 'remove labelAt so readable-v2 can use its verified automatic label placement',+ (candidate) => { delete candidate.labelAt; },+ )]);+ }+ const compositionObstacle = rect && workflowSceneLabelObstacles().find((candidate) => (+ rectsOverlap(rect, candidate)+ ));+ if (compositionObstacle) {+ throwExplicitPinConflict(edge, 'edge-label lane/phase/group clearance', {+ conflictingPins: [authoredPinEvidence(edge, 'labelAt')],+ labelAt: [...edge.labelAt],+ labelRect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },+ compositionObstacle,+ }, [verifiedEdgeFix(+ edge,+ `remove labelAt from edge "${workflowEdgeName(edge)}" so readable-v2 can use its verified automatic label placement`,+ (candidate) => { delete candidate.labelAt; },+ )]);+ }+ }+ }+ validateReadablePairwisePinConflicts();+}++function validateWorkflow() {+ const problems = [];+ if (workflow.schema_version !== 1 && workflow.schema_version !== 2) {+ problems.push('Workflow files must set "schema_version" to 1 or 2.');+ }+ if (workflow.diagram_type !== 'workflow') {+ problems.push(`Unsupported diagram_type "${workflow.diagram_type}". Expected "workflow".`);+ }+ if (!workflow.meta || !workflow.meta.title) {+ problems.push('Workflow files must include meta.title.');+ }+ if (!Array.isArray(workflow.lanes) || !workflow.lanes.length) {+ problems.push('Workflow files must include at least one lane.');+ }+ if (!Array.isArray(workflow.nodes)) {+ problems.push('Workflow files must include a nodes array.');+ }+ if (!Array.isArray(workflow.edges)) {+ problems.push('Workflow files must include an edges array.');+ }+ if (workflow.phases !== undefined && !Array.isArray(workflow.phases)) {+ problems.push('Workflow "phases" must be an array.');+ }+ if (workflow.groups !== undefined && !Array.isArray(workflow.groups)) {+ problems.push('Workflow "groups" must be an array.');+ }+ if (workflow.mainPath !== undefined && !Array.isArray(workflow.mainPath)) {+ problems.push('Workflow "mainPath" must be an array of node ids.');+ }+ if (workflow.cards !== undefined && !Array.isArray(workflow.cards)) {+ problems.push('Workflow "cards" must be an array.');+ }+ if (problems.length) {+ throwDiagnosticProblems('Workflow layout validation failed', problems, {+ subject: { diagramType: 'workflow' },+ });+ }++ enforceLegacyColumnCapacity();++ const laneIds = new Set(workflow.lanes.map((lane) => lane.id));+ if (laneIds.size !== workflow.lanes.length) {+ problems.push('Lane ids must be unique.');+ }+ if (nodes.size !== workflow.nodes.length) {+ problems.push('Node ids must be unique.');+ }+ const phaseIds = new Set(asArray(workflow.phases).map((phase) => phase.id));+ if (phaseIds.size !== asArray(workflow.phases).length) {+ problems.push('Phase ids must be unique.');+ }+ const groupIds = new Set(asArray(workflow.groups).map((group) => group.id));+ if (groupIds.size !== asArray(workflow.groups).length) {+ problems.push('Group ids must be unique.');+ }++ for (const node of nodes.values()) {+ if (!laneIds.has(node.lane)) {+ problems.push(`Node "${node.id}" uses unknown lane "${node.lane}".`);+ continue;+ }+ if (!Number.isInteger(node.col) || node.col < 0 || node.col >= layout.colXs.length) {+ problems.push(`Node "${node.id}" uses column ${node.col}, but valid columns are integers 0..${layout.colXs.length - 1}.`);+ continue;+ }+ if (!isFinitePoint(node.x, node.y, node.cx, node.cy)) {+ problems.push(`Node "${node.id}" produced non-finite coordinates — check col, width, height, and yOffset are numbers.`);+ continue;+ }+ const estLabelW = textUnits(node.label) * 6.8;+ if (estLabelW > node.width + 6) {+ problems.push(`Label "${node.label}" (~${Math.round(estLabelW)}px) is wider than node "${node.id}" (${node.width}px) — shorten the label or increase node.width.`);+ }+ const brandRailProblem = brandTopRailProblem(node, node.width, nodeTextFit.labelMinimum);+ if (brandRailProblem) problems.push(brandRailProblem);+ const availableTextW = availableNodeTextWidth(node.width);+ for (const [field, value, minimum] of [+ ['Sublabel', node.sublabel, nodeTextFit.sublabelMinimum],+ ['Tag', node.tag, nodeTextFit.tagMinimum],+ ]) {+ if (!value) continue;+ const minimumW = minimumNodeTextWidth(value, minimum);+ if (minimumW > availableTextW) {+ problems.push(`${field} "${value}" needs ~${Math.ceil(minimumW)}px at the ${minimum}px legible minimum, but node "${node.id}" provides ${availableTextW}px — shorten the ${field.toLowerCase()} or increase node.width.`);+ }+ }++ const top = laneTop(node.lane);+ const contentTop = top + layout.laneTitleH + laneGroupHeaderH(node.lane);+ const laneRight = layout.laneX + layout.laneW;+ if (node.x < layout.laneX || node.x + node.width > laneRight) {+ problems.push(`Node "${node.id}" exceeds the horizontal bounds of lane "${node.lane}".`);+ }+ if (node.y < contentTop || node.y + node.height > top + laneHeight(node.lane)) {+ problems.push(`Node "${node.id}" collides with the title or boundary of lane "${node.lane}".`);+ }+ }++ const phaseRanges = [];+ for (const phase of asArray(workflow.phases)) {+ if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)) {+ problems.push(`Phase "${phase.id}" must use integer fromCol/toCol values.`);+ continue;+ }+ if (phase.fromCol < 0 || phase.toCol >= layout.colXs.length || phase.fromCol > phase.toCol) {+ problems.push(`Phase "${phase.id}" uses invalid columns ${phase.fromCol}..${phase.toCol}; use an ordered range within 0..${layout.colXs.length - 1}.`);+ } else {+ phaseRanges.push(phase);+ }+ const estLabelW = textUnits(phase.label) * 5.6;+ const width = phaseSpan(phase).width;+ if (estLabelW > width + 8) {+ problems.push(`Phase label "${phase.label}" (~${Math.round(estLabelW)}px) is wider than its ${Math.round(width)}px span — shorten the label or widen the phase range.`);+ }+ }+ phaseRanges.sort((a, b) => a.fromCol - b.fromCol || a.toCol - b.toCol);+ for (let i = 0; i < phaseRanges.length; i += 1) {+ for (let j = i + 1; j < phaseRanges.length; j += 1) {+ const earlier = phaseRanges[i];+ const later = phaseRanges[j];+ if (later.fromCol > earlier.toCol) break;+ problems.push(`Phase "${later.id}" (${later.fromCol}..${later.toCol}) overlaps phase "${earlier.id}" (${earlier.fromCol}..${earlier.toCol}) — start at col ${earlier.toCol + 1} or later, or end the earlier phase at col ${later.fromCol - 1}.`);+ }+ }++ for (const group of asArray(workflow.groups)) {+ if (!laneIds.has(group.lane)) {+ problems.push(`Group "${group.id}" uses unknown lane "${group.lane}".`);+ continue;+ }+ if (!Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)) {+ problems.push(`Group "${group.id}" must use integer fromCol/toCol values.`);+ continue;+ }+ if (group.fromCol < 0 || group.toCol >= layout.colXs.length || group.fromCol > group.toCol) {+ problems.push(`Group "${group.id}" uses invalid columns ${group.fromCol}..${group.toCol}; use an ordered range within 0..${layout.colXs.length - 1}.`);+ }+ const contained = [...nodes.values()].some((node) => node.lane === group.lane && node.col >= group.fromCol && node.col <= group.toCol);+ if (!contained) {+ problems.push(`Group "${group.id}" does not contain any nodes — align its lane/columns with the parallel or branch work it frames.`);+ }+ }++ const byLane = new Map();+ for (const node of nodes.values()) {+ byLane.set(node.lane, [...(byLane.get(node.lane) || []), node]);+ }+ for (const [lane, laneNodes] of byLane) {+ for (let i = 0; i < laneNodes.length; i += 1) {+ for (let j = i + 1; j < laneNodes.length; j += 1) {+ if (rectsOverlap(laneNodes[i], laneNodes[j], 8)) {+ problems.push(`Nodes "${laneNodes[i].id}" and "${laneNodes[j].id}" are less than 8px apart in lane "${lane}" — move one to another col, adjust yOffset, or reduce width/height.`);+ }+ }+ }+ }++ for (const edge of workflow.edges) {+ if (!nodes.has(edge.from)) problems.push(`Edge "${edge.label || edge.from}" references unknown source "${edge.from}".`);+ if (!nodes.has(edge.to)) problems.push(`Edge "${edge.label || edge.to}" references unknown target "${edge.to}".`);+ if (nodes.has(edge.from) && nodes.has(edge.to)) {+ const routed = pathFor(edge);+ if (routed.points.length === 2) {+ const [start, end] = routed.points;+ const segmentLength = Math.hypot(end[0] - start[0], end[1] - start[1]);+ if (segmentLength < 28) {+ problems.push(`Edge "${edge.from}" -> "${edge.to}" is too short (${Math.round(segmentLength)}px; minimum 28px) — move the nodes farther apart or use a verified orthogonal route with readable clearance.`);+ }+ }+ }+ }++ problems.push(...cleanEndpointSideProblems({+ relations: workflow.edges,+ endpointIds: new Set(nodes.keys()),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ fromSideFor: (edge) => edgeSides(edge).fromSide,+ toSideFor: (edge) => edgeSides(edge).toSide,+ routeHint: 'keep automatic routing, or choose fromSide/toSide and via points whose first and final segments cross node borders perpendicularly',+ }));+ problems.push(...cleanFlowProblems({+ relations: workflow.edges,+ obstacles: nodes.values(),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ obstacleKind: 'node',+ routeHint: 'adjust fromSide/toSide, set route/via or channel coordinates, or move the node to a clearer lane/column'+ }));+ problems.push(...cleanCrossingProblems({+ relations: workflow.edges,+ endpointIds: new Set(nodes.keys()),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ profile: workflow.meta?.quality_profile,+ profileIsAuthoritative: true,+ mergeForwardCollinearWaypoints: workflow.schema_version === 2,+ routeHint: 'adjust route/via, bias, or channel coordinates so the edges use separate lane corridors'+ }));+ problems.push(...cleanAmbiguousCorridorProblems({+ relations: workflow.edges,+ endpointIds: new Set(nodes.keys()),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ profile: workflow.meta?.quality_profile,+ profileIsAuthoritative: true,+ routeHint: 'adjust route/via, bias, or channel coordinates so unrelated edges do not visually merge'+ }));+ problems.push(...cleanBorderRunProblems({+ relations: workflow.edges,+ endpointIds: new Set(nodes.keys()),+ frames: workflowCompositionFrames(),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ profile: workflow.meta?.quality_profile,+ profileIsAuthoritative: true,+ routeHint: 'adjust route/via, bias, or channel coordinates so the edge crosses the lane or group perpendicularly instead of following its border'+ }));+ problems.push(...cleanRouteRhythmProblems({+ relations: workflow.edges,+ endpointIds: new Set(nodes.keys()),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ profile: workflow.meta?.quality_profile,+ profileIsAuthoritative: true,+ routeHint: 'adjust route/via, bias, or channel coordinates so each turn has a readable run-up'+ }));++ if (Array.isArray(workflow.mainPath)) {+ for (const id of workflow.mainPath) {+ if (!nodes.has(id)) {+ problems.push(`mainPath references unknown node "${id}".`);+ }+ }+ for (let i = 0; i < workflow.mainPath.length - 1; i += 1) {+ const fromId = workflow.mainPath[i];+ const toId = workflow.mainPath[i + 1];+ const from = nodes.get(fromId);+ const to = nodes.get(toId);+ if (!from || !to) continue;+ const linked = workflow.edges.some((edge) => edge.from === fromId && edge.to === toId);+ if (!linked) {+ problems.push(`mainPath step "${fromId}" -> "${toId}" has no matching edge — add the edge or remove the pair from mainPath.`);+ }+ if (to.col < from.col) {+ problems.push(`mainPath step "${fromId}" -> "${toId}" moves backward from col ${from.col} to ${to.col} — use a return edge outside mainPath for loops.`);+ }+ }+ }++ const labelRects = [];+ for (const [edgeIndex, edge] of workflow.edges.entries()) {+ const labelRect = labelRectFor(edge, edgeIndex);+ if (labelRect) labelRects.push(labelRect);+ }+ for (const rect of labelRects) {+ for (const node of nodes.values()) {+ if (rectsOverlap(rect, node, -2)) {+ problems.push(`Label "${rect.label}" overlaps node "${node.id}" — adjust labelDx/labelDy/labelSegment or set labelAt.\n${suggestLabelObstacleFix(rect, rect.lx, rect.ly, node, 'node')}`);+ }+ }+ }+ for (let i = 0; i < labelRects.length; i += 1) {+ for (let j = i + 1; j < labelRects.length; j += 1) {+ if (rectsOverlap(labelRects[i], labelRects[j], -2)) {+ problems.push(`Labels "${labelRects[i].label}" and "${labelRects[j].label}" overlap — adjust labelDx/labelDy/labelSegment or route one relationship through a separate corridor.\n${suggestLabelPairFix(labelRects[i], labelRects[j])}`);+ }+ }+ }+ problems.push(...cleanLabelRouteClearanceProblems({+ relations: workflow.edges,+ labels: labelRects,+ endpointIds: new Set(nodes.keys()),+ pathFor,+ diagramType: 'workflow',+ relationCollection: 'edges',+ profile: workflow.meta?.quality_profile,+ profileIsAuthoritative: true,+ }));++ if (workflow.schema_version === 1) {+ if (viewBox[0] < layout.laneX + layout.laneW + 16) {+ problems.push(`viewBox width ${viewBox[0]} clips the ${layout.laneW}px lanes — set meta.viewBox[0] to at least ${layout.laneX + layout.laneW + 16}.`);+ }+ if (legendY() + 18 > viewBox[1]) {+ problems.push(`Legend exceeds viewBox height ${viewBox[1]} — set meta.viewBox[1] to at least ${legendY() + 18}.`);+ }+ }++ if (problems.length) {+ throwDiagnosticProblems('Workflow layout validation failed', problems, {+ subject: { diagramType: 'workflow' },+ });+ }+}++function validateReadableInputsBeforeRouting() {+ if (workflow.schema_version !== 2) return;+ const fail = (diagnostic) => throwDiagnosticError(diagnostic.message, [diagnostic]);+ const unusedId = (base, used) => {+ for (let suffix = 2; ; suffix += 1) {+ const candidate = `${base}-${suffix}`;+ if (!used.has(candidate)) return candidate;+ }+ };+ const authoredLanes = [...workflow.lanes].sort((left, right) => (+ sourceIndexes.lanes.get(left) - sourceIndexes.lanes.get(right)+ ));+ const authoredNodes = [...workflow.nodes].sort((left, right) => (+ sourceIndexes.nodes.get(left) - sourceIndexes.nodes.get(right)+ ));+ const authoredEdges = [...workflow.edges].sort((left, right) => (+ sourceIndexes.edges.get(left) - sourceIndexes.edges.get(right)+ ));++ const firstLaneIndex = new Map();+ for (const lane of authoredLanes) {+ const laneIndex = sourceIndexes.lanes.get(lane);+ if (firstLaneIndex.has(lane.id)) {+ const message = `Workflow lane id "${lane.id}" is duplicated.`;+ const replacement = unusedId(lane.id, new Set(workflow.lanes.map(({ id }) => id)));+ const canonicalLaneIndex = workflow.lanes.indexOf(lane);+ const supportedFixes = acceptsFix((document) => {+ document.lanes[canonicalLaneIndex].id = replacement;+ }) ? [`rename /lanes/${laneIndex}/id to verified unique id "${replacement}"`] : [];+ fail({+ code: 'workflow/duplicate-lane-id',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', lane: lane.id, path: `/lanes/${laneIndex}/id` },+ evidence: {+ duplicateLaneId: lane.id,+ firstPath: `/lanes/${firstLaneIndex.get(lane.id)}/id`,+ duplicatePath: `/lanes/${laneIndex}/id`,+ },+ supportedFixes,+ });+ }+ firstLaneIndex.set(lane.id, laneIndex);+ }++ const firstNodeIndex = new Map();+ for (const node of authoredNodes) {+ const nodeIndex = sourceIndexes.nodes.get(node);+ if (firstNodeIndex.has(node.id)) {+ const message = `Workflow node id "${node.id}" is duplicated.`;+ const replacement = unusedId(node.id, new Set(workflow.nodes.map(({ id }) => id)));+ const canonicalNodeIndex = workflow.nodes.indexOf(node);+ const supportedFixes = acceptsFix((document) => {+ document.nodes[canonicalNodeIndex].id = replacement;+ }) ? [`rename /nodes/${nodeIndex}/id to verified unique id "${replacement}"`] : [];+ fail({+ code: 'workflow/duplicate-node-id',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', node: node.id, path: `/nodes/${nodeIndex}/id` },+ evidence: {+ duplicateNodeId: node.id,+ firstPath: `/nodes/${firstNodeIndex.get(node.id)}/id`,+ duplicatePath: `/nodes/${nodeIndex}/id`,+ },+ supportedFixes,+ });+ }+ firstNodeIndex.set(node.id, nodeIndex);+ }++ const availableNodeIds = [...nodes.keys()].sort(stableCompare);+ for (const edge of authoredEdges) {+ const edgeIndex = sourceIndexes.edges.get(edge);+ for (const [field, endpoint] of [['from', 'source'], ['to', 'target']]) {+ if (nodes.has(edge[field])) continue;+ const message = `Workflow edge "${workflowEdgeName(edge)}" references unknown ${endpoint} "${edge[field]}".`;+ const canonicalEdgeIndex = workflow.edges.indexOf(edge);+ const supportedFixes = availableNodeIds.flatMap((nodeId) => (+ acceptsFix((document) => {+ document.edges[canonicalEdgeIndex][field] = nodeId;+ })+ ? [`set /edges/${edgeIndex}/${field} to verified node id "${nodeId}"`]+ : []+ ));+ fail({+ code: 'workflow/unknown-edge-endpoint',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: edge.id ?? null,+ path: `/edges/${edgeIndex}/${field}`,+ from: edge.from,+ to: edge.to,+ },+ evidence: {+ endpoint,+ unknownNodeId: edge[field],+ availableNodeIds,+ },+ supportedFixes,+ });+ }+ }+ const laneIds = new Set(workflow.lanes.map((lane) => lane.id));+ const availableLaneIds = [...laneIds].sort(stableCompare);+ const nodeSourceIndexes = new Map(authoredNodes.map((node) => [+ node.id,+ sourceIndexes.nodes.get(node),+ ]));++ const byLane = new Map();+ for (const authoredNode of authoredNodes) {+ const nodeIndex = sourceIndexes.nodes.get(authoredNode);+ const node = nodes.get(authoredNode.id);+ if (!laneIds.has(node.lane)) {+ const message = `Workflow node "${node.id}" uses unknown lane "${node.lane}".`;+ const canonicalNodeIndex = workflow.nodes.findIndex((candidate) => candidate.id === node.id);+ const supportedFixes = availableLaneIds.flatMap((laneId) => (+ acceptsFix((document) => {+ document.nodes[canonicalNodeIndex].lane = laneId;+ })+ ? [`set /nodes/${nodeIndex}/lane to verified lane id "${laneId}"`]+ : []+ ));+ fail({+ code: 'workflow/unknown-node-lane',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', node: node.id, path: `/nodes/${nodeIndex}/lane` },+ evidence: { unknownLaneId: node.lane, availableLaneIds },+ supportedFixes,+ });+ }+ if (!Number.isInteger(node.col) || node.col < 0 || node.col >= layout.colXs.length) {+ const message = `Workflow node "${node.id}" uses column ${node.col}, but valid columns are integers 0..${layout.colXs.length - 1}.`;+ const canonicalNodeIndex = workflow.nodes.findIndex((candidate) => candidate.id === node.id);+ const supportedFixes = layout.colXs.flatMap((_x, col) => (+ acceptsFix((document) => {+ document.nodes[canonicalNodeIndex].col = col;+ })+ ? [`set /nodes/${nodeIndex}/col to verified column ${col}`]+ : []+ ));+ fail({+ code: 'workflow/invalid-node-column',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', node: node.id, path: `/nodes/${nodeIndex}/col` },+ evidence: { actualColumn: node.col, minimumColumn: 0, maximumColumn: layout.colXs.length - 1 },+ supportedFixes,+ });+ }+ if (!isFinitePoint(node.x, node.y, node.cx, node.cy)) {+ const message = `Workflow node "${node.id}" produced non-finite coordinates.`;+ fail({+ code: 'workflow/non-finite-node-geometry',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', node: node.id, path: `/nodes/${nodeIndex}` },+ evidence: {+ measuredRect: { x: node.x, y: node.y, width: node.width, height: node.height },+ authored: {+ col: authoredNode.col,+ width: authoredNode.width ?? null,+ height: authoredNode.height ?? null,+ yOffset: authoredNode.yOffset ?? null,+ },+ },+ supportedFixes: [],+ });+ }+ byLane.set(node.lane, [...(byLane.get(node.lane) || []), node]);+ }+ for (const [lane, laneNodes] of byLane) {+ for (let left = 0; left < laneNodes.length; left += 1) {+ for (let right = left + 1; right < laneNodes.length; right += 1) {+ if (rectsOverlap(laneNodes[left], laneNodes[right], 8)) {+ const leftNode = laneNodes[left];+ const rightNode = laneNodes[right];+ const rightIndex = nodeSourceIndexes.get(rightNode.id);+ const canonicalNodeIndex = workflow.nodes.findIndex((candidate) => (+ candidate.id === rightNode.id+ ));+ const supportedFixes = layout.colXs.flatMap((_x, col) => {+ if (col === rightNode.col) return [];+ return acceptsFix((document) => {+ document.nodes[canonicalNodeIndex].col = col;+ })+ ? [`set /nodes/${rightIndex}/col to verified free column ${col}`]+ : [];+ });+ const message = `Workflow nodes "${leftNode.id}" and "${rightNode.id}" are less than 8px apart in lane "${lane}".`;+ fail({+ code: 'workflow/node-overlap',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', node: rightNode.id, path: `/nodes/${rightIndex}` },+ evidence: {+ lane,+ minimumClearancePx: 8,+ nodes: [+ { id: leftNode.id, rect: { x: leftNode.x, y: leftNode.y, width: leftNode.width, height: leftNode.height } },+ { id: rightNode.id, rect: { x: rightNode.x, y: rightNode.y, width: rightNode.width, height: rightNode.height } },+ ],+ },+ supportedFixes,+ });+ }+ }+ }+ }+}++function gapYBetween(fromLane, toLane, bias = 0.5) {+ const a = laneTop(fromLane) + laneHeight(fromLane);+ const b = laneTop(toLane);+ return a + (b - a) * bias;+}++function spanForCols(fromCol, toCol, pad = 46, minimumWidth = 0) {+ const start = layout.colXs[fromCol] - pad;+ const end = layout.colXs[toCol] + pad;+ const width = Math.max(end - start, minimumWidth);+ if (fromCol === toCol && width > end - start) {+ return { x: start, width, cx: start + width / 2 };+ }+ const cx = (start + end) / 2;+ return { x: cx - width / 2, width, cx };+}++function phaseSpan(phase) {+ return spanForCols(+ phase.fromCol,+ phase.toCol,+ 46,+ workflow.schema_version === 2 ? textUnits(phase.label) * 5.6 + 8 : 0,+ );+}++function groupSpan(group) {+ if (workflow.schema_version === 2) {+ return readableGroupBounds(workflow, group, layout.colXs);+ }+ return spanForCols(+ group.fromCol,+ group.toCol,+ 50,+ 0,+ );+}++function sameLaneAutoVia(start, end) {+ if (start[0] === end[0] || start[1] === end[1]) return [];+ const midX = (start[0] + end[0]) / 2;+ return [[midX, start[1]], [midX, end[1]]];+}++function routeClearsUnrelatedNodes(edge, points, clearance = 2) {+ const endpointIds = new Set([edge.from, edge.to]);+ for (const node of nodes.values()) {+ if (endpointIds.has(node.id)) continue;+ for (let index = 0; index < points.length - 1; index += 1) {+ if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, node, clearance)) {+ return false;+ }+ }+ }+ return true;+}++function firstRouteNodeCollision(edge, points) {+ const lastSegment = points.length - 2;+ for (const node of nodes.values()) {+ const endpointRole = node.id === edge.from+ ? 'source-endpoint'+ : node.id === edge.to ? 'target-endpoint' : 'unrelated';+ for (let segmentIndex = 0; segmentIndex <= lastSegment; segmentIndex += 1) {+ if (endpointRole === 'source-endpoint' && segmentIndex === 0) continue;+ if (endpointRole === 'target-endpoint' && segmentIndex === lastSegment) continue;+ const clearancePx = endpointRole === 'unrelated' ? 2 : 0;+ const from = points[segmentIndex];+ const to = points[segmentIndex + 1];+ if (segmentIntersectsRect({ start: from, end: to }, node, clearancePx)) {+ return {+ obstacleNode: node.id,+ obstacleRole: endpointRole,+ segmentIndex,+ from: [...from],+ to: [...to],+ clearancePx,+ };+ }+ }+ }+ return null;+}++function oneBendCrossLaneVia(edge, start, end, fromSide, toSide) {+ const fromVertical = fromSide === 'top' || fromSide === 'bottom';+ const toVertical = toSide === 'top' || toSide === 'bottom';+ if (fromVertical === toVertical) return null;++ const corner = fromVertical ? [start[0], end[1]] : [end[0], start[1]];+ const points = normalizeRoutePoints([start, corner, end]);+ if (points.length !== 3 || !routeHonorsEndpointSides(points, fromSide, toSide)) return null;++ const segmentsAreReadable = points.slice(0, -1).every((point, index) => (+ Math.hypot(+ points[index + 1][0] - point[0],+ points[index + 1][1] - point[1],+ ) >= 8+ ));+ if (!segmentsAreReadable || !routeClearsUnrelatedNodes(edge, points)) return null;+ return points.slice(1, -1);+}++const pathCache = new Map();+const readableSideCache = new Map();++function legacyAutomaticOneBendSides(edge, from, to) {+ const automaticRoute = !edge.via && (!edge.route || edge.route === 'auto');+ const automaticFrom = !edge.fromSide || edge.fromSide === 'auto';+ const automaticTo = !edge.toSide || edge.toSide === 'auto';+ if (!automaticRoute || !automaticFrom || !automaticTo || from.lane === to.lane) return null;+ if (from.cx === to.cx || from.cy === to.cy) return null;+ const verticalFrom = to.cy < from.cy ? 'top' : 'bottom';+ const horizontalTo = to.cx < from.cx ? 'right' : 'left';+ const horizontalFrom = to.cx < from.cx ? 'left' : 'right';+ const verticalTo = to.cy < from.cy ? 'bottom' : 'top';+ const candidates = [+ { fromSide: verticalFrom, toSide: horizontalTo },+ { fromSide: horizontalFrom, toSide: verticalTo },+ ];++ return candidates.find(({ fromSide, toSide }) => {+ const start = anchor(from, fromSide);+ const end = anchor(to, toSide);+ return oneBendCrossLaneVia(edge, start, end, fromSide, toSide);+ }) || null;+}++function readableAutomaticSides(edge, from, to) {+ const automaticRoute = !edge.via+ && edge.channelX === undefined+ && edge.channelY === undefined+ && (!edge.route || edge.route === 'auto');+ const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null;+ const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null;+ if (!automaticRoute || (authoredFrom && authoredTo)) return null;+ if (readableSideCache.has(edge)) return readableSideCache.get(edge);++ const preferred = [];+ const legacyPreferred = legacyAutomaticOneBendSides(edge, from, to);+ if (legacyPreferred) preferred.push(legacyPreferred);+ preferred.push({+ fromSide: authoredFrom || defaultFromSide(from, to),+ toSide: authoredTo || defaultToSide(from, to),+ });+ const sideOrder = ['right', 'bottom', 'left', 'top'];+ for (const fromSide of authoredFrom ? [authoredFrom] : sideOrder) {+ for (const toSide of authoredTo ? [authoredTo] : sideOrder) {+ preferred.push({ fromSide, toSide });+ }+ }++ const seen = new Set();+ const sidePairs = [];+ for (const candidate of preferred) {+ if (authoredFrom && candidate.fromSide !== authoredFrom) continue;+ if (authoredTo && candidate.toSide !== authoredTo) continue;+ const key = `${candidate.fromSide}:${candidate.toSide}`;+ if (seen.has(key)) continue;+ seen.add(key);+ sidePairs.push(candidate);+ }++ const naturalFromSide = authoredFrom || defaultFromSide(from, to);+ const naturalToSide = authoredTo || defaultToSide(from, to);+ const planFor = (candidate, pairOrdinal) => {+ const start = anchor(from, candidate.fromSide);+ const end = anchor(to, candidate.toSide);+ return {+ start,+ end,+ planned: readableAutomaticCandidateSet(+ edge,+ from,+ to,+ start,+ end,+ candidate.fromSide,+ candidate.toSide,+ {+ ordinalOffset: pairOrdinal * 9,+ naturalFromSide,+ naturalToSide,+ },+ ),+ };+ };++ const primary = sidePairs[0];+ if (primary) {+ const { planned } = planFor(primary, 0);+ if (planned.candidates.length) {+ readableSideCache.set(edge, primary);+ return primary;+ }+ }++ const candidates = [];+ for (const [pairOrdinal, candidate] of sidePairs.entries()) {+ const { planned } = planFor(candidate, pairOrdinal);+ candidates.push(...planned.candidates.map((route) => ({ ...route, ...candidate })));+ }+ candidates.sort((left, right) => compareCost(left.cost, right.cost));+ if (candidates.length) {+ const selected = {+ fromSide: candidates[0].fromSide,+ toSide: candidates[0].toSide,+ };+ readableSideCache.set(edge, selected);+ return selected;+ }+ readableSideCache.set(edge, null);+ return null;+}++function automaticOneBendSides(edge, from, to) {+ return workflow.schema_version === 2+ ? readableAutomaticSides(edge, from, to)+ : legacyAutomaticOneBendSides(edge, from, to);+}++const OUTWARD_SIDE_VECTOR = Object.freeze({+ left: [-1, 0],+ right: [1, 0],+ top: [0, -1],+ bottom: [0, 1],+});++function outwardStub(point, side, distance = 16) {+ const [dx, dy] = OUTWARD_SIDE_VECTOR[side] || [0, 0];+ return [point[0] + dx * distance, point[1] + dy * distance];+}++function orthogonalRoute(points) {+ return points.every((point, index) => {+ if (!Array.isArray(point) || point.length !== 2 || !isFinitePoint(...point)) return false;+ if (index === 0) return true;+ const previous = points[index - 1];+ const dx = Math.abs(point[0] - previous[0]);+ const dy = Math.abs(point[1] - previous[1]);+ return (dx <= 0.0001) !== (dy <= 0.0001);+ });+}++function routeClearsEndpointNodes(points, from, to) {+ const lastSegment = points.length - 2;+ for (let index = 0; index <= lastSegment; index += 1) {+ const segment = { start: points[index], end: points[index + 1] };+ if (index > 0 && segmentIntersectsRect(segment, from)) return false;+ if (index < lastSegment && segmentIntersectsRect(segment, to)) return false;+ }+ return true;+}++function routeMeetsHardRhythm(points) {+ if (points.length === 2) {+ return Math.hypot(points[1][0] - points[0][0], points[1][1] - points[0][1]) + 0.0001 >= 28;+ }+ return points.slice(0, -1).every((point, index) => {+ const length = Math.abs(points[index + 1][0] - point[0]) + Math.abs(points[index + 1][1] - point[1]);+ const endpoint = index === 0 || index === points.length - 2;+ return length + 0.0001 >= (endpoint ? 8 : 16);+ });+}++function routeLabelClearsNodes(edge, points) {+ if (!edge.label || edge.labelAt) return true;+ const [lx, ly] = workflowEdgeLabelPoint(edge, points);+ const rect = {+ x: lx - workflowLabelWidth(edge.label) / 2,+ y: ly - 10,+ width: workflowLabelWidth(edge.label),+ height: 14,+ };+ return [...nodes.values()].every((node) => !rectsOverlap(rect, node, -2));+}++function candidateLabelRect(edge, points) {+ if (!edge.label) return null;+ const [lx, ly] = workflowEdgeLabelPoint(edge, points);+ const width = workflowLabelWidth(edge.label);+ return { x: lx - width / 2, y: ly - 10, width, height: 14 };+}++function labelRouteClearanceDeficit(edge, points, threshold = 8) {+ const candidateLabel = candidateLabelRect(edge, points);+ let deficit = 0;+ for (const [otherEdge, routed] of pathCache) {+ const otherIndex = workflow.edges.indexOf(otherEdge);+ const otherLabel = labelRectFor(otherEdge, otherIndex);+ if (candidateLabel) {+ for (let index = 0; index < routed.points.length - 1; index += 1) {+ const clearance = segmentRectClearance({+ start: routed.points[index],+ end: routed.points[index + 1],+ }, candidateLabel);+ if (clearance != null) deficit += Math.max(0, threshold - clearance);+ }+ }+ if (otherLabel) {+ for (let index = 0; index < points.length - 1; index += 1) {+ const clearance = segmentRectClearance({+ start: points[index],+ end: points[index + 1],+ }, otherLabel);+ if (clearance != null) deficit += Math.max(0, threshold - clearance);+ }+ }+ }+ return deficit;+}++function routeClearsPlacedLabels(edge, points) {+ const candidateLabel = candidateLabelRect(edge, points);+ for (const [otherEdge, routed] of pathCache) {+ const otherIndex = workflow.edges.indexOf(otherEdge);+ const otherLabel = labelRectFor(otherEdge, otherIndex);+ if (candidateLabel && otherLabel && rectsOverlap(candidateLabel, otherLabel, -2)) return false;+ if (candidateLabel) {+ for (let index = 0; index < routed.points.length - 1; index += 1) {+ const clearance = segmentRectClearance({+ start: routed.points[index],+ end: routed.points[index + 1],+ }, candidateLabel);+ if (clearance != null && clearance + 0.0001 < 4) return false;+ }+ }+ if (otherLabel) {+ for (let index = 0; index < points.length - 1; index += 1) {+ const clearance = segmentRectClearance({+ start: points[index],+ end: points[index + 1],+ }, otherLabel);+ if (clearance != null && clearance + 0.0001 < 4) return false;+ }+ }+ }+ return true;+}++function routeClearsLegend(edge, points) {+ if (!workflowLegendEntries.length) return true;+ const legendRects = workflowLegendRects();+ for (const rect of legendRects) {+ for (let index = 0; index < points.length - 1; index += 1) {+ if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, rect)) return false;+ }+ const label = candidateLabelRect(edge, points);+ if (label && rectsOverlap(label, rect)) return false;+ }+ return true;+}++function routeClearsSceneLabelObstacles(edge, points) {+ const label = candidateLabelRect(edge, points);+ for (const obstacle of workflowSceneLabelObstacles()) {+ for (let index = 0; index < points.length - 1; index += 1) {+ if (segmentIntersectsRect({ start: points[index], end: points[index + 1] }, obstacle)) {+ return false;+ }+ }+ if (label && rectsOverlap(label, obstacle)) return false;+ }+ return true;+}++function routeClearsFrameBorders(points) {+ return collectBorderRuns({+ routedRelations: [{ points }],+ frames: workflowCompositionFrames(),+ }).length === 0;+}++function routeExtentCoordinates(edge, points) {+ const coordinates = [...points];+ if (!edge.labelAt) {+ const label = candidateLabelRect(edge, points);+ if (label) {+ coordinates.push([label.x, label.y], [label.x + label.width, label.y + label.height]);+ }+ }+ return coordinates;+}++function routeFitsCanvasOrigin(edge, points) {+ return routeExtentCoordinates(edge, points).every(([x, y]) => x >= 0 && y >= 0);+}++function readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide) {+ return points.length >= 2+ && orthogonalRoute(points)+ && routeHonorsEndpointSides(points, fromSide, toSide)+ && routeMeetsHardRhythm(points)+ && routeClearsEndpointNodes(points, from, to)+ && routeClearsUnrelatedNodes(edge, points)+ && routeLabelClearsNodes(edge, points)+ && routeClearsPlacedLabels(edge, points)+ && routeClearsLegend(edge, points)+ && routeClearsSceneLabelObstacles(edge, points)+ && routeClearsFrameBorders(points)+ && routeFitsCanvasOrigin(edge, points);+}++function corridorViaY(start, end, fromSide, toSide, y) {+ const startStub = outwardStub(start, fromSide);+ const endStub = outwardStub(end, toSide);+ return [startStub, [startStub[0], y], [endStub[0], y], endStub];+}++function corridorViaX(start, end, fromSide, toSide, x) {+ const startStub = outwardStub(start, fromSide);+ const endStub = outwardStub(end, toSide);+ return [startStub, [x, startStub[1]], [x, endStub[1]], endStub];+}++function axisOverlapLength(a, b, c, d) {+ const horizontal = Math.abs(a[1] - b[1]) <= 0.0001+ && Math.abs(c[1] - d[1]) <= 0.0001+ && Math.abs(a[1] - c[1]) <= 0.0001;+ const vertical = Math.abs(a[0] - b[0]) <= 0.0001+ && Math.abs(c[0] - d[0]) <= 0.0001+ && Math.abs(a[0] - c[0]) <= 0.0001;+ if (!horizontal && !vertical) return 0;+ const axis = horizontal ? 0 : 1;+ return Math.max(0, Math.min(Math.max(a[axis], b[axis]), Math.max(c[axis], d[axis]))+ - Math.max(Math.min(a[axis], b[axis]), Math.min(c[axis], d[axis])));+}++function properAxisCrossing(a, b, c, d) {+ const firstHorizontal = Math.abs(a[1] - b[1]) <= 0.0001;+ const secondHorizontal = Math.abs(c[1] - d[1]) <= 0.0001;+ if (firstHorizontal === secondHorizontal) return false;+ const horizontal = firstHorizontal ? [a, b] : [c, d];+ const vertical = firstHorizontal ? [c, d] : [a, b];+ const x = vertical[0][0];+ const y = horizontal[0][1];+ return x > Math.min(horizontal[0][0], horizontal[1][0]) + 0.0001+ && x < Math.max(horizontal[0][0], horizontal[1][0]) - 0.0001+ && y > Math.min(vertical[0][1], vertical[1][1]) + 0.0001+ && y < Math.max(vertical[0][1], vertical[1][1]) - 0.0001;+}++function routeInteractionMetrics(edge, points) {+ let properCrossingCount = 0;+ let sharedCorridorPx = 0;+ for (const [otherEdge, routed] of pathCache) {+ if ([edge.from, edge.to].some((id) => id === otherEdge.from || id === otherEdge.to)) continue;+ for (let left = 0; left < points.length - 1; left += 1) {+ for (let right = 0; right < routed.points.length - 1; right += 1) {+ if (properAxisCrossing(points[left], points[left + 1], routed.points[right], routed.points[right + 1])) {+ properCrossingCount += 1;+ }+ sharedCorridorPx += axisOverlapLength(+ points[left], points[left + 1], routed.points[right], routed.points[right + 1],+ );+ }+ }+ }+ return { properCrossingCount, sharedCorridorPx };+}++function automaticForwardReversePx(edge, points) {+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ if (!from || !to || ['return', 'error'].includes(edge.role) || to.col <= from.col) return 0;+ return points.slice(0, -1).reduce((total, point, index) => (+ total + Math.max(0, point[0] - points[index + 1][0])+ ), 0);+}++function readableCandidateCost(+ edge,+ points,+ ordinal,+ naturalFromSide,+ naturalToSide,+) {+ const interaction = routeInteractionMetrics(edge, points);+ const segmentLengths = points.slice(0, -1).map((point, index) => (+ Math.abs(points[index + 1][0] - point[0]) + Math.abs(points[index + 1][1] - point[1])+ ));+ const routeLength = segmentLengths.reduce((total, length) => total + length, 0);+ const directLength = Math.abs(points.at(-1)[0] - points[0][0]) + Math.abs(points.at(-1)[1] - points[0][1]);+ const interiorPreferred28Deficit = segmentLengths.slice(1, -1)+ .reduce((total, length) => total + Math.max(0, 28 - length), 0);+ const xs = points.map(([x]) => x);+ const ys = points.map(([, y]) => y);+ const canvasGrowthPx = Math.max(0, -Math.min(...xs))+ + Math.max(0, Math.max(...xs) - minimumCanvasWidth)+ + Math.max(0, -Math.min(...ys))+ + Math.max(0, Math.max(...ys) - autoHeight);+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ const naturalStart = anchor(from, naturalFromSide);+ const naturalEnd = anchor(to, naturalToSide);+ const portDisplacementPx = Math.abs(points[0][0] - naturalStart[0])+ + Math.abs(points[0][1] - naturalStart[1])+ + Math.abs(points.at(-1)[0] - naturalEnd[0])+ + Math.abs(points.at(-1)[1] - naturalEnd[1]);+ const legacyCoordinateDisplacement = Math.abs(from.cx - LEGACY_COLUMN_CENTERS[from.col])+ + Math.abs(to.cx - LEGACY_COLUMN_CENTERS[to.col]);+ return {+ automaticForwardReversePx: automaticForwardReversePx(edge, points),+ properCrossingCount: interaction.properCrossingCount,+ sharedCorridorPx: interaction.sharedCorridorPx,+ labelRouteClearanceDeficit: labelRouteClearanceDeficit(edge, points),+ interiorPreferred28Deficit,+ bendCount: Math.max(0, points.length - 2),+ stretchMilli: Math.round((directLength > 0 ? routeLength / directLength : 1) * 1000),+ canvasGrowthPx,+ portDisplacementMilli: Math.round(portDisplacementPx * 1000),+ legacyCoordinateDisplacement,+ stableCandidateOrdinal: ordinal,+ };+}++function compareCost(left, right) {+ for (const dimension of READABLE_CANDIDATE_COST_PRIORITY) {+ if ((left[dimension] || 0) !== (right[dimension] || 0)) {+ return (left[dimension] || 0) - (right[dimension] || 0);+ }+ }+ return 0;+}++function readableAutomaticCandidateSet(+ edge,+ from,+ to,+ start,+ end,+ fromSide,+ toSide,+ {+ ordinalOffset = 0,+ naturalFromSide = fromSide,+ naturalToSide = toSide,+ } = {},+) {+ const midX = (start[0] + end[0]) / 2;+ const laneGapY = from.lane === to.lane+ ? laneTop(from.lane) - 16+ : gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);+ const topY = Math.max(8, Math.min(laneTop(from.lane), laneTop(to.lane)) - 16);+ const bottomY = Math.max(+ laneTop(from.lane) + laneHeight(from.lane),+ laneTop(to.lane) + laneHeight(to.lane),+ ) + 16;+ const outsideLeft = layout.laneX - 20;+ const outsideRight = layout.laneX + layout.laneW + 12;+ const rawCandidates = [+ { family: 'facing-straight', via: [] },+ { family: 'horizontal-then-vertical', via: [[end[0], start[1]]] },+ { family: 'vertical-then-horizontal', via: [[start[0], end[1]]] },+ { family: 'lane-gap-corridor', via: corridorViaY(start, end, fromSide, toSide, laneGapY) },+ { family: 'column-gap-corridor', via: corridorViaX(start, end, fromSide, toSide, midX) },+ { family: 'outside-left', via: corridorViaX(start, end, fromSide, toSide, outsideLeft) },+ { family: 'outside-right', via: corridorViaX(start, end, fromSide, toSide, outsideRight) },+ { family: 'top-corridor', via: corridorViaY(start, end, fromSide, toSide, topY) },+ { family: 'bottom-corridor', via: corridorViaY(start, end, fromSide, toSide, bottomY) },+ ];+ const candidates = rawCandidates.map((candidate, ordinal) => ({+ ...candidate,+ ordinal: ordinalOffset + ordinal,+ points: normalizeRoutePoints([start, ...candidate.via, end]),+ })).filter(({ points }) => (+ readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide)+ )).map((candidate) => ({+ ...candidate,+ cost: readableCandidateCost(+ edge,+ candidate.points,+ candidate.ordinal,+ naturalFromSide,+ naturalToSide,+ ),+ })).sort((left, right) => compareCost(left.cost, right.cost));+ return { rawCandidates, candidates, outsideRight };+}++function readableAutomaticVia(edge, from, to, start, end, fromSide, toSide) {+ const { rawCandidates, candidates, outsideRight } = readableAutomaticCandidateSet(+ edge,+ from,+ to,+ start,+ end,+ fromSide,+ toSide,+ );++ if (candidates.length) return candidates[0].points.slice(1, -1);+ const outsideRightCandidate = rawCandidates.find(({ family }) => family === 'outside-right');+ if (outsideRightCandidate) {+ const currentPoints = normalizeRoutePoints([start, ...outsideRightCandidate.via, end]);+ const labelRect = candidateLabelRect(edge, currentPoints);+ let outsideRightMinX = outsideRight;+ for (const node of nodes.values()) {+ if (!labelRect || !rectsOverlap(labelRect, node, -2)) continue;+ const rightwardLabelDeficit = node.x + node.width - 2 - labelRect.x;+ if (rightwardLabelDeficit > 0) {+ outsideRightMinX = Math.max(+ outsideRightMinX,+ outsideRight + rightwardLabelDeficit * 2,+ );+ }+ }+ for (const [otherEdge, routed] of pathCache) {+ const otherIndex = workflow.edges.indexOf(otherEdge);+ const otherLabel = labelRectFor(otherEdge, otherIndex);+ if (labelRect && otherLabel && rectsOverlap(labelRect, otherLabel, -2)) {+ const rightwardLabelDeficit = otherLabel.x + otherLabel.width - 2 - labelRect.x;+ if (rightwardLabelDeficit > 0) {+ outsideRightMinX = Math.max(+ outsideRightMinX,+ outsideRight + rightwardLabelDeficit * 2,+ );+ }+ }+ if (!labelRect) continue;+ for (let index = 0; index < routed.points.length - 1; index += 1) {+ const segment = {+ start: routed.points[index],+ end: routed.points[index + 1],+ };+ const clearance = segmentRectClearance(segment, labelRect);+ if (clearance == null || clearance + 0.0001 >= 4) continue;+ const rightwardLabelDeficit = Math.max(segment.start[0], segment.end[0])+ + 4 - labelRect.x;+ if (rightwardLabelDeficit > 0) {+ outsideRightMinX = Math.max(+ outsideRightMinX,+ outsideRight + rightwardLabelDeficit * 2,+ );+ }+ }+ }+ outsideRightMinX = Math.ceil(outsideRightMinX * 1000) / 1000;+ let rightmostPlacedX = outsideRight;+ for (const node of nodes.values()) {+ rightmostPlacedX = Math.max(rightmostPlacedX, node.x + node.width);+ }+ for (const [otherEdge, routed] of pathCache) {+ for (const [x] of routed.points) rightmostPlacedX = Math.max(rightmostPlacedX, x);+ const otherLabel = labelRectFor(otherEdge, workflow.edges.indexOf(otherEdge));+ if (otherLabel) {+ rightmostPlacedX = Math.max(rightmostPlacedX, otherLabel.x + otherLabel.width);+ }+ }+ let probeGrowth = Math.max(+ 32,+ labelRect?.width ?? 0,+ rightmostPlacedX + 16 - outsideRightMinX,+ );+ let lastInfeasibleX = outsideRight;+ for (let probe = 0; probe < 7; probe += 1) {+ if (outsideRightMinX > outsideRight + 0.0001) {+ const expandedPoints = normalizeRoutePoints([+ start,+ ...corridorViaX(start, end, fromSide, toSide, outsideRightMinX),+ end,+ ]);+ if (readableCandidateIsFeasible(edge, expandedPoints, from, to, fromSide, toSide)) {+ let feasibleX = outsideRightMinX;+ let feasiblePoints = expandedPoints;+ let infeasibleX = lastInfeasibleX;+ for (let refinement = 0;+ refinement < 53 && feasibleX - infeasibleX > 0.001;+ refinement += 1) {+ const midpointX = Math.ceil(((infeasibleX + feasibleX) / 2) * 1000) / 1000;+ if (midpointX >= feasibleX - 0.0001) break;+ const midpointPoints = normalizeRoutePoints([+ start,+ ...corridorViaX(start, end, fromSide, toSide, midpointX),+ end,+ ]);+ if (readableCandidateIsFeasible(+ edge,+ midpointPoints,+ from,+ to,+ fromSide,+ toSide,+ )) {+ feasibleX = midpointX;+ feasiblePoints = midpointPoints;+ } else {+ infeasibleX = midpointX;+ }+ }+ return feasiblePoints.slice(1, -1);+ }+ lastInfeasibleX = outsideRightMinX;+ }+ outsideRightMinX = Math.ceil((outsideRightMinX + probeGrowth) * 1000) / 1000;+ probeGrowth *= 2;+ }+ }+ const hasRelevantAbsolutePin = Array.isArray(edge.labelAt)+ || [...pathCache.keys()].some((otherEdge) => (+ Array.isArray(otherEdge.labelAt) || hasAbsoluteRoutePins(otherEdge)+ ));+ if (hasRelevantAbsolutePin) classifyFailedAutomaticCandidatePins(edge, rawCandidates);+ const horizontallyFacing = (+ fromSide === 'right' && toSide === 'left' && end[0] > start[0]+ ) || (+ fromSide === 'left' && toSide === 'right' && start[0] > end[0]+ );+ if (horizontallyFacing && from.col !== to.col) {+ const fromCol = Math.min(from.col, to.col);+ const toCol = Math.max(from.col, to.col);+ const requiredRankGap = from.width / 2 + 32 + to.width / 2;+ const actualRankGap = layout.colXs[toCol] - layout.colXs[fromCol];+ if (actualRankGap + 0.0001 < requiredRankGap) {+ throw new WorkflowLayoutFeedback({+ kind: 'rank-gap-minimum',+ fromCol,+ toCol,+ minimum: Math.ceil(requiredRankGap * 1000) / 1000,+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ attemptedCandidateFamilies: rawCandidates.map(({ family }) => family),+ candidateCount: rawCandidates.length,+ });+ }+ }+ if (from.lane !== to.lane && layout.laneGap < 32) {+ throw new WorkflowLayoutFeedback({+ kind: 'lane-gap-minimum',+ minimum: 32,+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ attemptedCandidateFamilies: rawCandidates.map(({ family }) => family),+ candidateCount: rawCandidates.length,+ });+ }+ const message = `Workflow edge "${workflowEdgeName(edge)}" has no feasible readable-v2 automatic route.`;+ throwDiagnosticError(message, [{+ code: 'workflow/solver-budget-exhausted',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ },+ evidence: {+ attemptedCandidateFamilies: rawCandidates.map(({ family }) => family),+ candidateCount: rawCandidates.length,+ },+ supportedFixes: [],+ }]);+}++function readablePresetVia(edge, from, to, start, end, fromSide, toSide) {+ const preset = edge.route;+ let via;+ switch (preset) {+ case 'straight':+ via = [];+ break;+ case 'drop': {+ const y = gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);+ via = [[start[0], y], [end[0], y]];+ break;+ }+ case 'outside-right': {+ const x = layout.laneX + layout.laneW + 12;+ via = [[x, start[1]], [x, end[1]]];+ break;+ }+ case 'return-left': {+ const x = Math.min(from.x, to.x) - 28;+ via = [[x, start[1]], [x, end[1]]];+ break;+ }+ case 'bottom-channel': {+ const y = Math.max(from.y + from.height, to.y + to.height) + 32;+ via = [[start[0], y], [end[0], y]];+ break;+ }+ case 'up-channel': {+ const y = Math.min(from.y, to.y) - 28;+ via = [[start[0], y], [end[0], y]];+ break;+ }+ default:+ return readableAutomaticVia(edge, from, to, start, end, fromSide, toSide);+ }+ const points = normalizeRoutePoints([start, ...via, end]);+ if (readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide)+ && routeMatchesPresetFamily(preset, points, from, to)) {+ return points.slice(1, -1);+ }+ const message = `Workflow edge "${workflowEdgeName(edge)}" cannot satisfy route preset "${preset}" under readable-v2 constraints (minimum 8px endpoint stubs, 16px interior turns, and 28px direct clearance).`;+ const edgeIndex = workflow.edges.indexOf(edge);+ const edgeName = workflowEdgeName(edge);+ const supportedFixes = [];+ for (const candidatePreset of ['straight', 'drop', 'outside-right', 'return-left', 'bottom-channel', 'up-channel']) {+ if (candidatePreset === preset) continue;+ if (acceptsFix((document) => {+ document.edges[edgeIndex].route = candidatePreset;+ })) {+ supportedFixes.push(`set edge "${edgeName}" route to verified preset "${candidatePreset}"`);+ }+ }+ if (acceptsFix((document) => {+ delete document.edges[edgeIndex].route;+ })) {+ supportedFixes.push(`remove route from edge "${edgeName}" so readable-v2 can use its verified automatic candidate`);+ }+ throwDiagnosticError(message, [{+ code: 'workflow/route-preset-conflict',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ route: preset,+ },+ evidence: {+ attemptedCandidateFamily: preset,+ points,+ fromSide,+ toSide,+ requiredEndpointStubPx: 8,+ requiredInteriorSegmentPx: 16,+ requiredDirectClearancePx: 28,+ },+ supportedFixes,+ }]);+}++function routeVia(+ edge,+ from,+ to,+ start,+ end,+ fromSide,+ toSide,+ { validateReadablePreset = true } = {},+) {+ if (edge.via) return edge.via;+ const hasCoordinatePins = edge.channelX !== undefined || edge.channelY !== undefined;+ if (workflow.schema_version === 2+ && edge.route+ && edge.route !== 'auto'+ && !hasCoordinatePins+ && validateReadablePreset) {+ return readablePresetVia(edge, from, to, start, end, fromSide, toSide);+ }+ switch (edge.route || 'auto') {+ case 'straight':+ return [];+ case 'drop': {+ const y = edge.channelY ?? gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);+ return [[start[0], y], [end[0], y]];+ }+ case 'outside-right': {+ const x = edge.channelX ?? layout.laneX + layout.laneW + 12;+ return [[x, start[1]], [x, end[1]]];+ }+ case 'return-left': {+ const x = edge.channelX ?? Math.min(from.x, to.x) - 28;+ return [[x, start[1]], [x, end[1]]];+ }+ case 'bottom-channel': {+ const y = edge.channelY ?? Math.max(from.y + from.height, to.y + to.height) + 32;+ return [[start[0], y], [end[0], y]];+ }+ case 'up-channel': {+ const y = edge.channelY ?? Math.min(from.y, to.y) - 28;+ return [[start[0], y], [end[0], y]];+ }+ case 'auto':+ default: {+ if (workflow.schema_version === 2) {+ if (edge.channelX !== undefined && edge.channelY !== undefined) {+ return [[edge.channelX, start[1]], [edge.channelX, edge.channelY], [end[0], edge.channelY]];+ }+ if (edge.channelX !== undefined) return [[edge.channelX, start[1]], [edge.channelX, end[1]]];+ if (edge.channelY !== undefined) return [[start[0], edge.channelY], [end[0], edge.channelY]];+ return readableAutomaticVia(edge, from, to, start, end, fromSide, toSide);+ }+ if (from.lane === to.lane) return sameLaneAutoVia(start, end);+ const oneBendVia = oneBendCrossLaneVia(edge, start, end, fromSide, toSide);+ if (oneBendVia) return oneBendVia;+ const y = gapYBetween(from.lane, to.lane, edge.bias ?? 0.5);+ return [[start[0], y], [end[0], y]];+ }+ }+}++function workflowEdgeLabelPoint(edge, points) {+ if (workflow.schema_version === 1) {+ if (edge.labelAt || Number.isInteger(edge.labelSegment) || points.length !== 3) {+ return labelPoint(edge, points);+ }+ const segmentLengths = [0, 1].map((index) => Math.hypot(+ points[index + 1][0] - points[index][0],+ points[index + 1][1] - points[index][1],+ ));+ const labelSegment = segmentLengths[0] >= segmentLengths[1] ? 0 : 1;+ const point = labelPoint({ ...edge, labelSegment }, points);+ if (points[labelSegment][0] === points[labelSegment + 1][0]) point[1] += 10;+ return point;+ }+ if (edge.labelAt || Number.isInteger(edge.labelSegment) || points.length <= 2) {+ return labelPoint(edge, points);+ }+ const segments = points.slice(0, -1).map((point, index) => ({+ index,+ horizontal: Math.abs(points[index + 1][1] - point[1]) <= 0.0001,+ length: Math.hypot(+ points[index + 1][0] - point[0],+ points[index + 1][1] - point[1],+ ),+ })).sort((left, right) => (+ Number(right.horizontal) - Number(left.horizontal)+ || right.length - left.length+ || left.index - right.index+ ));+ const labelSegment = segments[0]?.index ?? 0;+ const point = labelPoint({ ...edge, labelSegment }, points);+ if (points[labelSegment][0] === points[labelSegment + 1][0]) point[1] += 10;+ return point;+}++function edgeSides(edge) {+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ const resolved = workflow.schema_version === 2 ? readableSideCache.get(edge) : null;+ if (resolved) return resolved;+ const oneBendSides = automaticOneBendSides(edge, from, to);+ if (oneBendSides) return oneBendSides;+ if (workflow.schema_version === 2+ && layout.channelLabelEdgeKeys?.has(stableValueKey(edge))+ && !edge.fromSide+ && !edge.toSide) {+ return { fromSide: 'top', toSide: 'top' };+ }+ return {+ fromSide: chosenSide(edge.fromSide, defaultFromSide(from, to)),+ toSide: chosenSide(edge.toSide, defaultToSide(from, to)),+ };+}++const automaticPorts = automaticPortSpread(workflow.edges, nodes, {+ sideFor: (edge, endpoint) => edgeSides(edge)[endpoint === 'source' ? 'fromSide' : 'toSide'],+});++function readableAutomaticRoute(edge, from, to, primarySides, primaryPorts) {+ const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null;+ const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null;+ const sideOrder = ['right', 'bottom', 'left', 'top'];+ const sidePairs = [primarySides];+ for (const fromSide of authoredFrom ? [authoredFrom] : sideOrder) {+ for (const toSide of authoredTo ? [authoredTo] : sideOrder) {+ sidePairs.push({ fromSide, toSide });+ }+ }++ const naturalFromSide = authoredFrom || defaultFromSide(from, to);+ const naturalToSide = authoredTo || defaultToSide(from, to);+ const seen = new Set();+ const plans = [];+ const feedback = [];+ let firstFailure = null;+ for (const candidateSides of sidePairs) {+ if (authoredFrom && candidateSides.fromSide !== authoredFrom) continue;+ if (authoredTo && candidateSides.toSide !== authoredTo) continue;+ const key = `${candidateSides.fromSide}:${candidateSides.toSide}`;+ if (seen.has(key)) continue;+ const pairOrdinal = seen.size;+ seen.add(key);+ const primary = pairOrdinal === 0;+ const start = primaryPorts?.from && primary+ ? primaryPorts.from+ : anchor(from, candidateSides.fromSide);+ const end = primaryPorts?.to && primary+ ? primaryPorts.to+ : anchor(to, candidateSides.toSide);+ const planned = readableAutomaticCandidateSet(+ edge,+ from,+ to,+ start,+ end,+ candidateSides.fromSide,+ candidateSides.toSide,+ {+ ordinalOffset: pairOrdinal * 9,+ naturalFromSide,+ naturalToSide,+ },+ );+ plans.push(...planned.candidates.map((candidate) => ({+ ...candidate,+ ...candidateSides,+ })));+ if (planned.candidates.length) continue;+ try {+ const expandedVia = withDiagnosticRecordingSuppressed(() => readableAutomaticVia(+ edge,+ from,+ to,+ start,+ end,+ candidateSides.fromSide,+ candidateSides.toSide,+ ));+ const expandedPoints = normalizeRoutePoints([start, ...expandedVia, end]);+ const outsideRightOrdinal = planned.rawCandidates.findIndex(({ family }) => (+ family === 'outside-right'+ ));+ const ordinal = pairOrdinal * 9 + Math.max(0, outsideRightOrdinal);+ plans.push({+ family: 'outside-right',+ ordinal,+ points: expandedPoints,+ cost: readableCandidateCost(+ edge,+ expandedPoints,+ ordinal,+ naturalFromSide,+ naturalToSide,+ ),+ ...candidateSides,+ });+ } catch (error) {+ if (error instanceof WorkflowLayoutFeedback) {+ feedback.push({ error, pairOrdinal });+ } else if (!firstFailure) {+ firstFailure = error;+ }+ }+ }++ plans.sort((left, right) => compareCost(left.cost, right.cost));+ if (plans.length) {+ const selected = plans[0];+ return {+ points: selected.points,+ fromSide: selected.fromSide,+ toSide: selected.toSide,+ };+ }++ const feedbackPriority = {+ 'rank-gap-minimum': 0,+ 'lane-gap-minimum': 1,+ };+ feedback.sort((left, right) => (+ (feedbackPriority[left.error.request?.kind] ?? 99)+ - (feedbackPriority[right.error.request?.kind] ?? 99)+ || left.pairOrdinal - right.pairOrdinal+ ));+ if (feedback.length) throw feedback[0].error;+ const authoredSideFields = [+ ...(authoredFrom ? ['fromSide'] : []),+ ...(authoredTo ? ['toSide'] : []),+ ];+ if (authoredSideFields.length) {+ const alternatives = verifiedPinRemovalAlternatives(+ edge,+ authoredSideFields,+ 'so readable-v2 can replan the remaining endpoint-side pins',+ );+ const sourceAnchor = primaryPorts?.from || anchor(from, primarySides.fromSide);+ const targetAnchor = primaryPorts?.to || anchor(to, primarySides.toSide);+ const attemptedEvidence = firstFailure?.archifyDiagnostics?.[0]?.evidence || {};+ throwExplicitPinConflict(edge, 'readable route feasibility with authored endpoint sides', {+ conflictingPins: conflictPinsFromRemovalSets(+ edge,+ alternatives.removalSets,+ authoredSideFields,+ ),+ actualCoordinates: {+ sourceAnchor: [...sourceAnchor],+ targetAnchor: [...targetAnchor],+ },+ fromSide: primarySides.fromSide,+ toSide: primarySides.toSide,+ ...(attemptedEvidence.attemptedCandidateFamilies+ ? { attemptedCandidateFamilies: attemptedEvidence.attemptedCandidateFamilies }+ : {}),+ ...(attemptedEvidence.candidateCount !== undefined+ ? { candidateCount: attemptedEvidence.candidateCount }+ : {}),+ }, alternatives.supportedFixes);+ }+ if (firstFailure) throw firstFailure;+ throw new Error('readable-v2 automatic route enumeration produced no result');+}++function isReadableControlledRoute(edge) {+ return workflow.schema_version === 2 && (+ Array.isArray(edge.via)+ || edge.channelX !== undefined+ || edge.channelY !== undefined+ || (edge.route && edge.route !== 'auto')+ );+}++function readableControlledRoute(edge, from, to) {+ const authoredFrom = edge.fromSide && edge.fromSide !== 'auto' ? edge.fromSide : null;+ const authoredTo = edge.toSide && edge.toSide !== 'auto' ? edge.toSide : null;+ const naturalFromSide = authoredFrom || defaultFromSide(from, to);+ const naturalToSide = authoredTo || defaultToSide(from, to);+ const sideOrder = ['right', 'bottom', 'left', 'top'];+ const preferredPairs = [{+ fromSide: naturalFromSide,+ toSide: naturalToSide,+ }];+ for (const fromSide of authoredFrom ? [authoredFrom] : sideOrder) {+ for (const toSide of authoredTo ? [authoredTo] : sideOrder) {+ preferredPairs.push({ fromSide, toSide });+ }+ }++ const seen = new Set();+ const sidePairs = preferredPairs.filter(({ fromSide, toSide }) => {+ if (authoredFrom && fromSide !== authoredFrom) return false;+ if (authoredTo && toSide !== authoredTo) return false;+ const key = `${fromSide}:${toSide}`;+ if (seen.has(key)) return false;+ seen.add(key);+ return true;+ });+ const hasAbsoluteRoutePins = Array.isArray(edge.via)+ || edge.channelX !== undefined+ || edge.channelY !== undefined;+ const candidates = [];+ const diagnosticCandidates = [];+ const materializedCandidates = [];+ for (const [ordinal, { fromSide, toSide }] of sidePairs.entries()) {+ const start = anchor(from, fromSide);+ const end = anchor(to, toSide);+ const via = routeVia(+ edge,+ from,+ to,+ start,+ end,+ fromSide,+ toSide,+ { validateReadablePreset: false },+ );+ const authoredPoints = [start, ...via, end];+ const points = hasAbsoluteRoutePins+ ? authoredPoints+ : normalizeRoutePoints(authoredPoints);+ const materialized = { points, fromSide, toSide, ordinal };+ materializedCandidates.push(materialized);+ if (points.length >= 2+ && points.every((point) => (+ Array.isArray(point) && point.length === 2 && isFinitePoint(...point)+ ))+ && routeHonorsEndpointSides(points, fromSide, toSide)) {+ diagnosticCandidates.push(materialized);+ }+ if (!readableCandidateIsFeasible(edge, points, from, to, fromSide, toSide)) continue;+ if (edge.route && edge.route !== 'auto' && !routeMatchesPresetFamily(+ edge.route,+ points,+ from,+ to,+ )) continue;+ if (presentChannelPins(edge).some((field) => (+ !routeContainsChannelPin(points, field, edge[field])+ ))) continue;+ candidates.push({+ points,+ fromSide,+ toSide,+ cost: readableCandidateCost(+ edge,+ points,+ ordinal,+ naturalFromSide,+ naturalToSide,+ ),+ });+ }+ candidates.sort((left, right) => compareCost(left.cost, right.cost));+ if (candidates.length) return candidates[0];++ // Absolute geometry is authoritative even when it is invalid. Preserve the+ // best endpoint-side inference so validation can diagnose the authored+ // segment or preset that actually failed instead of silently falling back to+ // default sides and changing the route's meaning.+ if (hasAbsoluteRoutePins) {+ return diagnosticCandidates[0] || materializedCandidates[0] || null;+ }++ // Preset-only routes retain their dedicated typed conflict (and verified+ // alternative search) when exhaustive side inference found no valid plan.+ const fallback = materializedCandidates[0];+ if (!fallback) return null;+ const fallbackVia = readablePresetVia(+ edge,+ from,+ to,+ fallback.points[0],+ fallback.points.at(-1),+ fallback.fromSide,+ fallback.toSide,+ );+ return {+ ...fallback,+ points: normalizeRoutePoints([+ fallback.points[0],+ ...fallbackVia,+ fallback.points.at(-1),+ ]),+ };+}++function pathFor(edge) {+ if (pathCache.has(edge)) return pathCache.get(edge);+ const from = nodes.get(edge.from);+ const to = nodes.get(edge.to);+ if (isReadableControlledRoute(edge)) {+ const planned = readableControlledRoute(edge, from, to);+ if (planned) {+ readableSideCache.set(edge, {+ fromSide: planned.fromSide,+ toSide: planned.toSide,+ });+ const routed = { d: polylinePath(planned.points), points: planned.points };+ pathCache.set(edge, routed);+ return routed;+ }+ }+ const ports = automaticPorts.get(edge);+ const { fromSide, toSide } = edgeSides(edge);+ const readableAutomatic = workflow.schema_version === 2+ && !Array.isArray(edge.via)+ && edge.channelX === undefined+ && edge.channelY === undefined+ && (!edge.route || edge.route === 'auto');+ if (readableAutomatic) {+ const planned = readableAutomaticRoute(+ edge,+ from,+ to,+ { fromSide, toSide },+ ports,+ );+ readableSideCache.set(edge, {+ fromSide: planned.fromSide,+ toSide: planned.toSide,+ });+ const routed = { d: polylinePath(planned.points), points: planned.points };+ pathCache.set(edge, routed);+ return routed;+ }+ const start = ports?.from || anchor(from, fromSide);+ const end = ports?.to || anchor(to, toSide);+ const authoredPoints = [start, ...routeVia(edge, from, to, start, end, fromSide, toSide), end];+ const hasAbsoluteRoutePins = Array.isArray(edge.via)+ || edge.channelX !== undefined+ || edge.channelY !== undefined;+ const points = workflow.schema_version === 2 && !hasAbsoluteRoutePins+ ? normalizeRoutePoints(authoredPoints)+ : authoredPoints;+ const routed = { d: polylinePath(points), points };+ pathCache.set(edge, routed);+ return routed;+}++function labelRectFor(edge, relationIndex) {+ if (!edge.label || !nodes.has(edge.from) || !nodes.has(edge.to)) return null;+ const [lx, ly] = workflowEdgeLabelPoint(edge, pathFor(edge).points);+ const width = workflowLabelWidth(edge.label);+ return {+ relation: edge,+ relationIndex,+ label: edge.label,+ x: lx - width / 2,+ y: ly - 10,+ width,+ height: 14,+ lx,+ ly,+ };+}++function measuredContentBounds() {+ let left = layout.laneX;+ let top = 27;+ let right = layout.laneX + layout.laneW;+ let bottom = legendY() + 18;+ const owners = {+ left: 'workflow lanes',+ top: asArray(workflow.phases).length ? 'phase header band' : 'workflow top padding',+ right: 'workflow lanes',+ bottom: workflowLegendEntries.length ? 'legend' : 'workflow lanes and bottom padding',+ };+ const includePoint = ([x, y], contributor) => {+ if (x < left) {+ left = x;+ owners.left = contributor;+ }+ if (y < top) {+ top = y;+ owners.top = contributor;+ }+ if (x > right) {+ right = x;+ owners.right = contributor;+ }+ if (y > bottom) {+ bottom = y;+ owners.bottom = contributor;+ }+ };+ const includeRect = (rect, contributor) => {+ includePoint([rect.x, rect.y], contributor);+ includePoint([rect.x + rect.width, rect.y + rect.height], contributor);+ };++ for (const node of nodes.values()) includeRect(node, `node ${node.id}`);+ for (const [index, edge] of workflow.edges.entries()) {+ if (!nodes.has(edge.from) || !nodes.has(edge.to)) continue;+ for (const point of pathFor(edge).points) includePoint(point, `edge ${edge.id || index}`);+ const label = labelRectFor(edge, index);+ if (label) includeRect(label, `edge ${edge.id || index} label mask`);+ }+ for (const phase of asArray(workflow.phases)) {+ if (!Number.isInteger(phase.fromCol) || !Number.isInteger(phase.toCol)+ || phase.fromCol < 0 || phase.toCol >= layout.colXs.length || phase.fromCol > phase.toCol) continue;+ const span = phaseSpan(phase);+ includeRect({ x: span.x, y: 27, width: span.width, height: 16 }, `phase ${phase.id}`);+ }+ for (const group of asArray(workflow.groups)) {+ if (!laneIndex.has(group.lane) || !Number.isInteger(group.fromCol) || !Number.isInteger(group.toCol)+ || group.fromCol < 0 || group.toCol >= layout.colXs.length || group.fromCol > group.toCol) continue;+ const span = groupSpan(group);+ includeRect({+ x: span.x,+ y: laneTop(group.lane) + layout.laneTitleH + GROUP_FRAME_TOP_INSET,+ width: span.width,+ height: workflow.schema_version === 2+ ? laneHeight(group.lane) - layout.laneTitleH+ - GROUP_FRAME_TOP_INSET - GROUP_FRAME_BOTTOM_INSET+ : layout.laneH - layout.laneTitleH - 16,+ }, `group ${group.id}`);+ if (workflow.schema_version === 2) {+ const frameY = laneTop(group.lane) + layout.laneTitleH + GROUP_FRAME_TOP_INSET;+ const labelBaseline = frameY + GROUP_LABEL_BASELINE_OFFSET;+ includeRect({+ x: span.x + 10,+ y: labelBaseline - GROUP_LABEL_MASK_ASCENT,+ width: textUnits(group.label) * 5.6,+ height: GROUP_LABEL_MASK_H,+ }, `group ${group.id} label`);+ }+ }+ if (workflowLegendEntries.length) {+ for (const rect of workflowLegendRects()) includeRect(rect, `legend ${rect.kind}`);+ }+ return {+ left,+ top,+ right,+ bottom,+ contributors: [...new Set([+ ...Object.values(owners),+ ...asArray(layout.widthContributors),+ ...asArray(layout.heightContributors),+ ])],+ };+}++function finalizeReadableViewBox() {+ if (workflow.schema_version !== 2) {+ requiredViewBox = [...viewBox];+ return;+ }+ const bounds = measuredContentBounds();+ requiredViewBox = [+ Math.max(minimumCanvasWidth, Math.ceil(bounds.right + 16)),+ Math.max(autoHeight, Math.ceil(bounds.bottom + 18)),+ ];+ const outsideOrigin = bounds.left < 0 || bounds.top < 0;+ if (outsideOrigin) {+ const hasAbsolutePins = workflow.edges.some((edge) => (+ Array.isArray(edge.via)+ || Array.isArray(edge.labelAt)+ || edge.channelX !== undefined+ || edge.channelY !== undefined+ ));+ const message = `Workflow geometry extends above or left of the viewBox origin (${Math.round(bounds.left)}, ${Math.round(bounds.top)}).`;+ throwDiagnosticError(message, [{+ code: hasAbsolutePins ? 'workflow/explicit-pin-conflict' : 'workflow/solver-budget-exhausted',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', path: '/meta/viewBox' },+ evidence: {+ actualViewBox: [...viewBox],+ requiredViewBox: [...requiredViewBox],+ contentBounds: [bounds.left, bounds.top, bounds.right, bounds.bottom],+ contributors: bounds.contributors,+ },+ supportedFixes: [],+ }]);+ }+ if (!workflow.meta?.viewBox) {+ viewBox = [...requiredViewBox];+ return;+ }+ const tooNarrow = viewBox[0] < requiredViewBox[0];+ const tooShort = viewBox[1] < requiredViewBox[1];+ if (!tooNarrow && !tooShort) return;+ const message = `Workflow viewBox ${viewBox[0]}×${viewBox[1]} cannot contain the readable-v2 layout; minimum ${requiredViewBox[0]}×${requiredViewBox[1]}.`;+ const supportedFixes = [];+ if (acceptsFix((document) => {+ document.meta.viewBox = [...requiredViewBox];+ })) {+ supportedFixes.push(`set meta.viewBox to at least [${requiredViewBox[0]}, ${requiredViewBox[1]}]`);+ }+ if (acceptsFix((document) => {+ delete document.meta.viewBox;+ })) {+ supportedFixes.push('omit meta.viewBox so the compiler can use its measured intrinsic canvas');+ }+ throwDiagnosticError(message, [{+ code: 'workflow/viewbox-capacity',+ severity: 'error',+ message,+ subject: { diagramType: 'workflow', path: '/meta/viewBox' },+ evidence: {+ actualViewBox: [...viewBox],+ requiredViewBox: [...requiredViewBox],+ contentBounds: [bounds.left, bounds.top, bounds.right, bounds.bottom],+ contributors: bounds.contributors,+ },+ supportedFixes,+ }]);+}++function renderLane(lane, index) {+ const y = laneTop(lane.id);+ const height = laneHeight(index);+ const exception = lane.variant === 'exception'+ ? `\n <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-${index}-exception" x="${layout.laneX + 6}" y="${y + 6}" width="${layout.laneW - 12}" height="${height - 12}" rx="8" class="c-security-group" stroke-width="1"/>`+ : '';+ const labelClass = lane.variant === 'exception' ? 't-security' : 't-dim';+ const prefix = lane.variant === 'exception' ? 'EX' : String(index + 1).padStart(2, '0');+ return ` <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-${index}" x="${layout.laneX}" y="${y}" width="${layout.laneW}" height="${height}" rx="10" class="c-lane" stroke-width="1"/>${exception}+ <text x="${layout.laneX + 14}" y="${y + 22}" class="${labelClass}" font-size="10" font-weight="600">${prefix} / ${esc(lane.label)}</text>`;+}++function renderPhase(phase) {+ const span = phaseSpan(phase);+ const accent = variantAccent(phase.variant);+ const [lineClass] = arrowClassMap[phase.variant || 'default'] || arrowClassMap.default;+ return ` <line x1="${span.x}" y1="35" x2="${span.x + span.width}" y2="35" class="${lineClass}" stroke-width="1.1"/>+ <rect x="${span.x}" y="27" width="${span.width}" height="16" rx="4" class="c-mask"/>+ <text x="${span.cx}" y="39" class="${accent}" font-size="8" font-weight="600" text-anchor="middle">${esc(phase.label)}</text>`;+}++function renderGroup(group, index) {+ const span = groupSpan(group);+ const y = laneTop(group.lane) + layout.laneTitleH + GROUP_FRAME_TOP_INSET;+ const height = workflow.schema_version === 2+ ? laneHeight(group.lane) - layout.laneTitleH+ - GROUP_FRAME_TOP_INSET - GROUP_FRAME_BOTTOM_INSET+ : layout.laneH - layout.laneTitleH - 16;+ const cls = group.variant === 'security' ? 'c-security-group' : 'c-lane';+ const textClass = variantAccent(group.variant);+ const labelY = workflow.schema_version === 2 ? y + GROUP_LABEL_BASELINE_OFFSET : y + 14;+ return ` <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-${index}" x="${span.x}" y="${y}" width="${span.width}" height="${height}" rx="9" class="${cls}" stroke-width="1"/>+ <text x="${span.x + 10}" y="${labelY}" class="${textClass}" font-size="7" font-weight="600">${esc(group.label)}</text>`;+}++function renderNode(node) {+ const fill = componentFill[node.type] || 'c-external';+ const accent = componentText[node.type] || 't-muted';+ const hasSub = node.sublabel != null && node.sublabel !== '';+ const labelFontSize = fittedNodeFontSize(node.label, brandLabelFitWidth(node, node.width), nodeTextFit.labelPreferred, nodeTextFit.labelMinimum);+ const sublabelFontSize = hasSub+ ? fittedNodeFontSize(node.sublabel, node.width, nodeTextFit.sublabelPreferred, nodeTextFit.sublabelMinimum)+ : nodeTextFit.sublabelPreferred;+ const sub = hasSub+ ? `\n <text data-detail="context" x="${node.cx}" y="${node.y + 38}" class="t-muted" font-size="${sublabelFontSize}" text-anchor="middle">${esc(node.sublabel)}</text>`+ : '';+ const tag = node.tag+ ? `\n <text data-detail="fine" x="${node.cx}" y="${node.y + node.height - 12}" class="${accent}" font-size="${fittedNodeFontSize(node.tag, node.width, nodeTextFit.tagPreferred, nodeTextFit.tagMinimum)}" text-anchor="middle">${esc(node.tag)}</text>`+ : '';+ const brand = renderBrandMark(node, { x: node.x + node.width - 22, y: node.y + 6 });+ const passport = { kind: node.type, sublabel: node.sublabel, tag: node.tag, context: nodeContext(node), ...brandMetadataFor(node) };+ return ` <g ${focusNodeAttrs(node.id, node.label, passport, workflow.meta.locale)}>+ ${focusNodeTitle(node.label, passport)}+ <rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="c-mask"/>+ <rect x="${node.x}" y="${node.y}" width="${node.width}" height="${node.height}" rx="6" class="${fill}"${animateAttr(workflow.meta, 'node', nodeStep(node))} stroke-width="1.5"/>+ ${renderSemanticSigil(node.type, { x: node.x + 6, y: node.y + 6 })}${brand ? `\n ${brand}` : ''}+ <text data-node-label=""${hasSub ? ' data-detail-anchor=""' : ''} x="${node.cx}" y="${node.y + 21}" class="t-primary" font-size="${labelFontSize}" font-weight="600" text-anchor="middle">${esc(node.label)}</text>${sub}${tag}+ </g>`;+}++function renderEdgePath(edge, index) {+ const [cls, marker] = arrowClassMap[edge.variant || 'default'] || arrowClassMap.default;+ const routed = pathFor(edge);+ const strokeWidth = edge.width || (edge.variant === 'emphasis' ? 1.8 : 1.4);+ return ` <path ${focusEdgeAttrs(edge.from, edge.to, edge.label, index, edge.id)} data-composition-points="${routePointsValue(routed.points)}" d="${routed.d}" class="${cls}"${animateAttr(workflow.meta, 'edge', edgeSteps.get(edge))} stroke-width="${strokeWidth}" marker-end="url(#${marker})"/>`;+}++function renderEdgeLabel(edge, index) {+ if (!edge.label) return '';+ const routed = pathFor(edge);+ const [lx, ly] = workflowEdgeLabelPoint(edge, routed.points);+ const labelW = workflowLabelWidth(edge.label);+ return ` <g data-detail="context" ${focusEdgeAttrs(edge.from, edge.to, edge.label, index, edge.id)}>+ <rect x="${lx - labelW / 2}" y="${ly - 10}" width="${labelW}" height="14" rx="3" class="c-mask"/>+ <text x="${lx}" y="${ly}" class="${variantAccent(edge.variant, { dashed: 't-database' })}" font-size="8" text-anchor="middle">${esc(edge.label)}</text>+ </g>`;+}++function renderLegend() {+ const obstacles = workflow.schema_version === 2+ ? relationshipLegendObstacles(workflow.edges, {+ pointsFor: (edge) => pathFor(edge).points,+ labelRectFor,+ })+ : [];+ return renderResolvedLegend({+ entries: workflowLegendEntries,+ locale: workflow.meta.locale,+ layout: workflowLegendLayout(obstacles),+ renderSwatch: (entry) => `<rect x="${entry.x}" y="${entry.baseline - 8}" width="14" height="9" rx="2" class="${componentFill[entry.kind] || 'c-external'}" stroke-width="1"/>`,+ });+}++function renderSvg() {+ return ` <svg viewBox="0 0 ${viewBox[0]} ${viewBox[1]}" ${svgRootAttrs(workflow.meta, 'workflow diagram')}>+${svgAccessibleText(workflow.meta, 'workflow')}+${renderDefinitions()}++ <!-- Background Grid -->+ <rect width="100%" height="100%" fill="url(#grid)" />++ <!-- Swimlanes -->+${workflow.lanes.map(renderLane).join('\n\n')}++ <!-- Phase headers -->+${asArray(workflow.phases).map(renderPhase).join('\n')}++ <!-- Workflow groups -->+${asArray(workflow.groups).map(renderGroup).join('\n')}++ <!-- Edge paths -->+${workflow.edges.map(renderEdgePath).join('\n')}++ <!-- Nodes -->+${[...nodes.values()].map(renderNode).join('\n\n')}++ <!-- Edge labels -->+${workflow.edges.map(renderEdgeLabel).join('\n')}++ <!-- Legend -->+${renderLegend()}+ </svg>`;+}+++ try {+ validateReadableInputsBeforeRouting();+ validateReadablePinnedGeometry();+ validateWorkflow();+ finalizeReadableViewBox();+ const svg = renderSvg();+ const receipt = {+ contract: layout.contract,+ viewBox: [...viewBox],+ requiredViewBox: [...requiredViewBox],+ columns: [...layout.colXs],+ nodes: [...nodes.values()].map((node) => ({+ id: node.id,+ lane: node.lane,+ col: node.col,+ x: node.x,+ y: node.y,+ width: node.width,+ height: node.height,+ })),+ edges: workflow.edges.map((edge) => ({+ id: edge.id ?? null,+ from: edge.from,+ to: edge.to,+ points: pathFor(edge).points.map((point) => [...point]),+ })),+ labels: workflow.edges.flatMap((edge) => {+ if (!edge.label || !nodes.has(edge.from) || !nodes.has(edge.to)) return [];+ const [x, y] = workflowEdgeLabelPoint(edge, pathFor(edge).points);+ return [{ edge: edge.id ?? null, label: edge.label, x, y, width: workflowLabelWidth(edge.label), height: 14 }];+ }),+ diagnostics: [],+ };+ return { ok: true, svg, receipt };+ } catch (error) {+ if (!Array.isArray(error?.archifyDiagnostics)) throw error;+ const diagnostics = error.archifyDiagnostics.map((diagnostic) => ({ ...diagnostic }));+ return compilerFailure(layout.contract, diagnostics, error.message);+ }+}++function feedbackFailure(request) {+ const message = `Workflow edge "${request.edge || `${request.from}->${request.to}`}" exhausted bounded readable-v2 layout feedback without a feasible automatic route.`;+ const diagnostics = [{+ code: 'workflow/solver-budget-exhausted',+ severity: 'error',+ message,+ subject: {+ diagramType: 'workflow',+ edge: request.edge,+ from: request.from,+ to: request.to,+ },+ evidence: {+ attemptedCandidateFamilies: request.attemptedCandidateFamilies,+ candidateCount: request.candidateCount,+ },+ supportedFixes: [],+ }];+ return compilerFailure('readable-v2', diagnostics, message);+}++function compileWorkflowWithFeedback({ workflow, qualityProfile, discoverFixes = true } = {}) {+ let layoutFeedback = {};+ for (let attempt = 0; attempt <= MAX_READABLE_LAYOUT_FEEDBACK_ROUNDS; attempt += 1) {+ try {+ return compileWorkflowInternal({+ workflow,+ qualityProfile,+ discoverFixes,+ layoutFeedback,+ });+ } catch (error) {+ if (!(error instanceof WorkflowLayoutFeedback)) throw error;+ const request = error.request;+ let nextFeedback = null;+ if (request.kind === 'rank-gap-minimum'+ && Number.isInteger(request.fromCol)+ && Number.isInteger(request.toCol)+ && Number.isFinite(request.minimum)) {+ const key = `${request.fromCol}:${request.toCol}`;+ const current = layoutFeedback.rankGapMinimums?.[key] ?? -Infinity;+ if (request.minimum > current + 0.0001) {+ nextFeedback = {+ ...layoutFeedback,+ rankGapMinimums: {+ ...(layoutFeedback.rankGapMinimums || {}),+ [key]: request.minimum,+ },+ rankGapContributors: {+ ...(layoutFeedback.rankGapContributors || {}),+ [key]: [+ `rank ${request.fromCol}→${request.toCol} route clearance`,+ `edge ${request.edge || `${request.from}->${request.to}`} route`,+ ],+ },+ };+ }+ } else if (request.kind === 'lane-gap-minimum'+ && Number.isFinite(request.minimum)+ && request.minimum > (layoutFeedback.laneGapMin ?? -Infinity) + 0.0001) {+ nextFeedback = {+ ...layoutFeedback,+ laneGapMin: request.minimum,+ laneGapContributors: [+ `edge ${request.edge || `${request.from}->${request.to}`} lane-gap route clearance`,+ ],+ };+ }+ if (!nextFeedback || attempt === MAX_READABLE_LAYOUT_FEEDBACK_ROUNDS) {+ return feedbackFailure(request);+ }+ layoutFeedback = nextFeedback;+ }+ }+ throw new Error('unreachable readable-v2 layout feedback state');+}++export function compileWorkflow({ workflow, qualityProfile } = {}) {+ return compileWorkflowWithFeedback({ workflow, qualityProfile });+}diff --git a/archify/renderers/workflow/workflow-migration-geometry.mjs b/archify/renderers/workflow/workflow-migration-geometry.mjsnew file mode 100644index 00000000..00533871--- /dev/null+++ b/archify/renderers/workflow/workflow-migration-geometry.mjs@@ -0,0 +1,144 @@+const TARGET_SCHEMA_VERSION = 2;++function clone(value) {+ return JSON.parse(JSON.stringify(value));+}++/**+ * Return the authored workflow as a schema-v2 document without its capacity+ * override. The compiler can use this projection to discover the intrinsic v2+ * rank plan before deciding whether an explicit viewBox needs to grow.+ */+export function intrinsicWorkflow(workflow) {+ const intrinsic = clone(workflow);+ intrinsic.schema_version = TARGET_SCHEMA_VERSION;+ intrinsic.meta = { ...intrinsic.meta };+ delete intrinsic.meta.viewBox;+ return intrinsic;+}++/**+ * Return a schema-v2 planning projection that removes authored route geometry+ * which may only become valid after its legacy X coordinates are remapped.+ * Rank-affecting automatic and straight relationships remain in the projection.+ */+export function planningWorkflow(workflow) {+ const planned = intrinsicWorkflow(workflow);+ planned.edges = planned.edges.flatMap((edge) => {+ const hasRoutedGeometry = Array.isArray(edge.via)+ || (edge.route && !['auto', 'straight'].includes(edge.route))+ || edge.channelX !== undefined+ || edge.channelY !== undefined;+ if (hasRoutedGeometry) return [];++ const automatic = {};+ for (const property of ['id', 'from', 'to', 'variant', 'role', 'width']) {+ if (edge[property] !== undefined) automatic[property] = edge[property];+ }+ if (edge.route === 'straight') automatic.route = 'straight';+ if (edge.labelAt === undefined && edge.label !== undefined) automatic.label = edge.label;+ return [automatic];+ });++ if (Array.isArray(planned.mainPath)) {+ const projectedPairs = new Set(planned.edges.map((edge) => `${edge.from}\u0000${edge.to}`));+ const projectionBreaksMainPath = planned.mainPath.some((from, index) => (+ index < planned.mainPath.length - 1+ && !projectedPairs.has(`${from}\u0000${planned.mainPath[index + 1]}`)+ ));+ if (projectionBreaksMainPath) delete planned.mainPath;+ }++ return planned;+}++function mappedNumber(value) {+ return Number(value.toFixed(6));+}++/**+ * Build a deterministic piecewise-linear mapping between corresponding legacy+ * and readable rank centers. Coordinates outside the rank span are extrapolated+ * using the nearest segment so explicitly authored outside corridors retain+ * their relative offset.+ */+export function createHorizontalRankMapper(oldColumns, newColumns) {+ if (+ !Array.isArray(oldColumns)+ || !Array.isArray(newColumns)+ || oldColumns.length !== newColumns.length+ || oldColumns.length < 2+ || !oldColumns.every(Number.isFinite)+ || !newColumns.every(Number.isFinite)+ ) {+ throw new TypeError('Horizontal rank mapping requires matching finite column arrays.');+ }+ for (let index = 1; index < oldColumns.length; index += 1) {+ if (oldColumns[index] <= oldColumns[index - 1] || newColumns[index] <= newColumns[index - 1]) {+ throw new TypeError('Horizontal rank mapping requires strictly increasing columns.');+ }+ }++ return (x) => {+ if (!Number.isFinite(x)) throw new TypeError('Horizontal rank mapping requires a finite x coordinate.');+ let segment = oldColumns.length - 2;+ if (x <= oldColumns[0]) {+ segment = 0;+ } else {+ for (let index = 0; index < oldColumns.length - 1; index += 1) {+ if (x <= oldColumns[index + 1]) {+ segment = index;+ break;+ }+ }+ }+ const oldSpan = oldColumns[segment + 1] - oldColumns[segment];+ const newSpan = newColumns[segment + 1] - newColumns[segment];+ const ratio = (x - oldColumns[segment]) / oldSpan;+ return mappedNumber(newColumns[segment] + ratio * newSpan);+ };+}++/**+ * Apply one horizontal coordinate mapping to every schema-v1 absolute X pin.+ * The caller owns the supplied workflow; this function reports an audit trail+ * for each changed coordinate in stable document order.+ */+export function mapExplicitCoordinates(workflow, mapX) {+ const changedCoordinates = [];+ const record = (path, owner, property) => {+ const from = owner[property];+ const to = mapX(from);+ owner[property] = to;+ if (to !== from) changedCoordinates.push({ path, from, to });+ };++ for (const [edgeIndex, edge] of workflow.edges.entries()) {+ if (Array.isArray(edge.via)) {+ for (const [pointIndex, point] of edge.via.entries()) {+ if (Array.isArray(point) && Number.isFinite(point[0])) {+ record(`/edges/${edgeIndex}/via/${pointIndex}/0`, point, 0);+ }+ }+ }+ if (Array.isArray(edge.labelAt) && Number.isFinite(edge.labelAt[0])) {+ record(`/edges/${edgeIndex}/labelAt/0`, edge.labelAt, 0);+ }+ if (Number.isFinite(edge.channelX)) {+ record(`/edges/${edgeIndex}/channelX`, edge, 'channelX');+ }+ }+ return changedCoordinates;+}++/**+ * Construct an independently owned schema-v2 candidate with all authored+ * absolute X pins mapped to the readable rank plan.+ */+export function createMappedWorkflowCandidate(workflow, oldColumns, newColumns) {+ const document = clone(workflow);+ document.schema_version = TARGET_SCHEMA_VERSION;+ const mapX = createHorizontalRankMapper(oldColumns, newColumns);+ const changedCoordinates = mapExplicitCoordinates(document, mapX);+ return { document, changedCoordinates };+}diff --git a/archify/schemas/README.md b/archify/schemas/README.mdindex e667c032..4a43011c 100644--- a/archify/schemas/README.md+++ b/archify/schemas/README.md@@ -45,7 +45,7 @@ and an optional short `note`.### Legend presentation contractEvery `meta` object accepts the same optional legend shape without changing-`schema_version: 1`:+the schema version already selected for that renderer:```json"legend": {@@ -109,14 +109,26 @@ output.## schema_version policy-`schema_version` is `"const": 1`. The constant pins the IR contract: a file-that validates today keeps validating and rendering on every 2.x release.-Additive viewer, accessibility, and presentation improvements may enhance the-generated HTML, but they must not reinterpret authored IR or turn a previously-valid profile-less v1 file into a new hard layout failure. A breaking change to-any IR shape bumps the constant to `2`; renderers will then reject version-1-files with a clear schema error instead of misrendering them. Additive,-backwards-compatible fields do not bump the version.+Workflow supports schema versions 1 and 2. Version 1 remains the fixed-layout+compatibility contract; version 2 opts into the readable workflow compiler and+can be produced explicitly with `archify migrate workflow ... --to-schema 2`.+The other four diagram schemas keep `schema_version` pinned to `1`.++Workflow also accepts optional `semanticChecks`. `allowedRoots` and+`allowedTerminals` close the set of intentional graph sources and sinks;+`requiredEdges` requires exact authored relationships; and `requiredPaths`+requires directed reachability while allowing intermediate nodes. The compiler+evaluates these facts before layout and returns typed `workflow/*` diagnostics.+The field is additive and geometry-neutral: omitting it preserves existing+workflow behavior and including a satisfied contract does not change SVG or+layout-receipt bytes.++A file that validates today must keep validating and rendering within its+declared version throughout the 2.x release line. Additive viewer,+accessibility, and presentation improvements may enhance generated HTML, but+they must not reinterpret authored IR or turn a previously valid profile-less+v1 file into a new hard layout failure. Breaking IR changes require a new+version; additive, backwards-compatible fields do not.## Shared definitions (common.schema.json)diff --git a/archify/schemas/workflow.schema.json b/archify/schemas/workflow.schema.jsonindex 237f7f90..1ccaf17f 100644--- a/archify/schemas/workflow.schema.json+++ b/archify/schemas/workflow.schema.json@@ -14,7 +14,10 @@],"properties": {"schema_version": {- "const": 1+ "enum": [+ 1,+ 2+ ]},"diagram_type": {"const": "workflow"@@ -40,13 +43,24 @@"type": "string"},"animation": {- "$ref": "common.schema.json#/$defs/animation"+ "enum": [+ "trace",+ "none"+ ]},"visual_preset": {- "$ref": "common.schema.json#/$defs/visualPreset"+ "enum": [+ "classic",+ "signal-flow",+ "blueprint",+ "editorial"+ ]},"quality_profile": {- "$ref": "common.schema.json#/$defs/qualityProfile"+ "enum": [+ "standard",+ "showcase"+ ]},"views": {"$ref": "common.schema.json#/$defs/guidedViews"@@ -146,7 +160,12 @@"maximum": 5},"variant": {- "$ref": "common.schema.json#/$defs/variant"+ "enum": [+ "default",+ "emphasis",+ "security",+ "dashed"+ ]}}}@@ -185,7 +204,12 @@"maximum": 5},"variant": {- "$ref": "common.schema.json#/$defs/variant"+ "enum": [+ "default",+ "emphasis",+ "security",+ "dashed"+ ]}}}@@ -197,6 +221,37 @@"$ref": "common.schema.json#/$defs/id"}},+ "semanticChecks": {+ "type": "object",+ "additionalProperties": false,+ "minProperties": 1,+ "properties": {+ "allowedRoots": {+ "type": "array",+ "items": {+ "$ref": "common.schema.json#/$defs/id"+ }+ },+ "allowedTerminals": {+ "type": "array",+ "items": {+ "$ref": "common.schema.json#/$defs/id"+ }+ },+ "requiredEdges": {+ "type": "array",+ "items": {+ "$ref": "#/$defs/semanticRelation"+ }+ },+ "requiredPaths": {+ "type": "array",+ "items": {+ "$ref": "#/$defs/semanticRelation"+ }+ }+ }+ },"nodes": {"type": "array","minItems": 1,@@ -287,10 +342,10 @@]},"fromSide": {- "$ref": "common.schema.json#/$defs/side"+ "$ref": "#/$defs/side"},"toSide": {- "$ref": "common.schema.json#/$defs/side"+ "$ref": "#/$defs/side"},"route": {"enum": [@@ -334,7 +389,8 @@"maximum": 1},"width": {- "$ref": "common.schema.json#/$defs/relationshipWidth"+ "type": "number",+ "minimum": 0.5}}}@@ -342,5 +398,31 @@"cards": {"$ref": "common.schema.json#/$defs/cards"}+ },+ "$defs": {+ "semanticRelation": {+ "type": "object",+ "additionalProperties": false,+ "required": [+ "from",+ "to"+ ],+ "properties": {+ "from": {+ "$ref": "common.schema.json#/$defs/id"+ },+ "to": {+ "$ref": "common.schema.json#/$defs/id"+ }+ }+ },+ "side": {+ "enum": [+ "left",+ "right",+ "top",+ "bottom"+ ]+ }}}diff --git a/archify/test/authoring-safety-contract.test.mjs b/archify/test/authoring-safety-contract.test.mjsindex 3acc7e8b..07a4fa7b 100644--- a/archify/test/authoring-safety-contract.test.mjs+++ b/archify/test/authoring-safety-contract.test.mjs@@ -11,17 +11,25 @@ const authoringContract = fs.readFileSync(path.join(skillRoot, 'references', 'authoring-contract.md'),'utf8',);+const schemaReadme = fs.readFileSync(path.join(skillRoot, 'schemas', 'README.md'), 'utf8');-test('relationship labels remain semantic data and deletion is an auditable last resort', () => {+test('semantic relationship labels are preserved and deletion is not a geometry repair', () => {for (const [name, source] of [['SKILL.md', skill], ['authoring contract', authoringContract]]) {assert.match(source, /Relationship labels are semantic data/i, name);assert.match(source, /move the label[\s\S]*adjust the route or spacing[\s\S]*shorten/i, name);assert.match(source, /protocol[\s\S]*action[\s\S]*direction[\s\S]*synchronous[\s\S]*asynchronous[\s\S]*cross-boundary mechanism/i, name);- assert.match(source, /Never\s+delete[\s\S]*merely to pass `?showcase`?/i, name);- assert.match(source, /explain why[\s\S]*redundant/i, name);+ assert.match(source, /Omit only wording[\s\S]*fully implied by both endpoints/i, name);+ assert.match(source, /Preserve every meaningful label/i, name);+ assert.match(source, /deleting it is not\s+a (?:geometry|spacing) repair/i, name);}});+test('schema policy documents the workflow v1/v2 compatibility boundary', () => {+ assert.match(schemaReadme, /Workflow[^\n]*schema versions? 1 and 2/i);+ assert.match(schemaReadme, /other four[^\n]*schema_version[^\n]*1/i);+ assert.doesNotMatch(schemaReadme, /schema_version` is `"const": 1`/);+});+test('deployment ownership stays explicit, fact-backed, and cannot be removed to pass', () => {assert.match(skill, /Omit `meta\.engineering_profile` by default/);assert.match(skill, /Region.*cluster.*security boundar.*do not.*enable/i);diff --git a/archify/test/cli.test.mjs b/archify/test/cli.test.mjsindex b0b756ab..7e3f5eda 100644--- a/archify/test/cli.test.mjs+++ b/archify/test/cli.test.mjs@@ -78,6 +78,7 @@ test('cli: help lists commands and diagram types', () => {assert.match(result.stdout, /archify preview <type>/);assert.match(result.stdout, /archify visual-check <output\.html>/);assert.match(result.stdout, /--open/);+ assert.match(result.stdout, /--repo-root path \(architecture only\)/);assert.match(result.stdout, /archify guide \[scenario or question\]/);assert.match(result.stdout, /archify doctor/);assert.match(result.stdout, /archify demo \[output-directory\]/);@@ -613,6 +614,54 @@ test('cli: validate emits structured json without keeping html output', () => {assert.deepEqual(new Set(fs.readdirSync(tmp)), before);});+test('cli: validate JSON exposes only the primary v1 column-capacity diagnostic', () => {+ const input = path.join(tmp, 'pinned-column-capacity.workflow.json');+ fs.writeFileSync(input, `${JSON.stringify({+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Pinned issue 126 diagnostic boundary',+ viewBox: [720, 400],+ legend: { mode: 'hidden' },+ },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ fromSide: 'top',+ toSide: 'top',+ via: [[220, 60], [300, 60]],+ }],+ }, null, 2)}\n`);++ const result = run(['validate', 'workflow', input, '--json'], {+ env: { ...process.env, ARCHIFY_DIAGNOSTIC_FORMAT: 'json' },+ });++ assert.equal(result.status, 1, result.stderr || result.stdout);+ assert.equal(result.stderr, '');+ const failure = JSON.parse(result.stdout);+ assert.equal(failure.ok, false);+ assert.equal(failure.command, 'validate');+ assert.equal(failure.stage, 'render');+ assert.equal(failure.type, 'workflow');+ assert.equal(failure.diagnostics.length, 1, JSON.stringify(failure.diagnostics, null, 2));+ const [primary] = failure.diagnostics;+ assert.equal(primary.code, 'workflow/column-capacity');+ assert.equal(primary.subject.edge, 'ab');+ assert.equal(primary.subject.fromCol, 1);+ assert.equal(primary.subject.toCol, 2);+ assert.ok(primary.supportedFixes.length > 0);+ assert.ok(failure.diagnostics.every(({ code }) => (+ code !== 'workflow/explicit-pin-conflict' && code !== 'workflow/viewbox-capacity'+ )));+});+test('cli: --quality overrides the source profile for render, validate, and deliver', () => {const input = path.join(skillRoot, 'examples/agent-tool-call.workflow.json');const out = path.join(tmp, 'workflow-standard.html');@@ -650,6 +699,35 @@ test('cli: rejects a quality flag without a value', () => {}});+test('cli: validate rejects unknown flags, layout-json assignment typos, and extra positionals', () => {+ const input = path.join(skillRoot, 'examples/agent-tool-call.workflow.json');+ const cases = [+ {+ args: ['validate', 'workflow', input, '--layout-json', '--bogus'],+ pattern: /Unknown validate option "--bogus"/,+ },+ {+ args: ['validate', 'workflow', input, '--layout-json=true'],+ pattern: /Unknown validate option "--layout-json=true"/,+ },+ {+ args: ['validate', 'workflow', input, '--layout-json=true', '--json'],+ pattern: /Unknown validate option "--layout-json=true"/,+ },+ {+ args: ['validate', 'workflow', input, 'unexpected-output.html', '--layout-json'],+ pattern: /Usage:/,+ },+ ];++ for (const { args, pattern } of cases) {+ const result = run(args);+ assert.equal(result.status, 2, `${args.join(' ')}\n${result.stderr}\n${result.stdout}`);+ assert.equal(result.stdout, '');+ assert.match(result.stderr, pattern);+ }+});+test('cli: inspect emits architecture layout json', () => {const input = path.resolve(skillRoot, '../examples/archify-repo-grid.architecture.json');const result = run(['inspect', 'architecture', input]);@@ -662,6 +740,14 @@ test('cli: inspect emits architecture layout json', () => {assert.ok(parsed.connections.length >= 1);});+test('cli: inspect remains architecture-only while workflow uses validate --layout-json', () => {+ const input = path.join(skillRoot, 'examples', 'agent-tool-call.workflow.json');+ const result = run(['inspect', 'workflow', input]);+ assert.equal(result.status, 2);+ assert.match(result.stderr, /inspect is currently supported for architecture diagrams only/);+ assert.equal(result.stdout, '');+});+test('cli: validate returns renderer errors for bad input', () => {const input = path.join(tmp, 'bad.workflow.json');const validateTmp = path.join(tmp, 'validate-failure-tmp');diff --git a/archify/test/fixtures/fail-migration-cleanup.mjs b/archify/test/fixtures/fail-migration-cleanup.mjsnew file mode 100644index 00000000..8ea2af51--- /dev/null+++ b/archify/test/fixtures/fail-migration-cleanup.mjs@@ -0,0 +1,17 @@+import fs from 'node:fs';+import path from 'node:path';++const originalRmSync = fs.rmSync.bind(fs);+let injectedFailure = false;++fs.rmSync = function failMigrationCleanupOnce(target, options) {+ const isMigrationStagingDirectory = path.basename(String(target)).startsWith('.archify-migration-');+ if (!injectedFailure && isMigrationStagingDirectory) {+ injectedFailure = true;+ originalRmSync(target, options);+ const error = new Error('simulated migration cleanup failure');+ error.code = 'EPERM';+ throw error;+ }+ return originalRmSync(target, options);+};diff --git a/archify/test/fixtures/issue-126/custom-widths.workflow.json b/archify/test/fixtures/issue-126/custom-widths.workflow.jsonnew file mode 100644index 00000000..68bd7207--- /dev/null+++ b/archify/test/fixtures/issue-126/custom-widths.workflow.json@@ -0,0 +1,18 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": {+ "title": "Sanitized custom widths",+ "legend": { "mode": "hidden" }+ },+ "lanes": [+ { "id": "main", "label": "Main flow" }+ ],+ "nodes": [+ { "id": "compact", "lane": "main", "col": 1, "type": "frontend", "label": "In", "width": 32 },+ { "id": "wide", "lane": "main", "col": 2, "type": "database", "label": "Sanitized downstream service", "width": 240 }+ ],+ "edges": [+ { "id": "compact-wide", "from": "compact", "to": "wide" }+ ]+}diff --git a/archify/test/fixtures/issue-126/explicit-route.workflow.json b/archify/test/fixtures/issue-126/explicit-route.workflow.jsonnew file mode 100644index 00000000..6d573797--- /dev/null+++ b/archify/test/fixtures/issue-126/explicit-route.workflow.json@@ -0,0 +1,28 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": {+ "title": "Sanitized explicit route",+ "viewBox": [900, 420],+ "legend": { "mode": "hidden" }+ },+ "lanes": [+ { "id": "source", "label": "Source" },+ { "id": "target", "label": "Target" }+ ],+ "nodes": [+ { "id": "producer", "lane": "source", "col": 1, "type": "backend", "label": "Producer" },+ { "id": "consumer", "lane": "target", "col": 1, "type": "backend", "label": "Consumer" }+ ],+ "edges": [+ {+ "id": "producer-consumer",+ "from": "producer",+ "to": "consumer",+ "fromSide": "right",+ "toSide": "right",+ "route": "outside-right",+ "channelX": 720+ }+ ]+}diff --git a/archify/test/fixtures/issue-126/explicit-viewbox.workflow.json b/archify/test/fixtures/issue-126/explicit-viewbox.workflow.jsonnew file mode 100644index 00000000..f09740f0--- /dev/null+++ b/archify/test/fixtures/issue-126/explicit-viewbox.workflow.json@@ -0,0 +1,19 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": {+ "title": "Sanitized explicit viewBox",+ "viewBox": [1600, 520],+ "legend": { "mode": "hidden" }+ },+ "lanes": [+ { "id": "main", "label": "Main flow" }+ ],+ "nodes": [+ { "id": "start", "lane": "main", "col": 0, "type": "frontend", "label": "Start" },+ { "id": "finish", "lane": "main", "col": 5, "type": "backend", "label": "Finish" }+ ],+ "edges": [+ { "id": "start-finish", "from": "start", "to": "finish", "label": "complete" }+ ]+}diff --git a/archify/test/fixtures/issue-126/labels.workflow.json b/archify/test/fixtures/issue-126/labels.workflow.jsonnew file mode 100644index 00000000..0e27edbe--- /dev/null+++ b/archify/test/fixtures/issue-126/labels.workflow.json@@ -0,0 +1,18 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": {+ "title": "Sanitized semantic labels",+ "legend": { "mode": "hidden" }+ },+ "lanes": [+ { "id": "main", "label": "Main flow" }+ ],+ "nodes": [+ { "id": "request", "lane": "main", "col": 3, "type": "frontend", "label": "Request" },+ { "id": "result", "lane": "main", "col": 4, "type": "backend", "label": "Result" }+ ],+ "edges": [+ { "id": "request-result", "from": "request", "to": "result", "label": "同步 ✅ ready" }+ ]+}diff --git a/archify/test/fixtures/v1-workflow-700x400.workflow.json b/archify/test/fixtures/v1-workflow-700x400.workflow.jsonnew file mode 100644index 00000000..72212424--- /dev/null+++ b/archify/test/fixtures/v1-workflow-700x400.workflow.json@@ -0,0 +1,22 @@+{+ "schema_version": 1,+ "diagram_type": "workflow",+ "meta": {+ "title": "Legacy narrow workflow",+ "viewBox": [700, 400]+ },+ "lanes": [+ { "id": "first", "label": "First" },+ { "id": "second", "label": "Second" }+ ],+ "nodes": [+ { "id": "node_0", "lane": "first", "col": 0, "type": "frontend", "label": "frontend" },+ { "id": "node_1", "lane": "first", "col": 2, "type": "backend", "label": "backend" },+ { "id": "node_2", "lane": "first", "col": 4, "type": "database", "label": "database" },+ { "id": "node_3", "lane": "second", "col": 0, "type": "cloud", "label": "cloud" },+ { "id": "node_4", "lane": "second", "col": 2, "type": "security", "label": "security" },+ { "id": "node_5", "lane": "second", "col": 4, "type": "messagebus", "label": "messagebus" },+ { "id": "node_6", "lane": "second", "col": 5, "type": "external", "label": "external" }+ ],+ "edges": []+}diff --git a/archify/test/fixtures/v1-workflow-explicit-coordinates.workflow.json b/archify/test/fixtures/v1-workflow-explicit-coordinates.workflow.jsonnew file mode 100644index 00000000..203be266--- /dev/null+++ b/archify/test/fixtures/v1-workflow-explicit-coordinates.workflow.json@@ -0,0 +1,47 @@+{+ "schema_version": 1,+ "diagram_type": "workflow",+ "meta": {+ "title": "Pinned coordinate migration",+ "viewBox": [720, 700],+ "legend": { "mode": "hidden" }+ },+ "lanes": [+ { "id": "route", "label": "Explicit route" },+ { "id": "label", "label": "Explicit label" },+ { "id": "channel-source", "label": "Channel source" },+ { "id": "channel-target", "label": "Channel target" }+ ],+ "nodes": [+ { "id": "route-a", "lane": "route", "col": 0, "type": "backend", "label": "A" },+ { "id": "route-b", "lane": "route", "col": 2, "type": "backend", "label": "B" },+ { "id": "label-a", "lane": "label", "col": 2, "type": "backend", "label": "C" },+ { "id": "label-b", "lane": "label", "col": 3, "type": "backend", "label": "D" },+ { "id": "channel-a", "lane": "channel-source", "col": 1, "type": "backend", "label": "E" },+ { "id": "channel-b", "lane": "channel-target", "col": 1, "type": "backend", "label": "F" }+ ],+ "edges": [+ {+ "id": "pinned-via",+ "from": "route-a",+ "to": "route-b",+ "via": [[220, 119]]+ },+ {+ "id": "pinned-label",+ "from": "label-a",+ "to": "label-b",+ "label": "ok",+ "labelAt": [365, 203]+ },+ {+ "id": "pinned-channel",+ "from": "channel-a",+ "to": "channel-b",+ "fromSide": "right",+ "toSide": "right",+ "route": "outside-right",+ "channelX": 500+ }+ ]+}diff --git a/archify/test/generate-validators.test.mjs b/archify/test/generate-validators.test.mjsindex 7252e281..3d5df070 100644--- a/archify/test/generate-validators.test.mjs+++ b/archify/test/generate-validators.test.mjs@@ -4,10 +4,29 @@ import { spawnSync } from 'node:child_process';import fs from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';+import { workflow as validateWorkflow } from '../renderers/shared/generated-validators.mjs';const __dirname = path.dirname(fileURLToPath(import.meta.url));const skillRoot = path.resolve(__dirname, '..');+function workflowDocument(schemaVersion) {+ return {+ schema_version: schemaVersion,+ diagram_type: 'workflow',+ meta: { title: 'Schema compatibility' },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [{ id: 'step', lane: 'main', col: 0, type: 'backend', label: 'Step' }],+ edges: [],+ };+}++test('generated workflow validator accepts schema versions 1 and 2 only', () => {+ assert.equal(validateWorkflow(workflowDocument(1)), true, JSON.stringify(validateWorkflow.errors));+ assert.equal(validateWorkflow(workflowDocument(2)), true, JSON.stringify(validateWorkflow.errors));+ assert.equal(validateWorkflow(workflowDocument(3)), false);+ assert.deepEqual(validateWorkflow.errors?.[0]?.params.allowedValues, [1, 2]);+});+test('validator freshness check accepts CRLF checkouts', () => {const scratch = fs.mkdtempSync(path.join(skillRoot, '.validator-check-'));try {diff --git a/archify/test/geometry.test.mjs b/archify/test/geometry.test.mjsindex 4064b005..2b93f8c4 100644--- a/archify/test/geometry.test.mjs+++ b/archify/test/geometry.test.mjs@@ -217,8 +217,7 @@ test('cleanFlowProblems exempts endpoints and ignores missing endpoint geometry'pathFor: () => ({ points: [[20, 10], [80, 10]] }),diagramType: 'workflow',relationCollection: 'edges',- obstacleKind: 'node',- profile: 'standard'+ obstacleKind: 'node'});assert.deepEqual(endpointOnly, []);@@ -247,8 +246,7 @@ test('cleanFlowProblems uses clearance, reports the first segment, and deduplicapathFor: () => ({ points: [[0, -1], [20, -1], [0, 5], [20, 5]] }),diagramType: 'workflow',relationCollection: 'edges',- obstacleKind: 'node',- profile: 'standard'+ obstacleKind: 'node'});assert.equal(problems.length, 1);assert.match(problems[0], /segment 0 \[0, -1\] -> \[20, -1\]/);diff --git a/archify/test/layout-rules.test.mjs b/archify/test/layout-rules.test.mjsindex f3a47e84..b432ddab 100644--- a/archify/test/layout-rules.test.mjs+++ b/archify/test/layout-rules.test.mjs@@ -582,7 +582,7 @@ const TAG_SHRINK_CASES = [['architecture', 'components', 'owner: platform operations team', 7],['dataflow', 'nodes', 'owner: analytics platform', 7],['lifecycle', 'states', 'owner: platform operations pod', 7],- ['workflow', 'nodes', 'owner: runtime squad A', 7],+ ['workflow', 'nodes', 'owner: runtime execution squad A', 7],];for (const [mode, collection, tag, preferred] of TAG_SHRINK_CASES) {@@ -928,6 +928,7 @@ test('workflow: explicit labelAt remains authoritative on an automatic one-bendtest('workflow: bounded font fitting keeps an ordinary long sublabel inside its node', () => {const d = load('workflow');+ d.nodes[0].width = 92;d.nodes[0].sublabel = 'shell / browser / MCP';const { code, stderr, outPath } = render('workflow', d);assert.equal(code, 0, stderr);@@ -1011,12 +1012,34 @@ test('architecture: showcase rejects a connection label that hides another route});test('workflow: showcase rejects an edge label that hides another route', () => {- const d = load('workflow');- d.edges.find((edge) => edge.id === 'plan-request').labelAt = [562, 491];+ const d = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Workflow label-route clearance',+ quality_profile: 'showcase',+ viewBox: [720, 400],+ legend: { mode: 'hidden' },+ },+ lanes: [+ { id: 'label', label: 'Label owner' },+ { id: 'route', label: 'Other route' },+ ],+ nodes: [+ { id: 'a', lane: 'label', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'label', col: 2, type: 'backend', label: 'B' },+ { id: 'c', lane: 'route', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'route', col: 2, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'labeled-edge', from: 'a', to: 'b', label: 'plan', labelAt: [200, 243] },+ { id: 'other-route', from: 'c', to: 'd' },+ ],+ };const { code, stderr } = render('workflow', d);assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);assert.match(stderr, /\[composition\/label-route-clearance\] showcase workflow/);- assert.match(stderr, /plan.*retry-request/);+ assert.match(stderr, /plan.*other-route/);});test('lifecycle: showcase rejects a transition label that hides another route', () => {@@ -1194,6 +1217,32 @@ test('architecture: showcase rejects an unrelated proper edge crossing', () => {assert.match(stderr, /route\/via|fromSide\/toSide/);});+test('architecture: showcase preserves a straight-through explicit waypoint as an authored touch', () => {+ const d = {+ schema_version: 1,+ diagram_type: 'architecture',+ meta: {+ title: 'Forward-collinear waypoint compatibility',+ quality_profile: 'showcase',+ viewBox: [600, 320],+ legend: { mode: 'hidden' },+ },+ components: [+ { id: 'a', type: 'backend', label: 'A', pos: [50, 100], size: [80, 60] },+ { id: 'b', type: 'backend', label: 'B', pos: [450, 100], size: [80, 60] },+ { id: 'c', type: 'backend', label: 'C', pos: [260, 0], size: [80, 60] },+ { id: 'd', type: 'backend', label: 'D', pos: [260, 200], size: [80, 60] },+ ],+ connections: [+ { id: 'horizontal', from: 'a', to: 'b', via: [[300, 130]] },+ { id: 'vertical', from: 'c', to: 'd' },+ ],+ };++ const { code, stderr } = render('architecture', d);+ assert.equal(code, 0, stderr);+});+test('architecture: standard keeps the same proper crossing renderable', () => {const d = {schema_version: 1,diff --git a/archify/test/relationship-lens.test.mjs b/archify/test/relationship-lens.test.mjsindex 7ceda226..e86ed94c 100644--- a/archify/test/relationship-lens.test.mjs+++ b/archify/test/relationship-lens.test.mjs@@ -51,7 +51,8 @@ test('all typed renderers expose named, stable relationships without changing geassert.equal(keys.size, relationships.length, `${mode} keeps one stable key per source relationship`);relationships.forEach((relationship, index) => {- assert.match(diagram, new RegExp(`data-edge-from="${escapeAttr(relationship.from)}"[^>]+data-edge-to="${escapeAttr(relationship.to)}"[^>]+data-edge-key="${index}"`), `${mode} relationship ${index}`);+ const expectedKey = source.schema_version === 2 ? '\\d+' : String(index);+ assert.match(diagram, new RegExp(`data-edge-from="${escapeAttr(relationship.from)}"[^>]+data-edge-to="${escapeAttr(relationship.to)}"[^>]+data-edge-key="${expectedKey}"`), `${mode} relationship ${index}`);if (relationship.label) {assert.match(diagram, new RegExp(`data-edge-label="${escapeAttr(relationship.label).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"`), `${mode} named relationship ${index}`);}diff --git a/archify/test/relationship-permalink.test.mjs b/archify/test/relationship-permalink.test.mjsindex 769a4c12..fc50ef72 100644--- a/archify/test/relationship-permalink.test.mjs+++ b/archify/test/relationship-permalink.test.mjs@@ -36,18 +36,22 @@ function canonicalSvg(html) {return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';}+function relationshipKey(html, id) {+ return html.match(new RegExp(`data-edge-key="(\\d+)" data-edge-id="${id}"`))?.[1] ?? null;+}+test('all typed renderers preserve optional authored relationship ids beside runtime keys', () => {for (const mode of Object.keys(CASES)) {const doc = fixture(mode);doc[CASES[mode].collection][0].id = 'shareable-relation';const { result, html } = run(mode, doc, 'stable-id');assert.equal(result.status, 0, `${mode}: ${result.stderr}`);- assert.match(html, /data-edge-key="0" data-edge-id="shareable-relation"/, mode);+ assert.match(html, /data-edge-key="\d+" data-edge-id="shareable-relation"/, mode);assert.match(canonicalSvg(html), /data-edge-id="shareable-relation"/, mode);}});-test('authored relationship identity survives source-order changes while runtime keys remain private', () => {+test('authored relationship identity and readable-v2 compiler keys survive source-order changes', () => {const original = fixture('workflow');const reordered = fixture('workflow');const moved = reordered.edges.shift();@@ -57,8 +61,11 @@ test('authored relationship identity survives source-order changes while runtimeconst second = run('workflow', reordered, 'reordered');assert.equal(first.result.status, 0, first.result.stderr);assert.equal(second.result.status, 0, second.result.stderr);- assert.match(first.html, /data-edge-key="0" data-edge-id="request-chat"/);- assert.match(second.html, /data-edge-key="1" data-edge-id="request-chat"/);+ assert.notEqual(relationshipKey(first.html, 'request-chat'), null);+ assert.equal(+ relationshipKey(second.html, 'request-chat'),+ relationshipKey(first.html, 'request-chat'),+ );assert.match(first.html, /'#relation=' \+ encodeURIComponent\(record\.id\)/);assert.match(second.html, /'#relation=' \+ encodeURIComponent\(record\.id\)/);});diff --git a/archify/test/semantic-legend-gateway.test.mjs b/archify/test/semantic-legend-gateway.test.mjsindex e5d70106..3d8a711f 100644--- a/archify/test/semantic-legend-gateway.test.mjs+++ b/archify/test/semantic-legend-gateway.test.mjs@@ -56,7 +56,7 @@ test('only legends with an exact node-kind meaning publish bridge entries', () =// semantic bridge contract focused by rendering the same typed nodes with// an explicit full legend and no relationship geometry in the band.document.meta.legend = { mode: 'all' };- document.meta.viewBox = [1200, 900];+ delete document.meta.viewBox;document.edges = [];delete document.mainPath;}));diff --git a/archify/test/semantic-passport.test.mjs b/archify/test/semantic-passport.test.mjsindex f988a383..1e5c17ac 100644--- a/archify/test/semantic-passport.test.mjs+++ b/archify/test/semantic-passport.test.mjs@@ -51,7 +51,7 @@ test('renderer-owned structure supplies truthful Semantic Passport context', ()const lifecycle = render('lifecycle', CASES.lifecycle);assert.match(architecture, /data-node-id="api"[^>]+data-node-kind="backend"[^>]+data-node-context="AWS Region: us-west-2 › sg-api :443\/:8000"/);- assert.match(workflow, /data-node-id="approval"[^>]+data-node-kind="security"[^>]+data-node-context="Policy Boundary › Plan \+ route"/);+ assert.match(workflow, /data-node-id="approval"[^>]+data-node-kind="security"[^>]+data-node-context="Policy & Recovery › Human or policy stop › Plan \+ route"/);assert.match(sequence, /data-node-id="redis"[^>]+data-node-kind="database"[^>]+data-node-context="Sequence participant"/);assert.match(dataflow, /data-node-id="warehouse"[^>]+data-node-kind="database"[^>]+data-node-context="04 \/ Store"/);assert.match(lifecycle, /data-node-id="executing"[^>]+data-node-kind="active"[^>]+data-node-context="Lifecycle phases"/);diff --git a/archify/test/workflow-compiler-hard-contract.test.mjs b/archify/test/workflow-compiler-hard-contract.test.mjsnew file mode 100644index 00000000..f8a7aeb8--- /dev/null+++ b/archify/test/workflow-compiler-hard-contract.test.mjs@@ -0,0 +1,2135 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';++import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';++function clone(value) {+ return JSON.parse(JSON.stringify(value));+}++function workflow({ lanes, nodes, edges }) {+ return {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: {+ title: 'Workflow compiler hard-contract fixture',+ legend: { mode: 'hidden' },+ },+ lanes,+ nodes,+ edges,+ };+}++function oneLaneWorkflow(edges) {+ return workflow({+ lanes: [{ id: 'main', label: 'M' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges,+ });+}++function nestedOutsideRightCorridorWorkflow() {+ return workflow({+ lanes: [0, 1, 2, 3].map((index) => ({ id: `l${index}`, label: `Lane ${index}` })),+ nodes: [+ { id: 'outer-from', lane: 'l0', col: 0, type: 'backend', label: 'Outer from' },+ { id: 'inner-from', lane: 'l1', col: 0, type: 'backend', label: 'Inner from' },+ { id: 'inner-to', lane: 'l2', col: 2, type: 'database', label: 'Inner to' },+ { id: 'outer-to', lane: 'l3', col: 2, type: 'database', label: 'Outer to' },+ ],+ edges: [+ {+ id: 'outer',+ from: 'outer-from',+ to: 'outer-to',+ route: 'outside-right',+ channelX: 800,+ fromSide: 'right',+ toSide: 'right',+ },+ {+ id: 'inner',+ from: 'inner-from',+ to: 'inner-to',+ route: 'outside-right',+ channelX: 800,+ fromSide: 'right',+ toSide: 'right',+ },+ ],+ });+}++function crossingAtForwardCollinearViaWorkflow({ pinHorizontal = false } = {}) {+ return workflow({+ lanes: [+ { id: 'top', label: 'Top' },+ { id: 'middle', label: 'Middle' },+ { id: 'bottom', label: 'Bottom' },+ ],+ nodes: [+ { id: 'left', lane: 'middle', col: 0, type: 'backend', label: 'Left' },+ { id: 'right', lane: 'middle', col: 4, type: 'backend', label: 'Right' },+ { id: 'above', lane: 'top', col: 2, type: 'backend', label: 'Above' },+ { id: 'below', lane: 'bottom', col: 2, type: 'backend', label: 'Below' },+ ],+ edges: [+ {+ id: pinHorizontal ? 'a-pinned' : 'a-auto',+ from: 'left',+ to: 'right',+ ...(pinHorizontal ? { via: [[334, 243]] } : {}),+ },+ {+ id: 'z-pinned',+ from: 'above',+ to: 'below',+ via: [[334, 243]],+ },+ ],+ });+}++function oneLaneAnchors() {+ const result = compileWorkflow({ workflow: oneLaneWorkflow([]), qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ const source = result.receipt.nodes.find(({ id }) => id === 'a');+ const target = result.receipt.nodes.find(({ id }) => id === 'b');+ assert.ok(source && target);+ return {+ start: [source.x + source.width, source.y + source.height / 2],+ end: [target.x, target.y + target.height / 2],+ };+}++function assertExplicitPinConflict(result, context) {+ assert.equal(result.ok, false, `${context} must not produce an SVG`);+ assert.equal(result.svg, undefined);+ assert.ok(Array.isArray(result.diagnostics) && result.diagnostics.length > 0);+ assert.ok(+ result.diagnostics.some(({ code }) => code === 'workflow/explicit-pin-conflict'),+ `${context} must report workflow/explicit-pin-conflict:\n${JSON.stringify(result.diagnostics, null, 2)}`,+ );+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);+}++function assertSupportedFixesNameChangedEdge(diagnostic, edgeIds) {+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+ for (const fix of diagnostic.supportedFixes) {+ assert.ok(+ edgeIds.some((edgeId) => fix.includes(`edge "${edgeId}"`)),+ `supported fix must name its changed edge (${edgeIds.join(', ')}): ${fix}`,+ );+ }+}++function assertOrthogonal(points) {+ for (let index = 0; index < points.length - 1; index += 1) {+ const [x1, y1] = points[index];+ const [x2, y2] = points[index + 1];+ assert.ok(x1 === x2 || y1 === y2, `segment ${index} must be orthogonal`);+ assert.notDeepEqual(points[index], points[index + 1], `segment ${index} must be non-zero`);+ }+}++function routeContainsChannel(points, field, value) {+ return points.slice(0, -1).some((start, index) => {+ const end = points[index + 1];+ if (field === 'channelX') {+ return start[0] === value && end[0] === value && start[1] !== end[1];+ }+ return start[1] === value && end[1] === value && start[0] !== end[0];+ });+}++function segmentMeetsRect(start, end, rect, clearance = 2) {+ const left = rect.x - clearance;+ const right = rect.x + rect.width + clearance;+ const top = rect.y - clearance;+ const bottom = rect.y + rect.height + clearance;+ if (start[1] === end[1]) {+ return start[1] >= top && start[1] <= bottom+ && Math.max(start[0], end[0]) >= left+ && Math.min(start[0], end[0]) <= right;+ }+ if (start[0] === end[0]) {+ return start[0] >= left && start[0] <= right+ && Math.max(start[1], end[1]) >= top+ && Math.min(start[1], end[1]) <= bottom;+ }+ return true;+}++test('readable-v2 auto routing selects a feasible corridor around a same-lane obstacle', () => {+ const document = workflow({+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'obstacle', lane: 'main', col: 2, type: 'database', label: 'Obstacle' },+ { id: 'b', lane: 'main', col: 5, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b' }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(+ result.ok,+ true,+ `a feasible automatic corridor must compile:\n${JSON.stringify(result.diagnostics, null, 2)}`,+ );++ const points = result.receipt.edges.find(({ id }) => id === 'ab')?.points;+ const obstacle = result.receipt.nodes.find(({ id }) => id === 'obstacle');+ assert.ok(points && obstacle);+ assert.ok(points.length >= 3, 'the route must bend around the intervening node');+ assertOrthogonal(points);+ for (let index = 0; index < points.length - 1; index += 1) {+ assert.equal(+ segmentMeetsRect(points[index], points[index + 1], obstacle),+ false,+ `segment ${index} must clear the unrelated obstacle`,+ );+ }+});++test('readable-v2 evaluates automatic endpoint sides against the complete labeled route', () => {+ const document = workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 1, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', label: 'L'.repeat(50) }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.viewBox, [768, 404]);+ assert.deepEqual(result.receipt.edges[0].points, [+ [94, 145], [94, 166], [214, 166], [214, 217],+ ]);+});++test('readable-v2 retries automatic endpoint sides against already planned routes', () => {+ const document = workflow({+ lanes: [0, 1, 2].map((index) => ({ id: `l${index}`, label: `Lane ${index}` })),+ nodes: [+ { id: 'a', lane: 'l0', col: 2, type: 'backend', label: 'A' },+ { id: 'b', lane: 'l0', col: 3, type: 'backend', label: 'B', yOffset: -1 },+ { id: 'c', lane: 'l2', col: 4, type: 'backend', label: 'C' },+ ],+ edges: [+ { id: 'e0', from: 'a', to: 'b', label: 'L'.repeat(17) },+ { id: 'e1', from: 'a', to: 'c' },+ ],+ });++ const first = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ const second = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.equal(second.ok, true, JSON.stringify(second.diagnostics, null, 2));+ assert.equal(second.svg, first.svg);+ assert.equal(JSON.stringify(second.receipt), JSON.stringify(first.receipt));+ assertOrthogonal(first.receipt.edges.find(({ id }) => id === 'e1').points);+});++test('readable-v2 expands an outside corridor for deterministic labeled fan-out', () => {+ const document = workflow({+ lanes: Array.from({ length: 5 }, (_, index) => ({+ id: `l${index}`,+ label: `Lane ${index}`,+ })),+ nodes: [+ { id: 'hub', lane: 'l0', col: 0, type: 'backend', label: 'Hub', width: 64 },+ { id: 't0', lane: 'l1', col: 2, type: 'external', label: 'T0', width: 160 },+ { id: 't1', lane: 'l2', col: 4, type: 'database', label: 'T1', width: 160 },+ { id: 't2', lane: 'l3', col: 3, type: 'external', label: 'T2', width: 64 },+ { id: 't3', lane: 'l4', col: 4, type: 'database', label: 'T3', width: 120 },+ ],+ edges: [+ { id: 'e0', from: 'hub', to: 't0', label: 'A'.repeat(80) },+ { id: 'e1', from: 'hub', to: 't1', label: 'B'.repeat(80) },+ { id: 'e2', from: 'hub', to: 't2', label: 'C'.repeat(12) },+ { id: 'e3', from: 'hub', to: 't3', label: 'D'.repeat(24) },+ ],+ });++ const first = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ const second = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.deepEqual(second, first);+ const route = first.receipt.edges.find(({ id }) => id === 'e3')?.points;+ assert.ok(route);+ assertOrthogonal(route);+ assert.ok(+ Math.max(...route.map(([x]) => x)) > 764,+ `the final fan-out edge must escape the occupied route/label region: ${JSON.stringify(route)}`,+ );+});++test('readable-v2 expands an outside corridor without moving the lane geometry', () => {+ const document = workflow({+ lanes: Array.from({ length: 5 }, (_, index) => ({+ id: `l${index}`,+ label: `Lane ${index}`,+ })),+ nodes: [+ { id: 'hub', lane: 'l0', col: 1, type: 'backend', label: 'Hub', width: 92 },+ { id: 't0', lane: 'l1', col: 2, type: 'external', label: 'T0', width: 120 },+ { id: 't1', lane: 'l2', col: 1, type: 'database', label: 'T1', width: 160 },+ { id: 't2', lane: 'l3', col: 1, type: 'external', label: 'T2', width: 120 },+ { id: 't3', lane: 'l4', col: 2, type: 'database', label: 'T3', width: 120 },+ ],+ edges: [+ { id: 'e0', from: 'hub', to: 't0', label: 'A'.repeat(120) },+ { id: 'e1', from: 'hub', to: 't1', label: 'B'.repeat(48) },+ { id: 'e2', from: 'hub', to: 't2', label: 'C'.repeat(24) },+ { id: 'e3', from: 'hub', to: 't3', label: 'D'.repeat(84) },+ ],+ });++ const first = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ const second = compileWorkflow({ workflow: clone(document), qualityProfile: 'showcase' });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.deepEqual(second, first);+ const route = first.receipt.edges.find(({ id }) => id === 'e3')?.points;+ assert.ok(route);+ assertOrthogonal(route);+ assert.ok(Math.max(...route.map(([x]) => x)) > 1200, JSON.stringify(route));+ assert.ok(first.receipt.viewBox[0] < 1400, JSON.stringify(first.receipt.viewBox));+});++test('readable-v2 may expand an unlabeled edge around already placed labels', () => {+ const document = workflow({+ lanes: Array.from({ length: 4 }, (_, index) => ({+ id: `l${index}`,+ label: `Lane ${index}`,+ })),+ nodes: [+ { id: 'hub', lane: 'l0', col: 0, type: 'backend', label: 'Hub', width: 120 },+ { id: 't0', lane: 'l1', col: 1, type: 'backend', label: 'T0', width: 92, yOffset: -4 },+ { id: 't1', lane: 'l2', col: 3, type: 'backend', label: 'T1', width: 92, yOffset: 4 },+ { id: 't2', lane: 'l3', col: 1, type: 'external', label: 'T2', width: 120, yOffset: -4 },+ { id: 't3', lane: 'l1', col: 5, type: 'backend', label: 'T3', width: 92, yOffset: -12 },+ { id: 't4', lane: 'l2', col: 1, type: 'backend', label: 'T4', width: 120, yOffset: -12 },+ ],+ edges: [+ { id: 'e00', from: 'hub', to: 't0', label: 'Z'.repeat(80) },+ { id: 'e01', from: 'hub', to: 't1', label: 'Q'.repeat(120) },+ { id: 'e02', from: 'hub', to: 't2', label: 'Q'.repeat(120) },+ { id: 'e03', from: 'hub', to: 't3', label: 'Z'.repeat(80) },+ { id: 'e04', from: 'hub', to: 't4' },+ ],+ });++ const first = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ const second = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.deepEqual(second, first);+ const route = first.receipt.edges.find(({ id }) => id === 'e04')?.points;+ assert.ok(route);+ assertOrthogonal(route);+ assert.ok(Math.max(...route.map(([x]) => x)) > 764, JSON.stringify(route));++ const boundedDocument = clone(document);+ boundedDocument.meta.viewBox = [1378, 692];+ const bounded = compileWorkflow({ workflow: boundedDocument, qualityProfile: 'standard' });+ assert.equal(bounded.ok, true, JSON.stringify(bounded.diagnostics, null, 2));+ assert.deepEqual(bounded.receipt.viewBox, [1378, 692]);+});++test('readable-v2 feeds a measured outside-channel constraint back into layout', () => {+ const document = workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 0, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', label: 'L'.repeat(120) }],+ });+ document.meta.quality_profile = 'showcase';++ const first = compileWorkflow({ workflow: document });+ const second = compileWorkflow({ workflow: clone(document) });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.deepEqual(first.receipt.viewBox, [780, 404]);+ assert.deepEqual(first.receipt.requiredViewBox, [780, 404]);+ assert.deepEqual(first.receipt.edges[0].points, [+ [140, 119], [764, 119], [764, 243], [140, 243],+ ]);+ assert.deepEqual(+ { x: first.receipt.labels[0].x, y: first.receipt.labels[0].y },+ { x: 452, y: 109 },+ );+ assert.equal(second.svg, first.svg);+ assert.equal(JSON.stringify(second.receipt), JSON.stringify(first.receipt));+});++test('readable-v2 feeds a measured adjacent-rank gutter back into layout', () => {+ const document = workflow({+ lanes: [{ id: 'l0', label: 'Lane 0' }, { id: 'l1', label: 'Lane 1' }],+ nodes: [+ { id: 'a', lane: 'l0', col: 0, type: 'backend', label: 'A' },+ { id: 'obstacle', lane: 'l0', col: 1, type: 'database', label: 'Obstacle' },+ { id: 'b', lane: 'l1', col: 1, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', fromSide: 'right', toSide: 'left' }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.columns.slice(0, 2), [94, 218]);+ assert.deepEqual(result.receipt.edges[0].points, [+ [140, 119], [156, 119], [156, 243], [172, 243],+ ]);+});++test('readable-v2 feeds a measured lane gap back into layout', () => {+ const document = workflow({+ lanes: [0, 1, 2].map((index) => ({ id: `l${index}`, label: `Lane ${index}` })),+ nodes: [0, 1, 2].map((index) => ({+ id: `n${index}`, lane: `l${index}`, col: 5, type: 'backend', label: `N${index}`,+ })),+ edges: [+ {+ id: 'e0', from: 'n1', to: 'n2', fromSide: 'bottom', toSide: 'right', label: 'LLLLLLLLLL',+ },+ {+ id: 'e2', from: 'n2', to: 'n1', fromSide: 'left', toSide: 'right', label: 'x',+ },+ ],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.columns, [94, 214, 334, 454, 574, 694]);+ assert.deepEqual(result.receipt.nodes.map(({ id, y }) => ({ id, y })), [+ { id: 'n0', y: 93 }, { id: 'n1', y: 229 }, { id: 'n2', y: 365 },+ ]);+ assert.deepEqual(result.receipt.edges.map(({ id, points }) => ({ id, points })), [+ {+ id: 'e0',+ points: [[694, 281], [694, 308], [756, 308], [756, 391], [740, 391]],+ },+ {+ id: 'e2',+ points: [[648, 391], [632, 391], [632, 172], [756, 172], [756, 255], [740, 255]],+ },+ ]);+ assert.deepEqual(result.receipt.requiredViewBox, [772, 552]);+});++for (const { name, makeDocument } of [+ {+ name: 'duplicate authored via points',+ makeDocument: () => {+ const { start } = oneLaneAnchors();+ const pin = [start[0] + 60, start[1]];+ return oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', via: [pin, [...pin]],+ }]);+ },+ },+ {+ name: 'diagonal authored via geometry',+ makeDocument: () => {+ const { start } = oneLaneAnchors();+ return oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', via: [[start[0] + 60, start[1] + 31]],+ }]);+ },+ },+]) {+ test(`readable-v2 rejects ${name} with a typed explicit-pin diagnostic`, () => {+ const result = compileWorkflow({ workflow: makeDocument(), qualityProfile: 'standard' });+ assertExplicitPinConflict(result, name);+ });+}++test('readable-v2 duplicate evidence excludes a compatible channel assertion', () => {+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ via: [[200, 119], [200, 180], [200, 180], [260, 180], [260, 119]],+ channelY: 180,+ }]);+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'duplicate via with compatible channelY');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'non-zero route segments');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'ab', field: 'via', path: '/edges/0/via',+ value: [[200, 119], [200, 180], [200, 180], [260, 180], [260, 119]],+ }]);+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+});++test('readable-v2 obstacle evidence excludes a compatible channel assertion', () => {+ const document = workflow({+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'obstacle', lane: 'main', col: 1, type: 'database', label: 'Obstacle' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ via: [[156, 119], [156, 180], [200, 180], [200, 119], [276, 119]],+ channelY: 180,+ }],+ });+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'node collision with compatible channelY');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'node clearance');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'ab', field: 'via', path: '/edges/0/via',+ value: [[156, 119], [156, 180], [200, 180], [200, 119], [276, 119]],+ }]);+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+});++test('readable-v2 infers omitted endpoint sides around an authored via', () => {+ const expected = [[94, 93], [94, 77], [334, 77], [334, 93]];+ for (const qualityProfile of ['standard', 'showcase']) {+ for (const sides of [+ {},+ { fromSide: 'top' },+ { toSide: 'top' },+ { fromSide: 'top', toSide: 'top' },+ ]) {+ const document = oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', via: [[94, 77], [334, 77]], ...sides,+ }]);+ const result = compileWorkflow({ workflow: document, qualityProfile });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.edges[0].points, expected);+ }+ }++ const restricted = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ fromSide: 'right',+ via: [[94, 77], [334, 77]],+ }]);+ assertExplicitPinConflict(+ compileWorkflow({ workflow: restricted, qualityProfile: 'standard' }),+ 'authored fromSide must remain a hard restriction',+ );++ const duplicate = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ via: [[94, 77], [94, 77], [334, 77]],+ }]);+ const duplicateResult = compileWorkflow({ workflow: duplicate, qualityProfile: 'standard' });+ assertExplicitPinConflict(duplicateResult, 'inferred top ports around duplicate via geometry');+ assert.equal(duplicateResult.diagnostics[0].evidence.invariant, 'non-zero route segments');+ assert.deepEqual(duplicateResult.diagnostics[0].evidence.from, [94, 77]);+ assert.deepEqual(duplicateResult.diagnostics[0].evidence.to, [94, 77]);+});++test('readable-v2 reports an infeasible authored target side with its verified single-pin repair', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'bottom', col: 0, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', toSide: 'top' }],+ });+ document.groups = [{+ id: 'g', label: 'Very long group label', lane: 'bottom', fromCol: 0, toCol: 0,+ }];++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/explicit-pin-conflict');+ assert.deepEqual(diagnostic.subject, {+ diagramType: 'workflow',+ edge: 'ab',+ from: 'a',+ to: 'b',+ path: '/edges/0/toSide',+ });+ assert.equal(+ diagnostic.evidence.invariant,+ 'readable route feasibility with authored endpoint sides',+ );+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'ab',+ field: 'toSide',+ path: '/edges/0/toSide',+ value: 'top',+ }]);+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove toSide from edge "ab" so readable-v2 can replan the remaining endpoint-side pins',+ ]);+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);++ const repaired = clone(document);+ delete repaired.edges[0].toSide;+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'showcase' });+ assert.equal(verified.ok, true, JSON.stringify(verified.diagnostics, null, 2));+});++test('readable-v2 reports via and fromSide as a minimal conflict with two verified repairs', () => {+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ fromSide: 'right',+ toSide: 'top',+ via: [[20, 119], [20, 50], [334, 50]],+ }]);++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'perpendicular endpoint-side direction');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [+ {+ edge: 'ab',+ field: 'fromSide',+ path: '/edges/0/fromSide',+ value: 'right',+ },+ {+ edge: 'ab',+ field: 'via',+ path: '/edges/0/via',+ value: [[20, 119], [20, 50], [334, 50]],+ },+ ]);+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove fromSide from edge "ab" and replan the remaining explicit pins',+ 'remove via from edge "ab" and replan the remaining explicit pins',+ ]);++ for (const field of ['fromSide', 'via']) {+ const repaired = clone(document);+ delete repaired.edges[0][field];+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(+ verified.ok,+ true,+ `removing ${field} must recompile:\n${JSON.stringify(verified.diagnostics, null, 2)}`,+ );+ }+});++test('readable-v2 infers endpoint sides for auto channel pins', () => {+ const cases = [+ {+ edge: { channelY: 77 },+ document: oneLaneWorkflow([]),+ expected: [[94, 93], [94, 77], [334, 77], [334, 93]],+ },+ {+ edge: { channelX: 20 },+ document: workflow({+ lanes: [{ id: 'l0', label: 'L0' }, { id: 'l1', label: 'L1' }],+ nodes: [+ { id: 'a', lane: 'l0', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'l1', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [],+ }),+ expected: [[48, 119], [20, 119], [20, 243], [288, 243]],+ },+ {+ edge: { channelX: 20, channelY: 181 },+ document: workflow({+ lanes: [{ id: 'l0', label: 'L0' }, { id: 'l1', label: 'L1' }],+ nodes: [+ { id: 'a', lane: 'l0', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'l1', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [],+ }),+ expected: [[48, 119], [20, 119], [20, 181], [334, 181], [334, 217]],+ },+ ];++ for (const qualityProfile of ['standard', 'showcase']) {+ for (const fixture of cases) {+ fixture.document.edges = [{ id: 'ab', from: 'a', to: 'b', ...fixture.edge }];+ const result = compileWorkflow({ workflow: clone(fixture.document), qualityProfile });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.edges[0].points, fixture.expected);+ for (const [field, value] of Object.entries(fixture.edge)) {+ assert.ok(routeContainsChannel(result.receipt.edges[0].points, field, value));+ }+ }+ }+});++test('readable-v2 treats an omitted preset side as a solver choice', () => {+ const crossLane = (route, extra = {}) => workflow({+ lanes: [{ id: 'l0', label: 'X' }, { id: 'l1', label: 'Y' }],+ nodes: [+ { id: 'a', lane: 'l0', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'l1', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', route, ...extra }],+ });+ const cases = [+ {+ route: 'straight',+ document: oneLaneWorkflow([{ id: 'ab', from: 'a', to: 'b', route: 'straight' }]),+ expected: [[140, 119], [288, 119]],+ },+ { route: 'drop', document: crossLane('drop'), expected: [[94, 145], [94, 166], [334, 166], [334, 217]] },+ { route: 'outside-right', document: crossLane('outside-right'), expected: [[140, 119], [764, 119], [764, 243], [380, 243]] },+ { route: 'return-left', document: crossLane('return-left'), expected: [[48, 119], [20, 119], [20, 243], [288, 243]] },+ { route: 'bottom-channel', document: crossLane('bottom-channel'), expected: [[94, 145], [94, 301], [334, 301], [334, 269]] },+ { route: 'up-channel', document: crossLane('up-channel'), expected: [[94, 93], [94, 65], [334, 65], [334, 217]] },+ { route: 'outside-right partial', document: crossLane('outside-right', { fromSide: 'right' }), expected: [[140, 119], [764, 119], [764, 243], [380, 243]] },+ ];++ for (const fixture of cases) {+ const result = compileWorkflow({ workflow: fixture.document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, `${fixture.route}: ${JSON.stringify(result.diagnostics, null, 2)}`);+ assert.deepEqual(result.receipt.edges[0].points, fixture.expected);+ }+});++test('readable-v2 treats an infeasible route preset as a candidate-family conflict, not a coordinate pin', () => {+ const document = workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', route: 'straight' }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/route-preset-conflict');+ assert.ok(diagnostic);+ assert.ok(result.diagnostics.every(({ code }) => code !== 'workflow/explicit-pin-conflict'));+ assert.ok(diagnostic.supportedFixes.length > 0);+ assert.ok(diagnostic.supportedFixes.every((fix) => /^set edge |^remove route /.test(fix)));+ for (const fix of diagnostic.supportedFixes) {+ const repaired = clone(document);+ const preset = fix.match(/verified preset "([^"]+)"/)?.[1];+ if (preset) repaired.edges[0].route = preset;+ else delete repaired.edges[0].route;+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(verified.ok, true, `advertised fix must recompile: ${fix}`);+ }+});++test('readable-v2 never accepts a same-lane drop through the preset-only fallback', () => {+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: 'drop',+ fromSide: 'top',+ toSide: 'top',+ }]);+ document.nodes.forEach((node) => { node.yOffset = 20; });++ for (const qualityProfile of ['standard', 'showcase']) {+ const result = compileWorkflow({ workflow: clone(document), qualityProfile });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.ok(result.diagnostics.some(({ code }) => code === 'workflow/route-preset-conflict'));+ assert.ok(result.diagnostics.every(({ code }) => code !== 'workflow/explicit-pin-conflict'));+ }+});++test('readable-v2 never silently ignores coordinate pins that conflict with a route preset', () => {+ const cases = [+ {+ name: 'straight with channelY',+ document: oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', route: 'straight', channelY: 300,+ }]),+ },+ {+ name: 'straight with channelX',+ document: oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', route: 'straight', channelX: 300,+ }]),+ },+ {+ name: 'drop with channelX',+ document: workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 0, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', route: 'drop', channelX: 777 }],+ }),+ },+ ...[+ ['outside-right', 'channelY'],+ ['return-left', 'channelY'],+ ['bottom-channel', 'channelX'],+ ['up-channel', 'channelX'],+ ].map(([route, field]) => ({+ name: `${route} with ${field}`,+ document: oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', route, [field]: 300,+ }]),+ })),+ ];++ for (const { name, document } of cases) {+ let result;+ assert.doesNotThrow(() => {+ result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ }, `${name} must stay inside the public compiler result boundary`);+ assertExplicitPinConflict(result, name);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.route, document.edges[0].route);+ assert.ok(diagnostic.evidence.conflictingPins.length > 0);+ }+});++test('readable-v2 preset compatibility reports both authored causal paths and verified repairs', () => {+ const document = oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', route: 'straight', channelY: 300,+ }]);+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'straight preset with channelY');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'route preset compatibility');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [+ {+ edge: 'ab', field: 'route', path: '/edges/0/route', value: 'straight',+ },+ {+ edge: 'ab', field: 'channelY', path: '/edges/0/channelY', value: 300,+ },+ ]);+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove route from edge "ab" and keep the remaining verified route assertions',+ 'remove channelY from edge "ab" and keep the remaining verified route assertions',+ ]);++ for (const field of ['route', 'channelY']) {+ const repaired = clone(document);+ delete repaired.edges[0][field];+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(+ verified.ok,+ true,+ `removing ${field} must recompile:\n${JSON.stringify(verified.diagnostics, null, 2)}`,+ );+ }+});++test('readable-v2 rejects a raw via that does not belong to its route preset family', () => {+ const { start, end } = oneLaneAnchors();+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: 'straight',+ via: [+ [start[0] + 20, start[1]],+ [start[0] + 20, start[1] + 40],+ [end[0] - 20, start[1] + 40],+ [end[0] - 20, end[1]],+ ],+ }]);++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'straight preset with a detouring via');+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.route, 'straight');+ assert.equal(diagnostic.evidence.invariant, 'route preset compatibility');+});++for (const fixture of [+ {+ preset: 'straight',+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { via: [[180, 119], [240, 119]] },+ expected: [[140, 119], [180, 119], [240, 119], [288, 119]],+ },+ {+ preset: 'drop',+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { fromSide: 'bottom', toSide: 'top', via: [[94, 181], [334, 181]] },+ expected: [[94, 145], [94, 181], [334, 181], [334, 217]],+ },+ {+ preset: 'outside-right',+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { fromSide: 'right', toSide: 'right', via: [[720, 119], [720, 243]] },+ expected: [[140, 119], [720, 119], [720, 243], [380, 243]],+ },+ {+ preset: 'return-left',+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { fromSide: 'left', toSide: 'left', via: [[20, 119], [20, 243]] },+ expected: [[48, 119], [20, 119], [20, 243], [288, 243]],+ },+ {+ preset: 'bottom-channel',+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { fromSide: 'bottom', toSide: 'bottom', via: [[94, 200], [334, 200]] },+ expected: [[94, 145], [94, 200], [334, 200], [334, 145]],+ },+ {+ preset: 'up-channel',+ lanes: [{ id: 'main', label: 'M' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edge: { fromSide: 'top', toSide: 'top', via: [[94, 20], [334, 20]] },+ expected: [[94, 93], [94, 20], [334, 20], [334, 93]],+ },+]) {+ test(`readable-v2 preserves a compatible ${fixture.preset} via without normalization`, () => {+ const document = workflow({+ lanes: fixture.lanes,+ nodes: fixture.nodes,+ edges: [{+ id: 'ab', from: 'a', to: 'b', route: fixture.preset, ...fixture.edge,+ }],+ });+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.edges[0].points, fixture.expected);+ });+}++test('readable-v2 keeps a compatible channel pin authoritative inside its route preset', () => {+ const document = workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: 'drop',+ channelY: 181,+ fromSide: 'bottom',+ toSide: 'top',+ }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ const points = result.receipt.edges.find(({ id }) => id === 'ab').points;+ assert.ok(+ points.slice(0, -1).some((point, index) => (+ point[1] === 181 && points[index + 1][1] === 181+ )),+ `the final path must contain the authored channelY: ${JSON.stringify(points)}`,+ );+});++for (const fixture of [+ {+ preset: 'outside-right', field: 'channelX', value: 720,+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ sides: { fromSide: 'right', toSide: 'right' },+ },+ {+ preset: 'return-left', field: 'channelX', value: 20,+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ sides: { fromSide: 'left', toSide: 'left' },+ },+ {+ preset: 'bottom-channel', field: 'channelY', value: 200,+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ sides: { fromSide: 'bottom', toSide: 'bottom' },+ },+ {+ preset: 'up-channel', field: 'channelY', value: 20,+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ sides: { fromSide: 'top', toSide: 'top' },+ },+]) {+ test(`readable-v2 keeps ${fixture.field} authoritative for ${fixture.preset}`, () => {+ const document = workflow({+ lanes: fixture.lanes,+ nodes: fixture.nodes,+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: fixture.preset,+ [fixture.field]: fixture.value,+ ...fixture.sides,+ }],+ });+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, true, JSON.stringify(result.diagnostics, null, 2));+ const points = result.receipt.edges[0].points;+ assert.ok(routeContainsChannel(points, fixture.field, fixture.value));+ });+}++for (const fixture of [+ {+ preset: 'outside-right', field: 'channelX', value: 20,+ sides: { fromSide: 'left', toSide: 'left' },+ crossLane: true,+ },+ {+ preset: 'return-left', field: 'channelX', value: 720,+ sides: { fromSide: 'right', toSide: 'right' },+ crossLane: true,+ },+ {+ preset: 'bottom-channel', field: 'channelY', value: 20,+ sides: { fromSide: 'top', toSide: 'top' },+ },+ {+ preset: 'up-channel', field: 'channelY', value: 340,+ sides: { fromSide: 'bottom', toSide: 'bottom' },+ },+ {+ preset: 'drop', field: 'channelY', value: 20,+ sides: { fromSide: 'top', toSide: 'top' },+ },+]) {+ test(`readable-v2 rejects ${fixture.preset} when its channel belongs to another route family`, () => {+ for (const qualityProfile of ['standard', 'showcase']) {+ const edges = [{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: fixture.preset,+ [fixture.field]: fixture.value,+ ...fixture.sides,+ }];+ const document = fixture.crossLane+ ? workflow({+ lanes: [{ id: 'source', label: 'Source' }, { id: 'target', label: 'Target' }],+ nodes: [+ { id: 'a', lane: 'source', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'target', col: 2, type: 'backend', label: 'B' },+ ],+ edges,+ })+ : oneLaneWorkflow(edges);+ const result = compileWorkflow({ workflow: document, qualityProfile });+ assertExplicitPinConflict(result, `${fixture.preset} ${fixture.field} under ${qualityProfile}`);+ const diagnostic = result.diagnostics.find(({ code }) => (+ code === 'workflow/explicit-pin-conflict'+ ));+ assert.equal(diagnostic.evidence.invariant, 'route preset compatibility');+ }+ });+}++test('readable-v2 treats channels beside via as assertions over the authored path', () => {+ const { start, end } = oneLaneAnchors();+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ channelX: start[0] + 40,+ channelY: start[1] + 61,+ via: [+ [start[0] + 40, start[1]],+ [start[0] + 40, start[1] + 61],+ [end[0] - 48, start[1] + 61],+ [end[0] - 48, end[1]],+ ],+ }]);++ const matching = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(matching.ok, true, JSON.stringify(matching.diagnostics, null, 2));+ assert.deepEqual(matching.receipt.edges[0].points, [start, ...document.edges[0].via, end]);++ const mismatched = clone(document);+ mismatched.edges[0].channelX += 1;+ const result = compileWorkflow({ workflow: mismatched, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'via missing its asserted channelX');+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'channel pin preservation');+ assert.deepEqual(+ diagnostic.evidence.conflictingPins.map(({ edge, field, path }) => ({ edge, field, path })),+ [+ { edge: 'ab', field: 'via', path: '/edges/0/via' },+ { edge: 'ab', field: 'channelX', path: '/edges/0/channelX' },+ ],+ );++ const nearButNotExact = clone(document);+ nearButNotExact.edges[0].channelX += 0.00005;+ const nearResult = compileWorkflow({+ workflow: nearButNotExact,+ qualityProfile: 'standard',+ });+ assertExplicitPinConflict(nearResult, 'channel assertions must preserve exact authored numbers');+ assert.equal(nearResult.diagnostics[0].evidence.invariant, 'channel pin preservation');+});++test('readable-v2 reports via and channelY as a minimal assertion conflict with two verified repairs', () => {+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ via: [[94, 77], [334, 77]],+ channelY: 200,+ }]);++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'channel pin preservation');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [+ {+ edge: 'ab',+ field: 'via',+ path: '/edges/0/via',+ value: [[94, 77], [334, 77]],+ },+ {+ edge: 'ab',+ field: 'channelY',+ path: '/edges/0/channelY',+ value: 200,+ },+ ]);+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove via from edge "ab" and replan the remaining explicit route assertions',+ 'remove channelY from edge "ab" and replan the remaining explicit route assertions',+ ]);++ for (const field of ['via', 'channelY']) {+ const repaired = clone(document);+ delete repaired.edges[0][field];+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(+ verified.ok,+ true,+ `removing ${field} must recompile:\n${JSON.stringify(verified.diagnostics, null, 2)}`,+ );+ }+});++test('readable-v2 reports conflicts between absolute label and route pins as typed geometry', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'top', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'bottom', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 4, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'labelpin', from: 'a', to: 'b', label: 'PIN', labelAt: [334, 243] },+ { id: 'routepin', from: 'c', to: 'd', via: [[334, 243]] },+ ],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ assertExplicitPinConflict(result, 'labelAt crossing an authored via');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-route clearance');+ assert.deepEqual(diagnostic.evidence.conflictingPins.map(({ edge, field }) => ({ edge, field })), [+ { edge: 'labelpin', field: 'labelAt' },+ { edge: 'routepin', field: 'via' },+ ]);+ assert.equal(diagnostic.evidence.clearancePx, 0);+ assertSupportedFixesNameChangedEdge(diagnostic, ['labelpin', 'routepin']);+ assert.ok(+ diagnostic.supportedFixes.some((fix) => fix.includes('edge "routepin"')),+ `a routepin repair must identify routepin: ${diagnostic.supportedFixes}`,+ );+ assert.doesNotMatch(diagnostic.supportedFixes.join('\n'), /remove (?:one |the )?label(?!At)/i);+});++test('readable-v2 derives label-route pins from joint verified removals when route plans first', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'top', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'bottom', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 4, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'a-route', from: 'c', to: 'd', via: [[334, 243]] },+ { id: 'z-label', from: 'a', to: 'b', label: 'PIN', labelAt: [334, 243] },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'route-first joint label-route conflict');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-route clearance');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-label', field: 'labelAt', path: '/edges/1/labelAt', value: [334, 243],+ }]);+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+ for (const fix of diagnostic.supportedFixes) {+ const replacement = fix.match(/^set labelAt on edge "z-label" to \[(-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?)\]$/);+ assert.ok(replacement, `route removal is not causal and must not be advertised: ${fix}`);+ const repaired = clone(document);+ repaired.edges[1].labelAt = replacement.slice(1).map(Number);+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised label repair must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 derives both causal pins when label plans before the authored route', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'top', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'bottom', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 4, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'z-route', from: 'c', to: 'd', via: [[334, 243]] },+ { id: 'a-label', from: 'a', to: 'b', label: 'PIN', labelAt: [334, 243] },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'label-first joint label-route conflict');+ const diagnostic = result.diagnostics[0];+ assert.deepEqual(diagnostic.evidence.conflictingPins, [+ { edge: 'a-label', field: 'labelAt', path: '/edges/1/labelAt', value: [334, 243] },+ { edge: 'z-route', field: 'via', path: '/edges/0/via', value: [[334, 243]] },+ ]);+ assert.ok(+ diagnostic.supportedFixes.some((fix) => fix.startsWith('set labelAt on edge "a-label"')),+ JSON.stringify(diagnostic.supportedFixes, null, 2),+ );+ assert.ok(+ diagnostic.supportedFixes.includes('remove via from edge "z-route" so readable-v2 can replan the remaining authored label-route pins'),+ JSON.stringify(diagnostic.supportedFixes, null, 2),+ );+});++test('readable-v2 classifies an authored labelAt colliding with an earlier automatic route', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'top', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'bottom', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 4, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'a-route', from: 'c', to: 'd' },+ { id: 'z-label', from: 'a', to: 'b', label: 'PIN', labelAt: [334, 243] },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'labelAt colliding with an earlier automatic route');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-route clearance');+ assert.equal(diagnostic.subject.path, '/edges/1/labelAt');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-label',+ field: 'labelAt',+ path: '/edges/1/labelAt',+ value: [334, 243],+ }]);+ assert.deepEqual(diagnostic.evidence.labelAt, [334, 243]);+ assert.deepEqual(diagnostic.evidence.collidedRoute, {+ edge: 'a-route',+ from: 'c',+ to: 'd',+ points: [[140, 243], [528, 243]],+ });+ assert.deepEqual(diagnostic.evidence.routeSegment, {+ from: [140, 243],+ to: [528, 243],+ });++ for (const fix of diagnostic.supportedFixes) {+ const replacement = fix.match(/^set labelAt on edge "z-label" to \[(-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?)\]$/);+ assert.ok(replacement, `only a concrete labelAt alternative may be advertised: ${fix}`);+ const repaired = clone(document);+ repaired.edges[1].labelAt = replacement.slice(1).map(Number);+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised labelAt alternative must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 classifies an automatic label colliding with a later authored route', () => {+ const document = workflow({+ lanes: [+ { id: 'top', label: 'Top' },+ { id: 'mid', label: 'Mid' },+ { id: 'bottom', label: 'Bottom' },+ ],+ nodes: [+ { id: 'a', lane: 'mid', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'mid', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'top', col: 2, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 2, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'a-label', from: 'a', to: 'b', label: 'AUTO' },+ { id: 'z-route', from: 'c', to: 'd', via: [[334, 243]] },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'automatic label colliding with a later authored route');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-route clearance');+ assert.equal(diagnostic.subject.path, '/edges/1/via');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-route',+ field: 'via',+ path: '/edges/1/via',+ value: [[334, 243]],+ }]);+ assert.deepEqual(diagnostic.evidence.collidedRoute, {+ edge: 'z-route',+ from: 'c',+ to: 'd',+ points: [[334, 145], [334, 243], [334, 341]],+ });+ assert.deepEqual(diagnostic.evidence.routeSegment, {+ from: [334, 145],+ to: [334, 341],+ });++ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+ for (const fix of diagnostic.supportedFixes) {+ assert.equal(+ fix,+ 'remove via from edge "z-route" so readable-v2 can replan the remaining authored route assertions',+ );+ const repaired = clone(document);+ delete repaired.edges[1].via;+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised route alternative must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 classifies an authored labelAt colliding with an earlier automatic label', () => {+ const document = oneLaneWorkflow([+ { id: 'a-auto', from: 'a', to: 'b', label: 'AUTO' },+ { id: 'z-pin', from: 'a', to: 'b', label: 'PIN', labelAt: [214, 119] },+ ]);+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'labelAt colliding with an earlier automatic label');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-label clearance');+ assert.equal(diagnostic.subject.path, '/edges/1/labelAt');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-pin',+ field: 'labelAt',+ path: '/edges/1/labelAt',+ value: [214, 119],+ }]);+ assert.deepEqual(diagnostic.evidence.labelRects.map(({ edge, ...rect }) => ({ edge, ...rect })), [+ { edge: 'z-pin', x: 199, y: 109, width: 30, height: 14 },+ { edge: 'a-auto', x: 199, y: 99, width: 30, height: 14 },+ ]);++ for (const fix of diagnostic.supportedFixes) {+ const replacement = fix.match(/^set labelAt on edge "z-pin" to \[(-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?)\]$/);+ assert.ok(replacement, `only a concrete labelAt alternative may be advertised: ${fix}`);+ const repaired = clone(document);+ repaired.edges[1].labelAt = replacement.slice(1).map(Number);+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised labelAt alternative must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 derives the causal labelAt from joint verified label removals', () => {+ const document = workflow({+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'top', col: 4, type: 'backend', label: 'B' },+ { id: 'c', lane: 'bottom', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'bottom', col: 4, type: 'backend', label: 'D' },+ ],+ edges: [+ { id: 'a-label', from: 'a', to: 'b', label: 'FIRST', labelAt: [334, 119] },+ { id: 'z-label', from: 'c', to: 'd', label: 'SECOND', labelAt: [334, 119] },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'joint causal label-label conflict');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-label clearance');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-label', field: 'labelAt', path: '/edges/1/labelAt', value: [334, 119],+ }]);+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));+ for (const fix of diagnostic.supportedFixes) {+ const replacement = fix.match(/^set labelAt on edge "z-label" to \[(-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?)\]$/);+ assert.ok(replacement, `only the causal label pin may be changed: ${fix}`);+ const repaired = clone(document);+ repaired.edges[1].labelAt = replacement.slice(1).map(Number);+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised label repair must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 reports conflicts between two absolute label pins without deleting semantics', () => {+ const document = oneLaneWorkflow([+ {+ id: 'one', from: 'a', to: 'b', label: 'ONE', via: [[214, 119]], labelAt: [214, 80],+ },+ {+ id: 'two', from: 'a', to: 'b', label: 'TWO', via: [[214, 119]], labelAt: [214, 80],+ },+ ]);++ for (const qualityProfile of ['standard', 'showcase']) {+ const result = compileWorkflow({ workflow: clone(document), qualityProfile });+ assertExplicitPinConflict(result, `overlapping labelAt pins under ${qualityProfile}`);+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit label-label clearance');+ assert.deepEqual(diagnostic.evidence.conflictingPins.map(({ edge, field }) => ({ edge, field })), [+ { edge: 'one', field: 'labelAt' },+ { edge: 'two', field: 'labelAt' },+ ]);+ assertSupportedFixesNameChangedEdge(diagnostic, ['one', 'two']);+ assert.doesNotMatch(diagnostic.supportedFixes.join('\n'), /remove (?:one |the )?label(?!At)/i);+ }+});++test('readable-v2 reports showcase crossings between two absolute route pins', () => {+ const document = workflow({+ lanes: [+ { id: 'top', label: 'Top' },+ { id: 'middle', label: 'Middle' },+ { id: 'bottom', label: 'Bottom' },+ ],+ nodes: [+ { id: 'left', lane: 'middle', col: 0, type: 'backend', label: 'Left' },+ { id: 'right', lane: 'middle', col: 4, type: 'backend', label: 'Right' },+ { id: 'above', lane: 'top', col: 2, type: 'backend', label: 'Above' },+ { id: 'below', lane: 'bottom', col: 2, type: 'backend', label: 'Below' },+ ],+ edges: [+ { id: 'horizontal', from: 'left', to: 'right', via: [[250, 243]] },+ { id: 'vertical', from: 'above', to: 'below', via: [[334, 200]] },+ ],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ assertExplicitPinConflict(result, 'two crossing absolute routes');+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route crossing');+ assert.deepEqual(diagnostic.evidence.point, [334, 243]);+ assertSupportedFixesNameChangedEdge(diagnostic, ['horizontal', 'vertical']);+ assert.ok(+ diagnostic.supportedFixes.some((fix) => fix.includes('edge "vertical"')),+ `a vertical repair must identify vertical: ${diagnostic.supportedFixes}`,+ );+});++test('readable-v2 catches an automatic route crossing exactly at an authored straight-through via', () => {+ const document = crossingAtForwardCollinearViaWorkflow();+ const standard = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(standard.ok, true, JSON.stringify(standard.diagnostics, null, 2));+ assert.deepEqual(+ standard.receipt.edges.find(({ id }) => id === 'z-pinned').points,+ [[334, 145], [334, 243], [334, 341]],+ 'analysis must not remove the authored via from the receipt',+ );++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ assertExplicitPinConflict(result, 'an automatic route crossing at an authored straight-through via');+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route crossing');+ assert.deepEqual(diagnostic.evidence.point, [334, 243]);+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-pinned',+ field: 'via',+ path: '/edges/1/via',+ value: [[334, 243]],+ }]);+ assert.equal(diagnostic.subject.edge, 'z-pinned');+ assert.equal(diagnostic.subject.path, '/edges/1/via');+ assertSupportedFixesNameChangedEdge(diagnostic, ['z-pinned']);+});++test('readable-v2 catches two pinned routes crossing exactly at their straight-through vias', () => {+ const document = crossingAtForwardCollinearViaWorkflow({ pinHorizontal: true });+ const standard = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(standard.ok, true, JSON.stringify(standard.diagnostics, null, 2));+ assert.deepEqual(+ standard.receipt.edges.map(({ id, points }) => ({ id, points })),+ [+ { id: 'a-pinned', points: [[140, 243], [334, 243], [528, 243]] },+ { id: 'z-pinned', points: [[334, 145], [334, 243], [334, 341]] },+ ],+ 'analysis must retain both authored straight-through vias in the receipt',+ );++ const result = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ assertExplicitPinConflict(result, 'two pinned routes crossing at straight-through vias');+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route crossing');+ assert.deepEqual(diagnostic.evidence.point, [334, 243]);+ assert.deepEqual(diagnostic.evidence.conflictingPins, [+ { edge: 'a-pinned', field: 'via', path: '/edges/0/via', value: [[334, 243]] },+ { edge: 'z-pinned', field: 'via', path: '/edges/1/via', value: [[334, 243]] },+ ]);+ assertSupportedFixesNameChangedEdge(diagnostic, ['a-pinned', 'z-pinned']);+});++test('readable-v2 classifies a side-only authored route crossing an automatic route', () => {+ const document = workflow({+ lanes: ['l0', 'l1', 'l2'].map((id) => ({ id, label: id })),+ nodes: [+ { id: 'n00', lane: 'l0', col: 0, type: 'backend', label: 'N00' },+ { id: 'n01', lane: 'l0', col: 1, type: 'backend', label: 'N01' },+ { id: 'n02', lane: 'l0', col: 2, type: 'backend', label: 'N02' },+ { id: 'n11', lane: 'l1', col: 1, type: 'backend', label: 'N11' },+ ],+ edges: [+ { id: 'a-auto', from: 'n00', to: 'n01' },+ { id: 'z-side', from: 'n02', to: 'n11', fromSide: 'top', toSide: 'left' },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'side-only route crossing an automatic route');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route crossing');+ assert.ok(diagnostic.evidence.conflictingPins.length > 0);+ assert.ok(diagnostic.evidence.conflictingPins.every(({ edge, field, path, value }) => (+ edge === 'z-side'+ && ['fromSide', 'toSide'].includes(field)+ && path === `/edges/1/${field}`+ && value === document.edges[1][field]+ )), JSON.stringify(diagnostic.evidence.conflictingPins, null, 2));+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));++ for (const fix of diagnostic.supportedFixes) {+ const removal = fix.match(/^remove (fromSide|toSide)(?: and (fromSide|toSide))? from edge "z-side" /);+ assert.ok(removal, `supported fix must be a concrete side-pin removal: ${fix}`);+ const repaired = clone(document);+ for (const field of removal.slice(1).filter(Boolean)) delete repaired.edges[1][field];+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised side-pin repair must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 classifies a side-only authored route sharing an automatic corridor', () => {+ const document = workflow({+ lanes: ['l0', 'l1', 'l2'].map((id) => ({ id, label: id })),+ nodes: [+ { id: 'n00', lane: 'l0', col: 0, type: 'backend', label: 'N00' },+ { id: 'n02', lane: 'l0', col: 2, type: 'backend', label: 'N02' },+ { id: 'n01', lane: 'l0', col: 1, type: 'backend', label: 'N01' },+ { id: 'n03', lane: 'l0', col: 3, type: 'backend', label: 'N03' },+ ],+ edges: [+ { id: 'a-auto', from: 'n00', to: 'n02' },+ { id: 'z-side', from: 'n01', to: 'n03', fromSide: 'bottom', toSide: 'top' },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'side-only route sharing an automatic corridor');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route corridor clearance');+ assert.deepEqual(diagnostic.evidence.overlapStart, [214, 161]);+ assert.deepEqual(diagnostic.evidence.overlapEnd, [334, 161]);+ assert.equal(diagnostic.evidence.overlapLengthPx, 120);+ assert.ok(diagnostic.evidence.conflictingPins.length > 0);+ assert.ok(diagnostic.evidence.conflictingPins.every(({ edge, field, path, value }) => (+ edge === 'z-side'+ && ['fromSide', 'toSide'].includes(field)+ && path === `/edges/1/${field}`+ && value === document.edges[1][field]+ )), JSON.stringify(diagnostic.evidence.conflictingPins, null, 2));+ assert.ok(diagnostic.supportedFixes.length > 0, JSON.stringify(diagnostic, null, 2));++ for (const fix of diagnostic.supportedFixes) {+ const removal = fix.match(/^remove (fromSide|toSide)(?: and (fromSide|toSide))? from edge "z-side" /);+ assert.ok(removal, `supported fix must be a concrete side-pin removal: ${fix}`);+ const repaired = clone(document);+ for (const field of removal.slice(1).filter(Boolean)) delete repaired.edges[1][field];+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, `advertised side-pin repair must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 classifies a preset-only route sharing an automatic corridor', () => {+ const document = workflow({+ lanes: [{ id: 'l0', label: 'l0' }, { id: 'l1', label: 'l1' }],+ nodes: [+ { id: 'n00', lane: 'l0', col: 0, type: 'backend', label: 'N00' },+ { id: 'n11', lane: 'l1', col: 1, type: 'backend', label: 'N11' },+ { id: 'n01', lane: 'l0', col: 1, type: 'backend', label: 'N01' },+ { id: 'n02', lane: 'l0', col: 2, type: 'backend', label: 'N02' },+ ],+ edges: [+ { id: 'a-auto', from: 'n00', to: 'n11' },+ { id: 'z-route', from: 'n01', to: 'n02', route: 'bottom-channel' },+ ],+ });+ document.meta.quality_profile = 'showcase';++ const result = compileWorkflow({ workflow: document });+ assertExplicitPinConflict(result, 'preset-only route sharing an automatic corridor');+ const diagnostic = result.diagnostics[0];+ assert.equal(diagnostic.evidence.invariant, 'explicit route-route corridor clearance');+ assert.deepEqual(diagnostic.subject, {+ diagramType: 'workflow',+ edge: 'z-route',+ from: 'n01',+ to: 'n02',+ path: '/edges/1/route',+ });+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'z-route',+ field: 'route',+ path: '/edges/1/route',+ value: 'bottom-channel',+ }]);+ assert.deepEqual(diagnostic.evidence.overlapStart, [214, 166]);+ assert.deepEqual(diagnostic.evidence.overlapEnd, [214, 177]);+ assert.equal(diagnostic.evidence.overlapLengthPx, 11);+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove route from edge "z-route" so readable-v2 can replan the remaining authored route assertions',+ ]);++ const repaired = clone(document);+ delete repaired.edges[1].route;+ const verified = compileWorkflow({ workflow: repaired });+ assert.equal(verified.ok, true, JSON.stringify(verified.diagnostics, null, 2));+});++test('readable-v2 reports unknown edge endpoints with a precise semantic diagnostic', () => {+ const document = oneLaneWorkflow([{ id: 'ab', from: 'a', to: 'ghost' }]);+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ assert.equal(result.diagnostics.length, 1);+ assert.equal(result.diagnostics[0].code, 'workflow/unknown-edge-endpoint');+ assert.equal(result.diagnostics[0].subject.edge, 'ab');+ assert.equal(result.diagnostics[0].subject.path, '/edges/0/to');+ assert.deepEqual(result.diagnostics[0].evidence, {+ endpoint: 'target',+ unknownNodeId: 'ghost',+ availableNodeIds: ['a', 'b'],+ });+});++test('unknown endpoint diagnostics retain the authored edge pointer after canonical sorting', () => {+ const document = oneLaneWorkflow([+ { id: 'z-valid', from: 'a', to: 'b' },+ { id: 'a-invalid', from: 'a', to: 'ghost' },+ ]);++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1);+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/unknown-edge-endpoint');+ assert.equal(diagnostic.subject.edge, 'a-invalid');+ assert.equal(diagnostic.subject.path, '/edges/1/to');+ assert.equal(diagnostic.evidence.endpoint, 'target');+ assert.equal(diagnostic.evidence.unknownNodeId, 'ghost');+ assert.ok(diagnostic.supportedFixes.length > 0);+});++test('unknown node lane diagnostics retain the authored node pointer after canonical sorting', () => {+ const document = oneLaneWorkflow([]);+ document.nodes[0].lane = 'ghost';++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1);+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/unknown-node-lane');+ assert.equal(diagnostic.subject.node, 'a');+ assert.equal(diagnostic.subject.path, '/nodes/0/lane');+ assert.deepEqual(diagnostic.evidence, {+ unknownLaneId: 'ghost',+ availableLaneIds: ['main'],+ });+ assert.ok(diagnostic.supportedFixes.length > 0);+});++for (const fixture of [+ {+ name: 'lane id',+ code: 'workflow/duplicate-lane-id',+ expectedSubject: { lane: 'main', path: '/lanes/1/id' },+ expectedEvidence: {+ duplicateLaneId: 'main',+ firstPath: '/lanes/0/id',+ duplicatePath: '/lanes/1/id',+ },+ mutate(document) {+ document.lanes.push({ id: 'main', label: 'Duplicate Main' });+ },+ },+ {+ name: 'node id',+ code: 'workflow/duplicate-node-id',+ expectedSubject: { node: 'a', path: '/nodes/2/id' },+ expectedEvidence: {+ duplicateNodeId: 'a',+ firstPath: '/nodes/0/id',+ duplicatePath: '/nodes/2/id',+ },+ mutate(document) {+ document.nodes.push({+ id: 'a', lane: 'main', col: 4, type: 'database', label: 'Duplicate A',+ });+ },+ },+]) {+ test(`duplicate ${fixture.name} diagnostics name both authored source pointers`, () => {+ const document = oneLaneWorkflow([]);+ fixture.mutate(document);++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1);+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, fixture.code);+ assert.deepEqual(+ diagnostic.subject,+ { diagramType: 'workflow', ...fixture.expectedSubject },+ );+ assert.deepEqual(diagnostic.evidence, fixture.expectedEvidence);+ assert.ok(diagnostic.supportedFixes.length > 0);+ });+}++test('showcase rejects nested authored outside-right corridors while standard permits them', () => {+ const document = nestedOutsideRightCorridorWorkflow();++ const standard = compileWorkflow({ workflow: clone(document), qualityProfile: 'standard' });+ assert.equal(standard.ok, true, JSON.stringify(standard.diagnostics, null, 2));++ const showcase = compileWorkflow({ workflow: clone(document), qualityProfile: 'showcase' });+ assertExplicitPinConflict(showcase, 'nested authored outside-right corridors');+ const diagnostic = showcase.diagnostics.find(({ code }) => (+ code === 'workflow/explicit-pin-conflict'+ ));+ assertSupportedFixesNameChangedEdge(diagnostic, ['inner', 'outer']);+ assert.deepEqual(+ diagnostic.evidence.conflictingPins.map(({ edge, field, value }) => ({ edge, field, value })),+ [{ edge: 'inner', field: 'channelX', value: 800 }],+ );+ assert.deepEqual(diagnostic.supportedFixes, [+ 'remove channelX from edge "inner" so readable-v2 can replan the remaining authored route assertions',+ ]);+ const repaired = clone(document);+ delete repaired.edges.find(({ id }) => id === 'inner').channelX;+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'showcase' });+ assert.equal(verified.ok, true, JSON.stringify(verified.diagnostics, null, 2));+});++test('an explicit standard profile overrides an ambient showcase profile', () => {+ const document = nestedOutsideRightCorridorWorkflow();+ document.meta.quality_profile = 'showcase';+ const previousProfile = process.env.ARCHIFY_QUALITY_PROFILE;++ try {+ process.env.ARCHIFY_QUALITY_PROFILE = 'showcase';+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(+ result.ok,+ true,+ `the explicit standard profile must win:\n${JSON.stringify(result.diagnostics, null, 2)}`,+ );+ } finally {+ if (previousProfile === undefined) delete process.env.ARCHIFY_QUALITY_PROFILE;+ else process.env.ARCHIFY_QUALITY_PROFILE = previousProfile;+ }+});++test('readable-v2 never advertises an unverified blocking-node repair', () => {+ const document = workflow({+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [{ id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' }],+ edges: [{ id: 'self', from: 'a', to: 'a' }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/solver-budget-exhausted');+ assert.ok(diagnostic, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(diagnostic.supportedFixes, []);+});++for (const { name, makeVia } of [+ {+ name: 'a 4px endpoint stub',+ makeVia: ({ start, end }) => [+ [start[0] + 4, start[1]],+ [start[0] + 4, start[1] + 41],+ [end[0], start[1] + 41],+ ],+ },+ {+ name: 'a 12px interior turn segment',+ makeVia: ({ start }) => [+ [start[0] + 20, start[1]],+ [start[0] + 20, start[1] + 31],+ [start[0] + 32, start[1] + 31],+ [start[0] + 32, start[1]],+ ],+ },+]) {+ test(`standard profile rejects ${name} as a hard route constraint`, () => {+ const via = makeVia(oneLaneAnchors());+ const result = compileWorkflow({+ workflow: oneLaneWorkflow([{ id: 'ab', from: 'a', to: 'b', via }]),+ qualityProfile: 'standard',+ });+ assert.equal(result.ok, false, `${name} must be invalid in standard as well as showcase`);+ assert.ok(Array.isArray(result.diagnostics) && result.diagnostics.length > 0);+ });+}++test('readable-v2 reports collapsed channel pins without escaping the compiler boundary', () => {+ const { start } = oneLaneAnchors();+ for (const pin of [+ { channelX: start[0] },+ { channelY: start[1] },+ ]) {+ let result;+ assert.doesNotThrow(() => {+ result = compileWorkflow({+ workflow: oneLaneWorkflow([{ id: 'ab', from: 'a', to: 'b', ...pin }]),+ qualityProfile: 'standard',+ });+ });+ assertExplicitPinConflict(result, JSON.stringify(pin));+ assert.ok(result.diagnostics.some(({ evidence }) => (+ evidence?.invariant === 'non-zero route segments'+ )));+ }+});++test('parallel anonymous edges remain byte-deterministic when their input order changes', () => {+ const document = oneLaneWorkflow([+ { from: 'a', to: 'b', variant: 'default', role: 'main' },+ { from: 'a', to: 'b', variant: 'dashed', role: 'async' },+ ]);+ const reordered = clone(document);+ reordered.edges.reverse();++ const first = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ const second = compileWorkflow({ workflow: reordered, qualityProfile: 'standard' });+ assert.equal(first.ok, true, JSON.stringify(first.diagnostics, null, 2));+ assert.equal(second.ok, true, JSON.stringify(second.diagnostics, null, 2));+ assert.equal(second.svg, first.svg);+ assert.equal(JSON.stringify(second.receipt), JSON.stringify(first.receipt));+});++test('compileWorkflow returns a diagnostic result instead of throwing when meta is absent', () => {+ const document = oneLaneWorkflow([]);+ delete document.meta;++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.ok(Array.isArray(result.diagnostics) && result.diagnostics.length > 0);+});++test('compileWorkflow returns typed failures for non-document public inputs without throwing', () => {+ for (const input of [undefined, null, [], {}]) {+ const result = compileWorkflow({ workflow: input });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.ok(Array.isArray(result.diagnostics) && result.diagnostics.length > 0);+ assert.ok(result.diagnostics.every(({ code }) => code !== 'internal/unclassified'));+ assert.ok(result.diagnostics.every(({ supportedFixes }) => (+ Array.isArray(supportedFixes) && supportedFixes.length === 0+ )));+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);+ }+});++test('compileWorkflow enforces the canonical workflow schema at its public boundary', () => {+ for (const { expectedCode, mutate, qualityProfile } of [+ { expectedCode: 'schema/additionalProperties', mutate: (document) => { document.unsupported = true; } },+ { expectedCode: 'schema/enum', mutate: (document) => { document.nodes[0].type = 'bogus'; } },+ { expectedCode: 'schema/minimum', mutate: (document) => { document.nodes[0].width = 31; } },+ { expectedCode: 'schema/required', mutate: (document) => { delete document.nodes[0].label; } },+ { expectedCode: 'schema/enum', mutate: () => {}, qualityProfile: 'impossible' },+ ]) {+ const document = oneLaneWorkflow([]);+ mutate(document);+ const result = compileWorkflow({ workflow: document, qualityProfile });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.ok(+ result.diagnostics.some(({ code }) => code === expectedCode),+ JSON.stringify(result.diagnostics, null, 2),+ );+ assert.ok(result.diagnostics.every(({ code }) => code !== 'internal/unclassified'));+ assert.ok(result.diagnostics.every(({ supportedFixes }) => (+ Array.isArray(supportedFixes) && supportedFixes.length === 0+ )));+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);+ }+});++test('readable-v2 rejects a negative absolute label pin without an explicit viewBox', () => {+ const document = oneLaneWorkflow([{+ id: 'ab', from: 'a', to: 'b', label: 'pinned', labelAt: [-20, 80],+ }]);+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/explicit-pin-conflict');+ assert.deepEqual(diagnostic.subject, {+ diagramType: 'workflow',+ edge: 'ab',+ from: 'a',+ to: 'b',+ path: '/edges/0/labelAt',+ });+ assert.equal(diagnostic.evidence.invariant, 'viewBox-origin containment');+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'ab',+ field: 'labelAt',+ path: '/edges/0/labelAt',+ value: [-20, 80],+ }]);+ assert.deepEqual(diagnostic.evidence.offendingRect, {+ x: -39.4,+ y: 70,+ width: 38.8,+ height: 14,+ });+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);++ assert.ok(diagnostic.supportedFixes.length > 0);+ for (const fix of diagnostic.supportedFixes) {+ const repaired = clone(document);+ const target = repaired.edges.find(({ id }) => fix.includes(`edge "${id}"`));+ assert.ok(target, `supported fix must name an existing edge: ${fix}`);+ const replacement = fix.match(/^set labelAt on edge "[^"]+" to \[(-?\d+(?:\.\d+)?), (-?\d+(?:\.\d+)?)\]$/);+ if (replacement) {+ target.labelAt = replacement.slice(1).map(Number);+ } else {+ assert.match(fix, /^remove labelAt from edge "[^"]+" /);+ delete target.labelAt;+ }+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(verified.ok, true, `advertised fix must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`);+ }+});++test('readable-v2 rejects an explicit channel that crosses the measured legend', () => {+ const document = oneLaneWorkflow([{+ id: 'ab',+ from: 'a',+ to: 'b',+ route: 'bottom-channel',+ channelY: 200,+ fromSide: 'bottom',+ toSide: 'bottom',+ }]);+ document.meta.legend = { mode: 'all' };+ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'legend-crossing channelY');+ assert.ok(result.diagnostics.some(({ evidence }) => evidence?.invariant === 'legend clearance'));+});++test('readable-v2 explicit-pin diagnostics name the first intersected node and segment', () => {+ const document = workflow({+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'obstacle', lane: 'main', col: 1, type: 'database', label: 'Obstacle' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ fromSide: 'right',+ toSide: 'left',+ via: [[200, 119], [260, 119]],+ }],+ });++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assertExplicitPinConflict(result, 'unrelated node collision');+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.evidence.invariant, 'node clearance');+ assert.deepEqual({+ obstacleNode: diagnostic.evidence.obstacleNode,+ obstacleRole: diagnostic.evidence.obstacleRole,+ segmentIndex: diagnostic.evidence.segmentIndex,+ from: diagnostic.evidence.from,+ to: diagnostic.evidence.to,+ clearancePx: diagnostic.evidence.clearancePx,+ }, {+ obstacleNode: 'obstacle',+ obstacleRole: 'unrelated',+ segmentIndex: 0,+ from: [140, 119],+ to: [200, 119],+ clearancePx: 2,+ });+});++test('fixed-v1 publishes only repairs that survive complete replanning', () => {+ const document = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Verified fixes', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ groups: [{ id: 'target-only', label: 'Target', lane: 'main', fromCol: 2, toCol: 2 }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b' }],+ };++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(result.ok, false);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/column-capacity');+ assert.ok(diagnostic);+ assert.ok(+ diagnostic.supportedFixes.every((fix) => !/^move node /.test(fix)),+ `moving the group's only node must not be advertised as verified: ${diagnostic.supportedFixes}`,+ );+});++test('fixed-v1 verifies the exact serialized values in every rounded-width repair', () => {+ const document = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Rounded verified widths', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'M' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A', width: 52.006 },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B', width: 51.995 },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b' }],+ };++ const result = compileWorkflow({ workflow: document, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/column-capacity');+ assert.deepEqual(diagnostic.evidence.nodeWidthsPx, [52.006, 51.995]);+ assert.ok(diagnostic.supportedFixes.length > 0);+ assert.ok(+ diagnostic.supportedFixes.includes('set node widths "a"=52px and "b"=51.99px'),+ JSON.stringify(diagnostic.supportedFixes, null, 2),+ );++ for (const fix of diagnostic.supportedFixes) {+ const repaired = clone(document);+ if (fix === 'migrate this workflow to schema_version 2') {+ repaired.schema_version = 2;+ } else {+ const move = fix.match(/^move node "([^"]+)" to verified free column (\d+)$/);+ const widths = [...fix.matchAll(/"([^"]+)"=([\d.]+)px/g)];+ if (move) {+ repaired.nodes.find(({ id }) => id === move[1]).col = Number(move[2]);+ } else {+ assert.ok(widths.length > 0, `unsupported advertised repair: ${fix}`);+ for (const [, nodeId, width] of widths) {+ repaired.nodes.find(({ id }) => id === nodeId).width = Number(width);+ }+ }+ }+ const verified = compileWorkflow({ workflow: repaired, qualityProfile: 'standard' });+ assert.equal(+ verified.ok,+ true,+ `advertised fix must recompile: ${fix}\n${JSON.stringify(verified.diagnostics, null, 2)}`,+ );+ }+});diff --git a/archify/test/workflow-compiler.test.mjs b/archify/test/workflow-compiler.test.mjsnew file mode 100644index 00000000..5266aaa1--- /dev/null+++ b/archify/test/workflow-compiler.test.mjs@@ -0,0 +1,1163 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { createHash } from 'node:crypto';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const skillRoot = path.resolve(__dirname, '..');+const cli = path.join(skillRoot, 'bin', 'archify.mjs');+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-workflow-compiler-'));++function readJson(file) {+ return JSON.parse(fs.readFileSync(file, 'utf8'));+}++function clone(value) {+ return JSON.parse(JSON.stringify(value));+}++function sha256(value) {+ return createHash('sha256').update(value).digest('hex');+}++function attribute(tag, name) {+ const value = tag.match(new RegExp(`\\b${name}="([^"]*)"`))?.[1];+ assert.notEqual(value, undefined, `expected ${name} in ${tag}`);+ return value;+}++function numericRect(attributes) {+ return Object.fromEntries(['x', 'y', 'width', 'height'].map((name) => [+ name,+ Number(attribute(attributes, name)),+ ]));+}++function nodeRect(svg, id) {+ const escapedId = id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const attributes = svg.match(new RegExp(+ `<g\\b[^>]*id="node-${escapedId}"[^>]*>[\\s\\S]*?<rect\\b([^>]*)>`,+ ))?.[1];+ assert.ok(attributes, `expected rendered node ${id}`);+ return numericRect(attributes);+}++function edgePoints(svg, id) {+ const tag = (svg.match(/<path\b[^>]*>/g) || []).find((candidate) => (+ attributeOrUndefined(candidate, 'data-edge-id') === id+ ));+ assert.ok(tag, `expected rendered edge ${id}`);+ return attribute(tag, 'data-composition-points')+ .split(';')+ .map((point) => point.split(',').map(Number));+}++function edgeLabelRect(svg, id) {+ const escapedId = id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const attributes = svg.match(new RegExp(+ `<g\\b(?=[^>]*data-edge-id="${escapedId}")(?=[^>]*data-edge-label=)[^>]*>[\\s\\S]*?<rect\\b([^>]*)>`,+ ))?.[1];+ assert.ok(attributes, `expected rendered label mask for edge ${id}`);+ return numericRect(attributes);+}++function attributeOrUndefined(tag, name) {+ return tag.match(new RegExp(`\\b${name}="([^"]*)"`))?.[1];+}++function svgViewBox(svg) {+ const tag = svg.match(/<svg\b[^>]*>/)?.[0];+ assert.ok(tag, 'expected an SVG root');+ return attribute(tag, 'viewBox').split(/\s+/).map(Number);+}++function legendGeometry(svg) {+ return svg.match(/<g data-legend-semantic-kind="[^"]+"[^>]*>/g) || [];+}++function assertRectInsideViewBox(rect, viewBox, message) {+ const [minX, minY, width, height] = viewBox;+ assert.ok(rect.x >= minX, `${message}: left edge ${rect.x} is outside ${minX}`);+ assert.ok(rect.y >= minY, `${message}: top edge ${rect.y} is outside ${minY}`);+ assert.ok(+ rect.x + rect.width <= minX + width,+ `${message}: right edge ${rect.x + rect.width} is outside ${minX + width}`,+ );+ assert.ok(+ rect.y + rect.height <= minY + height,+ `${message}: bottom edge ${rect.y + rect.height} is outside ${minY + height}`,+ );+}++function assertRectInsideRect(rect, container, message) {+ assert.ok(rect.x >= container.x, `${message}: left edge ${rect.x} is outside ${container.x}`);+ assert.ok(rect.y >= container.y, `${message}: top edge ${rect.y} is outside ${container.y}`);+ assert.ok(+ rect.x + rect.width <= container.x + container.width,+ `${message}: right edge ${rect.x + rect.width} is outside ${container.x + container.width}`,+ );+ assert.ok(+ rect.y + rect.height <= container.y + container.height,+ `${message}: bottom edge ${rect.y + rect.height} is outside ${container.y + container.height}`,+ );+}++function groupFrameRect(svg, index = 0) {+ const attributes = svg.match(new RegExp(+ `<rect\\b(?=[^>]*data-composition-frame-kind="group")(?=[^>]*data-composition-frame-id="group-${index}")([^>]*)/>`,+ ))?.[1];+ assert.ok(attributes, `expected rendered group frame ${index}`);+ return numericRect(attributes);+}++function asciiGroupLabelTextRect(svg, label) {+ const escapedLabel = label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const attributes = svg.match(new RegExp(`<text\\b([^>]*)>${escapedLabel}</text>`))?.[1];+ assert.ok(attributes, `expected rendered group label ${label}`);+ return {+ x: Number(attribute(attributes, 'x')),+ y: Number(attribute(attributes, 'y')) - 10,+ width: Array.from(label).length * 5.6,+ height: 14,+ };+}++function rectsOverlap(left, right) {+ return !(+ left.x + left.width <= right.x+ || right.x + right.width <= left.x+ || left.y + left.height <= right.y+ || right.y + right.height <= left.y+ );+}++function orthogonalSegmentIntersectsRect(start, end, rect) {+ const left = rect.x;+ const right = rect.x + rect.width;+ const top = rect.y;+ const bottom = rect.y + rect.height;+ if (start[1] === end[1]) {+ return start[1] >= top && start[1] <= bottom+ && Math.max(start[0], end[0]) >= left+ && Math.min(start[0], end[0]) <= right;+ }+ if (start[0] === end[0]) {+ return start[0] >= left && start[0] <= right+ && Math.max(start[1], end[1]) >= top+ && Math.min(start[1], end[1]) <= bottom;+ }+ throw new Error(`expected an orthogonal route segment: ${JSON.stringify([start, end])}`);+}++function asciiLaneHeaderTextRect(label, { laneTop = 52, laneIndex = 0 } = {}) {+ const prefix = String(laneIndex + 1).padStart(2, '0');+ return {+ x: 54,+ y: laneTop + 12,+ width: Array.from(`${prefix} / ${label}`).length * 6.2,+ height: 14,+ };+}++function compileSuccessfully(workflow, qualityProfile) {+ const request = qualityProfile === undefined+ ? { workflow }+ : { workflow, qualityProfile };+ const result = compileWorkflow(request);+ assert.equal(+ result.ok,+ true,+ `expected workflow compilation to succeed:\n${JSON.stringify(result.diagnostics, null, 2)}`,+ );+ assert.equal(typeof result.svg, 'string');+ assert.match(result.svg, /^\s*<svg\b/, 'compiler should return one canonical renderer SVG');+ assert.ok(result.receipt);+ assert.deepEqual(result.receipt.diagnostics, []);+ return result;+}++function adjacentWorkflow({+ fromCol = 1,+ toCol = fromCol + 1,+ label,+ widths = [92, 92],+ nodeLabels = ['A', 'B'],+ viewBox,+ frames = false,+} = {}) {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: {+ title: `Adjacent ranks ${fromCol} to ${toCol}`,+ legend: { mode: 'hidden' },+ ...(viewBox ? { viewBox } : {}),+ },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ {+ id: 'a', lane: 'main', col: fromCol, type: 'backend', label: nodeLabels[0], width: widths[0],+ },+ {+ id: 'b', lane: 'main', col: toCol, type: 'backend', label: nodeLabels[1], width: widths[1],+ },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', ...(label ? { label } : {}) }],+ };+ if (frames) {+ workflow.phases = [{+ id: 'phase', label: 'P', fromCol, toCol,+ }];+ workflow.groups = [{+ id: 'group', label: 'G', lane: 'main', fromCol, toCol,+ }];+ }+ return workflow;+}++function assertReadableAdjacentResult(result, { label, widths = [92, 92] } = {}) {+ assert.equal(result.receipt.contract, 'readable-v2');+ assert.deepEqual(result.receipt.viewBox, svgViewBox(result.svg).slice(2));+ assert.ok(Array.isArray(result.receipt.requiredViewBox));+ assert.equal(result.receipt.columns.length, 6);+ assert.ok(result.receipt.columns.every(Number.isFinite));+ for (let index = 1; index < result.receipt.columns.length; index += 1) {+ assert.ok(+ result.receipt.columns[index] > result.receipt.columns[index - 1],+ `column ${index} must be strictly after column ${index - 1}`,+ );+ }++ const source = nodeRect(result.svg, 'a');+ const target = nodeRect(result.svg, 'b');+ assert.equal(source.width, widths[0]);+ assert.equal(target.width, widths[1]);+ assert.ok(source.x + source.width <= target.x, 'same-lane nodes must not overlap');++ const points = edgePoints(result.svg, 'ab');+ assert.deepEqual(points.length, 2, `adjacent facing nodes should use a direct route: ${JSON.stringify(points)}`);+ assert.equal(points[0][0], source.x + source.width, 'edge must leave the source right side');+ assert.equal(points[1][0], target.x, 'edge must enter the target left side');+ assert.equal(points[0][1], points[1][1], 'direct route must be horizontal');+ const directClearance = points[1][0] - points[0][0];+ assert.ok(directClearance >= 28, `direct clearance ${directClearance}px must be at least 28px`);++ if (label) {+ const mask = edgeLabelRect(result.svg, 'ab');+ assert.ok(+ directClearance + 1e-9 >= mask.width + 8,+ `labeled direct clearance ${directClearance}px must fit ${mask.width}px mask plus 8px breathing room`,+ );+ assertRectInsideViewBox(mask, svgViewBox(result.svg), 'edge label mask');+ }+}++test('fixed-v1 compiler preserves the official workflow baseline SVG byte-for-byte', () => {+ const workflow = readJson(path.join(__dirname, 'fixtures', 'v1-baseline', 'agent-tool-call.workflow.json'));+ const result = compileSuccessfully(workflow);+ assert.equal(result.receipt.contract, 'fixed-v1');+ assert.equal(+ sha256(result.svg),+ '4e493db1977889675ce7b04bf9ba60fb97cb50f01fc0fd9e8446861282c65645',+ );+});++test('fixed-v1 compiler preserves the exact 700x400 compatibility geometry', () => {+ const workflow = readJson(path.join(+ __dirname,+ 'fixtures',+ 'v1-workflow-700x400.workflow.json',+ ));++ const result = compileSuccessfully(workflow);+ assert.equal(result.receipt.contract, 'fixed-v1');+ assert.deepEqual(result.receipt.viewBox, [700, 400]);+ assert.deepEqual(svgViewBox(result.svg), [0, 0, 700, 400]);+ assert.equal(+ sha256(result.svg),+ '28b0167460d16c55ae6bf38bde41368248671a78b3a49133da05ed1efb4354af',+ 'the v1 compiler extraction must not move or reserialize legacy geometry',+ );+});++test('fixed-v1 keeps valid phase and group spans independent of label measurement', () => {+ const workflow = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Fixed v1 frame geometry', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ phases: [{ id: 'phase', label: 'P'.repeat(17), fromCol: 0, toCol: 0 }],+ groups: [{+ id: 'group', label: 'G'.repeat(30), lane: 'main', fromCol: 0, toCol: 0,+ }],+ nodes: [{ id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' }],+ edges: [],+ };++ const result = compileSuccessfully(workflow);+ assert.match(+ result.svg,+ /<line x1="42" y1="35" x2="134" y2="35"/,+ 'v1 phase spans must retain the legacy fixed 46px padding',+ );+ assert.match(+ result.svg,+ /data-composition-frame-kind="group"[^>]* x="38" y="90" width="100"/,+ 'v1 group spans must retain the legacy fixed 50px padding',+ );+});++test('fixed-v1 reports one causal column-capacity diagnostic for issue #126', () => {+ const workflow = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Issue 126 causal diagnostic', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b', label: 'liga' }],+ };++ const result = compileWorkflow({ workflow, qualityProfile: 'showcase' });+ assert.equal(result.ok, false);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ assert.deepEqual(result.receipt.diagnostics, result.diagnostics);++ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/column-capacity');+ assert.equal(diagnostic.subject.edge, 'ab');+ assert.equal(diagnostic.subject.from, 'a');+ assert.equal(diagnostic.subject.to, 'b');+ assert.equal(diagnostic.subject.fromCol, 1);+ assert.equal(diagnostic.subject.toCol, 2);+ assert.deepEqual(diagnostic.evidence, {+ centerDistancePx: 80,+ nodeWidthsPx: [92, 92],+ actualSignedClearancePx: -12,+ requiredDirectClearancePx: 28,+ });+ assert.deepEqual(diagnostic.suppresses, [+ 'workflow/short-edge',+ 'clean-flow/endpoint-side-direction',+ 'workflow/label-node-overlap',+ ]);+ assert.ok(diagnostic.supportedFixes.some((fix) => /schema_version 2/.test(fix)));+ assert.ok(diagnostic.supportedFixes.some((fix) => /column 3/.test(fix)));+ assert.ok(diagnostic.supportedFixes.some((fix) => /width/i.test(fix)));+ assert.doesNotMatch(+ diagnostic.supportedFixes.join('\n'),+ /drop|remove|omit|unlabel|channel/i,+ 'a causal overlap diagnostic must not propose a label or routing non-fix',+ );+});++test('fixed-v1 verifies the real coordinate migration before advertising it', () => {+ const workflow = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Pinned issue 126 migration',+ viewBox: [720, 400],+ legend: { mode: 'hidden' },+ },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ fromSide: 'top',+ toSide: 'top',+ via: [[220, 60], [300, 60]],+ }],+ };++ const result = compileWorkflow({ workflow, qualityProfile: 'showcase' });+ assert.equal(result.ok, false);+ assert.equal(result.diagnostics[0].code, 'workflow/column-capacity');+ assert.ok(+ result.diagnostics[0].supportedFixes.includes('migrate this workflow to schema_version 2'),+ JSON.stringify(result.diagnostics[0], null, 2),+ );+});++test('readable-v2 supports every adjacent rank with and without a semantic label', () => {+ for (const qualityProfile of ['standard', 'showcase']) {+ for (let fromCol = 0; fromCol < 5; fromCol += 1) {+ for (const label of [undefined, 'liga']) {+ const result = compileSuccessfully(adjacentWorkflow({ fromCol, label }), qualityProfile);+ assertReadableAdjacentResult(result, { label });+ }+ }+ }+});++test('readable-v2 satisfies the complete adjacent-rank acceptance matrix', () => {+ let cases = 0;+ for (const qualityProfile of ['standard', 'showcase']) {+ for (let fromCol = 0; fromCol < 5; fromCol += 1) {+ for (const label of [undefined, 'liga']) {+ for (const frames of [false, true]) {+ for (const width of [900, 1080, 1400, 1600]) {+ const result = compileSuccessfully(adjacentWorkflow({+ fromCol,+ label,+ frames,+ viewBox: [width, 420],+ }), qualityProfile);+ assert.deepEqual(result.receipt.viewBox, [width, 420]);+ assertReadableAdjacentResult(result, { label });+ if (frames) assert.match(result.svg, /data-composition-frame-kind="group"/);+ cases += 1;+ }+ }+ }+ }+ }+ assert.equal(cases, 160);+});++test('readable-v2 phase and group frames derive from solved ranks without moving the core geometry', () => {+ for (const qualityProfile of ['standard', 'showcase']) {+ for (let fromCol = 0; fromCol < 5; fromCol += 1) {+ const plain = compileSuccessfully(adjacentWorkflow({ fromCol, label: 'liga' }), qualityProfile);+ const framed = compileSuccessfully(+ adjacentWorkflow({ fromCol, label: 'liga', frames: true }),+ qualityProfile,+ );++ assert.deepEqual(framed.receipt.columns, plain.receipt.columns);+ assert.deepEqual(nodeRect(framed.svg, 'a'), nodeRect(plain.svg, 'a'));+ assert.deepEqual(nodeRect(framed.svg, 'b'), nodeRect(plain.svg, 'b'));+ assert.deepEqual(edgePoints(framed.svg, 'ab'), edgePoints(plain.svg, 'ab'));+ assert.match(framed.svg, /data-composition-frame-kind="group"/);+ assertReadableAdjacentResult(framed, { label: 'liga' });+ }+ }+});++test('readable-v2 treats the phase header mask as a routing obstacle', () => {+ const document = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Phase route obstacle', legend: { mode: 'hidden' } },+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'bottom', col: 4, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab', from: 'a', to: 'b', fromSide: 'top', toSide: 'top',+ }],+ };++ const withoutPhase = compileSuccessfully(clone(document), 'showcase');+ assert.ok(withoutPhase.receipt.edges.find(({ id }) => id === 'ab'));++ const withPhaseDocument = clone(document);+ withPhaseDocument.phases = [{ id: 'p', label: 'Phase', fromCol: 0, toCol: 5 }];+ const withPhase = compileSuccessfully(withPhaseDocument, 'showcase');+ const columns = withPhase.receipt.columns;+ const phaseMask = {+ x: columns[0] - 46,+ y: 27,+ width: (columns[5] + 46) - (columns[0] - 46),+ height: 16,+ };+ const points = withPhase.receipt.edges.find(({ id }) => id === 'ab').points;+ for (let index = 0; index < points.length - 1; index += 1) {+ assert.equal(+ orthogonalSegmentIntersectsRect(points[index], points[index + 1], phaseMask),+ false,+ `edge ab segment ${index} must clear the phase mask: ${JSON.stringify(points)}`,+ );+ }+});++test('readable-v2 never routes through a single-rank group label', () => {+ const groupLabel = 'Very long group label';+ const document = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Group label route obstacle', legend: { mode: 'hidden' } },+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ groups: [{ id: 'g', label: groupLabel, lane: 'top', fromCol: 2, toCol: 2 }],+ nodes: [+ { id: 'a', lane: 'top', col: 2, type: 'backend', label: 'A' },+ { id: 'b', lane: 'bottom', col: 4, type: 'database', label: 'B' },+ ],+ edges: [{+ id: 'ab', from: 'a', to: 'b', fromSide: 'top', toSide: 'top',+ }],+ };++ const first = compileWorkflow({ workflow: document, qualityProfile: 'showcase' });+ const second = compileWorkflow({ workflow: clone(document), qualityProfile: 'showcase' });+ assert.deepEqual(second, first, 'repeated compilation must be deterministic');++ assert.equal(first.ok, false);+ assert.equal(first.svg, undefined);+ assert.equal(first.diagnostics.length, 1, JSON.stringify(first.diagnostics, null, 2));+ const [diagnostic] = first.diagnostics;+ assert.equal(diagnostic.code, 'workflow/explicit-pin-conflict');+ assert.equal(diagnostic.subject.path, '/edges/0/fromSide');+ assert.equal(+ diagnostic.evidence.invariant,+ 'readable route feasibility with authored endpoint sides',+ );+ assert.deepEqual(diagnostic.evidence.conflictingPins, [{+ edge: 'ab',+ field: 'fromSide',+ path: '/edges/0/fromSide',+ value: 'top',+ }]);+ assert.ok(diagnostic.supportedFixes.length > 0);+ assert.deepEqual(first.receipt.diagnostics, first.diagnostics);++ const repaired = clone(document);+ delete repaired.edges[0].fromSide;+ const rendered = compileWorkflow({ workflow: repaired, qualityProfile: 'showcase' });+ assert.equal(rendered.ok, true, JSON.stringify(rendered.diagnostics, null, 2));++ const escapedLabel = groupLabel.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const attributes = rendered.svg.match(new RegExp(+ `<text\\b([^>]*)>${escapedLabel}</text>`,+ ))?.[1];+ assert.ok(attributes, 'expected the rendered group label');+ const groupLabelRect = {+ x: Number(attribute(attributes, 'x')),+ y: Number(attribute(attributes, 'y')) - 10,+ width: Array.from(groupLabel).length * 5.6,+ height: 14,+ };+ const points = rendered.receipt.edges.find(({ id }) => id === 'ab').points;+ for (let index = 0; index < points.length - 1; index += 1) {+ assert.equal(+ orthogonalSegmentIntersectsRect(points[index], points[index + 1], groupLabelRect),+ false,+ `edge ab segment ${index} must clear the group label: ${JSON.stringify(points)}`,+ );+ }+});++test('readable-v2 shifts top-side routes beyond lane header text deterministically', () => {+ const makeDocument = (topLaneLabel) => ({+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Lane header route obstacle', legend: { mode: 'hidden' } },+ lanes: [+ { id: 'top', label: topLaneLabel },+ { id: 'bottom', label: 'Bottom' },+ ],+ nodes: [+ { id: 'a', lane: 'top', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'bottom', col: 4, type: 'database', label: 'B' },+ ],+ edges: [{+ id: 'ab', from: 'a', to: 'b', fromSide: 'top', toSide: 'top',+ }],+ });++ const compiled = new Map();+ for (const label of ['Responsibility owner', 'R']) {+ const first = compileSuccessfully(makeDocument(label), 'showcase');+ const second = compileSuccessfully(makeDocument(label), 'showcase');+ assert.deepEqual(second, first, `${label}: repeated compilation must be deterministic`);++ const points = first.receipt.edges.find(({ id }) => id === 'ab').points;+ const headerRect = asciiLaneHeaderTextRect(label);+ for (let index = 0; index < points.length - 1; index += 1) {+ assert.equal(+ orthogonalSegmentIntersectsRect(points[index], points[index + 1], headerRect),+ false,+ `${label}: edge ab segment ${index} must clear the top lane header: ${JSON.stringify(points)}`,+ );+ }+ compiled.set(label, first);+ }++ assert.ok(+ compiled.get('Responsibility owner').receipt.columns[0]+ > compiled.get('R').receipt.columns[0],+ 'the wider lane header must move the col-0 top-side corridor farther right',+ );+});++test('explicit viewBox width is containment capacity and never stretches readable-v2 geometry', () => {+ for (const qualityProfile of ['standard', 'showcase']) {+ for (let fromCol = 0; fromCol < 5; fromCol += 1) {+ const intrinsic = compileSuccessfully(adjacentWorkflow({+ fromCol,+ label: 'liga',+ }), qualityProfile);+ const expectedGeometry = {+ columns: intrinsic.receipt.columns,+ source: nodeRect(intrinsic.svg, 'a'),+ target: nodeRect(intrinsic.svg, 'b'),+ edge: edgePoints(intrinsic.svg, 'ab'),+ };++ for (const width of [900, 1080, 1400, 1600]) {+ const result = compileSuccessfully(adjacentWorkflow({+ fromCol,+ label: 'liga',+ viewBox: [width, 420],+ }), qualityProfile);+ assert.deepEqual(result.receipt.viewBox, [width, 420]);+ assert.deepEqual(svgViewBox(result.svg), [0, 0, width, 420]);+ assert.deepEqual(result.receipt.requiredViewBox, intrinsic.receipt.requiredViewBox);+ assert.deepEqual(result.receipt.columns, expectedGeometry.columns);+ assert.deepEqual(nodeRect(result.svg, 'a'), expectedGeometry.source);+ assert.deepEqual(nodeRect(result.svg, 'b'), expectedGeometry.target);+ assert.deepEqual(edgePoints(result.svg, 'ab'), expectedGeometry.edge);+ assertReadableAdjacentResult(result, { label: 'liga' });+ }+ }+ }+});++test('capacity-only viewBox failures preserve the intrinsic routes, labels, and requirement', () => {+ const document = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'capacity', legend: { mode: 'hidden' } },+ lanes: [{ id: 'top', label: 'Top' }, { id: 'bottom', label: 'Bottom' }],+ nodes: [+ { id: 'n0', lane: 'top', col: 0, type: 'backend', label: 'N0' },+ { id: 'n1', lane: 'bottom', col: 1, type: 'backend', label: 'N1' },+ { id: 'n2', lane: 'top', col: 1, type: 'database', label: 'N2' },+ { id: 'n3', lane: 'bottom', col: 3, type: 'database', label: 'N3' },+ ],+ edges: [+ { id: 'e0', from: 'n3', to: 'n0' },+ {+ id: 'e1',+ from: 'n1',+ to: 'n2',+ label: 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ',+ },+ ],+ };+ const intrinsic = compileSuccessfully(clone(document), 'showcase');++ const insufficientDocument = clone(document);+ insufficientDocument.meta.viewBox = [900, 1000];+ const insufficient = compileWorkflow({+ workflow: insufficientDocument,+ qualityProfile: 'showcase',+ });+ assert.equal(insufficient.ok, false);+ assert.equal(insufficient.svg, undefined);+ assert.equal(insufficient.diagnostics.length, 1, JSON.stringify(insufficient.diagnostics, null, 2));+ const [capacity] = insufficient.diagnostics;+ assert.equal(capacity.code, 'workflow/viewbox-capacity');+ assert.deepEqual(capacity.evidence.actualViewBox, [900, 1000]);+ assert.deepEqual(capacity.evidence.requiredViewBox, intrinsic.receipt.requiredViewBox);++ const sufficientDocument = clone(document);+ sufficientDocument.meta.viewBox = [intrinsic.receipt.requiredViewBox[0], 1000];+ const sufficient = compileSuccessfully(sufficientDocument, 'showcase');+ assert.deepEqual(sufficient.receipt.requiredViewBox, intrinsic.receipt.requiredViewBox);+ assert.deepEqual(sufficient.receipt.edges, intrinsic.receipt.edges);+ assert.deepEqual(sufficient.receipt.labels, intrinsic.receipt.labels);+});++test('explicit viewBox capacity names the rank and label constraints that require more width', () => {+ const result = compileWorkflow({+ workflow: adjacentWorkflow({ fromCol: 1, label: 'liga', viewBox: [700, 420] }),+ qualityProfile: 'showcase',+ });+ assert.equal(result.ok, false);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/viewbox-capacity');+ assert.ok(diagnostic, JSON.stringify(result.diagnostics, null, 2));+ assert.ok(diagnostic.evidence.contributors.includes('rank 1→2 direct clearance'));+ assert.ok(diagnostic.evidence.contributors.includes('edge ab label mask'));+});++test('explicit viewBox capacity names the rank and authored node widths that require more width', () => {+ const result = compileWorkflow({+ workflow: adjacentWorkflow({+ fromCol: 1,+ widths: [240, 240],+ viewBox: [700, 420],+ }),+ qualityProfile: 'showcase',+ });+ assert.equal(result.ok, false);+ const diagnostic = result.diagnostics.find(({ code }) => code === 'workflow/viewbox-capacity');+ assert.ok(diagnostic, JSON.stringify(result.diagnostics, null, 2));+ const contributors = diagnostic.evidence.contributors;+ assert.ok(+ contributors.some((contributor) => /rank 1→2/i.test(contributor) && /clearance/i.test(contributor)),+ `contributors must name the rank 1→2 width constraint: ${JSON.stringify(contributors)}`,+ );+ for (const nodeId of ['a', 'b']) {+ assert.ok(+ contributors.some((contributor) => (+ new RegExp(`node ${nodeId}\\b`, 'i').test(contributor) && /width/i.test(contributor)+ )),+ `contributors must name node ${nodeId}'s authored width: ${JSON.stringify(contributors)}`,+ );+ }+});++test('explicit viewBox height capacity names the authored tall node without naming a hidden legend', () => {+ const result = compileWorkflow({+ workflow: {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: {+ title: 'Tall node height capacity',+ legend: { mode: 'hidden' },+ viewBox: [1200, 280],+ },+ lanes: [{ id: 'main', label: 'M' }],+ nodes: [{+ id: 'tall', lane: 'main', col: 0, type: 'backend', label: 'Tall', height: 160,+ }],+ edges: [],+ },+ qualityProfile: 'showcase',+ });++ assert.equal(result.ok, false);+ assert.equal(result.svg, undefined);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/viewbox-capacity');+ assert.deepEqual(diagnostic.evidence.actualViewBox, [1200, 280]);+ assert.equal(diagnostic.evidence.requiredViewBox[1], 374);+ const contributors = diagnostic.evidence.contributors;+ assert.ok(+ contributors.some((contributor) => (+ /node tall\b/i.test(contributor)+ && /height/i.test(contributor)+ && /160px/i.test(contributor)+ )),+ `contributors must name tall's authored 160px height: ${JSON.stringify(contributors)}`,+ );+ assert.equal(+ contributors.some((contributor) => /legend/i.test(contributor)),+ false,+ `a hidden legend must not be named as a height contributor: ${JSON.stringify(contributors)}`,+ );+});++test('readable-v2 measures asymmetric custom widths and CJK edge labels', () => {+ const cases = [+ { widths: [32, 92], label: '同步', nodeLabels: ['甲', '乙'] },+ { widths: [102, 124], label: '資料 ready', nodeLabels: ['入口', '出口'] },+ { widths: [132, 160], label: '审批通过', nodeLabels: ['请求', '执行'] },+ { widths: [92, 240], label: '结果 ✅ 回传', nodeLabels: ['工具', '外部服务'] },+ ];++ for (const current of cases) {+ const result = compileSuccessfully(adjacentWorkflow({+ fromCol: 1,+ label: current.label,+ widths: current.widths,+ nodeLabels: current.nodeLabels,+ viewBox: [1600, 420],+ }), 'showcase');+ assertReadableAdjacentResult(result, current);+ }+});++test('readable-v2 compares long-label gutter growth with a legal automatic channel', () => {+ const automaticDocument = adjacentWorkflow({+ fromCol: 3,+ label: 'L'.repeat(80),+ });+ const automatic = compileSuccessfully(automaticDocument, 'showcase');+ const forcedStraightDocument = clone(automaticDocument);+ forcedStraightDocument.edges[0].route = 'straight';+ const forcedStraight = compileSuccessfully(forcedStraightDocument, 'showcase');++ assert.ok(edgePoints(automatic.svg, 'ab').length > 2, 'the compact plan must use a legal channel');+ assert.ok(+ automatic.receipt.requiredViewBox[0] < forcedStraight.receipt.requiredViewBox[0],+ 'the selected channel must require less canvas than forcing the direct gutter',+ );+ assertRectInsideViewBox(+ edgeLabelRect(automatic.svg, 'ab'),+ svgViewBox(automatic.svg),+ 'long automatic edge label',+ );++ const leftRankDocument = adjacentWorkflow({ fromCol: 0, label: 'X'.repeat(100) });+ const leftRank = compileSuccessfully(leftRankDocument, 'showcase');+ assertRectInsideViewBox(+ edgeLabelRect(leftRank.svg, 'ab'),+ svgViewBox(leftRank.svg),+ 'left-rank long automatic edge label',+ );+});++test('readable-v2 property matrix satisfies every adjacent rank across supported representative widths', () => {+ const widths = [32, 92, 102, 124, 132, 160, 240];+ for (let fromCol = 0; fromCol < 5; fromCol += 1) {+ for (const sourceWidth of widths) {+ for (const targetWidth of widths) {+ const result = compileSuccessfully(adjacentWorkflow({+ fromCol,+ label: '同步 ✅',+ widths: [sourceWidth, targetWidth],+ }), 'showcase');+ assertReadableAdjacentResult(result, {+ label: '同步 ✅',+ widths: [sourceWidth, targetWidth],+ });+ }+ }+ }+});++test('readable-v2 expands rank spans for measured phase and group label capacity', () => {+ const workflow = adjacentWorkflow({ fromCol: 0, frames: true });+ workflow.phases[0].label = 'P'.repeat(50);+ workflow.groups[0].label = 'G'.repeat(50);++ const result = compileSuccessfully(workflow, 'showcase');+ assert.ok(result.receipt.columns[1] - result.receipt.columns[0] > 120);+ assertReadableAdjacentResult(result);+});++test('readable-v2 contains a long single-rank group label in its frame and intrinsic canvas', () => {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Single-rank group capacity', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ groups: [{+ id: 'long-group',+ label: 'X'.repeat(120),+ lane: 'main',+ fromCol: 5,+ toCol: 5,+ }],+ nodes: [+ { id: 'outside', lane: 'main', col: 2, type: 'database', label: 'Outside' },+ { id: 'node', lane: 'main', col: 5, type: 'backend', label: 'Node' },+ ],+ edges: [],+ };++ const result = compileSuccessfully(workflow, 'showcase');+ assert.ok(result.receipt.requiredViewBox[0] > 768);+ const groupAttributes = result.svg.match(+ /<rect\b(?=[^>]*data-composition-frame-id="group-0")[^>]*\b(x="[^"]+"[^>]*)\/>/,+ )?.[1];+ assert.ok(groupAttributes);+ const group = numericRect(groupAttributes);+ assert.ok(group.width >= 120 * 5.6 + 20, `group width ${group.width} must contain its label`);+ const outside = nodeRect(result.svg, 'outside');+ assert.ok(group.x >= outside.x + outside.width, 'single-rank group must not cover an unrelated rank');+ const labelBaseline = Number(result.svg.match(/<text\b[^>]*\by="([^"]+)"[^>]*>X{120}<\/text>/)?.[1]);+ assert.ok(labelBaseline <= nodeRect(result.svg, 'node').y - 4, 'group label must remain above its node');+});++test('readable-v2 group frames contain custom-width member rectangles on every side', () => {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Wide group member', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ groups: [{ id: 'group', label: 'G', lane: 'main', fromCol: 2, toCol: 2 }],+ nodes: [{+ id: 'wide', lane: 'main', col: 2, type: 'backend', label: 'Wide', width: 240,+ }],+ edges: [],+ };++ const result = compileSuccessfully(workflow, 'showcase');+ assertRectInsideRect(+ nodeRect(result.svg, 'wide'),+ groupFrameRect(result.svg),+ 'custom-width group member',+ );+});++test('readable-v2 group frames contain tagged and tall members away from the label rail', () => {+ const cases = [+ ['tagged member', { tag: 'TAG' }],+ ['120px-tall member', { height: 120 }],+ ];++ for (const [description, authoredGeometry] of cases) {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: description, legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ groups: [{ id: 'group', label: 'G', lane: 'main', fromCol: 0, toCol: 1 }],+ nodes: [{+ id: 'member',+ lane: 'main',+ col: 1,+ type: 'backend',+ label: 'Member',+ ...authoredGeometry,+ }],+ edges: [],+ };++ const result = compileSuccessfully(workflow, 'showcase');+ const member = nodeRect(result.svg, 'member');+ const groupLabel = asciiGroupLabelTextRect(result.svg, 'G');+ assert.ok(+ member.x >= groupLabel.x + groupLabel.width,+ `${description}: fixture must keep the member horizontally clear of its group label`,+ );+ assertRectInsideRect(member, groupFrameRect(result.svg), description);+ }+});++test('readable-v2 keeps a first-rank group label mask clear of its lane header mask', () => {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'First-rank group labels', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ groups: [{ id: 'group', label: 'G', lane: 'main', fromCol: 0, toCol: 0 }],+ nodes: [{ id: 'member', lane: 'main', col: 0, type: 'backend', label: 'Member' }],+ edges: [],+ };++ const result = compileSuccessfully(workflow, 'showcase');+ const laneHeader = asciiLaneHeaderTextRect('Main');+ const groupLabel = asciiGroupLabelTextRect(result.svg, 'G');+ assert.equal(+ rectsOverlap(laneHeader, groupLabel),+ false,+ `lane header ${JSON.stringify(laneHeader)} must not overlap group label ${JSON.stringify(groupLabel)}`,+ );+});++test('readable-v2 measures multi-row legends into intrinsic and explicit viewBox capacity', () => {+ const workflow = adjacentWorkflow({ fromCol: 0 });+ workflow.meta.legend = {+ mode: 'all',+ entries: Object.fromEntries([+ 'frontend', 'backend', 'security', 'messagebus', 'database', 'cloud', 'external',+ ].map((kind) => [kind, { label: `${kind} contract evidence` }])),+ };+ const hiddenDocument = clone(workflow);+ hiddenDocument.meta.legend = { mode: 'hidden' };+ const hidden = compileSuccessfully(hiddenDocument, 'showcase');+ const intrinsic = compileSuccessfully(workflow, 'showcase');+ assert.ok(intrinsic.receipt.requiredViewBox[1] > hidden.receipt.requiredViewBox[1]);++ const tooShortDocument = clone(workflow);+ tooShortDocument.meta.viewBox = [+ intrinsic.receipt.requiredViewBox[0],+ hidden.receipt.requiredViewBox[1],+ ];+ const tooShort = compileWorkflow({ workflow: tooShortDocument, qualityProfile: 'showcase' });+ assert.equal(tooShort.ok, false);+ assert.ok(tooShort.diagnostics.some(({ code }) => code === 'workflow/viewbox-capacity'));++ const sufficientDocument = clone(workflow);+ sufficientDocument.meta.viewBox = [...intrinsic.receipt.requiredViewBox];+ const sufficient = compileSuccessfully(sufficientDocument, 'showcase');+ assert.deepEqual(sufficient.receipt.viewBox, intrinsic.receipt.requiredViewBox);++ const expectedGeometry = {+ requiredViewBox: intrinsic.receipt.requiredViewBox,+ columns: intrinsic.receipt.columns,+ nodes: intrinsic.receipt.nodes,+ edges: intrinsic.receipt.edges,+ labels: intrinsic.receipt.labels,+ legend: legendGeometry(intrinsic.svg),+ };+ for (const width of [900, 1400]) {+ const explicitDocument = clone(workflow);+ explicitDocument.meta.viewBox = [width, 1000];+ const explicit = compileSuccessfully(explicitDocument, 'showcase');+ assert.deepEqual(explicit.receipt.requiredViewBox, expectedGeometry.requiredViewBox);+ assert.deepEqual(explicit.receipt.columns, expectedGeometry.columns);+ assert.deepEqual(explicit.receipt.nodes, expectedGeometry.nodes);+ assert.deepEqual(explicit.receipt.edges, expectedGeometry.edges);+ assert.deepEqual(explicit.receipt.labels, expectedGeometry.labels);+ assert.deepEqual(legendGeometry(explicit.svg), expectedGeometry.legend);+ }+});++test('a wide node in an unrelated lane does not expand the adjacent-rank gap', () => {+ const baselineDocument = adjacentWorkflow({+ fromCol: 1,+ label: 'liga',+ viewBox: [1600, 520],+ });+ baselineDocument.lanes.push({ id: 'other', label: 'Other' });+ const baseline = compileSuccessfully(baselineDocument, 'showcase');++ const withUnrelatedWideNode = clone(baselineDocument);+ withUnrelatedWideNode.nodes.push({+ id: 'wide', lane: 'other', col: 1, type: 'database', label: 'Wide', width: 240,+ });+ const widened = compileSuccessfully(withUnrelatedWideNode, 'showcase');++ assert.equal(+ widened.receipt.columns[2] - widened.receipt.columns[1],+ baseline.receipt.columns[2] - baseline.receipt.columns[1],+ );+});++test('explicit labelAt participates in readable-v2 viewBox containment', () => {+ const workflow = adjacentWorkflow({+ fromCol: 0,+ label: 'outside',+ viewBox: [900, 420],+ });+ workflow.nodes[1].col = 5;+ workflow.edges[0].labelAt = [563, 539];++ const result = compileWorkflow({ workflow, qualityProfile: 'showcase' });+ assert.equal(result.ok, false);+ assert.equal(result.diagnostics.length, 1, JSON.stringify(result.diagnostics, null, 2));+ const [diagnostic] = result.diagnostics;+ assert.equal(diagnostic.code, 'workflow/viewbox-capacity');+ assert.deepEqual(diagnostic.evidence.actualViewBox, [900, 420]);+ assert.ok(diagnostic.evidence.requiredViewBox[1] > 420);+ assert.ok(+ diagnostic.evidence.contributors.some((contributor) => /edge ab label/i.test(contributor)),+ JSON.stringify(diagnostic.evidence.contributors),+ );+ assert.doesNotMatch(diagnostic.supportedFixes.join('\n'), /drop|remove (?:the )?label|unlabel/i);+});++test('sanitized downstream fixtures cover labels, explicit routes, custom widths, and explicit viewBoxes', () => {+ const fixtureRoot = path.join(__dirname, 'fixtures', 'issue-126');++ const labels = compileSuccessfully(readJson(path.join(fixtureRoot, 'labels.workflow.json')), 'showcase');+ assertRectInsideViewBox(+ edgeLabelRect(labels.svg, 'request-result'),+ svgViewBox(labels.svg),+ 'sanitized semantic label',+ );++ const explicitRoute = compileSuccessfully(+ readJson(path.join(fixtureRoot, 'explicit-route.workflow.json')),+ 'showcase',+ );+ assert.ok(+ edgePoints(explicitRoute.svg, 'producer-consumer').some(([x]) => x === 720),+ 'the authored channelX pin must remain exact',+ );++ const customWidths = compileSuccessfully(+ readJson(path.join(fixtureRoot, 'custom-widths.workflow.json')),+ 'showcase',+ );+ assert.equal(nodeRect(customWidths.svg, 'compact').width, 32);+ assert.equal(nodeRect(customWidths.svg, 'wide').width, 240);++ const explicitViewBox = compileSuccessfully(+ readJson(path.join(fixtureRoot, 'explicit-viewbox.workflow.json')),+ 'showcase',+ );+ assert.deepEqual(explicitViewBox.receipt.viewBox, [1600, 520]);+});++test('readable-v2 SVG and receipt bytes are deterministic across repeated and reordered input', () => {+ const workflow = {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: { title: 'Deterministic workflow', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'frontend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ { id: 'c', lane: 'main', col: 4, type: 'database', label: 'C' },+ ],+ edges: [+ { id: 'ab', from: 'a', to: 'b', label: 'one' },+ { id: 'bc', from: 'b', to: 'c', label: 'two' },+ ],+ };++ const first = compileSuccessfully(clone(workflow), 'showcase');+ for (let iteration = 0; iteration < 3; iteration += 1) {+ const repeated = compileSuccessfully(clone(workflow), 'showcase');+ assert.equal(repeated.svg, first.svg);+ assert.equal(JSON.stringify(repeated.receipt), JSON.stringify(first.receipt));+ }++ const reordered = clone(workflow);+ reordered.nodes.reverse();+ reordered.edges.reverse();+ const reorderedResult = compileSuccessfully(reordered, 'showcase');+ assert.equal(reorderedResult.svg, first.svg);+ assert.equal(JSON.stringify(reorderedResult.receipt), JSON.stringify(first.receipt));+});++test('CLI validate workflow --layout-json prints the stable compiler receipt', () => {+ const input = path.join(tmp, 'layout-json.workflow.json');+ fs.writeFileSync(input, JSON.stringify(adjacentWorkflow({+ fromCol: 3,+ label: 'liga',+ viewBox: [1080, 420],+ })));++ const result = spawnSync(process.execPath, [+ cli,+ 'validate',+ 'workflow',+ input,+ '--layout-json',+ '--quality',+ 'standard',+ ], { encoding: 'utf8' });++ assert.equal(result.status, 0, result.stderr);+ const receipt = JSON.parse(result.stdout);+ assert.equal(receipt.contract, 'readable-v2');+ assert.deepEqual(receipt.viewBox, [1080, 420]);+ assert.ok(Array.isArray(receipt.requiredViewBox));+ assert.equal(receipt.columns.length, 6);+ assert.deepEqual(receipt.diagnostics, []);+});++test('CLI validate workflow --layout-json returns only the causal compiler failure receipt', () => {+ const input = path.join(tmp, 'layout-json-failure.workflow.json');+ fs.writeFileSync(input, JSON.stringify({+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Issue 126 failure receipt', legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [{ id: 'ab', from: 'a', to: 'b' }],+ }));++ const result = spawnSync(process.execPath, [+ cli,+ 'validate',+ 'workflow',+ input,+ '--layout-json',+ '--json',+ ], { encoding: 'utf8' });++ assert.equal(result.status, 1);+ assert.equal(result.stderr, '');+ const receipt = JSON.parse(result.stdout);+ assert.equal(receipt.contract, 'fixed-v1');+ assert.equal(receipt.diagnostics.length, 1, JSON.stringify(receipt.diagnostics, null, 2));+ assert.equal(receipt.diagnostics[0].code, 'workflow/column-capacity');+});++process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/archify/test/workflow-migration.test.mjs b/archify/test/workflow-migration.test.mjsnew file mode 100644index 00000000..5ac01096--- /dev/null+++ b/archify/test/workflow-migration.test.mjs@@ -0,0 +1,620 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { createHash } from 'node:crypto';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import {+ createHorizontalRankMapper,+ migrateWorkflowDocument,+} from '../migrations/workflow-v2.mjs';+import {+ createMappedWorkflowCandidate,+ intrinsicWorkflow,+ planningWorkflow,+} from '../renderers/workflow/workflow-migration-geometry.mjs';+import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const skillRoot = path.resolve(__dirname, '..');+const cli = path.join(skillRoot, 'bin', 'archify.mjs');+const fixture = path.join(+ __dirname,+ 'fixtures',+ 'v1-workflow-explicit-coordinates.workflow.json',+);+const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-workflow-migration-'));++function sha256(value) {+ return createHash('sha256').update(value).digest('hex');+}++function runMigration(source, destination, { importModule, env } = {}) {+ return spawnSync(process.execPath, [+ ...(importModule ? ['--import', importModule] : []),+ cli,+ 'migrate',+ 'workflow',+ source,+ destination,+ '--to-schema',+ '2',+ '--json',+ ], {+ encoding: 'utf8',+ ...(env ? { env: { ...process.env, ...env } } : {}),+ });+}++function runValidation(source) {+ return spawnSync(process.execPath, [cli, 'validate', 'workflow', source, '--json'], {+ encoding: 'utf8',+ });+}++function parseJsonOutput(result) {+ assert.doesNotThrow(+ () => JSON.parse(result.stdout),+ `expected JSON stdout, received:\n${result.stdout}\nstderr:\n${result.stderr}`,+ );+ return JSON.parse(result.stdout);+}++function copyFixture(name, mutate = (value) => value) {+ const source = path.join(tmp, name);+ const value = mutate(JSON.parse(fs.readFileSync(fixture, 'utf8')));+ fs.writeFileSync(source, `${JSON.stringify(value, null, 2)}\n`);+ return source;+}++function explicitPinConflictWorkflow() {+ return {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Unmappable explicit label pin',+ viewBox: [900, 420],+ legend: { mode: 'hidden' },+ },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 5, type: 'backend', label: 'B' },+ ],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ label: 'outside',+ labelAt: [365, -20],+ }],+ };+}++function heightConstrainedWorkflow() {+ return {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Legacy height capacity',+ viewBox: [720, 240],+ legend: { mode: 'hidden' },+ },+ lanes: [+ { id: 'first', label: 'First' },+ { id: 'second', label: 'Second' },+ ],+ nodes: [+ { id: 'a', lane: 'first', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'second', col: 2, type: 'database', label: 'B' },+ ],+ edges: [],+ };+}++function profileDivergenceWorkflow() {+ return {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'profile divergence',+ quality_profile: 'showcase',+ legend: { mode: 'hidden' },+ },+ lanes: [+ { id: 'top', label: 'Top' },+ { id: 'middle', label: 'Middle' },+ { id: 'bottom', label: 'Bottom' },+ { id: 'issue', label: 'Issue' },+ ],+ nodes: [+ { id: 'left', lane: 'middle', col: 0, type: 'backend', label: 'Left' },+ { id: 'right', lane: 'middle', col: 4, type: 'backend', label: 'Right' },+ { id: 'above', lane: 'top', col: 2, type: 'backend', label: 'Above' },+ { id: 'below', lane: 'bottom', col: 2, type: 'backend', label: 'Below' },+ { id: 'a', lane: 'issue', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'issue', col: 2, type: 'backend', label: 'B' },+ ],+ edges: [+ { id: 'ab', from: 'a', to: 'b' },+ { id: 'horizontal', from: 'left', to: 'right', via: [[244, 243]] },+ { id: 'vertical', from: 'above', to: 'below', via: [[300, 200]] },+ ],+ };+}++test('migration geometry helpers construct mapped v2 candidates without mutating the source', () => {+ const source = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Pure migration geometry', viewBox: [720, 400], legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'a', lane: 'main', col: 1, type: 'backend', label: 'A' },+ { id: 'b', lane: 'main', col: 2, type: 'backend', label: 'B' },+ ],+ mainPath: ['a', 'b'],+ edges: [{+ id: 'ab',+ from: 'a',+ to: 'b',+ label: 'pin',+ fromSide: 'top',+ toSide: 'top',+ via: [[220, 60], [260, 60], [300, 60]],+ labelAt: [260, 42],+ channelX: 260,+ }],+ };+ const sourceBefore = JSON.parse(JSON.stringify(source));++ const intrinsic = intrinsicWorkflow(source);+ assert.equal(intrinsic.schema_version, 2);+ assert.equal('viewBox' in intrinsic.meta, false);+ assert.deepEqual(intrinsic.edges, source.edges);++ const planning = planningWorkflow(source);+ assert.deepEqual(planning.edges, []);+ assert.equal('mainPath' in planning, false);++ const mapX = createHorizontalRankMapper([88, 220, 300], [94, 214, 334]);+ assert.equal(mapX(260), 274, 'the migration module must preserve the mapper re-export');++ const mapped = createMappedWorkflowCandidate(+ source,+ [88, 220, 300],+ [94, 214, 334],+ );+ assert.equal(mapped.document.schema_version, 2);+ assert.deepEqual(mapped.document.meta.viewBox, [720, 400]);+ assert.deepEqual(mapped.document.edges[0].via, [[214, 60], [274, 60], [334, 60]]);+ assert.deepEqual(mapped.document.edges[0].labelAt, [274, 42]);+ assert.equal(mapped.document.edges[0].channelX, 274);+ assert.deepEqual(mapped.changedCoordinates, [+ { path: '/edges/0/via/0/0', from: 220, to: 214 },+ { path: '/edges/0/via/1/0', from: 260, to: 274 },+ { path: '/edges/0/via/2/0', from: 300, to: 334 },+ { path: '/edges/0/labelAt/0', from: 260, to: 274 },+ { path: '/edges/0/channelX', from: 260, to: 274 },+ ]);+ assert.deepEqual(source, sourceBefore);+});++test('document migration treats a legacy explicit viewBox as capacity and expands it monotonically', () => {+ const source = heightConstrainedWorkflow();+ const sourceBefore = JSON.parse(JSON.stringify(source));++ const migration = migrateWorkflowDocument(source);++ assert.equal(migration.ok, true, JSON.stringify(migration, null, 2));+ assert.deepEqual(source, sourceBefore, 'the document migration must not mutate its input');+ assert.deepEqual(migration.document.meta.viewBox, [768, 404]);+ assert.deepEqual(migration.document.meta.viewBox, migration.newRequiredViewBox);+ assert.ok(migration.document.meta.viewBox[0] >= source.meta.viewBox[0]);+ assert.ok(migration.document.meta.viewBox[1] >= source.meta.viewBox[1]);+ assert.ok(migration.preExistingDiagnostics.some(({ message }) => (+ /viewBox height 240/.test(message)+ )), JSON.stringify(migration.preExistingDiagnostics, null, 2));+ assert.deepEqual(migration.migrationDiagnostics, []);+ assert.deepEqual(migration.newSchemaDiagnostics, []);+});++test('CLI atomically commits a capacity-expanded migration and preserves source bytes', () => {+ const source = path.join(tmp, 'height-capacity-source.workflow.json');+ const destination = path.join(tmp, 'height-capacity-destination.workflow.json');+ const sourceBytes = Buffer.from(`${JSON.stringify(heightConstrainedWorkflow(), null, 2)}\n`);+ fs.writeFileSync(source, sourceBytes);+ fs.writeFileSync(destination, 'destination sentinel\n');++ const result = runMigration(source, destination);++ assert.equal(result.status, 0, result.stderr || result.stdout);+ assert.deepEqual(fs.readFileSync(source), sourceBytes, 'the CLI must preserve source bytes');+ const destinationBytes = fs.readFileSync(destination);+ const migrated = JSON.parse(destinationBytes);+ const report = parseJsonOutput(result);+ assert.equal(report.ok, true);+ assert.equal(migrated.schema_version, 2);+ assert.deepEqual(migrated.meta.viewBox, [768, 404]);+ assert.deepEqual(migrated.meta.viewBox, report.newRequiredViewBox);+ assert.ok(migrated.meta.viewBox[0] >= 720);+ assert.ok(migrated.meta.viewBox[1] >= 240);+ assert.deepEqual(report.destination, {+ path: path.resolve(destination),+ sha256: sha256(destinationBytes),+ bytes: destinationBytes.length,+ });+ assert.deepEqual(report.migrationDiagnostics, []);+ assert.deepEqual(report.newSchemaDiagnostics, []);+});++test('column-capacity diagnostics do not advertise migration across a quality-profile divergence', () => {+ const document = profileDivergenceWorkflow();+ const standard = compileWorkflow({ workflow: document, qualityProfile: 'standard' });+ assert.equal(standard.ok, false);+ const capacity = standard.diagnostics.find(({ code }) => code === 'workflow/column-capacity');+ assert.ok(capacity, JSON.stringify(standard.diagnostics, null, 2));++ const migration = migrateWorkflowDocument(document);+ assert.equal(migration.ok, false, 'the authored showcase migration must reject its pinned crossing');+ assert.ok(migration.newSchemaDiagnostics.some(({ code, evidence }) => (+ code === 'workflow/explicit-pin-conflict'+ && evidence?.invariant === 'explicit route-route crossing'+ )), JSON.stringify(migration, null, 2));+ assert.ok(+ capacity.supportedFixes.every((fix) => !/migrate this workflow/i.test(fix)),+ `a standard-only verification must not advertise the failing authored showcase migration: ${capacity.supportedFixes}`,+ );+});++test('document migration uses the authored profile and returns an independently compilable document', () => {+ const document = profileDivergenceWorkflow();+ document.meta.quality_profile = 'standard';++ const migration = migrateWorkflowDocument(document);++ assert.equal(migration.ok, true, JSON.stringify(migration, null, 2));+ assert.deepEqual(migration.migrationDiagnostics, []);+ assert.deepEqual(migration.newSchemaDiagnostics, []);+ const standalone = compileWorkflow({ workflow: migration.document });+ assert.equal(standalone.ok, true, JSON.stringify(standalone.diagnostics, null, 2));+});++test('document migration defaults an omitted profile to standard', () => {+ const document = profileDivergenceWorkflow();+ delete document.meta.quality_profile;++ const migration = migrateWorkflowDocument(document);++ assert.equal(migration.ok, true, JSON.stringify(migration, null, 2));+ const standalone = compileWorkflow({ workflow: migration.document });+ assert.equal(standalone.ok, true, JSON.stringify(standalone.diagnostics, null, 2));+});++test('CLI migration ignores ambient standard for an authored showcase workflow', () => {+ const source = path.join(tmp, 'authored-showcase-source.workflow.json');+ const destination = path.join(tmp, 'authored-showcase-destination.workflow.json');+ const sourceBytes = Buffer.from(`${JSON.stringify(profileDivergenceWorkflow(), null, 2)}\n`);+ fs.writeFileSync(source, sourceBytes);++ const migration = runMigration(source, destination, {+ env: { ARCHIFY_QUALITY_PROFILE: 'standard' },+ });++ assert.notEqual(migration.status, 0);+ assert.deepEqual(fs.readFileSync(source), sourceBytes);+ assert.equal(fs.existsSync(destination), false);+ const report = parseJsonOutput(migration);+ assert.equal(report.ok, false);+ assert.ok(report.newSchemaDiagnostics.some(({ code, evidence }) => (+ code === 'workflow/explicit-pin-conflict'+ && evidence?.invariant === 'explicit route-route crossing'+ )), JSON.stringify(report, null, 2));+});++test('CLI migration ignores ambient showcase for an authored standard workflow', () => {+ const source = path.join(tmp, 'authored-standard-source.workflow.json');+ const destination = path.join(tmp, 'authored-standard-destination.workflow.json');+ const document = profileDivergenceWorkflow();+ document.meta.quality_profile = 'standard';+ const sourceBytes = Buffer.from(`${JSON.stringify(document, null, 2)}\n`);+ fs.writeFileSync(source, sourceBytes);++ const migration = runMigration(source, destination, {+ env: { ARCHIFY_QUALITY_PROFILE: 'showcase' },+ });++ assert.equal(migration.status, 0, migration.stderr || migration.stdout);+ assert.deepEqual(fs.readFileSync(source), sourceBytes);+ assert.equal(fs.existsSync(destination), true);+ const report = parseJsonOutput(migration);+ assert.equal(report.ok, true);+ const migrated = JSON.parse(fs.readFileSync(destination, 'utf8'));+ const standalone = compileWorkflow({ workflow: migrated });+ assert.equal(standalone.ok, true, JSON.stringify(standalone.diagnostics, null, 2));+});++test('CLI migration makes the blocking new-schema diagnostic primary over pre-existing findings', () => {+ const source = path.join(tmp, 'blocking-diagnostic-source.workflow.json');+ const destination = path.join(tmp, 'blocking-diagnostic-destination.workflow.json');+ fs.writeFileSync(source, `${JSON.stringify(profileDivergenceWorkflow(), null, 2)}\n`);++ const migration = runMigration(source, destination, {+ env: { ARCHIFY_QUALITY_PROFILE: 'showcase' },+ });++ assert.notEqual(migration.status, 0);+ assert.equal(fs.existsSync(destination), false);+ const report = parseJsonOutput(migration);+ assert.equal(report.ok, false);+ assert.equal(report.preExistingDiagnostics[0].code, 'workflow/column-capacity');+ const blocker = report.newSchemaDiagnostics.find(({ code }) => code === 'workflow/explicit-pin-conflict');+ assert.ok(blocker, JSON.stringify(report, null, 2));+ assert.equal(report.error, blocker.message);+ assert.deepEqual(report.diagnostics[0], blocker);+ assert.ok(report.diagnostics.some(({ code }) => code === 'workflow/column-capacity'));+});++test('workflow migration remaps absolute x coordinates, expands only the constrained viewBox axis, and reports hashes', () => {+ const source = copyFixture('pinned-source.workflow.json');+ const destination = path.join(tmp, 'pinned-destination.workflow.json');+ const sourceBefore = fs.readFileSync(source);++ const result = runMigration(source, destination);+ assert.equal(result.status, 0, result.stderr || result.stdout);+ assert.deepEqual(fs.readFileSync(source), sourceBefore, 'migration must not mutate its source bytes');+ assert.equal(fs.existsSync(destination), true);++ const migratedBytes = fs.readFileSync(destination);+ const migrated = JSON.parse(migratedBytes);+ assert.equal(migrated.schema_version, 2);+ assert.deepEqual(migrated.meta.viewBox, [768, 700], 'width grows to fit v2 while sufficient height is preserved');+ assert.deepEqual(migrated.edges[0].via, [[214, 119]]);+ assert.deepEqual(migrated.edges[1].labelAt, [394, 203]);+ assert.equal(migrated.edges[2].channelX, 574);++ const report = parseJsonOutput(result);+ assert.equal(report.ok, true);+ assert.equal(report.command, 'migrate');+ assert.equal(report.type, 'workflow');+ assert.equal(report.fromSchemaVersion, 1);+ assert.equal(report.toSchemaVersion, 2);+ assert.deepEqual(report.source, {+ path: path.resolve(source),+ sha256: sha256(sourceBefore),+ bytes: sourceBefore.length,+ });+ assert.deepEqual(report.destination, {+ path: path.resolve(destination),+ sha256: sha256(migratedBytes),+ bytes: migratedBytes.length,+ });+ assert.deepEqual(report.preExistingDiagnostics, []);+ assert.ok(Array.isArray(report.migrationDiagnostics));+ assert.deepEqual(report.newSchemaDiagnostics, []);+ assert.deepEqual(report.changedCoordinates, [+ { path: '/edges/0/via/0/0', from: 220, to: 214 },+ { path: '/edges/1/labelAt/0', from: 365, to: 394 },+ { path: '/edges/2/channelX', from: 500, to: 574 },+ ]);+ assert.deepEqual(report.oldRequiredViewBox, [720, 652]);+ assert.deepEqual(report.newRequiredViewBox, [768, 652]);+});++test('workflow migration never shrinks an already spacious explicit viewBox', () => {+ const source = copyFixture('spacious-source.workflow.json', (workflow) => {+ workflow.meta.viewBox = [1600, 900];+ return workflow;+ });+ const destination = path.join(tmp, 'spacious-destination.workflow.json');++ const result = runMigration(source, destination);+ assert.equal(result.status, 0, result.stderr || result.stdout);+ const migrated = JSON.parse(fs.readFileSync(destination, 'utf8'));+ assert.deepEqual(migrated.meta.viewBox, [1600, 900]);+ assert.equal(parseJsonOutput(result).destination.sha256, sha256(fs.readFileSync(destination)));+});++test('workflow migration reports the measured legacy requirement separately from authored capacity', () => {+ const source = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: {+ title: 'Spacious legacy capacity',+ viewBox: [1600, 900],+ legend: { mode: 'hidden' },+ },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [{ id: 'only', lane: 'main', col: 0, type: 'backend', label: 'Only' }],+ edges: [],+ };++ const migration = migrateWorkflowDocument(source);++ assert.equal(migration.ok, true, JSON.stringify(migration, null, 2));+ assert.deepEqual(migration.oldRequiredViewBox, [720, 280]);+ assert.deepEqual(migration.document.meta.viewBox, [1600, 900]);+ assert.deepEqual(migration.newRequiredViewBox, [768, 280]);+});++test('workflow migration staging never aliases a destination named like its verification artifact', () => {+ const source = copyFixture('artifact-name-source.workflow.json');+ const destination = path.join(tmp, 'migration-check.html');++ const result = runMigration(source, destination);+ assert.equal(result.status, 0, result.stderr || result.stdout);+ assert.equal(JSON.parse(fs.readFileSync(destination, 'utf8')).schema_version, 2);+ assert.equal(parseJsonOutput(result).destination.path, path.resolve(destination));+});++test('workflow migration cleanup failure warns without reversing a successful commit', () => {+ const source = copyFixture('cleanup-warning-source.workflow.json');+ const destination = path.join(tmp, 'cleanup-warning-destination.workflow.json');+ const importModule = path.join(__dirname, 'fixtures', 'fail-migration-cleanup.mjs');++ const result = runMigration(source, destination, { importModule });++ assert.equal(result.status, 0, result.stderr || result.stdout);+ assert.equal(JSON.parse(fs.readFileSync(destination, 'utf8')).schema_version, 2);+ assert.equal(parseJsonOutput(result).ok, true);+ assert.match(result.stderr, /Warning: could not remove workflow migration staging directory/);+ assert.match(result.stderr, /simulated migration cleanup failure/);+});++test('workflow migration is idempotent when its v2 destination is migrated again', () => {+ const source = copyFixture('idempotent-source.workflow.json');+ const firstDestination = path.join(tmp, 'idempotent-first.workflow.json');+ const secondDestination = path.join(tmp, 'idempotent-second.workflow.json');++ const first = runMigration(source, firstDestination);+ assert.equal(first.status, 0, first.stderr || first.stdout);+ const second = runMigration(firstDestination, secondDestination);+ assert.equal(second.status, 0, second.stderr || second.stdout);++ const firstBytes = fs.readFileSync(firstDestination);+ const secondBytes = fs.readFileSync(secondDestination);+ assert.deepEqual(secondBytes, firstBytes);++ const report = parseJsonOutput(second);+ assert.equal(report.fromSchemaVersion, 2);+ assert.equal(report.toSchemaVersion, 2);+ assert.deepEqual(report.changedCoordinates, []);+ assert.deepEqual(report.preExistingDiagnostics, []);+ assert.deepEqual(report.migrationDiagnostics, []);+ assert.deepEqual(report.newSchemaDiagnostics, []);+ assert.equal(report.destination.sha256, report.source.sha256);+ assert.deepEqual(report.newRequiredViewBox, report.oldRequiredViewBox);+});++test('fallback planning preserves straight-edge rank constraints when mapping absolute pins', () => {+ const source = path.join(tmp, 'fallback-rank-source.workflow.json');+ const destination = path.join(tmp, 'fallback-rank-destination.workflow.json');+ const document = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Fallback rank mapping', viewBox: [720, 520], legend: { mode: 'hidden' } },+ lanes: [+ { id: 'pin', label: 'Pinned label' },+ { id: 'straight', label: 'Straight constraint' },+ { id: 'blocker', label: 'Blocker' },+ ],+ nodes: [+ { id: 'a', lane: 'pin', col: 0, type: 'backend', label: 'A' },+ { id: 'b', lane: 'pin', col: 1, type: 'backend', label: 'B' },+ { id: 'c', lane: 'straight', col: 0, type: 'backend', label: 'C' },+ { id: 'd', lane: 'straight', col: 1, type: 'backend', label: 'D' },+ { id: 'obstacle', lane: 'blocker', col: 4, type: 'database', label: 'Obstacle' },+ ],+ mainPath: ['a', 'b'],+ edges: [+ {+ id: 'pin-edge',+ from: 'a',+ to: 'b',+ label: 'p',+ labelAt: [562, 367],+ route: 'bottom-channel',+ fromSide: 'bottom',+ toSide: 'bottom',+ },+ { id: 'straight-edge', from: 'c', to: 'd', label: 'x', route: 'straight' },+ ],+ };+ fs.writeFileSync(source, `${JSON.stringify(document, null, 2)}\n`);++ const result = runMigration(source, destination);+ assert.equal(result.status, 0, result.stderr || result.stdout);+ const migrated = JSON.parse(fs.readFileSync(destination, 'utf8'));+ assert.deepEqual(migrated.edges[0].labelAt, [643.52, 367]);+ const report = parseJsonOutput(result);+ assert.deepEqual(report.changedCoordinates, [{+ path: '/edges/0/labelAt/0',+ from: 562,+ to: 643.52,+ }]);+ assert.deepEqual(report.newSchemaDiagnostics, []);+});++for (const { example, expectedEdge } of [+ { example: 'incident-response.workflow.json', expectedEdge: ['alert', 'page'] },+ { example: 'release-delivery.workflow.json', expectedEdge: ['pull_request', 'build'] },+]) {+ test(`workflow migration preserves causal route diagnostics for packaged ${example}`, () => {+ const source = path.join(skillRoot, 'examples', example);+ const destination = path.join(tmp, `migrated-${example}`);+ const sourceBefore = fs.readFileSync(source);++ const validation = runValidation(source);+ assert.equal(validation.status, 0, validation.stderr || validation.stdout);+ const result = runMigration(source, destination);+ assert.notEqual(result.status, 0);+ assert.equal(fs.existsSync(destination), false);+ assert.deepEqual(fs.readFileSync(source), sourceBefore);++ const failure = parseJsonOutput(result);+ assert.equal(failure.diagnostics.length, 1, JSON.stringify(failure.diagnostics, null, 2));+ assert.ok(failure.diagnostics.every(({ message }) => !/mainPath step .* no matching edge/.test(message)));+ const [diagnostic] = failure.diagnostics;+ assert.equal(diagnostic.code, 'workflow/route-preset-conflict');+ assert.deepEqual([diagnostic.subject?.from, diagnostic.subject?.to], expectedEdge);+ assert.equal(diagnostic.subject?.route, 'drop');+ });+}++test('workflow migration rejects the source path as its destination without changing the file', () => {+ const source = copyFixture('same-path.workflow.json');+ const sourceBefore = fs.readFileSync(source);++ const result = runMigration(source, source);+ assert.notEqual(result.status, 0);+ assert.deepEqual(fs.readFileSync(source), sourceBefore);++ const failure = parseJsonOutput(result);+ assert.equal(failure.ok, false);+ assert.equal(failure.command, 'migrate');+ assert.ok(Array.isArray(failure.diagnostics));+ assert.equal(failure.diagnostics.length, 1);+ assert.equal(failure.diagnostics[0].code, 'migration/source-destination');+ assert.match(failure.error, /source|destination/i);+ assert.ok(failure.diagnostics[0].supportedFixes.some((fix) => /different.*destination/i.test(fix)));+});++test('workflow migration reports a cyclic-symlink destination as structured JSON', () => {+ const source = copyFixture('symlink-cycle-source.workflow.json');+ const destination = path.join(tmp, 'migration-cycle-a.workflow.json');+ const otherLink = path.join(tmp, 'migration-cycle-b.workflow.json');+ fs.symlinkSync(otherLink, destination, 'file');+ fs.symlinkSync(destination, otherLink, 'file');++ const result = runMigration(source, destination);+ assert.notEqual(result.status, 0);+ assert.equal(result.stderr, '');+ const failure = parseJsonOutput(result);+ assert.equal(failure.ok, false);+ assert.equal(failure.diagnostics[0].code, 'output/symlink-cycle');+ assert.equal(failure.diagnostics[0].subject.output, path.resolve(destination));+});++test('failed workflow migration emits diagnostics and never writes its destination', () => {+ const source = path.join(tmp, 'pin-conflict-source.workflow.json');+ const destination = path.join(tmp, 'pin-conflict-destination.workflow.json');+ fs.writeFileSync(source, `${JSON.stringify(explicitPinConflictWorkflow(), null, 2)}\n`);+ assert.equal(fs.existsSync(destination), false);++ const result = runMigration(source, destination);+ assert.notEqual(result.status, 0);+ assert.equal(fs.existsSync(destination), false, 'a failed migration must not leave a partial destination');++ const failure = parseJsonOutput(result);+ assert.equal(failure.ok, false);+ assert.equal(failure.command, 'migrate');+ assert.ok(Array.isArray(failure.diagnostics));+ assert.ok(+ failure.diagnostics.some(({ code }) => code === 'workflow/explicit-pin-conflict'),+ JSON.stringify(failure.diagnostics, null, 2),+ );+});++process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/archify/test/workflow-semantic-contract.test.mjs b/archify/test/workflow-semantic-contract.test.mjsnew file mode 100644index 00000000..0653e1b7--- /dev/null+++ b/archify/test/workflow-semantic-contract.test.mjs@@ -0,0 +1,131 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';++import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';++function document(semanticChecks) {+ return {+ schema_version: 2,+ diagram_type: 'workflow',+ meta: {+ title: 'Workflow semantic contract fixture',+ legend: { mode: 'hidden' },+ },+ lanes: [+ { id: 'main', label: 'Main' },+ { id: 'recovery', label: 'Recovery' },+ ],+ nodes: [+ { id: 'input', lane: 'main', col: 0, type: 'external', label: 'Input' },+ { id: 'process', lane: 'main', col: 2, type: 'backend', label: 'Process' },+ { id: 'result', lane: 'main', col: 4, type: 'frontend', label: 'Result' },+ { id: 'ledger', lane: 'recovery', col: 4, type: 'database', label: 'Ledger' },+ { id: 'resume', lane: 'recovery', col: 1, type: 'backend', label: 'Resume' },+ ],+ edges: [+ { id: 'start', from: 'input', to: 'process' },+ { id: 'finish', from: 'process', to: 'result' },+ { id: 'record', from: 'process', to: 'ledger' },+ ],+ ...(semanticChecks ? { semanticChecks } : {}),+ };+}++test('semanticChecks rejects an undeclared root instead of accepting an orphan recovery node', () => {+ const workflow = document({+ allowedRoots: ['input'],+ });++ const result = compileWorkflow({ workflow, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.ok(+ result.diagnostics.some((diagnostic) => (+ diagnostic.code === 'workflow/unexpected-root'+ && diagnostic.subject?.node === 'resume'+ )),+ JSON.stringify(result.diagnostics, null, 2),+ );+});++test('semanticChecks rejects a missing required edge with its exact endpoints', () => {+ const workflow = document({+ requiredEdges: [{ from: 'ledger', to: 'resume' }],+ });++ const result = compileWorkflow({ workflow, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.ok(+ result.diagnostics.some((diagnostic) => (+ diagnostic.code === 'workflow/required-edge'+ && diagnostic.subject?.from === 'ledger'+ && diagnostic.subject?.to === 'resume'+ )),+ JSON.stringify(result.diagnostics, null, 2),+ );+});++test('semanticChecks accepts required reachability through intermediate nodes without changing SVG bytes', () => {+ const baseline = document();+ const constrained = document({+ allowedRoots: ['input', 'resume'],+ allowedTerminals: ['result', 'ledger', 'resume'],+ requiredEdges: [{ from: 'process', to: 'ledger' }],+ requiredPaths: [{ from: 'input', to: 'result' }],+ });++ const baselineResult = compileWorkflow({ workflow: baseline, qualityProfile: 'standard' });+ const constrainedResult = compileWorkflow({ workflow: constrained, qualityProfile: 'standard' });++ assert.equal(baselineResult.ok, true, JSON.stringify(baselineResult.diagnostics, null, 2));+ assert.equal(constrainedResult.ok, true, JSON.stringify(constrainedResult.diagnostics, null, 2));+ assert.equal(constrainedResult.svg, baselineResult.svg);+ assert.deepEqual(constrainedResult.receipt, baselineResult.receipt);+});++test('semanticChecks rejects a required path that is not reachable in authored direction', () => {+ const workflow = document({+ requiredPaths: [{ from: 'ledger', to: 'resume' }],+ });++ const result = compileWorkflow({ workflow, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.ok(+ result.diagnostics.some((diagnostic) => diagnostic.code === 'workflow/required-path'),+ JSON.stringify(result.diagnostics, null, 2),+ );+});++test('semanticChecks rejects an undeclared terminal', () => {+ const workflow = document({+ allowedTerminals: ['result', 'ledger'],+ });++ const result = compileWorkflow({ workflow, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.ok(+ result.diagnostics.some((diagnostic) => (+ diagnostic.code === 'workflow/unexpected-terminal'+ && diagnostic.subject?.node === 'resume'+ )),+ JSON.stringify(result.diagnostics, null, 2),+ );+});++test('semanticChecks reports unknown contract node ids before graph analysis', () => {+ const workflow = document({+ requiredEdges: [{ from: 'missing', to: 'resume' }],+ });++ const result = compileWorkflow({ workflow, qualityProfile: 'standard' });++ assert.equal(result.ok, false);+ assert.deepEqual(+ result.diagnostics.map(({ code }) => code),+ ['workflow/semantic-node-reference'],+ );+ assert.equal(result.diagnostics[0].subject.path, '/semanticChecks/requiredEdges/0/from');+});diff --git a/docs/article-archify.md b/docs/article-archify.mdindex dfe495d0..ecf6c376 100644--- a/docs/article-archify.md+++ b/docs/article-archify.md@@ -167,7 +167,7 @@ Archify 的渲染器给你一个 lane/stage 网格(约束),但让你决定----Archify 的 JSON IR 有一个强制字段叫 `schema_version: 1`。从第一天就强制了。打破性变更触发版本号升级,旧版本永远合法。+Archify 的 JSON IR 从第一天就强制声明 `schema_version`。最初五种图都固定为 `schema_version: 1`;现在 Workflow 是明确的例外:v1 继续合法并保持旧版固定布局,v2 则显式选择新的可读性编译器。其他四种图仍固定为 v1。打破性变更触发版本号升级,旧版本永远合法。这一行比它前面 200 行的 SKILL.md 都更能说明问题。diff --git a/docs/assets/archify-live-proof.gif b/docs/assets/archify-live-proof.gifindex beb6a591..5094ef30 100644Binary files a/docs/assets/archify-live-proof.gif and b/docs/assets/archify-live-proof.gif differdiff --git a/docs/assets/archify-live-proof.json b/docs/assets/archify-live-proof.jsonindex 9e8a544b..3d6d7830 100644--- a/docs/assets/archify-live-proof.json+++ b/docs/assets/archify-live-proof.json@@ -7,13 +7,13 @@"fps": 10,"frameCount": 54,"durationSeconds": 5.4,- "bytes": 918340,- "sha256": "af7940a3d61f386a2e3afb21549bc689b3f3c7d142239e6cce52d4b3b511af2d",+ "bytes": 1731693,+ "sha256": "de3f05c390409b99c3f8d4e9e213dbe67688846f836b7c0e66010410666ed2c7","scenes": [{"id": "signal-flow","artifact": "docs/gallery/artifacts/agent-tool-call.workflow.html",- "artifactSha256": "7d9c378a53f9bd870a1f4e67db0d4b8e2bedbdb78c3678764aef4a48b4d1b391",+ "artifactSha256": "5f0042bfcfcd229ed7f8d14b8be665f1dca901486034943d4475766a599c7771","view": "happy-path","eyebrow": "WORKFLOW · SIGNAL FLOW","title": "Agent Tool Call",diff --git a/docs/gallery.html b/docs/gallery.htmlindex 74b116af..270055df 100644--- a/docs/gallery.html+++ b/docs/gallery.html@@ -293,12 +293,12 @@<iframe src="gallery/artifacts/agent-tool-call.workflow.html?embed=1&theme=dark" data-src-base="gallery/artifacts/agent-tool-call.workflow.html" title="Agent Tool Call live Archify preview" loading="eager"></iframe></div><div class="card-body">- <p class="card-description" data-en="A policy-aware agent loop with planning, approval, tool execution, exception handling, and observability lanes." data-zh="包含规划、审批、工具执行、异常处理与可观测泳道的策略感知智能体闭环。">A policy-aware agent loop with planning, approval, tool execution, exception handling, and observability lanes.</p>+ <p class="card-description" data-en="Four consolidated lanes trace a policy-aware agent loop across user interaction, agent runtime, policy and recovery, and tool execution with evidence." data-zh="四条整合泳道呈现策略感知的智能体闭环:用户交互、智能体运行时、策略与恢复,以及带证据的工具执行。">Four consolidated lanes trace a policy-aware agent loop across user interaction, agent runtime, policy and recovery, and tool execution with evidence.</p><div class="receipt" aria-label="Validation receipt"><div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div><div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div><div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 11E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7d9c378a53f9bd870a1f4e67db0d4b8e2bedbdb78c3678764aef4a48b4d1b391">7d9c378a53f9</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="5f0042bfcfcd229ed7f8d14b8be665f1dca901486034943d4475766a599c7771">5f0042bfcfcd</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-tool-call.workflow.html?present=1&play=1#view=happy-path" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>@@ -669,16 +669,16 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"evidence-loop"],"guidedPlayback": true,- "schemaVersion": 1,+ "schemaVersion": 2,"visualPreset": "signal-flow","animation": "trace","engineeringProfile": null,"nodeCount": 12,"edgeCount": 11,- "artifactBytes": 720452,- "artifactSha256": "7d9c378a53f9bd870a1f4e67db0d4b8e2bedbdb78c3678764aef4a48b4d1b391",- "sourceBytes": 6367,- "sourceSha256": "9c94c8c0b2104478b77befb4cc5e343d381acba6e66645ab17616fde20b60e05",+ "artifactBytes": 723038,+ "artifactSha256": "5f0042bfcfcd229ed7f8d14b8be665f1dca901486034943d4475766a599c7771",+ "sourceBytes": 5687,+ "sourceSha256": "4d3f6c23de2ca7d306e05d0041a9506833bb5a164a2bddc2d1984cf4da3ee90c","checks": [{"name": "single_svg",@@ -730,17 +730,17 @@ receipt 99 checks / 11 artifacts / deterministic hashes</pre>"ambiguousCorridors": 0,"containerBorderRuns": 0,"labelRouteClearanceIssues": 0,- "minLabelRouteClearance": 52.1,+ "minLabelRouteClearance": 29,"desktopReadabilityIssues": 0,"minProjectedNodeTextPx": null,- "maxBends": 2,- "routesOverSuggestedBends": 0,- "maxStretch": 1.257,+ "maxBends": 3,+ "routesOverSuggestedBends": 1,+ "maxStretch": 1.225,"routesOverSuggestedStretch": 0,- "minSegmentPx": 13,- "minInteriorSegmentPx": 70,- "shortSegmentCount": 1,- "shortEndpointSegmentCount": 1,+ "minSegmentPx": 16,+ "minInteriorSegmentPx": 82,+ "shortSegmentCount": 0,+ "shortEndpointSegmentCount": 0,"shortInteriorSegmentCount": 0,"microSegmentCount": 0},diff --git a/docs/gallery/artifacts/agent-tool-call.workflow.html b/docs/gallery/artifacts/agent-tool-call.workflow.htmlindex b5ea59d3..bc9f6211 100644--- a/docs/gallery/artifacts/agent-tool-call.workflow.html+++ b/docs/gallery/artifacts/agent-tool-call.workflow.html@@ -5004,7 +5004,7 @@<!-- Main Diagram --><div class="diagram-container" data-detail-level="read"data-preset-badge-editorial-plate="ARCHIFY / PLATE 04">- <svg viewBox="0 0 720 900" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase">+ <svg viewBox="0 0 1096 684" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase"><title id="archify-diagram-title">Agent Tool Call Workflow</title><desc id="archify-diagram-description">A workflow diagram generated by Archify.</desc><!-- Definitions -->@@ -5030,237 +5030,263 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Swimlanes -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="1028" height="106" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="74" class="t-dim" font-size="10" font-weight="600">01 / User Interface</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="176" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="198" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="178" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="200" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="300" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="322" class="t-dim" font-size="10" font-weight="600">03 / Policy Boundary</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="312" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-2-exception" x="46" y="318" width="1016" height="102" rx="8" class="c-security-group" stroke-width="1"/>+ <text x="54" y="334" class="t-security" font-size="10" font-weight="600">EX / Policy & Recovery</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="424" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-3-exception" x="46" y="430" width="628" height="92" rx="8" class="c-security-group" stroke-width="1"/>- <text x="54" y="446" class="t-security" font-size="10" font-weight="600">EX / Exception Handling</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-4" x="40" y="548" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="570" class="t-dim" font-size="10" font-weight="600">05 / Tool Execution</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-5" x="40" y="672" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="694" class="t-dim" font-size="10" font-weight="600">06 / Observability</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="446" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="468" class="t-dim" font-size="10" font-weight="600">04 / Tool Execution & Evidence</text><!-- Phase headers -->- <line x1="42" y1="35" x2="266" y2="35" class="a-default" stroke-width="1.1"/>- <rect x="42" y="27" width="224" height="16" rx="4" class="c-mask"/>- <text x="154" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>- <line x1="254" y1="35" x2="476" y2="35" class="a-emphasis" stroke-width="1.1"/>- <rect x="254" y="27" width="222" height="16" rx="4" class="c-mask"/>- <text x="365" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>- <line x1="454" y1="35" x2="671" y2="35" class="a-dashed" stroke-width="1.1"/>- <rect x="454" y="27" width="217" height="16" rx="4" class="c-mask"/>- <text x="562.5" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text>+ <line x1="68" y1="35" x2="320" y2="35" class="a-default" stroke-width="1.1"/>+ <rect x="68" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="194" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>+ <line x1="445.20000000000005" y1="35" x2="697.2" y2="35" class="a-emphasis" stroke-width="1.1"/>+ <rect x="445.20000000000005" y="27" width="252.00000000000006" height="16" rx="4" class="c-mask"/>+ <text x="571.2" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>+ <line x1="784" y1="35" x2="1036" y2="35" class="a-dashed" stroke-width="1.1"/>+ <rect x="784" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="910" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text><!-- Workflow groups -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="250" y="214" width="230" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="260" y="228" class="t-backend" font-size="7" font-weight="600">Planning loop</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="450" y="586" width="225" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="460" y="600" class="t-messagebus" font-size="7" font-weight="600">Tool work</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="380" y="462" width="295" height="58" rx="9" class="c-security-group" stroke-width="1"/>- <text x="390" y="476" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="421.2" y="216" width="300.00000000000006" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="431.2" y="214" class="t-backend" font-size="7" font-weight="600">Planning loop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="581.2" y="350" width="478.79999999999995" height="72" rx="9" class="c-security-group" stroke-width="1"/>+ <text x="591.2" y="348" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="204" y="484" width="357.20000000000005" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="214" y="482" class="t-messagebus" font-size="7" font-weight="600">Evidence path</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-3" x="760" y="484" width="300" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="770" y="482" class="t-messagebus" font-size="7" font-weight="600">Tool work</text><!-- Edge paths -->- <path data-edge-from="user" data-edge-to="chat" data-edge-key="0" data-edge-id="request-chat" data-composition-points="134,119;174,119" d="M 134 119 L 174 119" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request" data-composition-points="220,145;220,166;300,166;300,209" d="M 220 145 L 220 166 L 300 166 L 300 209" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="planner" data-edge-to="router" data-edge-key="2" data-edge-id="planner-route" data-composition-points="346,243;384,243" d="M 346 243 L 384 243" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check" data-composition-points="430,269;430,290;430,290;430,333" d="M 430 269 L 430 290 L 430 290 L 430 333" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="approval" data-edge-to="tool" data-edge-key="4" data-edge-id="approved-tool" data-composition-points="384,367;356,367;356,615;454,615" d="M 384 367 L 356 367 L 356 615 L 454 615" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied" data-composition-points="430,401;430,414;500,414;500,465" d="M 430 401 L 430 414 L 500 414 L 500 465" class="a-security" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="6" data-edge-id="retry-request" data-composition-points="546,491;579,491" d="M 546 491 L 579 491" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="tool" data-edge-to="external" data-edge-key="7" data-edge-id="tool-external-call" data-composition-points="546,615;579,615" d="M 546 615 L 579 615" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="external" data-edge-to="final" data-edge-key="8" data-edge-id="external-reply" data-composition-points="671,615;692,615;692,119;671,119" d="M 671 615 L 692 615 L 692 119 L 671 119" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result" data-composition-points="625,641;625,797;500,797;500,765" d="M 625 641 L 625 797 L 500 797 L 500 765" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="266,739;454,739" d="M 266 739 L 454 739" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check" data-composition-points="651.2,279;651.2,302;569.2,302;569.2,387;585.2,387" d="M 651.2 279 L 651.2 302 L 569.2 302 L 569.2 387 L 585.2 387" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied" data-composition-points="651.2,421;651.2,442;830,442;830,413" d="M 651.2 421 L 651.2 442 L 830 442 L 830 413" class="a-security" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="tool" data-edge-key="2" data-edge-id="approved-tool" data-composition-points="651.2,421;651.2,521;764,521" d="M 651.2 421 L 651.2 521 L 764 521" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="external" data-edge-to="final" data-edge-key="3" data-edge-id="external-reply" data-composition-points="1056,521;1080,521;1080,120;1056,120" d="M 1056 521 L 1080 521 L 1080 120 L 1056 120" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request" data-composition-points="274,146;274,253;425.2,253" d="M 274 146 L 274 253 L 425.2 253" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="planner" data-edge-to="router" data-edge-key="5" data-edge-id="planner-route" data-composition-points="557.2,253;585.2,253" d="M 557.2 253 L 585.2 253" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result" data-composition-points="990,547;990,579;491.2,579;491.2,547" d="M 990 547 L 990 579 L 491.2 579 L 491.2 547" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="user" data-edge-to="chat" data-edge-key="7" data-edge-id="request-chat" data-composition-points="180,120;208,120" d="M 180 120 L 208 120" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="8" data-edge-id="retry-request" data-composition-points="896,387;924,387" d="M 896 387 L 924 387" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="tool" data-edge-to="external" data-edge-key="9" data-edge-id="tool-external-call" data-composition-points="896,521;924,521" d="M 896 521 L 924 521" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="340,521;425.2,521" d="M 340 521 L 425.2 521" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><!-- Nodes --><g id="node-user" data-node-id="user" data-node-label="User" tabindex="0" role="button" aria-label="Focus User, asks for work, User Interface › Intake" aria-pressed="false" data-node-kind="external" data-node-sublabel="asks for work" data-node-context="User Interface › Intake"><title>User · asks for work · User Interface › Intake</title>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(48 99) scale(0.6875)">+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(54 100) scale(0.6875)"><rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/><path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/></g>- <text data-node-label="" data-detail-anchor="" x="88" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>- <text data-detail="context" x="88" y="131" class="t-muted" font-size="8" text-anchor="middle">asks for work</text>+ <text data-node-label="" data-detail-anchor="" x="114" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>+ <text data-detail="context" x="114" y="132" class="t-muted" font-size="8" text-anchor="middle">asks for work</text></g><g id="node-chat" data-node-id="chat" data-node-label="Chat Surface" tabindex="0" role="button" aria-label="Focus Chat Surface, thread + files, User Interface › Intake" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="thread + files" data-node-context="User Interface › Intake"><title>Chat Surface · thread + files · User Interface › Intake</title>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(180 99) scale(0.6875)">+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(214 100) scale(0.6875)"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M2 6.5h12"/><circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/><circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>- <text data-detail="context" x="220" y="131" class="t-muted" font-size="8" text-anchor="middle">thread + files</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>+ <text data-detail="context" x="274" y="132" class="t-muted" font-size="8" text-anchor="middle">thread + files</text></g><g id="node-final" data-node-id="final" data-node-label="Final Reply" tabindex="0" role="button" aria-label="Focus Final Reply, answer + changes, User Interface › Execute + report" aria-pressed="false" data-node-kind="backend" data-node-sublabel="answer + changes" data-node-context="User Interface › Execute + report"><title>Final Reply · answer + changes · User Interface › Execute + report</title>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(585 99) scale(0.6875)">+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(930 100) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>- <text data-detail="context" x="625" y="131" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>+ <text data-detail="context" x="990" y="132" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text></g><g id="node-planner" data-node-id="planner" data-node-label="Agent Planner" tabindex="0" role="button" aria-label="Focus Agent Planner, plan next step, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="plan next step" data-node-tag="context aware" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Agent Planner · plan next step · Agent Runtime › Planning loop › Plan + route · context aware</title>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-mask"/>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(260 215) scale(0.6875)">+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(431.2 225) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="300" y="230" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Agent Planner</text>- <text data-detail="context" x="300" y="247" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>- <text data-detail="fine" x="300" y="265" class="t-backend" font-size="7" text-anchor="middle">context aware</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="240" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Planner</text>+ <text data-detail="context" x="491.2" y="257" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>+ <text data-detail="fine" x="491.2" y="275" class="t-backend" font-size="7" text-anchor="middle">context aware</text></g><g id="node-router" data-node-id="router" data-node-label="Tool Router" tabindex="0" role="button" aria-label="Focus Tool Router, choose capability, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="choose capability" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Tool Router · choose capability · Agent Runtime › Planning loop › Plan + route</title>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-mask"/>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(390 223) scale(0.6875)">+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(591.2 233) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>- <text data-detail="context" x="430" y="255" class="t-muted" font-size="8" text-anchor="middle">choose capability</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="248" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>+ <text data-detail="context" x="651.2" y="265" class="t-muted" font-size="8" text-anchor="middle">choose capability</text></g>- <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy Boundary › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy Boundary › Plan + route">- <title>Approval Gate · scope + consent · Policy Boundary › Plan + route · block risky ops</title>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-mask"/>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(390 339) scale(0.6875)">+ <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy & Recovery › Human or policy stop › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy & Recovery › Human or policy stop › Plan + route">+ <title>Approval Gate · scope + consent · Policy & Recovery › Human or policy stop › Plan + route · block risky ops</title>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(591.2 359) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="354" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Approval Gate</text>- <text data-detail="context" x="430" y="371" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>- <text data-detail="fine" x="430" y="389" class="t-security" font-size="7" text-anchor="middle">block risky ops</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="374" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Approval Gate</text>+ <text data-detail="context" x="651.2" y="391" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>+ <text data-detail="fine" x="651.2" y="409" class="t-security" font-size="7" text-anchor="middle">block risky ops</text></g>- <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Blocked · wait or reject · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(460 471) scale(0.6875)">+ <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Blocked · wait or reject · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(770 367) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>- <text data-detail="context" x="500" y="503" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>+ <text data-detail="context" x="830" y="399" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text></g>- <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Retry Path · revise request · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(585 471) scale(0.6875)">+ <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Retry Path · revise request · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(930 367) scale(0.6875)"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/><circle cx="5" cy="4.5" r="1" class="sigil-fill"/><circle cx="10.5" cy="8" r="1" class="sigil-fill"/><circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>- <text data-detail="context" x="625" y="503" class="t-muted" font-size="8" text-anchor="middle">revise request</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>+ <text data-detail="context" x="990" y="399" class="t-muted" font-size="8" text-anchor="middle">revise request</text></g>- <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution › Tool work › Execute + report">- <title>Tool Call · shell / browser / MCP · Tool Execution › Tool work › Execute + report · structured result</title>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-mask"/>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(460 587) scale(0.6875)">- <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>- <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>- <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>- <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Tool Execution & Evidence › Evidence path › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Tool Execution & Evidence › Evidence path › Intake">+ <title>Context Store · repo + memory · Tool Execution & Evidence › Evidence path › Intake</title>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(214 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="602" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>- <text data-detail="context" x="500" y="619" class="t-muted" font-size="6.6" text-anchor="middle">shell / browser / MCP</text>- <text data-detail="fine" x="500" y="637" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Context Store</text>+ <text data-detail="context" x="274" y="533" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text></g>- <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution › Tool work › Execute + report">- <title>External API · network service · Tool Execution › Tool work › Execute + report</title>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(585 595) scale(0.6875)">- <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Tool Execution & Evidence › Evidence path › Plan + route" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Tool Execution & Evidence › Evidence path › Plan + route">+ <title>Trace Log · events + output · Tool Execution & Evidence › Evidence path › Plan + route</title>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(431.2 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="610" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>- <text data-detail="context" x="625" y="627" class="t-muted" font-size="8" text-anchor="middle">network service</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>+ <text data-detail="context" x="491.2" y="533" class="t-muted" font-size="8" text-anchor="middle">events + output</text></g>- <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Observability › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Observability › Intake">- <title>Context Store · repo + memory · Observability › Intake</title>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(180 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>Tool Call · shell / browser / MCP · Tool Execution & Evidence › Tool work › Execute + report · structured result</title>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(770 493) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="734" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Context Store</text>- <text data-detail="context" x="220" y="751" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="508" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>+ <text data-detail="context" x="830" y="525" class="t-muted" font-size="8" text-anchor="middle">shell / browser / MCP</text>+ <text data-detail="fine" x="830" y="543" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text></g>- <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Observability › Execute + report" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Observability › Execute + report">- <title>Trace Log · events + output · Observability › Execute + report</title>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(460 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>External API · network service · Tool Execution & Evidence › Tool work › Execute + report</title>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(930 501) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>- <text data-detail="context" x="500" y="751" class="t-muted" font-size="8" text-anchor="middle">events + output</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>+ <text data-detail="context" x="990" y="533" class="t-muted" font-size="8" text-anchor="middle">network service</text></g><!-- Edge labels -->-- <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request">- <rect x="245" y="146" width="30" height="14" rx="3" class="c-mask"/>- <text x="260" y="156" class="t-backend" font-size="8" text-anchor="middle">plan</text>+ <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check">+ <rect x="569.2" y="282" width="82" height="14" rx="3" class="c-mask"/>+ <text x="610.2" y="292" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>+ </g>+ <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied">+ <rect x="721.2" y="422" width="38.8" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="432" class="t-security" font-size="8" text-anchor="middle">denied</text></g>- <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check">- <rect x="423" y="277.5" width="82" height="14" rx="3" class="c-mask"/>- <text x="464" y="287.5" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>++ <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request">+ <rect x="334.6" y="233" width="30" height="14" rx="3" class="c-mask"/>+ <text x="349.6" y="243" class="t-backend" font-size="8" text-anchor="middle">plan</text></g>- <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied">- <rect x="445.6" y="406" width="38.8" height="14" rx="3" class="c-mask"/>- <text x="465" y="416" class="t-security" font-size="8" text-anchor="middle">denied</text>+ <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result">+ <rect x="704.4" y="559" width="72.4" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="569" class="t-database" font-size="8" text-anchor="middle">record result</text></g>- <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result">- <rect x="526.3" y="777" width="72.4" height="14" rx="3" class="c-mask"/>- <text x="562.5" y="787" class="t-database" font-size="8" text-anchor="middle">record result</text>- </g><g data-detail="context" data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory">- <rect x="326.4" y="725" width="77.2" height="14" rx="3" class="c-mask"/>- <text x="365" y="735" class="t-database" font-size="8" text-anchor="middle">trace + memory</text>+ <rect x="344" y="501" width="77.2" height="14" rx="3" class="c-mask"/>+ <text x="382.6" y="511" class="t-database" font-size="8" text-anchor="middle">trace + memory</text></g><!-- Legend -->-+ <g data-legend="" data-legend-bridge="">+ <text x="20" y="584" class="t-primary" font-size="12" font-weight="650">Legend</text>+ <g data-legend-semantic-kind="frontend" data-legend-kind="frontend" data-legend-label="User UI" data-legend-x="20" data-legend-baseline="604" data-legend-width="74">+ <rect x="20" y="596" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="42" y="604" class="t-muted" font-size="7.5" font-weight="500">User UI</text>+ </g>+ <g data-legend-semantic-kind="backend" data-legend-kind="backend" data-legend-label="Agent logic" data-legend-x="101" data-legend-baseline="604" data-legend-width="91">+ <rect x="101" y="596" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="123" y="604" class="t-muted" font-size="7.5" font-weight="500">Agent logic</text>+ </g>+ <g data-legend-semantic-kind="security" data-legend-kind="security" data-legend-label="Policy" data-legend-x="199" data-legend-baseline="604" data-legend-width="70">+ <rect x="199" y="596" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="221" y="604" class="t-muted" font-size="7.5" font-weight="500">Policy</text>+ </g>+ <g data-legend-semantic-kind="messagebus" data-legend-kind="messagebus" data-legend-label="Tool action" data-legend-x="276" data-legend-baseline="604" data-legend-width="91">+ <rect x="276" y="596" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="298" y="604" class="t-muted" font-size="7.5" font-weight="500">Tool action</text>+ </g>+ <g data-legend-semantic-kind="database" data-legend-kind="database" data-legend-label="Context / trace" data-legend-x="374" data-legend-baseline="604" data-legend-width="109">+ <rect x="374" y="596" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>+ <text x="396" y="604" class="t-muted" font-size="7.5" font-weight="500">Context / trace</text>+ </g>+ <g data-legend-semantic-kind="cloud" data-legend-kind="cloud" data-legend-label="Cloud service" data-legend-x="490" data-legend-baseline="604" data-legend-width="100">+ <rect x="490" y="596" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="512" y="604" class="t-muted" font-size="7.5" font-weight="500">Cloud service</text>+ </g>+ <g data-legend-semantic-kind="external" data-legend-kind="external" data-legend-label="External system" data-legend-x="597" data-legend-baseline="604" data-legend-width="109">+ <rect x="597" y="596" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="619" y="604" class="t-muted" font-size="7.5" font-weight="500">External system</text>+ </g>+ </g></svg><p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p><div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">@@ -5450,39 +5476,22 @@<div class="card"><div class="card-header"><div class="card-dot cyan"></div>- <h3>Renderer Rules</h3>+ <h3>Compiler Contract</h3></div><ul><li>• Lanes and columns determine node placement</li>- <li>• Edges attach to explicit node anchors</li>- <li>• Cross-lane paths use orthogonal routing</li>- <li>• Short adjacent links stay unlabeled</li>+ <li>• Labels reserve clearance; routes stay orthogonal</li></ul></div><div class="card"><div class="card-header"><div class="card-dot rose"></div>- <h3>Workflow Semantics</h3>- </div>- <ul>- <li>• Approval is a first-class policy step</li>- <li>• Consent gates are visible in the main path</li>- <li>• External calls stay inside the tool lane</li>- <li>• Trace writes are separate from the hot path</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>Why It Matters</h3>+ <h3>Runtime Semantics</h3></div><ul>- <li>• This is closer to a diagram_type renderer</li>- <li>• The graph can be edited without SVG surgery</li>- <li>• Layout rules can be tested and improved</li>- <li>• A future IR can reuse this shape directly</li>+ <li>• Approval gates risky work before tool execution</li>+ <li>• Evidence returns through isolated trace and memory</li></ul></div></div>diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.jsonindex f4ef80da..cce7ebab 100644--- a/docs/gallery/manifest.json+++ b/docs/gallery/manifest.json@@ -21,16 +21,16 @@"evidence-loop"],"guidedPlayback": true,- "schemaVersion": 1,+ "schemaVersion": 2,"visualPreset": "signal-flow","animation": "trace","engineeringProfile": null,"nodeCount": 12,"edgeCount": 11,- "artifactBytes": 720452,- "artifactSha256": "7d9c378a53f9bd870a1f4e67db0d4b8e2bedbdb78c3678764aef4a48b4d1b391",- "sourceBytes": 6367,- "sourceSha256": "9c94c8c0b2104478b77befb4cc5e343d381acba6e66645ab17616fde20b60e05",+ "artifactBytes": 723038,+ "artifactSha256": "5f0042bfcfcd229ed7f8d14b8be665f1dca901486034943d4475766a599c7771",+ "sourceBytes": 5687,+ "sourceSha256": "4d3f6c23de2ca7d306e05d0041a9506833bb5a164a2bddc2d1984cf4da3ee90c","checks": [{"name": "single_svg",@@ -82,17 +82,17 @@"ambiguousCorridors": 0,"containerBorderRuns": 0,"labelRouteClearanceIssues": 0,- "minLabelRouteClearance": 52.1,+ "minLabelRouteClearance": 29,"desktopReadabilityIssues": 0,"minProjectedNodeTextPx": null,- "maxBends": 2,- "routesOverSuggestedBends": 0,- "maxStretch": 1.257,+ "maxBends": 3,+ "routesOverSuggestedBends": 1,+ "maxStretch": 1.225,"routesOverSuggestedStretch": 0,- "minSegmentPx": 13,- "minInteriorSegmentPx": 70,- "shortSegmentCount": 1,- "shortEndpointSegmentCount": 1,+ "minSegmentPx": 16,+ "minInteriorSegmentPx": 82,+ "shortSegmentCount": 0,+ "shortEndpointSegmentCount": 0,"shortInteriorSegmentCount": 0,"microSegmentCount": 0},diff --git a/docs/gallery/sources/agent-tool-call.workflow.json b/docs/gallery/sources/agent-tool-call.workflow.jsonindex 1144e1d5..c8c31995 100644--- a/docs/gallery/sources/agent-tool-call.workflow.json+++ b/docs/gallery/sources/agent-tool-call.workflow.json@@ -1,5 +1,5 @@{- "schema_version": 1,+ "schema_version": 2,"diagram_type": "workflow","meta": {"title": "Agent Tool Call Workflow",@@ -26,16 +26,13 @@"note": "Isolate the durable trace and context path behind the visible answer."}],- "output": "examples/workflow-agent-tool-call-rendered.html",- "viewBox": [720, 900]+ "output": "examples/workflow-agent-tool-call-rendered.html"},"lanes": [{ "id": "ui", "label": "User Interface" },{ "id": "agent", "label": "Agent Runtime" },- { "id": "policy", "label": "Policy Boundary" },- { "id": "exceptions", "label": "Exception Handling", "variant": "exception" },- { "id": "tools", "label": "Tool Execution" },- { "id": "trace", "label": "Observability" }+ { "id": "policy", "label": "Policy & Recovery", "variant": "exception" },+ { "id": "tools", "label": "Tool Execution & Evidence" }],"phases": [{ "id": "intake", "label": "Intake", "fromCol": 0, "toCol": 1 },@@ -44,66 +41,53 @@],"groups": [{ "id": "agent_loop", "label": "Planning loop", "lane": "agent", "fromCol": 2, "toCol": 3, "variant": "emphasis" },- { "id": "tool_work", "label": "Tool work", "lane": "tools", "fromCol": 4, "toCol": 5, "variant": "dashed" },- { "id": "exception_path", "label": "Human or policy stop", "lane": "exceptions", "fromCol": 3, "toCol": 5, "variant": "security" }+ { "id": "exception_path", "label": "Human or policy stop", "lane": "policy", "fromCol": 3, "toCol": 5, "variant": "security" },+ { "id": "evidence_path", "label": "Evidence path", "lane": "tools", "fromCol": 1, "toCol": 2, "variant": "dashed" },+ { "id": "tool_work", "label": "Tool work", "lane": "tools", "fromCol": 4, "toCol": 5, "variant": "dashed" }],"mainPath": ["user", "chat", "planner", "router", "approval", "tool", "external", "final"],"nodes": [- { "id": "user", "lane": "ui", "col": 0, "type": "external", "label": "User", "sublabel": "asks for work" },- { "id": "chat", "lane": "ui", "col": 1, "type": "frontend", "label": "Chat Surface", "sublabel": "thread + files" },- { "id": "final", "lane": "ui", "col": 5, "type": "backend", "label": "Final Reply", "sublabel": "answer + changes" },- { "id": "planner", "lane": "agent", "col": 2, "type": "backend", "label": "Agent Planner", "sublabel": "plan next step", "tag": "context aware" },- { "id": "router", "lane": "agent", "col": 3, "type": "backend", "label": "Tool Router", "sublabel": "choose capability" },- { "id": "approval", "lane": "policy", "col": 3, "type": "security", "label": "Approval Gate", "sublabel": "scope + consent", "tag": "block risky ops" },- { "id": "blocked", "lane": "exceptions", "col": 4, "type": "security", "label": "Blocked", "sublabel": "wait or reject" },- { "id": "retry", "lane": "exceptions", "col": 5, "type": "messagebus", "label": "Retry Path", "sublabel": "revise request" },- { "id": "tool", "lane": "tools", "col": 4, "type": "messagebus", "label": "Tool Call", "sublabel": "shell / browser / MCP", "tag": "structured result" },- { "id": "external", "lane": "tools", "col": 5, "type": "cloud", "label": "External API", "sublabel": "network service" },- { "id": "store", "lane": "trace", "col": 1, "type": "database", "label": "Context Store", "sublabel": "repo + memory" },- { "id": "trace", "lane": "trace", "col": 4, "type": "database", "label": "Trace Log", "sublabel": "events + output" }+ { "id": "user", "lane": "ui", "col": 0, "type": "external", "label": "User", "sublabel": "asks for work", "width": 132 },+ { "id": "chat", "lane": "ui", "col": 1, "type": "frontend", "label": "Chat Surface", "sublabel": "thread + files", "width": 132 },+ { "id": "final", "lane": "ui", "col": 5, "type": "backend", "label": "Final Reply", "sublabel": "answer + changes", "width": 132 },+ { "id": "planner", "lane": "agent", "col": 2, "type": "backend", "label": "Agent Planner", "sublabel": "plan next step", "tag": "context aware", "width": 132 },+ { "id": "router", "lane": "agent", "col": 3, "type": "backend", "label": "Tool Router", "sublabel": "choose capability", "width": 132 },+ { "id": "approval", "lane": "policy", "col": 3, "type": "security", "label": "Approval Gate", "sublabel": "scope + consent", "tag": "block risky ops", "width": 132 },+ { "id": "blocked", "lane": "policy", "col": 4, "type": "security", "label": "Blocked", "sublabel": "wait or reject", "width": 132 },+ { "id": "retry", "lane": "policy", "col": 5, "type": "messagebus", "label": "Retry Path", "sublabel": "revise request", "width": 132 },+ { "id": "tool", "lane": "tools", "col": 4, "type": "messagebus", "label": "Tool Call", "sublabel": "shell / browser / MCP", "tag": "structured result", "width": 132 },+ { "id": "external", "lane": "tools", "col": 5, "type": "cloud", "label": "External API", "sublabel": "network service", "width": 132 },+ { "id": "store", "lane": "tools", "col": 1, "type": "database", "label": "Context Store", "sublabel": "repo + memory", "width": 132 },+ { "id": "trace", "lane": "tools", "col": 2, "type": "database", "label": "Trace Log", "sublabel": "events + output", "width": 132 }],"edges": [{ "id": "request-chat", "from": "user", "to": "chat", "variant": "default" },- { "id": "plan-request", "from": "chat", "to": "planner", "label": "plan", "variant": "emphasis", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 1 },+ { "id": "plan-request", "from": "chat", "to": "planner", "label": "plan", "variant": "emphasis" },{ "id": "planner-route", "from": "planner", "to": "router", "variant": "default" },- { "id": "approval-check", "from": "router", "to": "approval", "label": "needs approval?", "variant": "security", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 0, "labelDx": 34, "labelDy": 18 },- { "id": "approved-tool", "from": "approval", "to": "tool", "variant": "emphasis", "fromSide": "left", "toSide": "left", "route": "return-left" },- { "id": "approval-denied", "from": "approval", "to": "blocked", "label": "denied", "variant": "security", "role": "error", "fromSide": "bottom", "toSide": "top", "route": "drop", "labelSegment": 1, "labelDy": 12 },+ { "id": "approval-check", "from": "router", "to": "approval", "label": "needs approval?", "variant": "security" },+ { "id": "approved-tool", "from": "approval", "to": "tool", "variant": "emphasis" },+ { "id": "approval-denied", "from": "approval", "to": "blocked", "label": "denied", "variant": "security", "role": "error" },{ "id": "retry-request", "from": "blocked", "to": "retry", "variant": "dashed", "role": "branch" },{ "id": "tool-external-call", "from": "tool", "to": "external", "variant": "default" },{ "id": "external-reply", "from": "external", "to": "final", "variant": "emphasis", "role": "return", "fromSide": "right", "toSide": "right", "route": "outside-right", "width": 1.2 },{ "id": "record-result", "from": "external", "to": "trace", "label": "record result", "variant": "dashed", "fromSide": "bottom", "toSide": "bottom", "route": "bottom-channel", "labelSegment": 1 },- { "id": "write-trace-memory", "from": "store", "to": "trace", "label": "trace + memory", "variant": "dashed", "labelAt": [365, 735] }+ { "id": "write-trace-memory", "from": "store", "to": "trace", "label": "trace + memory", "variant": "dashed" }],"cards": [{"dot": "cyan",- "title": "Renderer Rules",+ "title": "Compiler Contract","items": ["Lanes and columns determine node placement",- "Edges attach to explicit node anchors",- "Cross-lane paths use orthogonal routing",- "Short adjacent links stay unlabeled"+ "Labels reserve clearance; routes stay orthogonal"]},{"dot": "rose",- "title": "Workflow Semantics",+ "title": "Runtime Semantics","items": [- "Approval is a first-class policy step",- "Consent gates are visible in the main path",- "External calls stay inside the tool lane",- "Trace writes are separate from the hot path"- ]- },- {- "dot": "emerald",- "title": "Why It Matters",- "items": [- "This is closer to a diagram_type renderer",- "The graph can be edited without SVG surgery",- "Layout rules can be tested and improved",- "A future IR can reuse this shape directly"+ "Approval gates risky work before tool execution",+ "Evidence returns through isolated trace and memory"]}]diff --git a/examples/workflow-agent-tool-call-rendered.html b/examples/workflow-agent-tool-call-rendered.htmlindex b5ea59d3..bc9f6211 100644--- a/examples/workflow-agent-tool-call-rendered.html+++ b/examples/workflow-agent-tool-call-rendered.html@@ -5004,7 +5004,7 @@<!-- Main Diagram --><div class="diagram-container" data-detail-level="read"data-preset-badge-editorial-plate="ARCHIFY / PLATE 04">- <svg viewBox="0 0 720 900" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase">+ <svg viewBox="0 0 1096 684" role="img" lang="en" aria-labelledby="archify-diagram-title archify-diagram-description" data-animation="trace" data-preset="signal-flow" data-quality-profile="showcase"><title id="archify-diagram-title">Agent Tool Call Workflow</title><desc id="archify-diagram-description">A workflow diagram generated by Archify.</desc><!-- Definitions -->@@ -5030,237 +5030,263 @@<rect width="100%" height="100%" fill="url(#grid)" /><!-- Swimlanes -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="1028" height="106" rx="10" class="c-lane" stroke-width="1"/><text x="54" y="74" class="t-dim" font-size="10" font-weight="600">01 / User Interface</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="176" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="198" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="178" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="200" class="t-dim" font-size="10" font-weight="600">02 / Agent Runtime</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="300" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="322" class="t-dim" font-size="10" font-weight="600">03 / Policy Boundary</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="312" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-2-exception" x="46" y="318" width="1016" height="102" rx="8" class="c-security-group" stroke-width="1"/>+ <text x="54" y="334" class="t-security" font-size="10" font-weight="600">EX / Policy & Recovery</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="424" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-3-exception" x="46" y="430" width="628" height="92" rx="8" class="c-security-group" stroke-width="1"/>- <text x="54" y="446" class="t-security" font-size="10" font-weight="600">EX / Exception Handling</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-4" x="40" y="548" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="570" class="t-dim" font-size="10" font-weight="600">05 / Tool Execution</text>-- <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-5" x="40" y="672" width="640" height="104" rx="10" class="c-lane" stroke-width="1"/>- <text x="54" y="694" class="t-dim" font-size="10" font-weight="600">06 / Observability</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="446" width="1028" height="114" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="468" class="t-dim" font-size="10" font-weight="600">04 / Tool Execution & Evidence</text><!-- Phase headers -->- <line x1="42" y1="35" x2="266" y2="35" class="a-default" stroke-width="1.1"/>- <rect x="42" y="27" width="224" height="16" rx="4" class="c-mask"/>- <text x="154" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>- <line x1="254" y1="35" x2="476" y2="35" class="a-emphasis" stroke-width="1.1"/>- <rect x="254" y="27" width="222" height="16" rx="4" class="c-mask"/>- <text x="365" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>- <line x1="454" y1="35" x2="671" y2="35" class="a-dashed" stroke-width="1.1"/>- <rect x="454" y="27" width="217" height="16" rx="4" class="c-mask"/>- <text x="562.5" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text>+ <line x1="68" y1="35" x2="320" y2="35" class="a-default" stroke-width="1.1"/>+ <rect x="68" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="194" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">Intake</text>+ <line x1="445.20000000000005" y1="35" x2="697.2" y2="35" class="a-emphasis" stroke-width="1.1"/>+ <rect x="445.20000000000005" y="27" width="252.00000000000006" height="16" rx="4" class="c-mask"/>+ <text x="571.2" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">Plan + route</text>+ <line x1="784" y1="35" x2="1036" y2="35" class="a-dashed" stroke-width="1.1"/>+ <rect x="784" y="27" width="252" height="16" rx="4" class="c-mask"/>+ <text x="910" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">Execute + report</text><!-- Workflow groups -->- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="250" y="214" width="230" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="260" y="228" class="t-backend" font-size="7" font-weight="600">Planning loop</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="450" y="586" width="225" height="58" rx="9" class="c-lane" stroke-width="1"/>- <text x="460" y="600" class="t-messagebus" font-size="7" font-weight="600">Tool work</text>- <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="380" y="462" width="295" height="58" rx="9" class="c-security-group" stroke-width="1"/>- <text x="390" y="476" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="421.2" y="216" width="300.00000000000006" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="431.2" y="214" class="t-backend" font-size="7" font-weight="600">Planning loop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="581.2" y="350" width="478.79999999999995" height="72" rx="9" class="c-security-group" stroke-width="1"/>+ <text x="591.2" y="348" class="t-security" font-size="7" font-weight="600">Human or policy stop</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="204" y="484" width="357.20000000000005" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="214" y="482" class="t-messagebus" font-size="7" font-weight="600">Evidence path</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-3" x="760" y="484" width="300" height="72" rx="9" class="c-lane" stroke-width="1"/>+ <text x="770" y="482" class="t-messagebus" font-size="7" font-weight="600">Tool work</text><!-- Edge paths -->- <path data-edge-from="user" data-edge-to="chat" data-edge-key="0" data-edge-id="request-chat" data-composition-points="134,119;174,119" d="M 134 119 L 174 119" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request" data-composition-points="220,145;220,166;300,166;300,209" d="M 220 145 L 220 166 L 300 166 L 300 209" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="planner" data-edge-to="router" data-edge-key="2" data-edge-id="planner-route" data-composition-points="346,243;384,243" d="M 346 243 L 384 243" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check" data-composition-points="430,269;430,290;430,290;430,333" d="M 430 269 L 430 290 L 430 290 L 430 333" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="approval" data-edge-to="tool" data-edge-key="4" data-edge-id="approved-tool" data-composition-points="384,367;356,367;356,615;454,615" d="M 384 367 L 356 367 L 356 615 L 454 615" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied" data-composition-points="430,401;430,414;500,414;500,465" d="M 430 401 L 430 414 L 500 414 L 500 465" class="a-security" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>- <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="6" data-edge-id="retry-request" data-composition-points="546,491;579,491" d="M 546 491 L 579 491" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="tool" data-edge-to="external" data-edge-key="7" data-edge-id="tool-external-call" data-composition-points="546,615;579,615" d="M 546 615 L 579 615" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>- <path data-edge-from="external" data-edge-to="final" data-edge-key="8" data-edge-id="external-reply" data-composition-points="671,615;692,615;692,119;671,119" d="M 671 615 L 692 615 L 692 119 L 671 119" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>- <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result" data-composition-points="625,641;625,797;500,797;500,765" d="M 625 641 L 625 797 L 500 797 L 500 765" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>- <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="266,739;454,739" d="M 266 739 L 454 739" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check" data-composition-points="651.2,279;651.2,302;569.2,302;569.2,387;585.2,387" d="M 651.2 279 L 651.2 302 L 569.2 302 L 569.2 387 L 585.2 387" class="a-security" data-animate="edge" style="--step:3" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied" data-composition-points="651.2,421;651.2,442;830,442;830,413" d="M 651.2 421 L 651.2 442 L 830 442 L 830 413" class="a-security" data-animate="edge" style="--step:9" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="approval" data-edge-to="tool" data-edge-key="2" data-edge-id="approved-tool" data-composition-points="651.2,421;651.2,521;764,521" d="M 651.2 421 L 651.2 521 L 764 521" class="a-emphasis" data-animate="edge" style="--step:4" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="external" data-edge-to="final" data-edge-key="3" data-edge-id="external-reply" data-composition-points="1056,521;1080,521;1080,120;1056,120" d="M 1056 521 L 1080 521 L 1080 120 L 1056 120" class="a-emphasis" data-animate="edge" style="--step:6" stroke-width="1.2" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request" data-composition-points="274,146;274,253;425.2,253" d="M 274 146 L 274 253 L 425.2 253" class="a-emphasis" data-animate="edge" style="--step:1" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="planner" data-edge-to="router" data-edge-key="5" data-edge-id="planner-route" data-composition-points="557.2,253;585.2,253" d="M 557.2 253 L 585.2 253" class="a-default" data-animate="edge" style="--step:2" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result" data-composition-points="990,547;990,579;491.2,579;491.2,547" d="M 990 547 L 990 579 L 491.2 579 L 491.2 547" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="user" data-edge-to="chat" data-edge-key="7" data-edge-id="request-chat" data-composition-points="180,120;208,120" d="M 180 120 L 208 120" class="a-default" data-animate="edge" style="--step:0" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="blocked" data-edge-to="retry" data-edge-key="8" data-edge-id="retry-request" data-composition-points="896,387;924,387" d="M 896 387 L 924 387" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="tool" data-edge-to="external" data-edge-key="9" data-edge-id="tool-external-call" data-composition-points="896,521;924,521" d="M 896 521 L 924 521" class="a-default" data-animate="edge" style="--step:5" stroke-width="1.4" marker-end="url(#arrowhead)"/>+ <path data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory" data-composition-points="340,521;425.2,521" d="M 340 521 L 425.2 521" class="a-dashed" data-animate="edge" style="--step:12" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/><!-- Nodes --><g id="node-user" data-node-id="user" data-node-label="User" tabindex="0" role="button" aria-label="Focus User, asks for work, User Interface › Intake" aria-pressed="false" data-node-kind="external" data-node-sublabel="asks for work" data-node-context="User Interface › Intake"><title>User · asks for work · User Interface › Intake</title>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="42" y="93" width="92" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(48 99) scale(0.6875)">+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="48" y="94" width="132" height="52" rx="6" class="c-external" data-animate="node" style="--step:0" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="external" class="semantic-sigil s-external" transform="translate(54 100) scale(0.6875)"><rect x="2.5" y="5" width="8.5" height="8" rx="1.5"/><path d="M8 2.5h5.5V8M13.5 2.5 7.5 8.5"/></g>- <text data-node-label="" data-detail-anchor="" x="88" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>- <text data-detail="context" x="88" y="131" class="t-muted" font-size="8" text-anchor="middle">asks for work</text>+ <text data-node-label="" data-detail-anchor="" x="114" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">User</text>+ <text data-detail="context" x="114" y="132" class="t-muted" font-size="8" text-anchor="middle">asks for work</text></g><g id="node-chat" data-node-id="chat" data-node-label="Chat Surface" tabindex="0" role="button" aria-label="Focus Chat Surface, thread + files, User Interface › Intake" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="thread + files" data-node-context="User Interface › Intake"><title>Chat Surface · thread + files · User Interface › Intake</title>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="93" width="92" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(180 99) scale(0.6875)">+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="94" width="132" height="52" rx="6" class="c-frontend" data-animate="node" style="--step:1" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(214 100) scale(0.6875)"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M2 6.5h12"/><circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/><circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>- <text data-detail="context" x="220" y="131" class="t-muted" font-size="8" text-anchor="middle">thread + files</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Chat Surface</text>+ <text data-detail="context" x="274" y="132" class="t-muted" font-size="8" text-anchor="middle">thread + files</text></g><g id="node-final" data-node-id="final" data-node-label="Final Reply" tabindex="0" role="button" aria-label="Focus Final Reply, answer + changes, User Interface › Execute + report" aria-pressed="false" data-node-kind="backend" data-node-sublabel="answer + changes" data-node-context="User Interface › Execute + report"><title>Final Reply · answer + changes · User Interface › Execute + report</title>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="93" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(585 99) scale(0.6875)">+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="94" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:7" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(930 100) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>- <text data-detail="context" x="625" y="131" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="115" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Final Reply</text>+ <text data-detail="context" x="990" y="132" class="t-muted" font-size="8" text-anchor="middle">answer + changes</text></g><g id="node-planner" data-node-id="planner" data-node-label="Agent Planner" tabindex="0" role="button" aria-label="Focus Agent Planner, plan next step, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="plan next step" data-node-tag="context aware" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Agent Planner · plan next step · Agent Runtime › Planning loop › Plan + route · context aware</title>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-mask"/>- <rect x="254" y="209" width="92" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(260 215) scale(0.6875)">+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="425.2" y="219" width="132" height="68" rx="6" class="c-backend" data-animate="node" style="--step:2" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(431.2 225) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="300" y="230" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Agent Planner</text>- <text data-detail="context" x="300" y="247" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>- <text data-detail="fine" x="300" y="265" class="t-backend" font-size="7" text-anchor="middle">context aware</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="240" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Agent Planner</text>+ <text data-detail="context" x="491.2" y="257" class="t-muted" font-size="8" text-anchor="middle">plan next step</text>+ <text data-detail="fine" x="491.2" y="275" class="t-backend" font-size="7" text-anchor="middle">context aware</text></g><g id="node-router" data-node-id="router" data-node-label="Tool Router" tabindex="0" role="button" aria-label="Focus Tool Router, choose capability, Agent Runtime › Planning loop › Plan + route" aria-pressed="false" data-node-kind="backend" data-node-sublabel="choose capability" data-node-context="Agent Runtime › Planning loop › Plan + route"><title>Tool Router · choose capability · Agent Runtime › Planning loop › Plan + route</title>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-mask"/>- <rect x="384" y="217" width="92" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(390 223) scale(0.6875)">+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="585.2" y="227" width="132" height="52" rx="6" class="c-backend" data-animate="node" style="--step:3" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(591.2 233) scale(0.6875)"><path d="M6 3 3 8l3 5M10 3l3 5-3 5"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>- <text data-detail="context" x="430" y="255" class="t-muted" font-size="8" text-anchor="middle">choose capability</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="248" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Router</text>+ <text data-detail="context" x="651.2" y="265" class="t-muted" font-size="8" text-anchor="middle">choose capability</text></g>- <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy Boundary › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy Boundary › Plan + route">- <title>Approval Gate · scope + consent · Policy Boundary › Plan + route · block risky ops</title>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-mask"/>- <rect x="384" y="333" width="92" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(390 339) scale(0.6875)">+ <g id="node-approval" data-node-id="approval" data-node-label="Approval Gate" tabindex="0" role="button" aria-label="Focus Approval Gate, scope + consent, Policy & Recovery › Human or policy stop › Plan + route" aria-pressed="false" data-node-kind="security" data-node-sublabel="scope + consent" data-node-tag="block risky ops" data-node-context="Policy & Recovery › Human or policy stop › Plan + route">+ <title>Approval Gate · scope + consent · Policy & Recovery › Human or policy stop › Plan + route · block risky ops</title>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="585.2" y="353" width="132" height="68" rx="6" class="c-security" data-animate="node" style="--step:4" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(591.2 359) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="430" y="354" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Approval Gate</text>- <text data-detail="context" x="430" y="371" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>- <text data-detail="fine" x="430" y="389" class="t-security" font-size="7" text-anchor="middle">block risky ops</text>+ <text data-node-label="" data-detail-anchor="" x="651.2" y="374" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Approval Gate</text>+ <text data-detail="context" x="651.2" y="391" class="t-muted" font-size="8" text-anchor="middle">scope + consent</text>+ <text data-detail="fine" x="651.2" y="409" class="t-security" font-size="7" text-anchor="middle">block risky ops</text></g>- <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Blocked · wait or reject · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="465" width="92" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(460 471) scale(0.6875)">+ <g id="node-blocked" data-node-id="blocked" data-node-label="Blocked" tabindex="0" role="button" aria-label="Focus Blocked, wait or reject, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="security" data-node-sublabel="wait or reject" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Blocked · wait or reject · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="764" y="361" width="132" height="52" rx="6" class="c-security" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(770 367) scale(0.6875)"><path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/><path d="m5.8 8 1.5 1.5 3-3"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>- <text data-detail="context" x="500" y="503" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Blocked</text>+ <text data-detail="context" x="830" y="399" class="t-muted" font-size="8" text-anchor="middle">wait or reject</text></g>- <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Exception Handling › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Exception Handling › Human or policy stop › Execute + report">- <title>Retry Path · revise request · Exception Handling › Human or policy stop › Execute + report</title>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="465" width="92" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(585 471) scale(0.6875)">+ <g id="node-retry" data-node-id="retry" data-node-label="Retry Path" tabindex="0" role="button" aria-label="Focus Retry Path, revise request, Policy & Recovery › Human or policy stop › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="revise request" data-node-context="Policy & Recovery › Human or policy stop › Execute + report">+ <title>Retry Path · revise request · Policy & Recovery › Human or policy stop › Execute + report</title>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="361" width="132" height="52" rx="6" class="c-messagebus" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(930 367) scale(0.6875)"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/><circle cx="5" cy="4.5" r="1" class="sigil-fill"/><circle cx="10.5" cy="8" r="1" class="sigil-fill"/><circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>- <text data-detail="context" x="625" y="503" class="t-muted" font-size="8" text-anchor="middle">revise request</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="382" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Retry Path</text>+ <text data-detail="context" x="990" y="399" class="t-muted" font-size="8" text-anchor="middle">revise request</text></g>- <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution › Tool work › Execute + report">- <title>Tool Call · shell / browser / MCP · Tool Execution › Tool work › Execute + report · structured result</title>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-mask"/>- <rect x="454" y="581" width="92" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(460 587) scale(0.6875)">- <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>- <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>- <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>- <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Tool Execution & Evidence › Evidence path › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Tool Execution & Evidence › Evidence path › Intake">+ <title>Context Store · repo + memory · Tool Execution & Evidence › Evidence path › Intake</title>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="208" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(214 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="602" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>- <text data-detail="context" x="500" y="619" class="t-muted" font-size="6.6" text-anchor="middle">shell / browser / MCP</text>- <text data-detail="fine" x="500" y="637" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text>+ <text data-node-label="" data-detail-anchor="" x="274" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Context Store</text>+ <text data-detail="context" x="274" y="533" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text></g>- <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution › Tool work › Execute + report">- <title>External API · network service · Tool Execution › Tool work › Execute + report</title>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-mask"/>- <rect x="579" y="589" width="92" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(585 595) scale(0.6875)">- <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Tool Execution & Evidence › Evidence path › Plan + route" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Tool Execution & Evidence › Evidence path › Plan + route">+ <title>Trace Log · events + output · Tool Execution & Evidence › Evidence path › Plan + route</title>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="425.2" y="495" width="132" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(431.2 501) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/></g>- <text data-node-label="" data-detail-anchor="" x="625" y="610" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>- <text data-detail="context" x="625" y="627" class="t-muted" font-size="8" text-anchor="middle">network service</text>+ <text data-node-label="" data-detail-anchor="" x="491.2" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>+ <text data-detail="context" x="491.2" y="533" class="t-muted" font-size="8" text-anchor="middle">events + output</text></g>- <g id="node-store" data-node-id="store" data-node-label="Context Store" tabindex="0" role="button" aria-label="Focus Context Store, repo + memory, Observability › Intake" aria-pressed="false" data-node-kind="database" data-node-sublabel="repo + memory" data-node-context="Observability › Intake">- <title>Context Store · repo + memory · Observability › Intake</title>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="174" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(180 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-tool" data-node-id="tool" data-node-label="Tool Call" tabindex="0" role="button" aria-label="Focus Tool Call, shell / browser / MCP, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="shell / browser / MCP" data-node-tag="structured result" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>Tool Call · shell / browser / MCP · Tool Execution & Evidence › Tool work › Execute + report · structured result</title>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-mask"/>+ <rect x="764" y="487" width="132" height="68" rx="6" class="c-messagebus" data-animate="node" style="--step:5" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(770 493) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/></g>- <text data-node-label="" data-detail-anchor="" x="220" y="734" class="t-primary" font-size="10.7" font-weight="600" text-anchor="middle">Context Store</text>- <text data-detail="context" x="220" y="751" class="t-muted" font-size="8" text-anchor="middle">repo + memory</text>+ <text data-node-label="" data-detail-anchor="" x="830" y="508" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Tool Call</text>+ <text data-detail="context" x="830" y="525" class="t-muted" font-size="8" text-anchor="middle">shell / browser / MCP</text>+ <text data-detail="fine" x="830" y="543" class="t-messagebus" font-size="7" text-anchor="middle">structured result</text></g>- <g id="node-trace" data-node-id="trace" data-node-label="Trace Log" tabindex="0" role="button" aria-label="Focus Trace Log, events + output, Observability › Execute + report" aria-pressed="false" data-node-kind="database" data-node-sublabel="events + output" data-node-context="Observability › Execute + report">- <title>Trace Log · events + output · Observability › Execute + report</title>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-mask"/>- <rect x="454" y="713" width="92" height="52" rx="6" class="c-database" data-animate="node" style="--step:12" stroke-width="1.5"/>- <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(460 719) scale(0.6875)">- <ellipse cx="8" cy="4" rx="5" ry="2"/>- <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ <g id="node-external" data-node-id="external" data-node-label="External API" tabindex="0" role="button" aria-label="Focus External API, network service, Tool Execution & Evidence › Tool work › Execute + report" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="network service" data-node-context="Tool Execution & Evidence › Tool work › Execute + report">+ <title>External API · network service · Tool Execution & Evidence › Tool work › Execute + report</title>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="924" y="495" width="132" height="52" rx="6" class="c-cloud" data-animate="node" style="--step:6" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(930 501) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/></g>- <text data-node-label="" data-detail-anchor="" x="500" y="734" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">Trace Log</text>- <text data-detail="context" x="500" y="751" class="t-muted" font-size="8" text-anchor="middle">events + output</text>+ <text data-node-label="" data-detail-anchor="" x="990" y="516" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">External API</text>+ <text data-detail="context" x="990" y="533" class="t-muted" font-size="8" text-anchor="middle">network service</text></g><!-- Edge labels -->-- <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="1" data-edge-id="plan-request">- <rect x="245" y="146" width="30" height="14" rx="3" class="c-mask"/>- <text x="260" y="156" class="t-backend" font-size="8" text-anchor="middle">plan</text>+ <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="0" data-edge-id="approval-check">+ <rect x="569.2" y="282" width="82" height="14" rx="3" class="c-mask"/>+ <text x="610.2" y="292" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>+ </g>+ <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="1" data-edge-id="approval-denied">+ <rect x="721.2" y="422" width="38.8" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="432" class="t-security" font-size="8" text-anchor="middle">denied</text></g>- <g data-detail="context" data-edge-from="router" data-edge-to="approval" data-edge-label="needs approval?" data-edge-key="3" data-edge-id="approval-check">- <rect x="423" y="277.5" width="82" height="14" rx="3" class="c-mask"/>- <text x="464" y="287.5" class="t-security" font-size="8" text-anchor="middle">needs approval?</text>++ <g data-detail="context" data-edge-from="chat" data-edge-to="planner" data-edge-label="plan" data-edge-key="4" data-edge-id="plan-request">+ <rect x="334.6" y="233" width="30" height="14" rx="3" class="c-mask"/>+ <text x="349.6" y="243" class="t-backend" font-size="8" text-anchor="middle">plan</text></g>- <g data-detail="context" data-edge-from="approval" data-edge-to="blocked" data-edge-label="denied" data-edge-key="5" data-edge-id="approval-denied">- <rect x="445.6" y="406" width="38.8" height="14" rx="3" class="c-mask"/>- <text x="465" y="416" class="t-security" font-size="8" text-anchor="middle">denied</text>+ <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="6" data-edge-id="record-result">+ <rect x="704.4" y="559" width="72.4" height="14" rx="3" class="c-mask"/>+ <text x="740.6" y="569" class="t-database" font-size="8" text-anchor="middle">record result</text></g>- <g data-detail="context" data-edge-from="external" data-edge-to="trace" data-edge-label="record result" data-edge-key="9" data-edge-id="record-result">- <rect x="526.3" y="777" width="72.4" height="14" rx="3" class="c-mask"/>- <text x="562.5" y="787" class="t-database" font-size="8" text-anchor="middle">record result</text>- </g><g data-detail="context" data-edge-from="store" data-edge-to="trace" data-edge-label="trace + memory" data-edge-key="10" data-edge-id="write-trace-memory">- <rect x="326.4" y="725" width="77.2" height="14" rx="3" class="c-mask"/>- <text x="365" y="735" class="t-database" font-size="8" text-anchor="middle">trace + memory</text>+ <rect x="344" y="501" width="77.2" height="14" rx="3" class="c-mask"/>+ <text x="382.6" y="511" class="t-database" font-size="8" text-anchor="middle">trace + memory</text></g><!-- Legend -->-+ <g data-legend="" data-legend-bridge="">+ <text x="20" y="584" class="t-primary" font-size="12" font-weight="650">Legend</text>+ <g data-legend-semantic-kind="frontend" data-legend-kind="frontend" data-legend-label="User UI" data-legend-x="20" data-legend-baseline="604" data-legend-width="74">+ <rect x="20" y="596" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="42" y="604" class="t-muted" font-size="7.5" font-weight="500">User UI</text>+ </g>+ <g data-legend-semantic-kind="backend" data-legend-kind="backend" data-legend-label="Agent logic" data-legend-x="101" data-legend-baseline="604" data-legend-width="91">+ <rect x="101" y="596" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="123" y="604" class="t-muted" font-size="7.5" font-weight="500">Agent logic</text>+ </g>+ <g data-legend-semantic-kind="security" data-legend-kind="security" data-legend-label="Policy" data-legend-x="199" data-legend-baseline="604" data-legend-width="70">+ <rect x="199" y="596" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="221" y="604" class="t-muted" font-size="7.5" font-weight="500">Policy</text>+ </g>+ <g data-legend-semantic-kind="messagebus" data-legend-kind="messagebus" data-legend-label="Tool action" data-legend-x="276" data-legend-baseline="604" data-legend-width="91">+ <rect x="276" y="596" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="298" y="604" class="t-muted" font-size="7.5" font-weight="500">Tool action</text>+ </g>+ <g data-legend-semantic-kind="database" data-legend-kind="database" data-legend-label="Context / trace" data-legend-x="374" data-legend-baseline="604" data-legend-width="109">+ <rect x="374" y="596" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>+ <text x="396" y="604" class="t-muted" font-size="7.5" font-weight="500">Context / trace</text>+ </g>+ <g data-legend-semantic-kind="cloud" data-legend-kind="cloud" data-legend-label="Cloud service" data-legend-x="490" data-legend-baseline="604" data-legend-width="100">+ <rect x="490" y="596" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="512" y="604" class="t-muted" font-size="7.5" font-weight="500">Cloud service</text>+ </g>+ <g data-legend-semantic-kind="external" data-legend-kind="external" data-legend-label="External system" data-legend-x="597" data-legend-baseline="604" data-legend-width="109">+ <rect x="597" y="596" width="14" height="9" rx="2" class="c-external" stroke-width="1"/>+ <text x="619" y="604" class="t-muted" font-size="7.5" font-weight="500">External system</text>+ </g>+ </g></svg><p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p><div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">@@ -5450,39 +5476,22 @@<div class="card"><div class="card-header"><div class="card-dot cyan"></div>- <h3>Renderer Rules</h3>+ <h3>Compiler Contract</h3></div><ul><li>• Lanes and columns determine node placement</li>- <li>• Edges attach to explicit node anchors</li>- <li>• Cross-lane paths use orthogonal routing</li>- <li>• Short adjacent links stay unlabeled</li>+ <li>• Labels reserve clearance; routes stay orthogonal</li></ul></div><div class="card"><div class="card-header"><div class="card-dot rose"></div>- <h3>Workflow Semantics</h3>- </div>- <ul>- <li>• Approval is a first-class policy step</li>- <li>• Consent gates are visible in the main path</li>- <li>• External calls stay inside the tool lane</li>- <li>• Trace writes are separate from the hot path</li>- </ul>- </div>-- <div class="card">- <div class="card-header">- <div class="card-dot emerald"></div>- <h3>Why It Matters</h3>+ <h3>Runtime Semantics</h3></div><ul>- <li>• This is closer to a diagram_type renderer</li>- <li>• The graph can be edited without SVG surgery</li>- <li>• Layout rules can be tested and improved</li>- <li>• A future IR can reuse this shape directly</li>+ <li>• Approval gates risky work before tool execution</li>+ <li>• Evidence returns through isolated trace and memory</li></ul></div></div>diff --git a/generated/maka-regenerated.workflow.html b/generated/maka-regenerated.workflow.htmlnew file mode 100644index 00000000..06beddc0--- /dev/null+++ b/generated/maka-regenerated.workflow.html@@ -0,0 +1,14758 @@+<!DOCTYPE html>+<html lang="zh-CN" data-theme="dark" data-preset="classic">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <meta name="generator" content="archify 2.16.0-dev.0">+ <title>Maka 托管执行、受控工具与可恢复事实</title>+ <script>+ // Resolve the theme before first paint so light-preference users don't+ // see a dark flash. The toolbar script below re-applies with UI state.+ (function () {+ try {+ var theme = null;+ try {+ var param = new URLSearchParams(window.location.search).get('theme');+ if (param === 'light' || param === 'dark') theme = param;+ if (new URLSearchParams(window.location.search).get('embed') === '1') {+ document.documentElement.setAttribute('data-embed', 'true');+ }+ if (new URLSearchParams(window.location.search).get('present') === '1') {+ document.documentElement.setAttribute('data-present', 'true');+ }+ } catch (_) {}+ if (!theme) {+ try { theme = localStorage.getItem('archify-theme'); } catch (_) {}+ }+ if (theme !== 'light' && theme !== 'dark') {+ theme = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ }+ document.documentElement.setAttribute('data-theme', theme);+ } catch (_) {}+ })();+ </script>+ <!-- Async font load: a blackholed network must not block first paint.+ The body font stack falls back to system monospace until it lands. -->+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>+ <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"+ rel="stylesheet" media="print" onload="this.media='all'">+ <noscript>+ <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">+ </noscript>+ <style>+ /* ==========================================================+ THEME VARIABLES — switch by toggling [data-theme] on <html>+ ========================================================== */+ :root,+ [data-theme="dark"] {+ --bg: #020617;+ --grid: #1e293b;+ --text: #ffffff;+ --text-muted: #94a3b8;+ --text-dim: #475569;+ /* UI chrome and menu hints need more contrast than SVG .t-dim accents */+ --text-faint: #7d8da1;++ --panel: rgba(15, 23, 42, 0.5);+ --panel-border: #1e293b;+ --lane-fill: rgba(15, 23, 42, 0.22);+ --lane-stroke: #334155;++ --arrow: #64748b;+ --arrow-emphasis: #34d399;++ /* Opaque mask color used behind semi-transparent component fills+ so the arrows drawn underneath are properly hidden. */+ --mask: #0f172a;++ --frontend-fill: rgba(8, 51, 68, 0.4);+ --frontend-stroke: #22d3ee;+ --backend-fill: rgba(6, 78, 59, 0.4);+ --backend-stroke: #34d399;+ --database-fill: rgba(76, 29, 149, 0.4);+ --database-stroke: #a78bfa;+ --cloud-fill: rgba(120, 53, 15, 0.3);+ --cloud-stroke: #fbbf24;+ --security-fill: rgba(136, 19, 55, 0.4);+ --security-stroke: #fb7185;+ --messagebus-fill: rgba(251, 146, 60, 0.3);+ --messagebus-stroke:#fb923c;+ --external-fill: rgba(30, 41, 59, 0.5);+ --external-stroke: #94a3b8;++ --toolbar-bg: rgba(15, 23, 42, 0.8);+ --toolbar-border: #334155;+ --toolbar-text: #e2e8f0;+ --toolbar-hover: rgba(15, 23, 42, 0.95);+ --toolbar-menu-bg: #0f172a;+ }++ [data-theme="light"] {+ --bg: #f8fafc;+ --grid: #e2e8f0;+ --text: #0f172a;+ --text-muted: #64748b;+ --text-dim: #94a3b8;+ --text-faint: #64748b;++ --panel: #ffffff;+ --panel-border: #e2e8f0;+ --lane-fill: rgba(248, 250, 252, 0.65);+ --lane-stroke: #cbd5e1;++ --arrow: #94a3b8;+ --arrow-emphasis: #059669;++ --mask: #ffffff;++ --frontend-fill: rgba(34, 211, 238, 0.15);+ --frontend-stroke: #0891b2;+ --backend-fill: rgba(52, 211, 153, 0.18);+ --backend-stroke: #059669;+ --database-fill: rgba(167, 139, 250, 0.2);+ --database-stroke: #7c3aed;+ --cloud-fill: rgba(251, 191, 36, 0.18);+ --cloud-stroke: #d97706;+ --security-fill: rgba(251, 113, 133, 0.15);+ --security-stroke: #e11d48;+ --messagebus-fill: rgba(251, 146, 60, 0.15);+ --messagebus-stroke:#ea580c;+ --external-fill: rgba(148, 163, 184, 0.18);+ --external-stroke: #64748b;++ --toolbar-bg: rgba(255, 255, 255, 0.92);+ --toolbar-border: #cbd5e1;+ --toolbar-text: #334155;+ --toolbar-hover: #ffffff;+ --toolbar-menu-bg: #ffffff;+ }++ /* ==========================================================+ SIGNAL FLOW — an opt-in, motion-forward visual preset.+ The variables also target a standalone exported SVG, whose+ root carries data-preset and data-theme directly.+ ========================================================== */+ [data-preset="signal-flow"][data-theme="dark"] {+ --bg: #030711;+ --grid: #15233a;+ --panel: rgba(6, 14, 28, 0.78);+ --panel-border: #1d3350;+ --lane-fill: rgba(9, 22, 40, 0.5);+ --lane-stroke: #2c4564;+ --text: #f5fbff;+ --text-muted: #9eb0c7;+ --text-dim: #52667f;+ --text-faint: #7890ad;+ --mask: #07101e;+ --frontend-fill: rgba(6, 182, 212, 0.14);+ --frontend-stroke: #67e8f9;+ --backend-fill: rgba(16, 185, 129, 0.14);+ --backend-stroke: #5eead4;+ --database-fill: rgba(139, 92, 246, 0.16);+ --database-stroke: #c4b5fd;+ --cloud-fill: rgba(245, 158, 11, 0.13);+ --cloud-stroke: #fcd34d;+ --security-fill: rgba(244, 63, 94, 0.13);+ --security-stroke: #fda4af;+ --messagebus-fill: rgba(249, 115, 22, 0.13);+ --messagebus-stroke: #fdba74;+ --external-fill: rgba(71, 85, 105, 0.24);+ --external-stroke: #a5b4c7;+ --arrow: #7890ad;+ --arrow-emphasis: #2dd4bf;+ --toolbar-bg: rgba(7, 16, 30, 0.86);+ --toolbar-border: #29415f;+ --toolbar-menu-bg: #07101e;+ }++ [data-preset="signal-flow"][data-theme="light"] {+ --bg: #f4f9fc;+ --grid: #d4e5ee;+ --panel: rgba(255, 255, 255, 0.82);+ --panel-border: #bfd5e2;+ --lane-fill: rgba(232, 243, 248, 0.62);+ --lane-stroke: #a9c5d5;+ --text: #102638;+ --text-muted: #587287;+ --text-dim: #8aa2b4;+ --text-faint: #668397;+ --mask: #ffffff;+ --frontend-fill: rgba(6, 182, 212, 0.09);+ --frontend-stroke: #0789a1;+ --backend-fill: rgba(5, 150, 105, 0.09);+ --backend-stroke: #087f69;+ --database-fill: rgba(124, 58, 237, 0.09);+ --database-stroke: #7254c7;+ --cloud-fill: rgba(217, 119, 6, 0.08);+ --cloud-stroke: #b9670b;+ --security-fill: rgba(225, 29, 72, 0.08);+ --security-stroke: #c53a59;+ --messagebus-fill: rgba(234, 88, 12, 0.08);+ --messagebus-stroke: #c65f27;+ --external-fill: rgba(100, 116, 139, 0.1);+ --external-stroke: #607a8c;+ --arrow: #7b97aa;+ --arrow-emphasis: #0d9488;+ }++ /* ==========================================================+ BLUEPRINT — a review-first drafting preset for deployment,+ infrastructure, and technical design documentation. It keeps+ the same semantic palette and geometry while trading glow for+ precise grid contrast, squared materials, and drafting marks.+ ========================================================== */+ [data-preset="blueprint"][data-theme="dark"] {+ --bg: #06131f;+ --grid: #17425a;+ --panel: rgba(7, 27, 43, 0.9);+ --panel-border: #27627f;+ --lane-fill: rgba(10, 43, 66, 0.36);+ --lane-stroke: #34799a;+ --text: #e3f6ff;+ --text-muted: #91b8ca;+ --text-dim: #557e92;+ --text-faint: #739caf;+ --mask: #0a2031;+ --frontend-fill: rgba(26, 157, 193, 0.14);+ --frontend-stroke: #66d9ef;+ --backend-fill: rgba(31, 155, 124, 0.13);+ --backend-stroke: #69dfbd;+ --database-fill: rgba(120, 105, 196, 0.14);+ --database-stroke: #b4a8ff;+ --cloud-fill: rgba(197, 145, 43, 0.13);+ --cloud-stroke: #ffd166;+ --security-fill: rgba(199, 76, 104, 0.13);+ --security-stroke: #ff8da1;+ --messagebus-fill: rgba(207, 112, 49, 0.13);+ --messagebus-stroke: #ffad66;+ --external-fill: rgba(84, 119, 139, 0.18);+ --external-stroke: #a7cad9;+ --arrow: #78a3b7;+ --arrow-emphasis: #64dfc1;+ --toolbar-bg: rgba(7, 28, 45, 0.92);+ --toolbar-border: #34799a;+ --toolbar-text: #d8f3ff;+ --toolbar-hover: rgba(18, 58, 83, 0.95);+ --toolbar-menu-bg: #0a2031;+ }++ [data-preset="blueprint"][data-theme="light"] {+ --bg: #edf7fa;+ --grid: #b5d5e1;+ --panel: rgba(249, 253, 255, 0.94);+ --panel-border: #78aabd;+ --lane-fill: rgba(210, 232, 240, 0.42);+ --lane-stroke: #83b2c4;+ --text: #123344;+ --text-muted: #4e7486;+ --text-dim: #86a6b4;+ --text-faint: #668c9d;+ --mask: #f9fdff;+ --frontend-fill: rgba(8, 145, 178, 0.08);+ --frontend-stroke: #087f9c;+ --backend-fill: rgba(5, 128, 101, 0.08);+ --backend-stroke: #08755f;+ --database-fill: rgba(100, 75, 180, 0.08);+ --database-stroke: #6757a8;+ --cloud-fill: rgba(181, 120, 15, 0.08);+ --cloud-stroke: #a86609;+ --security-fill: rgba(190, 48, 80, 0.07);+ --security-stroke: #b32f50;+ --messagebus-fill: rgba(196, 81, 22, 0.07);+ --messagebus-stroke: #b65120;+ --external-fill: rgba(79, 112, 128, 0.08);+ --external-stroke: #506f7e;+ --arrow: #6d93a5;+ --arrow-emphasis: #087f69;+ --toolbar-bg: rgba(247, 252, 254, 0.94);+ --toolbar-border: #8ab5c5;+ --toolbar-text: #294f61;+ --toolbar-hover: #ffffff;+ --toolbar-menu-bg: #f9fdff;+ }++ /* ==========================================================+ EDITORIAL — a warm, publication-minded preset for design+ reviews, launch notes, and documentation. The diagram keeps+ the same semantic palette and exact geometry, but trades+ software chrome for paper, ink, ruled structure, and one+ restrained vermilion accent.+ ========================================================== */+ [data-preset="editorial"][data-theme="dark"] {+ --bg: #181611;+ --grid: #39342a;+ --panel: rgba(35, 31, 24, 0.96);+ --panel-border: #625a4a;+ --lane-fill: rgba(52, 46, 35, 0.46);+ --lane-stroke: #726957;+ --text: #f4eddf;+ --text-muted: #b9ae9b;+ --text-dim: #776e60;+ --text-faint: #9d917e;+ --mask: #231f18;+ --frontend-fill: rgba(43, 133, 142, 0.16);+ --frontend-stroke: #7fc6c7;+ --backend-fill: rgba(63, 132, 92, 0.16);+ --backend-stroke: #8fc29e;+ --database-fill: rgba(117, 91, 141, 0.17);+ --database-stroke: #c0a4d0;+ --cloud-fill: rgba(170, 119, 49, 0.16);+ --cloud-stroke: #d8ad68;+ --security-fill: rgba(157, 69, 65, 0.17);+ --security-stroke: #df9085;+ --messagebus-fill: rgba(174, 79, 42, 0.16);+ --messagebus-stroke: #df946f;+ --external-fill: rgba(126, 115, 96, 0.18);+ --external-stroke: #b8ad99;+ --arrow: #948978;+ --arrow-emphasis: #dd6b3d;+ --toolbar-bg: rgba(35, 31, 24, 0.92);+ --toolbar-border: #625a4a;+ --toolbar-text: #eee5d5;+ --toolbar-hover: #302a20;+ --toolbar-menu-bg: #231f18;+ }++ [data-preset="editorial"][data-theme="light"] {+ --bg: #f2eee5;+ --grid: #d8d0c2;+ --panel: rgba(251, 248, 241, 0.97);+ --panel-border: #c4b9a6;+ --lane-fill: rgba(229, 221, 207, 0.42);+ --lane-stroke: #b8aa94;+ --text: #242018;+ --text-muted: #6f6658;+ --text-dim: #a09788;+ --text-faint: #817767;+ --mask: #fbf8f1;+ --frontend-fill: rgba(31, 117, 126, 0.09);+ --frontend-stroke: #287e84;+ --backend-fill: rgba(42, 119, 75, 0.09);+ --backend-stroke: #397b53;+ --database-fill: rgba(105, 75, 130, 0.09);+ --database-stroke: #765d86;+ --cloud-fill: rgba(157, 103, 31, 0.1);+ --cloud-stroke: #9a671f;+ --security-fill: rgba(153, 58, 52, 0.09);+ --security-stroke: #9e463f;+ --messagebus-fill: rgba(182, 70, 27, 0.09);+ --messagebus-stroke: #ad4b25;+ --external-fill: rgba(101, 91, 75, 0.09);+ --external-stroke: #746b5e;+ --arrow: #8a806f;+ --arrow-emphasis: #bb4c23;+ --toolbar-bg: rgba(251, 248, 241, 0.94);+ --toolbar-border: #c4b9a6;+ --toolbar-text: #40392f;+ --toolbar-hover: #fffdf8;+ --toolbar-menu-bg: #fbf8f1;+ }++ * { margin: 0; padding: 0; box-sizing: border-box; }++ body {+ font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace;+ background: var(--bg);+ min-height: 100vh;+ padding: 2rem;+ color: var(--text);+ transition: background 0.2s ease, color 0.2s ease;+ }++ html[data-preset="signal-flow"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(34, 211, 238, 0.14), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.12), transparent 30rem);+ background-attachment: fixed;+ }+ html[data-preset="signal-flow"][data-theme="light"] body {+ background-image:+ radial-gradient(circle at 18% -8%, rgba(6, 182, 212, 0.12), transparent 34rem),+ radial-gradient(circle at 92% 18%, rgba(139, 92, 246, 0.08), transparent 30rem);+ }+ html[data-preset="blueprint"] body {+ background-image:+ linear-gradient(var(--grid) 1px, transparent 1px),+ linear-gradient(90deg, var(--grid) 1px, transparent 1px);+ background-size: 32px 32px;+ background-position: -1px -1px;+ background-attachment: fixed;+ }+ html[data-preset="editorial"] body {+ background-image:+ linear-gradient(90deg, transparent 0, transparent 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) 5.4rem, color-mix(in srgb, var(--security-stroke) 18%, transparent) calc(5.4rem + 1px), transparent calc(5.4rem + 1px)),+ repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--grid) 36%, transparent) 31px, color-mix(in srgb, var(--grid) 36%, transparent) 32px);+ background-attachment: fixed;+ }++ /* Gallery/embed mode keeps the generated artifact as the source of truth+ while presenting only its diagram surface inside a proof card. */+ html[data-embed="true"] body {+ min-height: 0;+ padding: 0;+ overflow: hidden;+ background: var(--bg);+ background-image: none;+ }+ html[data-embed="true"] .toolbar,+ html[data-embed="true"] .header,+ html[data-embed="true"] .cards,+ html[data-embed="true"] .diagram-nav,+ html[data-embed="true"] .overview-map,+ html[data-embed="true"] .focus-chip,+ html[data-embed="true"] .route-probe,+ html[data-embed="true"] .semantic-lens,+ html[data-embed="true"] .diagram-guide,+ html[data-embed="true"] .node-finder,+ html[data-embed="true"] .guided-views { display: none !important; }+ html[data-embed="true"] .container { max-width: none; }+ html[data-embed="true"] .diagram-container {+ padding: 0.5rem;+ border: 0;+ border-radius: 0;+ box-shadow: none;+ }+ html[data-embed="true"] .diagram-container svg { min-width: 0; }++ /* Share Chapter Cue lives in the HTML viewer layer, not inside the SVG.+ It gives one-shot embeds a title, authored note, truthful stop order,+ and lifecycle state while canonical diagram geometry stays untouched. */+ .share-chapter-cue { display: none; }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ position: absolute;+ z-index: 18;+ top: 0.85rem;+ left: 50%;+ display: grid;+ grid-template-columns: auto minmax(9rem, 13.5rem) minmax(0, 1fr);+ align-items: center;+ gap: 0.45rem 0.85rem;+ width: min(52rem, calc(100% - 1.5rem));+ min-height: 3.35rem;+ padding: 0.55rem 0.75rem 0.65rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ border-radius: 0.75rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--frontend-fill) 52%, transparent), transparent 45%),+ color-mix(in srgb, var(--toolbar-menu-bg) 92%, transparent);+ color: var(--toolbar-text);+ box-shadow: 0 14px 42px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.045);+ backdrop-filter: blur(16px);+ pointer-events: none;+ animation: archify-share-cue-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ html[data-preset="blueprint"] .share-chapter-cue {+ border-radius: 0.2rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 46%, transparent), transparent 36%),+ var(--toolbar-menu-bg);+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);+ backdrop-filter: none;+ }+ html[data-preset="editorial"] .share-chapter-cue {+ border-color: var(--panel-border);+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 42%),+ var(--toolbar-menu-bg);+ box-shadow: 0 10px 30px color-mix(in srgb, #000 18%, transparent);+ backdrop-filter: none;+ }+ html[data-preset="editorial"] .share-chapter-state { color: var(--arrow-emphasis); }+ html[data-preset="editorial"] .share-chapter-state::before {+ border-radius: 0;+ box-shadow: none;+ transform: rotate(45deg) scale(0.8);+ }+ .share-chapter-index {+ display: grid;+ gap: 0.12rem;+ min-width: 5rem;+ padding-right: 0.75rem;+ border-right: 1px solid var(--toolbar-border);+ }+ .share-chapter-state {+ display: inline-flex;+ align-items: center;+ gap: 0.36rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ }+ .share-chapter-state::before {+ width: 0.38rem;+ height: 0.38rem;+ border-radius: 50%;+ background: currentColor;+ box-shadow: 0 0 10px currentColor;+ content: '';+ }+ .share-chapter-cue[data-state="playing"] .share-chapter-state::before {+ animation: archify-share-cue-pulse 1.15s ease-in-out infinite;+ }+ .share-chapter-count {+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 700;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .share-chapter-copy { min-width: 0; }+ .share-chapter-copy strong,+ .share-chapter-copy small,+ .share-chapter-route {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .share-chapter-copy strong {+ color: var(--toolbar-text);+ font-size: 0.6875rem;+ line-height: 1.35;+ }+ .share-chapter-copy small {+ margin-top: 0.08rem;+ color: var(--text-muted);+ font-size: 0.5rem;+ line-height: 1.35;+ }+ .share-chapter-route {+ color: color-mix(in srgb, var(--frontend-stroke) 76%, var(--text-muted));+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.015em;+ text-align: right;+ }+ .share-chapter-progress {+ position: absolute;+ right: 0;+ bottom: 0;+ left: 0;+ height: 2px;+ overflow: hidden;+ background: color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .share-chapter-progress span {+ display: block;+ width: 100%;+ height: 100%;+ background: linear-gradient(90deg, var(--frontend-stroke), var(--database-stroke));+ box-shadow: 0 0 12px var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }++ /* Presentation Stage is a viewer-only layer: it gives the live diagram+ the viewport while keeping guided views, theme, focus, and exports real.+ Embed mode wins when both query parameters are present. */+ html[data-present="true"]:not([data-embed="true"]) body {+ height: 100dvh;+ min-height: 0;+ padding: 1rem;+ overflow: hidden;+ }+ html[data-present="true"]:not([data-embed="true"]) .container {+ display: flex;+ flex-direction: column;+ gap: 0.75rem;+ width: 100%;+ max-width: none;+ height: calc(100dvh - 2rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ flex: none;+ min-width: 0;+ margin: 0;+ padding-right: 23rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row { margin-bottom: 0.25rem; }+ html[data-present="true"]:not([data-embed="true"]) .subtitle {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ flex: none;+ margin-bottom: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container {+ display: flex;+ flex: 1 1 auto;+ align-items: center;+ justify-content: center;+ min-height: 0;+ padding: 0.75rem;+ padding-bottom: calc(0.75rem + var(--archify-nav-reserve));+ }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .cards { display: none; }+ html[data-present="true"]:not([data-embed="true"]) #btn-present {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }++ /* The reader owns only the outer scale. Wide diagrams keep one authored+ SVG/viewBox while the runtime chooses a desktop width from the actual+ vertical budget. This avoids device-specific files and breakpoint+ jumps between a laptop and a tall monitor. */+ .container {+ width: 100%;+ max-width: var(--archify-reader-width, 1440px);+ margin: 0 auto;+ }+ @media (min-width: 768px) and (max-height: 920px) {+ .header { margin-bottom: 1rem; }+ .diagram-container { padding: 1rem; }+ .cards { margin-top: 1rem; }+ .card { padding: 1rem; }+ }++ .header { margin-bottom: 1.5rem; padding-right: 29.5rem; }++ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header,+ html[data-preset="editorial"] .header { padding-right: 29.5rem; }++ .header-row {+ display: flex;+ align-items: center;+ gap: 1rem;+ margin-bottom: 0.5rem;+ }++ .pulse-dot {+ width: 12px;+ height: 12px;+ background: var(--frontend-stroke);+ border-radius: 50%;+ animation: none;+ }++ html[data-motion-capable="true"] .pulse-dot { animation: pulse 2s infinite; }++ @keyframes pulse {+ 0%, 100% { opacity: 1; }+ 50% { opacity: 0.5; }+ }++ h1 {+ font-size: 1.5rem;+ font-weight: 700;+ letter-spacing: -0.025em;+ }++ .subtitle {+ color: var(--text-muted);+ font-size: 0.875rem;+ margin-left: 1.75rem;+ }++ html[data-preset="signal-flow"] .header-row::after {+ content: attr(data-preset-badge-signal-flow);+ margin-left: auto;+ color: var(--frontend-stroke);+ border: 1px solid var(--frontend-stroke);+ border-radius: 999px;+ padding: 0.28rem 0.6rem;+ font-size: 0.625rem;+ letter-spacing: 0.12em;+ opacity: 0.82;+ box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);+ white-space: nowrap;+ }++ html[data-preset="blueprint"] .pulse-dot {+ width: 10px;+ height: 10px;+ border: 1px solid var(--frontend-stroke);+ border-radius: 1px;+ background: transparent;+ box-shadow: inset 0 0 0 2px var(--bg);+ transform: rotate(45deg);+ animation: none;+ }+ html[data-preset="blueprint"] .header-row::after {+ content: attr(data-preset-badge-blueprint);+ margin-left: auto;+ padding: 0.28rem 0.55rem;+ border-top: 1px solid var(--frontend-stroke);+ border-bottom: 1px solid var(--frontend-stroke);+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.14em;+ white-space: nowrap;+ }++ html[data-preset="editorial"] h1,+ html[data-preset="editorial"] .card h3 {+ font-family: Georgia, 'Times New Roman', 'Songti SC', STSong, serif;+ letter-spacing: -0.02em;+ }+ html[data-preset="editorial"] h1 { font-size: 1.72rem; font-weight: 600; }+ html[data-preset="editorial"] .pulse-dot {+ width: 9px;+ height: 9px;+ border: 1px solid var(--arrow-emphasis);+ border-radius: 0;+ background: var(--arrow-emphasis);+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);+ transform: rotate(45deg);+ animation: none;+ }+ html[data-preset="editorial"] .header-row::after {+ content: attr(data-preset-badge-editorial);+ margin-left: auto;+ padding: 0.32rem 0 0.24rem;+ border-bottom: 2px solid var(--arrow-emphasis);+ color: var(--arrow-emphasis);+ font-family: Georgia, 'Times New Roman', serif;+ font-size: 0.625rem;+ font-style: italic;+ font-weight: 600;+ letter-spacing: 0.08em;+ white-space: nowrap;+ }++ .diagram-container {+ --archify-nav-reserve: 0px;+ background: var(--panel);+ border-radius: 1rem;+ border: 1px solid var(--panel-border);+ padding: 1.5rem;+ padding-bottom: calc(1.5rem + var(--archify-nav-reserve));+ overflow: hidden;+ position: relative;+ }++ html[data-preset="signal-flow"] .diagram-container {+ position: relative;+ overflow: hidden;+ background: linear-gradient(180deg, rgba(8, 20, 38, 0.82), rgba(3, 8, 18, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 28px 80px rgba(0, 0, 0, 0.34);+ }+ html[data-preset="signal-flow"][data-theme="light"] .diagram-container {+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(237, 246, 250, 0.94));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 24px 60px rgba(45, 78, 99, 0.12);+ }+ html[data-preset="blueprint"] .diagram-container {+ border-color: var(--panel-border);+ border-radius: 0.35rem;+ background: var(--panel);+ box-shadow:+ inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 34%, transparent),+ 0 18px 48px rgba(0, 0, 0, 0.16);+ }+ html[data-preset="blueprint"] .diagram-container::after {+ content: "";+ position: absolute;+ z-index: 10;+ inset: 0.7rem;+ pointer-events: none;+ background:+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right top / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) left bottom / 1px 1.35rem no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1.35rem 1px no-repeat,+ linear-gradient(var(--frontend-stroke), var(--frontend-stroke)) right bottom / 1px 1.35rem no-repeat;+ opacity: 0.58;+ }+ html[data-preset="editorial"] .diagram-container {+ overflow: hidden;+ border-color: var(--panel-border);+ border-radius: 0.38rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--security-fill) 58%, transparent), transparent 12%),+ var(--panel);+ box-shadow:+ 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent),+ 0 18px 48px color-mix(in srgb, #000 19%, transparent);+ }+ html[data-preset="editorial"] .diagram-container::after {+ position: absolute;+ z-index: 10;+ top: 0.72rem;+ right: 1.25rem;+ padding: 0.2rem 0.52rem;+ border: 1px solid var(--panel-border);+ background: var(--panel);+ color: var(--arrow-emphasis);+ content: attr(data-preset-badge-editorial-plate);+ font-family: Georgia, 'Times New Roman', serif;+ font-size: 0.52rem;+ font-style: italic;+ font-weight: 600;+ letter-spacing: 0.09em;+ pointer-events: none;+ }+ html[data-embed="true"][data-preset="editorial"] .diagram-container::after { display: none; }+ html[data-motion-capable="true"][data-preset="signal-flow"][data-ambient-motion="running"] .diagram-container::before {+ content: "";+ position: absolute;+ inset: 0;+ pointer-events: none;+ background: linear-gradient(115deg, transparent 28%, rgba(103, 232, 249, 0.035) 48%, transparent 68%);+ transform: translateX(-70%);+ animation: archify-signal-scan 4.8s ease-in-out 1 both;+ }++ /* Motion Governor gives the reader a real static state and gives the+ strongest semantic action the only motion budget. Atmosphere resets to+ its authored base instead of freezing mid-cycle. Static artifacts never+ start a decorative pulse or scan. */+ html:not([data-motion-capable="true"]) svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ }+ html[data-motion="still"] .pulse-dot,+ html[data-motion="still"] .diagram-container::before,+ html[data-motion="still"] svg[data-animation="trace"] [data-animate],+ html[data-motion-owner] .pulse-dot,+ html[data-motion-owner] .diagram-container::before,+ html[data-motion-owner] svg[data-animation="trace"] [data-animate],+ html[data-embed="true"] .pulse-dot,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .pulse-dot,+ html[data-share-playback="true"] .diagram-container::before,+ html[data-document-hidden="true"] .pulse-dot,+ html[data-document-hidden="true"] .diagram-container::before,+ html[data-document-hidden="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ }+ html[data-motion="still"] .diagram-container::before,+ html[data-motion-owner] .diagram-container::before,+ html[data-embed="true"] .diagram-container::before,+ html[data-share-playback="true"] .diagram-container::before {+ opacity: 0;+ }+ html[data-motion="still"] .guided-view-progress span,+ html[data-motion="still"] .guided-story-caption,+ html[data-motion="still"] .story-trail-flow,+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow,+ html[data-motion="still"] .route-journey-flow,+ html[data-motion="still"] .semantic-lens-flow,+ html[data-motion="still"] .diagram-guide,+ html[data-motion="still"] [data-story-step],+ html[data-motion="still"] .overview-map-live,+ html[data-motion="still"] .guided-view-stop,+ html[data-motion="still"] .share-chapter-cue,+ html[data-motion="still"] .share-chapter-state::before,+ html[data-motion="still"] .share-chapter-progress span,+ html[data-document-hidden="true"] .guided-view-progress span,+ html[data-document-hidden="true"] .story-trail-flow,+ html[data-document-hidden="true"] .intent-trace-flow,+ html[data-document-hidden="true"] .route-probe-flow,+ html[data-document-hidden="true"] .route-journey-flow,+ html[data-document-hidden="true"] .semantic-lens-flow,+ html[data-document-hidden="true"] .diagram-guide,+ html[data-document-hidden="true"] [data-story-step],+ html[data-document-hidden="true"] .overview-map-live,+ html[data-document-hidden="true"] .guided-view-stop,+ html[data-document-hidden="true"] .share-chapter-cue,+ html[data-document-hidden="true"] .share-chapter-state::before,+ html[data-document-hidden="true"] .share-chapter-progress span {+ animation: none !important;+ }+ html[data-motion="still"] .guided-view-progress span {+ transform: scaleX(1) !important;+ }+ html[data-motion="still"] svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ html[data-motion="still"] .intent-trace-flow,+ html[data-motion="still"] .route-probe-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ html[data-motion="still"] .route-journey-overlay,+ html[data-document-hidden="true"] .route-journey-overlay { display: none !important; }+ html[data-motion="still"] .relationship-pulse-overlay,+ html[data-motion="still"] .story-carrier-overlay,+ html[data-document-hidden="true"] .story-carrier-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-overlay { display: none !important; }+ html[data-motion="still"] .chapter-handoff-anchor { animation: none !important; }+ html[data-motion="still"] .guided-view-chapter,+ html[data-motion="still"] svg [data-node-id],+ html[data-motion="still"] svg [data-edge-from],+ html[data-motion="still"] svg [data-detail],+ html[data-motion="still"] svg [data-detail-anchor],+ html[data-motion="still"] svg [data-legend-hit],+ html[data-motion="still"] svg {+ transition: none !important;+ }++ svg {+ width: 100%;+ min-width: min(900px, 100%);+ display: block;+ transform-origin: 0 0;+ transition: transform 0.18s ease;+ }++ .diagram-container.is-camera-moving svg {+ transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);+ }+ .diagram-container.is-camera-transaction svg { transition: none; }+ .diagram-container.is-pannable { cursor: grab; }+ .diagram-container.is-panning { cursor: grabbing; user-select: none; }+ .diagram-container.is-panning svg { transition: none; }++ .diagram-nav {+ position: absolute;+ right: 1rem;+ bottom: 1rem;+ z-index: 12;+ display: inline-flex;+ align-items: center;+ max-width: calc(100% - 2rem);+ padding: 0.15rem;+ gap: 0;+ overflow-x: auto;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 48%, transparent);+ border-radius: 0.58rem;+ background: color-mix(in srgb, var(--toolbar-bg) 82%, transparent);+ box-shadow: 0 5px 14px rgba(0, 0, 0, 0.07);+ backdrop-filter: blur(10px);+ scrollbar-width: none;+ }+ .diagram-nav::-webkit-scrollbar { display: none; }+ .diagram-nav button,+ .focus-chip button,+ .guided-views button {+ border: 0;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ cursor: pointer;+ }+ .diagram-nav button {+ min-width: 2rem;+ height: 2rem;+ padding: 0 0.35rem;+ border-radius: 0.35rem;+ color: color-mix(in srgb, var(--toolbar-text) 68%, transparent);+ font-size: 0.56rem;+ font-weight: 600;+ letter-spacing: 0.02em;+ transition: background 0.15s, color 0.15s;+ }+ .diagram-nav button:hover,+ .diagram-nav button:focus-visible,+ .focus-chip button:hover,+ .focus-chip button:focus-visible,+ .guided-views button:hover,+ .guided-views button:focus-visible { background: var(--toolbar-hover); }+ .diagram-nav button:focus-visible,+ .focus-chip button:focus-visible,+ .guided-views button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .diagram-nav button:disabled { opacity: 0.38; cursor: default; }+ .diagram-nav button:disabled:hover { background: transparent; }+ .diagram-nav #btn-route-probe,+ .diagram-nav #btn-overview-map,+ .diagram-nav #btn-semantic-lens {+ min-width: auto;+ padding-inline: 0.5rem;+ color: color-mix(in srgb, var(--toolbar-text) 86%, transparent);+ font-weight: 650;+ }+ .diagram-nav #btn-node-finder,+ .diagram-nav [data-view="out"] {+ position: relative;+ margin-left: 0.25rem;+ }+ .diagram-nav #btn-node-finder::before,+ .diagram-nav [data-view="out"]::before {+ position: absolute;+ top: 0.4rem;+ bottom: 0.4rem;+ left: -0.13rem;+ width: 1px;+ background: color-mix(in srgb, var(--toolbar-border) 62%, transparent);+ content: "";+ pointer-events: none;+ }+ .diagram-nav-icon {+ display: block;+ width: 0.72rem;+ height: 0.72rem;+ margin: auto;+ background: currentColor;+ -webkit-mask-position: center;+ -webkit-mask-repeat: no-repeat;+ -webkit-mask-size: contain;+ mask-position: center;+ mask-repeat: no-repeat;+ mask-size: contain;+ }+ .diagram-nav-icon.find {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='4.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='m12 12 4 4' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='4.5' fill='none' stroke='black' stroke-width='1.8'/%3E%3Cpath d='m12 12 4 4' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ .diagram-nav-icon.guide {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='7' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M7.8 7.3a2.4 2.4 0 014.6.9c0 1.8-2.4 2-2.4 3.7M10 14.9h.01' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='7' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M7.8 7.3a2.4 2.4 0 014.6.9c0 1.8-2.4 2-2.4 3.7M10 14.9h.01' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ .diagram-nav-icon.minus {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ .diagram-nav-icon.plus {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 5v10M5 10h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 5v10M5 10h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ .diagram-nav [data-view="reset"] {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.2rem;+ min-width: 3.1rem;+ padding-inline: 0.35rem;+ }+ .diagram-nav [data-view="reset"][data-detail-visible] {+ min-width: 3.8rem;+ }+ .diagram-nav-detail {+ color: color-mix(in srgb, var(--toolbar-text) 52%, transparent);+ font-size: 0.44rem;+ font-weight: 700;+ line-height: 1;+ letter-spacing: 0.07em;+ }+ .diagram-nav-percent {+ color: color-mix(in srgb, var(--toolbar-text) 84%, transparent);+ font-size: 0.55rem;+ font-weight: 650;+ line-height: 1;+ }+ .diagram-container[data-camera-indicator="true"] .diagram-nav-detail,+ .diagram-container[data-camera-indicator="true"] .diagram-nav-percent { color: var(--frontend-stroke); }+ .diagram-nav #btn-diagram-guide[aria-expanded="true"] {+ color: var(--cloud-stroke);+ background: var(--toolbar-hover);+ }++ /* Semantic Radar is a deliberately simplified, viewer-only overview. It+ uses authored node bounds and the live camera viewport rather than+ cloning the canonical SVG, so IDs, filters, animation, and export state+ stay singular and deterministic. */+ .overview-map {+ position: absolute;+ right: 1rem;+ bottom: calc(4.15rem + var(--archify-nav-reserve));+ z-index: 12;+ width: 11.25rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ border-radius: 0.78rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.625rem;+ }+ .overview-map[hidden] { display: none; }+ .overview-map[data-docked="true"] {+ position: fixed;+ right: var(--archify-radar-right, 1rem);+ top: var(--archify-radar-top, 1rem);+ bottom: auto;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: var(--archify-radar-left, 1rem);+ }+ html[data-preset="blueprint"] .overview-map { border-radius: 0.28rem; }+ .overview-map-head {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.45rem;+ min-height: 2.25rem;+ padding: 0.42rem 0.48rem 0.38rem 0.55rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(110deg, color-mix(in srgb, var(--frontend-fill) 45%, transparent), transparent 68%);+ cursor: grab;+ touch-action: none;+ user-select: none;+ }+ .overview-map[data-panel-dragging="true"] .overview-map-head { cursor: grabbing; }+ .overview-map[data-placement-invalid="true"] {+ border-color: var(--security-stroke);+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--security-stroke) 34%, transparent), 0 16px 42px rgba(0, 0, 0, 0.3);+ }+ .overview-map[data-compact="true"] {+ width: 7.4rem;+ }+ .overview-map[data-compact="true"] .overview-map-head {+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.24rem;+ min-height: 1.5rem;+ padding: 0.05rem 0.16rem 0.05rem 0.32rem;+ border-bottom: 0;+ }+ .overview-map[data-compact="true"] .overview-map-live,+ .overview-map[data-compact="true"] .overview-map-copy,+ .overview-map[data-compact="true"] .overview-map-surface,+ .overview-map[data-compact="true"] .overview-map-hint {+ display: none;+ }+ .overview-map[data-compact="true"] .overview-map-expand { display: inline-flex; }+ .overview-map[data-compact="true"] .overview-map-close {+ width: 1.15rem;+ height: 1.15rem;+ font-size: 0.72rem;+ }+ .overview-map-live {+ width: 0.42rem;+ height: 0.42rem;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent);+ animation: archify-radar-live 2.4s ease-out infinite;+ }+ .overview-map-copy { min-width: 0; line-height: 1.1; }+ .overview-map-copy strong {+ display: block;+ overflow: hidden;+ color: var(--frontend-stroke);+ font-size: 0.59rem;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-copy small {+ display: block;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.52rem;+ letter-spacing: 0.04em;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .overview-map-expand {+ display: none;+ align-items: center;+ justify-content: center;+ min-width: 0;+ height: 1.2rem;+ padding: 0 0.34rem;+ overflow: hidden;+ border: 0;+ border-radius: 0.3rem;+ background: transparent;+ color: var(--frontend-stroke);+ font: inherit;+ font-size: 0.49rem;+ font-weight: 700;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ white-space: nowrap;+ cursor: pointer;+ }+ .overview-map-close {+ width: 1.55rem;+ height: 1.55rem;+ padding: 0;+ border: 0;+ border-radius: 0.34rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.9rem;+ cursor: pointer;+ }+ .overview-map-expand:hover,+ .overview-map-expand:focus-visible,+ .overview-map-close:hover,+ .overview-map-close:focus-visible { background: var(--toolbar-hover); }+ .overview-map-expand:focus-visible,+ .overview-map-close:focus-visible,+ .overview-map-surface:focus-visible,+ .overview-map-node:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .overview-map-surface {+ position: relative;+ height: 7rem;+ margin: 0.42rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--panel-border) 72%, transparent);+ border-radius: 0.42rem;+ background:+ linear-gradient(color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ linear-gradient(90deg, color-mix(in srgb, var(--panel-border) 26%, transparent) 1px, transparent 1px),+ color-mix(in srgb, var(--bg) 86%, transparent);+ background-size: 12px 12px;+ cursor: crosshair;+ touch-action: none;+ }+ html[data-preset="blueprint"] .overview-map-surface { border-radius: 0.1rem; }+ .overview-map-surface > svg {+ width: 100%;+ height: 100%;+ min-width: 0;+ transform: none !important;+ transition: none !important;+ display: block;+ overflow: visible;+ }+ .overview-map-node {+ fill: var(--backend-stroke);+ fill-opacity: 0.52;+ stroke: var(--backend-stroke);+ stroke-opacity: 0.86;+ vector-effect: non-scaling-stroke;+ cursor: pointer;+ transition: fill-opacity 140ms ease, stroke-width 140ms ease, filter 140ms ease;+ }+ .overview-map-node[data-kind="frontend"],+ .overview-map-node[data-kind="start"] { fill: var(--frontend-stroke); stroke: var(--frontend-stroke); }+ .overview-map-node[data-kind="database"],+ .overview-map-node[data-kind="success"] { fill: var(--database-stroke); stroke: var(--database-stroke); }+ .overview-map-node[data-kind="cloud"],+ .overview-map-node[data-kind="waiting"] { fill: var(--cloud-stroke); stroke: var(--cloud-stroke); }+ .overview-map-node[data-kind="messagebus"] { fill: var(--messagebus-stroke); stroke: var(--messagebus-stroke); }+ .overview-map-node[data-kind="security"],+ .overview-map-node[data-kind="decision"],+ .overview-map-node[data-kind="failure"] { fill: var(--security-stroke); stroke: var(--security-stroke); }+ .overview-map-node[data-kind="external"],+ .overview-map-node[data-kind="neutral"] { fill: var(--external-stroke); stroke: var(--external-stroke); }+ .overview-map-node[data-radar-active="true"],+ .overview-map-node:hover,+ .overview-map-node:focus-visible {+ fill-opacity: 0.92;+ stroke-width: 2.2;+ filter: drop-shadow(0 0 3px currentColor);+ }+ .overview-map-viewport {+ fill: color-mix(in srgb, var(--frontend-fill) 56%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ filter: drop-shadow(0 0 3px color-mix(in srgb, var(--frontend-stroke) 54%, transparent));+ }+ .overview-map-hint {+ display: flex;+ justify-content: space-between;+ gap: 0.5rem;+ padding: 0 0.52rem 0.46rem;+ color: var(--text-faint);+ font-size: 0.49rem;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ }+ .diagram-nav #btn-overview-map[aria-expanded="true"] {+ color: var(--frontend-stroke);+ background: var(--toolbar-hover);+ }+ .overview-map-feedback {+ position: absolute;+ right: 1rem;+ bottom: 4.15rem;+ z-index: 13;+ max-width: min(16rem, calc(100% - 2rem));+ padding: 0.38rem 0.55rem;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ border-radius: 0.5rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);+ font-size: 0.52rem;+ line-height: 1.35;+ pointer-events: none;+ }+ .overview-map-feedback[hidden] { display: none; }+ .focus-chip[data-radar-yielded="true"] { display: none !important; }+ .diagram-nav #btn-route-probe[aria-pressed="true"] {+ color: var(--backend-stroke);+ background: var(--toolbar-hover);+ }+ .diagram-nav #btn-semantic-lens[aria-expanded="true"],+ .diagram-nav #btn-semantic-lens[aria-pressed="true"] {+ color: var(--database-stroke);+ background: var(--toolbar-hover);+ }++ /* Semantic Lens turns the compiled node-kind palette into an analytical+ legend. One kind reveals its real traffic; two kinds compare only their+ direct authored relationships. Geometry and the canonical SVG stay put. */+ .semantic-lens {+ position: absolute;+ right: 1rem;+ bottom: calc(4.15rem + var(--archify-nav-reserve));+ z-index: 24;+ width: min(20rem, calc(100% - 2rem));+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--database-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--database-fill) 34%, transparent), transparent 48%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);+ backdrop-filter: blur(18px);+ animation: archify-lens-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .semantic-lens[hidden] { display: none; }+ .semantic-lens[data-dock-side="left"] { left: 1rem; right: auto; }+ .semantic-lens[data-dock-side="right"] { left: auto; right: 1rem; }+ html[data-preset="blueprint"] .semantic-lens { border-radius: 0.28rem; }+ .semantic-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.72rem 0.78rem 0.62rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .semantic-lens-eyebrow {+ display: block;+ color: var(--database-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .semantic-lens-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.82rem;+ letter-spacing: -0.02em;+ }+ .semantic-lens-close {+ width: 1.75rem;+ height: 1.75rem;+ padding: 0;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .semantic-lens-close:hover,+ .semantic-lens-close:focus-visible { background: var(--toolbar-hover); }+ .semantic-lens-instruction {+ margin: 0;+ padding: 0.52rem 0.78rem 0.48rem;+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-kinds {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.3rem;+ max-height: min(15rem, 40vh);+ padding: 0 0.5rem 0.5rem;+ overflow-y: auto;+ scrollbar-width: thin;+ }+ .semantic-lens-kind {+ --lens-color: var(--external-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.42rem;+ min-width: 0;+ min-height: 2.15rem;+ padding: 0.35rem 0.42rem;+ border: 1px solid color-mix(in srgb, var(--lens-color) 24%, var(--toolbar-border));+ border-radius: 0.45rem;+ background: color-mix(in srgb, var(--panel) 76%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, opacity 140ms ease;+ }+ html[data-preset="blueprint"] .semantic-lens-kind { border-radius: 0.12rem; }+ .semantic-lens-kind[data-kind="frontend"],+ .semantic-lens-kind[data-kind="start"] { --lens-color: var(--frontend-stroke); }+ .semantic-lens-kind[data-kind="backend"],+ .semantic-lens-kind[data-kind="active"] { --lens-color: var(--backend-stroke); }+ .semantic-lens-kind[data-kind="database"],+ .semantic-lens-kind[data-kind="success"] { --lens-color: var(--database-stroke); }+ .semantic-lens-kind[data-kind="cloud"],+ .semantic-lens-kind[data-kind="waiting"] { --lens-color: var(--cloud-stroke); }+ .semantic-lens-kind[data-kind="messagebus"] { --lens-color: var(--messagebus-stroke); }+ .semantic-lens-kind[data-kind="security"],+ .semantic-lens-kind[data-kind="decision"],+ .semantic-lens-kind[data-kind="failure"] { --lens-color: var(--security-stroke); }+ .semantic-lens-kind:hover,+ .semantic-lens-kind:focus-visible,+ .semantic-lens-kind[aria-pressed="true"] {+ border-color: color-mix(in srgb, var(--lens-color) 78%, var(--toolbar-border));+ background: color-mix(in srgb, var(--lens-color) 11%, var(--panel));+ }+ .semantic-lens-kind:focus-visible,+ .semantic-lens-close:focus-visible,+ .semantic-lens-actions button:focus-visible {+ outline: 2px solid var(--database-stroke);+ outline-offset: 1px;+ }+ .semantic-lens-kind:disabled { opacity: 0.34; cursor: default; }+ .semantic-lens-swatch {+ width: 0.48rem;+ height: 0.48rem;+ border-radius: 50%;+ background: var(--lens-color);+ box-shadow: 0 0 8px color-mix(in srgb, var(--lens-color) 58%, transparent);+ }+ .semantic-lens-kind strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.61rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-lens-kind em {+ color: var(--lens-color);+ font-size: 0.54rem;+ font-style: normal;+ font-weight: 800;+ }+ .semantic-lens-status {+ min-height: 2.5rem;+ margin: 0;+ padding: 0.55rem 0.78rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.55rem;+ line-height: 1.45;+ }+ .semantic-lens-status strong { color: var(--database-stroke); font-weight: 800; }+ .semantic-lens-actions {+ display: flex;+ justify-content: flex-end;+ gap: 0.28rem;+ padding: 0 0.62rem 0.62rem;+ }+ .semantic-lens-actions button {+ min-height: 1.8rem;+ padding: 0.28rem 0.48rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 0.56rem;+ cursor: pointer;+ }+ .semantic-lens-actions button:hover { background: var(--toolbar-hover); }+ .semantic-lens-actions #semantic-lens-copy { color: var(--database-stroke); }+ @keyframes archify-lens-in {+ from { opacity: 0; transform: translateY(5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }++ /* Route Probe answers a reader question over the compiled semantic graph:+ choose two stable nodes and reveal the shortest authored directed route.+ The receipt and signal live entirely in the viewer layer. */+ .route-probe {+ position: absolute;+ left: 1rem;+ bottom: calc(1rem + var(--archify-nav-reserve));+ z-index: 12;+ width: min(46rem, calc(100% - 25rem));+ min-width: 18rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 62%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(115deg, color-mix(in srgb, var(--backend-fill) 50%, transparent), transparent 62%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.625rem;+ }+ .route-probe[hidden] { display: none; }+ .route-probe[data-route-dock="top"] {+ top: 1rem;+ bottom: auto;+ }+ html[data-preset="blueprint"] .route-probe { border-radius: 0.25rem; }+ .route-probe-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.65rem;+ padding: 0.52rem 0.58rem 0.44rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 80%, transparent);+ }+ .route-probe-copy { min-width: 0; }+ .route-probe-eyebrow {+ display: block;+ color: var(--backend-stroke);+ font-size: 0.48rem;+ font-weight: 800;+ letter-spacing: 0.15em;+ text-transform: uppercase;+ }+ .route-probe-title {+ display: block;+ margin-top: 0.14rem;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.72rem;+ line-height: 1.25;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .route-probe-actions { display: flex; gap: 0.2rem; }+ .route-probe button {+ min-height: 1.55rem;+ padding: 0.25rem 0.42rem;+ border: 0;+ border-radius: 0.36rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ cursor: pointer;+ }+ .route-probe button:hover,+ .route-probe button:focus-visible { background: var(--toolbar-hover); }+ .route-probe button:focus-visible {+ outline: 2px solid var(--backend-stroke);+ outline-offset: 1px;+ }+ .route-probe-copy-link { color: var(--frontend-stroke) !important; }+ .route-probe-find { color: var(--backend-stroke) !important; }+ .route-probe-copy-link[hidden] { display: none; }+ .route-probe-find[hidden] { display: none; }+ .route-probe-path {+ display: flex;+ align-items: center;+ min-height: 2.2rem;+ padding: 0.42rem 0.58rem 0.24rem;+ overflow-x: auto;+ scrollbar-width: thin;+ white-space: nowrap;+ }+ .route-probe-node,+ .route-probe button.route-probe-node {+ flex: none;+ max-width: 9.5rem;+ overflow: hidden;+ min-height: 1.75rem !important;+ padding: 0.22rem 0.38rem;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 46%, var(--toolbar-border));+ border-radius: 999px;+ background: color-mix(in srgb, var(--backend-fill) 52%, transparent);+ color: var(--text);+ font-size: 0.56rem;+ font-weight: 700;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .route-probe-node[data-endpoint="start"] {+ border-color: var(--frontend-stroke);+ color: var(--frontend-stroke);+ }+ .route-probe-node[data-endpoint="end"] {+ border-color: var(--security-stroke);+ color: var(--security-stroke);+ }+ .route-probe-node[data-route-journey-state="past"] { opacity: 0.66; }+ .route-probe-node[data-route-journey-state="future"] { opacity: 0.48; }+ .route-probe-node[aria-current="step"] {+ border-color: var(--backend-stroke);+ background: color-mix(in srgb, var(--backend-fill) 82%, var(--toolbar-menu-bg));+ color: var(--text);+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--backend-stroke) 42%, transparent), 0 0 14px color-mix(in srgb, var(--backend-stroke) 34%, transparent);+ opacity: 1;+ }+ html[data-preset="blueprint"] .route-probe-node[aria-current="step"] {+ border-style: double;+ border-width: 3px;+ border-radius: 0.2rem;+ box-shadow: none;+ }+ .route-probe-arrow {+ flex: none;+ padding: 0 0.28rem;+ color: var(--text-faint);+ font-size: 0.65rem;+ }+ .route-probe-placeholder {+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.03em;+ }+ .route-probe-status {+ display: block;+ min-height: 1.45rem;+ padding: 0.08rem 0.58rem 0.44rem;+ color: var(--text-faint);+ font-size: 0.52rem;+ line-height: 1.35;+ }+ .route-journey-controls {+ display: grid;+ grid-template-columns: 2rem minmax(5.8rem, auto) 2rem minmax(4.8rem, auto);+ justify-content: start;+ gap: 0.22rem;+ padding: 0.08rem 0.58rem 0.28rem;+ }+ .route-journey-controls[hidden] { display: none; }+ .route-journey-controls button {+ min-height: 1.8rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);+ background: color-mix(in srgb, var(--toolbar-bg) 72%, transparent);+ font-size: 0.54rem;+ font-weight: 700;+ }+ .route-journey-controls button:disabled {+ cursor: default;+ opacity: 0.34;+ }+ .route-journey-play { color: var(--backend-stroke) !important; }+ .route-journey-overview { color: var(--frontend-stroke) !important; }+ .route-journey-controls[data-playing="true"] .route-journey-play {+ border-color: color-mix(in srgb, var(--backend-stroke) 64%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 62%, transparent);+ }+ .route-probe[data-state="error"] {+ border-color: color-mix(in srgb, var(--security-stroke) 72%, var(--toolbar-border));+ }+ .route-probe[data-state="error"] .route-probe-status { color: var(--security-stroke); }++ .focus-chip {+ position: absolute;+ left: 1rem;+ top: 1rem;+ z-index: 12;+ display: block;+ width: min(22rem, calc(100% - 13rem));+ max-width: calc(100% - 13rem);+ overflow: hidden;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);+ backdrop-filter: blur(16px);+ font-size: 0.6875rem;+ }+ .focus-chip[hidden] { display: none; }+ html[data-preset="blueprint"] .focus-chip { border-radius: 0.3rem; }+ .focus-chip button {+ flex: none;+ padding: 0.3rem 0.45rem;+ border-radius: 0.35rem;+ font-size: 0.625rem;+ }+ .relationship-lens-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 0.75rem;+ padding: 0.7rem 0.75rem 0.65rem;+ border-bottom: 1px solid var(--toolbar-border);+ background: linear-gradient(120deg, color-mix(in srgb, var(--frontend-fill) 34%, transparent), transparent 72%);+ }+ .relationship-lens-copy { min-width: 0; }+ .relationship-lens-actions {+ display: flex;+ flex-direction: column;+ align-items: flex-end;+ gap: 0.18rem;+ }+ .relationship-lens-actions button { white-space: nowrap; }+ .relationship-lens-actions #btn-focus-clear {+ display: grid;+ width: 1.75rem;+ height: 1.75rem;+ padding: 0;+ place-items: center;+ color: var(--text-muted);+ font-size: 1rem;+ line-height: 1;+ }+ .relationship-lens-actions #btn-focus-clear:hover,+ .relationship-lens-actions #btn-focus-clear:focus-visible {+ background: var(--toolbar-hover);+ color: var(--text);+ }+ .relationship-lens-actions #btn-focus-copy { color: var(--frontend-stroke); }+ .relationship-lens-actions #btn-focus-relations { display: none; }+ .relationship-lens-eyebrow {+ display: block;+ margin-bottom: 0.18rem;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.14em;+ text-transform: uppercase;+ }+ .relationship-lens-title {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.8rem;+ line-height: 1.35;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail {+ display: block;+ margin-top: 0.12rem;+ overflow: hidden;+ color: var(--text-muted);+ font-size: 0.625rem;+ line-height: 1.4;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-detail[hidden] { display: none; }+ .semantic-passport-meta {+ display: flex;+ flex-wrap: wrap;+ gap: 0.24rem;+ margin-top: 0.42rem;+ }+ .semantic-passport-meta span,+ .semantic-passport-meta code {+ max-width: 100%;+ overflow: hidden;+ padding: 0.14rem 0.34rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 82%, transparent);+ border-radius: 999px;+ background: color-mix(in srgb, var(--panel) 68%, transparent);+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ letter-spacing: 0.04em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-meta [data-passport="kind"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 50%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-weight: 800;+ text-transform: uppercase;+ }+ .semantic-passport-meta [data-passport="tag"] { color: var(--cloud-stroke); }+ .semantic-passport-meta [data-passport="brand"] {+ border-color: color-mix(in srgb, var(--messagebus-stroke) 52%, var(--toolbar-border));+ color: var(--messagebus-stroke);+ font-weight: 700;+ }+ .semantic-passport-meta [hidden] { display: none; }+ html[data-preset="blueprint"] .semantic-passport-meta span,+ html[data-preset="blueprint"] .semantic-passport-meta code { border-radius: 0.1rem; }+ .semantic-passport-evidence {+ margin-top: 0.52rem;+ padding: 0.5rem;+ border: 1px solid color-mix(in srgb, var(--backend-stroke) 32%, var(--toolbar-border));+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--backend-fill) 18%, var(--panel));+ }+ .semantic-passport-evidence[hidden] { display: none; }+ html[data-preset="blueprint"] .semantic-passport-evidence { border-radius: 0.18rem; }+ .semantic-passport-evidence-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 0.55rem;+ margin-bottom: 0.35rem;+ }+ .semantic-passport-evidence-status {+ display: inline-flex;+ align-items: center;+ gap: 0.28rem;+ color: var(--backend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .semantic-passport-evidence-status::before {+ content: '';+ width: 0.38rem;+ height: 0.38rem;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--backend-stroke) 14%, transparent);+ }+ .semantic-passport-repository {+ min-width: 0;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ text-decoration: none;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-repository:hover,+ .semantic-passport-repository:focus-visible { color: var(--backend-stroke); }+ .semantic-passport-evidence-links { display: grid; gap: 0.22rem; }+ .semantic-passport-source {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.15rem 0.45rem;+ align-items: center;+ padding: 0.34rem 0.4rem;+ border: 1px solid transparent;+ border-radius: 0.38rem;+ color: var(--text-muted);+ text-decoration: none;+ }+ .semantic-passport-source:hover,+ .semantic-passport-source:focus-visible {+ border-color: color-mix(in srgb, var(--backend-stroke) 42%, transparent);+ background: color-mix(in srgb, var(--backend-fill) 32%, transparent);+ color: var(--text);+ }+ .semantic-passport-source strong {+ overflow: hidden;+ font-size: 0.5625rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .semantic-passport-source code {+ color: var(--backend-stroke);+ font: inherit;+ font-size: 0.5rem;+ }+ .semantic-passport-source small {+ grid-column: 1 / -1;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-summary {+ display: block;+ margin-top: 0.12rem;+ color: var(--text-faint);+ font-size: 0.5625rem;+ }+ .semantic-passport-reach {+ display: grid;+ gap: 0.28rem;+ margin-top: 0.52rem;+ padding-top: 0.48rem;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 76%, transparent);+ }+ .semantic-passport-reach[hidden] { display: none; }+ .semantic-passport-reach-label {+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.1em;+ text-transform: uppercase;+ }+ .semantic-passport-reach-actions {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 0.25rem;+ }+ .semantic-passport-reach-actions button {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 0.5rem;+ min-width: 0;+ min-height: 2rem;+ padding: 0.32rem 0.42rem;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent);+ background: color-mix(in srgb, var(--panel) 70%, transparent);+ color: var(--text-muted);+ text-align: left;+ }+ .semantic-passport-reach-actions button:hover:not(:disabled),+ .semantic-passport-reach-actions button:focus-visible {+ border-color: color-mix(in srgb, var(--frontend-stroke) 62%, var(--toolbar-border));+ color: var(--text);+ }+ .semantic-passport-reach-actions button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .semantic-passport-reach-actions button:disabled {+ cursor: default;+ opacity: 0.5;+ }+ .semantic-passport-reach-actions button[aria-pressed="true"] {+ border-color: color-mix(in srgb, var(--reach-color, var(--frontend-stroke)) 72%, var(--toolbar-border));+ background: color-mix(in srgb, var(--reach-fill, var(--frontend-fill)) 48%, transparent);+ color: var(--text);+ }+ #btn-reach-upstream {+ --reach-color: var(--database-stroke);+ --reach-fill: var(--database-fill);+ }+ #btn-reach-downstream {+ --reach-color: var(--backend-stroke);+ --reach-fill: var(--backend-fill);+ }+ .semantic-passport-reach-actions strong {+ color: var(--reach-color, var(--frontend-stroke));+ font-size: 0.625rem;+ }+ .semantic-passport-reach-status {+ color: var(--text-faint);+ font-size: 0.525rem;+ line-height: 1.4;+ }+ .semantic-passport-reach-status[hidden] { display: none; }+ .relationship-lens-list {+ max-height: min(18rem, 46vh);+ overflow: auto;+ padding: 0.4rem;+ scrollbar-width: thin;+ scrollbar-color: var(--frontend-stroke) transparent;+ }+ .relationship-lens-list::-webkit-scrollbar { width: 4px; }+ .relationship-lens-list::-webkit-scrollbar-thumb {+ border-radius: 999px;+ background: color-mix(in srgb, var(--frontend-stroke) 68%, transparent);+ }+ .relationship-lens-group + .relationship-lens-group { margin-top: 0.35rem; }+ .relationship-lens-group-title {+ display: block;+ padding: 0.24rem 0.38rem 0.16rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .relationship-lens-row {+ display: grid;+ grid-template-columns: 2.1rem minmax(0, 1fr);+ gap: 0.06rem 0.45rem;+ width: 100%;+ padding: 0.45rem 0.5rem !important;+ text-align: left;+ }+ .relationship-lens-row:hover,+ .relationship-lens-row:focus-visible,+ .relationship-lens-row[data-preview-active="true"] {+ background: var(--toolbar-hover);+ box-shadow: inset 2px 0 0 var(--frontend-stroke);+ }+ .relationship-lens-row:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .relationship-lens-direction {+ grid-row: 1 / 3;+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ }+ .relationship-lens-row[data-direction="in"] .relationship-lens-direction { color: var(--database-stroke); }+ .relationship-lens-row[data-direction="loop"] .relationship-lens-direction { color: var(--security-stroke); }+ .relationship-lens-row strong {+ overflow: hidden;+ color: var(--text);+ font-size: 0.6875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-row small {+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .relationship-lens-empty {+ margin: 0;+ padding: 0.75rem;+ color: var(--text-faint);+ font-size: 0.625rem;+ text-align: center;+ }++ /* Diagram Guide keeps the artifact's growing reader vocabulary+ discoverable without widening the permanent control bar. It derives+ honest counts at runtime and delegates every action to an existing+ production interaction instead of creating a second command system. */+ .diagram-guide {+ position: absolute;+ top: 1rem;+ right: 1rem;+ z-index: 26;+ width: min(32rem, calc(100% - 2rem));+ max-height: min(42rem, calc(100% - 2rem));+ overflow: auto;+ border: 1px solid color-mix(in srgb, var(--cloud-stroke) 58%, var(--toolbar-border));+ border-radius: 0.82rem;+ background:+ linear-gradient(135deg, color-mix(in srgb, var(--cloud-fill) 32%, transparent), transparent 42%),+ var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 22px 64px rgba(0, 0, 0, 0.4);+ backdrop-filter: blur(18px);+ animation: archify-guide-in 180ms cubic-bezier(0.22, 1, 0.36, 1);+ }+ .diagram-guide[hidden] { display: none; }+ html[data-preset="blueprint"] .diagram-guide { border-radius: 0.28rem; }+ .diagram-guide-head {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: start;+ gap: 1rem;+ padding: 0.82rem 0.9rem 0.68rem;+ border-bottom: 1px solid var(--toolbar-border);+ }+ .diagram-guide-eyebrow {+ display: block;+ color: var(--cloud-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.16em;+ text-transform: uppercase;+ }+ .diagram-guide-title {+ display: block;+ margin-top: 0.16rem;+ color: var(--text);+ font-size: 0.86rem;+ letter-spacing: -0.02em;+ }+ .diagram-guide-close {+ width: 1.8rem;+ height: 1.8rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .diagram-guide-close:hover,+ .diagram-guide-close:focus-visible { background: var(--toolbar-hover); }+ .diagram-guide-stats {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin: 0;+ padding: 0.54rem 0.9rem;+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 74%, transparent);+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.025em;+ }+ .diagram-guide-stats::before {+ content: '';+ width: 0.42rem;+ height: 0.42rem;+ flex: none;+ border-radius: 50%;+ background: var(--backend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--backend-stroke) 72%, transparent);+ }+ .diagram-guide-actions {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.38rem;+ padding: 0.62rem;+ }+ .diagram-guide-action {+ --guide-accent: var(--frontend-stroke);+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ min-height: 4.15rem;+ padding: 0.55rem 0.58rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 22%, var(--toolbar-border));+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ color: var(--toolbar-text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;+ }+ .diagram-guide-action[data-guide-action="route"] { --guide-accent: var(--backend-stroke); }+ .diagram-guide-action[data-guide-action="map"] { --guide-accent: var(--database-stroke); }+ .diagram-guide-action[data-guide-action="lens"] { --guide-accent: var(--messagebus-stroke); }+ .diagram-guide-action[data-guide-action="story"] { --guide-accent: var(--security-stroke); }+ .diagram-guide-action[data-guide-action="present"] {+ --guide-accent: var(--cloud-stroke);+ }+ .diagram-guide-action:hover,+ .diagram-guide-action:focus-visible {+ border-color: color-mix(in srgb, var(--guide-accent) 76%, var(--toolbar-border));+ background: color-mix(in srgb, var(--guide-accent) 9%, var(--panel));+ transform: translateY(-1px);+ }+ .diagram-guide-action:focus-visible,+ .diagram-guide-close:focus-visible {+ outline: 2px solid var(--cloud-stroke);+ outline-offset: 1px;+ }+ .diagram-guide-action:disabled {+ opacity: 0.42;+ cursor: default;+ transform: none;+ }+ .diagram-guide-index {+ display: grid;+ place-items: center;+ width: 1.65rem;+ height: 1.65rem;+ border: 1px solid color-mix(in srgb, var(--guide-accent) 64%, var(--toolbar-border));+ border-radius: 0.35rem;+ color: var(--guide-accent);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.06em;+ }+ .diagram-guide-action-copy { min-width: 0; }+ .diagram-guide-action strong {+ display: block;+ overflow: hidden;+ color: var(--text);+ font-size: 0.66rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-action small {+ display: -webkit-box;+ margin-top: 0.18rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5rem;+ line-height: 1.35;+ -webkit-box-orient: vertical;+ -webkit-line-clamp: 2;+ }+ .diagram-guide kbd {+ align-self: start;+ min-width: 1.45rem;+ padding: 0.12rem 0.3rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5rem;+ text-align: center;+ }+ .diagram-guide-shortcuts {+ display: flex;+ flex-wrap: wrap;+ gap: 0.34rem 0.62rem;+ padding: 0.58rem 0.9rem 0.68rem;+ border-top: 1px solid var(--toolbar-border);+ color: var(--text-faint);+ font-size: 0.5rem;+ }+ .diagram-guide-shortcuts span {+ display: inline-flex;+ align-items: center;+ gap: 0.28rem;+ white-space: nowrap;+ }+ .diagram-guide-feedback {+ min-height: 1rem;+ margin: -0.18rem 0.9rem 0.62rem;+ color: var(--security-stroke);+ font-size: 0.5rem;+ }+ .diagram-guide-feedback:empty { display: none; }+ @keyframes archify-guide-in {+ from { opacity: 0; transform: translateY(-5px) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }++ .node-finder {+ position: absolute;+ top: 1rem;+ left: 1rem;+ z-index: 24;+ display: flex;+ flex-direction: column;+ width: min(22rem, calc(100% - 2rem));+ max-height: calc(100% - 2rem);+ overflow: hidden;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-menu-bg);+ color: var(--toolbar-text);+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.22);+ backdrop-filter: blur(16px);+ }+ .node-finder[hidden] { display: none; }+ .node-finder[data-context="route-source"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 68%, var(--toolbar-border));+ }+ .node-finder[data-context="route-target"] {+ border-color: color-mix(in srgb, var(--security-stroke) 68%, var(--toolbar-border));+ }+ html[data-preset="blueprint"] .node-finder { border-radius: 0.3rem; }+ .node-finder-head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.7rem 0.8rem 0.45rem;+ }+ .node-finder-head strong {+ color: var(--text);+ font-size: 0.6875rem;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-source"] .node-finder-head strong { color: var(--frontend-stroke); }+ .node-finder[data-context="route-target"] .node-finder-head strong { color: var(--security-stroke); }+ .node-finder-close {+ width: 1.75rem;+ height: 1.75rem;+ border: 0;+ border-radius: 0.35rem;+ background: transparent;+ color: var(--toolbar-text);+ font: inherit;+ font-size: 1rem;+ cursor: pointer;+ }+ .node-finder-close:hover,+ .node-finder-close:focus-visible { background: var(--toolbar-hover); }+ .node-finder-close:focus-visible,+ .node-finder-result:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: -2px;+ }+ .node-finder-search {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ align-items: center;+ gap: 0.55rem;+ margin: 0 0.55rem 0.55rem;+ padding: 0 0.7rem;+ min-height: 2.6rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 78%, transparent);+ transition: border-color 160ms ease-out, box-shadow 160ms ease-out;+ }+ html[data-preset="blueprint"] .node-finder-search { border-radius: 0.18rem; }+ .node-finder-search > span { color: var(--frontend-stroke); font-size: 0.875rem; }+ .node-finder-search:focus-within {+ border-color: var(--frontend-stroke);+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--frontend-stroke) 20%, transparent);+ }+ .node-finder-input {+ appearance: none;+ width: 100%;+ min-width: 0;+ border: 0;+ outline: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ font-size: 0.75rem;+ }+ .node-finder-input:focus-visible { outline: none; }+ .node-finder-input::placeholder { color: var(--text-faint); }+ .node-finder kbd {+ padding: 0.1rem 0.32rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.25rem;+ color: var(--text-faint);+ font: inherit;+ font-size: 0.5625rem;+ }+ .node-finder-results {+ display: grid;+ flex: 1 1 auto;+ gap: 0;+ min-height: 0;+ max-height: min(18rem, 48vh);+ margin: 0 0.55rem 0.45rem;+ padding: 0;+ overflow-y: auto;+ overscroll-behavior: contain;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 78%, transparent);+ border-radius: 0.55rem;+ background: color-mix(in srgb, var(--panel) 54%, transparent);+ scroll-padding-block: 0.25rem;+ scrollbar-width: thin;+ }+ html[data-preset="blueprint"] .node-finder-results { border-radius: 0.18rem; }+ .node-finder-result {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem 0.75rem;+ width: 100%;+ min-height: 3.25rem;+ padding: 0.58rem 0.65rem;+ border: 0;+ border-radius: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ text-align: left;+ cursor: pointer;+ transition: background-color 160ms ease-out;+ }+ .node-finder-result:not(:last-child) {+ border-bottom: 1px solid color-mix(in srgb, var(--toolbar-border) 62%, transparent);+ }+ .node-finder-result:hover,+ .node-finder-result:focus-visible {+ position: relative;+ z-index: 1;+ background: color-mix(in srgb, var(--frontend-fill) 48%, var(--toolbar-hover));+ }+ .node-finder-result strong {+ overflow: hidden;+ font-size: 0.75rem;+ line-height: 1.25;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result small {+ grid-column: 1 / -1;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.5625rem;+ letter-spacing: 0.015em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .node-finder-result em {+ align-self: center;+ color: var(--frontend-stroke);+ font-size: 0.625rem;+ font-style: normal;+ }+ .node-finder[data-context^="route-"] .node-finder-result em {+ padding: 0.1rem 0.3rem;+ border: 1px solid color-mix(in srgb, currentColor 52%, transparent);+ border-radius: 999px;+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ }+ .node-finder[data-context="route-target"] .node-finder-result em { color: var(--security-stroke); }+ .node-finder-empty {+ padding: 1.1rem 0.75rem 1.25rem;+ color: var(--text-faint);+ font-size: 0.6875rem;+ text-align: center;+ }+ .node-finder-status {+ margin: 0;+ padding: 0.1rem 0.8rem 0.65rem;+ color: var(--text-faint);+ font-size: 0.5625rem;+ }++ .guided-views {+ display: grid;+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem auto;+ align-items: stretch;+ gap: 0.35rem;+ min-width: 0;+ margin: 0 0 0.75rem;+ padding: 0.35rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.85rem;+ background: var(--toolbar-bg);+ background: linear-gradient(120deg, var(--toolbar-bg), color-mix(in srgb, var(--toolbar-bg) 82%, var(--frontend-fill)));+ box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16);+ backdrop-filter: blur(12px);+ }+ .guided-views[hidden] { display: none; }++ html[data-preset="blueprint"] .guided-views {+ border-color: var(--panel-border);+ border-radius: 0.35rem;+ background:+ linear-gradient(90deg, color-mix(in srgb, var(--frontend-fill) 36%, transparent), transparent 24%),+ var(--toolbar-bg);+ box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);+ }+ html[data-preset="blueprint"] .guided-views button { border-radius: 0.2rem; }+ html[data-preset="blueprint"] .guided-view-progress { border-radius: 0; }+ html[data-preset="blueprint"] .guided-view-progress span { border-radius: 0; }+ .guided-views button {+ min-width: 0;+ padding: 0.45rem 0.6rem;+ border-radius: 0.55rem;+ font-size: 0.75rem;+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next { min-width: 2.75rem; min-height: 2.75rem; }+ .guided-views button:disabled { opacity: 0.3; cursor: default; }+ .guided-view-copy {+ min-width: 0;+ padding: 0.2rem 0.5rem;+ border-left: 1px solid var(--toolbar-border);+ overflow: hidden;+ }+ .guided-view-meta {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ min-height: 1rem;+ margin-bottom: 0.12rem;+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 700;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .guided-view-handoff {+ box-sizing: border-box;+ height: 1rem;+ min-width: 0;+ max-width: 15rem;+ overflow: hidden;+ padding: 0 0.38rem;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 46%, transparent);+ border-radius: 999px;+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-fill) 44%, transparent);+ font-size: 0.5rem;+ line-height: calc(1rem - 2px);+ letter-spacing: 0.06em;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-handoff[hidden] { display: none; }+ html[data-preset="blueprint"] .guided-view-handoff { border-radius: 0.15rem; }+ .chapter-handoff-overlay { pointer-events: none; }+ .chapter-handoff-anchor {+ fill: color-mix(in srgb, var(--frontend-fill) 10%, transparent);+ stroke: var(--frontend-stroke);+ stroke-width: 2;+ stroke-dasharray: 4 4;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ animation: archify-chapter-anchor 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="stay"] { opacity: 1; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="enter"] { opacity: 0.78; }+ svg[data-chapter-handoff] [data-node-id][data-chapter-role="leave"] { opacity: 0.26; }+ @keyframes archify-chapter-anchor {+ 0% { opacity: 0.35; stroke-dashoffset: 8; }+ 45% { opacity: 1; }+ 100% { opacity: 0.72; stroke-dashoffset: 0; }+ }+ .guided-view-progress {+ width: 3.5rem;+ height: 2px;+ overflow: hidden;+ border-radius: 999px;+ background: var(--toolbar-border);+ }+ .guided-view-progress span {+ display: block;+ width: 100%;+ height: 100%;+ border-radius: inherit;+ background: var(--frontend-stroke);+ transform: scaleX(0);+ transform-origin: left center;+ }+ .guided-view-copy strong,+ .guided-view-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .guided-view-copy strong { color: var(--toolbar-text); font-size: 0.75rem; line-height: 1.35; }+ .guided-view-copy small { margin-top: 0; color: var(--text-muted); font-size: 0.625rem; line-height: 1.35; }+ .guided-story-caption {+ display: grid;+ grid-template-columns: auto minmax(0, 1fr) auto;+ gap: 0.12rem 0.55rem;+ align-items: center;+ min-width: 0;+ margin-top: 0.18rem;+ padding: 0.3rem 0.5rem;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 32%, var(--toolbar-border));+ border-radius: 0.58rem;+ background: color-mix(in srgb, var(--frontend-fill) 26%, transparent);+ animation: archify-story-caption-in 140ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ .guided-story-caption[hidden] { display: none; }+ .guided-story-caption-index {+ grid-row: 1 / span 2;+ align-self: stretch;+ display: inline-grid;+ min-width: 3.3rem;+ place-items: center;+ padding-right: 0.52rem;+ border-right: 1px solid color-mix(in srgb, var(--frontend-stroke) 28%, var(--toolbar-border));+ color: var(--frontend-stroke);+ font-size: 0.5625rem;+ font-weight: 800;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ }+ .guided-story-caption strong,+ .guided-story-caption small {+ display: block;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-story-caption strong { color: var(--toolbar-text); font-size: 0.6875rem; line-height: 1.3; }+ .guided-story-caption small { color: var(--text-muted); font-size: 0.5625rem; line-height: 1.35; }+ .guided-story-caption-next {+ grid-column: 3;+ grid-row: 1 / span 2;+ display: grid;+ min-width: 6.4rem;+ max-width: 9.5rem;+ align-self: stretch;+ align-content: center;+ padding-left: 0.58rem;+ border-left: 1px solid color-mix(in srgb, var(--frontend-stroke) 22%, var(--toolbar-border));+ }+ .guided-story-caption-next[hidden] { display: none; }+ .guided-story-caption-next small {+ color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--text-muted));+ font-weight: 800;+ letter-spacing: 0.09em;+ text-transform: uppercase;+ }+ .guided-story-caption-next strong { color: var(--text-muted); font-weight: 700; }+ html[data-preset="blueprint"] .guided-story-caption { border-radius: 0.2rem; }+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-label,+ .guided-views[data-story-beat] .guided-view-copy > #guided-view-note { display: none; }+ @keyframes archify-story-caption-in {+ from { opacity: 0; transform: translateY(3px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .guided-view-trail {+ display: flex;+ align-items: center;+ gap: 0.28rem;+ min-width: 0;+ min-height: 1.7rem;+ margin-top: 0;+ padding: 0;+ overflow-x: auto;+ color: var(--text-faint);+ overscroll-behavior-x: contain;+ touch-action: pan-x;+ scrollbar-width: none;+ white-space: nowrap;+ }+ .guided-view-trail[hidden] { display: none; }+ .guided-view-trail::-webkit-scrollbar { display: none; }+ .guided-view-trail .guided-view-stop {+ appearance: none;+ box-sizing: border-box;+ display: inline-flex;+ flex: 0 0 auto;+ align-items: center;+ gap: 0.28rem;+ min-height: 1.5rem;+ padding: 0.1rem 0.3rem 0.1rem 0.18rem;+ border: 1px solid transparent;+ border-radius: 999px;+ background: transparent;+ color: var(--text-muted);+ cursor: pointer;+ font-family: inherit;+ font-size: 0.5625rem;+ font-weight: 650;+ letter-spacing: 0.02em;+ line-height: 1;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;+ }+ .guided-view-stop:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 36%, transparent);+ background: color-mix(in srgb, var(--frontend-fill) 34%, transparent);+ }+ .guided-view-stop:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-stop:disabled { cursor: wait; }+ .guided-view-stop::before {+ display: inline-grid;+ width: 1rem;+ height: 1rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 54%, var(--toolbar-border));+ border-radius: 50%;+ background: color-mix(in srgb, var(--frontend-fill) 58%, var(--toolbar-bg));+ color: var(--frontend-stroke);+ content: attr(data-story-number);+ font-size: 0.5rem;+ line-height: 1;+ }+ .guided-view-stop + .guided-view-stop::after {+ order: -1;+ color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--text-faint));+ content: '\00b7';+ font-size: 0.65rem;+ }+ .guided-view-stop[data-story-link="forward"]::after { content: '\2192'; }+ .guided-view-stop[data-story-link="reverse"]::after { content: '\2190'; }+ .guided-view-stop[data-story-link="multiple"]::after { content: '\21c4'; }+ .guided-view-stop[data-story-beat-state="pending"] { opacity: 0.38; }+ .guided-view-stop[data-story-beat-state="next"] {+ border-style: dashed;+ border-color: color-mix(in srgb, var(--frontend-stroke) 42%, var(--toolbar-border));+ color: color-mix(in srgb, var(--toolbar-text) 68%, var(--text-muted));+ opacity: 0.58;+ }+ .guided-view-stop[data-story-beat-state="past"] { color: var(--text-muted); opacity: 0.76; }+ .guided-view-stop[data-story-beat-state="active"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border));+ background: color-mix(in srgb, var(--frontend-fill) 42%, transparent);+ color: var(--toolbar-text);+ font-weight: 800;+ opacity: 1;+ }+ .guided-view-stop[data-story-beat-state="active"]::before {+ border-color: var(--frontend-stroke);+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 54%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-stop,+ html[data-preset="blueprint"] .guided-view-stop::before { border-radius: 0.1rem; }+ html[data-preset="blueprint"] .guided-view-stop[data-story-beat-state="active"]::before { box-shadow: none; }+ .guided-view-actions { display: flex; align-items: stretch; gap: 0.2rem; }+ .guided-view-actions button { white-space: nowrap; }+ .guided-view-play {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.38rem;+ min-width: 6.25rem !important;+ color: var(--frontend-stroke) !important;+ font-size: 0.625rem !important;+ }+ .guided-view-play[aria-pressed="true"] { background: var(--toolbar-hover); }+ .guided-view-all { min-width: 3.25rem !important; color: var(--text-muted) !important; font-size: 0.625rem !important; }+ .guided-view-beat-link {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.3rem;+ min-width: 5.4rem !important;+ min-height: 1.5rem;+ color: var(--text-muted) !important;+ font-size: 0.5625rem !important;+ letter-spacing: 0.025em;+ transition: background 140ms ease, border-color 140ms ease, color 140ms ease;+ }+ .guided-view-beat-link:not(:disabled):hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 52%, var(--toolbar-border));+ color: var(--frontend-stroke) !important;+ }+ .guided-view-beat-link[data-copy-state="copied"] {+ border-color: color-mix(in srgb, var(--backend-stroke) 58%, var(--toolbar-border));+ background: color-mix(in srgb, var(--backend-fill) 46%, transparent);+ color: var(--backend-stroke) !important;+ }+ .guided-view-index {+ grid-column: 1 / -1;+ min-width: 0;+ padding: 0.28rem 0.12rem 0.08rem;+ overflow: hidden;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ @media (min-width: 721px) {+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-index,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-beat-link,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-all,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-trail,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-label,+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-view-copy > #guided-view-note { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-views[data-playing="true"] .guided-story-caption { margin-top: 0.08rem; }+ }+ .guided-view-chapters {+ display: flex;+ gap: 0.28rem;+ min-width: 0;+ margin: 0;+ padding: 0.08rem 0.05rem 0.2rem;+ overflow-x: auto;+ list-style: none;+ scroll-padding-inline: 0.05rem;+ scroll-snap-type: x proximity;+ scrollbar-width: none;+ }+ .guided-view-chapters::-webkit-scrollbar { display: none; }+ .guided-view-chapters li {+ display: flex;+ flex: 1 1 0;+ min-width: 9.5rem;+ scroll-snap-align: center;+ }+ .guided-view-chapter {+ position: relative;+ display: grid !important;+ grid-template-columns: 1.55rem minmax(0, 1fr) auto;+ align-items: center;+ width: 100%;+ min-height: 2.75rem;+ padding: 0.36rem 0.48rem !important;+ overflow: hidden;+ border: 1px solid color-mix(in srgb, var(--toolbar-border) 86%, transparent) !important;+ border-radius: 0.48rem !important;+ background: color-mix(in srgb, var(--toolbar-bg) 88%, transparent) !important;+ color: var(--text-muted) !important;+ text-align: left;+ transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;+ }+ .guided-view-chapter:hover {+ border-color: color-mix(in srgb, var(--frontend-stroke) 58%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 42%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 1px;+ }+ .guided-view-chapter-index {+ display: inline-grid;+ width: 1.32rem;+ height: 1.32rem;+ place-items: center;+ border: 1px solid color-mix(in srgb, var(--frontend-stroke) 48%, var(--toolbar-border));+ border-radius: 50%;+ color: var(--frontend-stroke);+ font-size: 0.5rem;+ font-weight: 800;+ letter-spacing: 0.03em;+ }+ .guided-view-chapter-title {+ min-width: 0;+ overflow: hidden;+ color: var(--toolbar-text);+ font-size: 0.625rem;+ font-weight: 700;+ line-height: 1.3;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .guided-view-chapter-count {+ grid-column: 3;+ grid-row: 1;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-style: normal;+ font-weight: 650;+ white-space: nowrap;+ }+ .guided-view-chapter-delta {+ display: inline-flex;+ grid-column: 3;+ grid-row: 1;+ align-items: center;+ gap: 0.22rem;+ margin-left: 0.38rem;+ color: var(--text-faint);+ font-size: 0.5rem;+ font-weight: 750;+ letter-spacing: 0.01em;+ white-space: nowrap;+ }+ .guided-view-chapter-delta[hidden] { display: none; }+ .guided-view-chapter-delta [data-delta-kind="stay"] { color: var(--text-muted); }+ .guided-view-chapter-delta [data-delta-kind="enter"] { color: var(--frontend-stroke); }+ .guided-view-chapter-delta [data-delta-kind="leave"] { color: var(--security-stroke); }+ .guided-view-chapter[data-preview-active="true"] {+ border-color: color-mix(in srgb, var(--frontend-stroke) 72%, var(--toolbar-border)) !important;+ background: color-mix(in srgb, var(--frontend-fill) 54%, var(--toolbar-bg)) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] {+ border: 2px solid var(--frontend-stroke) !important;+ padding: calc(0.36rem - 1px) calc(0.48rem - 1px) !important;+ box-shadow: inset 3px 0 0 var(--frontend-stroke);+ color: var(--toolbar-text) !important;+ }+ .guided-view-chapter[data-chapter-position="current"] .guided-view-chapter-index {+ background: var(--frontend-stroke);+ color: var(--bg);+ }+ .guided-view-chapter[data-chapter-position="before"] {+ border-style: solid !important;+ opacity: 0.72;+ }+ .guided-view-chapter[data-chapter-position="after"] { border-style: dashed !important; }+ html[data-preset="signal-flow"] .guided-view-chapter[data-chapter-position="current"] {+ box-shadow: inset 3px 0 0 var(--frontend-stroke), 0 0 18px color-mix(in srgb, var(--frontend-stroke) 18%, transparent);+ }+ html[data-preset="blueprint"] .guided-view-chapter,+ html[data-preset="blueprint"] .guided-view-chapter-index { border-radius: 0.12rem !important; }++ /* Story Shelf — keep every authored chapter and the Play action visible,+ but do not spend a second row on unavailable director controls before+ the reader enters a chapter. Existing data-active-view state expands+ the full guided surface without a new toggle or stored preference. */+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(11rem, .72fr) auto minmax(0, 2fr);+ align-items: center;+ padding: 0.28rem 0.35rem;+ }+ .guided-views[data-active-view="all"] > #guided-view-prev,+ .guided-views[data-active-view="all"] > #guided-view-next,+ .guided-views[data-active-view="all"] .guided-view-beat-link,+ .guided-views[data-active-view="all"] .guided-view-all { display: none; }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ padding: 0.1rem 0.55rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy > #guided-view-note { display: none; }+ .guided-views[data-active-view="all"] .guided-view-actions {+ display: block;+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 3;+ grid-row: 1;+ padding: 0 0.08rem 0 0.42rem;+ border-top: 0;+ border-left: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ }+ .guided-views[data-active-view="all"] .guided-view-chapters {+ gap: 0.3rem;+ padding: 0;+ }++ .cards {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));+ gap: 1rem;+ margin-top: 2rem;+ }++ .card {+ background: var(--panel);+ border-radius: 0.75rem;+ border: 1px solid var(--panel-border);+ padding: 1.25rem;+ }++ html[data-preset="signal-flow"] .card {+ background: linear-gradient(145deg, rgba(10, 24, 43, 0.86), rgba(5, 12, 24, 0.92));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);+ }+ html[data-preset="signal-flow"][data-theme="light"] .card {+ background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(237, 246, 250, 0.9));+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 12px 32px rgba(45, 78, 99, 0.08);+ }++ /* Preserve the one-screen guarantee on ordinary laptop displays. The+ high-screen expansion above must not trade a fuller canvas for page+ scrolling at 900–1080px heights. */+ @media (min-width: 768px) and (max-height: 1100px) {+ .header { margin-bottom: 1rem; }+ .diagram-container {+ padding: 0.875rem;+ padding-bottom: calc(0.875rem + var(--archify-nav-reserve));+ }+ .cards { margin-top: 1rem; }+ .card { padding: 1rem; }+ }+ @media (min-width: 768px) and (max-height: 920px) {+ body { padding-block: 1.25rem; }+ .header { margin-bottom: 0.875rem; }+ .cards { margin-top: 0.75rem; }+ }++ html[data-preset="blueprint"] .card {+ position: relative;+ border-color: var(--panel-border);+ border-radius: 0.3rem;+ background: var(--panel);+ box-shadow: none;+ }+ html[data-preset="blueprint"] .card::before {+ content: "";+ position: absolute;+ top: -1px;+ left: 1rem;+ width: 2.5rem;+ border-top: 2px solid var(--frontend-stroke);+ }++ html[data-preset="editorial"] .card {+ position: relative;+ border-radius: 0.28rem;+ background: var(--panel);+ box-shadow: 0 10px 28px color-mix(in srgb, #000 10%, transparent);+ }+ html[data-preset="editorial"] .card::before {+ position: absolute;+ top: -1px;+ left: 1.25rem;+ width: 3.25rem;+ border-top: 3px solid var(--arrow-emphasis);+ content: "";+ }+ html[data-preset="editorial"] .card-dot { border-radius: 0; transform: rotate(45deg) scale(0.78); }++ .card-header {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ margin-bottom: 0.75rem;+ }++ .card-dot {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ }++ .card-dot.cyan { background: var(--frontend-stroke); }+ .card-dot.emerald { background: var(--backend-stroke); }+ .card-dot.violet { background: var(--database-stroke); }+ .card-dot.amber { background: var(--cloud-stroke); }+ .card-dot.rose { background: var(--security-stroke); }+ .card-dot.orange { background: var(--messagebus-stroke); }+ .card-dot.slate { background: var(--external-stroke); }++ .card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text); }++ .card ul {+ list-style: none;+ color: var(--text-muted);+ font-size: 0.75rem;+ }++ .card li { margin-bottom: 0.375rem; }++ /* ==========================================================+ Print stylesheet — hide interactive controls, force light,+ drop the grid so the diagram doesn't waste ink, use landscape+ so wide diagrams fit, pack summary cards into 2 columns to+ avoid an orphan card on a trailing page.+ ========================================================== */+ @page { size: landscape; margin: 1.5cm; }++ @media print {+ /* Force the FULL light palette — including component fills/strokes and+ lane/arrow colors — so printing from dark theme doesn't put neon+ strokes and translucent dark fills on white paper. */+ :root, [data-theme="dark"], [data-theme="light"] {+ --bg: #ffffff;+ --grid: transparent;+ --panel: #ffffff;+ --panel-border: #e2e8f0;+ --text: #0f172a;+ --text-muted: #475569;+ --text-dim: #94a3b8;+ --text-faint: #64748b;+ --mask: #ffffff;+ --lane-fill: rgba(248, 250, 252, 0.65);+ --lane-stroke: #cbd5e1;+ --arrow: #94a3b8;+ --arrow-emphasis: #059669;+ --frontend-fill: rgba(34, 211, 238, 0.15);+ --frontend-stroke: #0891b2;+ --backend-fill: rgba(52, 211, 153, 0.18);+ --backend-stroke: #059669;+ --database-fill: rgba(167, 139, 250, 0.2);+ --database-stroke: #7c3aed;+ --cloud-fill: rgba(251, 191, 36, 0.18);+ --cloud-stroke: #d97706;+ --security-fill: rgba(251, 113, 133, 0.15);+ --security-stroke: #e11d48;+ --messagebus-fill: rgba(251, 146, 60, 0.15);+ --messagebus-stroke:#ea580c;+ --external-fill: rgba(148, 163, 184, 0.18);+ --external-stroke: #64748b;+ }+ body { background: #ffffff !important; padding: 0; }+ .container { max-width: none; }+ .toolbar, .diagram-nav, .focus-chip, .guided-views, .archify-toast, .no-print { display: none !important; }+ .chapter-handoff-overlay { display: none !important; }+ svg [data-node-id][data-chapter-role] { opacity: 1 !important; }+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { opacity: 1 !important; filter: none !important; }+ .diagram-container, .card { box-shadow: none; border-color: #e2e8f0; }+ .diagram-container { --archify-nav-reserve: 0px !important; }+ html[data-preset="signal-flow"] .diagram-container,+ html[data-preset="signal-flow"] .card { background: #ffffff; }+ .cards { grid-template-columns: 1fr 1fr; }+ /* Ensure elements break sensibly across pages */+ .card { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container { break-inside: avoid; page-break-inside: avoid; }+ .diagram-container svg [data-detail] {+ opacity: 1 !important;+ pointer-events: auto !important;+ }+ .diagram-container svg [data-detail-anchor] { transform: none !important; }+ .diagram-container svg[data-lens-active] [data-node-id],+ .diagram-container svg[data-lens-active] [data-edge-from],+ .diagram-container svg[data-legend-preview-active] [data-node-id],+ .diagram-container svg[data-legend-preview-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ }+ [data-legend-bridge-runtime] { display: none !important; }+ .semantic-lens-overlay { display: none !important; }+ .relationship-hit-overlay { display: none !important; }+ .relationship-pulse-overlay { display: none !important; }+ .route-probe-overlay, .route-journey-overlay { display: none !important; }+ .story-trail-overlay,+ .story-carrier-overlay { display: none !important; }+ .diagram-container svg[data-focus-active] [data-node-id],+ .diagram-container svg[data-focus-active] [data-edge-from],+ .diagram-container svg[data-reach-active] [data-node-id],+ .diagram-container svg[data-reach-active] [data-edge-from],+ .diagram-container svg[data-story-beat] [data-story-step],+ .diagram-container svg[data-story-beat] [data-edge-from][data-story-beat-step],+ .diagram-container svg[data-route-active] [data-node-id],+ .diagram-container svg[data-route-active] [data-edge-from] {+ opacity: 1 !important;+ filter: none !important;+ animation: none !important;+ }+ h1, .subtitle { color: #0f172a; }+ }++ /* ==========================================================+ TOOLBAR (theme toggle + export menu)+ ========================================================== */+ .toolbar {+ position: fixed;+ top: 1rem;+ right: 1rem;+ display: flex;+ align-items: center;+ gap: 0.5rem;+ padding: 0;+ border: 0;+ background: transparent;+ box-shadow: none;+ z-index: 100;+ }+ .toolbar button {+ background: var(--toolbar-bg);+ color: var(--toolbar-text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 0.875rem;+ border-radius: 0.625rem;+ font-family: inherit;+ font-size: 0.75rem;+ font-weight: 500;+ cursor: pointer;+ white-space: nowrap;+ backdrop-filter: blur(10px);+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);+ transition: background 0.15s, border-color 0.15s, color 0.15s;+ display: inline-flex;+ align-items: center;+ gap: 0.375rem;+ min-height: 2.75rem;+ }+ .toolbar button:hover {+ background: var(--toolbar-hover);+ border-color: color-mix(in srgb, var(--arrow) 62%, var(--toolbar-border));+ }+ .toolbar button[aria-expanded="true"],+ .toolbar button[aria-pressed="true"]:not(#btn-theme) {+ background: color-mix(in srgb, var(--frontend-stroke) 10%, var(--toolbar-hover));+ border-color: color-mix(in srgb, var(--frontend-stroke) 48%, var(--toolbar-border));+ }+ .toolbar #btn-export {+ padding-right: 0.82rem;+ padding-left: 0.82rem;+ }+ .toolbar #btn-export:hover,+ .toolbar #btn-export[aria-expanded="true"] {+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-stroke) 10%, var(--toolbar-hover));+ border-color: color-mix(in srgb, var(--frontend-stroke) 54%, var(--toolbar-border));+ }+ .toolbar button:focus-visible {+ outline: 2px solid var(--frontend-stroke);+ outline-offset: 2px;+ }+ .toolbar #btn-motion[hidden] { display: none !important; }+ .toolbar #btn-motion { min-width: 4.4rem; }+ .toolbar #btn-motion:disabled { cursor: default; opacity: 0.58; }+ .toolbar .preset-wrap,+ .toolbar .export-wrap {+ position: relative;+ }+ .toolbar-icon {+ display: inline-block;+ width: 0.95rem;+ height: 0.95rem;+ flex: 0 0 auto;+ background: currentColor;+ -webkit-mask-position: center;+ -webkit-mask-repeat: no-repeat;+ -webkit-mask-size: contain;+ mask-position: center;+ mask-repeat: no-repeat;+ mask-size: contain;+ }+ .toolbar-chevron {+ width: 0.65rem;+ height: 0.65rem;+ transition: transform 0.15s ease;+ }+ [aria-expanded="true"] > .toolbar-chevron { transform: rotate(180deg); }+ [data-theme="light"] #theme-icon {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='3.1'/%3E%3Cpath d='M10 2.2v1.4M10 16.4v1.4M2.2 10h1.4M16.4 10h1.4M4.5 4.5l1 1M14.5 14.5l1 1M15.5 4.5l-1 1M5.5 14.5l-1 1'/%3E%3C/g%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='3.1'/%3E%3Cpath d='M10 2.2v1.4M10 16.4v1.4M2.2 10h1.4M16.4 10h1.4M4.5 4.5l1 1M14.5 14.5l1 1M15.5 4.5l-1 1M5.5 14.5l-1 1'/%3E%3C/g%3E%3C/svg%3E");+ }+ [data-theme="dark"] #theme-icon {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M15.2 12.7A6.3 6.3 0 017.3 4.8a6.3 6.3 0 107.9 7.9Z' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M15.2 12.7A6.3 6.3 0 017.3 4.8a6.3 6.3 0 107.9 7.9Z' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'/%3E%3C/svg%3E");+ }+ #btn-present[aria-pressed="false"] #present-icon {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7.2 3.2h-4v4M12.8 3.2h4v4M7.2 16.8h-4v-4M12.8 16.8h4v-4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7.2 3.2h-4v4M12.8 3.2h4v4M7.2 16.8h-4v-4M12.8 16.8h4v-4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ #btn-present[aria-pressed="true"] #present-icon {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7.2 7.2h-4v-4M12.8 7.2h4v-4M7.2 12.8h-4v4M12.8 12.8h4v4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7.2 7.2h-4v-4M12.8 7.2h4v-4M7.2 12.8h-4v4M12.8 12.8h4v4' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");+ }+ .toolbar-chevron {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ }+ .toolbar #btn-preset { min-width: 5.4rem; }+ .preset-control-mark {+ width: 0.58rem;+ height: 0.58rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 0.2rem;+ background: color-mix(in srgb, var(--frontend-stroke) 28%, transparent);+ transition: border-radius 0.15s, box-shadow 0.15s, transform 0.15s;+ }+ #btn-preset[data-preset-option="signal-flow"] .preset-control-mark {+ border-radius: 50%;+ box-shadow: 0 0 10px color-mix(in srgb, var(--frontend-stroke) 78%, transparent);+ }+ #btn-preset[data-preset-option="blueprint"] .preset-control-mark {+ border-radius: 0.06rem;+ background: transparent;+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--frontend-stroke) 32%, transparent);+ transform: rotate(45deg) scale(0.84);+ }+ #btn-preset[data-preset-option="editorial"] .preset-control-mark {+ border-color: var(--arrow-emphasis);+ border-radius: 0;+ background: var(--arrow-emphasis);+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--arrow-emphasis) 14%, transparent);+ transform: rotate(45deg) scale(0.72);+ }+ .toolbar .preset-menu {+ position: absolute;+ top: calc(100% + 0.375rem);+ right: 0;+ display: none;+ width: 18.5rem;+ max-width: calc(100vw - 2rem);+ padding: 0.45rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.875rem;+ background: var(--toolbar-menu-bg);+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);+ }+ .toolbar .preset-menu.open { display: block; }+ .toolbar .preset-menu.open,+ .toolbar .export-menu.open {+ animation: toolbar-menu-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);+ transform-origin: top right;+ }+ @keyframes toolbar-menu-in {+ from { opacity: 0; transform: translateY(-0.25rem) scale(0.985); }+ to { opacity: 1; transform: translateY(0) scale(1); }+ }+ .preset-menu-heading {+ display: flex;+ align-items: baseline;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.42rem 0.6rem 0.55rem;+ color: var(--text-faint);+ font-size: 0.56rem;+ letter-spacing: 0.13em;+ text-transform: uppercase;+ }+ .preset-menu-heading span:last-child {+ font-size: 0.52rem;+ letter-spacing: 0.04em;+ text-transform: none;+ }+ .toolbar .preset-option {+ display: grid;+ grid-template-columns: 2rem minmax(0, 1fr) 1rem;+ align-items: center;+ gap: 0.68rem;+ width: 100%;+ min-height: 3.35rem;+ padding: 0.5rem 0.62rem;+ border: 0;+ border-radius: 0.5rem;+ background: transparent;+ box-shadow: none;+ backdrop-filter: none;+ text-align: left;+ }+ .toolbar .preset-option:hover,+ .toolbar .preset-option:focus-visible { background: var(--toolbar-hover); }+ .toolbar .preset-option[aria-checked="true"] {+ background: color-mix(in srgb, var(--frontend-stroke) 9%, transparent);+ border-color: color-mix(in srgb, var(--frontend-stroke) 36%, transparent);+ }+ .preset-option-swatch {+ position: relative;+ width: 2rem;+ height: 1.55rem;+ overflow: hidden;+ border: 1px solid #64748b;+ border-radius: 0.24rem;+ background: #0f172a;+ box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);+ }+ .preset-option-swatch::before,+ .preset-option-swatch::after { position: absolute; content: ""; }+ .preset-option-swatch.classic::before {+ top: 0.42rem;+ right: 0.35rem;+ bottom: 0.42rem;+ left: 0.35rem;+ border: 1px solid #22d3ee;+ border-radius: 0.16rem;+ background: rgba(34, 211, 238, 0.14);+ }+ .preset-option-swatch.signal-flow {+ border-color: #29415f;+ background: linear-gradient(135deg, #07101e 10%, #10243c 100%);+ }+ .preset-option-swatch.signal-flow::before {+ top: 50%;+ right: 0.2rem;+ left: 0.2rem;+ height: 1px;+ background: linear-gradient(90deg, #67e8f9, #c4b5fd);+ box-shadow: 0 0 8px #67e8f9;+ }+ .preset-option-swatch.signal-flow::after {+ top: calc(50% - 0.13rem);+ right: 0.28rem;+ width: 0.26rem;+ height: 0.26rem;+ border-radius: 50%;+ background: #67e8f9;+ box-shadow: 0 0 7px #67e8f9;+ }+ .preset-option-swatch.blueprint {+ border-color: #34799a;+ border-radius: 0.08rem;+ background-color: #0a2031;+ background-image:+ linear-gradient(rgba(102, 217, 239, 0.18) 1px, transparent 1px),+ linear-gradient(90deg, rgba(102, 217, 239, 0.18) 1px, transparent 1px);+ background-size: 0.42rem 0.42rem;+ }+ .preset-option-swatch.blueprint::before {+ top: 0.34rem;+ right: 0.38rem;+ bottom: 0.34rem;+ left: 0.38rem;+ border: 1px solid #66d9ef;+ }+ .preset-option-swatch.editorial {+ border-color: #b8aa94;+ border-radius: 0.08rem;+ background: repeating-linear-gradient(0deg, #f2eee5 0 0.34rem, #d8d0c2 0.36rem, #f2eee5 0.38rem);+ }+ .preset-option-swatch.editorial::before {+ top: 0;+ bottom: 0;+ left: 0.42rem;+ width: 1px;+ background: #c9502d;+ opacity: 0.72;+ }+ .preset-option-swatch.editorial::after {+ top: 0.52rem;+ right: 0.45rem;+ width: 0.38rem;+ height: 0.38rem;+ background: #c9502d;+ transform: rotate(45deg);+ }+ .preset-option-copy { min-width: 0; }+ .preset-option-copy strong,+ .preset-option-copy small { display: block; }+ .preset-option-copy strong {+ color: var(--toolbar-text);+ font-size: 0.72rem;+ font-weight: 600;+ }+ .preset-option-copy small {+ margin-top: 0.16rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.57rem;+ font-weight: 400;+ white-space: nowrap;+ text-overflow: ellipsis;+ }+ .preset-option-check {+ display: inline-block;+ width: 0.9rem;+ height: 0.9rem;+ color: var(--frontend-stroke);+ background: currentColor;+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3 3 7-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ -webkit-mask-position: center;+ -webkit-mask-repeat: no-repeat;+ -webkit-mask-size: contain;+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3 3 7-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");+ mask-position: center;+ mask-repeat: no-repeat;+ mask-size: contain;+ opacity: 0;+ }+ .preset-option[aria-checked="true"] .preset-option-check { opacity: 1; }+ html[data-preset="editorial"] .toolbar button,+ html[data-preset="editorial"] .preset-menu,+ html[data-preset="editorial"] .export-menu,+ html[data-preset="editorial"] .overview-map,+ html[data-preset="editorial"] .semantic-lens,+ html[data-preset="editorial"] .route-probe,+ html[data-preset="editorial"] .focus-chip,+ html[data-preset="editorial"] .diagram-guide,+ html[data-preset="editorial"] .node-finder,+ html[data-preset="editorial"] .guided-views,+ html[data-preset="editorial"] .share-chapter-cue {+ border-radius: 0.3rem;+ }+ .motion-control-dot {+ width: 0.46rem;+ height: 0.46rem;+ flex: 0 0 auto;+ border: 1px solid var(--frontend-stroke);+ border-radius: 50%;+ background: var(--frontend-stroke);+ box-shadow: 0 0 9px color-mix(in srgb, var(--frontend-stroke) 72%, transparent);+ }+ #btn-motion[aria-pressed="false"] .motion-control-dot {+ background: transparent;+ box-shadow: none;+ }+ .toolbar .export-menu {+ position: absolute;+ top: calc(100% + 0.375rem);+ right: 0;+ background: var(--toolbar-menu-bg);+ border: 1px solid var(--toolbar-border);+ width: 19rem;+ max-width: calc(100vw - 2rem);+ max-height: calc(100vh - 5.5rem);+ overflow-y: auto;+ border-radius: 0.875rem;+ padding: 0.55rem;+ display: none;+ flex-direction: column;+ box-shadow: 0 18px 48px rgba(0,0,0,0.24);+ }+ .toolbar .export-menu.open { display: flex; }+ .export-menu-header {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 1rem;+ padding: 0.5rem 0.55rem 0.72rem;+ }+ .export-menu-header strong,+ .export-menu-header span { display: block; }+ .export-menu-header strong {+ color: var(--toolbar-text);+ font-size: 0.78rem;+ font-weight: 650;+ letter-spacing: -0.015em;+ }+ .export-menu-header span {+ margin-top: 0.16rem;+ color: var(--text-faint);+ font-size: 0.56rem;+ }+ .export-menu-header kbd {+ padding: 0.16rem 0.36rem;+ border: 1px solid var(--toolbar-border);+ border-radius: 0.3rem;+ color: var(--text-faint);+ background: color-mix(in srgb, var(--toolbar-border) 16%, transparent);+ font-family: inherit;+ font-size: 0.54rem;+ font-weight: 600;+ }+ .export-menu-section {+ display: grid;+ grid-template-columns: minmax(0, 1fr);+ gap: 0.18rem;+ }+ .export-menu-section + .export-menu-section {+ margin-top: 0.42rem;+ padding-top: 0.42rem;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 68%, transparent);+ }+ .export-menu-heading {+ grid-column: 1 / -1;+ display: block;+ padding: 0.24rem 0.55rem 0.2rem;+ color: var(--text-faint);+ font-size: 0.54rem;+ font-weight: 600;+ letter-spacing: 0.12em;+ text-transform: uppercase;+ }+ .toolbar .export-menu button {+ display: grid;+ grid-template-columns: 1.15rem minmax(0, 1fr);+ align-items: center;+ column-gap: 0.52rem;+ background: transparent;+ border: 1px solid transparent;+ box-shadow: none;+ backdrop-filter: none;+ width: 100%;+ min-height: 3rem;+ text-align: left;+ padding: 0.48rem 0.55rem;+ border-radius: 0.5rem;+ white-space: nowrap;+ }+ .export-item-copy {+ display: block;+ min-width: 0;+ }+ .export-item-copy strong,+ .export-item-copy small { display: block; }+ .export-item-copy strong {+ overflow: hidden;+ color: inherit;+ font-size: 0.7rem;+ font-weight: 550;+ text-overflow: ellipsis;+ }+ .export-item-copy small {+ margin-top: 0.12rem;+ overflow: hidden;+ color: var(--text-faint);+ font-size: 0.55rem;+ font-weight: 450;+ text-overflow: ellipsis;+ }+ .toolbar .export-menu button::before {+ width: 1rem;+ height: 1rem;+ background: currentColor;+ content: "";+ opacity: 0.72;+ -webkit-mask-position: center;+ -webkit-mask-repeat: no-repeat;+ -webkit-mask-size: contain;+ mask-position: center;+ mask-repeat: no-repeat;+ mask-size: contain;+ }+ .toolbar .export-menu button[data-format="share-card"]::before,+ .toolbar .export-menu button[data-action="route-share-card"]::before,+ .toolbar .export-menu button[data-action="reach-share-card"]::before {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' d='M3 4.5h14v11H3zM6 12l2.5-2.5 2 2 1.5-1.5 2 2'/%3E%3Ccircle cx='13.8' cy='7.3' r='1.2' fill='black'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='black' stroke-width='1.7' d='M3 4.5h14v11H3zM6 12l2.5-2.5 2 2 1.5-1.5 2 2'/%3E%3Ccircle cx='13.8' cy='7.3' r='1.2' fill='black'/%3E%3C/svg%3E");+ }+ .toolbar .export-menu button[data-action^="copy"]::before {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Crect x='6' y='6' width='10' height='10' rx='1.5' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M4 13H3.5A1.5 1.5 0 012 11.5v-8A1.5 1.5 0 013.5 2h8A1.5 1.5 0 0113 3.5V4' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Crect x='6' y='6' width='10' height='10' rx='1.5' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M4 13H3.5A1.5 1.5 0 012 11.5v-8A1.5 1.5 0 013.5 2h8A1.5 1.5 0 0113 3.5V4' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ }+ .toolbar .export-menu button[data-format="png"]::before,+ .toolbar .export-menu button[data-format="jpeg"]::before,+ .toolbar .export-menu button[data-format="webp"]::before {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 2.5h7l3 3v12H5zM12 2.5v3h3' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M7.5 14l2-2 1.5 1.5 1.5-1.5' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 2.5h7l3 3v12H5zM12 2.5v3h3' fill='none' stroke='black' stroke-width='1.7'/%3E%3Cpath d='M7.5 14l2-2 1.5 1.5 1.5-1.5' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ }+ .toolbar .export-menu button[data-format="svg"]::before,+ .toolbar .export-menu button[data-format="webm"]::before {+ -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.5l7 4v7l-7 4-7-4v-7zM3 6.5l7 4 7-4M10 10.5v7' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 2.5l7 4v7l-7 4-7-4v-7zM3 6.5l7 4 7-4M10 10.5v7' fill='none' stroke='black' stroke-width='1.7'/%3E%3C/svg%3E");+ }+ .toolbar .export-menu button[data-format="share-card"],+ .toolbar .export-menu button[data-action="route-share-card"],+ .toolbar .export-menu button[data-action="reach-share-card"] {+ min-height: 3.35rem;+ color: var(--toolbar-text);+ background: color-mix(in srgb, var(--frontend-stroke) 8%, transparent);+ border-color: color-mix(in srgb, var(--frontend-stroke) 24%, var(--toolbar-border));+ }+ .toolbar .export-menu button[hidden] { display: none; }+ .toolbar .export-menu button:hover {+ background: var(--toolbar-hover);+ }+ .toolbar .export-menu button:focus-visible {+ background: var(--toolbar-hover);+ outline-offset: -2px;+ }+ .toolbar .export-menu button:disabled {+ color: var(--text-faint);+ background: color-mix(in srgb, var(--toolbar-border) 18%, transparent);+ cursor: not-allowed;+ }+ .toolbar .export-menu button:disabled:hover {+ border-color: transparent;+ }+ .toolbar .export-menu .hint {+ color: var(--text-faint);+ font-size: 0.55rem;+ }++ /* Toast — brief feedback for actions like "copied" */+ .archify-toast {+ position: fixed;+ top: 1rem;+ left: 50%;+ transform: translateX(-50%) translateY(-8px);+ background: var(--toolbar-menu-bg);+ color: var(--text);+ border: 1px solid var(--toolbar-border);+ padding: 0.5rem 1rem;+ border-radius: 0.5rem;+ font-family: inherit;+ font-size: 0.75rem;+ opacity: 0;+ transition: opacity 0.2s, transform 0.2s;+ z-index: 200;+ pointer-events: none;+ box-shadow: 0 4px 20px rgba(0,0,0,0.25);+ }+ .archify-toast.show {+ opacity: 1;+ transform: translateX(-50%) translateY(0);+ }++ @media (max-width: 720px) {+ body { padding: 1rem; }+ .toolbar .preset-menu,+ .toolbar .export-menu {+ position: fixed;+ top: 4.5rem;+ right: 1rem;+ left: 1rem;+ width: auto;+ max-width: none;+ }+ .toolbar {+ position: relative;+ justify-content: flex-end;+ width: max-content;+ max-width: 100%;+ margin-left: auto;+ margin-bottom: 1rem;+ }+ .header { margin-bottom: 1.25rem; padding-right: 0; }+ html[data-preset="signal-flow"] .header,+ html[data-preset="blueprint"] .header,+ html[data-preset="editorial"] .header { padding-right: 0; }+ .header-row {+ gap: 0.75rem;+ align-items: flex-start;+ }+ html[data-preset="signal-flow"] .header-row,+ html[data-preset="blueprint"] .header-row,+ html[data-preset="editorial"] .header-row { flex-wrap: wrap; }+ html[data-preset="signal-flow"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ html[data-preset="blueprint"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ html[data-preset="editorial"] .header-row::after {+ margin-left: 0;+ order: 3;+ }+ h1 {+ font-size: 1.25rem;+ line-height: 1.25;+ }+ .subtitle {+ margin-left: 0;+ font-size: 0.8125rem;+ line-height: 1.55;+ }+ .diagram-container {+ padding: 0.75rem;+ border-radius: 0.75rem;+ }+ html:not([data-embed="true"]) .diagram-container {+ padding: 0.75rem 0.75rem 4.25rem;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] {+ overflow-x: auto;+ overflow-y: hidden;+ overscroll-behavior-x: contain;+ scrollbar-width: thin;+ scroll-behavior: smooth;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ min-width: 720px;+ }+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-nav,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .overview-map,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .focus-chip,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .route-probe,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .semantic-lens,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .diagram-guide,+ html:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] .node-finder {+ transform: translateX(var(--archify-scroll-x, 0px));+ }+ .diagram-nav { right: 0.5rem; bottom: 0.5rem; }+ .diagram-nav button {+ min-width: 2.75rem;+ height: 2.75rem;+ }+ .diagram-nav [data-view="reset"] { min-width: 3.75rem; }+ .diagram-nav [data-view="reset"][data-detail-visible] { min-width: 4.35rem; }+ .overview-map {+ right: 0.5rem;+ bottom: 3.7rem;+ width: min(10.25rem, calc(100% - 1rem));+ }+ .overview-map[data-docked="true"] {+ right: var(--archify-radar-right, 0.5rem);+ top: var(--archify-radar-top, 0.5rem);+ bottom: auto;+ transform: none !important;+ }+ .overview-map[data-docked="true"][data-dock-side="left"] {+ right: auto;+ left: var(--archify-radar-left, 0.5rem);+ }+ .overview-map-surface { height: 4rem; }+ .overview-map-feedback { right: 0.5rem; bottom: 3.7rem; }+ .semantic-lens {+ right: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ max-height: calc(100% - 4.2rem);+ }+ .semantic-lens[data-dock-side] { left: auto; right: 0.5rem; }+ .semantic-lens-kinds { max-height: min(12rem, 34vh); }+ .focus-chip {+ left: 0.5rem;+ top: 0.5rem;+ width: calc(100% - 1rem);+ max-width: none;+ }+ .relationship-lens-list { max-height: min(12rem, 38vh); }+ .relationship-lens-actions #btn-focus-relations { display: block; color: var(--database-stroke); }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-head { border-bottom-color: transparent; }+ .focus-chip:not([data-relations-expanded="true"]) .relationship-lens-list { display: none; }+ /* While a mobile reader previews one relationship, turn the full Lens+ into a compact peek card. This keeps the exact source and target on+ canvas instead of covering them with a long, scrollable list. */+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-list {+ max-height: none;+ padding: 0.35rem;+ overflow: hidden;+ }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group { margin: 0; }+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-group-title,+ .focus-chip[data-relationship-previewing="true"] .relationship-lens-row:not([data-preview-active="true"]) {+ display: none;+ }+ .node-finder {+ top: 0.5rem;+ left: 0.5rem;+ width: min(22rem, calc(100% - 1rem));+ max-height: calc(100% - 1rem);+ }+ .diagram-guide {+ top: 0.5rem;+ right: 0.5rem;+ left: 0.5rem;+ width: auto;+ max-height: calc(100% - 1rem);+ }+ .diagram-guide-head { padding: 0.62rem 0.7rem 0.52rem; }+ .diagram-guide-stats { padding: 0.42rem 0.7rem; }+ .diagram-guide-actions {+ grid-template-columns: 1fr;+ gap: 0.28rem;+ padding: 0.42rem;+ }+ .diagram-guide-action {+ min-height: 3.1rem;+ padding: 0.42rem 0.48rem;+ }+ .diagram-guide-action small {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .diagram-guide-index {+ width: 1.5rem;+ height: 1.5rem;+ }+ .diagram-guide-shortcuts { padding: 0.46rem 0.7rem 0.52rem; }+ .diagram-guide-action[data-guide-action="present"] { grid-column: auto; }+ .route-probe[data-guide-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .node-finder-results { max-height: min(16rem, 38vh); }+ .route-probe {+ left: 0.5rem;+ bottom: 3.7rem;+ width: calc(100% - 1rem);+ min-width: 0;+ }+ .route-probe[data-route-dock="top"] {+ top: 0.5rem;+ bottom: auto;+ }+ .route-probe[data-finder-open="true"] {+ visibility: hidden;+ pointer-events: none;+ }+ .route-probe-head { padding: 0.45rem 0.48rem 0.38rem; }+ .route-probe-path { padding: 0.35rem 0.48rem 0.2rem; }+ .route-probe-node { min-height: 2.75rem !important; }+ .route-journey-controls {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem minmax(0, 1fr);+ padding: 0.08rem 0.48rem 0.32rem;+ }+ .route-journey-controls button { min-height: 2.75rem; }+ .route-probe-status { padding: 0.05rem 0.48rem 0.38rem; }+ .route-probe-node { max-width: 7.5rem; }+ .guided-views {+ grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-view-actions {+ grid-column: 1 / -1;+ display: grid;+ grid-template-columns: repeat(3, minmax(0, 1fr));+ }+ .guided-views > #guided-view-prev,+ .guided-views > #guided-view-next {+ align-self: center;+ height: 2.75rem;+ }+ .guided-view-play,+ .guided-view-all,+ .guided-view-beat-link { min-height: 2.75rem; }+ .guided-view-copy small { white-space: normal; }+ .guided-story-caption { padding: 0.32rem 0.45rem; }+ .guided-story-caption-index { min-width: 2.9rem; padding-right: 0.42rem; }+ .guided-story-caption strong,+ .guided-story-caption small { white-space: normal; }+ .guided-story-caption-next { display: none; }+ .guided-view-trail { min-height: 2rem; }+ .guided-view-trail .guided-view-stop {+ min-height: 2rem;+ padding: 0.22rem 0.42rem 0.22rem 0.28rem;+ }+ .guided-view-handoff { max-width: min(9rem, 32vw); }+ .guided-view-index { padding-top: 0.35rem; }+ .guided-view-chapters {+ gap: 0.35rem;+ scroll-padding-inline: 0.2rem;+ }+ .guided-view-chapters li {+ flex: 0 0 min(14rem, 78vw);+ min-width: 0;+ }+ .guided-view-chapter { min-height: 2.75rem; }+ .guided-views[data-active-view="all"] {+ grid-template-columns: minmax(0, 1fr) auto;+ gap: 0.2rem;+ padding: 0.25rem;+ }+ .guided-views[data-active-view="all"] .guided-view-copy {+ grid-column: 1;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-actions {+ grid-column: 2;+ grid-row: 1;+ }+ .guided-views[data-active-view="all"] .guided-view-play {+ min-width: 6rem !important;+ min-height: 2.75rem;+ }+ .guided-views[data-active-view="all"] .guided-view-index {+ grid-column: 1 / -1;+ grid-row: 2;+ padding: 0.3rem 0.08rem 0;+ border-top: 1px solid color-mix(in srgb, var(--toolbar-border) 72%, transparent);+ border-left: 0;+ }+ html[data-embed="true"][data-share-playback="true"] .share-chapter-cue:not([hidden]),+ html[data-embed="true"][data-share-moment="true"] .share-chapter-cue:not([hidden]) {+ top: 0.5rem;+ grid-template-columns: auto minmax(0, 1fr);+ gap: 0.28rem 0.55rem;+ width: calc(100% - 1rem);+ min-height: 0;+ padding: 0.45rem 0.55rem 0.55rem;+ }+ html[data-embed="true"][data-share-playback="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ html[data-embed="true"][data-share-moment="true"] .diagram-container {+ padding-top: 4.25rem;+ }+ .share-chapter-index {+ min-width: 4.4rem;+ padding-right: 0.5rem;+ }+ .share-chapter-copy small { font-size: 0.46rem; }+ .share-chapter-route {+ grid-column: 1 / -1;+ font-size: 0.5rem;+ text-align: left;+ }+ .cards {+ grid-template-columns: 1fr;+ margin-top: 1rem;+ }+ html[data-present="true"]:not([data-embed="true"]) body { padding: 0.5rem; }+ html[data-present="true"]:not([data-embed="true"]) .container {+ gap: 0.5rem;+ height: calc(100dvh - 1rem);+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar {+ position: fixed;+ top: 0.5rem;+ right: 0.5rem;+ margin: 0;+ gap: 0.25rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .toolbar button {+ min-height: 2.75rem;+ padding: 0.42rem 0.58rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .header {+ min-height: 2.25rem;+ padding: 3.5rem 0 0;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row {+ min-height: 2.25rem;+ margin: 0;+ align-items: center;+ flex-wrap: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .header-row::after,+ html[data-present="true"]:not([data-embed="true"]) .pulse-dot,+ html[data-present="true"]:not([data-embed="true"]) .subtitle { display: none; }+ html[data-present="true"]:not([data-embed="true"]) h1 {+ flex: 1 1 auto;+ min-width: 0;+ max-width: 100%;+ overflow: hidden;+ font-size: 0.875rem;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-views {+ padding: 0.2rem;+ }+ html[data-present="true"]:not([data-embed="true"]) .guided-view-copy small { display: none; }+ html[data-present="true"]:not([data-embed="true"]) .guided-story-caption small { display: block; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container { padding: 0.5rem 0.5rem 3.75rem; }+ html[data-present="true"]:not([data-embed="true"]) .diagram-container[data-wide-diagram="true"] > svg {+ width: 720px;+ height: auto;+ min-width: 720px;+ }+ }++ @media (max-width: 420px) {+ .export-menu-section { grid-template-columns: 1fr; }+ .export-menu-heading,+ .toolbar .export-menu button[data-format="share-card"],+ .toolbar .export-menu button[data-action="route-share-card"],+ .toolbar .export-menu button[data-action="reach-share-card"] { grid-column: 1; }+ }++ @media (prefers-reduced-motion: reduce) {+ .guided-story-caption { animation: none !important; }+ .toolbar .preset-menu.open,+ .toolbar .export-menu.open { animation: none; }+ .toolbar-chevron { transition: none; }+ }++ @media (max-width: 360px) {+ .toolbar { gap: 0.25rem; }+ .toolbar button { padding-right: 0.58rem; padding-left: 0.58rem; }+ .toolbar #btn-motion { min-width: 4.4rem; padding-right: 0.58rem; padding-left: 0.58rem; }+ #theme-label, #preset-label, #present-label { display: none; }+ .guided-view-handoff { max-width: 6.5rem; }+ }++ /* ==========================================================+ SVG SEMANTIC CLASSES — use these instead of inline fill/stroke+ ========================================================== */+ .c-grid { stroke: var(--grid); fill: none; }+ .c-mask { fill: var(--mask); stroke: none; }++ .c-frontend { fill: var(--frontend-fill); stroke: var(--frontend-stroke); }+ .c-backend { fill: var(--backend-fill); stroke: var(--backend-stroke); }+ .c-database { fill: var(--database-fill); stroke: var(--database-stroke); }+ .c-cloud { fill: var(--cloud-fill); stroke: var(--cloud-stroke); }+ .c-security { fill: var(--security-fill); stroke: var(--security-stroke); }+ .c-messagebus { fill: var(--messagebus-fill); stroke: var(--messagebus-stroke); }+ .c-external { fill: var(--external-fill); stroke: var(--external-stroke); }++ /* Text helpers */+ .t-primary { fill: var(--text); }+ .t-muted { fill: var(--text-muted); }+ .t-dim { fill: var(--text-dim); }+ .t-frontend { fill: var(--frontend-stroke); }+ .t-backend { fill: var(--backend-stroke); }+ .t-database { fill: var(--database-stroke); }+ .t-cloud { fill: var(--cloud-stroke); }+ .t-security { fill: var(--security-stroke); }+ .t-messagebus { fill: var(--messagebus-stroke); }+ .t-external { fill: var(--external-stroke); }++ /* Semantic Sigils are small authored role stamps, not icons from a brand+ pack and not viewer controls. Prefix selectors with svg so the canonical+ export's SVG-only stylesheet collector keeps them automatically. */+ svg .semantic-sigil {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ opacity: 0.76;+ pointer-events: none;+ }+ svg .semantic-sigil > * { vector-effect: non-scaling-stroke; }+ svg .semantic-sigil .sigil-fill { fill: currentColor; stroke: none; }+ svg .s-frontend { color: var(--frontend-stroke); }+ svg .s-backend { color: var(--backend-stroke); }+ svg .s-database { color: var(--database-stroke); }+ svg .s-cloud { color: var(--cloud-stroke); }+ svg .s-security { color: var(--security-stroke); }+ svg .s-messagebus { color: var(--messagebus-stroke); }+ svg .s-external { color: var(--external-stroke); }++ /* Brand Marks are authored identity badges. Their color is contained+ inside one neutral plate so vendor color never replaces Archify's+ semantic node and relationship vocabulary. */+ svg .brand-mark { pointer-events: none; }+ svg .brand-mark-badge { fill: #fff; stroke: none; }+ svg .brand-mark-frame {+ fill: none;+ stroke: #cbd5e1;+ stroke-width: 0.8;+ vector-effect: non-scaling-stroke;+ }+ svg .brand-mark-fallback {+ fill: none;+ stroke: #475569;+ stroke-width: 1.15;+ stroke-linecap: round;+ stroke-linejoin: round;+ }+ svg[data-preset="blueprint"] .brand-mark-badge,+ svg[data-preset="blueprint"] .brand-mark-frame { rx: 1px; }++ /* Reading Depth is a viewer-only level-of-detail layer. MAP preserves the+ authored structure and primary labels, READ restores relationship labels+ and node context, and FULL restores tags and fine annotations. Semantic+ intent can reveal the relevant detail without moving any geometry. */+ svg [data-detail] { transition: opacity 160ms ease; }+ svg [data-detail-anchor] {+ transform-box: fill-box;+ transform-origin: center;+ transition: transform 160ms ease;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail="context"],+ .diagram-container[data-detail-level="map"] svg [data-detail="fine"],+ .diagram-container[data-detail-level="read"] svg [data-detail="fine"] {+ opacity: 0;+ pointer-events: none;+ }+ .diagram-container[data-detail-level="map"] svg [data-detail-anchor] {+ transform: translateY(8px);+ }++ /* Focus, lens, preview, route, and story states are stronger reader intent than+ the global zoom level. Reveal only their exact semantic matches. */+ svg[data-focus-active] [data-focus-match][data-detail],+ svg[data-focus-active] [data-focus-match] [data-detail],+ svg[data-reach-active] [data-reach-match][data-detail],+ svg[data-reach-active] [data-reach-match] [data-detail],+ svg[data-lens-active] [data-lens-match][data-detail],+ svg[data-lens-active] [data-lens-match] [data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match][data-detail],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match][data-detail],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail],+ svg[data-route-active] [data-route-match][data-detail],+ svg[data-route-active] [data-route-match] [data-detail],+ svg[data-story-active] [data-story-step][data-detail],+ svg[data-story-active] [data-story-step] [data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview][data-detail],+ svg[data-relationship-preview-active] [data-relationship-preview] [data-detail],+ svg [data-node-id]:hover [data-detail],+ svg [data-node-id]:focus-visible [data-detail] {+ opacity: 1;+ pointer-events: auto;+ }+ svg[data-focus-active] [data-focus-match] [data-detail-anchor],+ svg[data-reach-active] [data-reach-match] [data-detail-anchor],+ svg[data-lens-active] [data-lens-match] [data-detail-anchor],+ svg[data-legend-preview-active] [data-legend-preview-match] [data-detail-anchor],+ svg[data-intent-trace-active] [data-intent-trace-match] [data-detail-anchor],+ svg[data-route-active] [data-route-match] [data-detail-anchor],+ svg[data-story-active] [data-story-step] [data-detail-anchor],+ svg [data-node-id]:hover [data-detail-anchor],+ svg [data-node-id]:focus-visible [data-detail-anchor] { transform: none; }++ /* Arrows */+ .a-default { stroke: var(--arrow); fill: none; }+ .a-emphasis { stroke: var(--arrow-emphasis); fill: none; }+ .a-security { stroke: var(--security-stroke); fill: none; stroke-dasharray: 5,5; }+ .a-dashed { stroke: var(--database-stroke); fill: none; stroke-dasharray: 4,4; }++ /* Arrowhead markers reference these */+ .m-default { fill: var(--arrow); }+ .m-emphasis { fill: var(--arrow-emphasis); }+ .m-security { fill: var(--security-stroke); }+ .m-dashed { fill: var(--database-stroke); }++ /* Stable semantic exploration hooks emitted by every renderer. */+ svg [data-node-id] {+ cursor: pointer;+ transition: opacity 0.18s ease, filter 0.18s ease;+ }+ svg [data-edge-from] { transition: opacity 0.18s ease, filter 0.18s ease; }+ svg [data-node-id]:hover,+ svg [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ outline: none;+ }+ /* Verified Source Beacons are installed at runtime only for nodes whose+ repository evidence passed the local revision/blob/line checks. They+ live inside the owning node so every focus, route, story, and guided+ view keeps one coherent opacity state. Export serialization removes+ them before producing the canonical SVG or any derived visual. */+ .source-evidence-beacon {+ pointer-events: none;+ opacity: 0.76;+ transition: opacity 160ms ease, filter 160ms ease;+ }+ .source-evidence-beacon rect {+ fill: color-mix(in srgb, var(--mask) 92%, var(--backend-stroke));+ stroke: color-mix(in srgb, var(--backend-stroke) 82%, var(--panel-border));+ stroke-width: 1;+ vector-effect: non-scaling-stroke;+ }+ .source-evidence-beacon text {+ fill: var(--backend-stroke);+ font-size: 5.5px;+ font-weight: 800;+ letter-spacing: 0.06em;+ text-anchor: middle;+ text-transform: uppercase;+ }+ svg [data-node-id]:hover .source-evidence-beacon,+ svg [data-node-id]:focus-visible .source-evidence-beacon,+ svg [data-node-id][data-focus-selected] .source-evidence-beacon {+ opacity: 1;+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));+ }+ svg[data-preset="signal-flow"] .source-evidence-beacon { opacity: 0.9; }+ svg[data-preset="blueprint"] .source-evidence-beacon rect {+ rx: 0.8px;+ filter: none;+ }+ svg [data-legend-kind][role="button"] { cursor: pointer; }+ svg [data-legend-kind]:focus { outline: none; }+ svg [data-legend-hit] {+ fill: transparent;+ stroke: transparent;+ stroke-width: 1.4;+ pointer-events: all;+ vector-effect: non-scaling-stroke;+ transition: stroke 150ms ease, stroke-width 150ms ease, filter 150ms ease;+ }+ svg [data-legend-count-badge] { pointer-events: none; }+ svg [data-legend-count-badge] rect {+ fill: var(--mask);+ stroke: var(--panel-border);+ stroke-width: 1;+ vector-effect: non-scaling-stroke;+ }+ svg [data-legend-count-badge] text {+ fill: var(--text-muted);+ font-size: 8px;+ font-weight: 700;+ text-anchor: middle;+ }+ svg [data-legend-kind][role="button"]:hover [data-legend-hit] {+ stroke: color-mix(in srgb, var(--database-stroke) 58%, transparent);+ }+ svg [data-legend-kind][role="button"]:focus-visible [data-legend-hit] {+ stroke: var(--frontend-stroke);+ stroke-width: 1.8;+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-hit] {+ stroke: var(--database-stroke);+ stroke-width: 2.2;+ stroke-dasharray: 3 2;+ }+ svg [data-legend-kind][data-legend-selected] [data-legend-count-badge] rect {+ stroke: var(--database-stroke);+ stroke-width: 1.8;+ }+ svg [data-legend-kind][data-legend-zero] { opacity: 0.44; }+ svg[data-preset="signal-flow"] [data-legend-kind][data-legend-selected] [data-legend-hit] {+ filter: drop-shadow(0 0 4px var(--database-stroke));+ }+ svg[data-preset="blueprint"] [data-legend-hit],+ svg[data-preset="blueprint"] [data-legend-count-badge] rect { rx: 0; filter: none; }+ svg[data-legend-preview-active] [data-node-id],+ svg[data-legend-preview-active] [data-edge-from] { opacity: 0.11; }+ svg[data-legend-preview-active] [data-legend-preview-match] { opacity: 1; }+ svg[data-legend-preview-active] [data-legend-preview-peer] { opacity: 0.62; }+ svg[data-legend-preview-active] [data-legend-preview-selected] {+ filter: drop-shadow(0 0 8px var(--database-stroke));+ }+ svg[data-lens-active] [data-node-id],+ svg[data-lens-active] [data-edge-from] { opacity: 0.11; }+ svg[data-lens-active] [data-lens-match] { opacity: 1; }+ svg[data-lens-active] [data-lens-peer] { opacity: 0.62; }+ svg[data-lens-active] [data-lens-selected] {+ filter: drop-shadow(0 0 10px var(--database-stroke));+ }+ .semantic-lens-overlay { pointer-events: none; }+ .semantic-lens-flow {+ fill: none;+ stroke-width: 3.05;+ stroke-linecap: round;+ stroke-dasharray: 0.075 0.925;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.9;+ animation: archify-semantic-lens-flow 1.35s linear 1 both;+ animation-delay: var(--lens-flow-delay, 0s);+ }+ .semantic-lens-flow[data-direction="out"],+ .semantic-lens-flow[data-direction="forward"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ .semantic-lens-flow[data-direction="in"],+ .semantic-lens-flow[data-direction="reverse"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 3px var(--database-stroke));+ }+ .semantic-lens-flow[data-direction="within"] {+ stroke: var(--messagebus-stroke);+ filter: drop-shadow(0 0 3px var(--messagebus-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow {+ stroke-width: 3.7;+ opacity: 1;+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="out"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="forward"] {+ filter: drop-shadow(0 0 6px var(--frontend-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="in"],+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="reverse"] {+ filter: drop-shadow(0 0 6px var(--database-stroke));+ }+ svg[data-preset="signal-flow"] .semantic-lens-flow[data-direction="within"] {+ filter: drop-shadow(0 0 6px var(--messagebus-stroke));+ }+ svg[data-preset="blueprint"] .semantic-lens-flow {+ stroke-width: 2.45;+ stroke-linecap: square;+ filter: none;+ opacity: 0.78;+ }+ html[data-embed="true"] .semantic-lens-overlay { display: none; }+ svg[data-focus-active] [data-node-id],+ svg[data-focus-active] [data-edge-from] { opacity: 0.13; }+ svg[data-focus-active] [data-focus-match] { opacity: 1; }+ svg[data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }++ /* Authored Reachability is a bounded graph query over the relationships+ already present in the artifact. Upstream walks incoming edges;+ downstream walks outgoing edges. It never claims runtime causality and+ changes only viewer emphasis, not canonical geometry or export bytes. */+ svg[data-reach-active] [data-node-id],+ svg[data-reach-active] [data-edge-from] { opacity: 0.09; }+ svg[data-reach-active] [data-reach-match] { opacity: 1; }+ svg[data-reach-active="upstream"] [data-reach-origin] {+ filter: drop-shadow(0 0 11px var(--database-stroke));+ }+ svg[data-reach-active="downstream"] [data-reach-origin] {+ filter: drop-shadow(0 0 11px var(--backend-stroke));+ }+ svg[data-reach-active="upstream"] [data-edge-from][data-reach-match] {+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--database-stroke) 72%, transparent));+ }+ svg[data-reach-active="downstream"] [data-edge-from][data-reach-match] {+ filter: drop-shadow(0 0 4px color-mix(in srgb, var(--backend-stroke) 72%, transparent));+ }+ svg[data-preset="blueprint"][data-reach-active] [data-reach-origin],+ svg[data-preset="blueprint"][data-reach-active] [data-edge-from][data-reach-match] {+ filter: none;+ }++ /* Direct Relationship Explorer makes authored paths a real input surface+ without changing their visible stroke or canonical SVG. A transparent+ runtime rail supplies forgiving pointer geometry; the exact authored+ path and endpoints continue to carry every visible state. */+ .relationship-hit-overlay { pointer-events: none; }+ .relationship-hit-target { outline: none; }+ .relationship-hit-rail {+ fill: none;+ stroke: transparent;+ stroke-width: 24;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: stroke;+ cursor: pointer;+ }+ .relationship-focus-rail {+ fill: none;+ stroke: color-mix(in srgb, var(--frontend-stroke) 34%, transparent);+ stroke-width: 6;+ stroke-dasharray: 2 4;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ pointer-events: none;+ opacity: 0;+ }+ .relationship-hit-target:focus-visible .relationship-focus-rail {+ opacity: 1;+ }+ svg[data-preset="blueprint"] .relationship-hit-target:focus-visible .relationship-focus-rail {+ stroke-linecap: square;+ filter: none;+ }+ svg[data-relationship-direct-active] [data-node-id],+ svg[data-relationship-direct-active] [data-edge-from] { opacity: 0.16; }+ svg[data-relationship-direct-active] [data-relationship-preview],+ svg[data-relationship-direct-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-focus-active]:not([data-relationship-pin-active]) .relationship-hit-rail,+ svg[data-story-active] .relationship-hit-rail,+ svg[data-route-picking] .relationship-hit-rail,+ svg[data-route-active] .relationship-hit-rail,+ svg[data-lens-active] .relationship-hit-rail,+ svg[data-chapter-preview] .relationship-hit-rail { pointer-events: none; }+ html[data-embed="true"] .relationship-hit-overlay { display: none; }+ @media (hover: none), (pointer: coarse) {+ .relationship-hit-rail { stroke-width: 24; }+ }++ /* Relationship Preview is temporary exploration state layered on top of+ neighborhood focus. It changes emphasis only; exported geometry and the+ relationship's original solid/dashed visual language stay untouched. */+ svg[data-relationship-preview-active] [data-focus-match] { opacity: 0.18; }+ svg[data-relationship-preview-active] [data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview-node] { opacity: 1; }+ svg[data-relationship-preview-active] [data-relationship-preview] {+ filter: drop-shadow(0 0 5px var(--arrow-emphasis));+ }+ svg[data-relationship-preview-active] [data-relationship-preview] path,+ svg[data-relationship-preview-active] path[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] line,+ svg[data-relationship-preview-active] line[data-relationship-preview],+ svg[data-relationship-preview-active] [data-relationship-preview] polyline,+ svg[data-relationship-preview-active] polyline[data-relationship-preview] {+ stroke-width: 2.75;+ }+ svg[data-relationship-preview-active] [data-relationship-preview-source] {+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 7px var(--database-stroke));+ }+ .relationship-pulse-overlay { pointer-events: none; }+ .relationship-flow-pulse {+ fill: none;+ stroke: var(--arrow-emphasis);+ stroke-width: 3.35;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 4px var(--arrow-emphasis));+ animation: archify-relationship-pulse 1.2s linear 1 both;+ }+ svg[data-preset="signal-flow"] .relationship-flow-pulse {+ stroke: var(--frontend-stroke);+ stroke-width: 3.85;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"] .relationship-flow-pulse {+ stroke-width: 2.5;+ stroke-linecap: square;+ filter: none;+ }+ svg[data-preset="editorial"] .relationship-flow-pulse {+ stroke: var(--arrow-emphasis);+ stroke-width: 2.75;+ filter: none;+ }+ .semantic-flow-token {+ color: var(--frontend-stroke);+ opacity: 0;+ pointer-events: none;+ }+ .relationship-flow-token {+ animation: archify-relationship-token-life 1.2s linear 1 both;+ }+ .story-flow-token {+ animation: archify-relationship-token-life 0.78s linear 1 both;+ }+ .semantic-flow-token-halo {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.1;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ }+ .relationship-flow-token-shape {+ fill: var(--mask);+ stroke: currentColor;+ stroke-width: 1.35;+ stroke-linecap: round;+ stroke-linejoin: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-ink {+ fill: none;+ stroke: currentColor;+ stroke-width: 1.05;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ }+ .relationship-flow-token-dot { fill: currentColor; stroke: none; }+ .semantic-flow-token[data-token-kind="data"] { color: var(--database-stroke); }+ .semantic-flow-token[data-token-kind="event"] { color: var(--messagebus-stroke); }+ .semantic-flow-token[data-token-kind="security"] { color: var(--security-stroke); }+ .semantic-flow-token[data-token-kind="state"] { color: var(--cloud-stroke); }+ svg[data-preset="signal-flow"] .semantic-flow-token {+ filter: drop-shadow(0 0 5px currentColor);+ }+ svg[data-preset="blueprint"] .semantic-flow-token { filter: none; }+ svg[data-preset="editorial"] .semantic-flow-token { filter: none; }+ html[data-embed="true"] .relationship-pulse-overlay { display: none; }++ /* Intent Trace is a temporary, pre-click exploration layer. Related+ topology stays readable while a short viewer-only signal runs over+ cloned edge geometry; the authored edge remains untouched underneath. */+ svg[data-intent-trace-active] [data-node-id],+ svg[data-intent-trace-active] [data-edge-from] { opacity: 0.2; }+ svg[data-intent-trace-active] [data-intent-trace-match] { opacity: 1; }+ svg[data-intent-trace-active] [data-intent-trace-selected] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ .intent-trace-overlay { pointer-events: none; }+ .intent-trace-flow {+ fill: none;+ stroke-width: 3.1;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.94;+ animation: archify-intent-trace-flow 1.15s linear 1 both;+ }+ /* Direction names describe each edge relative to the focused node only.+ The cloned geometry already runs from the authored source to target, so+ incoming and outgoing signals must share the same playback direction. */+ .intent-trace-flow[data-direction="out"] {+ stroke: var(--frontend-stroke);+ filter: drop-shadow(0 0 4px var(--frontend-stroke));+ }+ .intent-trace-flow[data-direction="in"] {+ stroke: var(--database-stroke);+ filter: drop-shadow(0 0 4px var(--database-stroke));+ animation-direction: normal;+ }+ .intent-trace-flow[data-direction="loop"] {+ stroke: var(--security-stroke);+ filter: drop-shadow(0 0 4px var(--security-stroke));+ }+ svg[data-preset="blueprint"] [data-intent-trace-selected],+ svg[data-preset="blueprint"] .intent-trace-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="editorial"] [data-intent-trace-selected],+ svg[data-preset="editorial"] .intent-trace-flow { filter: none; }+ .intent-trace-status {+ position: absolute;+ width: 1px;+ height: 1px;+ padding: 0;+ margin: -1px;+ overflow: hidden;+ clip: rect(0, 0, 0, 0);+ clip-path: inset(50%);+ white-space: nowrap;+ border: 0;+ }++ /* Route Probe separates a durable two-point query from selection and+ one-hop hover. Only the chosen shortest directed path stays prominent;+ the traveling signal is cloned viewer geometry and never authored SVG. */+ svg[data-route-picking="target"] [data-node-id] { opacity: 0.24; }+ svg[data-route-picking="target"] [data-route-candidate],+ svg[data-route-picking="target"] [data-route-start] { opacity: 1; }+ svg[data-route-picking] [data-node-id] { cursor: crosshair; }+ svg[data-route-picking] [data-route-start] {+ filter: drop-shadow(0 0 10px var(--frontend-stroke));+ }+ svg[data-route-active] [data-node-id],+ svg[data-route-active] [data-edge-from] { opacity: 0.11; }+ svg[data-route-active] [data-route-match] { opacity: 1; }+ svg[data-route-active] [data-route-start] {+ filter: drop-shadow(0 0 11px var(--frontend-stroke));+ }+ svg[data-route-active] [data-route-end] {+ filter: drop-shadow(0 0 11px var(--security-stroke));+ }+ svg[data-route-active] [data-route-step]:not([data-route-start]):not([data-route-end]) {+ filter: drop-shadow(0 0 7px var(--backend-stroke));+ }+ svg[data-route-journey] [data-route-match][data-route-journey-state="past"] { opacity: 0.62; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="future"] { opacity: 0.34; }+ svg[data-route-journey] [data-route-match][data-route-journey-state="current"] { opacity: 1; }+ svg[data-route-journey] [data-node-id][data-route-journey-current] {+ filter: drop-shadow(0 0 10px var(--backend-stroke));+ }+ svg[data-route-journey] [data-edge-from][data-route-journey-current] {+ opacity: 1;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ }+ .route-probe-overlay { pointer-events: none; }+ .route-journey-overlay { pointer-events: none; }+ .route-probe-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.25;+ stroke-linecap: round;+ stroke-dasharray: 0.085 0.915;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0.96;+ filter: drop-shadow(0 0 5px var(--backend-stroke));+ animation: archify-route-probe-flow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ animation-delay: calc(var(--route-step, 0) * 0.16s);+ }+ .route-journey-flow {+ fill: none;+ stroke: var(--backend-stroke);+ stroke-width: 3.5;+ stroke-linecap: round;+ stroke-dasharray: 0.1 0.9;+ stroke-dashoffset: 0;+ vector-effect: non-scaling-stroke;+ opacity: 0;+ filter: drop-shadow(0 0 6px var(--backend-stroke));+ animation: archify-route-journey-flow 780ms cubic-bezier(0.22, 1, 0.36, 1) 1 both;+ }+ svg[data-preset="blueprint"] [data-route-start],+ svg[data-preset="blueprint"] [data-route-end],+ svg[data-preset="blueprint"] [data-route-step],+ svg[data-preset="blueprint"] .route-probe-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="blueprint"] .route-journey-flow {+ filter: none;+ stroke-linecap: square;+ }+ svg[data-preset="editorial"] [data-route-start],+ svg[data-preset="editorial"] [data-route-end],+ svg[data-preset="editorial"] [data-route-step],+ svg[data-preset="editorial"] .route-probe-flow,+ svg[data-preset="editorial"] .route-journey-flow { filter: none; }++ svg[data-preset="editorial"] .c-grid {+ stroke-dasharray: 1 4;+ opacity: 0.48;+ }+ svg[data-preset="editorial"] .c-region {+ fill: color-mix(in srgb, var(--cloud-fill) 48%, transparent);+ stroke-dasharray: 9 4;+ }+ svg[data-preset="editorial"] [data-node-id]:hover,+ svg[data-preset="editorial"] [data-node-id]:focus-visible,+ svg[data-preset="editorial"][data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent));+ }++ svg[data-preset="blueprint"] .c-grid {+ stroke-dasharray: 1 3;+ opacity: 0.78;+ }+ svg[data-preset="blueprint"] .c-region {+ fill: color-mix(in srgb, var(--cloud-fill) 58%, transparent);+ stroke-dasharray: 12 4 2 4;+ }+ svg[data-preset="blueprint"] .c-security-group,+ svg[data-preset="blueprint"] .c-lane { stroke-dasharray: 7 3; }+ svg[data-preset="blueprint"] [data-node-id]:hover,+ svg[data-preset="blueprint"] [data-node-id]:focus-visible {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-focus-active] [data-focus-selected] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }+ svg[data-preset="blueprint"][data-focus-active][data-reach-active] [data-focus-selected][data-reach-origin] {+ filter: none;+ }+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-source],+ svg[data-preset="blueprint"][data-relationship-preview-active] [data-relationship-preview-target] {+ filter: drop-shadow(0 0 3px var(--frontend-stroke));+ }++ /* Story Trail is a viewer-only overlay derived from the ordered focus IDs+ of the active guided view. The authored edge stays underneath with its+ original color, dash pattern, marker, and geometry intact. */+ .story-trail-overlay { pointer-events: none; }+ .story-carrier-overlay { pointer-events: none; }+ .story-trail-flow {+ fill: none;+ stroke: var(--frontend-stroke);+ stroke-width: 2.8;+ stroke-linecap: round;+ vector-effect: non-scaling-stroke;+ opacity: 0.34;+ filter: drop-shadow(0 0 2px var(--frontend-stroke));+ }+ svg[data-story-beat] [data-story-step] {+ opacity: 0.22;+ filter: saturate(0.42);+ transition: opacity 180ms ease, filter 180ms ease;+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="past"] {+ opacity: 0.72;+ filter: saturate(0.82);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="next"] {+ opacity: 0.5;+ filter: saturate(0.66);+ }+ svg[data-story-beat] [data-story-step][data-story-beat-state="active"] {+ opacity: 1;+ filter: drop-shadow(0 0 7px var(--frontend-stroke));+ animation: archify-story-beat-node 360ms cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step] {+ opacity: 0.16;+ transition: opacity 160ms ease;+ }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="past"] { opacity: 0.58; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="next"] { opacity: 0.34; }+ svg[data-story-beat] [data-edge-from][data-story-beat-step][data-story-beat-state="active"] { opacity: 1; }+ svg[data-story-beat] .story-trail-flow { opacity: 0; transition: opacity 160ms ease; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="past"] { opacity: 0.34; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="next"] { opacity: 0.2; }+ svg[data-story-beat] .story-trail-flow[data-story-beat-state="active"] { opacity: 0.92; }+ svg[data-story-beat] .story-trail-flow[data-story-pulse="true"] {+ stroke-dasharray: 2 13;+ stroke-dashoffset: 30;+ opacity: 0.92;+ animation: archify-story-flow 0.78s linear 1 both;+ }+ svg[data-preset="blueprint"] .story-trail-flow {+ stroke-linecap: square;+ filter: none;+ opacity: 0.5;+ }+ svg[data-preset="blueprint"][data-story-beat] [data-story-step][data-story-beat-state="active"] {+ filter: none;+ animation: none;+ }+ svg[data-preset="editorial"] .story-trail-flow { filter: none; }+ svg[data-preset="editorial"][data-story-beat] [data-story-step][data-story-beat-state="active"] {+ filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 16%, transparent));+ }++ /* Chapter Delta Preview is a static, pre-commit comparison between two+ chapter focus sets. Symbols in the rail carry the meaning without color;+ these SVG rules only make exact stable-ID membership easier to scan. */+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] {+ opacity: 0.1 !important;+ filter: none !important;+ transition: none !important;+ }+ svg[data-chapter-preview] .story-trail-overlay { opacity: 0.08 !important; }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="stay"] {+ opacity: 0.76 !important;+ filter: saturate(0.7) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="enter"] {+ opacity: 1 !important;+ filter: saturate(1.2) !important;+ }+ svg[data-chapter-preview] [data-node-id][data-chapter-preview-role="leave"] {+ opacity: 0.28 !important;+ filter: grayscale(0.72) !important;+ }+ svg[data-preset="blueprint"][data-chapter-preview] [data-node-id] { filter: none !important; }++ /* Dashed boundary variants */+ .c-security-group { fill: transparent; stroke: var(--security-stroke); stroke-dasharray: 4,4; }+ .c-region { fill: rgba(251, 191, 36, 0.05); stroke: var(--cloud-stroke); stroke-dasharray: 8,4; }+ .c-lane { fill: var(--lane-fill); stroke: var(--lane-stroke); stroke-dasharray: 6,6; }++ /* Optional trace animation, enabled only by meta.animation = "trace".+ The ordinary viewer performs one ambient pass and then restores the+ authored solid/security/async line language. WebM samples the same+ authored geometry into an explicit canvas timeline. */+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="edge"] {+ animation: archify-edge-flow 2.4s linear 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ html[data-ambient-motion="running"] svg[data-animation="trace"] [data-animate="node"] {+ transform-box: fill-box;+ transform-origin: center;+ animation: archify-node-pulse 3.6s ease-in-out 1;+ animation-delay: calc(var(--step, 0) * 160ms);+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: round;+ filter: drop-shadow(0 0 3px var(--arrow-emphasis));+ animation-duration: 1.75s;+ }+ svg[data-preset="signal-flow"][data-animation="trace"] [data-animate="node"] {+ animation-duration: 3.1s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="edge"] {+ stroke-linecap: square;+ filter: none;+ animation-duration: 2.15s;+ }+ svg[data-preset="blueprint"][data-animation="trace"] [data-animate="node"] {+ animation-name: archify-blueprint-node-pulse;+ animation-duration: 3.8s;+ }+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="edge"] {+ filter: none;+ animation-duration: 2.2s;+ }+ svg[data-preset="editorial"][data-animation="trace"] [data-animate="node"] {+ animation-name: archify-editorial-node-pulse;+ animation-duration: 3.5s;+ }+ /* Embedded proofs are static until a named Story Trail chapter is played.+ This keeps proof grids calm and ensures ?play=1 stops all viewer motion+ after one 3.2 second chapter instead of leaving ambient trace loops on. */+ html[data-embed="true"] svg[data-animation="trace"] [data-animate],+ html[data-share-playback="true"] svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ @keyframes archify-edge-flow {+ 0% { stroke-dasharray: 10 8; stroke-dashoffset: 54; opacity: 0.42; }+ 88% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 99.9% { stroke-dasharray: 10 8; stroke-dashoffset: 0; opacity: 1; }+ 100% { stroke-dashoffset: 0; opacity: 1; }+ }+ @keyframes archify-node-pulse {+ 0%, 72%, 100% { filter: none; stroke-width: 1.5; }+ 18%, 36% {+ filter: drop-shadow(0 0 8px var(--arrow-emphasis));+ stroke-width: 2.4;+ }+ }+ @keyframes archify-blueprint-node-pulse {+ 0%, 72%, 100% { opacity: 1; filter: none; }+ 18%, 36% { opacity: 0.72; filter: drop-shadow(0 0 2px var(--frontend-stroke)); }+ }+ @keyframes archify-editorial-node-pulse {+ 0%, 72%, 100% { opacity: 1; filter: none; }+ 18%, 36% { opacity: 0.78; filter: drop-shadow(0 2px 2px color-mix(in srgb, var(--text) 18%, transparent)); }+ }+ @keyframes archify-signal-scan {+ 0%, 18% { opacity: 1; transform: translateX(-70%); }+ 70% { opacity: 1; transform: translateX(70%); }+ 100% { opacity: 0; transform: translateX(70%); }+ }+ @keyframes archify-radar-live {+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--backend-stroke) 52%, transparent); }+ 55%, 100% { box-shadow: 0 0 0 0.32rem transparent; }+ }+ @keyframes archify-guided-progress {+ from { transform: scaleX(var(--guided-progress-start, 0)); }+ to { transform: scaleX(1); }+ }+ @keyframes archify-story-flow {+ to { stroke-dashoffset: 0; }+ }+ @keyframes archify-intent-trace-flow {+ 0% { opacity: 0.28; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.94; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-route-probe-flow {+ 0% { stroke-dashoffset: 0; opacity: 0.96; }+ 78% { stroke-dashoffset: -1; opacity: 0.96; }+ 100% { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0.58; }+ }+ @keyframes archify-route-journey-flow {+ 0% { opacity: 0.16; stroke-dashoffset: 0; }+ 14%, 76% { opacity: 1; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-semantic-lens-flow {+ 0% { opacity: 0.2; stroke-dashoffset: 0; }+ 12%, 78% { opacity: 0.9; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-pulse {+ 0% { opacity: 0.18; stroke-dashoffset: 0; }+ 10%, 76% { opacity: 0.98; }+ 100% { opacity: 0; stroke-dashoffset: -1; }+ }+ @keyframes archify-relationship-token-life {+ 0%, 7% { opacity: 0; }+ 13%, 82% { opacity: 1; }+ 100% { opacity: 0; }+ }+ @keyframes archify-story-beat-node {+ from { opacity: 0.48; filter: saturate(0.6); }+ 58% { opacity: 1; filter: drop-shadow(0 0 10px var(--frontend-stroke)); }+ to { opacity: 1; filter: drop-shadow(0 0 7px var(--frontend-stroke)); }+ }+ @keyframes archify-share-cue-enter {+ from { opacity: 0; transform: translate(-50%, -0.45rem); }+ to { opacity: 1; transform: translate(-50%, 0); }+ }+ @keyframes archify-share-cue-pulse {+ 0%, 100% { opacity: 1; transform: scale(1); }+ 50% { opacity: 0.48; transform: scale(0.78); }+ }+ @media (prefers-reduced-motion: reduce) {+ html[data-preset="signal-flow"] .diagram-container::before {+ animation: none !important;+ }+ .pulse-dot { animation: none !important; }+ svg[data-animation="trace"] [data-animate] {+ animation: none !important;+ stroke-dashoffset: 0;+ }+ .guided-view-progress span {+ animation: none !important;+ transform: scaleX(1) !important;+ }+ .story-trail-flow,+ .intent-trace-flow,+ .route-probe-flow,+ .semantic-lens,+ .diagram-guide,+ [data-story-step],+ .overview-map-live,+ .guided-view-stop,+ .share-chapter-cue,+ .chapter-handoff-anchor,+ .share-chapter-state::before,+ .share-chapter-progress span { animation: none !important; }+ .guided-view-chapter,+ svg[data-chapter-preview] [data-node-id],+ svg[data-chapter-preview] [data-edge-from] { transition: none !important; }+ svg[data-story-playing="true"] .story-trail-flow {+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.55;+ }+ .intent-trace-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.72;+ }+ .route-probe-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-dashoffset: 0;+ opacity: 0.78;+ }+ .route-journey-overlay,+ .story-carrier-overlay { display: none !important; }+ .semantic-lens-flow {+ animation: none !important;+ stroke-dasharray: none;+ stroke-width: 2.2;+ opacity: 0.34;+ filter: none;+ }+ .relationship-pulse-overlay { display: none !important; }+ .guided-view-chapter { transition: none !important; }+ .source-evidence-beacon,+ svg [data-node-id], svg [data-edge-from], svg [data-detail], svg [data-detail-anchor], svg [data-legend-hit], svg { transition: none !important; }+ }+ </style>+</head>+<body>+ <!-- Toolbar: theme, live visual style, trace motion, presentation stage, and export.+ Motion appears only for trace-enabled artifacts and has no shortcut;+ Keyboard: T toggles theme, S cycles style, F toggles the stage, E opens export. -->+ <div class="toolbar" role="toolbar" aria-label="图表操作">+ <button id="btn-theme" type="button"+ title="切换主题(T)"+ aria-label="切换颜色主题"+ aria-pressed="false">+ <span id="theme-icon" class="toolbar-icon" aria-hidden="true"></span>+ <span id="theme-label">深色</span>+ </button>+ <div class="preset-wrap">+ <button id="btn-preset" type="button"+ title="选择视觉风格(S 循环切换)"+ aria-label="选择视觉风格"+ aria-haspopup="menu"+ aria-expanded="false"+ aria-controls="preset-menu"+ aria-keyshortcuts="S">+ <span class="preset-control-mark" aria-hidden="true"></span>+ <span id="preset-label">风格</span>+ <span class="toolbar-icon toolbar-chevron" aria-hidden="true"></span>+ </button>+ <div class="preset-menu" id="preset-menu" role="menu" aria-label="视觉风格">+ <div class="preset-menu-heading" role="presentation"><span>视觉表达</span><span>S 循环切换</span></div>+ <button class="preset-option" data-preset-value="classic" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">+ <span class="preset-option-swatch classic" aria-hidden="true"></span>+ <span class="preset-option-copy"><strong>经典</strong><small>稳定的技术默认风格</small></span>+ <span class="preset-option-check" aria-hidden="true"></span>+ </button>+ <button class="preset-option" data-preset-value="signal-flow" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">+ <span class="preset-option-swatch signal-flow" aria-hidden="true"></span>+ <span class="preset-option-copy"><strong>信号流</strong><small>突出动态流向</small></span>+ <span class="preset-option-check" aria-hidden="true"></span>+ </button>+ <button class="preset-option" data-preset-value="blueprint" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">+ <span class="preset-option-swatch blueprint" aria-hidden="true"></span>+ <span class="preset-option-copy"><strong>蓝图</strong><small>工程评审</small></span>+ <span class="preset-option-check" aria-hidden="true"></span>+ </button>+ <button class="preset-option" data-preset-value="editorial" type="button" role="menuitemradio" aria-checked="false" tabindex="-1">+ <span class="preset-option-swatch editorial" aria-hidden="true"></span>+ <span class="preset-option-copy"><strong>编辑风格</strong><small>适合发布与上线说明</small></span>+ <span class="preset-option-check" aria-hidden="true"></span>+ </button>+ </div>+ </div>+ <button id="btn-motion" type="button" hidden+ title="暂停动效"+ aria-label="暂停动效"+ aria-pressed="true">+ <span class="motion-control-dot" aria-hidden="true"></span>+ <span id="motion-label">动态</span>+ </button>+ <button id="btn-present" type="button"+ title="演示模式(F)"+ aria-label="进入演示模式"+ aria-pressed="false">+ <span id="present-icon" class="toolbar-icon" aria-hidden="true"></span>+ <span id="present-label">演示</span>+ </button>+ <div class="export-wrap">+ <button id="btn-export" type="button"+ title="导出图表(E)"+ aria-label="导出图表"+ aria-haspopup="menu"+ aria-expanded="false"+ aria-controls="export-menu">+ 导出 <span class="toolbar-icon toolbar-chevron" aria-hidden="true"></span>+ </button>+ <div class="export-menu" id="export-menu" role="menu" aria-label="导出">+ <div class="export-menu-header" role="presentation">+ <div><strong>导出图表</strong><span>便携、整洁的输出</span></div>+ <kbd>E</kbd>+ </div>+ <div class="export-menu-section" role="group" aria-label="分享">+ <span class="export-menu-heading" aria-hidden="true">分享</span>+ <button data-format="share-card" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>分享卡片</strong><small class="hint">1200×630 PNG</small></span></button>+ <button data-action="route-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled><span class="export-item-copy"><strong>路径分享卡片</strong><small class="hint">1200×630 PNG</small></span></button>+ <button data-action="reach-share-card" type="button" role="menuitem" tabindex="-1" hidden disabled><span class="export-item-copy"><strong>可达范围分享卡片</strong><small class="hint">1200×630 PNG</small></span></button>+ <button data-action="copy-share-card" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>复制分享卡片</strong><small class="hint">复制 PNG 到剪贴板</small></span></button>+ <button data-action="copy" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>复制图表</strong><small class="hint">复制 PNG 到剪贴板</small></span></button>+ </div>+ <div class="export-menu-section" role="group" aria-label="位图">+ <span class="export-menu-heading" aria-hidden="true">图像</span>+ <button data-format="png" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>PNG</strong><small class="hint">无损图像</small></span></button>+ <button data-format="jpeg" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>JPEG</strong><small class="hint">紧凑图像</small></span></button>+ <button data-format="webp" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>WebP</strong><small class="hint">现代图像格式</small></span></button>+ </div>+ <div class="export-menu-section" role="group" aria-label="矢量与动效">+ <span class="export-menu-heading" aria-hidden="true">矢量与动效</span>+ <button data-format="svg" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>SVG</strong><small class="hint">可编辑矢量图</small></span></button>+ <button data-format="webm" type="button" role="menuitem" tabindex="-1"><span class="export-item-copy"><strong>WebM</strong><small class="hint">6 秒动效</small></span></button>+ </div>+ </div>+ </div>+ </div>++ <div class="container">+ <!-- Header -->+ <div class="header">+ <div class="header-row"+ data-preset-badge-signal-flow="信号流"+ data-preset-badge-blueprint="蓝图 / 修订 01"+ data-preset-badge-editorial="编辑风格 / 现场笔记">+ <div class="pulse-dot"></div>+ <h1>Maka 托管执行、受控工具与可恢复事实</h1>+ </div>+ </div>++ <script id="archify-guided-views-data" type="application/json">[{"id":"turn_spine","label":"托管回合主链","focus":["request_portal","host_kernel","session_owner","turn_driver","flow_adapter","response_surface"],"note":"请求进入 Runtime Host,由 SessionManager 编排回合并经 Flow 流式返回结果。"},{"id":"guarded_effect","label":"受控工具副作用","focus":["turn_driver","boundary_gate","tool_runtime","artifact_store","runtime_ledger"],"note":"工具调用先通过 ExecutionBoundary,再发布文件结果并写入 RuntimeEvent 账本。"},{"id":"durable_resume","label":"规范事实恢复","focus":["runtime_ledger","resume_planner","host_kernel","session_owner"],"note":"恢复规划器读取事件与 Artifact 引用,验证后重新进入 Host 托管链。"}]</script>++ <script id="archify-i18n-data" type="application/json">{"locale":"zh-CN","messages":{"viewer.kind.frontend":"前端","viewer.kind.backend":"后端","viewer.kind.database":"数据库","viewer.kind.cloud":"云服务","viewer.kind.security":"安全","viewer.kind.messagebus":"消息总线","viewer.kind.external":"外部系统","viewer.kind.neutral":"中性","viewer.kind.node":"节点","viewer.kind.start":"开始","viewer.kind.active":"活动","viewer.kind.waiting":"等待","viewer.kind.decision":"决策","viewer.kind.success":"成功","viewer.kind.failure":"失败","viewer.toolbar.actions":"图表操作","viewer.theme.toggle.title":"切换主题(T)","viewer.theme.toggle":"切换颜色主题","viewer.theme.dark":"深色","viewer.theme.light":"浅色","viewer.preset.choose.title":"选择视觉风格(S 循环切换)","viewer.preset.choose":"选择视觉风格","viewer.preset.style":"风格","viewer.preset.menu":"视觉风格","viewer.preset.identity":"视觉表达","viewer.preset.cycles":"S 循环切换","viewer.preset.classic":"经典","viewer.preset.classic.short":"经典","viewer.preset.classic.hint":"稳定的技术默认风格","viewer.preset.flow":"信号流","viewer.preset.flow.short":"流动","viewer.preset.flow.hint":"突出动态流向","viewer.preset.blueprint":"蓝图","viewer.preset.blueprint.hint":"工程评审","viewer.preset.editorial":"编辑风格","viewer.preset.editorial.hint":"适合发布与上线说明","viewer.preset.badge.signalFlow":"信号流","viewer.preset.badge.blueprint":"蓝图 / 修订 01","viewer.preset.badge.editorial":"编辑风格 / 现场笔记","viewer.preset.badge.editorialPlate":"ARCHIFY / 图版 04","viewer.preset.current":"当前视觉风格:{style}。选择视觉风格","viewer.motion.live":"动态","viewer.motion.still":"静态","viewer.motion.pause":"暂停动效","viewer.motion.resume":"恢复动效","viewer.motion.reduced":"已根据减少动态效果偏好暂停动效","viewer.motion.hidden":"页面不可见时已暂停动效","viewer.motion.yielding":"暂停动效;当前让位于{owner}","viewer.motion.yielding.title":"动态预览已启用 · 正在让位于{owner}","viewer.owner.story":"引导故事","viewer.owner.chapter":"当前章节","viewer.owner.chapterPreview":"章节差异预览","viewer.owner.handoff":"章节交接","viewer.owner.route":"路径探测","viewer.owner.lens":"语义透镜","viewer.owner.relationship":"关系预览","viewer.owner.intent":"意图追踪","viewer.owner.focus":"语义聚焦","viewer.owner.legend":"图例预览","viewer.owner.reader":"读者交互","viewer.present.enter":"进入演示模式","viewer.present.enter.title":"演示模式(F)","viewer.present.exit":"退出演示模式","viewer.present.exit.title":"退出演示模式(F 或 Escape)","viewer.present.present":"演示","viewer.present.exit.label":"退出","viewer.export.button":"导出","viewer.export.button.title":"导出图表(E)","viewer.export.diagram":"导出图表","viewer.export.menu":"导出","viewer.export.subtitle":"便携、整洁的输出","viewer.export.share":"分享","viewer.export.shareCard":"分享卡片","viewer.export.routeShareCard":"路径分享卡片","viewer.export.reachShareCard":"可达范围分享卡片","viewer.export.copyShareCard":"复制分享卡片","viewer.export.copyDiagram":"复制图表","viewer.export.clipboardPng":"复制 PNG 到剪贴板","viewer.export.raster":"位图","viewer.export.image":"图像","viewer.export.lossless":"无损图像","viewer.export.compact":"紧凑图像","viewer.export.modern":"现代图像格式","viewer.export.vectorMotion":"矢量与动效","viewer.export.vectorMotion.heading":"矢量与动效","viewer.export.editable":"可编辑矢量图","viewer.export.motion6s":"6 秒动效","viewer.export.unsupported":"当前浏览器不支持","viewer.export.clipboardUnsupported":"当前浏览器不支持写入图片剪贴板","viewer.export.clipboardUnsupported.period":"当前浏览器不支持写入图片剪贴板。","viewer.export.clipboardUnsupported.short":"此浏览器不支持写入图片剪贴板。","viewer.export.motionUnavailable":"当前浏览器无法录制动效","viewer.export.webmUnavailable":"当前浏览器不支持 WebM","viewer.export.failed":"导出失败:{message}","viewer.export.unknownVariant":"未知的分享卡片类型:{variant}","viewer.export.routeRequired":"请先追踪路径,再导出路径分享卡片","viewer.export.reachRequired":"请先追踪编写可达范围,再导出可达范围分享卡片","viewer.export.unknown":"未知错误","viewer.export.routeFailed":"路径分享卡片导出失败:{message}","viewer.export.reachFailed":"可达范围分享卡片导出失败:{message}","viewer.export.copyFailed":"复制失败:{message}","viewer.export.copiedPng":"已将 PNG 复制到剪贴板","viewer.export.copiedShare":"已复制分享卡片","viewer.export.downloadedShare":"已下载分享卡片","viewer.export.downloadedRoute":"已下载路径分享卡片","viewer.export.downloadedReach":"已下载可达范围分享卡片","viewer.export.downloadedWebm":"已下载 WebM","viewer.export.recording":"正在录制 6 秒动效…","viewer.export.card.routeSummary.one":"路径:{source} → {target} · {count} 个有向跳转","viewer.export.card.routeSummary.other":"路径:{source} → {target} · {count} 个有向跳转","viewer.export.card.reachSummary":"从{origin}开始的编写{direction} · {nodes} · {links} · 最深 {hops}","viewer.export.card.node.one":"{count} 个节点","viewer.export.card.node.other":"{count} 个节点","viewer.export.card.link.one":"{count} 条连接","viewer.export.card.link.other":"{count} 条连接","viewer.export.card.hop.one":"{count} 跳","viewer.export.card.hop.other":"{count} 跳","viewer.export.card.routeBadge":"ARCHIFY · 路径 · {hops}","viewer.export.card.reachBadge":"ARCHIFY · {direction}可达范围","viewer.export.card.defaultBadge":"ARCHIFY · {preset} · {theme}","viewer.export.direction.upstream":"上游","viewer.export.direction.downstream":"下游","viewer.export.error.canvasUnavailable":"无法为{label}使用画布","viewer.export.error.contextUnavailable":"无法为{label}创建二维画布上下文","viewer.export.error.toBlobUnavailable":"{label}无法使用 canvas.toBlob","viewer.export.error.toBlobNull":"{label}的 canvas.toBlob 未返回数据","viewer.export.error.variantsCombined":"无法同时组合多种分享卡片类型","viewer.export.error.viewerState":"分享卡片导出无法移除临时 Viewer 状态","viewer.export.error.routeState":"路径卡片导出无法安全保留已解析路径","viewer.export.error.reachState":"可达范围卡片导出无法安全保留编写的可达范围","viewer.export.error.webmRequirements":"WebM 动效导出需要追踪动画及浏览器 MediaRecorder 支持","viewer.export.error.mediaRecorder":"MediaRecorder 录制失败","viewer.export.error.emptyWebm":"MediaRecorder 生成了空的 WebM","viewer.export.error.webmBackground":"无法为 WebM 导出加载 SVG 背景","viewer.guided.region":"图表引导视图","viewer.guided.previous":"上一个引导视图","viewer.guided.previous.title":"上一个引导视图([)","viewer.guided.next":"下一个引导视图","viewer.guided.next.title":"下一个引导视图(])","viewer.guided.views":"引导视图","viewer.guided.explore":"探索此系统","viewer.guided.intro":"沿精选路径逐步查看,而不改变源图表。","viewer.guided.trail":"故事轨迹","viewer.guided.beat":"节点","viewer.guided.nextBeat":"下一步","viewer.guided.play":"播放引导故事","viewer.guided.play.title":"播放引导故事(P)","viewer.guided.pause":"暂停引导故事","viewer.guided.pause.title":"暂停引导故事(P)","viewer.guided.replay":"重播引导故事","viewer.guided.replay.title":"重播引导故事(P)","viewer.guided.playStory":"播放故事","viewer.guided.pauseStory":"暂停","viewer.guided.replayStory":"重播故事","viewer.guided.motionUnavailable":"静态模式下无法播放故事","viewer.guided.enableMotion":"切换为动态模式以播放引导故事","viewer.guided.selectBeatLink":"选择故事节点以复制其精确链接","viewer.guided.copyMoment":"复制此刻","viewer.guided.momentCopied":"已复制时刻链接","viewer.guided.momentCopyFailed":"无法复制故事时刻链接","viewer.guided.copied":"已复制","viewer.guided.copyFailed":"复制失败","viewer.guided.showAll":"显示全部","viewer.guided.showAll.aria":"显示完整图表","viewer.guided.chapters":"故事章节","viewer.guided.storyTrail":"{label}的故事轨迹:{count} 个节点","viewer.guided.chapter.open":"打开第 {index}/{total} 章:{label},{count} 个停靠点","viewer.guided.chapter.current":"当前第 {index}/{total} 章:{label},{count} 个停靠点","viewer.guided.chapter.selectedNodes":"已选择 {count} 个节点","viewer.guided.chapter.stops":"{count} 个停靠点","viewer.guided.chapter.stop.one":"{count} 个停靠点","viewer.guided.chapter.stop.other":"{count} 个停靠点","viewer.guided.chapter.current.title":"{label} — 当前章节,{count} 个停靠点","viewer.guided.chapter.delta.expanded":"{stay} 个保留,{enter} 个进入,{leave} 个离开","viewer.guided.chapter.delta.aria":"打开第 {index}/{total} 章:{label}。章节聚焦差异:{delta}","viewer.guided.chapter.delta.title":"{label} — 章节聚焦 {delta}","viewer.guided.handoff":"{from} → {to} · 经由{label}","viewer.guided.share.chapter":"章节 {index} / {total}","viewer.guided.share.initial":"章节 01 / 01","viewer.guided.share.default":"引导章节","viewer.guided.state.ready":"就绪","viewer.guided.state.playing":"播放中","viewer.guided.state.settled":"已完成","viewer.guided.state.paused":"已暂停","viewer.guided.state.pinned":"已固定","viewer.guided.state.still":"静态","viewer.guided.share.step":"步骤 {index} / {total} · {label}","viewer.guided.share.staticMoment":"{step} · 静态时刻","viewer.guided.share.complete":"{count} 个步骤已完成 · {note}","viewer.guided.share.settled":"路径已稳定,可供阅读。","viewer.guided.share.staticPath":"{count} 个步骤 · 静态路径","viewer.guided.share.ready":"{count} 个步骤 · 就绪","viewer.guided.share.aria":"{state},第 {index}/{total} 章:{label}。{beat}。{route}","viewer.guided.beat.start":"节点 {index} / {total} · {label} · 起点","viewer.guided.beat.forward":"节点 {index} / {total} · {from} → {to}","viewer.guided.beat.reverse":"节点 {index} / {total} · {from} → {to} · 反向编写连接","viewer.guided.beat.multiple":"节点 {index} / {total} · {from} ⇄ {to} · {count} 条编写连接","viewer.guided.beat.group":"节点 {index} / {total} · {from} · {to} · 分组 · 无直接连接","viewer.guided.beat.aria.prefix":"故事节点 {index}/{total}:{label}。","viewer.guided.beat.aria.start":"起点。","viewer.guided.beat.aria.forward":"从{from}经一条正向编写关系到达。","viewer.guided.beat.aria.reverse":"从{from}出发;编写关系实际由{to}指向{from}。","viewer.guided.beat.aria.multiple":"从{from}经 {count} 条编写关系到达;不使用任意动效。","viewer.guided.beat.aria.group":"与{from}分组展示,没有直接编写关系。","viewer.guided.caption.start":"起点","viewer.guided.caption.grouped":"分组过渡 · 无直接编写连接","viewer.guided.caption.more":" +另外 {count} 条","viewer.guided.caption.reverse":"反向编写关系","viewer.guided.caption.relationships":"{count} 条编写关系","viewer.guided.caption.relationship":"编写关系","viewer.guided.caption.direction":"编写方向:{from} → {to}","viewer.guided.caption.starting":"编写起点","viewer.guided.beatLink":"复制当前故事时刻链接:第 {index}/{total} 个节点:{label}","viewer.guided.noStory":"此图表没有编写引导故事。","viewer.guide.eyebrow":"图表指南","viewer.guide.close":"关闭图表指南","viewer.guide.inspecting":"正在检查已编译语义","viewer.guide.actions":"图表探索操作","viewer.guide.find":"查找任意节点","viewer.guide.find.hint":"搜索标签、职责、类型和稳定 ID。","viewer.guide.route":"追踪路径","viewer.guide.route.aria":"追踪有向路径","viewer.guide.route.hint":"查看两个语义节点如何按编写方向连接。","viewer.guide.map":"查看完整系统","viewer.guide.map.hint":"打开带实时视口和稳定节点的语义雷达。","viewer.guide.lens":"比较语义类型","viewer.guide.lens.hint":"统计角色、显示流量并比较直接编写的连接。","viewer.guide.story":"播放引导故事","viewer.guide.story.hint":"浏览已编写的章节和真实关系。","viewer.guide.present":"进入演示模式","viewer.guide.present.hint":"让实时图表占满视口,同时不改变导出。","viewer.guide.shortcuts":"其他键盘快捷键","viewer.guide.shortcut.export":"导出","viewer.guide.shortcut.theme":"主题","viewer.guide.shortcut.style":"风格","viewer.guide.shortcut.reset":"重置","viewer.guide.shortcut.zoomIn":"放大","viewer.guide.shortcut.zoomOut":"缩小","viewer.guide.shortcut.close":"关闭","viewer.guide.facts":"{nodes} · {relationships} · {views}","viewer.guide.fact.node.one":"{count} 个语义节点","viewer.guide.fact.node.other":"{count} 个语义节点","viewer.guide.fact.relationship.one":"{count} 条关系","viewer.guide.fact.relationship.other":"{count} 条关系","viewer.guide.fact.view.one":"{count} 个引导视图","viewer.guide.fact.view.other":"{count} 个引导视图","viewer.guide.story.available.one":"浏览 {count} 个已编写章节及其真实关系。","viewer.guide.story.available.other":"浏览 {count} 个已编写章节及其真实关系。","viewer.guide.story.unavailable":"此图表没有编写引导故事。","viewer.guide.open":"打开图表指南","viewer.guide.noStory":"此图表没有编写引导故事。","viewer.finder.title":"查找节点","viewer.finder.close":"关闭节点查找器","viewer.finder.placeholder":"搜索标签或 ID","viewer.finder.search":"搜索图表节点","viewer.finder.results":"图表节点","viewer.finder.empty":"没有匹配的节点","viewer.finder.result.focus":"聚焦{label}","viewer.finder.result.routeStart":"选择{label}作为路径起点","viewer.finder.result.routeTarget":"选择{label}作为路径终点,{links}","viewer.finder.status.empty":"没有匹配的节点","viewer.finder.status.count.one":"{count} 个匹配节点","viewer.finder.status.count.other":"{count} 个匹配节点","viewer.finder.noun.nodes":"个节点","viewer.finder.link.one":"{count} 条连接","viewer.finder.link.other":"{count} 条连接","viewer.finder.result.focus.one":"聚焦{label},{count} 条相关连接","viewer.finder.result.focus.other":"聚焦{label},{count} 条相关连接","viewer.finder.status.filtered":"{visible}/{available} {noun}","viewer.finder.status.all":"{available} {noun}","viewer.passport.eyebrow":"语义护照","viewer.passport.metadata":"节点元数据","viewer.passport.evidence":"已验证的源代码证据","viewer.passport.verified":"已验证来源","viewer.passport.reach":"编写可达范围","viewer.passport.reach.trace":"追踪编写的可达性","viewer.passport.upstream":"上游","viewer.passport.downstream":"下游","viewer.passport.upstream.trace":"追踪上游编写可达性","viewer.passport.downstream.trace":"追踪下游编写可达性","viewer.passport.close":"关闭语义护照","viewer.passport.copy":"复制链接","viewer.passport.copy.focus":"复制聚焦节点的链接","viewer.passport.relations":"关系","viewer.passport.relations.show":"显示关联关系","viewer.passport.relations.hide":"隐藏关联关系","viewer.passport.relations.list":"关联关系","viewer.passport.copyRelation":"复制关系","viewer.passport.copyNode":"复制节点","viewer.passport.copyPinned":"复制固定关系的链接","viewer.passport.copySource":"复制来源节点的链接","viewer.passport.copy.focused.success":"已复制聚焦节点链接","viewer.passport.copy.pinned.success":"已复制固定关系链接","viewer.passport.copy.focused.failed":"无法复制聚焦节点链接","viewer.passport.copy.pinned.failed":"无法复制固定关系链接","viewer.passport.relationship.none":"没有关联关系","viewer.passport.relationship.count.one":"{count} 条关系","viewer.passport.relationship.count.other":"{count} 条关系","viewer.passport.relationship.show.one":"显示 {count} 条关联关系","viewer.passport.relationship.show.other":"显示 {count} 条关联关系","viewer.passport.relationship.summary":"{out} 条出向 · {in} 条入向{loops}","viewer.passport.relationship.loops":" · {count} 条自环","viewer.passport.relationship.explorer":"直接关系浏览器","viewer.passport.relationship.help":"使用方向键浏览关系。按 Enter 或空格键固定详情;按 Escape 清除。","viewer.passport.relationship.loopsBack":"回环","viewer.passport.relationship.connectsTo":"连接到","viewer.passport.relationship.connectsFrom":"连接自","viewer.passport.relationship.pinned":"已固定关系 · {from} → {to} · {label}","viewer.passport.relationship.inspect":"检查第 {index}/{total} 条关系:{from} 到 {to},{label}。按 Enter 查看详情。","viewer.passport.relationship.group.out":"出向","viewer.passport.relationship.group.in":"入向","viewer.passport.relationship.group.loop":"自环","viewer.passport.relationship.row":"{group}:{relationship},{neighbor}","viewer.passport.relationship.direction.out":"出 →","viewer.passport.relationship.direction.in":"← 入","viewer.passport.relationship.direction.loop":"自环","viewer.passport.sourceCount.one":"{count} 个已验证来源引用","viewer.passport.sourceCount.other":"{count} 个已验证来源引用","viewer.passport.sourceMarker":"来源","viewer.passport.beacon.one":"{count} 个已验证来源;聚焦此节点以检查","viewer.passport.beacon.other":"{count} 个已验证来源;聚焦此节点以检查","viewer.passport.repository.open":"打开已验证的仓库修订版本 {revision}","viewer.passport.source.open":"打开修订版本 {revision} 中已验证的来源 {path}","viewer.passport.source.openLink":"打开 ↗","viewer.passport.reach.upstream.one":"追踪 {count} 个上游编写节点","viewer.passport.reach.upstream.other":"追踪 {count} 个上游编写节点","viewer.passport.reach.downstream.one":"追踪 {count} 个下游编写节点","viewer.passport.reach.downstream.other":"追踪 {count} 个下游编写节点","viewer.passport.reach.noUpstream":"没有上游编写节点","viewer.passport.reach.noDownstream":"没有下游编写节点","viewer.passport.reach.status":"{direction} · {nodes} 个节点 · {links} 条连接 · 最深 {hops} 跳","viewer.route.eyebrow":"路径探测","viewer.route.start":"选择起点节点","viewer.route.start.find":"查找起点","viewer.route.start.find.aria":"查找路径起点","viewer.route.copy":"复制链接","viewer.route.copy.aria":"复制已追踪路径的链接","viewer.route.clear":"清除","viewer.route.clear.aria":"清除路径探测","viewer.route.traced":"已追踪路径","viewer.route.pickTwo":"在图表中选择两个语义节点","viewer.route.pickOne":"在图表中选择一个语义节点","viewer.route.controls":"路径旅程控制","viewer.route.previous":"上一个路径位置","viewer.route.play":"播放路径旅程","viewer.route.pause":"暂停路径旅程","viewer.route.replay":"重播路径旅程","viewer.route.next":"下一个路径位置","viewer.route.journey":"旅程","viewer.route.pause.label":"暂停","viewer.route.replay.label":"重播","viewer.route.overview":"总览","viewer.route.overview.aria":"显示完整路径总览","viewer.route.instructions":"先选择来源,再选择目标;方向很重要。","viewer.route.destination":"选择从{label}出发的目标","viewer.route.destination.find":"查找目标","viewer.route.destination.find.aria":"查找可达的路径目标","viewer.route.differentDestination":"选择其他目标","viewer.route.distinct":"一条路径需要两个不同的语义节点。","viewer.route.unreachable":"没有通往{label}的有向路径","viewer.route.unreachable.detail":"从{source}无法到达{target}。请选择高亮的目标。","viewer.route.start.instructions":"选择来源。下一步只会显示有向可达的目标。","viewer.route.copy.success":"已复制路径链接","viewer.route.copy.failed":"无法复制路径链接","viewer.route.position":"路径位置 {index}/{total}:{label}","viewer.route.step":"第 {index}/{total} 步 · {phase} · {label}","viewer.route.motionRequired":"自动旅程需要动态模式","viewer.route.trigger.clear":"清除已追踪路径","viewer.route.overview.status":"{nodes} · {hops} · 最短编写路径","viewer.route.overview.node.one":"{count} 个节点","viewer.route.overview.node.other":"{count} 个节点","viewer.route.overview.hop.one":"{count} 个有向跳转","viewer.route.overview.hop.other":"{count} 个有向跳转","viewer.route.phase.playing":"播放中","viewer.route.phase.complete":"已完成","viewer.route.phase.inspecting":"检查中","viewer.route.destination.count.one":"有 {count} 个有向目标可用。请选择高亮节点。","viewer.route.destination.count.other":"有 {count} 个有向目标可用。请选择高亮节点。","viewer.route.noOutgoing":"此处没有可用的出向路径。请清除后选择其他来源。","viewer.route.result.title":"{source} 到 {target}","viewer.route.finder.source.title":"选择路径起点","viewer.route.finder.source.placeholder":"搜索路径来源","viewer.route.finder.source.empty":"没有匹配的路径来源","viewer.route.finder.source.results":"可作为路径起点的节点","viewer.route.finder.source.noun":"个路径来源","viewer.route.finder.source.badge":"起点","viewer.route.finder.target.title":"从{label}出发的目标","viewer.route.finder.target.placeholder":"搜索可达目标","viewer.route.finder.target.empty":"没有匹配的可达目标","viewer.route.finder.target.results":"可达路径目标","viewer.route.finder.target.noun":"个可达目标","viewer.route.hop.one":"{count} 跳","viewer.route.hop.other":"{count} 跳","viewer.lens.eyebrow":"语义透镜","viewer.lens.title":"比较系统角色","viewer.lens.close":"关闭语义透镜","viewer.lens.instruction":"最多选择两种语义类型。选择一种可显示其真实流量;选择两种只比较直接编写的关系。","viewer.lens.kinds":"语义类型","viewer.lens.choose":"选择一种类型以检查其节点和相连关系。","viewer.lens.copy":"复制语义透镜链接","viewer.lens.clear":"清除语义透镜","viewer.lens.open":"打开语义透镜","viewer.lens.openActive":"打开当前语义透镜","viewer.lens.legend":"语义图例","viewer.lens.legend.inspect.one":"检查{label},{count} 个节点","viewer.lens.legend.inspect.other":"检查{label},{count} 个节点","viewer.lens.kind.count.one":"{label},{count} 个节点","viewer.lens.kind.count.other":"{label},{count} 个节点","viewer.lens.compare.one":"{first} → {second}:{forward} · {second} → {first}:{reverse} · 共 {count} 条直接关系","viewer.lens.compare.other":"{first} → {second}:{forward} · {second} → {first}:{reverse} · 共 {count} 条直接关系","viewer.lens.single":"{nodes} · {relationships} · 已连接节点保持可见","viewer.lens.node.one":"{count} 个{label}节点","viewer.lens.node.other":"{count} 个{label}节点","viewer.lens.relationship.one":"{count} 条相连关系","viewer.lens.relationship.other":"{count} 条相连关系","viewer.radar.title":"语义雷达","viewer.radar.building":"正在构建总览","viewer.radar.openFull":"打开完整语义雷达","viewer.radar.open":"打开雷达","viewer.radar.close":"关闭语义雷达","viewer.radar.surface":"图表总览。点击节点进行聚焦,或使用方向键平移。","viewer.radar.click":"点击节点","viewer.radar.drag":"拖动平移","viewer.radar.space":"语义雷达需要更多地图可见空间。","viewer.radar.nodes":"语义图表雷达节点","viewer.radar.focus":"从语义雷达聚焦{label}","viewer.radar.status":"{count} 个节点 · {viewport}","viewer.radar.fullMap":"{count} 个节点 · 完整地图","viewer.radar.compacted":"已收紧雷达,避免遮挡语义护照或地图控件。","viewer.radar.cancelWaiting":"取消等待更多地图空间的语义雷达","viewer.radar.needsSpace":"语义雷达需要更多可见地图空间","viewer.radar.viewport.full":"完整地图","viewer.radar.viewport.width":"宽度 {percent}%","viewer.radar.viewport.scale":"视口 {percent}%","viewer.nav.controls":"图表视图控制","viewer.nav.route":"追踪有向路径","viewer.nav.route.title":"追踪路径(R)","viewer.nav.route.short":"路径","viewer.nav.radar":"打开语义雷达","viewer.nav.radar.title":"语义雷达(M)","viewer.nav.radar.short":"地图","viewer.nav.lens":"打开语义透镜","viewer.nav.lens.title":"语义透镜(L)","viewer.nav.lens.short":"透镜","viewer.nav.find":"查找节点","viewer.nav.find.title":"查找节点(/)","viewer.nav.guide":"打开图表指南","viewer.nav.guide.title":"图表指南(?)","viewer.nav.zoomOut":"缩小","viewer.nav.zoomOut.title":"缩小(-)","viewer.nav.reset":"重置图表视图","viewer.nav.reset.title":"重置视图(0)","viewer.nav.read":"阅读","viewer.nav.zoomIn":"放大","viewer.nav.zoomIn.title":"放大(+)","viewer.nav.camera":"{hint}。重置图表视图","viewer.nav.camera.title":"{semantic}{hint} · 重置视图(0)","viewer.nav.camera.semantic":"语义相机已启用 · ","viewer.nav.level.map":"概览","viewer.nav.level.read":"阅读","viewer.nav.level.full":"完整","viewer.nav.level.auto":"自动","viewer.nav.detail.map":"放大以显示关系标签和节点上下文","viewer.nav.detail.read":"再次放大以显示标签和注释","viewer.nav.detail.full":"完整图表详情","viewer.intent.summary":"{label}。{out} 条出向,{in} 条入向{loops}。共 {total} 条连接。按 Enter 查看详情。","viewer.intent.loops":",{count} 条自环","viewer.common.copied":"已复制","viewer.common.copyFailed":"复制失败","viewer.common.copyLink":"复制链接","viewer.common.clear":"清除","viewer.common.close":"关闭"}}</script>+ <div class="guided-views no-print" id="guided-views" hidden aria-label="图表引导视图">+ <button id="guided-view-prev" type="button" aria-label="上一个引导视图" title="上一个引导视图([)">←</button>+ <div class="guided-view-copy">+ <div class="guided-view-meta">+ <span>引导视图</span>+ <span id="guided-view-count"></span>+ <span class="guided-view-progress" aria-hidden="true"><span id="guided-view-progress-bar"></span></span>+ <span class="guided-view-handoff" id="guided-view-handoff" hidden aria-hidden="true"></span>+ </div>+ <strong id="guided-view-label">探索此系统</strong>+ <small id="guided-view-note" aria-live="polite" aria-atomic="true">沿精选路径逐步查看,而不改变源图表。</small>+ <div class="guided-view-trail" id="guided-view-trail" hidden role="group" aria-label="故事轨迹"></div>+ <div class="guided-story-caption" id="guided-story-caption" hidden aria-live="polite" aria-atomic="true">+ <span class="guided-story-caption-index" id="guided-story-caption-index">节点</span>+ <strong id="guided-story-caption-route"></strong>+ <small id="guided-story-caption-detail"></small>+ <span class="guided-story-caption-next" id="guided-story-caption-next" hidden aria-hidden="true">+ <small>下一步</small>+ <strong id="guided-story-caption-next-label"></strong>+ </span>+ </div>+ </div>+ <button id="guided-view-next" type="button" aria-label="下一个引导视图" title="下一个引导视图(])">→</button>+ <div class="guided-view-actions">+ <button class="guided-view-play" id="guided-view-play" type="button" aria-label="播放引导故事" aria-pressed="false" title="播放引导故事(P)">+ <span id="guided-view-play-icon" aria-hidden="true">▶</span>+ <span id="guided-view-play-label">播放故事</span>+ </button>+ <button class="guided-view-beat-link" id="guided-view-beat-link" type="button" aria-label="选择故事节点以复制其精确链接" title="选择故事节点以复制其精确链接" disabled>+ <span aria-hidden="true">#</span>+ <span id="guided-view-beat-link-label">复制此刻</span>+ </button>+ <button class="guided-view-all" id="guided-view-all" type="button" aria-label="显示完整图表">显示全部</button>+ </div>+ <nav class="guided-view-index" id="guided-view-index" aria-label="故事章节">+ <ol class="guided-view-chapters" id="guided-view-chapters"></ol>+ </nav>+ </div>++ <!-- Main Diagram -->+ <div class="diagram-container" data-detail-level="read"+ data-preset-badge-editorial-plate="ARCHIFY / 图版 04">+ <svg viewBox="0 0 1237 652" role="img" lang="zh-CN" aria-labelledby="archify-diagram-title archify-diagram-description" data-preset="classic" data-quality-profile="showcase">+ <title id="archify-diagram-title">Maka 托管执行、受控工具与可恢复事实</title>+ <desc id="archify-diagram-description">由 Archify 生成的工作流图。</desc>+ <!-- Definitions -->+ <defs>+ <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-default" />+ </marker>+ <marker id="arrowhead-emphasis" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-emphasis" />+ </marker>+ <marker id="arrowhead-security" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-security" />+ </marker>+ <marker id="arrowhead-dashed" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">+ <polygon points="0 0, 10 3.5, 0 7" class="m-dashed" />+ </marker>+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">+ <path d="M 40 0 L 0 0 0 40" class="c-grid" stroke-width="0.5"/>+ </pattern>+ </defs>++ <!-- Background Grid -->+ <rect width="100%" height="100%" fill="url(#grid)" />++ <!-- Swimlanes -->+ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-0" x="40" y="52" width="1135" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="74" class="t-dim" font-size="10" font-weight="600">01 / 产品请求与反馈</text>++ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-1" x="40" y="176" width="1135" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="198" class="t-dim" font-size="10" font-weight="600">02 / Runtime Host、Session 与 Turn</text>++ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-2" x="40" y="300" width="1135" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="exception-lane" data-composition-frame-id="lane-2-exception" x="46" y="306" width="1123" height="92" rx="8" class="c-security-group" stroke-width="1"/>+ <text x="54" y="322" class="t-security" font-size="10" font-weight="600">EX / 模型调用与受控副作用</text>++ <rect data-graph-role="structural-frame" data-composition-frame-kind="lane" data-composition-frame-id="lane-3" x="40" y="424" width="1135" height="104" rx="10" class="c-lane" stroke-width="1"/>+ <text x="54" y="446" class="t-dim" font-size="10" font-weight="600">04 / Artifact、事件账本与恢复</text>++ <!-- Phase headers -->+ <line x1="95" y1="35" x2="307" y2="35" class="a-default" stroke-width="1.1"/>+ <rect x="95" y="27" width="212" height="16" rx="4" class="c-mask"/>+ <text x="201" y="39" class="t-muted" font-size="8" font-weight="600" text-anchor="middle">接入托管</text>+ <line x1="420.3999999999999" y1="35" x2="741.2" y2="35" class="a-emphasis" stroke-width="1.1"/>+ <rect x="420.3999999999999" y="27" width="320.80000000000007" height="16" rx="4" class="c-mask"/>+ <text x="580.8" y="39" class="t-backend" font-size="8" font-weight="600" text-anchor="middle">编排并驱动 Turn</text>+ <line x1="811.2" y1="35" x2="903.2" y2="35" class="a-security" stroke-width="1.1"/>+ <rect x="811.2" y="27" width="92" height="16" rx="4" class="c-mask"/>+ <text x="857.2" y="39" class="t-security" font-size="8" font-weight="600" text-anchor="middle">执行与记账</text>+ <line x1="1042.6000000000001" y1="35" x2="1134.6000000000001" y2="35" class="a-dashed" stroke-width="1.1"/>+ <rect x="1042.6000000000001" y="27" width="92" height="16" rx="4" class="c-mask"/>+ <text x="1088.6000000000001" y="39" class="t-messagebus" font-size="8" font-weight="600" text-anchor="middle">反馈与恢复</text>++ <!-- Workflow groups -->+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-0" x="181" y="214" width="603.2" height="62" rx="9" class="c-lane" stroke-width="1"/>+ <text x="191" y="212" class="t-backend" font-size="7" font-weight="600">Host 执行权威</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-1" x="612.2" y="338" width="554.4000000000001" height="62" rx="9" class="c-security-group" stroke-width="1"/>+ <text x="622.2" y="336" class="t-security" font-size="7" font-weight="600">ExecutionBoundary</text>+ <rect data-graph-role="structural-frame" data-composition-frame-kind="group" data-composition-frame-id="group-2" x="774.2" y="462" width="390.4000000000001" height="62" rx="9" class="c-lane" stroke-width="1"/>+ <text x="784.2" y="460" class="t-messagebus" font-size="7" font-weight="600">规范恢复事实</text>++ <!-- Edge paths -->+ <path data-edge-from="boundary_gate" data-edge-to="tool_runtime" data-edge-label="准入后执行" data-edge-key="0" data-edge-id="admit_effect" data-composition-points="695.2,393;695.2,420;1088.6000000000001,420;1088.6000000000001,393" d="M 695.2 393 L 695.2 420 L 1088.6000000000001 420 L 1088.6000000000001 393" class="a-security" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="turn_driver" data-edge-to="boundary_gate" data-edge-label="工具调用" data-edge-key="1" data-edge-id="ask_for_effect" data-composition-points="695.2,269;695.2,290;600.2,290;600.2,367;616.2,367" d="M 695.2 269 L 695.2 290 L 600.2 290 L 600.2 367 L 616.2 367" class="a-security" stroke-width="1.4" marker-end="url(#arrowhead-security)"/>+ <path data-edge-from="turn_driver" data-edge-to="flow_adapter" data-edge-label="请求 / stream" data-edge-key="2" data-edge-id="dispatch_model_flow" data-composition-points="780.2,243;850.2,243;850.2,341" d="M 780.2 243 L 850.2 243 L 850.2 341" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="flow_adapter" data-edge-to="response_surface" data-edge-label="增量事件" data-edge-key="3" data-edge-id="emit_response" data-composition-points="864.2,341;864.2,119;1022.6000000000001,119" d="M 864.2 341 L 864.2 119 L 1022.6000000000001 119" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="request_portal" data-edge-to="host_kernel" data-edge-label="Host 连接" data-edge-key="4" data-edge-id="open_host" data-composition-points="141,145;141,166;353,166;353,243;337,243" d="M 141 145 L 141 166 L 353 166 L 353 243 L 337 243" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="tool_runtime" data-edge-to="artifact_store" data-edge-label="文件型结果" data-edge-key="5" data-edge-id="publish_file_result" data-composition-points="1162.6000000000001,367;1214.601,367;1214.601,491;1160.6000000000001,491" d="M 1162.6000000000001 367 L 1214.601 367 L 1214.601 491 L 1160.6000000000001 491" class="a-dashed" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="runtime_ledger" data-edge-to="resume_planner" data-edge-label="读取事件与 Artifact 引用" data-edge-key="6" data-edge-id="read_resume_facts" data-composition-points="778.2,491;234,491" d="M 778.2 491 L 234 491" class="a-dashed" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="artifact_store" data-edge-to="runtime_ledger" data-edge-label="Artifact 引用" data-edge-key="7" data-edge-id="record_artifact_ref" data-composition-points="1016.6000000000001,491;936.2,491" d="M 1016.6000000000001 491 L 936.2 491" class="a-dashed" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="flow_adapter" data-edge-to="runtime_ledger" data-edge-label="写入 RuntimeEvent" data-edge-key="8" data-edge-id="record_runtime_events" data-composition-points="857.2,341;857.2,325;1220.601,325;1220.601,533;857.2,533;857.2,517" d="M 857.2 341 L 857.2 325 L 1220.601 325 L 1220.601 533 L 857.2 533 L 857.2 517" class="a-dashed" stroke-width="1.4" marker-end="url(#arrowhead-dashed)"/>+ <path data-edge-from="resume_planner" data-edge-to="host_kernel" data-edge-label="验证恢复计划" data-edge-key="9" data-edge-id="reenter_host" data-composition-points="141,517;141,544;261,544;261,269" d="M 141 517 L 141 544 L 261 544 L 261 269" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="session_owner" data-edge-to="turn_driver" data-edge-label="启动 / 续接" data-edge-key="10" data-edge-id="start_or_resume_turn" data-composition-points="539.4,243;610.2,243" d="M 539.4 243 L 610.2 243" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>+ <path data-edge-from="host_kernel" data-edge-to="session_owner" data-edge-label="托管命令" data-edge-key="11" data-edge-id="submit_session_command" data-composition-points="261,269;261,285;466.4,285;466.4,269" d="M 261 269 L 261 285 L 466.4 285 L 466.4 269" class="a-emphasis" stroke-width="1.8" marker-end="url(#arrowhead-emphasis)"/>++ <!-- Nodes -->+ <g id="node-request_portal" data-node-id="request_portal" data-node-label="提交产品请求" tabindex="0" role="button" aria-label="聚焦提交产品请求,Desktop / CLI, 产品请求与反馈 › 接入托管" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="Desktop / CLI" data-node-context="产品请求与反馈 › 接入托管">+ <title>提交产品请求 · Desktop / CLI · 产品请求与反馈 › 接入托管</title>+ <rect x="80" y="93" width="122" height="52" rx="6" class="c-mask"/>+ <rect x="80" y="93" width="122" height="52" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(86 99) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="141" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">提交产品请求</text>+ <text data-detail="context" x="141" y="131" class="t-muted" font-size="8" text-anchor="middle">Desktop / CLI</text>+ </g>++ <g id="node-response_surface" data-node-id="response_surface" data-node-label="流式反馈与终态" tabindex="0" role="button" aria-label="聚焦流式反馈与终态,界面更新及最终结果, 产品请求与反馈 › 反馈与恢复" aria-pressed="false" data-node-kind="frontend" data-node-sublabel="界面更新及最终结果" data-node-context="产品请求与反馈 › 反馈与恢复">+ <title>流式反馈与终态 · 界面更新及最终结果 · 产品请求与反馈 › 反馈与恢复</title>+ <rect x="1022.6000000000001" y="93" width="132" height="52" rx="6" class="c-mask"/>+ <rect x="1022.6000000000001" y="93" width="132" height="52" rx="6" class="c-frontend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="frontend" class="semantic-sigil s-frontend" transform="translate(1028.6000000000001 99) scale(0.6875)">+ <rect x="2" y="3" width="12" height="10" rx="2"/>+ <path d="M2 6.5h12"/>+ <circle cx="4.1" cy="4.8" r=".7" class="sigil-fill"/>+ <circle cx="6.3" cy="4.8" r=".7" class="sigil-fill"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="1088.6000000000001" y="114" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">流式反馈与终态</text>+ <text data-detail="context" x="1088.6000000000001" y="131" class="t-muted" font-size="8" text-anchor="middle">界面更新及最终结果</text>+ </g>++ <g id="node-host_kernel" data-node-id="host_kernel" data-node-label="RuntimeHostKernel" tabindex="0" role="button" aria-label="聚焦RuntimeHostKernel,根目录唯一执行权威, Runtime Host、Session 与 Turn › Host 执行权威 › 接入托管" aria-pressed="false" data-node-kind="backend" data-node-sublabel="根目录唯一执行权威" data-node-context="Runtime Host、Session 与 Turn › Host 执行权威 › 接入托管">+ <title>RuntimeHostKernel · 根目录唯一执行权威 · Runtime Host、Session 与 Turn › Host 执行权威 › 接入托管</title>+ <rect x="185" y="217" width="152" height="52" rx="6" class="c-mask"/>+ <rect x="185" y="217" width="152" height="52" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(191 223) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="261" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">RuntimeHostKernel</text>+ <text data-detail="context" x="261" y="255" class="t-muted" font-size="8" text-anchor="middle">根目录唯一执行权威</text>+ </g>++ <g id="node-session_owner" data-node-id="session_owner" data-node-label="SessionManager" tabindex="0" role="button" aria-label="聚焦SessionManager,Session / Turn 所有者, Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn" aria-pressed="false" data-node-kind="backend" data-node-sublabel="Session / Turn 所有者" data-node-context="Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn">+ <title>SessionManager · Session / Turn 所有者 · Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn</title>+ <rect x="393.4" y="217" width="146" height="52" rx="6" class="c-mask"/>+ <rect x="393.4" y="217" width="146" height="52" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(399.4 223) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="466.4" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SessionManager</text>+ <text data-detail="context" x="466.4" y="255" class="t-muted" font-size="8" text-anchor="middle">Session / Turn 所有者</text>+ </g>++ <g id="node-turn_driver" data-node-id="turn_driver" data-node-label="AgentRun / RuntimeRunner" tabindex="0" role="button" aria-label="聚焦AgentRun / RuntimeRunner,事件驱动的 Turn 编排, Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn" aria-pressed="false" data-node-kind="backend" data-node-sublabel="事件驱动的 Turn 编排" data-node-context="Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn">+ <title>AgentRun / RuntimeRunner · 事件驱动的 Turn 编排 · Runtime Host、Session 与 Turn › Host 执行权威 › 编排并驱动 Turn</title>+ <rect x="610.2" y="217" width="170" height="52" rx="6" class="c-mask"/>+ <rect x="610.2" y="217" width="170" height="52" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(616.2 223) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="695.2" y="238" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">AgentRun / RuntimeRunner</text>+ <text data-detail="context" x="695.2" y="255" class="t-muted" font-size="8" text-anchor="middle">事件驱动的 Turn 编排</text>+ </g>++ <g id="node-boundary_gate" data-node-id="boundary_gate" data-node-label="ExecutionBoundary" tabindex="0" role="button" aria-label="聚焦ExecutionBoundary,权限与 sandbox 准入, 模型调用与受控副作用 › ExecutionBoundary › 编排并驱动 Turn" aria-pressed="false" data-node-kind="security" data-node-sublabel="权限与 sandbox 准入" data-node-context="模型调用与受控副作用 › ExecutionBoundary › 编排并驱动 Turn">+ <title>ExecutionBoundary · 权限与 sandbox 准入 · 模型调用与受控副作用 › ExecutionBoundary › 编排并驱动 Turn</title>+ <rect x="616.2" y="341" width="158" height="52" rx="6" class="c-mask"/>+ <rect x="616.2" y="341" width="158" height="52" rx="6" class="c-security" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="security" class="semantic-sigil s-security" transform="translate(622.2 347) scale(0.6875)">+ <path d="M8 2.2 13 4v3.5c0 3.1-1.8 5.4-5 6.5-3.2-1.1-5-3.4-5-6.5V4Z"/>+ <path d="m5.8 8 1.5 1.5 3-3"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="695.2" y="362" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ExecutionBoundary</text>+ <text data-detail="context" x="695.2" y="379" class="t-muted" font-size="8" text-anchor="middle">权限与 sandbox 准入</text>+ </g>++ <g id="node-flow_adapter" data-node-id="flow_adapter" data-node-label="AiSdkFlow / Backend" tabindex="0" role="button" aria-label="聚焦AiSdkFlow / Backend,模型调用与 RuntimeEvent 映射, 模型调用与受控副作用 › ExecutionBoundary › 执行与记账" aria-pressed="false" data-node-kind="cloud" data-node-sublabel="模型调用与 RuntimeEvent 映射" data-node-context="模型调用与受控副作用 › ExecutionBoundary › 执行与记账">+ <title>AiSdkFlow / Backend · 模型调用与 RuntimeEvent 映射 · 模型调用与受控副作用 › ExecutionBoundary › 执行与记账</title>+ <rect x="782.2" y="341" width="150" height="52" rx="6" class="c-mask"/>+ <rect x="782.2" y="341" width="150" height="52" rx="6" class="c-cloud" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="cloud" class="semantic-sigil s-cloud" transform="translate(788.2 347) scale(0.6875)">+ <path d="M4.3 12.5h7.3a2.4 2.4 0 0 0 .2-4.8 4 4 0 0 0-7.5-1.3A3.1 3.1 0 0 0 4.3 12.5Z"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="857.2" y="362" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">AiSdkFlow / Backend</text>+ <text data-detail="context" x="857.2" y="379" class="t-muted" font-size="8" text-anchor="middle">模型调用与 RuntimeEvent 映射</text>+ </g>++ <g id="node-tool_runtime" data-node-id="tool_runtime" data-node-label="ToolRuntime" tabindex="0" role="button" aria-label="聚焦ToolRuntime,执行、终止与结果结算, 模型调用与受控副作用 › ExecutionBoundary › 反馈与恢复" aria-pressed="false" data-node-kind="messagebus" data-node-sublabel="执行、终止与结果结算" data-node-context="模型调用与受控副作用 › ExecutionBoundary › 反馈与恢复">+ <title>ToolRuntime · 执行、终止与结果结算 · 模型调用与受控副作用 › ExecutionBoundary › 反馈与恢复</title>+ <rect x="1014.6000000000001" y="341" width="148" height="52" rx="6" class="c-mask"/>+ <rect x="1014.6000000000001" y="341" width="148" height="52" rx="6" class="c-messagebus" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="messagebus" class="semantic-sigil s-messagebus" transform="translate(1020.6000000000001 347) scale(0.6875)">+ <path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/>+ <circle cx="5" cy="4.5" r="1" class="sigil-fill"/>+ <circle cx="10.5" cy="8" r="1" class="sigil-fill"/>+ <circle cx="7" cy="11.5" r="1" class="sigil-fill"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="1088.6000000000001" y="362" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ToolRuntime</text>+ <text data-detail="context" x="1088.6000000000001" y="379" class="t-muted" font-size="8" text-anchor="middle">执行、终止与结果结算</text>+ </g>++ <g id="node-resume_planner" data-node-id="resume_planner" data-node-label="RuntimeContinuationPlanner" tabindex="0" role="button" aria-label="聚焦RuntimeContinuationPlanner,读取事实并验证恢复, Artifact、事件账本与恢复 › 接入托管" aria-pressed="false" data-node-kind="backend" data-node-sublabel="读取事实并验证恢复" data-node-context="Artifact、事件账本与恢复 › 接入托管">+ <title>RuntimeContinuationPlanner · 读取事实并验证恢复 · Artifact、事件账本与恢复 › 接入托管</title>+ <rect x="48" y="465" width="186" height="52" rx="6" class="c-mask"/>+ <rect x="48" y="465" width="186" height="52" rx="6" class="c-backend" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="backend" class="semantic-sigil s-backend" transform="translate(54 471) scale(0.6875)">+ <path d="M6 3 3 8l3 5M10 3l3 5-3 5"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="141" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">RuntimeContinuationPlanner</text>+ <text data-detail="context" x="141" y="503" class="t-muted" font-size="8" text-anchor="middle">读取事实并验证恢复</text>+ </g>++ <g id="node-runtime_ledger" data-node-id="runtime_ledger" data-node-label="SqliteRuntimeStore" tabindex="0" role="button" aria-label="聚焦SqliteRuntimeStore,RuntimeEvent 规范账本, Artifact、事件账本与恢复 › 规范恢复事实 › 执行与记账" aria-pressed="false" data-node-kind="database" data-node-sublabel="RuntimeEvent 规范账本" data-node-context="Artifact、事件账本与恢复 › 规范恢复事实 › 执行与记账">+ <title>SqliteRuntimeStore · RuntimeEvent 规范账本 · Artifact、事件账本与恢复 › 规范恢复事实 › 执行与记账</title>+ <rect x="778.2" y="465" width="158" height="52" rx="6" class="c-mask"/>+ <rect x="778.2" y="465" width="158" height="52" rx="6" class="c-database" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(784.2 471) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="857.2" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">SqliteRuntimeStore</text>+ <text data-detail="context" x="857.2" y="503" class="t-muted" font-size="8" text-anchor="middle">RuntimeEvent 规范账本</text>+ </g>++ <g id="node-artifact_store" data-node-id="artifact_store" data-node-label="ArtifactStore" tabindex="0" role="button" aria-label="聚焦ArtifactStore,文件结果与引用发布, Artifact、事件账本与恢复 › 规范恢复事实 › 反馈与恢复" aria-pressed="false" data-node-kind="database" data-node-sublabel="文件结果与引用发布" data-node-context="Artifact、事件账本与恢复 › 规范恢复事实 › 反馈与恢复">+ <title>ArtifactStore · 文件结果与引用发布 · Artifact、事件账本与恢复 › 规范恢复事实 › 反馈与恢复</title>+ <rect x="1016.6000000000001" y="465" width="144" height="52" rx="6" class="c-mask"/>+ <rect x="1016.6000000000001" y="465" width="144" height="52" rx="6" class="c-database" stroke-width="1.5"/>+ <g aria-hidden="true" data-semantic-sigil="database" class="semantic-sigil s-database" transform="translate(1022.6000000000001 471) scale(0.6875)">+ <ellipse cx="8" cy="4" rx="5" ry="2"/>+ <path d="M3 4v8c0 1.1 2.2 2 5 2s5-.9 5-2V4M3 8c0 1.1 2.2 2 5 2s5-.9 5-2"/>+ </g>+ <text data-node-label="" data-detail-anchor="" x="1088.6000000000001" y="486" class="t-primary" font-size="11" font-weight="600" text-anchor="middle">ArtifactStore</text>+ <text data-detail="context" x="1088.6000000000001" y="503" class="t-muted" font-size="8" text-anchor="middle">文件结果与引用发布</text>+ </g>++ <!-- Edge labels -->+ <g data-detail="context" data-edge-from="boundary_gate" data-edge-to="tool_runtime" data-edge-label="准入后执行" data-edge-key="0" data-edge-id="admit_effect">+ <rect x="862.9000000000001" y="400" width="58" height="14" rx="3" class="c-mask"/>+ <text x="891.9000000000001" y="410" class="t-security" font-size="8" text-anchor="middle">准入后执行</text>+ </g>+ <g data-detail="context" data-edge-from="turn_driver" data-edge-to="boundary_gate" data-edge-label="工具调用" data-edge-key="1" data-edge-id="ask_for_effect">+ <rect x="623.5" y="270" width="48.4" height="14" rx="3" class="c-mask"/>+ <text x="647.7" y="280" class="t-security" font-size="8" text-anchor="middle">工具调用</text>+ </g>+ <g data-detail="context" data-edge-from="turn_driver" data-edge-to="flow_adapter" data-edge-label="请求 / stream" data-edge-key="2" data-edge-id="dispatch_model_flow">+ <rect x="779" y="223" width="72.4" height="14" rx="3" class="c-mask"/>+ <text x="815.2" y="233" class="t-backend" font-size="8" text-anchor="middle">请求 / stream</text>+ </g>+ <g data-detail="context" data-edge-from="flow_adapter" data-edge-to="response_surface" data-edge-label="增量事件" data-edge-key="3" data-edge-id="emit_response">+ <rect x="919.2" y="99" width="48.4" height="14" rx="3" class="c-mask"/>+ <text x="943.4000000000001" y="109" class="t-backend" font-size="8" text-anchor="middle">增量事件</text>+ </g>+ <g data-detail="context" data-edge-from="request_portal" data-edge-to="host_kernel" data-edge-label="Host 连接" data-edge-key="4" data-edge-id="open_host">+ <rect x="220.4" y="146" width="53.199999999999996" height="14" rx="3" class="c-mask"/>+ <text x="247" y="156" class="t-backend" font-size="8" text-anchor="middle">Host 连接</text>+ </g>+ <g data-detail="context" data-edge-from="tool_runtime" data-edge-to="artifact_store" data-edge-label="文件型结果" data-edge-key="5" data-edge-id="publish_file_result">+ <rect x="1158.6005" y="471" width="58" height="14" rx="3" class="c-mask"/>+ <text x="1187.6005" y="481" class="t-database" font-size="8" text-anchor="middle">文件型结果</text>+ </g>+ <g data-detail="context" data-edge-from="runtime_ledger" data-edge-to="resume_planner" data-edge-label="读取事件与 Artifact 引用" data-edge-key="6" data-edge-id="read_resume_facts">+ <rect x="443.5" y="471" width="125.19999999999999" height="14" rx="3" class="c-mask"/>+ <text x="506.1" y="481" class="t-database" font-size="8" text-anchor="middle">读取事件与 Artifact 引用</text>+ </g>+ <g data-detail="context" data-edge-from="artifact_store" data-edge-to="runtime_ledger" data-edge-label="Artifact 引用" data-edge-key="7" data-edge-id="record_artifact_ref">+ <rect x="940.2" y="471" width="72.4" height="14" rx="3" class="c-mask"/>+ <text x="976.4000000000001" y="481" class="t-database" font-size="8" text-anchor="middle">Artifact 引用</text>+ </g>+ <g data-detail="context" data-edge-from="flow_adapter" data-edge-to="runtime_ledger" data-edge-label="写入 RuntimeEvent" data-edge-key="8" data-edge-id="record_runtime_events">+ <rect x="993.1005000000002" y="305" width="91.6" height="14" rx="3" class="c-mask"/>+ <text x="1038.9005000000002" y="315" class="t-database" font-size="8" text-anchor="middle">写入 RuntimeEvent</text>+ </g>+ <g data-detail="context" data-edge-from="resume_planner" data-edge-to="host_kernel" data-edge-label="验证恢复计划" data-edge-key="9" data-edge-id="reenter_host">+ <rect x="167.2" y="524" width="67.6" height="14" rx="3" class="c-mask"/>+ <text x="201" y="534" class="t-backend" font-size="8" text-anchor="middle">验证恢复计划</text>+ </g>+ <g data-detail="context" data-edge-from="session_owner" data-edge-to="turn_driver" data-edge-label="启动 / 续接" data-edge-key="10" data-edge-id="start_or_resume_turn">+ <rect x="543.4" y="223" width="62.8" height="14" rx="3" class="c-mask"/>+ <text x="574.8" y="233" class="t-backend" font-size="8" text-anchor="middle">启动 / 续接</text>+ </g>+ <g data-detail="context" data-edge-from="host_kernel" data-edge-to="session_owner" data-edge-label="托管命令" data-edge-key="11" data-edge-id="submit_session_command">+ <rect x="339.5" y="265" width="48.4" height="14" rx="3" class="c-mask"/>+ <text x="363.7" y="275" class="t-backend" font-size="8" text-anchor="middle">托管命令</text>+ </g>++ <!-- Legend -->+ <g data-legend="" data-legend-bridge="">+ <text x="20" y="552" class="t-primary" font-size="12" font-weight="650">图例</text>+ <g data-legend-semantic-kind="frontend" data-legend-kind="frontend" data-legend-label="用户界面" data-legend-x="20" data-legend-baseline="572" data-legend-width="78">+ <rect x="20" y="564" width="14" height="9" rx="2" class="c-frontend" stroke-width="1"/>+ <text x="42" y="572" class="t-muted" font-size="7.5" font-weight="500">用户界面</text>+ </g>+ <g data-legend-semantic-kind="backend" data-legend-kind="backend" data-legend-label="Agent 逻辑" data-legend-x="105" data-legend-baseline="572" data-legend-width="87">+ <rect x="105" y="564" width="14" height="9" rx="2" class="c-backend" stroke-width="1"/>+ <text x="127" y="572" class="t-muted" font-size="7.5" font-weight="500">Agent 逻辑</text>+ </g>+ <g data-legend-semantic-kind="security" data-legend-kind="security" data-legend-label="策略" data-legend-x="199" data-legend-baseline="572" data-legend-width="61">+ <rect x="199" y="564" width="14" height="9" rx="2" class="c-security" stroke-width="1"/>+ <text x="221" y="572" class="t-muted" font-size="7.5" font-weight="500">策略</text>+ </g>+ <g data-legend-semantic-kind="messagebus" data-legend-kind="messagebus" data-legend-label="工具操作" data-legend-x="267" data-legend-baseline="572" data-legend-width="78">+ <rect x="267" y="564" width="14" height="9" rx="2" class="c-messagebus" stroke-width="1"/>+ <text x="289" y="572" class="t-muted" font-size="7.5" font-weight="500">工具操作</text>+ </g>+ <g data-legend-semantic-kind="database" data-legend-kind="database" data-legend-label="上下文 / 追踪" data-legend-x="352" data-legend-baseline="572" data-legend-width="100">+ <rect x="352" y="564" width="14" height="9" rx="2" class="c-database" stroke-width="1"/>+ <text x="374" y="572" class="t-muted" font-size="7.5" font-weight="500">上下文 / 追踪</text>+ </g>+ <g data-legend-semantic-kind="cloud" data-legend-kind="cloud" data-legend-label="云服务" data-legend-x="459" data-legend-baseline="572" data-legend-width="70">+ <rect x="459" y="564" width="14" height="9" rx="2" class="c-cloud" stroke-width="1"/>+ <text x="481" y="572" class="t-muted" font-size="7.5" font-weight="500">云服务</text>+ </g>+ </g>+ </svg>+ <p class="intent-trace-status no-print" id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"></p>+ <div class="share-chapter-cue no-print" id="share-chapter-cue" hidden role="status" aria-live="polite">+ <div class="share-chapter-index">+ <span class="share-chapter-state" id="share-chapter-state">就绪</span>+ <span class="share-chapter-count" id="share-chapter-count">章节 01 / 01</span>+ </div>+ <div class="share-chapter-copy">+ <strong id="share-chapter-label">引导章节</strong>+ <small id="share-chapter-note"></small>+ </div>+ <span class="share-chapter-route" id="share-chapter-route"></span>+ <span class="share-chapter-progress" aria-hidden="true"><span id="share-chapter-progress-bar"></span></span>+ </div>+ <div class="diagram-guide no-print" id="diagram-guide" hidden role="dialog" aria-modal="false" aria-labelledby="diagram-guide-title">+ <div class="diagram-guide-head">+ <span>+ <span class="diagram-guide-eyebrow">图表指南</span>+ <strong class="diagram-guide-title" id="diagram-guide-title">探索此系统</strong>+ </span>+ <button class="diagram-guide-close" id="diagram-guide-close" type="button" aria-label="关闭图表指南">×</button>+ </div>+ <p class="diagram-guide-stats" id="diagram-guide-stats">正在检查已编译语义</p>+ <div class="diagram-guide-actions" id="diagram-guide-actions" role="group" aria-label="图表探索操作">+ <button class="diagram-guide-action" type="button" data-guide-action="find" aria-label="查找任意节点">+ <span class="diagram-guide-index" aria-hidden="true">01</span>+ <span class="diagram-guide-action-copy"><strong>查找任意节点</strong><small>搜索标签、职责、类型和稳定 ID。</small></span>+ <kbd aria-hidden="true">/</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="route" aria-label="追踪有向路径">+ <span class="diagram-guide-index" aria-hidden="true">02</span>+ <span class="diagram-guide-action-copy"><strong>追踪路径</strong><small>查看两个语义节点如何按编写方向连接。</small></span>+ <kbd aria-hidden="true">R</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="map" aria-label="查看完整系统">+ <span class="diagram-guide-index" aria-hidden="true">03</span>+ <span class="diagram-guide-action-copy"><strong>查看完整系统</strong><small>打开带实时视口和稳定节点的语义雷达。</small></span>+ <kbd aria-hidden="true">M</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="lens" aria-label="比较语义类型">+ <span class="diagram-guide-index" aria-hidden="true">04</span>+ <span class="diagram-guide-action-copy"><strong>比较语义类型</strong><small>统计角色、显示流量并比较直接编写的连接。</small></span>+ <kbd aria-hidden="true">L</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="story" aria-label="播放引导故事">+ <span class="diagram-guide-index" aria-hidden="true">05</span>+ <span class="diagram-guide-action-copy"><strong>播放引导故事</strong><small id="diagram-guide-story-copy">浏览已编写的章节和真实关系。</small></span>+ <kbd aria-hidden="true">P</kbd>+ </button>+ <button class="diagram-guide-action" type="button" data-guide-action="present" aria-label="进入演示模式">+ <span class="diagram-guide-index" aria-hidden="true">06</span>+ <span class="diagram-guide-action-copy"><strong>进入演示模式</strong><small>让实时图表占满视口,同时不改变导出。</small></span>+ <kbd aria-hidden="true">F</kbd>+ </button>+ </div>+ <div class="diagram-guide-shortcuts" aria-label="其他键盘快捷键">+ <span><kbd>E</kbd> 导出</span><span><kbd>T</kbd> 主题</span><span><kbd>S</kbd> 风格</span><span><kbd>0</kbd> 重置</span><span><kbd>+</kbd> 放大</span><span><kbd>-</kbd> 缩小</span><span><kbd>Esc</kbd> 关闭</span>+ </div>+ <p class="diagram-guide-feedback" id="diagram-guide-feedback" aria-live="polite"></p>+ </div>+ <div class="node-finder no-print" id="node-finder" hidden role="dialog" aria-modal="false" aria-labelledby="node-finder-title">+ <div class="node-finder-head">+ <strong id="node-finder-title">查找节点</strong>+ <button class="node-finder-close" id="node-finder-close" type="button" aria-label="关闭节点查找器">×</button>+ </div>+ <div class="node-finder-search">+ <span aria-hidden="true">⌕</span>+ <input class="node-finder-input" id="node-finder-input" type="search" autocomplete="off" spellcheck="false" placeholder="搜索标签或 ID" aria-label="搜索图表节点" aria-describedby="node-finder-status">+ <kbd aria-hidden="true">/</kbd>+ </div>+ <div class="node-finder-results" id="node-finder-results" role="group" aria-label="图表节点"></div>+ <p class="node-finder-empty" id="node-finder-empty" hidden>没有匹配的节点</p>+ <p class="node-finder-status" id="node-finder-status" aria-live="polite"></p>+ </div>+ <div class="focus-chip relationship-lens no-print" id="focus-chip" hidden role="region" aria-labelledby="relationship-lens-title">+ <div class="relationship-lens-head">+ <div class="relationship-lens-copy">+ <span class="relationship-lens-eyebrow">语义护照</span>+ <strong class="relationship-lens-title" id="relationship-lens-title"><span id="focus-label"></span></strong>+ <span class="semantic-passport-detail" id="focus-detail" hidden></span>+ <div class="semantic-passport-meta" id="focus-passport-meta" aria-label="节点元数据">+ <span id="focus-kind" data-passport="kind"></span>+ <span id="focus-context" data-passport="context" hidden></span>+ <span id="focus-tag" data-passport="tag" hidden></span>+ <span id="focus-brand" data-passport="brand" hidden></span>+ <code id="focus-id" data-passport="id"></code>+ </div>+ <div class="semantic-passport-evidence" id="focus-evidence" hidden aria-label="已验证的源代码证据">+ <div class="semantic-passport-evidence-head">+ <span class="semantic-passport-evidence-status">已验证来源</span>+ <a class="semantic-passport-repository" id="focus-repository" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer"></a>+ </div>+ <div class="semantic-passport-evidence-links" id="focus-evidence-links"></div>+ </div>+ <span class="relationship-lens-summary" id="focus-summary" aria-live="polite"></span>+ <div class="semantic-passport-reach" id="focus-reach" hidden>+ <span class="semantic-passport-reach-label">编写可达范围</span>+ <div class="semantic-passport-reach-actions" role="group" aria-label="追踪编写的可达性">+ <button id="btn-reach-upstream" type="button" aria-label="追踪上游编写可达性" aria-pressed="false">+ <span>上游</span><strong id="focus-reach-upstream-count">0</strong>+ </button>+ <button id="btn-reach-downstream" type="button" aria-label="追踪下游编写可达性" aria-pressed="false">+ <span>下游</span><strong id="focus-reach-downstream-count">0</strong>+ </button>+ </div>+ <small class="semantic-passport-reach-status" id="focus-reach-status" hidden aria-live="polite"></small>+ </div>+ </div>+ <div class="relationship-lens-actions">+ <button id="btn-focus-clear" type="button" aria-label="关闭语义护照" title="关闭">×</button>+ <button id="btn-focus-copy" type="button" aria-label="复制聚焦节点的链接">复制链接</button>+ <button id="btn-focus-relations" type="button" aria-label="显示关联关系" aria-expanded="false" aria-controls="relationship-lens-list">关系</button>+ </div>+ </div>+ <div class="relationship-lens-list" id="relationship-lens-list" aria-label="关联关系"></div>+ </div>+ <div class="route-probe no-print" id="route-probe" hidden role="region" aria-labelledby="route-probe-title" data-state="idle">+ <div class="route-probe-head">+ <span class="route-probe-copy">+ <span class="route-probe-eyebrow">路径探测</span>+ <strong class="route-probe-title" id="route-probe-title">选择起点节点</strong>+ </span>+ <span class="route-probe-actions">+ <button class="route-probe-find" id="route-probe-find" type="button" aria-label="查找路径起点" data-node-finder-trigger>查找起点</button>+ <button class="route-probe-copy-link" id="route-probe-copy" type="button" aria-label="复制已追踪路径的链接" hidden>复制链接</button>+ <button id="route-probe-clear" type="button" aria-label="清除路径探测">清除</button>+ </span>+ </div>+ <div class="route-probe-path" id="route-probe-path" aria-label="已追踪路径">+ <span class="route-probe-placeholder">在图表中选择两个语义节点</span>+ </div>+ <div class="route-journey-controls" id="route-journey-controls" hidden role="group" aria-label="路径旅程控制" data-playing="false">+ <button id="route-journey-prev" type="button" aria-label="上一个路径位置" title="上一个路径位置">←</button>+ <button class="route-journey-play" id="route-journey-play" type="button" aria-label="播放路径旅程" aria-pressed="false" title="播放路径旅程">+ <span id="route-journey-play-icon" aria-hidden="true">▶</span>+ <span id="route-journey-play-label">旅程</span>+ </button>+ <button id="route-journey-next" type="button" aria-label="下一个路径位置" title="下一个路径位置">→</button>+ <button class="route-journey-overview" id="route-journey-overview" type="button" aria-label="显示完整路径总览" title="显示完整路径总览">总览</button>+ </div>+ <small class="route-probe-status" id="route-probe-status" aria-live="polite">先选择来源,再选择目标;方向很重要。</small>+ </div>+ <div class="semantic-lens no-print" id="semantic-lens" hidden role="dialog" aria-modal="false" aria-labelledby="semantic-lens-title">+ <div class="semantic-lens-head">+ <span>+ <span class="semantic-lens-eyebrow">语义透镜</span>+ <strong class="semantic-lens-title" id="semantic-lens-title">比较系统角色</strong>+ </span>+ <button class="semantic-lens-close" id="semantic-lens-close" type="button" aria-label="关闭语义透镜">×</button>+ </div>+ <p class="semantic-lens-instruction">最多选择两种语义类型。选择一种可显示其真实流量;选择两种只比较直接编写的关系。</p>+ <div class="semantic-lens-kinds" id="semantic-lens-kinds" role="group" aria-label="语义类型"></div>+ <p class="semantic-lens-status" id="semantic-lens-status" aria-live="polite">选择一种类型以检查其节点和相连关系。</p>+ <div class="semantic-lens-actions">+ <button id="semantic-lens-copy" type="button" aria-label="复制语义透镜链接" hidden>复制链接</button>+ <button id="semantic-lens-clear" type="button" aria-label="清除语义透镜">清除</button>+ </div>+ </div>+ <div class="overview-map no-print" id="overview-map" hidden role="region" aria-labelledby="overview-map-title">+ <div class="overview-map-head">+ <span class="overview-map-live" aria-hidden="true"></span>+ <span class="overview-map-copy">+ <strong id="overview-map-title">语义雷达</strong>+ <small id="overview-map-status" aria-live="polite">正在构建总览</small>+ </span>+ <button class="overview-map-expand" id="overview-map-expand" type="button" aria-label="打开完整语义雷达">打开雷达</button>+ <button class="overview-map-close" id="overview-map-close" type="button" aria-label="关闭语义雷达">×</button>+ </div>+ <div class="overview-map-surface" id="overview-map-surface" tabindex="0" role="group" aria-label="图表总览。点击节点进行聚焦,或使用方向键平移。"></div>+ <div class="overview-map-hint" aria-hidden="true"><span>点击节点</span><span>拖动平移</span></div>+ </div>+ <p class="overview-map-feedback no-print" id="overview-map-feedback" role="status" aria-live="polite" hidden>语义雷达需要更多地图可见空间。</p>+ <div class="diagram-nav no-print" role="toolbar" aria-label="图表视图控制">+ <button id="btn-route-probe" type="button" aria-label="追踪有向路径" aria-pressed="false" aria-controls="route-probe" title="追踪路径(R)">路径</button>+ <button id="btn-overview-map" type="button" aria-label="打开语义雷达" aria-expanded="false" aria-controls="overview-map" title="语义雷达(M)">地图</button>+ <button id="btn-semantic-lens" type="button" aria-label="打开语义透镜" aria-haspopup="dialog" aria-expanded="false" aria-pressed="false" aria-controls="semantic-lens" title="语义透镜(L)">透镜</button>+ <button id="btn-node-finder" type="button" aria-label="查找节点" aria-haspopup="dialog" aria-expanded="false" aria-controls="node-finder" title="查找节点(/)" data-node-finder-trigger><span class="diagram-nav-icon find" aria-hidden="true"></span></button>+ <button id="btn-diagram-guide" type="button" aria-label="打开图表指南" aria-haspopup="dialog" aria-expanded="false" aria-controls="diagram-guide" title="图表指南(?)"><span class="diagram-nav-icon guide" aria-hidden="true"></span></button>+ <button data-view="out" type="button" aria-label="缩小" title="缩小(-)"><span class="diagram-nav-icon minus" aria-hidden="true"></span></button>+ <button data-view="reset" type="button" aria-label="重置图表视图" title="重置视图(0)"><span class="diagram-nav-detail" data-view-detail hidden>阅读</span><span class="diagram-nav-percent" data-view-percent>100%</span></button>+ <button data-view="in" type="button" aria-label="放大" title="放大(+)"><span class="diagram-nav-icon plus" aria-hidden="true"></span></button>+ </div>+ </div>++ <!-- Info Cards -->+ <div class="cards">+ <div class="card">+ <div class="card-header">+ <div class="card-dot emerald"></div>+ <h3>托管权威不下沉</h3>+ </div>+ <ul>+ <li>• RuntimeHostKernel 保持根目录唯一执行权威</li>+ <li>• SessionManager 与 RuntimeRunner 管理 Session、Turn 和续接</li>+ </ul>+ </div>++ <div class="card">+ <div class="card-header">+ <div class="card-dot violet"></div>+ <h3>恢复依赖规范事实</h3>+ </div>+ <ul>+ <li>• ArtifactStore 发布文件结果并把引用写入 RuntimeEvent</li>+ <li>• RuntimeContinuationPlanner 从 SQLite 账本恢复后重新进入 Host</li>+ </ul>+ </div>+ </div>++ </div>++ <script>+ var Archify = {};+ var archifyI18nData = (function () {+ var node = document.getElementById('archify-i18n-data');+ try { return JSON.parse(node ? node.textContent : '{}'); }+ catch (_) { return { locale: 'en', messages: {} }; }+ })();+ Archify.locale = archifyI18nData.locale || 'en';++ function viewerText(key, values) {+ var messages = archifyI18nData.messages || {};+ var template = Object.prototype.hasOwnProperty.call(messages, key) ? messages[key] : key;+ return String(template).replace(/\{([a-zA-Z0-9_]+)\}/g, function (match, name) {+ return values && Object.prototype.hasOwnProperty.call(values, name) ? String(values[name]) : match;+ });+ }++ function viewerCount(key, count, values) {+ var suffix = Number(count) === 1 ? '.one' : '.other';+ var payload = Object.assign({}, values || {}, { count: count });+ return viewerText(key + suffix, payload);+ }++ function viewerKindLabel(value) {+ var normalized = String(value || 'node').toLowerCase();+ var knownKey = 'viewer.kind.' + normalized;+ var known = viewerText(knownKey);+ if (known !== knownKey) return known;+ return normalized+ .replace(/messagebus/gi, 'message bus')+ .replace(/[-_]+/g, ' ')+ .replace(/\b\w/g, function (letter) { return letter.toUpperCase(); });+ }++ function hasDrawableGeometry(element) {+ if (!element) return false;+ var geometries = /^(path|line|polyline)$/i.test(element.tagName)+ ? [element]+ : Array.prototype.slice.call(element.querySelectorAll('path, line, polyline'));+ return geometries.some(function (geometry) {+ var source = geometry.tagName.toLowerCase() === 'path'+ ? geometry.getAttribute('d')+ : geometry.tagName.toLowerCase() === 'polyline'+ ? geometry.getAttribute('points')+ : [geometry.getAttribute('x1'), geometry.getAttribute('y1'), geometry.getAttribute('x2'), geometry.getAttribute('y2')].join(' ');+ if (!source || /(?:^|[^a-z])(?:nan|infinity)(?:[^a-z]|$)/i.test(source) || typeof geometry.getTotalLength !== 'function') return false;+ try {+ var length = Number(geometry.getTotalLength());+ return Number.isFinite(length) && length > 0;+ } catch (_) {+ return false;+ }+ });+ }++ /* ============================================================+ Visual style try-on — one topology, four bundled presets.+ The reader's choice is intentionally session-only: it updates the+ live page and canonical SVG together, but never rewrites the source,+ URL, or a later diagram's authored default.+ ============================================================ */+ Archify.preset = (function () {+ var PRESETS = ['classic', 'signal-flow', 'blueprint', 'editorial'];+ var LABELS = {+ classic: viewerText('viewer.preset.classic.short'),+ 'signal-flow': viewerText('viewer.preset.flow.short'),+ blueprint: viewerText('viewer.preset.blueprint'),+ editorial: viewerText('viewer.preset.editorial')+ };+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-preset');+ var label = document.getElementById('preset-label');+ var menu = document.getElementById('preset-menu');+ var options = function () {+ return Array.prototype.slice.call(menu.querySelectorAll('[data-preset-value]'));+ };+ var authored = PRESETS.indexOf(html.getAttribute('data-preset')) >= 0+ ? html.getAttribute('data-preset')+ : 'classic';++ function current() {+ var value = html.getAttribute('data-preset');+ return PRESETS.indexOf(value) >= 0 ? value : authored;+ }+ function nextAfter(preset) {+ return PRESETS[(PRESETS.indexOf(preset) + 1) % PRESETS.length];+ }+ function apply(preset) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (PRESETS.indexOf(preset) < 0) return false;+ html.setAttribute('data-preset', preset);+ svg.setAttribute('data-preset', preset);+ btn.setAttribute('data-preset-option', preset);+ label.textContent = LABELS[preset];+ btn.setAttribute('aria-label', viewerText('viewer.preset.current', { style: LABELS[preset] }));+ btn.title = viewerText('viewer.preset.choose.title');+ options().forEach(function (option) {+ var selected = option.getAttribute('data-preset-value') === preset;+ option.setAttribute('aria-checked', String(selected));+ });+ return true;+ }+ function cycle() { return apply(nextAfter(current())); }++ function isOpen() { return menu.classList.contains('open'); }+ function open(focusLast) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ menu.classList.add('open');+ btn.setAttribute('aria-expanded', 'true');+ var available = options();+ var selected = available.find(function (option) { return option.getAttribute('aria-checked') === 'true'; });+ var target = focusLast ? available[available.length - 1] : (selected || available[0]);+ if (target) target.focus();+ return true;+ }+ function close(focusTrigger) {+ menu.classList.remove('open');+ btn.setAttribute('aria-expanded', 'false');+ if (focusTrigger) btn.focus();+ return false;+ }++ apply(authored);+ btn.addEventListener('click', function (e) {+ e.stopPropagation();+ if (isOpen()) close(false);+ else open(false);+ });+ btn.addEventListener('keydown', function (e) {+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault();+ if (!isOpen()) open(e.key === 'ArrowUp');+ }+ });+ document.addEventListener('click', function (e) {+ if (!menu.contains(e.target) && e.target !== btn) close(false);+ });+ menu.addEventListener('click', function (e) {+ var option = e.target.closest('[data-preset-value]');+ if (!option || !menu.contains(option)) return;+ if (apply(option.getAttribute('data-preset-value'))) close(true);+ });+ menu.addEventListener('keydown', function (e) {+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }+ if (e.key === 'Tab') { close(false); return; }+ var available = options();+ var active = available.indexOf(document.activeElement);+ switch (e.key) {+ case 'ArrowDown':+ e.preventDefault();+ if (available.length) available[(active + 1 + available.length) % available.length].focus();+ break;+ case 'ArrowUp':+ e.preventDefault();+ if (available.length) available[(active - 1 + available.length) % available.length].focus();+ break;+ case 'Home':+ e.preventDefault();+ if (available[0]) available[0].focus();+ break;+ case 'End':+ e.preventDefault();+ if (available.length) available[available.length - 1].focus();+ break;+ }+ });+ return { cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen };+ })();++ /* ============================================================+ Theme toggle — persists to localStorage, respects system pref+ ============================================================ */++ Archify.theme = (function () {+ var STORAGE_KEY = 'archify-theme';+ var html = document.documentElement;+ var btn = document.getElementById('btn-theme');+ var label = document.getElementById('theme-label');++ // localStorage can throw (blocked cookies, sandboxed iframes); the whole+ // script element dies on an uncaught error, so guard every access.+ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored(value) {+ try { localStorage.setItem(STORAGE_KEY, value); } catch (_) {}+ }+ function urlOverride() {+ // URL param wins (useful for deterministic screenshots / share links)+ try {+ var param = new URLSearchParams(window.location.search).get('theme');+ if (param === 'light' || param === 'dark') return param;+ } catch (_) {}+ return null;+ }++ function resolveInitial() {+ var fromUrl = urlOverride();+ if (fromUrl) return fromUrl;+ var saved = readStored();+ if (saved === 'light' || saved === 'dark') return saved;+ return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';+ }++ function apply(theme) {+ html.setAttribute('data-theme', theme);+ label.textContent = viewerText(theme === 'dark' ? 'viewer.theme.dark' : 'viewer.theme.light');+ btn.setAttribute('aria-pressed', theme === 'light' ? 'true' : 'false');+ }++ function toggle() {+ var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';+ apply(next);+ writeStored(next);+ }++ apply(resolveInitial());+ btn.addEventListener('click', toggle);++ // Follow live OS theme changes while the user has no explicit preference.+ try {+ var media = window.matchMedia('(prefers-color-scheme: light)');+ var onChange = function (e) {+ var saved = readStored();+ if (urlOverride() || saved === 'light' || saved === 'dark') return;+ apply(e.matches ? 'light' : 'dark');+ };+ if (media.addEventListener) media.addEventListener('change', onChange);+ else if (media.addListener) media.addListener(onChange);+ } catch (_) {}++ return { toggle: toggle };+ })();++ /* ============================================================+ Export — Share Card / PNG / JPEG / WebP / SVG / WebM and clipboard++ Raster exports are always rendered at 4x source resolution for+ maximum sharpness. The trick: we set the serialized SVG's+ `width`/`height` to viewBox * 4 so the browser rasterizes the+ vectors at that resolution natively. drawImage then draws at+ the image's natural size (no upscaling = no blur).++ JPEG/WebP paint the current theme's background explicitly since+ those formats have no alpha channel.+ ============================================================ */+ (function () {+ var RASTER_SCALE = 4;+ var MOTION_DURATION = 6000;+ var MOTION_FPS = 30;+ var SHARE_CARD_WIDTH = 1200;+ var SHARE_CARD_HEIGHT = 630;+ var SHARE_CARD_PADDING = 36;+ var SHARE_CARD_HEADER = 112;++ function exportError(key, values) {+ var error = new Error(viewerText(key, values));+ error.archifyViewerMessage = true;+ return error;+ }++ function exportMessage(error) {+ return error && error.archifyViewerMessage+ ? error.message+ : viewerText('viewer.export.unknown');+ }++ function diagramFilename() {+ var title = (document.title || 'diagram')+ .replace(/\s+Architecture(\s+Diagram)?$/i, '')+ .replace(/\s+Diagram$/i, '')+ .trim();+ return title.replace(/[^a-z0-9_\-]+/gi, '-')+ .toLowerCase()+ .replace(/^-+|-+$/g, '') || 'diagram';+ }++ function currentBg() {+ return getComputedStyle(document.body).backgroundColor || '#ffffff';+ }++ /**+ * Serialize the main SVG into a standalone document.+ *+ * Two modes:+ * - Default (opts.autoTheme=false) — locks the serialized SVG to the+ * viewer's current theme. Used by the raster pipeline+ * (PNG/JPEG/WebP/clipboard) because canvas rasterization needs+ * deterministic colors; a raster cannot react to+ * prefers-color-scheme after encoding.+ * - autoTheme=true — emits BOTH dark and light variable sets plus a+ * `@media (prefers-color-scheme)` rule so the resulting SVG+ * self-themes when embedded in GitHub READMEs or other hosts that+ * expose a color scheme. Used for "Download SVG".+ */+ function applyRouteSnapshot(clone, snapshot) {+ if (!snapshot || !Array.isArray(snapshot.nodeIds) || !Array.isArray(snapshot.edges) ||+ snapshot.nodeIds.length < 2 || snapshot.edges.length !== snapshot.nodeIds.length - 1 ||+ snapshot.hops !== snapshot.edges.length ||+ !snapshot.source || !snapshot.target ||+ snapshot.source.id !== snapshot.nodeIds[0] ||+ snapshot.target.id !== snapshot.nodeIds[snapshot.nodeIds.length - 1]) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId]) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ nodeMatches.push(matchedNodes);+ }++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ var fromId = snapshot.nodeIds[edgeIndex];+ var toId = snapshot.nodeIds[edgeIndex + 1];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ edge.from !== fromId || edge.to !== toId) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push(matchedEdges);+ }++ clone.setAttribute('data-share-route', '');+ nodeMatches.forEach(function (matches, step) {+ matches.forEach(function (element) {+ element.setAttribute('data-share-route-match', '');+ element.setAttribute('data-share-route-step', String(step));+ if (step === 0) element.setAttribute('data-share-route-start', '');+ else if (step === snapshot.nodeIds.length - 1) element.setAttribute('data-share-route-end', '');+ else element.setAttribute('data-share-route-middle', '');+ });+ });+ edgeMatches.forEach(function (matches, step) {+ matches.forEach(function (element) {+ element.setAttribute('data-share-route-match', '');+ element.setAttribute('data-share-route-step', String(step));+ });+ });++ return clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-route-active') &&+ !clone.hasAttribute('data-route-journey') &&+ clone.querySelectorAll('[data-animate], [data-route-match], [data-route-step], [data-route-start], [data-route-end], [data-route-journey-state], [data-route-journey-current], [data-route-journey-overlay]').length === 0 &&+ clone.querySelectorAll('[data-share-route-match]').length ===+ nodeMatches.reduce(function (count, matches) { return count + matches.length; }, 0) ++ edgeMatches.reduce(function (count, matches) { return count + matches.length; }, 0);+ }++ function applyReachSnapshot(clone, snapshot) {+ if (!snapshot || (snapshot.direction !== 'upstream' && snapshot.direction !== 'downstream') ||+ !snapshot.origin || typeof snapshot.origin.id !== 'string' || !snapshot.origin.id ||+ typeof snapshot.origin.label !== 'string' || !snapshot.origin.label.trim() ||+ !Array.isArray(snapshot.nodeIds) || snapshot.nodeIds.length < 2 ||+ !Array.isArray(snapshot.edges) || !snapshot.edges.length ||+ !snapshot.depths || typeof snapshot.depths !== 'object' ||+ !Number.isInteger(snapshot.maxDepth) || snapshot.maxDepth < 1 ||+ snapshot.nodeIds[0] !== snapshot.origin.id) return false;++ clone.removeAttribute('data-animation');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-animate]'), function (element) {+ element.removeAttribute('data-animate');+ element.style.removeProperty('--step');+ });++ var cloneNodes = Array.prototype.slice.call(clone.querySelectorAll('[data-node-id]'));+ var cloneEdges = Array.prototype.slice.call(clone.querySelectorAll('[data-edge-key]'));+ var nodeIds = Object.create(null);+ var edgeKeys = Object.create(null);+ var nodeMatches = [];+ var edgeMatches = [];+ var measuredMaxDepth = 0;++ for (var nodeIndex = 0; nodeIndex < snapshot.nodeIds.length; nodeIndex++) {+ var nodeId = snapshot.nodeIds[nodeIndex];+ var depth = snapshot.depths[nodeId];+ if (typeof nodeId !== 'string' || !nodeId || nodeIds[nodeId] ||+ !Number.isInteger(depth) || depth < 0 || depth > snapshot.maxDepth ||+ (nodeId === snapshot.origin.id ? depth !== 0 : depth < 1)) return false;+ var matchedNodes = cloneNodes.filter(function (candidate) {+ return candidate.getAttribute('data-node-id') === nodeId;+ });+ if (matchedNodes.length !== 1) return false;+ nodeIds[nodeId] = true;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ nodeMatches.push({ elements: matchedNodes, id: nodeId, depth: depth });+ }+ if (measuredMaxDepth !== snapshot.maxDepth) return false;++ for (var edgeIndex = 0; edgeIndex < snapshot.edges.length; edgeIndex++) {+ var edge = snapshot.edges[edgeIndex];+ if (!edge || typeof edge.key !== 'string' || !edge.key || edgeKeys[edge.key] ||+ !nodeIds[edge.from] || !nodeIds[edge.to] ||+ !Number.isInteger(edge.depth) || edge.depth < 1 || edge.depth > snapshot.maxDepth ||+ edge.depth !== Math.max(snapshot.depths[edge.from], snapshot.depths[edge.to])) return false;+ var matchedEdges = cloneEdges.filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edge.key;+ });+ var drawableMatches = matchedEdges.filter(hasDrawableGeometry);+ if (!matchedEdges.length || drawableMatches.length !== 1 || !matchedEdges.every(function (candidate) {+ return candidate.getAttribute('data-edge-from') === edge.from &&+ candidate.getAttribute('data-edge-to') === edge.to &&+ (candidate.getAttribute('data-edge-id') || '') === (edge.id || '');+ })) return false;+ edgeKeys[edge.key] = true;+ edgeMatches.push({ elements: matchedEdges, depth: edge.depth });+ }++ clone.setAttribute('data-share-reach', snapshot.direction);+ nodeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ if (match.id === snapshot.origin.id) element.setAttribute('data-share-reach-origin', '');+ });+ });+ edgeMatches.forEach(function (match) {+ match.elements.forEach(function (element) {+ element.setAttribute('data-share-reach-match', '');+ element.setAttribute('data-share-reach-depth', String(match.depth));+ });+ });++ return clone.getAttribute('data-share-reach') === snapshot.direction &&+ !clone.hasAttribute('data-animation') &&+ !clone.hasAttribute('data-reach-active') &&+ clone.querySelectorAll('[data-animate], [data-reach-match], [data-reach-origin], [data-reach-depth]').length === 0 &&+ clone.querySelectorAll('[data-share-reach-origin]').length === 1 &&+ clone.querySelectorAll('[data-share-reach-match]').length ===+ nodeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0) ++ edgeMatches.reduce(function (count, match) { return count + match.elements.length; }, 0);+ }++ function serializeSvg(scale, opts) {+ // scale: integer multiplier for intrinsic SVG pixel dimensions used by+ // the raster path. Defaults to 1 (natural size) for SVG download.+ scale = scale || 1;+ opts = opts || {};+ var autoTheme = opts.autoTheme === true;+ var svg = document.querySelector('.diagram-container svg');+ var clone = svg.cloneNode(true);++ // View transforms and neighborhood focus are HTML exploration state,+ // never part of a downloaded full-diagram artifact.+ clone.style.removeProperty('transform');+ clone.removeAttribute('data-view-scale');+ clone.removeAttribute('data-focus-active');+ clone.removeAttribute('data-reach-active');+ clone.removeAttribute('data-lens-active');+ clone.removeAttribute('data-lens-flow-count');+ clone.removeAttribute('data-lens-flow-density');+ clone.removeAttribute('data-legend-preview-active');+ clone.removeAttribute('data-relationship-preview-active');+ clone.removeAttribute('data-relationship-direct-active');+ clone.removeAttribute('data-relationship-pin-active');+ clone.removeAttribute('data-intent-trace-active');+ clone.removeAttribute('data-route-picking');+ clone.removeAttribute('data-route-active');+ clone.removeAttribute('data-route-journey');+ clone.removeAttribute('data-share-route');+ clone.removeAttribute('data-share-reach');+ clone.removeAttribute('data-story-active');+ clone.removeAttribute('data-story-playing');+ clone.removeAttribute('data-story-beat');+ clone.removeAttribute('data-story-next');+ clone.removeAttribute('data-story-follow');+ clone.removeAttribute('data-chapter-handoff');+ clone.removeAttribute('data-chapter-anchor');+ clone.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-handoff-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-role]'), function (el) {+ el.removeAttribute('data-chapter-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-chapter-preview-role]'), function (el) {+ el.removeAttribute('data-chapter-preview-role');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-probe-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-journey-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-semantic-lens-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge-runtime]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-kind]'), function (el) {+ el.removeAttribute('data-legend-kind');+ el.removeAttribute('data-legend-label');+ el.removeAttribute('data-legend-count');+ el.removeAttribute('data-legend-zero');+ el.removeAttribute('data-legend-selected');+ el.removeAttribute('role');+ el.removeAttribute('tabindex');+ el.removeAttribute('aria-label');+ el.removeAttribute('aria-pressed');+ el.removeAttribute('aria-haspopup');+ el.removeAttribute('aria-controls');+ el.removeAttribute('aria-expanded');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-bridge]'), function (el) {+ el.removeAttribute('data-legend-bridge');+ el.removeAttribute('role');+ el.removeAttribute('aria-label');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-pulse-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-hit-overlay]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-beacon]'), function (el) {+ el.remove();+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-source-evidence-count]'), function (el) {+ var originalLabel = el.getAttribute('data-source-evidence-original-label');+ if (originalLabel == null || originalLabel === '') el.removeAttribute('aria-label');+ else el.setAttribute('aria-label', originalLabel);+ el.removeAttribute('data-source-evidence-count');+ el.removeAttribute('data-source-evidence-original-label');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-story-step], [data-story-beat-state], [data-story-beat-step]'), function (el) {+ el.removeAttribute('data-story-step');+ el.removeAttribute('data-story-beat-state');+ el.removeAttribute('data-story-beat-step');+ el.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-focus-match], [data-focus-selected]'), function (el) {+ el.removeAttribute('data-focus-match');+ el.removeAttribute('data-focus-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-reach-match], [data-reach-origin], [data-reach-depth]'), function (el) {+ el.removeAttribute('data-reach-match');+ el.removeAttribute('data-reach-origin');+ el.removeAttribute('data-reach-depth');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (el) {+ el.removeAttribute('data-lens-match');+ el.removeAttribute('data-lens-selected');+ el.removeAttribute('data-lens-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (el) {+ el.removeAttribute('data-legend-preview-match');+ el.removeAttribute('data-legend-preview-selected');+ el.removeAttribute('data-legend-preview-peer');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target]'), function (el) {+ el.removeAttribute('data-relationship-preview');+ el.removeAttribute('data-relationship-preview-node');+ el.removeAttribute('data-relationship-preview-source');+ el.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-intent-trace-match], [data-intent-trace-selected]'), function (el) {+ el.removeAttribute('data-intent-trace-match');+ el.removeAttribute('data-intent-trace-selected');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current]'), function (el) {+ el.removeAttribute('data-route-match');+ el.removeAttribute('data-route-start');+ el.removeAttribute('data-route-end');+ el.removeAttribute('data-route-step');+ el.removeAttribute('data-route-candidate');+ el.removeAttribute('data-route-journey-state');+ el.removeAttribute('data-route-journey-current');+ el.style.removeProperty('--route-step');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle]'), function (el) {+ el.removeAttribute('data-share-route-match');+ el.removeAttribute('data-share-route-step');+ el.removeAttribute('data-share-route-start');+ el.removeAttribute('data-share-route-end');+ el.removeAttribute('data-share-route-middle');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth]'), function (el) {+ el.removeAttribute('data-share-reach-match');+ el.removeAttribute('data-share-reach-origin');+ el.removeAttribute('data-share-reach-depth');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-detail], [data-detail-anchor]'), function (el) {+ el.removeAttribute('data-detail');+ el.removeAttribute('data-detail-anchor');+ });+ Array.prototype.forEach.call(clone.querySelectorAll('[data-node-id][aria-pressed]'), function (el) {+ el.setAttribute('aria-pressed', 'false');+ });+ var canonicalStateClean = !clone.hasAttribute('data-view-scale') &&+ !clone.hasAttribute('data-focus-active') &&+ !clone.hasAttribute('data-reach-active') &&+ !clone.hasAttribute('data-lens-active') &&+ !clone.hasAttribute('data-lens-flow-count') &&+ !clone.hasAttribute('data-lens-flow-density') &&+ !clone.hasAttribute('data-legend-preview-active') &&+ !clone.hasAttribute('data-relationship-preview-active') &&+ !clone.hasAttribute('data-relationship-direct-active') &&+ !clone.hasAttribute('data-intent-trace-active') &&+ !clone.hasAttribute('data-route-picking') &&+ !clone.hasAttribute('data-route-active') &&+ !clone.hasAttribute('data-route-journey') &&+ !clone.hasAttribute('data-share-route') &&+ !clone.hasAttribute('data-share-reach') &&+ !clone.hasAttribute('data-story-active') &&+ !clone.hasAttribute('data-story-playing') &&+ !clone.hasAttribute('data-story-beat') &&+ !clone.hasAttribute('data-story-next') &&+ !clone.hasAttribute('data-story-follow') &&+ !clone.hasAttribute('data-chapter-handoff') &&+ !clone.hasAttribute('data-chapter-anchor') &&+ !clone.hasAttribute('data-chapter-preview') &&+ !clone.style.getPropertyValue('transform') &&+ clone.querySelectorAll('[data-story-overlay], [data-story-carrier-overlay], [data-story-carrier-token], [data-story-step], [data-story-beat-state], [data-story-beat-step], [data-chapter-handoff-overlay], [data-chapter-role], [data-chapter-preview-role], [data-focus-match], [data-focus-selected], [data-reach-match], [data-reach-origin], [data-reach-depth], [data-semantic-lens-overlay], [data-lens-match], [data-lens-selected], [data-lens-peer], [data-legend-bridge], [data-legend-kind], [data-legend-bridge-runtime], [data-legend-count], [data-legend-zero], [data-legend-selected], [data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer], [data-relationship-hit-overlay], [data-relationship-pulse-overlay], [data-relationship-preview], [data-relationship-preview-node], [data-relationship-preview-source], [data-relationship-preview-target], [data-intent-trace-overlay], [data-intent-trace-match], [data-intent-trace-selected], [data-route-probe-overlay], [data-route-journey-overlay], [data-route-match], [data-route-start], [data-route-end], [data-route-step], [data-route-candidate], [data-route-journey-state], [data-route-journey-current], [data-share-route-match], [data-share-route-step], [data-share-route-start], [data-share-route-end], [data-share-route-middle], [data-share-reach-match], [data-share-reach-origin], [data-share-reach-depth], [data-source-evidence-beacon], [data-source-evidence-count], [data-source-evidence-original-label], [data-detail], [data-detail-anchor]').length === 0;++ var vb = svg.viewBox.baseVal;+ var finiteSvgDimensions = Number.isFinite(vb.x) && Number.isFinite(vb.y) &&+ Number.isFinite(vb.width) && Number.isFinite(vb.height) && vb.width > 0 && vb.height > 0;+ var routeStateClean = opts.routeSnapshot+ ? canonicalStateClean && finiteSvgDimensions && applyRouteSnapshot(clone, opts.routeSnapshot)+ : null;+ var reachStateClean = opts.reachSnapshot+ ? canonicalStateClean && finiteSvgDimensions && !opts.routeSnapshot && applyReachSnapshot(clone, opts.reachSnapshot)+ : null;+ // Scale width/height so the browser rasterizes the vectors at target+ // resolution directly. viewBox stays unchanged so coordinates don't+ // shift. This is the key to sharp rasters — do NOT scale later via+ // canvas upscaling.+ clone.setAttribute('width', vb.width * scale);+ clone.setAttribute('height', vb.height * scale);+ clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');++ // Only the SVG-relevant rules: semantic classes, markers, and the+ // theme variable blocks. Toolbar/cards/print CSS can never apply+ // inside a standalone SVG and would only bloat the export.+ var hostStyle = (function () {+ var out = [];+ Array.prototype.forEach.call(document.styleSheets, function (sheet) {+ var rules;+ try { rules = sheet.cssRules; } catch (_) { return; } // cross-origin+ if (!rules) return;+ Array.prototype.forEach.call(rules, function (rule) {+ if (rule.type === 7 && /^archify-/.test(rule.name || '')) {+ out.push(rule.cssText);+ return;+ }+ if (rule.type !== 1) return; // plain style rules only+ var sel = rule.selectorText || '';+ if (/(^|,)\s*(svg|:root|\[data-theme|\[data-preset|\.c-|\.t-|\.a-|\.m-)/.test(sel)) {+ out.push(rule.cssText);+ }+ });+ });+ return out.join('\n');+ })();++ // Derive the variable list from the stylesheet so newly added theme+ // variables can never be missed by the export pipeline again+ // (--lane-fill/--lane-stroke once were).+ var varNames = (function () {+ var seen = {};+ var names = [];+ (hostStyle.match(/--[a-zA-Z0-9-]+(?=\s*:)/g) || []).forEach(function (n) {+ if (!seen[n]) { seen[n] = true; names.push(n); }+ });+ return names;+ })();++ // Resolve the full variable set for a given data-theme via an+ // off-DOM probe, independent of what the viewer is currently set to.+ function resolveVars(themeAttr) {+ var probe = document.createElement('div');+ probe.setAttribute('data-theme', themeAttr);+ probe.setAttribute('data-preset', document.documentElement.getAttribute('data-preset') || 'classic');+ probe.style.cssText = 'position:absolute;width:0;height:0;visibility:hidden;';+ document.body.appendChild(probe);+ try {+ var c = getComputedStyle(probe);+ return varNames.map(function (n) {+ return n + ': ' + c.getPropertyValue(n).trim() + ';';+ }).join(' ');+ } finally {+ document.body.removeChild(probe);+ }+ }++ // Prepend a local()-only @font-face block for each weight so that the+ // sandboxed image-rendering context used during PNG/JPEG/WebP export+ // can find JetBrains Mono if the user has it installed locally, and+ // falls through cleanly to the monospace stack otherwise. The usual+ // Google-Fonts <link> in the host document is unreachable from the+ // serialized SVG, so url()-sourced faces would just hang.+ var fontFallback = [400, 500, 600, 700].map(function (w) {+ return "@font-face { font-family: 'JetBrains Mono'; font-weight: " + w ++ "; src: local('JetBrains Mono'), local('JetBrainsMono-Regular'); }";+ }).join('\n');++ var style = document.createElementNS('http://www.w3.org/2000/svg', 'style');+ var bgRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ bgRect.setAttribute('width', '100%');+ bgRect.setAttribute('height', '100%');++ if (autoTheme) {+ // Dual-theme SVG. Dark is the default (so hosts without+ // prefers-color-scheme still render), light swaps in via media+ // query, and svg[data-theme="..."] still lets downstream+ // consumers force a specific theme.+ var darkVars = resolveVars('dark');+ var lightVars = resolveVars('light');++ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + darkVars + " }\n" ++ "@media (prefers-color-scheme: light) { :root, svg { " + lightVars + " } }\n" ++ "svg[data-theme=\"light\"] { " + lightVars + " }\n" ++ "svg[data-theme=\"dark\"] { " + darkVars + " }\n" ++ "rect.c-bg-rect { fill: var(--bg); }\n";++ // Don't lock the serialized SVG to the viewer's current theme.+ clone.removeAttribute('data-theme');+ // Background follows the CSS variable, not a fixed color, so it+ // swaps with the media query.+ bgRect.setAttribute('class', 'c-bg-rect');+ } else {+ // Raster path: lock to the viewer's current theme.+ var theme = document.documentElement.getAttribute('data-theme') || 'dark';+ var themeHost = document.querySelector('[data-theme="' + theme + '"]') || document.documentElement;+ var computed = getComputedStyle(themeHost);+ var vars = varNames.map(function (n) {+ return n + ': ' + computed.getPropertyValue(n).trim() + ';';+ }).join(' ');++ // IMPORTANT: inject the resolved variables AFTER hostStyle,+ // otherwise hostStyle's ":root, [data-theme=\"dark\"] { ... }" rule+ // overrides our chosen theme via later-in-cascade equal-specificity.+ // Keep this order.+ style.textContent =+ fontFallback + "\n" ++ "svg { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono CJK SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace; }\n" ++ hostStyle + "\n" ++ ":root, svg { " + vars + " }\n";++ bgRect.setAttribute('fill', computed.getPropertyValue('--bg').trim() || '#ffffff');+ }++ if (opts.routeSnapshot) {+ style.textContent += "\nsvg[data-share-route] [data-node-id], svg[data-share-route] [data-edge-from] { opacity: 0.18; }\n" ++ "svg[data-share-route] [data-share-route-match] { opacity: 1; }\n" ++ "svg[data-share-route] [data-share-route-start] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-route] [data-share-route-middle] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 2.2; }\n" ++ "svg[data-share-route] [data-share-route-end] > :is(rect, circle, polygon):not(.c-mask) { stroke-width: 3.4; stroke-dasharray: 1 0; }\n";+ }+ if (opts.reachSnapshot) {+ style.textContent += "\nsvg[data-share-reach] [data-node-id], svg[data-share-reach] [data-edge-from] { opacity: 0.14; }\n" ++ "svg[data-share-reach] [data-share-reach-match] { opacity: 1; }\n" ++ "svg[data-share-reach] [data-edge-from][data-share-reach-match] { stroke-width: 1.55; }\n" ++ "svg[data-share-reach=\"upstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--database-stroke); stroke-width: 3.4; stroke-dasharray: 5 3; }\n" ++ "svg[data-share-reach=\"downstream\"] [data-share-reach-origin] > :is(rect, circle, polygon):not(.c-mask) { stroke: var(--backend-stroke); stroke-width: 3.4; stroke-dasharray: 1 0; }\n" ++ "svg[data-preset=\"blueprint\"][data-share-reach] [data-share-reach-origin], svg[data-preset=\"blueprint\"][data-share-reach] [data-edge-from][data-share-reach-match] { filter: none; }\n";+ }++ clone.insertBefore(style, clone.firstChild);+ clone.insertBefore(bgRect, style.nextSibling);++ return {+ svgString: new XMLSerializer().serializeToString(clone),+ width: vb.width * scale,+ height: vb.height * scale,+ canonicalStateClean: canonicalStateClean,+ routeStateClean: routeStateClean,+ reachStateClean: reachStateClean+ };+ }++ function download(blob, filename) {+ var url = URL.createObjectURL(blob);+ var a = document.createElement('a');+ a.href = url;+ a.download = filename;+ document.body.appendChild(a);+ a.click();+ a.remove();+ setTimeout(function () { URL.revokeObjectURL(url); }, 1000);+ }++ // Conservative upper bound on total canvas pixels. Older Safari on iOS+ // silently produces a blank canvas above ~16 Mpx; Chrome / Firefox /+ // desktop Safari are far higher but start failing on memory-constrained+ // devices. We pick the largest integer scale in {4,3,2,1} whose target+ // pixel count fits under this cap.+ var MAX_CANVAS_PIXELS = 16 * 1024 * 1024;++ function pickSafeScale(vbW, vbH) {+ for (var s = RASTER_SCALE; s >= 1; s--) {+ if (vbW * s * vbH * s <= MAX_CANVAS_PIXELS) return s;+ }+ return 1;+ }++ function rasterize(format) {+ // Serialize at a safe scale (RASTER_SCALE=4 by default, reduced if the+ // resulting canvas would exceed MAX_CANVAS_PIXELS). The SVG itself is+ // rasterized at target resolution natively; drawImage draws at natural+ // size — no upsampling blur.+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = pickSafeScale(vb.width, vb.height);+ var data = serializeSvg(scale);+ var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });+ var svgUrl = URL.createObjectURL(svgBlob);++ return new Promise(function (resolve, reject) {+ var img = new Image();+ img.onload = function () {+ try {+ var canvas = document.createElement('canvas');+ canvas.width = data.width;+ canvas.height = data.height;+ var ctx = canvas2dOrThrow(canvas, format);+ if (format === 'jpeg') {+ ctx.fillStyle = currentBg();+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ }+ // Draw at natural size — SVG was already rasterized at target res.+ ctx.drawImage(img, 0, 0);+ URL.revokeObjectURL(svgUrl);+ var mime = format === 'jpeg' ? 'image/jpeg' :+ format === 'webp' ? 'image/webp' : 'image/png';+ var quality = format === 'png' ? undefined : 0.95;+ canvas.toBlob(function (blob) {+ if (!blob) reject(exportError('viewer.export.error.toBlobNull', { label: format }));+ else resolve(blob);+ }, mime, quality);+ } catch (error) {+ URL.revokeObjectURL(svgUrl);+ reject(error);+ }+ };+ img.onerror = function (e) {+ URL.revokeObjectURL(svgUrl);+ reject(e);+ };+ img.src = svgUrl;+ });+ }++ function fitCanvasText(ctx, text, maxWidth, startSize, minSize, weight) {+ var value = String(text || '').trim();+ var size = startSize;+ var family = "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";+ while (size > minSize) {+ ctx.font = (weight || '600') + ' ' + size + 'px ' + family;+ if (ctx.measureText(value).width <= maxWidth) return value;+ size -= 1;+ }+ ctx.font = (weight || '600') + ' ' + minSize + 'px ' + family;+ if (ctx.measureText(value).width <= maxWidth) return value;+ var suffix = '\u2026';+ while (value.length > 1 && ctx.measureText(value + suffix).width > maxWidth) {+ value = value.slice(0, -1);+ }+ return value + suffix;+ }++ function canvas2dOrThrow(canvas, label) {+ if (!canvas || typeof canvas.getContext !== 'function') {+ throw exportError('viewer.export.error.canvasUnavailable', { label: label });+ }+ var ctx = canvas.getContext('2d');+ if (!ctx) throw exportError('viewer.export.error.contextUnavailable', { label: label });+ if (typeof canvas.toBlob !== 'function') throw exportError('viewer.export.error.toBlobUnavailable', { label: label });+ return ctx;+ }++ function renderShareCard(options) {+ options = options || {};+ var routeSnapshot = options.routeSnapshot || null;+ var reachSnapshot = options.reachSnapshot || null;+ if (routeSnapshot && reachSnapshot) return Promise.reject(exportError('viewer.export.error.variantsCombined'));+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var sourceScale = Math.min(2, pickSafeScale(vb.width, vb.height));+ var data = serializeSvg(sourceScale, { routeSnapshot: routeSnapshot, reachSnapshot: reachSnapshot });+ if (!data.canonicalStateClean) return Promise.reject(exportError('viewer.export.error.viewerState'));+ if (routeSnapshot && !data.routeStateClean) return Promise.reject(exportError('viewer.export.error.routeState'));+ if (reachSnapshot && !data.reachStateClean) return Promise.reject(exportError('viewer.export.error.reachState'));+ var svgBlob = new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' });+ var svgUrl = URL.createObjectURL(svgBlob);++ return new Promise(function (resolve, reject) {+ var img = new Image();+ img.onload = function () {+ try {+ var canvas = document.createElement('canvas');+ canvas.width = SHARE_CARD_WIDTH;+ canvas.height = SHARE_CARD_HEIGHT;+ var ctx = canvas2dOrThrow(canvas, viewerText('viewer.export.shareCard'));+ var computed = getComputedStyle(document.documentElement);+ var bg = computed.getPropertyValue('--bg').trim() || currentBg();+ var text = computed.getPropertyValue('--text').trim() || '#ffffff';+ var muted = computed.getPropertyValue('--text-muted').trim() || '#94a3b8';+ var border = computed.getPropertyValue('--panel-border').trim() || '#334155';+ var accentProperty = reachSnapshot+ ? (reachSnapshot.direction === 'upstream' ? '--database-stroke' : '--backend-stroke')+ : '--frontend-stroke';+ var accent = computed.getPropertyValue(accentProperty).trim() || '#22d3ee';+ var titleNode = document.querySelector('.header h1');+ var subtitleNode = document.querySelector('.header .subtitle');+ var title = titleNode ? titleNode.textContent : document.title;+ var directionLabel = reachSnapshot+ ? viewerText('viewer.export.direction.' + reachSnapshot.direction)+ : '';+ var subtitle = routeSnapshot+ ? viewerCount('viewer.export.card.routeSummary', routeSnapshot.hops, {+ source: routeSnapshot.source.label,+ target: routeSnapshot.target.label+ })+ : reachSnapshot+ ? viewerText('viewer.export.card.reachSummary', {+ direction: directionLabel,+ origin: reachSnapshot.origin.label,+ nodes: viewerCount('viewer.export.card.node', reachSnapshot.nodeIds.length - 1),+ links: viewerCount('viewer.export.card.link', reachSnapshot.edges.length),+ hops: viewerCount('viewer.export.card.hop', reachSnapshot.maxDepth)+ })+ : subtitleNode ? subtitleNode.textContent : '';+ var preset = document.documentElement.getAttribute('data-preset') || 'classic';+ var theme = document.documentElement.getAttribute('data-theme') || 'dark';+ var presetKey = preset === 'signal-flow'+ ? 'viewer.preset.flow.short'+ : 'viewer.preset.' + preset;+ var presetLabel = viewerText(presetKey).toUpperCase();+ var themeLabel = viewerText('viewer.theme.' + theme).toUpperCase();+ var cardLabel = routeSnapshot+ ? viewerText('viewer.export.card.routeBadge', {+ hops: viewerCount('viewer.export.card.hop', routeSnapshot.hops).toUpperCase()+ })+ : reachSnapshot+ ? viewerText('viewer.export.card.reachBadge', { direction: directionLabel.toUpperCase() })+ : viewerText('viewer.export.card.defaultBadge', { preset: presetLabel, theme: themeLabel });++ ctx.fillStyle = bg;+ ctx.fillRect(0, 0, SHARE_CARD_WIDTH, SHARE_CARD_HEIGHT);++ ctx.fillStyle = accent;+ ctx.fillRect(SHARE_CARD_PADDING, 27, 42, 3);++ ctx.textBaseline = 'alphabetic';+ ctx.fillStyle = text;+ var fittedTitle = fitCanvasText(ctx, title, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 330, 29, 18, '700');+ ctx.fillText(fittedTitle, SHARE_CARD_PADDING, 62);++ ctx.fillStyle = muted;+ var fittedSubtitle = fitCanvasText(ctx, subtitle, SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2 - 280, 13, 11, '500');+ ctx.fillText(fittedSubtitle, SHARE_CARD_PADDING, 87);++ ctx.font = "600 12px 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace";+ ctx.textAlign = 'right';+ ctx.fillStyle = accent;+ ctx.fillText(cardLabel, SHARE_CARD_WIDTH - SHARE_CARD_PADDING, 50);+ ctx.textAlign = 'left';++ var availableWidth = SHARE_CARD_WIDTH - SHARE_CARD_PADDING * 2;+ var availableHeight = SHARE_CARD_HEIGHT - SHARE_CARD_HEADER - SHARE_CARD_PADDING;+ var fit = Math.min(availableWidth / data.width, availableHeight / data.height);+ var drawWidth = data.width * fit;+ var drawHeight = data.height * fit;+ var drawX = SHARE_CARD_PADDING + (availableWidth - drawWidth) / 2;+ var drawY = SHARE_CARD_HEADER + (availableHeight - drawHeight) / 2;++ ctx.strokeStyle = border;+ ctx.lineWidth = 1;+ ctx.strokeRect(drawX - 0.5, drawY - 0.5, drawWidth + 1, drawHeight + 1);+ ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);+ URL.revokeObjectURL(svgUrl);++ canvas.toBlob(function (blob) {+ if (!blob) reject(exportError('viewer.export.error.toBlobNull', { label: viewerText('viewer.export.shareCard') }));+ else resolve(blob);+ }, 'image/png');+ } catch (error) {+ URL.revokeObjectURL(svgUrl);+ reject(error);+ }+ };+ img.onerror = function (e) {+ URL.revokeObjectURL(svgUrl);+ reject(e);+ };+ img.src = svgUrl;+ });+ }++ function rasterizeShareCard(options) {+ options = options || {};+ if (!options.variant) return renderShareCard();+ if (options.variant !== 'route' && options.variant !== 'reach') {+ return Promise.reject(exportError('viewer.export.unknownVariant', { variant: options.variant }));+ }+ if (options.variant === 'route') {+ var routeSnapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ if (!routeSnapshot) return Promise.reject(exportError('viewer.export.routeRequired'));+ return renderShareCard({ routeSnapshot: routeSnapshot });+ }+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ if (!snapshot) return Promise.reject(exportError('viewer.export.reachRequired'));+ return renderShareCard({ reachSnapshot: snapshot });+ }++ function motionMimeType() {+ if (typeof MediaRecorder === 'undefined') return '';+ var candidates = [+ 'video/webm;codecs=vp9',+ 'video/webm;codecs=vp8',+ 'video/webm'+ ];+ for (var i = 0; i < candidates.length; i++) {+ if (!MediaRecorder.isTypeSupported || MediaRecorder.isTypeSupported(candidates[i])) return candidates[i];+ }+ return '';+ }++ function canRecordMotion() {+ var svg = document.querySelector('.diagram-container svg');+ return !!(svg && svg.getAttribute('data-animation') === 'trace' &&+ typeof MediaRecorder !== 'undefined' && motionMimeType() &&+ typeof HTMLCanvasElement !== 'undefined' &&+ typeof HTMLCanvasElement.prototype.captureStream === 'function');+ }++ // Record the live CSS animation without Puppeteer, ffmpeg, or a network+ // dependency. SVG files loaded through Image are commonly rasterized as+ // one cached bitmap, so repeatedly drawing that Image does not reliably+ // advance its CSS animation. Keep one crisp static SVG background, then+ // render an explicit time-varying signal scene over the real authored+ // relationship geometry on every captured canvas frame.+ function recordWebm(options) {+ options = options || {};+ if (!canRecordMotion()) {+ return Promise.reject(exportError('viewer.export.error.webmRequirements'));+ }+ var duration = Math.max(250, Number(options.duration) || MOTION_DURATION);+ var fps = Math.max(1, Number(options.fps) || MOTION_FPS);+ var svg = document.querySelector('.diagram-container svg');+ var vb = svg.viewBox.baseVal;+ var scale = Math.min(1, 1280 / vb.width);+ var data = serializeSvg(scale);+ var sourceUrl = URL.createObjectURL(new Blob([data.svgString], { type: 'image/svg+xml;charset=utf-8' }));++ function createMotionScene(root) {+ var rootMatrix = root.getCTM ? root.getCTM() : null;++ function pointInRoot(element, point) {+ if (!rootMatrix || !element.getCTM || !point.matrixTransform) return { x: point.x, y: point.y };+ try {+ var elementMatrix = element.getCTM();+ if (!elementMatrix) return { x: point.x, y: point.y };+ var mapped = point.matrixTransform(rootMatrix.inverse().multiply(elementMatrix));+ return { x: mapped.x, y: mapped.y };+ } catch (_) {+ return { x: point.x, y: point.y };+ }+ }++ function samplesFor(element) {+ if (typeof element.getTotalLength !== 'function' || typeof element.getPointAtLength !== 'function') return [];+ var length;+ try { length = element.getTotalLength(); } catch (_) { return []; }+ if (!Number.isFinite(length) || length <= 0) return [];+ var count = Math.max(12, Math.min(72, Math.ceil(length / 12)));+ var points = [];+ for (var i = 0; i <= count; i++) {+ points.push(pointInRoot(element, element.getPointAtLength(length * i / count)));+ }+ return points;+ }++ function authoredStep(element, fallback) {+ var raw = element.style.getPropertyValue('--step') || getComputedStyle(element).getPropertyValue('--step');+ var value = Number(raw);+ return Number.isFinite(value) ? value : fallback;+ }++ var edges = Array.prototype.slice.call(root.querySelectorAll('[data-animate="edge"]')).map(function (element, index) {+ var computed = getComputedStyle(element);+ return {+ points: samplesFor(element),+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ width: Math.max(1.5, parseFloat(computed.strokeWidth) || 1.5),+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(function (edge) { return edge.points.length > 1; });++ var nodes = Array.prototype.slice.call(root.querySelectorAll('[data-node-id][data-animate="node"]')).map(function (element, index) {+ var box;+ try { box = element.getBBox(); } catch (_) { return null; }+ var painted = element.querySelector('[class*="c-"]') || element;+ var computed = getComputedStyle(painted);+ return {+ x: box.x,+ y: box.y,+ width: box.width,+ height: box.height,+ color: computed.stroke && computed.stroke !== 'none' ? computed.stroke : '#22d3ee',+ delay: Math.min(12, authoredStep(element, index)) * 0.16+ };+ }).filter(Boolean);++ return { edges: edges, nodes: nodes, x: vb.x, y: vb.y, width: vb.width, height: vb.height };+ }++ function pointAlong(points, progress) {+ var scaled = Math.max(0, Math.min(1, progress)) * (points.length - 1);+ var index = Math.min(points.length - 2, Math.floor(scaled));+ var mix = scaled - index;+ return {+ x: points[index].x + (points[index + 1].x - points[index].x) * mix,+ y: points[index].y + (points[index + 1].y - points[index].y) * mix+ };+ }++ function roundedRectPath(ctx, x, y, width, height, radius) {+ var r = Math.max(0, Math.min(radius, width / 2, height / 2));+ ctx.beginPath();+ ctx.moveTo(x + r, y);+ ctx.lineTo(x + width - r, y);+ ctx.quadraticCurveTo(x + width, y, x + width, y + r);+ ctx.lineTo(x + width, y + height - r);+ ctx.quadraticCurveTo(x + width, y + height, x + width - r, y + height);+ ctx.lineTo(x + r, y + height);+ ctx.quadraticCurveTo(x, y + height, x, y + height - r);+ ctx.lineTo(x, y + r);+ ctx.quadraticCurveTo(x, y, x + r, y);+ ctx.closePath();+ }++ function drawMotionFrame(ctx, backgroundImage, motionScene, elapsed) {+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.drawImage(backgroundImage, 0, 0, ctx.canvas.width, ctx.canvas.height);+ ctx.save();+ ctx.scale(ctx.canvas.width / motionScene.width, ctx.canvas.height / motionScene.height);+ ctx.translate(-motionScene.x, -motionScene.y);++ motionScene.edges.forEach(function (edge) {+ var duration = 1.75;+ var progress = (elapsed - edge.delay) / duration;+ if (progress < 0 || progress > 1) return;+ var head = Math.max(0, Math.min(1, progress));+ var tail = Math.max(0, head - 0.24);+ var opacity = Math.sin(Math.PI * Math.min(1, progress));++ ctx.save();+ ctx.strokeStyle = edge.color;+ ctx.fillStyle = edge.color;+ ctx.lineCap = 'round';+ ctx.lineJoin = 'round';+ ctx.lineWidth = Math.max(3.2, edge.width * 2.2);+ ctx.globalAlpha = 0.42 + opacity * 0.5;+ ctx.shadowColor = edge.color;+ ctx.shadowBlur = 10;+ ctx.beginPath();+ for (var i = 0; i <= 14; i++) {+ var trailPoint = pointAlong(edge.points, tail + (head - tail) * i / 14);+ if (i === 0) ctx.moveTo(trailPoint.x, trailPoint.y);+ else ctx.lineTo(trailPoint.x, trailPoint.y);+ }+ ctx.stroke();++ var point = pointAlong(edge.points, head);+ ctx.globalAlpha = 0.95;+ ctx.beginPath();+ ctx.arc(point.x, point.y, 4.8, 0, Math.PI * 2);+ ctx.fill();+ ctx.restore();+ });++ motionScene.nodes.forEach(function (node) {+ var progress = (elapsed - node.delay) / 2.6;+ if (progress < 0 || progress > 1) return;+ var pulse = Math.sin(Math.PI * progress);+ if (pulse <= 0.02) return;+ ctx.save();+ ctx.strokeStyle = node.color;+ ctx.lineWidth = 1.4 + pulse * 1.8;+ ctx.globalAlpha = pulse * 0.5;+ ctx.shadowColor = node.color;+ ctx.shadowBlur = 12 * pulse;+ var inset = 2 + pulse * 3;+ roundedRectPath(ctx, node.x - inset, node.y - inset, node.width + inset * 2, node.height + inset * 2, 8);+ ctx.stroke();+ ctx.restore();+ });++ ctx.restore();+ }++ var motionScene = createMotionScene(svg);++ return new Promise(function (resolve, reject) {+ var backgroundImage = new Image();+ backgroundImage.onload = function () {+ var canvas = document.createElement('canvas');+ canvas.width = Math.max(2, Math.round(data.width / 2) * 2);+ canvas.height = Math.max(2, Math.round(data.height / 2) * 2);+ var ctx = canvas.getContext('2d');+ var stream = canvas.captureStream(fps);+ var mime = motionMimeType();+ var recorder;+ try {+ recorder = new MediaRecorder(stream, { mimeType: mime, videoBitsPerSecond: 6000000 });+ } catch (err) {+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ reject(err);+ return;+ }+ var chunks = [];+ var raf = 0;+ var stopped = false;+ var startedAt = performance.now();+ function cleanup() {+ if (stopped) return;+ stopped = true;+ cancelAnimationFrame(raf);+ URL.revokeObjectURL(sourceUrl);+ stream.getTracks().forEach(function (track) { track.stop(); });+ }+ function draw(now) {+ var elapsed = Math.max(0, ((Number(now) || performance.now()) - startedAt) / 1000);+ drawMotionFrame(ctx, backgroundImage, motionScene, elapsed);+ raf = requestAnimationFrame(draw);+ }+ recorder.ondataavailable = function (event) {+ if (event.data && event.data.size) chunks.push(event.data);+ };+ recorder.onerror = function (event) {+ cleanup();+ reject(event.error || exportError('viewer.export.error.mediaRecorder'));+ };+ recorder.onstop = function () {+ cleanup();+ var blob = new Blob(chunks, { type: recorder.mimeType || mime });+ if (!blob.size) reject(exportError('viewer.export.error.emptyWebm'));+ else resolve(blob);+ };+ drawMotionFrame(ctx, backgroundImage, motionScene, 0);+ recorder.start(250);+ startedAt = performance.now();+ raf = requestAnimationFrame(draw);+ setTimeout(function () {+ if (recorder.state === 'inactive') return;+ // Chromium normally emits the final chunk during stop(), but+ // some embedded browser shells need an explicit encoder flush+ // first. Keep the short grace window bounded and harmless for+ // browsers that already delivered timeslice chunks.+ try { recorder.requestData(); } catch (_) {}+ setTimeout(function () {+ if (recorder.state !== 'inactive') recorder.stop();+ }, 120);+ }, duration);+ };+ backgroundImage.onerror = function () {+ URL.revokeObjectURL(sourceUrl);+ reject(exportError('viewer.export.error.webmBackground'));+ };+ backgroundImage.src = sourceUrl;+ });+ }++ var menu = document.getElementById('export-menu');+ var btn = document.getElementById('btn-export');+ var routeShareItem = menu.querySelector('button[data-action="route-share-card"]');+ var reachShareItem = menu.querySelector('button[data-action="reach-share-card"]');+ var items = function () {+ return Array.prototype.slice.call(menu.querySelectorAll('button[role="menuitem"]'));+ };++ function syncRouteShareItem() {+ var snapshot = Archify.routeProbe && typeof Archify.routeProbe.exportSnapshot === 'function'+ ? Archify.routeProbe.exportSnapshot()+ : null;+ routeShareItem.hidden = !snapshot;+ routeShareItem.disabled = !snapshot;+ return snapshot;+ }++ function syncReachShareItem() {+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ reachShareItem.hidden = !snapshot;+ reachShareItem.disabled = !snapshot;+ return snapshot;+ }++ // ---- Clipboard support ----------------------------------------------+ function canCopyImage() {+ return typeof ClipboardItem !== 'undefined' &&+ navigator.clipboard &&+ typeof navigator.clipboard.write === 'function';+ }++ // ---- Raster format detection ----------------------------------------+ // canvas.toBlob('image/webp') silently returns a PNG on browsers without+ // WebP encoding (older Safari), so detect explicitly.+ function supports(format) {+ if (format === 'share-card') return true;+ if (format === 'svg' || format === 'png') return true;+ if (format === 'webm') return canRecordMotion();+ var mime = format === 'jpeg' ? 'image/jpeg' : 'image/webp';+ try {+ var c = document.createElement('canvas');+ c.width = c.height = 2;+ return c.toDataURL(mime).indexOf('data:' + mime) === 0;+ } catch (_) { return false; }+ }++ // Gray out unsupported items.+ items().forEach(function (it) {+ if (it.dataset.format && !supports(it.dataset.format)) {+ it.disabled = true;+ it.title = viewerText('viewer.export.unsupported');+ }+ if ((it.dataset.action === 'copy' || it.dataset.action === 'copy-share-card') && !canCopyImage()) {+ it.disabled = true;+ it.title = viewerText('viewer.export.clipboardUnsupported');+ }+ });++ // ---- Toast ----------------------------------------------------------+ // A live region only announces CHANGES to an existing node, so the toast+ // element is created once up front and updated in place.+ var toastEl = document.createElement('div');+ toastEl.className = 'archify-toast';+ toastEl.setAttribute('role', 'status');+ document.body.appendChild(toastEl);+ var toastTimer = null;++ function toast(msg) {+ toastEl.textContent = '';+ requestAnimationFrame(function () {+ toastEl.textContent = msg;+ toastEl.classList.add('show');+ });+ clearTimeout(toastTimer);+ toastTimer = setTimeout(function () { toastEl.classList.remove('show'); }, 1500);+ }++ function open(focusLast) {+ if (Archify.preset && Archify.preset.isOpen()) Archify.preset.close(false);+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ syncRouteShareItem();+ syncReachShareItem();+ menu.classList.add('open');+ btn.setAttribute('aria-expanded', 'true');+ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });+ var target = focusLast ? available[available.length - 1] : available[0];+ if (target) target.focus();+ }+ function close(focusTrigger) {+ menu.classList.remove('open');+ btn.setAttribute('aria-expanded', 'false');+ if (focusTrigger) btn.focus();+ }+ function isOpen() { return menu.classList.contains('open'); }++ btn.addEventListener('click', function (e) {+ e.stopPropagation();+ if (isOpen()) close(false);+ else open();+ });+ // APG menu-button pattern: ArrowDown/ArrowUp on the trigger opens the menu.+ btn.addEventListener('keydown', function (e) {+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {+ e.preventDefault();+ if (!isOpen()) open(e.key === 'ArrowUp');+ }+ });+ document.addEventListener('click', function (e) {+ if (!menu.contains(e.target) && e.target !== btn) close(false);+ });++ // Keyboard navigation inside the menu.+ // Menu items: Up/Down, Home/End.+ // Esc closes + returns focus to trigger; Tab closes.+ menu.addEventListener('keydown', function (e) {+ if (e.key === 'Escape') { e.preventDefault(); close(true); return; }+ if (e.key === 'Tab') { close(false); return; }++ var available = items().filter(function (i) { return !i.hidden && !i.disabled; });+ var current = available.indexOf(document.activeElement);+ switch (e.key) {+ case 'ArrowDown':+ e.preventDefault();+ if (available.length) available[(current + 1 + available.length) % available.length].focus();+ break;+ case 'ArrowUp':+ e.preventDefault();+ if (available.length) available[(current - 1 + available.length) % available.length].focus();+ break;+ case 'Home':+ e.preventDefault();+ if (available[0]) available[0].focus();+ break;+ case 'End':+ e.preventDefault();+ if (available.length) available[available.length - 1].focus();+ break;+ }+ });++ function runExport(format) {+ var base = diagramFilename();+ close(true);+ clearExportReceipt();+ if (format === 'webm') toast(viewerText('viewer.export.recording'));+ return (format === 'share-card'+ ? rasterizeShareCard().then(function (blob) {+ recordExportReceipt('share-card', blob, true, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT });+ download(blob, base + '-share-card.png');+ toast(viewerText('viewer.export.downloadedShare'));+ })+ : format === 'svg'+ ? Promise.resolve(serializeSvg(1, { autoTheme: true })).then(function (d) {+ var blob = new Blob([d.svgString], { type: 'image/svg+xml;charset=utf-8' });+ recordExportReceipt('svg', blob, d.canonicalStateClean);+ download(blob, base + '.svg');+ })+ : format === 'webm'+ ? recordWebm().then(function (blob) {+ document.documentElement.setAttribute('data-last-motion-bytes', String(blob.size));+ recordExportReceipt('webm', blob, true);+ download(blob, base + '.webm');+ toast(viewerText('viewer.export.downloadedWebm'));+ })+ : rasterize(format).then(function (blob) {+ recordExportReceipt(format, blob, true);+ download(blob, base + '.' + format);+ })+ ).catch(function (err) {+ console.error(err);+ var technicalMessage = err && err.message ? err.message : format;+ var message = exportMessage(err);+ document.documentElement.setAttribute('data-last-export-error-format', format);+ document.documentElement.setAttribute('data-last-export-error', technicalMessage);+ if (format === 'webm') {+ var motionItem = menu.querySelector('button[data-format="webm"]');+ if (motionItem) {+ motionItem.disabled = true;+ motionItem.title = viewerText('viewer.export.motionUnavailable');+ motionItem.style.opacity = '0.5';+ }+ toast(viewerText('viewer.export.webmUnavailable'));+ return;+ }+ alert(viewerText('viewer.export.failed', { message: message }));+ });+ }++ function runRouteShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.routeProbe && Archify.routeProbe.exportSnapshot();+ var blobPromise = snapshot+ ? renderShareCard({ routeSnapshot: snapshot })+ : Promise.reject(exportError('viewer.export.routeRequired'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'route', true);+ download(blob, diagramFilename() + '-route-share-card.png');+ toast(viewerText('viewer.export.downloadedRoute'));+ return blob;+ }).catch(function (err) {+ console.error(err);+ var technicalMessage = err && err.message ? err.message : 'share-card';+ var message = exportMessage(err);+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', technicalMessage);+ alert(viewerText('viewer.export.routeFailed', { message: message }));+ });+ }++ function runReachShareCard() {+ close(false);+ clearExportReceipt();+ var snapshot = Archify.focus && typeof Archify.focus.reachabilitySnapshot === 'function'+ ? Archify.focus.reachabilitySnapshot()+ : null;+ var blobPromise = snapshot+ ? renderShareCard({ reachSnapshot: snapshot })+ : Promise.reject(exportError('viewer.export.reachRequired'));+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, false, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT }, 'reach', false, true);+ download(blob, diagramFilename() + '-' + snapshot.direction + '-reach-share-card.png');+ toast(viewerText('viewer.export.downloadedReach'));+ return blob;+ }).catch(function (err) {+ console.error(err);+ var technicalMessage = err && err.message ? err.message : 'share-card';+ var message = exportMessage(err);+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', technicalMessage);+ alert(viewerText('viewer.export.reachFailed', { message: message }));+ });+ }++ // A compact, machine-readable receipt for local QA and generated proof+ // galleries. It exposes no diagram contents, only the completed format,+ // byte count, and whether temporary viewer state was excluded.+ function recordExportReceipt(format, blob, canonical, dimensions, variant, routeStateClean, reachStateClean) {+ document.documentElement.setAttribute('data-last-export-format', format);+ document.documentElement.setAttribute('data-last-export-bytes', String(blob.size));+ document.documentElement.setAttribute('data-last-export-canonical', canonical ? 'true' : 'false');+ if (variant) {+ document.documentElement.setAttribute('data-last-export-variant', variant);+ } else {+ document.documentElement.removeAttribute('data-last-export-variant');+ }+ if (routeStateClean === true) {+ document.documentElement.setAttribute('data-last-export-route-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-route-state-clean');+ }+ if (reachStateClean === true) {+ document.documentElement.setAttribute('data-last-export-reach-state-clean', 'true');+ } else {+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ }+ if (dimensions) {+ document.documentElement.setAttribute('data-last-export-width', String(dimensions.width));+ document.documentElement.setAttribute('data-last-export-height', String(dimensions.height));+ } else {+ document.documentElement.removeAttribute('data-last-export-width');+ document.documentElement.removeAttribute('data-last-export-height');+ }+ }++ function clearExportReceipt() {+ document.documentElement.removeAttribute('data-last-export-format');+ document.documentElement.removeAttribute('data-last-export-bytes');+ document.documentElement.removeAttribute('data-last-export-canonical');+ document.documentElement.removeAttribute('data-last-export-width');+ document.documentElement.removeAttribute('data-last-export-height');+ document.documentElement.removeAttribute('data-last-export-variant');+ document.documentElement.removeAttribute('data-last-export-route-state-clean');+ document.documentElement.removeAttribute('data-last-export-reach-state-clean');+ document.documentElement.removeAttribute('data-last-export-error-format');+ document.documentElement.removeAttribute('data-last-export-error');+ }++ function writePngToClipboard(blobPromise) {+ // WebKit requires ClipboardItem to be constructed synchronously inside+ // the user gesture. Chromium accepts the same pending Promise<Blob>;+ // engines that reject promise values fall back to an awaited Blob.+ try {+ return navigator.clipboard.write([new ClipboardItem({ 'image/png': blobPromise })]);+ } catch (_) {+ return blobPromise.then(function (blob) {+ return navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);+ });+ }+ }++ function runCopyShareCard() {+ close(true);+ clearExportReceipt();+ if (!canCopyImage()) {+ alert(viewerText('viewer.export.clipboardUnsupported.period'));+ return;+ }+ var blobPromise = rasterizeShareCard();+ return writePngToClipboard(blobPromise).then(function () {+ return blobPromise.then(function (blob) {+ recordExportReceipt('share-card', blob, true, { width: SHARE_CARD_WIDTH, height: SHARE_CARD_HEIGHT });+ toast(viewerText('viewer.export.copiedShare'));+ });+ }).catch(function (err) {+ console.error(err);+ var technicalMessage = err && err.message ? err.message : 'share-card';+ var message = exportMessage(err);+ document.documentElement.setAttribute('data-last-export-error-format', 'share-card');+ document.documentElement.setAttribute('data-last-export-error', technicalMessage);+ alert(viewerText('viewer.export.copyFailed', { message: message }));+ });+ }++ function runCopy() {+ close(true);+ clearExportReceipt();+ if (!canCopyImage()) {+ alert(viewerText('viewer.export.clipboardUnsupported.short'));+ return;+ }+ var blobPromise = rasterize('png');+ return writePngToClipboard(blobPromise).then(function () {+ toast(viewerText('viewer.export.copiedPng'));+ }).catch(function (err) {+ console.error(err);+ alert(viewerText('viewer.export.copyFailed', {+ message: exportMessage(err)+ }));+ });+ }++ menu.addEventListener('click', function (e) {+ var routeShareCardBtn = e.target.closest('button[data-action="route-share-card"]');+ if (routeShareCardBtn && !routeShareCardBtn.disabled && !routeShareCardBtn.hidden) { runRouteShareCard(); return; }++ var reachShareCardBtn = e.target.closest('button[data-action="reach-share-card"]');+ if (reachShareCardBtn && !reachShareCardBtn.disabled && !reachShareCardBtn.hidden) { runReachShareCard(); return; }++ var copyShareCardBtn = e.target.closest('button[data-action="copy-share-card"]');+ if (copyShareCardBtn && !copyShareCardBtn.disabled) { runCopyShareCard(); return; }++ var copyBtn = e.target.closest('button[data-action="copy"]');+ if (copyBtn && !copyBtn.disabled) { runCopy(); return; }++ var formatBtn = e.target.closest('button[data-format]');+ if (formatBtn && !formatBtn.disabled) { runExport(formatBtn.dataset.format); }+ });++ Archify.motion = { canRecord: canRecordMotion, recordWebm: recordWebm };+ Archify.exportMenu = {+ open: open,+ close: close,+ isOpen: isOpen,+ run: runExport,+ shareCard: rasterizeShareCard,+ downloadRouteShareCard: runRouteShareCard,+ downloadReachShareCard: runReachShareCard,+ syncRouteShare: syncRouteShareItem,+ syncReachShare: syncReachShareItem,+ copyShareCard: runCopyShareCard+ };++ // Auto-open on page load for demo/screenshot purposes: ?openExport=1+ // Wait for fonts (so the menu doesn't flash before typography lands)+ // and paint before opening. Fallback timeout for browsers without the+ // Font Loading API.+ try {+ if (new URLSearchParams(window.location.search).get('openExport') === '1') {+ var openWhenReady = function () {+ requestAnimationFrame(function () { requestAnimationFrame(open); });+ };+ if (document.fonts && document.fonts.ready) {+ document.fonts.ready.then(openWhenReady);+ } else {+ setTimeout(openWhenReady, 200);+ }+ }+ } catch (_) {}+ })();++ /* ============================================================+ Motion Governor — one reader switch and one motion budget. Ambient+ trace yields to the strongest semantic owner; Still also parks bounded+ viewer signals without discarding their static meaning.+ ============================================================ */+ Archify.motionGovernor = (function () {+ var STORAGE_KEY = 'archify-motion';+ var html = document.documentElement;+ var svg = document.querySelector('.diagram-container svg');+ var btn = document.getElementById('btn-motion');+ var label = document.getElementById('motion-label');+ var motionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var capable = !!(svg && svg.getAttribute('data-animation') === 'trace');+ var readerPaused = false;+ var suspensions = Object.create(null);+ var explicitOwner = '';+ var owner = '';+ var ownerToken = 0;+ var ownerCleanup = null;+ var lastEffectivePaused = null;+ var ambientStarted = false;+ var ambientPending = new Set();++ function detachAmbientBoundary() {+ if (!svg) return;+ svg.removeEventListener('animationend', onAmbientBoundary, true);+ svg.removeEventListener('animationcancel', onAmbientBoundary, true);+ }+ function settleAmbient(reason) {+ if (!capable) return false;+ ambientStarted = true;+ ambientPending.clear();+ detachAmbientBoundary();+ html.setAttribute('data-ambient-motion', 'settled');+ html.setAttribute('data-ambient-settle-reason', reason || 'complete');+ return true;+ }+ function onAmbientBoundary(event) {+ if (!ambientPending.has(event.target)) return;+ ambientPending.delete(event.target);+ if (!ambientPending.size) settleAmbient('complete');+ }+ function startAmbient() {+ if (ambientStarted || !capable) return false;+ ambientStarted = true;+ ambientPending = new Set(Array.prototype.slice.call(svg.querySelectorAll('[data-animate="edge"], [data-animate="node"]')));+ if (!ambientPending.size) return settleAmbient('empty');+ svg.addEventListener('animationend', onAmbientBoundary, true);+ svg.addEventListener('animationcancel', onAmbientBoundary, true);+ html.setAttribute('data-ambient-motion', 'running');+ html.removeAttribute('data-ambient-settle-reason');+ return true;+ }++ function readStored() {+ try { return localStorage.getItem(STORAGE_KEY); } catch (_) { return null; }+ }+ function writeStored() {+ try {+ if (readerPaused) localStorage.setItem(STORAGE_KEY, 'still');+ else localStorage.removeItem(STORAGE_KEY);+ } catch (_) {}+ }+ function reducedMotion() {+ return !!(motionQuery && motionQuery.matches);+ }+ function hasSuspension() {+ return Object.keys(suspensions).length > 0;+ }+ function effectivePaused() {+ return readerPaused || reducedMotion() || hasSuspension();+ }+ function ownerLabel(value) {+ if (value === 'story') return viewerText('viewer.owner.story');+ if (value === 'chapter') return viewerText('viewer.owner.chapter');+ if (value === 'chapter-preview') return viewerText('viewer.owner.chapterPreview');+ if (value === 'handoff') return viewerText('viewer.owner.handoff');+ if (value === 'route') return viewerText('viewer.owner.route');+ if (value === 'lens') return viewerText('viewer.owner.lens');+ if (value === 'relationship') return viewerText('viewer.owner.relationship');+ if (value === 'intent') return viewerText('viewer.owner.intent');+ if (value === 'focus') return viewerText('viewer.owner.focus');+ if (value === 'legend') return viewerText('viewer.owner.legend');+ return viewerText('viewer.owner.reader');+ }+ function render() {+ if (!capable) return;+ var systemPaused = reducedMotion();+ var paused = effectivePaused();+ html.setAttribute('data-motion', paused ? 'still' : 'live');+ if (paused || owner || html.hasAttribute('data-embed') || html.hasAttribute('data-share-playback') || html.hasAttribute('data-document-hidden')) {+ settleAmbient('suppressed');+ } else if (!ambientStarted) {+ startAmbient();+ }+ btn.setAttribute('aria-pressed', paused ? 'false' : 'true');+ btn.disabled = systemPaused;+ label.textContent = viewerText(paused ? 'viewer.motion.still' : 'viewer.motion.live');+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (paused && lastEffectivePaused !== true && Archify.guidedViews && Archify.guidedViews.settleHandoff) {+ Archify.guidedViews.settleHandoff(systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still'));+ }+ if (paused && lastEffectivePaused !== true && Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: systemPaused ? 'reduced-motion' : (hasSuspension() ? 'hidden' : 'still') });+ }+ lastEffectivePaused = paused;+ if (Archify.routeProbe && typeof Archify.routeProbe.syncMotion === 'function') Archify.routeProbe.syncMotion();+ if (systemPaused) {+ btn.setAttribute('aria-label', viewerText('viewer.motion.reduced'));+ btn.title = viewerText('viewer.motion.reduced');+ } else if (hasSuspension()) {+ btn.setAttribute('aria-label', viewerText('viewer.motion.hidden'));+ btn.title = viewerText('viewer.motion.hidden');+ } else if (paused) {+ btn.setAttribute('aria-label', viewerText('viewer.motion.resume'));+ btn.title = viewerText('viewer.motion.resume');+ } else if (owner) {+ btn.setAttribute('aria-label', viewerText('viewer.motion.yielding', { owner: ownerLabel(owner) }));+ btn.title = viewerText('viewer.motion.yielding.title', { owner: ownerLabel(owner) });+ } else {+ btn.setAttribute('aria-label', viewerText('viewer.motion.pause'));+ btn.title = viewerText('viewer.motion.pause');+ }+ }+ function setPaused(next, options) {+ options = options || {};+ readerPaused = !!next;+ if (options.persist !== false) writeStored();+ render();+ return readerPaused;+ }+ function publishOwner() {+ owner = explicitOwner || deriveOwner();+ if (owner) html.setAttribute('data-motion-owner', owner);+ else html.removeAttribute('data-motion-owner');+ render();+ return owner;+ }+ function deriveOwner() {+ if (!svg) return '';+ if (svg.hasAttribute('data-story-playing') || svg.hasAttribute('data-story-follow')) return 'story';+ if (svg.hasAttribute('data-story-active')) return 'chapter';+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return 'route';+ if (svg.hasAttribute('data-lens-active')) return 'lens';+ if (svg.hasAttribute('data-relationship-preview-active')) return 'relationship';+ if (svg.hasAttribute('data-intent-trace-active')) return 'intent';+ if (svg.hasAttribute('data-focus-active')) return 'focus';+ if (svg.hasAttribute('data-legend-preview-active')) return 'legend';+ return '';+ }+ function clearClaim(preempted) {+ var cleanup = ownerCleanup;+ ownerCleanup = null;+ explicitOwner = '';+ if (preempted && cleanup) {+ try { cleanup(); } catch (_) {}+ }+ }+ function claim(next, cleanup) {+ if (!capable || !next) return 0;+ clearClaim(true);+ ownerToken += 1;+ explicitOwner = next;+ ownerCleanup = typeof cleanup === 'function' ? cleanup : null;+ publishOwner();+ return ownerToken;+ }+ function release(token) {+ if (!capable || token !== ownerToken || !explicitOwner) return false;+ clearClaim(false);+ ownerToken += 1;+ publishOwner();+ return true;+ }+ function suspend(reason) {+ var key = String(reason || 'runtime');+ var active = true;+ suspensions[key] = (suspensions[key] || 0) + 1;+ render();+ return function () {+ if (!active) return false;+ active = false;+ if (suspensions[key] > 1) suspensions[key] -= 1;+ else delete suspensions[key];+ render();+ return true;+ };+ }+ function syncVisibility() {+ if (document.hidden) {+ suspensions.visibility = true;+ html.setAttribute('data-document-hidden', 'true');+ } else {+ delete suspensions.visibility;+ html.removeAttribute('data-document-hidden');+ }+ render();+ }++ if (!capable) {+ btn.hidden = true;+ html.removeAttribute('data-motion-capable');+ html.removeAttribute('data-motion');+ html.removeAttribute('data-motion-owner');+ html.removeAttribute('data-ambient-motion');+ html.removeAttribute('data-ambient-settle-reason');+ return {+ capable: false,+ pause: function () { return false; },+ resume: function () { return false; },+ toggle: function () { return false; },+ setMode: function () { return 'still'; },+ mode: function () { return 'still'; },+ claim: function () { return 0; },+ release: function () { return false; },+ suspend: function () { return function () { return false; }; },+ isPaused: function () { return true; },+ owner: function () { return ''; }+ };+ }++ html.setAttribute('data-motion-capable', 'true');+ btn.hidden = false;+ readerPaused = readStored() === 'still';+ btn.addEventListener('click', function () { setPaused(!readerPaused); });+ if (motionQuery) {+ if (typeof motionQuery.addEventListener === 'function') motionQuery.addEventListener('change', render);+ else if (typeof motionQuery.addListener === 'function') motionQuery.addListener(render);+ }+ document.addEventListener('visibilitychange', syncVisibility);+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node) {+ var ownerObserver = new MutationObserver(function () { publishOwner(); });+ ownerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-story-playing', 'data-story-follow', 'data-story-active', 'data-route-picking', 'data-route-active',+ 'data-lens-active', 'data-relationship-preview-active', 'data-intent-trace-active',+ 'data-focus-active', 'data-legend-preview-active'+ ]+ });+ }+ syncVisibility();+ publishOwner();+ render();++ return {+ capable: true,+ pause: function () { return setPaused(true); },+ resume: function () { return setPaused(false); },+ toggle: function () { return setPaused(!readerPaused); },+ setMode: function (next, options) {+ setPaused(next === 'still', options);+ return effectivePaused() ? 'still' : 'live';+ },+ mode: function () { return effectivePaused() ? 'still' : 'live'; },+ claim: claim,+ release: release,+ suspend: suspend,+ isPaused: effectivePaused,+ owner: function () { return owner; }+ };+ })();++ /* Verified repository evidence is emitted only after the renderer checks+ the authored GitHub revision, source blobs, and optional line ranges+ against the explicit --repo-root. It remains outside the SVG so every+ canonical visual export stays free of repository paths. */+ Archify.sourceEvidence = (function () {+ var element = document.getElementById('archify-source-evidence-data');+ var payload = null;+ var svgNamespace = 'http://www.w3.org/2000/svg';+ if (element) {+ try {+ var parsed = JSON.parse(element.textContent || 'null');+ if (parsed && parsed.verified === true && parsed.repository && parsed.nodes) payload = parsed;+ } catch (_) {}+ }+ function installBeacons() {+ if (!payload) return 0;+ var svg = document.querySelector('.diagram-container svg');+ if (!svg) return 0;+ var installed = 0;+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var sources = payload.nodes[id];+ if (!Array.isArray(sources) || !sources.length || node.querySelector('[data-source-evidence-beacon]')) return;+ var shape = node.querySelector('[data-animate="node"]') || node.querySelector('[class*="c-"]');+ var box;+ try { box = (shape || node).getBBox(); } catch (_) { return; }+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y) || !Number.isFinite(box.width) || box.width < 36) return;++ var count = sources.length;+ var label = viewerCount('viewer.passport.beacon', count);+ var beacon = document.createElementNS(svgNamespace, 'g');+ beacon.classList.add('source-evidence-beacon');+ beacon.setAttribute('data-source-evidence-beacon', '');+ beacon.setAttribute('aria-hidden', 'true');+ var brandOffset = node.hasAttribute('data-node-brand') ? 24 : 0;+ beacon.setAttribute('transform', 'translate(' + (box.x + box.width - 35 - brandOffset) + ' ' + (box.y + 5) + ')');+ var title = document.createElementNS(svgNamespace, 'title');+ title.textContent = label;+ var plate = document.createElementNS(svgNamespace, 'rect');+ plate.setAttribute('width', '30');+ plate.setAttribute('height', '12');+ plate.setAttribute('rx', '6');+ var text = document.createElementNS(svgNamespace, 'text');+ text.setAttribute('x', '15');+ text.setAttribute('y', '8.25');+ text.textContent = viewerText('viewer.passport.sourceMarker') + ' ' + count;+ beacon.appendChild(title);+ beacon.appendChild(plate);+ beacon.appendChild(text);+ node.appendChild(beacon);++ var originalLabel = node.getAttribute('aria-label') || '';+ node.setAttribute('data-source-evidence-count', String(count));+ node.setAttribute('data-source-evidence-original-label', originalLabel);+ node.setAttribute('aria-label', (originalLabel ? originalLabel + ', ' : '') + viewerCount('viewer.passport.sourceCount', count));+ installed += 1;+ });+ return installed;+ }+ return {+ available: function () { return Boolean(payload); },+ repository: function () { return payload ? payload.repository : null; },+ node: function (id) {+ var sources = payload && payload.nodes ? payload.nodes[id] : null;+ return Array.isArray(sources) ? sources.slice() : [];+ },+ installBeacons: installBeacons+ };+ })();+ Archify.sourceEvidence.installBeacons();++ /* ============================================================+ Explore — stable-ID neighborhood focus + dependency-free pan/zoom.+ Renderer IDs become deep-linkable semantic hooks without turning the+ standalone artifact into a canvas editor.+ ============================================================ */+ Archify.focus = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var chip = document.getElementById('focus-chip');+ var label = document.getElementById('focus-label');+ var detail = document.getElementById('focus-detail');+ var kind = document.getElementById('focus-kind');+ var context = document.getElementById('focus-context');+ var tag = document.getElementById('focus-tag');+ var semanticId = document.getElementById('focus-id');+ var evidence = document.getElementById('focus-evidence');+ var repositoryLink = document.getElementById('focus-repository');+ var evidenceLinks = document.getElementById('focus-evidence-links');+ var summary = document.getElementById('focus-summary');+ var reachSection = document.getElementById('focus-reach');+ var reachStatus = document.getElementById('focus-reach-status');+ var upstreamBtn = document.getElementById('btn-reach-upstream');+ var downstreamBtn = document.getElementById('btn-reach-downstream');+ var upstreamCount = document.getElementById('focus-reach-upstream-count');+ var downstreamCount = document.getElementById('focus-reach-downstream-count');+ var relationshipList = document.getElementById('relationship-lens-list');+ var copyBtn = document.getElementById('btn-focus-copy');+ var relationsBtn = document.getElementById('btn-focus-relations');+ var clearBtn = document.getElementById('btn-focus-clear');+ var activeIds = [];+ var hoveredRelationship = null;+ var focusedRelationship = null;+ var pinnedRelationship = null;+ var pinnedRelationshipKey = null;+ var activeRelationshipPreview = null;+ var relationshipHitOverlay = null;+ var relationshipHitTargets = [];+ var directPreviewTimer = null;+ var reachabilityMode = null;+ var activeReachability = null;+ var svgNamespace = 'http://www.w3.org/2000/svg';+ var reducedMotionQuery = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }+ function reachabilityRelationships() {+ var seen = Object.create(null);+ var relationships = [];+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!from || !to || seen[key]) return;+ seen[key] = true;+ relationships.push({ key: key, from: from, to: to });+ });+ return relationships;+ }+ function computeReachability(originId, direction, relationships) {+ if (typeof originId !== 'string' || !originId ||+ (direction !== 'upstream' && direction !== 'downstream') ||+ !Array.isArray(relationships)) return null;+ var records = [];+ var seenKeys = Object.create(null);+ relationships.forEach(function (relationship, index) {+ if (!relationship || typeof relationship.from !== 'string' || !relationship.from ||+ typeof relationship.to !== 'string' || !relationship.to) return;+ var key = typeof relationship.key === 'string' && relationship.key+ ? relationship.key : String(index);+ if (seenKeys[key]) return;+ seenKeys[key] = true;+ records.push({ key: key, from: relationship.from, to: relationship.to });+ });++ var depths = Object.create(null);+ var order = [];+ var queue = [originId];+ depths[originId] = 0;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var current = queue[cursor];+ records.forEach(function (relationship) {+ var next = null;+ if (direction === 'downstream' && relationship.from === current) next = relationship.to;+ else if (direction === 'upstream' && relationship.to === current) next = relationship.from;+ if (next == null || Object.prototype.hasOwnProperty.call(depths, next)) return;+ depths[next] = depths[current] + 1;+ queue.push(next);+ });+ }+ queue.forEach(function (id) { order.push(id); });++ var edgeKeys = [];+ records.forEach(function (relationship) {+ if (Object.prototype.hasOwnProperty.call(depths, relationship.from) &&+ Object.prototype.hasOwnProperty.call(depths, relationship.to)) edgeKeys.push(relationship.key);+ });+ var maxDepth = order.reduce(function (maximum, id) {+ return Math.max(maximum, depths[id]);+ }, 0);+ return {+ direction: direction,+ originId: originId,+ nodeIds: order,+ edgeKeys: edgeKeys,+ depths: depths,+ maxDepth: maxDepth+ };+ }+ function reachabilityFor(id, direction) {+ return computeReachability(id, direction, reachabilityRelationships());+ }+ function resetReachabilityButtons() {+ upstreamBtn.setAttribute('aria-pressed', 'false');+ downstreamBtn.setAttribute('aria-pressed', 'false');+ }+ function clearReachability(options) {+ options = options || {};+ reachabilityMode = null;+ activeReachability = null;+ svg.removeAttribute('data-reach-active');+ chip.removeAttribute('data-reach-mode');+ nodes().forEach(function (node) {+ node.removeAttribute('data-reach-match');+ node.removeAttribute('data-reach-origin');+ node.removeAttribute('data-reach-depth');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-reach-match');+ edge.removeAttribute('data-reach-depth');+ });+ resetReachabilityButtons();+ reachStatus.textContent = '';+ reachStatus.hidden = true;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }+ if (options.updateUrl === true && activeIds.length === 1) {+ try {+ history.replaceState(null, '', location.pathname + location.search + '#focus=' + encodeURIComponent(activeIds[0]));+ } catch (_) {}+ }+ }+ function renderReachabilityControls(id) {+ var upstream = reachabilityFor(id, 'upstream');+ var downstream = reachabilityFor(id, 'downstream');+ var upstreamReach = upstream ? Math.max(0, upstream.nodeIds.length - 1) : 0;+ var downstreamReach = downstream ? Math.max(0, downstream.nodeIds.length - 1) : 0;+ upstreamCount.textContent = String(upstreamReach);+ downstreamCount.textContent = String(downstreamReach);+ upstreamBtn.disabled = upstreamReach === 0;+ downstreamBtn.disabled = downstreamReach === 0;+ upstreamBtn.setAttribute('aria-label', upstreamReach+ ? viewerCount('viewer.passport.reach.upstream', upstreamReach)+ : viewerText('viewer.passport.reach.noUpstream'));+ downstreamBtn.setAttribute('aria-label', downstreamReach+ ? viewerCount('viewer.passport.reach.downstream', downstreamReach)+ : viewerText('viewer.passport.reach.noDownstream'));+ reachSection.hidden = false;+ }+ function applyReachability(direction, options) {+ options = options || {};+ if (activeIds.length !== 1 || (direction !== 'upstream' && direction !== 'downstream')) return false;+ if (reachabilityMode === direction && options.toggle !== false) {+ clearReachability({ updateUrl: options.updateUrl !== false });+ return true;+ }+ var result = reachabilityFor(activeIds[0], direction);+ if (!result || result.nodeIds.length <= 1) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false, resetView: false });+ }+ clearRelationshipPreview({ clearPin: true });+ clearReachability({ updateUrl: false });+ reachabilityMode = direction;+ activeReachability = result;+ var edgeKeySet = Object.create(null);+ result.edgeKeys.forEach(function (key) { edgeKeySet[key] = true; });+ svg.setAttribute('data-reach-active', direction);+ chip.setAttribute('data-reach-mode', direction);+ nodes().forEach(function (node) {+ var id = node.getAttribute('data-node-id');+ if (!Object.prototype.hasOwnProperty.call(result.depths, id)) return;+ node.setAttribute('data-reach-match', '');+ node.setAttribute('data-reach-depth', String(result.depths[id]));+ if (id === result.originId) node.setAttribute('data-reach-origin', '');+ });+ edges().forEach(function (edge) {+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ if (!edgeKeySet[key]) return;+ edge.setAttribute('data-reach-match', '');+ var fromDepth = result.depths[edge.getAttribute('data-edge-from')];+ var toDepth = result.depths[edge.getAttribute('data-edge-to')];+ edge.setAttribute('data-reach-depth', String(Math.max(fromDepth || 0, toDepth || 0)));+ });+ resetReachabilityButtons();+ var activeButton = direction === 'upstream' ? upstreamBtn : downstreamBtn;+ activeButton.setAttribute('aria-pressed', 'true');+ var reachableCount = result.nodeIds.length - 1;+ var directionLabel = viewerText(direction === 'upstream'+ ? 'viewer.passport.upstream'+ : 'viewer.passport.downstream');+ reachStatus.textContent = viewerText('viewer.passport.reach.status', {+ direction: directionLabel,+ nodes: reachableCount,+ links: result.edgeKeys.length,+ hops: result.maxDepth+ });+ reachStatus.hidden = false;+ if (Archify.exportMenu && typeof Archify.exportMenu.syncReachShare === 'function') {+ Archify.exportMenu.syncReachShare();+ }+ if (options.updateUrl !== false) {+ try {+ history.replaceState(null, '', location.pathname + location.search + '#focus=' ++ encodeURIComponent(activeIds[0]) + '&reach=' + direction);+ } catch (_) {}+ }+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(result.nodeIds, { includeNeighbors: false, reason: 'reachability' });+ }+ requestLensPlacement();+ return true;+ }+ function reachabilitySnapshot() {+ if (!activeReachability || activeIds.length !== 1 ||+ (reachabilityMode !== 'upstream' && reachabilityMode !== 'downstream') ||+ activeReachability.direction !== reachabilityMode ||+ activeReachability.originId !== activeIds[0] ||+ svg.getAttribute('data-reach-active') !== reachabilityMode) return null;++ var originId = activeReachability.originId;+ var nodeIds = activeReachability.nodeIds.slice();+ var edgeKeys = activeReachability.edgeKeys.slice();+ if (nodeIds.length < 2 || nodeIds[0] !== originId || !edgeKeys.length ||+ !activeReachability.depths || !Number.isInteger(activeReachability.maxDepth) ||+ activeReachability.maxDepth < 1) return null;++ var allNodes = nodes();+ var allEdges = edges();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ var nodeIdSet = Object.create(null);+ var depths = Object.create(null);+ var originNode = null;+ var measuredMaxDepth = 0;++ if (nodeIds.some(function (id) {+ var depth = activeReachability.depths[id];+ var matches = allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ });+ if (typeof id !== 'string' || !id || seenNodeIds[id] || matches.length !== 1 ||+ !matches[0].hasAttribute('data-reach-match') ||+ !Number.isInteger(depth) || depth < 0 || depth > activeReachability.maxDepth ||+ (id === originId+ ? (!matches[0].hasAttribute('data-reach-origin') || depth !== 0)+ : depth < 1)) return true;+ seenNodeIds[id] = true;+ nodeIdSet[id] = true;+ depths[id] = depth;+ measuredMaxDepth = Math.max(measuredMaxDepth, depth);+ if (id === originId) originNode = matches[0];+ return false;+ }) || !originNode || measuredMaxDepth !== activeReachability.maxDepth ||+ allNodes.filter(function (node) { return node.hasAttribute('data-reach-match'); }).length !== nodeIds.length) return null;++ var edgeRecords = [];+ if (edgeKeys.some(function (key) {+ if (typeof key !== 'string' || !key || seenEdgeKeys[key]) return true;+ var fragments = allEdges.filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ if (!fragments.length || drawableFragments.length !== 1 ||+ !fragments.every(function (fragment) { return fragment.hasAttribute('data-reach-match'); })) return true;+ var first = fragments[0];+ var from = first.getAttribute('data-edge-from');+ var to = first.getAttribute('data-edge-to');+ var id = first.getAttribute('data-edge-id') || '';+ var labelValue = first.getAttribute('data-edge-label') || '';+ if (!nodeIdSet[from] || !nodeIdSet[to] || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === from &&+ fragment.getAttribute('data-edge-to') === to &&+ (fragment.getAttribute('data-edge-id') || '') === id;+ })) return true;+ seenEdgeKeys[key] = true;+ edgeRecords.push({+ key: key,+ id: id,+ from: from,+ to: to,+ label: labelValue,+ depth: Math.max(depths[from], depths[to])+ });+ return false;+ })) return null;++ var liveEdgeKeys = Object.create(null);+ if (allEdges.some(function (edge) {+ if (!edge.hasAttribute('data-reach-match')) return false;+ var key = edge.getAttribute('data-edge-key');+ if (!key || !seenEdgeKeys[key]) return true;+ liveEdgeKeys[key] = true;+ return false;+ }) || Object.keys(liveEdgeKeys).length !== edgeKeys.length) return null;++ return {+ direction: reachabilityMode,+ origin: { id: originId, label: nodeLabel(originNode, originId) },+ nodeIds: nodeIds,+ depths: depths,+ maxDepth: activeReachability.maxDepth,+ edges: edgeRecords+ };+ }+ function setPassportValue(element, value) {+ var normalized = value == null ? '' : String(value).trim();+ element.textContent = normalized;+ element.hidden = !normalized;+ }+ function renderSourceEvidence(id) {+ evidenceLinks.textContent = '';+ repositoryLink.removeAttribute('href');+ repositoryLink.textContent = '';+ var sources = Archify.sourceEvidence.node(id);+ var repository = Archify.sourceEvidence.repository();+ if (!repository || !sources.length) {+ evidence.hidden = true;+ return;+ }+ var slug = repository.url.replace(/^https:\/\/github\.com\//, '').replace(/\/$/, '');+ repositoryLink.href = repository.url + '/tree/' + repository.revision;+ repositoryLink.textContent = slug + ' @ ' + repository.shortRevision;+ repositoryLink.setAttribute('aria-label', viewerText('viewer.passport.repository.open', { revision: repository.revision }));+ sources.forEach(function (source) {+ var link = document.createElement('a');+ link.className = 'semantic-passport-source';+ link.href = source.href;+ link.target = '_blank';+ link.rel = 'noopener noreferrer';+ link.referrerPolicy = 'no-referrer';+ link.setAttribute('aria-label', viewerText('viewer.passport.source.open', { path: source.path, revision: repository.shortRevision }));+ var name = document.createElement('strong');+ name.textContent = source.label || source.path.split('/').pop() || source.path;+ var location = document.createElement('code');+ location.textContent = source.line+ ? 'L' + source.line + (source.endLine && source.endLine !== source.line ? '–' + source.endLine : '') + ' ↗'+ : viewerText('viewer.passport.source.openLink');+ var sourcePath = document.createElement('small');+ sourcePath.textContent = source.path;+ link.appendChild(name);+ link.appendChild(location);+ link.appendChild(sourcePath);+ evidenceLinks.appendChild(link);+ });+ evidence.hidden = false;+ }+ function renderPassport(id, node) {+ setPassportValue(detail, node.getAttribute('data-node-sublabel'));+ setPassportValue(kind, viewerKindLabel(node.getAttribute('data-node-kind') || 'node'));+ setPassportValue(context, node.getAttribute('data-node-context'));+ setPassportValue(tag, node.getAttribute('data-node-tag'));+ setPassportValue(document.getElementById('focus-brand'), node.getAttribute('data-node-brand'));+ semanticId.textContent = id;+ semanticId.hidden = false;+ renderSourceEvidence(id);+ }+ function relationshipsFor(id, byId) {+ var seen = {};+ var relationships = [];+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var edgeLabel = edge.getAttribute('data-edge-label') || '';+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + edgeLabel);+ var edgeId = edge.getAttribute('data-edge-id') || '';+ if (seen[edgeKey]) return;+ seen[edgeKey] = true;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var neighborId = direction === 'in' ? from : to;+ var neighbor = byId[neighborId];+ relationships.push({+ key: edgeKey,+ id: edgeId,+ from: from,+ to: to,+ direction: direction,+ neighborId: neighborId,+ neighborLabel: neighbor ? nodeLabel(neighbor, neighborId) : neighborId,+ label: edgeLabel || viewerText(direction === 'loop'+ ? 'viewer.passport.relationship.loopsBack'+ : direction === 'out'+ ? 'viewer.passport.relationship.connectsTo'+ : 'viewer.passport.relationship.connectsFrom')+ });+ });+ return relationships;+ }+ function relationshipEdgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function relationshipHitRecords() {+ var recordsByKey = {};+ var recordsById = {};+ var byId = {};+ nodes().forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var records = [];+ edges().forEach(function (edge) {+ var shapes = relationshipEdgeShapes(edge);+ if (!shapes.length) return;+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var labelValue = edge.getAttribute('data-edge-label') || '';+ var edgeId = edge.getAttribute('data-edge-id') || '';+ var key = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + labelValue);+ var existing = recordsByKey[key];+ if (existing) {+ if (existing.from !== from || existing.to !== to || existing.labelValue !== labelValue || existing.id !== edgeId) {+ existing.invalid = true;+ return;+ }+ shapes.forEach(function (shape) {+ if (existing.shapes.indexOf(shape) === -1) existing.shapes.push(shape);+ });+ return;+ }+ var record = {+ key: key,+ id: edgeId,+ from: from,+ to: to,+ fromLabel: byId[from] ? nodeLabel(byId[from], from) : from,+ toLabel: byId[to] ? nodeLabel(byId[to], to) : to,+ labelValue: labelValue,+ label: labelValue || viewerText(from === to+ ? 'viewer.passport.relationship.loopsBack'+ : 'viewer.passport.relationship.connectsTo'),+ edge: edge,+ shapes: shapes,+ invalid: false+ };+ recordsByKey[key] = record;+ if (edgeId) {+ if (recordsById[edgeId]) {+ recordsById[edgeId].invalid = true;+ record.invalid = true;+ } else {+ recordsById[edgeId] = record;+ }+ }+ records.push(record);+ });+ return records.filter(function (record) { return !record.invalid && record.from && record.to; });+ }+ function relationshipRecordForKey(key) {+ return relationshipHitRecords().find(function (record) { return record.key === key; }) || null;+ }+ function pinnedRelationshipRecord() {+ return pinnedRelationshipKey ? relationshipRecordForKey(pinnedRelationshipKey) : null;+ }+ function renderRelationshipCopyAction() {+ var record = pinnedRelationshipRecord();+ if (record && record.id) {+ copyBtn.textContent = viewerText('viewer.passport.copyRelation');+ copyBtn.setAttribute('aria-label', viewerText('viewer.passport.copyPinned'));+ } else if (pinnedRelationshipKey) {+ copyBtn.textContent = viewerText('viewer.passport.copyNode');+ copyBtn.setAttribute('aria-label', viewerText('viewer.passport.copySource'));+ } else {+ copyBtn.textContent = viewerText('viewer.passport.copy');+ copyBtn.setAttribute('aria-label', viewerText('viewer.passport.copy.focus'));+ }+ }+ function relationshipHitGeometry(shape, className) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', className || 'relationship-hit-rail');+ return clone;+ }+ function removeRelationshipPulse() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-relationship-pulse-overlay]'), function (element) {+ element.remove();+ });+ }+ function relationshipPulseGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('transform');+ clone.removeAttribute('filter');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('tabindex');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-focus-match');+ clone.removeAttribute('data-relationship-preview');+ clone.setAttribute('class', 'relationship-flow-pulse');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function relationshipTokenKind(edge) {+ var shapes = relationshipEdgeShapes(edge);+ var classEvidence = [edge.getAttribute('class') || ''].concat(shapes.map(function (shape) {+ return shape.getAttribute('class') || '';+ })).join(' ');+ var from = edge.getAttribute('data-edge-from') || '';+ var to = edge.getAttribute('data-edge-to') || '';+ var source = nodes().find(function (node) { return node.getAttribute('data-node-id') === from; });+ var target = nodes().find(function (node) { return node.getAttribute('data-node-id') === to; });+ var sourceKind = source ? source.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ var targetKind = target ? target.getAttribute('data-node-kind') || 'neutral' : 'neutral';+ if (/\ba-security\b/.test(classEvidence) || sourceKind === 'security' || targetKind === 'security' || targetKind === 'failure') return 'security';+ if (/\ba-dashed\b/.test(classEvidence) || sourceKind === 'messagebus' || targetKind === 'messagebus') return 'event';+ if (sourceKind === 'database' || targetKind === 'database') return 'data';+ if (targetKind === 'waiting' || targetKind === 'success') return 'state';+ return 'call';+ }+ function relationshipTokenPath(shape) {+ if (!shape) return '';+ var tagName = String(shape.tagName || '').toLowerCase();+ if (tagName === 'path') return shape.getAttribute('d') || '';+ if (tagName === 'line') {+ return 'M ' + shape.getAttribute('x1') + ' ' + shape.getAttribute('y1') ++ ' L ' + shape.getAttribute('x2') + ' ' + shape.getAttribute('y2');+ }+ if (tagName === 'polyline' && shape.points && shape.points.numberOfItems > 1) {+ var commands = [];+ for (var i = 0; i < shape.points.numberOfItems; i += 1) {+ var point = shape.points.getItem(i);+ commands.push((i === 0 ? 'M ' : 'L ') + point.x + ' ' + point.y);+ }+ return commands.join(' ');+ }+ return '';+ }+ function relationshipTokenPart(tagName, className, attrs) {+ var part = document.createElementNS(svgNamespace, tagName);+ part.setAttribute('class', className);+ Object.keys(attrs || {}).forEach(function (name) { part.setAttribute(name, attrs[name]); });+ return part;+ }+ function relationshipTokenGeometry(shape, kind, key, options) {+ options = options || {};+ var pathData = relationshipTokenPath(shape);+ if (!pathData) return null;+ var token = document.createElementNS(svgNamespace, 'g');+ token.setAttribute('class', 'semantic-flow-token ' + (options.className || 'relationship-flow-token'));+ token.setAttribute('data-token-kind', kind);+ token.setAttribute('data-token-edge-key', key);+ token.setAttribute('aria-hidden', 'true');+ token.appendChild(relationshipTokenPart('circle', 'semantic-flow-token-halo', { cx: '0', cy: '0', r: '7' }));+ if (kind === 'data') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-5', y: '-4', width: '10', height: '8', rx: '2' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -2.8 -1.2 h 5.6 M -2.8 1.4 h 3.8' }));+ } else if (kind === 'event') {+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-7', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '-2', y: '-3', width: '4', height: '6', rx: '1' }));+ token.appendChild(relationshipTokenPart('rect', 'relationship-flow-token-shape', { x: '3', y: '-3', width: '4', height: '6', rx: '1' }));+ } else if (kind === 'security') {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-shape', { d: 'M 0 -5 L 4 -3.4 V 0 c 0 3 -1.6 4.5 -4 5.5 C -2.4 4.5 -4 3 -4 0 v -3.4 Z' }));+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'm -2 .2 1.4 1.4 L 2 -1.4' }));+ } else if (kind === 'state') {+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-shape', { cx: '0', cy: '0', r: '5' }));+ token.appendChild(relationshipTokenPart('circle', 'relationship-flow-token-dot', { cx: '0', cy: '0', r: '1.35' }));+ } else {+ token.appendChild(relationshipTokenPart('path', 'relationship-flow-token-ink', { d: 'M -5 -3 L -1 0 L -5 3 M 0 -3 L 4 0 L 0 3' }));+ }+ var motion = document.createElementNS(svgNamespace, 'animateMotion');+ motion.setAttribute('path', pathData);+ motion.setAttribute('dur', options.duration || '1.2s');+ motion.setAttribute('begin', '0s');+ motion.setAttribute('fill', 'freeze');+ motion.setAttribute('rotate', 'auto');+ motion.setAttribute('calcMode', 'spline');+ motion.setAttribute('keyTimes', '0;1');+ motion.setAttribute('keySplines', '.2 0 .2 1');+ token.appendChild(motion);+ return token;+ }+ function createSemanticFlowToken(edge, shape, options) {+ if (!edge || !shape) return null;+ var key = edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ return relationshipTokenGeometry(shape, relationshipTokenKind(edge), key, options);+ }+ Archify.flowTokens = {+ create: createSemanticFlowToken,+ kind: function (edge) { return relationshipTokenKind(edge); },+ path: relationshipTokenPath+ };+ function renderRelationshipPulse(key) {+ removeRelationshipPulse();+ if (!key || document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (document.hidden || (Archify.motionGovernor && Archify.motionGovernor.isPaused())) return false;+ if (reducedMotionQuery && reducedMotionQuery.matches) return false;+ var matchingEdges = edges().filter(function (edge) {+ return edge.getAttribute('data-edge-key') === key;+ });+ if (!matchingEdges.length) return false;+ var overlay = document.createElementNS(svgNamespace, 'g');+ overlay.setAttribute('class', 'relationship-pulse-overlay');+ overlay.setAttribute('data-relationship-pulse-overlay', '');+ overlay.setAttribute('data-relationship-pulse-key', key);+ overlay.setAttribute('aria-hidden', 'true');+ var tokenAdded = false;+ matchingEdges.forEach(function (edge) {+ var wrapper = document.createElementNS(svgNamespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ var shapes = relationshipEdgeShapes(edge);+ shapes.forEach(function (shape) {+ wrapper.appendChild(relationshipPulseGeometry(shape));+ });+ if (!tokenAdded && shapes.length) {+ var tokenKind = relationshipTokenKind(edge);+ var token = relationshipTokenGeometry(shapes[0], tokenKind, key);+ if (token) {+ wrapper.appendChild(token);+ overlay.setAttribute('data-relationship-token-kind', tokenKind);+ tokenAdded = true;+ }+ }+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var finishPulse = function () {+ if (overlay.parentNode) overlay.remove();+ };+ overlay.addEventListener('animationend', finishPulse, { once: true });+ overlay.addEventListener('animationcancel', finishPulse, { once: true });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function clearRelationshipPreview(options) {+ options = options || {};+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ removeRelationshipPulse();+ activeRelationshipPreview = null;+ svg.removeAttribute('data-relationship-preview-active');+ svg.removeAttribute('data-relationship-direct-active');+ if (options.clearPin === true) {+ pinnedRelationship = null;+ pinnedRelationshipKey = null;+ svg.removeAttribute('data-relationship-pin-active');+ }+ chip.removeAttribute('data-relationship-previewing');+ edges().forEach(function (edge) { edge.removeAttribute('data-relationship-preview'); });+ nodes().forEach(function (node) {+ node.removeAttribute('data-relationship-preview-node');+ node.removeAttribute('data-relationship-preview-source');+ node.removeAttribute('data-relationship-preview-target');+ });+ Array.prototype.forEach.call(relationshipList.querySelectorAll('[data-preview-active]'), function (button) {+ button.removeAttribute('data-preview-active');+ });+ relationshipHitTargets.forEach(function (target) {+ target.setAttribute('aria-pressed', pinnedRelationshipKey && target.getAttribute('data-relationship-key') === pinnedRelationshipKey ? 'true' : 'false');+ target.removeAttribute('data-preview-active');+ });+ renderRelationshipCopyAction();+ requestLensPlacement();+ }+ function previewRelationship(button, options) {+ options = options || {};+ if (pinnedRelationshipKey && pinnedRelationship && button !== pinnedRelationship) return;+ clearRelationshipPreview();+ if (!button) return;+ var key = button.getAttribute('data-relationship-key');+ var from = button.getAttribute('data-relationship-from');+ var to = button.getAttribute('data-relationship-to');+ if (!key || !from || !to) return;+ svg.setAttribute('data-relationship-preview-active', key);+ if (options.direct === true) svg.setAttribute('data-relationship-direct-active', key);+ edges().forEach(function (edge) {+ if (edge.getAttribute('data-edge-key') === key) edge.setAttribute('data-relationship-preview', '');+ });+ nodes().forEach(function (node) {+ var id = node.getAttribute('data-node-id');+ if (id !== from && id !== to) return;+ node.setAttribute('data-relationship-preview-node', '');+ if (id === from) node.setAttribute('data-relationship-preview-source', '');+ if (id === to) node.setAttribute('data-relationship-preview-target', '');+ });+ button.setAttribute('data-preview-active', 'true');+ if (!chip.hidden && options.direct !== true) chip.setAttribute('data-relationship-previewing', 'true');+ activeRelationshipPreview = button;+ renderRelationshipPulse(key);+ requestLensPlacement();+ }+ function syncRelationshipPreview() {+ var next = pinnedRelationship || focusedRelationship || hoveredRelationship;+ if (next === activeRelationshipPreview) return;+ previewRelationship(next, { direct: !!(next && next.hasAttribute('data-relationship-hit-key')) });+ }+ function directRelationshipBlocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ (activeIds.length > 0 && !pinnedRelationshipKey) ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-route-picking') ||+ svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-chapter-preview');+ }+ function scheduleDirectRelationshipPreview(target) {+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ if (pinnedRelationshipKey) return;+ directPreviewTimer = window.setTimeout(function () {+ directPreviewTimer = null;+ if (pinnedRelationshipKey || hoveredRelationship !== target || directRelationshipBlocked()) return;+ previewRelationship(target, { direct: true });+ }, reducedMotionQuery && reducedMotionQuery.matches ? 0 : 90);+ }+ function relationshipHitTarget(key) {+ return relationshipHitTargets.find(function (target) {+ return target.getAttribute('data-relationship-key') === key;+ }) || null;+ }+ function revealPinnedRelationship(record) {+ function reveal() {+ if (!record || pinnedRelationshipKey !== record.key) return true;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') return false;+ Archify.view.reveal([record.from, record.to], { reason: 'relationship-direct' });+ return true;+ }+ if (!reveal()) requestAnimationFrame(reveal);+ }+ function inspectRelationship(key, options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (directPreviewTimer) window.clearTimeout(directPreviewTimer);+ directPreviewTimer = null;+ hoveredRelationship = null;+ focusedRelationship = null;+ if (pinnedRelationshipKey === key) {+ if (options.toggle === false) return true;+ clear({ updateUrl: options.updateUrl !== false });+ return true;+ }+ var record = relationshipRecordForKey(key);+ if (!record) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(record.from, { toggle: false, updateUrl: false });+ var row = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-key]')).find(function (candidate) {+ return candidate.getAttribute('data-relationship-key') === key;+ });+ if (!row) return false;+ previewRelationship(row);+ pinnedRelationship = row;+ pinnedRelationshipKey = key;+ svg.setAttribute('data-relationship-pin-active', key);+ var target = relationshipHitTarget(key);+ if (target) target.setAttribute('aria-pressed', 'true');+ renderRelationshipCopyAction();+ summary.textContent = viewerText('viewer.passport.relationship.pinned', {+ from: record.fromLabel,+ to: record.toLabel,+ label: record.label+ });+ revealPinnedRelationship(record);+ if (options.updateUrl !== false && record.id) {+ try { history.replaceState(null, '', location.pathname + location.search + '#relation=' + encodeURIComponent(record.id)); } catch (_) {}+ }+ return true;+ }+ function inspectRelationshipById(id, options) {+ var record = relationshipHitRecords().find(function (item) { return item.id === id; });+ return record ? inspectRelationship(record.key, options) : false;+ }+ function installRelationshipHitTargets() {+ if (html.getAttribute('data-embed') === 'true') return 0;+ var records = relationshipHitRecords();+ if (!records.length) return 0;+ relationshipHitOverlay = document.createElementNS(svgNamespace, 'g');+ relationshipHitOverlay.setAttribute('class', 'relationship-hit-overlay');+ relationshipHitOverlay.setAttribute('data-relationship-hit-overlay', '');+ relationshipHitOverlay.setAttribute('role', 'group');+ relationshipHitOverlay.setAttribute('aria-label', viewerText('viewer.passport.relationship.explorer'));+ var relationshipHelp = document.createElementNS(svgNamespace, 'desc');+ relationshipHelp.id = 'archify-relationship-help';+ relationshipHelp.textContent = viewerText('viewer.passport.relationship.help');+ relationshipHitOverlay.appendChild(relationshipHelp);+ records.forEach(function (record, index) {+ var target = document.createElementNS(svgNamespace, 'g');+ target.setAttribute('class', 'relationship-hit-target');+ target.setAttribute('data-relationship-hit-key', record.key);+ target.setAttribute('data-relationship-key', record.key);+ target.setAttribute('data-relationship-from', record.from);+ target.setAttribute('data-relationship-to', record.to);+ if (record.id) target.setAttribute('data-relationship-id', record.id);+ target.setAttribute('role', 'button');+ target.setAttribute('tabindex', index === 0 ? '0' : '-1');+ target.setAttribute('aria-pressed', 'false');+ target.setAttribute('aria-describedby', relationshipHelp.id);+ var description = viewerText('viewer.passport.relationship.inspect', {+ index: index + 1,+ total: records.length,+ from: record.fromLabel,+ to: record.toLabel,+ label: record.label+ });+ target.setAttribute('aria-label', description);+ var title = document.createElementNS(svgNamespace, 'title');+ title.textContent = record.fromLabel + ' \u2192 ' + record.toLabel + ' \u00b7 ' + record.label;+ target.appendChild(title);+ record.shapes.forEach(function (shape) {+ target.appendChild(relationshipHitGeometry(shape));+ target.appendChild(relationshipHitGeometry(shape, 'relationship-focus-rail'));+ });+ if (target.childNodes.length > 1) {+ relationshipHitTargets.push(target);+ relationshipHitOverlay.appendChild(target);+ }+ });+ if (!relationshipHitTargets.length) return 0;+ var firstNode = svg.querySelector('[data-node-id]');+ var nodeLayer = firstNode;+ while (nodeLayer && nodeLayer.parentNode && nodeLayer.parentNode !== svg) nodeLayer = nodeLayer.parentNode;+ if (nodeLayer && nodeLayer.parentNode === svg) svg.insertBefore(relationshipHitOverlay, nodeLayer);+ else svg.appendChild(relationshipHitOverlay);++ relationshipHitOverlay.addEventListener('pointerdown', function (event) {+ if (event.target.closest('[data-relationship-hit-key]')) event.stopPropagation();+ });+ relationshipHitOverlay.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked() || pinnedRelationshipKey) return;+ if (event.relatedTarget && target.contains(event.relatedTarget)) return;+ hoveredRelationship = target;+ scheduleDirectRelationshipPreview(target);+ });+ relationshipHitOverlay.addEventListener('pointerout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (hoveredRelationship === target) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('focusin', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ focusedRelationship = target;+ if (!pinnedRelationshipKey) previewRelationship(target, { direct: true });+ });+ relationshipHitOverlay.addEventListener('focusout', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || (event.relatedTarget && target.contains(event.relatedTarget))) return;+ if (focusedRelationship === target) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipHitOverlay.addEventListener('click', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target || directRelationshipBlocked()) return;+ event.preventDefault();+ event.stopPropagation();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ });+ relationshipHitOverlay.addEventListener('keydown', function (event) {+ var target = event.target.closest('[data-relationship-hit-key]');+ if (!target) return;+ if (event.key === 'Escape' && pinnedRelationshipKey) {+ event.preventDefault();+ clear({ updateUrl: false });+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ focusedRelationship = null;+ hoveredRelationship = null;+ inspectRelationship(target.getAttribute('data-relationship-key'));+ return;+ }+ if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft' && event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var index = relationshipHitTargets.indexOf(target);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = relationshipHitTargets.length - 1;+ else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') index = (index + 1) % relationshipHitTargets.length;+ else index = (index - 1 + relationshipHitTargets.length) % relationshipHitTargets.length;+ event.preventDefault();+ relationshipHitTargets.forEach(function (item, itemIndex) { item.setAttribute('tabindex', itemIndex === index ? '0' : '-1'); });+ try { relationshipHitTargets[index].focus({ preventScroll: true }); }+ catch (_) { try { relationshipHitTargets[index].focus(); } catch (_) {} }+ });+ return relationshipHitTargets.length;+ }+ function renderRelationshipLens(id, byId) {+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ renderPassport(id, byId[id]);+ var relationships = relationshipsFor(id, byId);+ chip.removeAttribute('data-relations-expanded');+ relationsBtn.setAttribute('aria-expanded', 'false');+ relationsBtn.textContent = viewerCount('viewer.passport.relationship.count', relationships.length);+ relationsBtn.setAttribute('aria-label', viewerCount('viewer.passport.relationship.show', relationships.length));+ var counts = { out: 0, in: 0, loop: 0 };+ relationships.forEach(function (relationship) { counts[relationship.direction] += 1; });+ summary.textContent = viewerText('viewer.passport.relationship.summary', {+ out: counts.out,+ in: counts.in,+ loops: counts.loop ? viewerText('viewer.passport.relationship.loops', { count: counts.loop }) : ''+ });+ renderReachabilityControls(id);+ relationshipList.textContent = '';+ if (!relationships.length) {+ var empty = document.createElement('p');+ empty.className = 'relationship-lens-empty';+ empty.textContent = viewerText('viewer.passport.relationship.none');+ relationshipList.appendChild(empty);+ return;+ }++ [+ { id: 'out', label: viewerText('viewer.passport.relationship.group.out') },+ { id: 'in', label: viewerText('viewer.passport.relationship.group.in') },+ { id: 'loop', label: viewerText('viewer.passport.relationship.group.loop') }+ ].forEach(function (group) {+ var items = relationships.filter(function (relationship) { return relationship.direction === group.id; });+ if (!items.length) return;+ var section = document.createElement('div');+ section.className = 'relationship-lens-group';+ var heading = document.createElement('span');+ heading.className = 'relationship-lens-group-title';+ heading.textContent = group.label + ' · ' + items.length;+ section.appendChild(heading);+ items.forEach(function (relationship) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'relationship-lens-row';+ button.setAttribute('data-direction', relationship.direction);+ button.setAttribute('data-relationship-target', relationship.neighborId);+ button.setAttribute('data-relationship-key', relationship.key);+ button.setAttribute('data-relationship-from', relationship.from);+ button.setAttribute('data-relationship-to', relationship.to);+ if (relationship.id) button.setAttribute('data-relationship-id', relationship.id);+ button.setAttribute('aria-label', viewerText('viewer.passport.relationship.row', {+ group: group.label,+ relationship: relationship.label,+ neighbor: relationship.neighborLabel+ }));+ var direction = document.createElement('span');+ direction.className = 'relationship-lens-direction';+ direction.setAttribute('aria-hidden', 'true');+ direction.textContent = viewerText(relationship.direction === 'out'+ ? 'viewer.passport.relationship.direction.out'+ : relationship.direction === 'in'+ ? 'viewer.passport.relationship.direction.in'+ : 'viewer.passport.relationship.direction.loop');+ var target = document.createElement('strong');+ target.textContent = relationship.neighborLabel;+ var relation = document.createElement('small');+ relation.textContent = relationship.label;+ button.appendChild(direction);+ button.appendChild(target);+ button.appendChild(relation);+ section.appendChild(button);+ });+ relationshipList.appendChild(section);+ });+ }+ var lensFrame = 0;+ function placeRelationshipLens() {+ lensFrame = 0;+ if (chip.hidden || activeIds.length !== 1) return;+ var node = svg.querySelector('[data-node-id="' + activeIds[0] + '"]');+ if (!node) return;+ var containerRect = container.getBoundingClientRect();+ var nodeRect = node.getBoundingClientRect();+ if (containerRect.bottom <= 0 || containerRect.top >= window.innerHeight) return;+ var padding = window.innerWidth <= 720 ? 8 : 16;+ var visibleTop = Math.max(padding, -containerRect.top + padding);+ var visibleBottom = Math.min(containerRect.height - padding, window.innerHeight - containerRect.top - padding);+ var maxTop = Math.max(padding, visibleBottom - chip.offsetHeight);+ var minTop = Math.min(visibleTop, maxTop);+ var nodeCenter = nodeRect.top - containerRect.top + nodeRect.height / 2;+ var mobile = window.innerWidth <= 720;+ var previewingOnMobile = mobile && chip.getAttribute('data-relationship-previewing') === 'true';+ var compactOnMobile = mobile && chip.getAttribute('data-relations-expanded') !== 'true';+ var preferred;+ if (compactOnMobile) {+ var nodeTop = nodeRect.top - containerRect.top;+ var nodeBottom = nodeRect.bottom - containerRect.top;+ var gap = 10;+ var above = nodeTop - chip.offsetHeight - gap;+ var below = nodeBottom + gap;+ if (above >= visibleTop) preferred = above;+ else if (below + chip.offsetHeight <= visibleBottom - 56) preferred = below;+ else preferred = nodeCenter < (visibleTop + visibleBottom) / 2+ ? Math.max(minTop, visibleBottom - chip.offsetHeight - 56)+ : visibleTop;+ } else if (previewingOnMobile) {+ var pinnedTop = visibleTop;+ var pinnedBottom = Math.max(minTop, visibleBottom - chip.offsetHeight - 56);+ preferred = nodeCenter < (visibleTop + visibleBottom) / 2 ? pinnedBottom : pinnedTop;+ } else {+ preferred = nodeCenter - chip.offsetHeight / 2;+ }+ var top = Math.max(minTop, Math.min(maxTop, preferred));+ var chipRect = chip.getBoundingClientRect();+ var safeGap = 10;+ var protectViewerChrome = !mobile || compactOnMobile || previewingOnMobile;+ var protectedRects = (protectViewerChrome+ ? [svg.querySelector('[data-legend]'), container.querySelector('.diagram-nav')]+ : [])+ .filter(function (element) {+ if (!element || element.hidden) return false;+ var style = window.getComputedStyle(element);+ return style.display !== 'none' && style.visibility !== 'hidden';+ })+ .map(function (element) { return element.getBoundingClientRect(); })+ .filter(function (rect) {+ return rect.width > 0 && rect.height > 0 &&+ chipRect.left < rect.right + safeGap && chipRect.right > rect.left - safeGap;+ });+ if (protectedRects.length) {+ var candidates = [top, minTop, maxTop];+ protectedRects.forEach(function (rect) {+ candidates.push(+ rect.top - containerRect.top - chip.offsetHeight - safeGap,+ rect.bottom - containerRect.top + safeGap+ );+ });+ var valid = candidates.map(function (candidate) {+ return Math.max(minTop, Math.min(maxTop, candidate));+ }).filter(function (candidate, index, all) {+ if (all.indexOf(candidate) !== index) return false;+ var candidateTop = containerRect.top + candidate;+ var candidateBottom = candidateTop + chip.offsetHeight;+ return protectedRects.every(function (rect) {+ return candidateBottom <= rect.top - safeGap || candidateTop >= rect.bottom + safeGap;+ });+ });+ valid.sort(function (first, second) {+ return Math.abs(first - preferred) - Math.abs(second - preferred);+ });+ if (valid.length) top = valid[0];+ }+ chip.style.top = Math.round(top) + 'px';+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ }+ function requestLensPlacement() {+ if (lensFrame) return;+ lensFrame = requestAnimationFrame(placeRelationshipLens);+ }+ function clear(options) {+ options = options || {};+ var restoreNode = options.restoreFocus === true && activeIds.length === 1+ ? svg.querySelector('[data-node-id="' + activeIds[0] + '"]')+ : null;+ clearReachability({ updateUrl: false });+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ hoveredRelationship = null;+ focusedRelationship = null;+ clearRelationshipPreview({ clearPin: true });+ activeIds = [];+ svg.removeAttribute('data-focus-active');+ nodes().forEach(function (node) {+ node.removeAttribute('data-focus-match');+ node.removeAttribute('data-focus-selected');+ node.setAttribute('aria-pressed', 'false');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-focus-match'); });+ chip.hidden = true;+ label.textContent = '';+ detail.textContent = '';+ detail.hidden = true;+ kind.textContent = '';+ kind.hidden = true;+ context.textContent = '';+ context.hidden = true;+ tag.textContent = '';+ tag.hidden = true;+ semanticId.textContent = '';+ semanticId.hidden = true;+ evidence.hidden = true;+ evidenceLinks.textContent = '';+ repositoryLink.removeAttribute('href');+ repositoryLink.textContent = '';+ summary.textContent = '';+ reachSection.hidden = true;+ upstreamCount.textContent = '0';+ downstreamCount.textContent = '0';+ upstreamBtn.disabled = true;+ downstreamBtn.disabled = true;+ relationshipList.textContent = '';+ copyBtn.textContent = viewerText('viewer.passport.copy');+ copyBtn.setAttribute('aria-label', viewerText('viewer.passport.copy.focus'));+ relationsBtn.textContent = viewerText('viewer.passport.relations');+ relationsBtn.setAttribute('aria-label', viewerText('viewer.passport.relations.show'));+ relationsBtn.setAttribute('aria-expanded', 'false');+ chip.removeAttribute('data-relations-expanded');+ chip.style.removeProperty('top');+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) {+ try { history.replaceState(null, '', location.pathname + location.search); } catch (_) {}+ }+ if (restoreNode) {+ try { restoreNode.focus({ preventScroll: true }); }+ catch (_) { try { restoreNode.focus(); } catch (_) {} }+ }+ }++ function setMany(ids, options) {+ options = options || {};+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ if (options.preserveRoute !== true && Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ var nodeList = nodes();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var normalized = [];+ (ids || []).forEach(function (id) {+ if (byId[id] && normalized.indexOf(id) === -1) normalized.push(id);+ });+ if (!normalized.length) return false;+ if (normalized.length === activeIds.length && normalized.every(function (id, index) { return activeIds[index] === id; }) && options.toggle !== false) {+ clear();+ return true;+ }++ clear({ updateUrl: false, preserveView: true });+ activeIds = normalized;+ var selected = {};+ var related = {};+ var seenEdges = {};+ var matchedEdges = 0;+ normalized.forEach(function (id) { selected[id] = true; related[id] = true; });+ var selectionMode = options.mode === 'selection' || normalized.length > 1;++ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var match = selectionMode ? selected[from] && selected[to] : selected[from] || selected[to];+ if (!match) return;+ edge.setAttribute('data-focus-match', '');+ if (!selectionMode) { related[from] = true; related[to] = true; }+ var edgeKey = edge.getAttribute('data-edge-key') || (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seenEdges[edgeKey]) { seenEdges[edgeKey] = true; matchedEdges += 1; }+ });+ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-focus-match', '');+ if (selected[nodeId]) {+ node.setAttribute('data-focus-selected', '');+ node.setAttribute('aria-pressed', 'true');+ }+ });+ svg.setAttribute('data-focus-active', normalized.join(' '));+ var defaultLabel = normalized.length === 1+ ? nodeLabel(byId[normalized[0]], normalized[0])+ : viewerText('viewer.guided.chapter.selectedNodes', { count: normalized.length });+ label.textContent = options.label || defaultLabel;+ chip.hidden = options.hideChip === true || normalized.length !== 1 || selectionMode;+ if (!chip.hidden) {+ renderRelationshipLens(normalized[0], byId);+ requestLensPlacement();+ }+ if (options.updateUrl !== false) {+ var key = options.urlKey || 'focus';+ var value = options.urlValue || normalized[0];+ try { history.replaceState(null, '', location.pathname + location.search + '#' + key + '=' + encodeURIComponent(value)); } catch (_) {}+ }+ return true;+ }++ function set(id, options) {+ options = options || {};+ options.mode = 'neighborhood';+ return setMany([id], options);+ }++ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function copyFocusLink() {+ if (activeIds.length !== 1) return Promise.resolve(false);+ var record = pinnedRelationshipRecord();+ var relationId = record && record.id;+ var value = location.href.replace(/#.*$/, '') + (relationId+ ? '#relation=' + encodeURIComponent(relationId)+ : '#focus=' + encodeURIComponent(activeIds[0]) + (reachabilityMode ? '&reach=' + reachabilityMode : ''));+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed');+ copyBtn.setAttribute('aria-label', copied+ ? viewerText(relationId ? 'viewer.passport.copy.pinned.success' : 'viewer.passport.copy.focused.success')+ : viewerText(relationId ? 'viewer.passport.copy.pinned.failed' : 'viewer.passport.copy.focused.failed'));+ window.setTimeout(function () {+ renderRelationshipCopyAction();+ }, 1600);+ return copied;+ });+ }++ svg.addEventListener('click', function (event) {+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (node) {+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ }+ else if (activeIds.length) clear();+ });+ svg.addEventListener('keydown', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.key !== 'Enter' && event.key !== ' ')) return;+ event.preventDefault();+ var id = node.getAttribute('data-node-id');+ set(id);+ if (activeIds.indexOf(id) !== -1 && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'focus' });+ }+ });+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });+ copyBtn.addEventListener('click', copyFocusLink);+ upstreamBtn.addEventListener('click', function () { applyReachability('upstream'); });+ downstreamBtn.addEventListener('click', function () { applyReachability('downstream'); });+ relationsBtn.addEventListener('click', function () {+ var expanded = chip.getAttribute('data-relations-expanded') === 'true';+ if (expanded) chip.removeAttribute('data-relations-expanded');+ else chip.setAttribute('data-relations-expanded', 'true');+ relationsBtn.setAttribute('aria-expanded', expanded ? 'false' : 'true');+ relationsBtn.setAttribute('aria-label', viewerText(expanded+ ? 'viewer.passport.relations.show'+ : 'viewer.passport.relations.hide'));+ requestLensPlacement();+ });+ relationshipList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-relationship-target]');+ if (!button) return;+ var id = button.getAttribute('data-relationship-target');+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'relationship' });+ }+ var node = svg.querySelector('[data-node-id="' + id + '"]');+ if (node) {+ try { node.focus({ preventScroll: true }); } catch (_) { try { node.focus(); } catch (_) {} }+ }+ });+ relationshipList.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch') return;+ if (finePointerQuery && !finePointerQuery.matches) return;+ var button = event.target.closest('[data-relationship-key]');+ if (!button || !relationshipList.contains(button)) return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ hoveredRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (hoveredRelationship === button) hoveredRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button) return;+ focusedRelationship = button;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-relationship-key]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ if (focusedRelationship === button) focusedRelationship = null;+ syncRelationshipPreview();+ });+ relationshipList.addEventListener('keydown', function (event) {+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp' && event.key !== 'Home' && event.key !== 'End') return;+ var buttons = Array.prototype.slice.call(relationshipList.querySelectorAll('[data-relationship-target]'));+ if (!buttons.length) return;+ var index = buttons.indexOf(document.activeElement);+ if (event.key === 'Home') index = 0;+ else if (event.key === 'End') index = buttons.length - 1;+ else if (event.key === 'ArrowDown') index = Math.min(buttons.length - 1, Math.max(0, index + 1));+ else index = Math.max(0, index < 0 ? 0 : index - 1);+ event.preventDefault();+ buttons[index].focus();+ });+ document.addEventListener('click', function (event) {+ var target = event.target;+ if (chip.hidden || !target || typeof target.closest !== 'function' || chip.contains(target)) return;+ if (container.getAttribute('data-just-panned') === 'true') return;+ if (target.closest('[data-node-id], [data-relationship-hit-key], .overview-map')) return;+ clear();+ }, true);+ window.addEventListener('scroll', requestLensPlacement, { passive: true });+ window.addEventListener('resize', requestLensPlacement);+ container.addEventListener('scroll', requestLensPlacement, { passive: true });+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) removeRelationshipPulse();+ });+ function syncRelationshipMotionPreference(event) {+ if (event.matches) removeRelationshipPulse();+ }+ if (reducedMotionQuery) {+ if (typeof reducedMotionQuery.addEventListener === 'function') {+ reducedMotionQuery.addEventListener('change', syncRelationshipMotionPreference);+ } else if (typeof reducedMotionQuery.addListener === 'function') {+ reducedMotionQuery.addListener(syncRelationshipMotionPreference);+ }+ }++ installRelationshipHitTargets();++ function syncFocusFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var relation = params.get('relation');+ var initial = params.get('focus');+ var reach = params.get('reach');+ if (relation) {+ if (html.getAttribute('data-embed') === 'true' ||+ !inspectRelationshipById(relation, { updateUrl: false, toggle: false })) clear({ updateUrl: false });+ }+ else if (initial) {+ if (set(initial, { updateUrl: false, toggle: false }) &&+ (reach === 'upstream' || reach === 'downstream')) {+ applyReachability(reach, { updateUrl: false, toggle: false, reveal: false });+ }+ }+ else if (!params.get('view')) clear({ updateUrl: false });+ } catch (_) {}+ }++ window.addEventListener('hashchange', syncFocusFromHash);+ syncFocusFromHash();++ return {+ set: set,+ setMany: setMany,+ clear: clear,+ copyLink: copyFocusLink,+ reach: applyReachability,+ clearReach: clearReachability,+ reachabilitySnapshot: reachabilitySnapshot,+ inspectRelationship: inspectRelationship,+ inspectRelationshipById: inspectRelationshipById,+ reposition: requestLensPlacement,+ relationship: function () {+ var record = pinnedRelationshipRecord();+ return record ? { id: record.id || null, key: record.key, from: record.from, to: record.to, label: record.label } : null;+ },+ reachability: function () {+ return activeReachability ? {+ direction: activeReachability.direction,+ originId: activeReachability.originId,+ nodeIds: activeReachability.nodeIds.slice(),+ edgeKeys: activeReachability.edgeKeys.slice(),+ maxDepth: activeReachability.maxDepth+ } : null;+ },+ active: function () { return activeIds.length === 0 ? null : (activeIds.length === 1 ? activeIds[0] : activeIds.slice()); }+ };+ })();++ /* ============================================================+ Intent Trace — temporary one-hop topology before durable focus.+ Fine-pointer hover and keyboard focus share the same stable-ID preview;+ touch continues directly to the existing click-to-focus contract.+ ============================================================ */+ Archify.intentTrace = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var status = document.getElementById('intent-trace-status');+ var namespace = 'http://www.w3.org/2000/svg';+ var activeId = null;+ var hoveredNode = null;+ var focusedNode = null;+ var enterTimer = null;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function finePointer() {+ return !window.matchMedia || window.matchMedia('(hover: hover) and (pointer: fine)').matches;+ }+ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }+ function blocked() {+ return html.getAttribute('data-embed') === 'true' ||+ html.getAttribute('data-guide-open') === 'true' ||+ container.classList.contains('is-panning') ||+ svg.hasAttribute('data-lens-active') ||+ svg.hasAttribute('data-story-active') ||+ svg.hasAttribute('data-relationship-preview-active') ||+ !!(Archify.routeProbe && typeof Archify.routeProbe.active === 'function' && Archify.routeProbe.active()) ||+ !!(Archify.focus && typeof Archify.focus.active === 'function' && Archify.focus.active());+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-intent-trace-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function clear(options) {+ options = options || {};+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = null;+ activeId = null;+ svg.removeAttribute('data-intent-trace-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-intent-trace-match');+ node.removeAttribute('data-intent-trace-selected');+ });+ edges().forEach(function (edge) { edge.removeAttribute('data-intent-trace-match'); });+ if (options.announce !== false) status.textContent = '';+ }+ function traceGeometry(shape, direction) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-intent-trace-match');+ clone.removeAttribute('data-intent-trace-selected');+ clone.setAttribute('class', 'intent-trace-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function show(id, options) {+ options = options || {};+ if (!id || blocked()) {+ clear({ announce: false });+ return false;+ }+ if (activeId === id) return true;+ clear({ announce: false });+ var nodeList = nodes();+ var edgeList = edges();+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ var selected = byId[id];+ if (!selected) return false;++ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'intent-trace-overlay');+ overlay.setAttribute('data-intent-trace-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var related = {};+ var seen = {};+ var counts = { out: 0, in: 0, loop: 0 };+ related[id] = true;++ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from !== id && to !== id) return;+ var direction = from === id && to === id ? 'loop' : (from === id ? 'out' : 'in');+ var key = edge.getAttribute('data-edge-key') ||+ (from + '\u0000' + to + '\u0000' + (edge.getAttribute('data-edge-label') || ''));+ if (!seen[key]) {+ seen[key] = true;+ counts[direction] += 1;+ }+ related[from] = true;+ related[to] = true;+ edge.setAttribute('data-intent-trace-match', '');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) {+ wrapper.appendChild(traceGeometry(shape, direction));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });++ nodeList.forEach(function (node) {+ var nodeId = node.getAttribute('data-node-id');+ if (related[nodeId]) node.setAttribute('data-intent-trace-match', '');+ if (nodeId === id) node.setAttribute('data-intent-trace-selected', '');+ });+ if (overlay.childNodes.length) {+ var firstEdge = edgeList[0];+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ activeId = id;+ svg.setAttribute('data-intent-trace-active', id);+ if (options.announce === true) {+ var total = counts.out + counts.in + counts.loop;+ status.textContent = viewerText('viewer.intent.summary', {+ label: nodeLabel(selected, id),+ out: counts.out,+ in: counts.in,+ loops: counts.loop ? viewerText('viewer.intent.loops', { count: counts.loop }) : '',+ total: total+ });+ }+ return true;+ }+ function schedule(node) {+ if (enterTimer) window.clearTimeout(enterTimer);+ enterTimer = window.setTimeout(function () {+ enterTimer = null;+ if (hoveredNode === node) show(node.getAttribute('data-node-id'), { announce: false });+ }, reducedMotion() ? 0 : 90);+ }+ function sync() {+ var candidate = focusedNode || hoveredNode;+ if (!candidate) {+ clear();+ return;+ }+ show(candidate.getAttribute('data-node-id'), { announce: candidate === focusedNode });+ }++ svg.addEventListener('pointerover', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || !finePointer() || event.pointerType === 'touch') return;+ if (event.relatedTarget && node.contains(event.relatedTarget)) return;+ hoveredNode = node;+ schedule(node);+ });+ svg.addEventListener('pointerout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (hoveredNode === node) hoveredNode = null;+ sync();+ });+ svg.addEventListener('focusin', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ focusedNode = node;+ show(node.getAttribute('data-node-id'), { announce: true });+ });+ svg.addEventListener('focusout', function (event) {+ var node = event.target.closest('[data-node-id]');+ if (!node || (event.relatedTarget && node.contains(event.relatedTarget))) return;+ if (focusedNode === node) focusedNode = null;+ sync();+ });+ container.addEventListener('pointerdown', function (event) {+ if (!event.target.closest('[data-node-id]')) clear({ announce: false });+ });+ window.addEventListener('blur', function () { clear({ announce: false }); });++ return {+ show: show,+ clear: clear,+ active: function () { return activeId; }+ };+ })();++ Archify.guidedViews = (function () {+ var data = document.getElementById('archify-guided-views-data');+ var panel = document.getElementById('guided-views');+ var prev = document.getElementById('guided-view-prev');+ var next = document.getElementById('guided-view-next');+ var all = document.getElementById('guided-view-all');+ var play = document.getElementById('guided-view-play');+ var playIcon = document.getElementById('guided-view-play-icon');+ var playLabel = document.getElementById('guided-view-play-label');+ var beatLink = document.getElementById('guided-view-beat-link');+ var beatLinkLabel = document.getElementById('guided-view-beat-link-label');+ var progressBar = document.getElementById('guided-view-progress-bar');+ var count = document.getElementById('guided-view-count');+ var handoffReceipt = document.getElementById('guided-view-handoff');+ var label = document.getElementById('guided-view-label');+ var note = document.getElementById('guided-view-note');+ var trail = document.getElementById('guided-view-trail');+ var storyCaption = document.getElementById('guided-story-caption');+ var storyCaptionIndex = document.getElementById('guided-story-caption-index');+ var storyCaptionRoute = document.getElementById('guided-story-caption-route');+ var storyCaptionDetail = document.getElementById('guided-story-caption-detail');+ var storyCaptionNext = document.getElementById('guided-story-caption-next');+ var storyCaptionNextLabel = document.getElementById('guided-story-caption-next-label');+ var chapterIndex = document.getElementById('guided-view-index');+ var chapterList = document.getElementById('guided-view-chapters');+ var shareCue = document.getElementById('share-chapter-cue');+ var shareCueState = document.getElementById('share-chapter-state');+ var shareCueCount = document.getElementById('share-chapter-count');+ var shareCueLabel = document.getElementById('share-chapter-label');+ var shareCueNote = document.getElementById('share-chapter-note');+ var shareCueRoute = document.getElementById('share-chapter-route');+ var shareCueProgress = document.getElementById('share-chapter-progress-bar');+ var svg = document.querySelector('.diagram-container svg');+ var views = [];+ var activeIndex = -1;+ var playing = false;+ var storyBeatTimer = null;+ var storyBeatIndex = -1;+ var storyBeatStartedAt = 0;+ var storyBeatElapsedMs = 0;+ var storyBeatDwellMs = 0;+ var storyPlaybackGeneration = 0;+ var storyFollowGeneration = 0;+ var storyPlaybackScope = 'story';+ var storyPlaybackComplete = false;+ var beatLinkFeedbackTimer = null;+ var momentRestoreGeneration = 0;+ var storySteps = [];+ var storyPulseOwnerToken = 0;+ var storyPulseGeneration = 0;+ var autoplayPending = false;+ var VIEW_INTERVAL_MS = 3200;+ var STORY_FOLLOW_MIN_DWELL_MS = 1100;+ var STORY_FOLLOW_DURATION_MS = 320;+ var chapterButtons = [];+ var handoffGeneration = 0;+ var currentHandoff = null;+ var previewGeneration = 0;+ var pointerPreviewIntent = null;+ var focusPreviewIntent = null;+ var activePreviewIndex = -1;+ var previewOwnerToken = 0;++ try { views = JSON.parse(data.textContent || '[]'); } catch (_) { views = []; }+ if (!views.length) return { count: 0, active: function () { return null; } };+ var canonicalNodeIds = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ canonicalNodeIds[node.getAttribute('data-node-id')] = true;+ });+ views.forEach(function (view) {+ var seen = {};+ view.focus = (view.focus || []).filter(function (id) {+ if (!canonicalNodeIds[id] || seen[id]) return false;+ seen[id] = true;+ return true;+ });+ });+ // Establish the compact cold state before exposing the panel so the+ // full Director cannot flash during first paint. Hash restoration runs+ // in the same task and replaces this state before paint when valid.+ panel.setAttribute('data-active-view', 'all');+ panel.hidden = false;+ panel.setAttribute('data-view-interval-ms', String(VIEW_INTERVAL_MS));+ panel.setAttribute('data-story-follow-min-dwell-ms', String(STORY_FOLLOW_MIN_DWELL_MS));+ buildChapterIndex();++ function reducedMotion() {+ return !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);+ }++ function findNode(id) {+ return Array.prototype.find.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ return node.getAttribute('data-node-id') === id;+ }) || null;+ }++ function chapterDelta(previous, destination) {+ var previousFocus = previous ? previous.focus : [];+ var destinationFocus = destination ? destination.focus : [];+ var previousIds = {};+ var destinationIds = {};+ previousFocus.forEach(function (id) { previousIds[id] = true; });+ destinationFocus.forEach(function (id) { destinationIds[id] = true; });+ return {+ stay: previousFocus.filter(function (id) { return destinationIds[id]; }),+ enter: destinationFocus.filter(function (id) { return !previousIds[id]; }),+ leave: previousFocus.filter(function (id) { return !destinationIds[id]; })+ };+ }++ function chapterAnchor(previous, destination, outgoingBeatIndex, delta) {+ if (!previous || !destination) return '';+ var stayIds = {};+ delta.stay.forEach(function (id) { stayIds[id] = true; });+ var activeBeat = outgoingBeatIndex >= 0 ? previous.focus[outgoingBeatIndex] : '';+ if (activeBeat && stayIds[activeBeat]) return activeBeat;+ for (var index = previous.focus.length - 1; index >= 0; index -= 1) {+ if (stayIds[previous.focus[index]]) return previous.focus[index];+ }+ return '';+ }++ function handoffMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-embed') === 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.capable && Archify.motionGovernor.isPaused());+ }++ function classifyHandoff(delta, anchor) {+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var role = roles[id] || '';+ if (role) node.setAttribute('data-chapter-role', role);+ else node.removeAttribute('data-chapter-role');+ });+ svg.setAttribute('data-chapter-handoff', anchor ? 'anchor' : 'no-anchor');+ if (anchor) svg.setAttribute('data-chapter-anchor', anchor);+ else svg.removeAttribute('data-chapter-anchor');+ }++ function drawHandoffAnchor(id) {+ var node = findNode(id);+ if (!node) return null;+ var box;+ try { box = node.getBBox(); } catch (_) { return null; }+ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var ring = document.createElementNS('http://www.w3.org/2000/svg', 'rect');+ overlay.setAttribute('class', 'chapter-handoff-overlay');+ overlay.setAttribute('data-chapter-handoff-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ ring.setAttribute('class', 'chapter-handoff-anchor');+ ring.setAttribute('x', String(box.x - 8));+ ring.setAttribute('y', String(box.y - 8));+ ring.setAttribute('width', String(box.width + 16));+ ring.setAttribute('height', String(box.height + 16));+ ring.setAttribute('rx', '10');+ overlay.appendChild(ring);+ svg.appendChild(overlay);+ return overlay;+ }++ function clearHandoffPresentation() {+ svg.removeAttribute('data-chapter-handoff');+ svg.removeAttribute('data-chapter-anchor');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-handoff-overlay]'), function (overlay) { overlay.remove(); });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-role]'), function (node) { node.removeAttribute('data-chapter-role'); });+ if (handoffReceipt) {+ handoffReceipt.hidden = true;+ handoffReceipt.textContent = '';+ }+ }++ function completeHandoff(handoff, outcome) {+ if (!handoff || currentHandoff !== handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ currentHandoff = null;+ clearHandoffPresentation();+ if (handoff.ownerToken && Archify.motionGovernor) Archify.motionGovernor.release(handoff.ownerToken);+ handoff.resolve({ id: handoff.id, state: outcome || 'complete', anchor: handoff.anchor || null });+ syncStoryControlsDisabled();+ syncChapterPreview();+ return true;+ }++ function settleHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'settled', true);+ else if (Archify.view && Archify.view.reveal) Archify.view.reveal(handoff.focus, { instant: true, reason: reason || 'settled' });+ completeHandoff(handoff, reason || 'settled');+ return true;+ }++ function cancelHandoff(reason) {+ var handoff = currentHandoff;+ if (!handoff) return false;+ if (handoff.holdTimer) clearTimeout(handoff.holdTimer);+ handoff.holdTimer = null;+ if (handoff.camera && handoff.camera.cancel) handoff.camera.cancel(reason || 'manual', false);+ completeHandoff(handoff, reason || 'manual');+ return true;+ }++ function afterHandoff(callback) {+ if (!currentHandoff) { callback(); return; }+ currentHandoff.finished.then(callback);+ }++ function beginHandoff(previousIndex, nextIndex, previous, destination, outgoingBeatIndex, reason) {+ if (!Archify.view || !Archify.view.reveal) return null;+ if (!previous || previousIndex === nextIndex) {+ Archify.view.reveal(destination.focus, { reason: reason });+ return null;+ }+ var delta = chapterDelta(previous, destination);+ var anchor = chapterAnchor(previous, destination, outgoingBeatIndex, delta);+ if (!handoffMotionAllowed()) {+ Archify.view.reveal(destination.focus, { instant: true, reason: reason });+ return null;+ }+ var resolver;+ var handoff = {+ id: ++handoffGeneration,+ mode: anchor ? 'holding' : 'no-anchor',+ anchor: anchor,+ focus: destination.focus.slice(),+ holdTimer: null,+ camera: null,+ ownerToken: 0,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver+ };+ currentHandoff = handoff;+ classifyHandoff(delta, anchor);+ if (anchor) {+ drawHandoffAnchor(anchor);+ var node = findNode(anchor);+ var nodeLabel = node ? (node.getAttribute('data-node-label') || anchor) : anchor;+ handoffReceipt.textContent = viewerText('viewer.guided.handoff', {+ from: (previousIndex + 1 < 10 ? '0' : '') + (previousIndex + 1),+ to: (nextIndex + 1 < 10 ? '0' : '') + (nextIndex + 1),+ label: nodeLabel+ });+ handoffReceipt.hidden = false;+ }+ if (Archify.motionGovernor) {+ handoff.ownerToken = Archify.motionGovernor.claim('handoff', function () {+ if (currentHandoff === handoff) settleHandoff('preempted');+ });+ }+ var startCamera = function () {+ if (currentHandoff !== handoff) return;+ handoff.holdTimer = null;+ handoff.mode = 'settling';+ svg.setAttribute('data-chapter-handoff', anchor ? 'settling' : 'no-anchor');+ handoff.camera = Archify.view.reveal(destination.focus, { reason: reason, duration: 420 });+ if (handoff.camera && handoff.camera.finished) {+ handoff.camera.finished.then(function (outcome) {+ if (currentHandoff === handoff) completeHandoff(handoff, outcome && outcome.state || 'complete');+ });+ } else {+ completeHandoff(handoff, 'complete');+ }+ };+ if (anchor) handoff.holdTimer = setTimeout(startCamera, 110);+ else startCamera();+ return handoff;+ }++ function centerChapterButton(button) {+ if (!button || !chapterList) return false;+ var target = Math.max(0, button.offsetLeft - (chapterList.clientWidth - button.offsetWidth) / 2);+ if (typeof chapterList.scrollTo === 'function') chapterList.scrollTo({ left: target, behavior: 'auto' });+ else chapterList.scrollLeft = target;+ return true;+ }++ function focusChapterButton(index) {+ if (!chapterButtons.length) return false;+ index = Math.max(0, Math.min(chapterButtons.length - 1, index));+ chapterButtons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === index ? '0' : '-1');+ });+ chapterButtons[index].focus();+ centerChapterButton(chapterButtons[index]);+ return true;+ }++ function buildChapterIndex() {+ chapterButtons = [];+ chapterList.textContent = '';+ views.forEach(function (view, index) {+ var item = document.createElement('li');+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'guided-view-chapter';+ button.setAttribute('data-guided-view-id', view.id);+ button.setAttribute('aria-pressed', 'false');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ button.setAttribute('aria-label', viewerText('viewer.guided.chapter.open', {+ index: index + 1,+ total: views.length,+ label: view.label,+ count: view.focus.length+ }));+ button.title = view.label + ' — ' + (view.note || viewerText('viewer.guided.chapter.selectedNodes', { count: view.focus.length }));+ var position = document.createElement('span');+ position.className = 'guided-view-chapter-index';+ position.setAttribute('aria-hidden', 'true');+ position.textContent = (index + 1 < 10 ? '0' : '') + (index + 1);+ var title = document.createElement('span');+ title.className = 'guided-view-chapter-title';+ title.textContent = view.label;+ var stops = document.createElement('em');+ stops.className = 'guided-view-chapter-count';+ stops.textContent = viewerCount('viewer.guided.chapter.stop', view.focus.length);+ var delta = document.createElement('span');+ delta.className = 'guided-view-chapter-delta';+ delta.hidden = true;+ delta.setAttribute('aria-hidden', 'true');+ ['stay', 'enter', 'leave'].forEach(function (kind) {+ var value = document.createElement('span');+ value.setAttribute('data-delta-kind', kind);+ delta.appendChild(value);+ });+ button.appendChild(position);+ button.appendChild(title);+ button.appendChild(stops);+ button.appendChild(delta);+ item.appendChild(button);+ chapterList.appendChild(item);+ chapterButtons.push(button);+ });+ }++ function syncChapterIndex() {+ chapterButtons.forEach(function (button, index) {+ var current = index === activeIndex;+ var stops = button.querySelector('.guided-view-chapter-count');+ var deltaLabel = button.querySelector('.guided-view-chapter-delta');+ var position = activeIndex < 0 ? 'available' : (current ? 'current' : (index < activeIndex ? 'before' : 'after'));+ button.setAttribute('data-chapter-position', position);+ button.setAttribute('aria-pressed', current ? 'true' : 'false');+ button.setAttribute('tabindex', current || (activeIndex < 0 && index === 0) ? '0' : '-1');+ if (current) {+ stops.hidden = false;+ deltaLabel.hidden = true;+ button.removeAttribute('data-chapter-delta');+ button.setAttribute('aria-label', viewerText('viewer.guided.chapter.current', {+ index: index + 1,+ total: views.length,+ label: views[index].label,+ count: views[index].focus.length+ }));+ button.title = viewerText('viewer.guided.chapter.current.title', {+ label: views[index].label,+ count: views[index].focus.length+ });+ } else {+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var compact = '=' + delta.stay.length + ' +' + delta.enter.length + ' \u2212' + delta.leave.length;+ var expanded = viewerText('viewer.guided.chapter.delta.expanded', {+ stay: delta.stay.length,+ enter: delta.enter.length,+ leave: delta.leave.length+ });+ stops.hidden = true;+ deltaLabel.hidden = false;+ deltaLabel.querySelector('[data-delta-kind="stay"]').textContent = '=' + delta.stay.length;+ deltaLabel.querySelector('[data-delta-kind="enter"]').textContent = '+' + delta.enter.length;+ deltaLabel.querySelector('[data-delta-kind="leave"]').textContent = '\u2212' + delta.leave.length;+ button.setAttribute('data-chapter-delta', compact);+ button.setAttribute('aria-label', viewerText('viewer.guided.chapter.delta.aria', {+ index: index + 1,+ total: views.length,+ label: views[index].label,+ delta: expanded+ }));+ button.title = viewerText('viewer.guided.chapter.delta.title', {+ label: views[index].label,+ delta: compact+ });+ }+ if (current) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ if (button.parentElement) button.parentElement.setAttribute('data-chapter-position', position);+ });+ if (activeIndex >= 0) centerChapterButton(chapterButtons[activeIndex]);+ }++ function chapterPreviewBlocked() {+ if (document.hidden || playing || currentHandoff) return true;+ if (document.documentElement.getAttribute('data-embed') === 'true') return true;+ if (window.matchMedia && window.matchMedia('print').matches) return true;+ if (svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active')) return true;+ if (svg.hasAttribute('data-lens-active') || svg.hasAttribute('data-legend-preview-active')) return true;+ if (svg.hasAttribute('data-relationship-preview-active') || svg.hasAttribute('data-intent-trace-active')) return true;+ return activeIndex < 0 && svg.hasAttribute('data-focus-active');+ }++ function clearChapterPreviewPresentation() {+ svg.removeAttribute('data-chapter-preview');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-chapter-preview-role]'), function (node) {+ node.removeAttribute('data-chapter-preview-role');+ });+ chapterButtons.forEach(function (button) { button.removeAttribute('data-preview-active'); });+ activePreviewIndex = -1;+ if (previewOwnerToken && Archify.motionGovernor) {+ var token = previewOwnerToken;+ previewOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }++ function clearChapterPreview(options) {+ options = options || {};+ previewGeneration += 1;+ if (options.clearIntents !== false) {+ pointerPreviewIntent = null;+ focusPreviewIntent = null;+ }+ clearChapterPreviewPresentation();+ return true;+ }++ function winningChapterPreviewIntent() {+ return [pointerPreviewIntent, focusPreviewIntent].filter(function (intent) {+ return intent && intent.index >= 0 && intent.index < views.length && intent.index !== activeIndex;+ }).sort(function (left, right) { return right.generation - left.generation; })[0] || null;+ }++ function showChapterPreview(index) {+ if (index < 0 || index >= views.length || index === activeIndex || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ if (activePreviewIndex === index && svg.getAttribute('data-chapter-preview') === views[index].id) return true;+ clearChapterPreviewPresentation();+ var delta = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ var roles = {};+ delta.stay.forEach(function (id) { roles[id] = 'stay'; });+ delta.enter.forEach(function (id) { roles[id] = 'enter'; });+ delta.leave.forEach(function (id) { roles[id] = 'leave'; });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var role = roles[node.getAttribute('data-node-id')];+ if (role) node.setAttribute('data-chapter-preview-role', role);+ });+ svg.setAttribute('data-chapter-preview', views[index].id);+ chapterButtons[index].setAttribute('data-preview-active', 'true');+ activePreviewIndex = index;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ previewOwnerToken = Archify.motionGovernor.claim('chapter-preview', function () {+ previewOwnerToken = 0;+ clearChapterPreviewPresentation();+ });+ }+ return true;+ }++ function syncChapterPreview() {+ var intent = winningChapterPreviewIntent();+ if (!intent || chapterPreviewBlocked()) {+ clearChapterPreviewPresentation();+ return false;+ }+ return showChapterPreview(intent.index);+ }++ function setChapterPreviewIntent(source, index) {+ var intent = { index: index, generation: ++previewGeneration };+ if (source === 'pointer') pointerPreviewIntent = intent;+ else focusPreviewIntent = intent;+ if (playing) pausePlayback();+ return syncChapterPreview();+ }++ function clearChapterPreviewIntent(source, index) {+ var intent = source === 'pointer' ? pointerPreviewIntent : focusPreviewIntent;+ if (intent && (typeof index !== 'number' || intent.index === index)) {+ if (source === 'pointer') pointerPreviewIntent = null;+ else focusPreviewIntent = null;+ previewGeneration += 1;+ }+ return syncChapterPreview();+ }++ function hoverCapable() {+ return !!(window.matchMedia && window.matchMedia('(hover: hover)').matches);+ }++ function sharePlaybackRequested() {+ try { return new URLSearchParams(location.search).get('play') === '1'; }+ catch (_) { return false; }+ }++ autoplayPending = sharePlaybackRequested();+ if (autoplayPending) {+ document.documentElement.setAttribute('data-share-playback', 'true');+ setAutoplayState('pending');+ }++ function setAutoplayState(state) {+ if (state) panel.setAttribute('data-autoplay', state);+ else panel.removeAttribute('data-autoplay');+ renderShareCue();+ }++ function shareCueStatus(state) {+ return {+ pending: viewerText('viewer.guided.state.ready'),+ playing: viewerText('viewer.guided.state.playing'),+ complete: viewerText('viewer.guided.state.settled'),+ interrupted: viewerText('viewer.guided.state.paused'),+ pinned: viewerText('viewer.guided.state.pinned'),+ 'reduced-motion': viewerText('viewer.guided.state.still')+ }[state] || viewerText('viewer.guided.state.ready');+ }++ function shareCueBeatCopy(state, view, stops) {+ var total = stops.length;+ var activeStop = storyBeatIndex >= 0 ? stops[storyBeatIndex] : null;+ if ((state === 'playing' || state === 'interrupted') && activeStop) {+ return viewerText('viewer.guided.share.step', {+ index: (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1),+ total: (total < 10 ? '0' : '') + total,+ label: activeStop.textContent+ });+ }+ if (state === 'pinned' && activeStop) {+ return storyBeatCopy(storySteps[storyBeatIndex], total);+ }+ if (state === 'reduced-motion' && activeStop && hashBeatMatchesCurrent()) {+ return viewerText('viewer.guided.share.staticMoment', {+ step: viewerText('viewer.guided.share.step', {+ index: (storyBeatIndex + 1 < 10 ? '0' : '') + (storyBeatIndex + 1),+ total: (total < 10 ? '0' : '') + total,+ label: activeStop.textContent+ })+ });+ }+ if (state === 'complete') return viewerText('viewer.guided.share.complete', {+ count: total,+ note: view.note || viewerText('viewer.guided.share.settled')+ });+ if (state === 'reduced-motion') return viewerText('viewer.guided.share.staticPath', { count: total });+ if (state === 'pending') return viewerText('viewer.guided.share.ready', { count: total });+ return view.note || viewerText('viewer.guided.chapter.selectedNodes', { count: view.focus.length });+ }++ function renderShareCue() {+ if (!shareCue) return;+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var shareMode = document.documentElement.getAttribute('data-share-playback') === 'true';+ var embedMode = document.documentElement.getAttribute('data-embed') === 'true';+ var pinnedMode = !shareMode && embedMode && hashBeatMatchesCurrent();+ if (pinnedMode) document.documentElement.setAttribute('data-share-moment', 'true');+ else document.documentElement.removeAttribute('data-share-moment');+ shareCue.hidden = !(embedMode && view && (shareMode || pinnedMode));+ if (shareCue.hidden) return;+ var state = pinnedMode ? 'pinned' : (panel.getAttribute('data-autoplay') || 'pending');+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ var route = stops.map(function (stop, index) {+ if (index === 0) return stop.textContent;+ var kind = stop.getAttribute('data-story-link');+ var separator = kind === 'forward' ? '\u2192' : (kind === 'reverse' ? '\u2190' : (kind === 'multiple' ? '\u21c4' : '\u00b7'));+ return separator + ' ' + stop.textContent;+ }).join(' ');+ var beatCopy = shareCueBeatCopy(state, view, stops);+ shareCue.setAttribute('data-state', state);+ shareCue.setAttribute('aria-live', state === 'playing' ? 'off' : 'polite');+ shareCueState.textContent = shareCueStatus(state);+ shareCueCount.textContent = viewerText('viewer.guided.share.chapter', {+ index: (activeIndex + 1 < 10 ? '0' : '') + (activeIndex + 1),+ total: (views.length < 10 ? '0' : '') + views.length+ });+ shareCueLabel.textContent = view.label;+ shareCueNote.textContent = beatCopy;+ shareCueRoute.textContent = route;+ shareCue.setAttribute('aria-label', viewerText('viewer.guided.share.aria', {+ state: shareCueStatus(state),+ index: activeIndex + 1,+ total: views.length,+ label: view.label,+ beat: beatCopy,+ route: route+ }));+ }++ function setShareCueProgress(fraction) {+ if (!shareCueProgress) return;+ shareCueProgress.style.animation = 'none';+ shareCueProgress.style.setProperty('--guided-progress-start', String(Math.max(0, Math.min(1, fraction))));+ shareCueProgress.style.transform = 'scaleX(' + Math.max(0, Math.min(1, fraction)) + ')';+ }++ function startShareCueProgress(fraction, duration) {+ if (!shareCueProgress) return;+ setShareCueProgress(fraction || 0);+ void shareCueProgress.offsetWidth;+ shareCueProgress.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function storyNodeLabel(node, fallback) {+ if (!node) return fallback;+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '');+ }++ function storyEdgeKey(edge) {+ return edge.getAttribute('data-edge-key') || (+ edge.getAttribute('data-edge-from') + '\u0000' ++ edge.getAttribute('data-edge-to') + '\u0000' ++ (edge.getAttribute('data-edge-label') || '')+ );+ }++ function uniqueStoryEdges(edgeList) {+ var positions = {};+ var unique = [];+ edgeList.forEach(function (edge) {+ var key = storyEdgeKey(edge);+ if (!Object.prototype.hasOwnProperty.call(positions, key)) {+ positions[key] = unique.length;+ unique.push(edge);+ return;+ }+ var index = positions[key];+ if (!storyGeometry(unique[index]).length && storyGeometry(edge).length) unique[index] = edge;+ });+ return unique;+ }++ function storyStep(view, index, edgeList, byId) {+ var id = view.focus[index];+ var node = byId[id];+ var previousId = index > 0 ? view.focus[index - 1] : '';+ var forward = [];+ var reverse = [];+ if (previousId) {+ edgeList.forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (from === previousId && to === id) forward.push(edge);+ else if (from === id && to === previousId) reverse.push(edge);+ });+ }+ forward = uniqueStoryEdges(forward);+ reverse = uniqueStoryEdges(reverse);+ var edges = forward.concat(reverse).sort(function (left, right) {+ return edgeList.indexOf(left) - edgeList.indexOf(right);+ });+ var relation = index === 0 ? 'start' : (!edges.length ? 'group' : (+ edges.length === 1 && forward.length === 1 ? 'forward' :+ (edges.length === 1 && reverse.length === 1 ? 'reverse' : 'multiple')+ ));+ return {+ index: index,+ nodeId: id,+ nodeLabel: storyNodeLabel(byId[id], id),+ previousId: previousId,+ previousLabel: previousId ? storyNodeLabel(byId[previousId], previousId) : '',+ relation: relation,+ edges: edges,+ edgeKeys: edges.map(storyEdgeKey),+ edgeLabels: edges.map(function (edge) { return edge.getAttribute('data-edge-label') || ''; }).filter(function (value, edgeIndex, values) {+ return value && values.indexOf(value) === edgeIndex;+ }),+ responsibility: node ? (node.getAttribute('data-node-sublabel') || '') : '',+ context: node ? (node.getAttribute('data-node-context') || '') : ''+ };+ }++ function storyBeatCopy(step, total) {+ if (!step) return '';+ var position = (step.index + 1 < 10 ? '0' : '') + (step.index + 1);+ var countValue = (total < 10 ? '0' : '') + total;+ if (step.relation === 'start') return viewerText('viewer.guided.beat.start', { index: position, total: countValue, label: step.nodeLabel });+ if (step.relation === 'forward') return viewerText('viewer.guided.beat.forward', { index: position, total: countValue, from: step.previousLabel, to: step.nodeLabel });+ if (step.relation === 'reverse') return viewerText('viewer.guided.beat.reverse', { index: position, total: countValue, from: step.nodeLabel, to: step.previousLabel });+ if (step.relation === 'multiple') return viewerText('viewer.guided.beat.multiple', { index: position, total: countValue, from: step.previousLabel, to: step.nodeLabel, count: step.edges.length });+ return viewerText('viewer.guided.beat.group', { index: position, total: countValue, from: step.previousLabel, to: step.nodeLabel });+ }++ function storyBeatAria(step, total) {+ var prefix = viewerText('viewer.guided.beat.aria.prefix', { index: step.index + 1, total: total, label: step.nodeLabel });+ if (step.relation === 'start') return prefix + viewerText('viewer.guided.beat.aria.start');+ if (step.relation === 'forward') return prefix + viewerText('viewer.guided.beat.aria.forward', { from: step.previousLabel });+ if (step.relation === 'reverse') return prefix + viewerText('viewer.guided.beat.aria.reverse', { from: step.previousLabel, to: step.nodeLabel });+ if (step.relation === 'multiple') return prefix + viewerText('viewer.guided.beat.aria.multiple', { from: step.previousLabel, count: step.edges.length });+ return prefix + viewerText('viewer.guided.beat.aria.group', { from: step.previousLabel });+ }++ function storyCaptionRouteCopy(step) {+ if (step.relation === 'start') return step.nodeLabel + ' · ' + viewerText('viewer.guided.caption.start');+ if (step.relation === 'reverse') return step.previousLabel + ' ← ' + step.nodeLabel;+ if (step.relation === 'multiple') return step.previousLabel + ' ⇄ ' + step.nodeLabel;+ if (step.relation === 'group') return step.previousLabel + ' · ' + step.nodeLabel;+ return step.previousLabel + ' → ' + step.nodeLabel;+ }++ function storyCaptionDetailCopy(step) {+ var facts = [];+ if (step.relation === 'group') facts.push(viewerText('viewer.guided.caption.grouped'));+ else if (step.edgeLabels.length) facts.push(step.edgeLabels.slice(0, 3).join(' + ') + (step.edgeLabels.length > 3 ? viewerText('viewer.guided.caption.more', { count: step.edgeLabels.length - 3 }) : ''));+ else if (step.relation === 'reverse') facts.push(viewerText('viewer.guided.caption.reverse'));+ else if (step.relation === 'multiple') facts.push(viewerText('viewer.guided.caption.relationships', { count: step.edges.length }));+ else if (step.relation !== 'start') facts.push(viewerText('viewer.guided.caption.relationship'));+ if (step.relation === 'reverse') facts.push(viewerText('viewer.guided.caption.direction', { from: step.nodeLabel, to: step.previousLabel }));+ if (step.responsibility) facts.push(step.responsibility);+ if (step.context) facts.push(step.context);+ if (!facts.length) facts.push(viewerText('viewer.guided.caption.starting'));+ return facts.join(' · ');+ }++ function renderStoryCaption(step, total, nextStep) {+ if (!storyCaption) return;+ if (!step) {+ storyCaption.hidden = true;+ storyCaption.removeAttribute('data-story-caption');+ storyCaptionNext.hidden = true;+ storyCaptionNextLabel.textContent = '';+ return;+ }+ storyCaption.hidden = false;+ storyCaption.setAttribute('data-story-caption', step.relation);+ storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ storyCaptionIndex.textContent = (step.index + 1 < 10 ? '0' : '') + (step.index + 1) + ' / ' + (total < 10 ? '0' : '') + total;+ storyCaptionRoute.textContent = storyCaptionRouteCopy(step);+ storyCaptionDetail.textContent = storyCaptionDetailCopy(step);+ storyCaptionNext.hidden = !nextStep;+ storyCaptionNextLabel.textContent = nextStep+ ? ((nextStep.index + 1 < 10 ? '0' : '') + (nextStep.index + 1) + ' · ' + nextStep.nodeLabel)+ : '';+ storyCaption.style.animation = 'none';+ void storyCaption.offsetWidth;+ storyCaption.style.removeProperty('animation');+ }++ function storyMomentLink() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return '';+ var url = new URL(location.href);+ url.searchParams.delete('play');+ url.hash = 'view=' + encodeURIComponent(view.id) + '&beat=' + encodeURIComponent(step.nodeId);+ return url.href;+ }++ function fallbackCopyStoryMoment(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }++ function resetBeatLinkFeedback() {+ if (beatLinkFeedbackTimer) clearTimeout(beatLinkFeedbackTimer);+ beatLinkFeedbackTimer = null;+ beatLink.removeAttribute('data-copy-state');+ beatLinkLabel.textContent = viewerText('viewer.guided.copyMoment');+ }++ function syncBeatLink() {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ var available = !!(activeIndex >= 0 && step && !currentHandoff);+ beatLink.disabled = !available;+ if (!beatLink.hasAttribute('data-copy-state')) beatLinkLabel.textContent = viewerText('viewer.guided.copyMoment');+ var description = available+ ? viewerText('viewer.guided.beatLink', { index: step.index + 1, total: storySteps.length, label: step.nodeLabel })+ : viewerText('viewer.guided.selectBeatLink');+ beatLink.setAttribute('aria-label', description);+ beatLink.title = description;+ }++ function setBeatLinkFeedback(copied) {+ resetBeatLinkFeedback();+ beatLink.setAttribute('data-copy-state', copied ? 'copied' : 'failed');+ beatLinkLabel.textContent = viewerText(copied ? 'viewer.guided.copied' : 'viewer.guided.copyFailed');+ beatLink.setAttribute('aria-label', viewerText(copied ? 'viewer.guided.momentCopied' : 'viewer.guided.momentCopyFailed'));+ beatLinkFeedbackTimer = setTimeout(function () {+ resetBeatLinkFeedback();+ syncBeatLink();+ }, 1600);+ }++ function copyStoryMomentLink() {+ if (playing) pausePlayback();+ var value = storyMomentLink();+ if (!value) return Promise.resolve(false);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopyStoryMoment(value); })+ : Promise.resolve(fallbackCopyStoryMoment(value));+ return copy.then(function (copied) {+ setBeatLinkFeedback(copied);+ return copied;+ });+ }++ function hashBeatMatchesCurrent() {+ var view = activeIndex >= 0 ? views[activeIndex] : null;+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ if (!view || !step) return false;+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ return params.get('view') === view.id && params.get('beat') === step.nodeId;+ } catch (_) { return false; }+ }++ function storyMotionAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (document.documentElement.getAttribute('data-motion') !== 'live') return false;+ if (document.documentElement.getAttribute('data-embed') === 'true' &&+ document.documentElement.getAttribute('data-share-playback') !== 'true') return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ return !(Archify.motionGovernor && Archify.motionGovernor.isPaused());+ }++ function storyAutomaticPlaybackAllowed() {+ if (document.hidden || reducedMotion()) return false;+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) return !Archify.motionGovernor.isPaused();+ return true;+ }++ function clearStoryPulse(options) {+ options = options || {};+ storyPulseGeneration += 1;+ Array.prototype.forEach.call(svg.querySelectorAll('.story-trail-flow[data-story-pulse]'), function (flow) {+ flow.removeAttribute('data-story-pulse');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-carrier-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (storyPulseOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = storyPulseOwnerToken;+ storyPulseOwnerToken = 0;+ Archify.motionGovernor.release(token);+ } else if (options.release === false) storyPulseOwnerToken = 0;+ }++ function pulseStoryStep(step) {+ clearStoryPulse();+ if (!step || (step.relation !== 'forward' && step.relation !== 'reverse') || step.edges.length !== 1 || !storyMotionAllowed()) return false;+ var flows = Array.prototype.slice.call(svg.querySelectorAll('.story-trail-flow[data-story-beat-step="' + step.index + '"]'));+ if (!flows.length) return false;+ var pulseGeneration = storyPulseGeneration;+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ storyPulseOwnerToken = Archify.motionGovernor.claim('story', function () {+ clearStoryPulse({ release: false });+ });+ }+ flows.forEach(function (flow) { flow.setAttribute('data-story-pulse', 'true'); });+ if (Archify.flowTokens && typeof Archify.flowTokens.create === 'function') {+ var edge = step.edges[0];+ var shapes = storyGeometry(edge);+ var carrier = shapes.length ? Archify.flowTokens.create(edge, shapes[0], {+ className: 'story-flow-token',+ duration: '0.78s'+ }) : null;+ if (carrier) {+ var carrierOverlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ var carrierWrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ carrierOverlay.setAttribute('class', 'story-carrier-overlay');+ carrierOverlay.setAttribute('data-story-carrier-overlay', '');+ carrierOverlay.setAttribute('aria-hidden', 'true');+ if (edge.hasAttribute('transform')) carrierWrapper.setAttribute('transform', edge.getAttribute('transform'));+ carrier.setAttribute('data-story-carrier-token', '');+ carrier.setAttribute('data-story-beat-step', String(step.index));+ carrierWrapper.appendChild(carrier);+ carrierOverlay.appendChild(carrierWrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ while (firstNode && firstNode.parentNode !== svg) firstNode = firstNode.parentNode;+ if (firstNode) svg.insertBefore(carrierOverlay, firstNode);+ else svg.appendChild(carrierOverlay);+ }+ }+ void flows[0].getBoundingClientRect();+ flows[0].addEventListener('animationend', function () {+ if (pulseGeneration === storyPulseGeneration) clearStoryPulse();+ }, { once: true });+ return true;+ }++ function stopStoryBeatTimer(options) {+ options = options || {};+ storyPlaybackGeneration += 1;+ if (storyBeatTimer && options.preserveElapsed === true && storyBeatStartedAt) {+ storyBeatElapsedMs = Math.min(storyBeatDwellMs, storyBeatElapsedMs + Math.max(0, Date.now() - storyBeatStartedAt));+ }+ if (storyBeatTimer) clearTimeout(storyBeatTimer);+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ }++ function centerStoryStop(stop) {+ if (!stop || !trail) return false;+ var target = Math.max(0, stop.offsetLeft - (trail.clientWidth - stop.offsetWidth) / 2);+ trail.scrollLeft = target;+ return true;+ }++ function storyBeatDwell(total) {+ return Math.max(STORY_FOLLOW_MIN_DWELL_MS, VIEW_INTERVAL_MS / Math.max(1, total));+ }++ function clearStoryFollow() {+ storyFollowGeneration += 1;+ svg.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow');+ panel.removeAttribute('data-story-follow-node');+ }++ function storyFrameIds(step) {+ if (!step) return [];+ var ids = [];+ if (step.index > 0 && storySteps[step.index - 1]) ids.push(storySteps[step.index - 1].nodeId);+ ids.push(step.nodeId);+ if (step.index + 1 < storySteps.length) ids.push(storySteps[step.index + 1].nodeId);+ return ids;+ }++ function followStoryStep(step, options) {+ options = options || {};+ if (!step || document.hidden) return false;+ if (!Archify.view || typeof Archify.view.reveal !== 'function') {+ var deferredIndex = step.index;+ var deferredGeneration = ++storyFollowGeneration;+ requestAnimationFrame(function () {+ if (deferredGeneration !== storyFollowGeneration || storyBeatIndex !== deferredIndex) return;+ if (Archify.view && typeof Archify.view.reveal === 'function') followStoryStep(step, options);+ });+ return true;+ }+ if (window.matchMedia && window.matchMedia('print').matches) return false;+ var embed = document.documentElement.getAttribute('data-embed') === 'true';+ var explicitEmbedPlayback = document.documentElement.getAttribute('data-share-playback') === 'true';+ if (embed && !explicitEmbedPlayback && options.linked !== true) return false;+ var ids = storyFrameIds(step);+ var generation = ++storyFollowGeneration;+ svg.setAttribute('data-story-follow', step.nodeId);+ panel.setAttribute('data-story-follow', 'moving');+ panel.setAttribute('data-story-follow-node', step.nodeId);+ var receipt = Archify.view.reveal(ids, {+ reason: options.manual === true ? 'story-beat' : 'story-follow',+ padding: 64,+ maxScale: 1.65,+ duration: STORY_FOLLOW_DURATION_MS,+ instant: options.instant === true || reducedMotion() || document.documentElement.getAttribute('data-motion') !== 'live'+ });+ if (receipt && receipt.finished && typeof receipt.finished.then === 'function') {+ receipt.finished.then(function (result) {+ if (generation !== storyFollowGeneration || storyBeatIndex !== step.index) return;+ svg.removeAttribute('data-story-follow');+ panel.setAttribute('data-story-follow', result && result.state === 'complete' ? 'settled' : 'interrupted');+ });+ } else if (generation === storyFollowGeneration) {+ panel.setAttribute('data-story-follow', 'settled');+ }+ return receipt;+ }++ function setStoryBeat(index, options) {+ options = options || {};+ var stops = Array.prototype.slice.call(trail.querySelectorAll('[data-story-node]'));+ if (!stops.length) return false;+ resetBeatLinkFeedback();+ storyBeatIndex = Math.max(0, Math.min(stops.length - 1, index));+ var nextStep = storyBeatIndex + 1 < storySteps.length ? storySteps[storyBeatIndex + 1] : null;+ svg.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ panel.setAttribute('data-story-beat', (storyBeatIndex + 1) + '/' + stops.length);+ if (nextStep) {+ svg.setAttribute('data-story-next', nextStep.nodeId);+ panel.setAttribute('data-story-next', nextStep.nodeId);+ } else {+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-next');+ }+ function storyBeatState(step) {+ if (step < storyBeatIndex) return 'past';+ if (step === storyBeatIndex) return 'active';+ if (step === storyBeatIndex + 1) return 'next';+ return 'pending';+ }+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step]'), function (node) {+ var step = Number(node.getAttribute('data-story-step'));+ node.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-step]'), function (edge) {+ var step = Number(edge.getAttribute('data-story-beat-step'));+ edge.setAttribute('data-story-beat-state', storyBeatState(step));+ });+ stops.forEach(function (stop, step) {+ stop.setAttribute('data-story-beat-state', storyBeatState(step));+ if (step === storyBeatIndex) stop.setAttribute('aria-current', 'step');+ else stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'off');+ note.textContent = storyBeatCopy(storySteps[storyBeatIndex], stops.length);+ renderStoryCaption(storySteps[storyBeatIndex], stops.length, nextStep);+ if (options.center === true) centerStoryStop(stops[storyBeatIndex]);+ if (options.pulse === true) pulseStoryStep(storySteps[storyBeatIndex]);+ else clearStoryPulse();+ if (options.follow === true) followStoryStep(storySteps[storyBeatIndex], {+ manual: options.manual === true,+ linked: options.linked === true,+ instant: options.followInstant === true+ });+ renderShareCue();+ syncBeatLink();+ return true;+ }++ function settleStoryBeats() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-beat-state]'), function (el) {+ el.removeAttribute('data-story-beat-state');+ });+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-beat-state]'), function (stop) {+ stop.removeAttribute('data-story-beat-state');+ stop.removeAttribute('aria-current');+ });+ note.setAttribute('aria-live', 'polite');+ if (activeIndex >= 0) note.textContent = views[activeIndex].note || viewerText('viewer.guided.chapter.selectedNodes', { count: views[activeIndex].focus.length });+ renderStoryCaption(null, 0);+ renderShareCue();+ syncBeatLink();+ }++ function clearStoryTrail() {+ stopStoryBeatTimer();+ clearStoryPulse();+ clearStoryFollow();+ resetBeatLinkFeedback();+ storyBeatIndex = -1;+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = 0;+ storySteps = [];+ svg.removeAttribute('data-story-active');+ svg.removeAttribute('data-story-playing');+ svg.removeAttribute('data-story-beat');+ svg.removeAttribute('data-story-next');+ panel.removeAttribute('data-story-beat');+ panel.removeAttribute('data-story-next');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-overlay]'), function (overlay) {+ overlay.remove();+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-story-step], [data-story-beat-state]'), function (node) {+ node.removeAttribute('data-story-step');+ node.removeAttribute('data-story-beat-state');+ node.style.removeProperty('--story-step');+ });+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-story-beat-step]'), function (edge) {+ edge.removeAttribute('data-story-beat-step');+ edge.removeAttribute('data-story-beat-state');+ });+ trail.textContent = '';+ trail.hidden = true;+ trail.removeAttribute('aria-label');+ renderStoryCaption(null, 0);+ syncBeatLink();+ }++ function storyGeometry(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }++ function renderStoryTrail(view) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ clearStoryTrail();+ if (!view) return;++ var nodeList = Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ var edgeList = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ var byId = {};+ nodeList.forEach(function (node) { byId[node.getAttribute('data-node-id')] = node; });+ storySteps = view.focus.map(function (_, index) { return storyStep(view, index, edgeList, byId); });+ var labels = [];+ storySteps.forEach(function (step, index) {+ var id = step.nodeId;+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-story-step', String(index));+ node.style.setProperty('--story-step', String(index));+ var nodeLabel = step.nodeLabel;+ labels.push(nodeLabel);+ var stop = document.createElement('button');+ stop.type = 'button';+ stop.className = 'guided-view-stop';+ stop.setAttribute('data-story-node', id);+ stop.setAttribute('data-story-index', String(index));+ stop.setAttribute('data-story-relation', step.relation);+ stop.setAttribute('data-story-number', (index + 1 < 10 ? '0' : '') + (index + 1));+ if (index > 0) stop.setAttribute('data-story-link', step.relation);+ stop.style.setProperty('--story-step', String(index));+ stop.setAttribute('aria-label', storyBeatAria(step, storySteps.length));+ stop.title = storyBeatCopy(step, storySteps.length);+ stop.textContent = nodeLabel;+ trail.appendChild(stop);+ });+ trail.hidden = labels.length === 0;+ trail.setAttribute('aria-label', viewerText('viewer.guided.storyTrail', { label: view.label, count: labels.length }));+ trail.scrollLeft = 0;+ svg.setAttribute('data-story-active', view.id);++ var overlay = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ overlay.setAttribute('class', 'story-trail-overlay');+ overlay.setAttribute('data-story-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var copied = 0;+ storySteps.forEach(function (step) {+ step.edges.forEach(function (edge) {+ var edgeBeat = step.index;+ edge.setAttribute('data-story-beat-step', String(edgeBeat));+ var wrapper = document.createElementNS('http://www.w3.org/2000/svg', 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ storyGeometry(edge).forEach(function (shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('role');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.setAttribute('class', 'story-trail-flow');+ clone.setAttribute('data-story-beat-step', String(edgeBeat));+ clone.style.setProperty('--story-step', String(edgeBeat));+ wrapper.appendChild(clone);+ copied += 1;+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ });+ if (copied) {+ var firstEdge = edgeList[0];+ if (firstEdge && firstEdge.parentNode) firstEdge.parentNode.insertBefore(overlay, firstEdge);+ else svg.insertBefore(overlay, svg.firstChild);+ }+ }++ function syncStoryPlayback() {+ var shouldPlay = playing && activeIndex >= 0;+ if (shouldPlay && svg.getAttribute('data-story-playing') !== 'true') svg.setAttribute('data-story-playing', 'true');+ else if (!shouldPlay && svg.hasAttribute('data-story-playing')) svg.removeAttribute('data-story-playing');+ }++ function resetProgress(fraction) {+ fraction = Math.max(0, Math.min(1, Number(fraction) || 0));+ progressBar.style.animation = 'none';+ progressBar.style.setProperty('--guided-progress-start', String(fraction));+ progressBar.style.transform = 'scaleX(' + fraction + ')';+ }++ function startProgress(fraction, duration) {+ resetProgress(fraction);+ void progressBar.offsetWidth;+ progressBar.style.animation = 'archify-guided-progress ' + Math.max(1, duration || VIEW_INTERVAL_MS) + 'ms linear forwards';+ }++ function currentStoryProgress() {+ var total = storySteps.length;+ if (!total || storyBeatIndex < 0) return 0;+ var elapsed = storyBeatElapsedMs;+ if (playing && storyBeatTimer && storyBeatStartedAt) elapsed += Math.max(0, Date.now() - storyBeatStartedAt);+ var dwell = storyBeatDwellMs || storyBeatDwell(total);+ return Math.max(0, Math.min(1, (storyBeatIndex + Math.min(1, elapsed / dwell)) / total));+ }++ function renderPlayback() {+ var automaticPlaybackAllowed = storyAutomaticPlaybackAllowed();+ panel.setAttribute('data-playing', playing ? 'true' : 'false');+ syncStoryPlayback();+ play.disabled = !playing && !automaticPlaybackAllowed;+ play.setAttribute('aria-pressed', playing ? 'true' : 'false');+ play.setAttribute('aria-label', viewerText(playing+ ? 'viewer.guided.pause'+ : !automaticPlaybackAllowed+ ? 'viewer.guided.motionUnavailable'+ : storyPlaybackComplete+ ? 'viewer.guided.replay'+ : 'viewer.guided.play'));+ play.title = viewerText(playing+ ? 'viewer.guided.pause.title'+ : !automaticPlaybackAllowed+ ? 'viewer.guided.enableMotion'+ : storyPlaybackComplete+ ? 'viewer.guided.replay.title'+ : 'viewer.guided.play.title');+ playIcon.textContent = playing ? '\u2016' : '\u25b6';+ playLabel.textContent = viewerText(playing+ ? 'viewer.guided.pauseStory'+ : storyPlaybackComplete+ ? 'viewer.guided.replayStory'+ : 'viewer.guided.playStory');+ if (storyCaption && !storyCaption.hidden) storyCaption.setAttribute('aria-live', playing ? 'off' : 'polite');+ }++ function render() {+ var view = views[activeIndex];+ count.textContent = activeIndex < 0 ? '0 / ' + views.length : (activeIndex + 1) + ' / ' + views.length;+ label.textContent = view ? view.label : viewerText('viewer.guided.explore');+ note.setAttribute('aria-live', storyBeatIndex >= 0 ? 'off' : 'polite');+ note.textContent = storyBeatIndex >= 0+ ? storyBeatCopy(storySteps[storyBeatIndex], storySteps.length)+ : (view+ ? (view.note || viewerText('viewer.guided.chapter.selectedNodes', { count: view.focus.length }))+ : viewerText('viewer.guided.intro'));+ prev.disabled = activeIndex < 0;+ next.disabled = activeIndex >= views.length - 1;+ all.disabled = activeIndex < 0;+ panel.setAttribute('data-active-view', view ? view.id : 'all');+ syncChapterIndex();+ renderShareCue();+ renderPlayback();+ syncBeatLink();+ }++ function pausePlayback(options) {+ options = options || {};+ var progress = options.complete === true ? 1 : currentStoryProgress();+ if (panel.getAttribute('data-autoplay') === 'playing') {+ setShareCueProgress(progress);+ setAutoplayState(options.complete === true ? 'complete' : 'interrupted');+ }+ stopStoryBeatTimer({ preserveElapsed: options.complete !== true });+ clearStoryPulse();+ clearStoryFollow();+ playing = false;+ storyPlaybackComplete = options.complete === true;+ resetProgress(progress);+ renderPlayback();+ renderShareCue();+ }++ function finishStoryChapter() {+ if (!playing) return false;+ if (storyPlaybackScope === 'chapter') {+ pausePlayback({ complete: true });+ return true;+ }+ if (activeIndex < views.length - 1) {+ var destinationIndex = activeIndex + 1;+ activate(destinationIndex, { playback: true });+ afterHandoff(function () {+ if (!playing || activeIndex !== destinationIndex) return;+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ scheduleStoryPlayback();+ });+ return true;+ }+ pausePlayback({ complete: true });+ return true;+ }++ function scheduleStoryPlayback() {+ var total = storySteps.length;+ if (!playing || !total || reducedMotion()) {+ if (playing) pausePlayback();+ return false;+ }+ storyBeatDwellMs = storyBeatDwell(total);+ if (storyBeatIndex < 0) {+ storyBeatElapsedMs = 0;+ setStoryBeat(0, { pulse: true, follow: true });+ }+ storyBeatElapsedMs = Math.max(0, Math.min(storyBeatDwellMs, storyBeatElapsedMs));+ var remainingDwell = Math.max(1, storyBeatDwellMs - storyBeatElapsedMs);+ var progress = (storyBeatIndex + storyBeatElapsedMs / storyBeatDwellMs) / total;+ var remainingChapter = remainingDwell + Math.max(0, total - storyBeatIndex - 1) * storyBeatDwellMs;+ startProgress(progress, remainingChapter);+ if (panel.getAttribute('data-autoplay') === 'playing') startShareCueProgress(progress, remainingChapter);+ var generation = ++storyPlaybackGeneration;+ storyBeatStartedAt = Date.now();+ storyBeatTimer = setTimeout(function () {+ if (!playing || generation !== storyPlaybackGeneration) return;+ storyBeatTimer = null;+ storyBeatStartedAt = 0;+ storyBeatElapsedMs = 0;+ if (storyBeatIndex < total - 1) {+ setStoryBeat(storyBeatIndex + 1, { pulse: true, follow: true });+ scheduleStoryPlayback();+ } else finishStoryChapter();+ }, remainingDwell);+ return true;+ }++ function startPlayback() {+ if (!storyAutomaticPlaybackAllowed()) {+ renderPlayback();+ return false;+ }+ autoplayPending = false;+ setAutoplayState(null);+ setShareCueProgress(0);+ document.documentElement.removeAttribute('data-share-playback');+ storyPlaybackScope = 'story';+ if (storyPlaybackComplete) showAll({ updateUrl: false });+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true });+ playing = true;+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }++ function startCurrentViewPlayback() {+ if (document.hidden) return false;+ autoplayPending = false;+ document.documentElement.setAttribute('data-share-playback', 'true');+ storyPlaybackScope = 'chapter';+ storyPlaybackComplete = false;+ if (activeIndex < 0) activate(0, { playback: true, updateUrl: false });+ if (!storyAutomaticPlaybackAllowed()) {+ var preserveMoment = hashBeatMatchesCurrent();+ setShareCueProgress(preserveMoment && storySteps.length ? (storyBeatIndex + 1) / storySteps.length : 1);+ setAutoplayState('reduced-motion');+ playing = false;+ if (preserveMoment) {+ clearStoryPulse();+ renderShareCue();+ } else settleStoryBeats();+ renderPlayback();+ return false;+ }+ playing = true;+ setAutoplayState('playing');+ renderPlayback();+ afterHandoff(function () {+ if (!playing) return;+ if (storyBeatIndex >= 0) followStoryStep(storySteps[storyBeatIndex]);+ scheduleStoryPlayback();+ });+ return true;+ }++ function maybeStartSharePlayback() {+ if (!autoplayPending || document.hidden) return false;+ return startCurrentViewPlayback();+ }++ function togglePlayback() {+ return playing ? (pausePlayback(), false) : startPlayback();+ }++ function syncStoryControlsDisabled() {+ Array.prototype.forEach.call(trail.querySelectorAll('[data-story-node]'), function (stop) {+ stop.disabled = !!currentHandoff;+ });+ syncBeatLink();+ }++ function selectStoryBeat(index) {+ if (currentHandoff || activeIndex < 0 || index < 0 || index >= storySteps.length) return false;+ momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ var view = views[activeIndex];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ setStoryBeat(index, { manual: true, center: true, pulse: true, follow: true });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }++ function selectStoryBeatById(id, options) {+ options = options || {};+ var index = storySteps.findIndex(function (step) { return step.nodeId === id; });+ if (index < 0) return false;+ if (playing) pausePlayback();+ else {+ stopStoryBeatTimer();+ clearStoryPulse();+ }+ storyPlaybackComplete = false;+ storyPlaybackScope = 'story';+ storyBeatElapsedMs = 0;+ storyBeatDwellMs = storyBeatDwell(storySteps.length);+ setStoryBeat(index, {+ manual: false,+ center: true,+ pulse: false,+ follow: options.follow === true,+ linked: options.linked === true,+ followInstant: options.followInstant === true+ });+ resetProgress(index / storySteps.length);+ renderPlayback();+ return true;+ }++ function updateUrl(view) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (view ? '#view=' + encodeURIComponent(view.id) : ''));+ } catch (_) {}+ }++ function showAll(options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ clearChapterPreview({ clearIntents: true });+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ cancelHandoff('overview');+ activeIndex = -1;+ renderStoryTrail(null);+ if (options.clearFocus !== false) Archify.focus.clear({ updateUrl: false });+ if (options.resetView !== false && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ render();+ if (options.updateUrl !== false) updateUrl(null);+ }++ function activate(index, options) {+ options = options || {};+ if (options.restore !== true) momentRestoreGeneration += 1;+ if (playing && options.playback !== true) pausePlayback();+ if (options.playback !== true) storyPlaybackComplete = false;+ if (index < 0) { showAll(options); return true; }+ if (index >= views.length) return false;+ clearChapterPreview({ clearIntents: true });+ var previousIndex = activeIndex;+ var previous = previousIndex >= 0 ? views[previousIndex] : null;+ var outgoingBeatIndex = storyBeatIndex;+ cancelHandoff('replaced');+ activeIndex = index;+ var view = views[index];+ Archify.focus.setMany(view.focus, {+ toggle: false,+ updateUrl: false,+ mode: 'selection',+ label: view.label,+ hideChip: true+ });+ renderStoryTrail(view);+ beginHandoff(previousIndex, index, previous, view, outgoingBeatIndex, options.playback === true ? 'playback' : 'guided');+ syncStoryControlsDisabled();+ render();+ if (options.updateUrl !== false) updateUrl(view);+ return true;+ }++ function activateById(id, options) {+ var index = views.findIndex(function (view) { return view.id === id; });+ return index >= 0 && activate(index, options);+ }++ prev.addEventListener('click', function () { activate(activeIndex - 1); });+ next.addEventListener('click', function () { activate(activeIndex + 1); });+ all.addEventListener('click', function () { showAll(); });+ play.addEventListener('click', togglePlayback);+ beatLink.addEventListener('click', copyStoryMomentLink);+ trail.addEventListener('focusin', function (event) {+ if (!event.target.closest('[data-story-node]')) return;+ if (playing) pausePlayback();+ });+ trail.addEventListener('click', function (event) {+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ trail.addEventListener('keydown', function (event) {+ if (event.key !== 'Enter' && event.key !== ' ') return;+ var stop = event.target.closest('[data-story-node]');+ if (!stop || stop.disabled) return;+ event.preventDefault();+ selectStoryBeat(Number(stop.getAttribute('data-story-index')));+ });+ chapterList.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ activateById(button.getAttribute('data-guided-view-id'));+ });+ chapterList.addEventListener('pointerover', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || !hoverCapable() || event.pointerType === 'touch') return;+ if (event.relatedTarget && button.contains(event.relatedTarget)) return;+ setChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('pointerout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('pointer', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusin', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button) return;+ setChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterIndex.addEventListener('focusout', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ if (!button || (event.relatedTarget && button.contains(event.relatedTarget))) return;+ clearChapterPreviewIntent('focus', chapterButtons.indexOf(button));+ });+ chapterList.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-guided-view-id]');+ var index = chapterButtons.indexOf(button);+ if (index < 0) return;+ var target = null;+ if (event.key === 'ArrowRight') target = Math.min(chapterButtons.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') target = Math.max(0, index - 1);+ else if (event.key === 'Home') target = 0;+ else if (event.key === 'End') target = chapterButtons.length - 1;+ if (target === null) return;+ event.preventDefault();+ focusChapterButton(target);+ });++ // A direct node exploration supersedes the curated view. Capture phase+ // releases the view before the focus explorer writes its own deep link.+ function releaseForNode(event) {+ if (activeIndex >= 0 && event.target.closest('[data-node-id]')) {+ pausePlayback();+ showAll({ clearFocus: false, updateUrl: false });+ }+ }+ svg.addEventListener('click', releaseForNode, true);+ svg.addEventListener('keydown', function (event) {+ if (event.key === 'Enter' || event.key === ' ') releaseForNode(event);+ }, true);++ document.addEventListener('keydown', function (event) {+ if (event.metaKey || event.ctrlKey || event.altKey) return;+ if (document.documentElement.getAttribute('data-guide-open') === 'true') return;+ var target = event.target;+ if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable)) return;+ if (event.key === ']') {+ event.preventDefault();+ if (activeIndex < views.length - 1) activate(activeIndex + 1);+ } else if (event.key === '[') {+ event.preventDefault();+ if (activeIndex >= 0) activate(activeIndex - 1);+ } else if (event.key.toLowerCase() === 'p') {+ event.preventDefault();+ togglePlayback();+ } else if (event.key === 'Escape' && activePreviewIndex >= 0) {+ event.preventDefault();+ event.stopImmediatePropagation();+ clearChapterPreview({ clearIntents: true });+ } else if (event.key === 'Escape' && activeIndex >= 0) {+ event.preventDefault();+ showAll();+ }+ }, true);++ function syncViewFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var initial = params.get('view');+ var requestedBeat = params.get('beat');+ var restoreGeneration = ++momentRestoreGeneration;+ if (initial) {+ var activated = activateById(initial, { updateUrl: false, restore: true });+ if (!activated) {+ showAll({ updateUrl: false, restore: true });+ return;+ }+ if (requestedBeat) afterHandoff(function () {+ if (restoreGeneration !== momentRestoreGeneration) return;+ var latest = new URLSearchParams(location.hash.replace(/^#/, ''));+ if (latest.get('view') !== initial || latest.get('beat') !== requestedBeat) return;+ if (activeIndex < 0 || views[activeIndex].id !== initial) return;+ selectStoryBeatById(requestedBeat, { linked: true, follow: true, followInstant: true });+ });+ } else if (params.get('focus') || params.get('relation')) {+ activeIndex = -1;+ render();+ } else {+ showAll({ updateUrl: false, restore: true });+ }+ } catch (_) { showAll({ updateUrl: false, restore: true }); }+ }++ window.addEventListener('hashchange', syncViewFromHash);+ document.addEventListener('visibilitychange', function () {+ if (document.hidden) {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('hidden');+ }+ else if (!document.hidden) maybeStartSharePlayback();+ });+ if (window.matchMedia) {+ var guidedMotionQuery = window.matchMedia('(prefers-reduced-motion: reduce)');+ var onGuidedMotionChange = function () {+ if (guidedMotionQuery.matches) {+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('reduced-motion');+ }+ };+ if (typeof guidedMotionQuery.addEventListener === 'function') guidedMotionQuery.addEventListener('change', onGuidedMotionChange);+ else if (typeof guidedMotionQuery.addListener === 'function') guidedMotionQuery.addListener(onGuidedMotionChange);+ }+ if (document.documentElement.getAttribute('data-embed') !== 'true' && typeof MutationObserver !== 'undefined' && typeof Node !== 'undefined' && svg instanceof Node && document.documentElement instanceof Node) {+ var chapterPreviewOwnerObserver = new MutationObserver(syncChapterPreview);+ chapterPreviewOwnerObserver.observe(svg, {+ attributes: true,+ attributeFilter: [+ 'data-route-picking', 'data-route-active', 'data-lens-active',+ 'data-legend-preview-active', 'data-relationship-preview-active',+ 'data-intent-trace-active', 'data-focus-active'+ ]+ });+ var storyMotionObserver = new MutationObserver(function () {+ if (document.documentElement.getAttribute('data-motion') !== 'live') clearStoryPulse();+ renderPlayback();+ });+ storyMotionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-motion'] });+ }+ window.addEventListener('beforeprint', function () {+ clearChapterPreview({ clearIntents: true });+ if (playing) pausePlayback();+ else clearStoryPulse();+ settleHandoff('print');+ });+ syncViewFromHash();+ if (autoplayPending) {+ requestAnimationFrame(function () {+ requestAnimationFrame(maybeStartSharePlayback);+ });+ }++ return {+ count: views.length,+ activate: activateById,+ showAll: showAll,+ play: startPlayback,+ playCurrent: startCurrentViewPlayback,+ pause: pausePlayback,+ beatLink: storyMomentLink,+ copyBeatLink: copyStoryMomentLink,+ cancelHandoff: cancelHandoff,+ settleHandoff: settleHandoff,+ clearPreview: function () { return clearChapterPreview({ clearIntents: true }); },+ isPlaying: function () { return playing; },+ handoff: function () {+ return currentHandoff ? { id: currentHandoff.id, mode: currentHandoff.mode, anchor: currentHandoff.anchor || null } : null;+ },+ active: function () { return activeIndex < 0 ? null : views[activeIndex].id; },+ preview: function () { return activePreviewIndex < 0 ? null : views[activePreviewIndex].id; },+ delta: function (id) {+ var index = views.findIndex(function (view) { return view.id === id; });+ if (index < 0) return null;+ var value = chapterDelta(activeIndex >= 0 ? views[activeIndex] : null, views[index]);+ return { stay: value.stay.slice(), enter: value.enter.slice(), leave: value.leave.slice() };+ },+ beat: function () {+ var step = storyBeatIndex >= 0 ? storySteps[storyBeatIndex] : null;+ return step ? {+ index: step.index,+ position: step.index + 1,+ total: storySteps.length,+ nodeId: step.nodeId,+ relation: step.relation,+ edgeKeys: step.edgeKeys.slice()+ } : null;+ },+ focus: function () { return activeIndex < 0 ? [] : views[activeIndex].focus.slice(); }+ };+ })();++ /* ============================================================+ Adaptive Reader Shell — one diagram across laptop and monitor.+ The canonical SVG and viewBox never change. On ordinary desktop pages,+ wide diagrams receive only enough outer width to use the available+ height without pushing summary cards below the viewport. Mobile,+ embed, presentation, print, and non-wide diagrams retain their own+ established layout contracts.+ ============================================================ */+ Archify.waitForStableLayout = function (options) {+ options = options || {};+ var maximumFrames = Math.max(1, Number(options.maximumFrames) || 240);+ var fontsReady = document.fonts && document.fonts.ready+ ? document.fonts.ready.catch(function () {})+ : Promise.resolve();+ return fontsReady.then(function () {+ if (typeof options.schedule === 'function') options.schedule();+ return new Promise(function (resolve, reject) {+ var previous = '';+ var stableFrames = 0;+ var sampledFrames = 0;+ function sample() {+ sampledFrames += 1;+ if (typeof options.pending === 'function' && options.pending()) {+ previous = '';+ stableFrames = 0;+ } else {+ var current = typeof options.snapshot === 'function' ? options.snapshot() : '';+ if (current === previous) stableFrames += 1;+ else {+ previous = current;+ stableFrames = 0;+ }+ if (stableFrames >= 3) {+ resolve({ stable: true, snapshot: current, sampledFrames: sampledFrames });+ return;+ }+ }+ if (sampledFrames >= maximumFrames) {+ reject(new Error(options.timeoutMessage || 'Layout did not reach stable dimensions.'));+ return;+ }+ requestAnimationFrame(sample);+ }+ requestAnimationFrame(sample);+ });+ });+ };++ Archify.readerLayout = (function () {+ var html = document.documentElement;+ var body = document.body;+ var shell = document.querySelector('.container');+ var diagram = document.querySelector('.diagram-container');+ var svg = diagram && diagram.querySelector(':scope > svg');+ var header = shell && shell.querySelector('.header');+ var guided = shell && shell.querySelector('.guided-views');+ var cards = shell && shell.querySelector('.cards');+ var viewBox = svg && svg.viewBox && svg.viewBox.baseVal;+ var ratio = viewBox && viewBox.height > 0 ? viewBox.width / viewBox.height : 0;+ var frame = 0;+ var settleFrame = 0;+ var lastWidth = 0;+ var WIDE_RATIO = 1.55;+ var MIN_DESKTOP_WIDTH = 1024;+ var MIN_READER_WIDTH = 960;+ var MAX_READER_WIDTH = 1920;+ var SAFE_BOTTOM_GAP = 12;++ if (diagram && ratio >= WIDE_RATIO) {+ diagram.setAttribute('data-wide-diagram', 'true');+ html.setAttribute('data-diagram-shape', 'wide');+ }++ function number(value) {+ var parsed = parseFloat(value);+ return Number.isFinite(parsed) ? parsed : 0;+ }+ function visible(element) {+ return Boolean(element && !element.hidden && window.getComputedStyle(element).display !== 'none');+ }+ function outerHeight(element) {+ if (!visible(element)) return 0;+ var style = window.getComputedStyle(element);+ return element.getBoundingClientRect().height + number(style.marginTop) + number(style.marginBottom);+ }+ function eligible() {+ return Boolean(+ shell && diagram && svg && ratio >= WIDE_RATIO &&+ window.innerWidth >= MIN_DESKTOP_WIDTH &&+ html.getAttribute('data-embed') !== 'true' &&+ html.getAttribute('data-present') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches)+ );+ }+ function clear() {+ html.style.removeProperty('--archify-reader-width');+ html.removeAttribute('data-reader-layout');+ html.removeAttribute('data-reader-overflow');+ lastWidth = 0;+ }+ function chromeMetrics() {+ var bodyStyle = window.getComputedStyle(body);+ var diagramStyle = window.getComputedStyle(diagram);+ return {+ bodyX: number(bodyStyle.paddingLeft) + number(bodyStyle.paddingRight),+ bodyY: number(bodyStyle.paddingTop) + number(bodyStyle.paddingBottom),+ diagramX: number(diagramStyle.paddingLeft) + number(diagramStyle.paddingRight) ++ number(diagramStyle.borderLeftWidth) + number(diagramStyle.borderRightWidth),+ diagramY: number(diagramStyle.paddingTop) + number(diagramStyle.paddingBottom) ++ number(diagramStyle.borderTopWidth) + number(diagramStyle.borderBottomWidth)+ };+ }+ function applyWidth(width) {+ var rounded = Math.round(width);+ if (Math.abs(rounded - lastWidth) < 1) return false;+ lastWidth = rounded;+ html.style.setProperty('--archify-reader-width', rounded + 'px');+ html.setAttribute('data-reader-layout', 'adaptive');+ return true;+ }+ function settleOverflow(minWidth) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ if (!eligible() || !lastWidth) return;+ var overflow = Math.max(+ document.documentElement.scrollHeight,+ document.body.scrollHeight+ ) - window.innerHeight;+ if (overflow > 1 && lastWidth > minWidth) {+ applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4));+ html.setAttribute('data-reader-overflow', 'reduced');+ } else if (overflow > 1) {+ html.setAttribute('data-reader-overflow', 'authored');+ } else {+ html.removeAttribute('data-reader-overflow');+ }+ });+ }+ function measure() {+ frame = 0;+ if (!eligible()) {+ clear();+ return null;+ }+ var chrome = chromeMetrics();+ var viewportCap = Math.max(0, window.innerWidth - chrome.bodyX);+ var minWidth = Math.min(MIN_READER_WIDTH, viewportCap);+ var maxWidth = Math.min(MAX_READER_WIDTH, viewportCap);+ var fixedHeight = chrome.bodyY + chrome.diagramY + SAFE_BOTTOM_GAP ++ outerHeight(header) + outerHeight(guided) + outerHeight(cards);+ var availableSvgHeight = Math.max(1, window.innerHeight - fixedHeight);+ var desiredWidth = availableSvgHeight * ratio + chrome.diagramX;+ var width = Math.max(minWidth, Math.min(maxWidth, desiredWidth));+ applyWidth(width);+ settleOverflow(minWidth);+ return {+ ratio: ratio,+ width: Math.round(width),+ availableSvgHeight: Math.round(availableSvgHeight),+ fixedHeight: Math.round(fixedHeight)+ };+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }+ function stableSnapshot() {+ var shellRect = shell ? shell.getBoundingClientRect() : { width: 0, height: 0 };+ var diagramRect = diagram ? diagram.getBoundingClientRect() : { width: 0, height: 0 };+ return [+ lastWidth,+ html.getAttribute('data-reader-layout') || '',+ html.getAttribute('data-reader-overflow') || '',+ Math.ceil(document.documentElement.scrollWidth),+ Math.ceil(document.documentElement.scrollHeight),+ Math.ceil(document.body.scrollWidth),+ Math.ceil(document.body.scrollHeight),+ Math.round(shellRect.width * 100) / 100,+ Math.round(shellRect.height * 100) / 100,+ Math.round(diagramRect.width * 100) / 100,+ Math.round(diagramRect.height * 100) / 100+ ].join('|');+ }+ function whenStable() {+ return Archify.waitForStableLayout({+ schedule: schedule,+ pending: function () { return Boolean(frame || settleFrame); },+ snapshot: stableSnapshot,+ timeoutMessage: 'Adaptive reader layout did not reach stable dimensions.'+ });+ }++ window.addEventListener('resize', schedule, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [header, guided, cards].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(schedule);+ if (guided) contentObserver.observe(guided, { attributes: true, childList: true, subtree: true });+ if (cards) contentObserver.observe(cards, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, { attributes: true, attributeFilter: ['data-embed', 'data-present'] });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ whenStable: whenStable,+ active: function () { return html.getAttribute('data-reader-layout') === 'adaptive'; },+ receipt: function () { return { ratio: ratio, width: lastWidth }; }+ };+ })();++ /* ============================================================+ Viewer Chrome Layout — keep HTML controls clear of the canonical SVG+ legend without changing authored geometry. The dock keeps its existing+ position unless its zero-reserve position would cover the legend; only+ then does a small bottom safe rail become part of the reader budget.+ ============================================================ */+ Archify.viewerChromeLayout = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container && container.querySelector(':scope > svg');+ var nav = container && container.querySelector('.diagram-nav');+ var legend = svg && svg.querySelector('[data-legend]');+ var frame = 0;+ var settleFrame = 0;+ var reserve = 0;+ var collisionLatched = false;+ var probingBaseline = false;+ var probePromise = null;+ var baselineIntersectionArea = 0;+ var lastReceipt = null;+ var SAFE_GAP = 10;++ function visible(element) {+ if (!element || element.hidden) return false;+ var style = window.getComputedStyle(element);+ return style.display !== 'none' && style.visibility !== 'hidden';+ }+ function usable(rect) {+ return Boolean(rect && rect.width > 0 && rect.height > 0);+ }+ function intersectionArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function eligible() {+ return Boolean(+ container && svg && nav && legend &&+ window.innerWidth > 720 &&+ html.getAttribute('data-embed') !== 'true' &&+ (!window.matchMedia || !window.matchMedia('print').matches) &&+ visible(nav) && visible(legend)+ );+ }+ function writeReserve(next, options) {+ options = options || {};+ next = Math.max(0, Math.ceil(next));+ if (Math.abs(next - reserve) < 1) return false;+ reserve = next;+ if (reserve) {+ container.style.setProperty('--archify-nav-reserve', reserve + 'px');+ container.setAttribute('data-nav-safe-rail', 'true');+ } else {+ container.style.removeProperty('--archify-nav-reserve');+ container.removeAttribute('data-nav-safe-rail');+ }+ if (Archify.readerLayout && typeof Archify.readerLayout.schedule === 'function') {+ Archify.readerLayout.schedule();+ }+ if (options.quiet !== true) {+ if (settleFrame) cancelAnimationFrame(settleFrame);+ settleFrame = requestAnimationFrame(function () {+ settleFrame = 0;+ schedule();+ });+ }+ return true;+ }+ function clear() {+ collisionLatched = false;+ baselineIntersectionArea = 0;+ writeReserve(0, { quiet: probingBaseline });+ lastReceipt = {+ eligible: false,+ active: false,+ reserve: 0,+ gap: SAFE_GAP,+ baselineIntersectionArea: 0,+ intersectionArea: 0+ };+ return lastReceipt;+ }+ function measure() {+ frame = 0;+ if (probingBaseline) return null;+ if (!eligible()) return clear();++ var navRect = nav.getBoundingClientRect();+ var legendRect = legend.getBoundingClientRect();+ var svgRect = svg.getBoundingClientRect();+ if (!usable(navRect) || !usable(legendRect) || !usable(svgRect)) return clear();++ var actualIntersectionArea = intersectionArea(navRect, legendRect);+ if (!collisionLatched && reserve === 0) {+ baselineIntersectionArea = actualIntersectionArea;+ if (actualIntersectionArea > 0) {+ collisionLatched = true;+ if (writeReserve(Math.max(0, svgRect.bottom + SAFE_GAP - navRect.top))) return null;+ }+ } else if (collisionLatched && reserve > 0 && actualIntersectionArea > 0) {+ /* Once zero-reserve geometry proves a collision, keep that decision+ latched while Adaptive Reader incorporates the rail. If the first+ rail is not quite tall enough (notably in Presentation flex+ layout), grow only by the remaining vertical overlap. */+ var remaining = Math.max(1, legendRect.bottom + SAFE_GAP - navRect.top);+ if (writeReserve(reserve + remaining)) return null;+ }++ navRect = nav.getBoundingClientRect();+ legendRect = legend.getBoundingClientRect();+ lastReceipt = {+ eligible: true,+ active: reserve > 0,+ reserve: reserve,+ gap: SAFE_GAP,+ baselineIntersectionArea: Math.round(baselineIntersectionArea * 100) / 100,+ intersectionArea: Math.round(intersectionArea(navRect, legendRect) * 100) / 100+ };+ return lastReceipt;+ }+ function reprobe() {+ if (probingBaseline) return probePromise || Promise.resolve(false);+ if (!reserve && !collisionLatched) {+ schedule();+ return Promise.resolve(false);+ }+ probingBaseline = true;+ collisionLatched = false;+ baselineIntersectionArea = 0;+ writeReserve(0, { quiet: true });+ var readerReady = Archify.readerLayout && typeof Archify.readerLayout.whenStable === 'function'+ ? Archify.readerLayout.whenStable().catch(function () {})+ : Promise.resolve();+ probePromise = readerReady.then(function () {+ probingBaseline = false;+ probePromise = null;+ schedule();+ return true;+ });+ return probePromise;+ }+ function schedule() {+ if (frame) return;+ frame = requestAnimationFrame(measure);+ }+ function stableSnapshot() {+ var containerRect = container ? container.getBoundingClientRect() : { width: 0, height: 0 };+ var navRect = nav ? nav.getBoundingClientRect() : { top: 0, left: 0 };+ var legendRect = legend ? legend.getBoundingClientRect() : { top: 0, left: 0 };+ return [+ reserve,+ Math.round(containerRect.width * 100) / 100,+ Math.round(containerRect.height * 100) / 100,+ Math.round(navRect.left * 100) / 100,+ Math.round(navRect.top * 100) / 100,+ Math.round(legendRect.left * 100) / 100,+ Math.round(legendRect.top * 100) / 100,+ collisionLatched ? 'latched' : 'clear',+ lastReceipt ? lastReceipt.intersectionArea : ''+ ].join('|');+ }+ function whenStable() {+ return Archify.waitForStableLayout({+ schedule: schedule,+ pending: function () { return Boolean(frame || settleFrame || probingBaseline); },+ snapshot: stableSnapshot,+ timeoutMessage: 'Viewer chrome layout did not reach stable dimensions.'+ });+ }++ window.addEventListener('resize', reprobe, { passive: true });+ window.addEventListener('load', schedule, { once: true });+ window.addEventListener('beforeprint', schedule);+ window.addEventListener('afterprint', reprobe);+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(reprobe).catch(function () {});+ if (typeof ResizeObserver === 'function') {+ var resizeObserver = new ResizeObserver(schedule);+ [nav, legend].forEach(function (element) { if (element) resizeObserver.observe(element); });+ }+ if (typeof MutationObserver === 'function') {+ var contentObserver = new MutationObserver(function (records) {+ var viewerModeChanged = records.some(function (record) { return record.target === html; });+ if (viewerModeChanged) reprobe();+ else schedule();+ });+ if (legend) contentObserver.observe(legend, { attributes: true, childList: true, subtree: true });+ contentObserver.observe(html, {+ attributes: true,+ attributeFilter: ['data-embed', 'data-present', 'data-preset', 'data-theme']+ });+ }+ schedule();++ return {+ measure: measure,+ schedule: schedule,+ reprobe: reprobe,+ whenStable: whenStable,+ active: function () { return reserve > 0; },+ receipt: function () { return lastReceipt || measure(); }+ };+ })();++ Archify.view = (function () {+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var outBtn = container.querySelector('[data-view="out"]');+ var resetBtn = container.querySelector('[data-view="reset"]');+ var resetDetailLabel = resetBtn.querySelector('[data-view-detail]');+ var resetPercentLabel = resetBtn.querySelector('[data-view-percent]');+ var inBtn = container.querySelector('[data-view="in"]');+ var state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ var drag = null;+ var cameraTimer = null;+ var cameraFrame = null;+ var cameraGeneration = 0;+ var cameraTransaction = null;+ var resizeFrame = 0;+ var autoScrollUntil = 0;++ var viewBox = svg.viewBox && svg.viewBox.baseVal;++ function clamp() {+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ state.x = Math.min(0, Math.max(width - width * state.scale, state.x));+ state.y = Math.min(0, Math.max(height - height * state.scale, state.y));+ }+ function reducedMotion() {+ return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;+ }+ function contentMetrics() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return null;+ var width = svg.clientWidth || 1;+ var height = svg.clientHeight || 1;+ var scale = Math.min(width / viewBox.width, height / viewBox.height);+ return {+ width: width,+ height: height,+ scale: scale,+ offsetX: (width - viewBox.width * scale) / 2,+ offsetY: (height - viewBox.height * scale) / 2+ };+ }+ function logicalViewport() {+ var metrics = contentMetrics();+ if (!metrics) return null;+ var x;+ var y;+ var width;+ var height;+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ x = viewBox.x + container.scrollLeft / metrics.scale;+ y = viewBox.y;+ width = Math.min(viewBox.width, Math.max(1, container.clientWidth / metrics.scale));+ height = viewBox.height;+ } else {+ x = viewBox.x + ((-state.x / state.scale) - metrics.offsetX) / metrics.scale;+ y = viewBox.y + ((-state.y / state.scale) - metrics.offsetY) / metrics.scale;+ width = Math.min(viewBox.width, metrics.width / state.scale / metrics.scale);+ height = Math.min(viewBox.height, metrics.height / state.scale / metrics.scale);+ }+ width = Math.max(1, Math.min(viewBox.width, width));+ height = Math.max(1, Math.min(viewBox.height, height));+ x = Math.max(viewBox.x, Math.min(viewBox.x + viewBox.width - width, x));+ y = Math.max(viewBox.y, Math.min(viewBox.y + viewBox.height - height, y));+ return { x: x, y: y, width: width, height: height, scale: state.scale };+ }+ function detailLevel() {+ if (state.mode === 'semantic') return 'full';+ if (state.scale >= 1.75) return 'full';+ if (state.scale >= 1) return 'read';+ return 'map';+ }+ function renderControls() {+ var semantic = state.mode === 'semantic' && state.scale > 1.01;+ var detail = detailLevel();+ var percent = Math.round(state.scale * 100) + '%';+ var levelLabel = viewerText('viewer.nav.level.' + detail);+ var detailHint = detail === 'map'+ ? viewerText('viewer.nav.detail.map')+ : detail === 'read'+ ? viewerText('viewer.nav.detail.read')+ : viewerText('viewer.nav.detail.full');+ var resolvedLevel = semantic ? viewerText('viewer.nav.level.auto') : levelLabel;+ var showDetailLevel = semantic || detail !== 'read';+ if (resetDetailLabel) {+ resetDetailLabel.textContent = resolvedLevel;+ resetDetailLabel.hidden = !showDetailLevel;+ }+ if (resetPercentLabel) resetPercentLabel.textContent = percent;+ resetBtn.toggleAttribute('data-detail-visible', showDetailLevel);+ resetBtn.title = viewerText('viewer.nav.camera.title', {+ semantic: semantic ? viewerText('viewer.nav.camera.semantic') : '',+ hint: detailHint+ });+ resetBtn.setAttribute('aria-label', viewerText('viewer.nav.camera', { hint: detailHint }));+ resetBtn.setAttribute('data-detail-level', detail);+ container.setAttribute('data-detail-level', detail);+ container.setAttribute('data-camera-mode', state.mode);+ container.setAttribute('data-camera-indicator', semantic ? 'true' : 'false');+ }+ function apply() {+ clamp();+ svg.style.transform = 'translate(' + state.x + 'px,' + state.y + 'px) scale(' + state.scale + ')';+ renderControls();+ outBtn.disabled = state.scale <= 1;+ inBtn.disabled = state.scale >= 3;+ container.classList.toggle('is-pannable', state.scale > 1);+ svg.setAttribute('data-view-scale', String(state.scale));+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ if (Archify.viewerChromeLayout && typeof Archify.viewerChromeLayout.schedule === 'function') {+ Archify.viewerChromeLayout.schedule();+ }+ }+ function sampleRenderedState() {+ var transform = '';+ try { transform = getComputedStyle(svg).transform || ''; } catch (_) {}+ var match = transform.match(/^matrix\(([^)]+)\)$/);+ if (!match) return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ var values = match[1].split(',').map(Number);+ if (values.length !== 6 || !values.every(Number.isFinite)) {+ return { scale: state.scale, x: state.x, y: state.y, mode: state.mode };+ }+ return { scale: values[0], x: values[4], y: values[5], mode: state.mode };+ }+ function finishCameraTransaction(transaction, outcome) {+ if (!transaction || transaction.settled) return false;+ transaction.settled = true;+ transaction.state = outcome || 'complete';+ if (transaction.frame) cancelAnimationFrame(transaction.frame);+ if (transaction.timer) clearTimeout(transaction.timer);+ transaction.frame = null;+ transaction.timer = null;+ if (cameraTransaction === transaction) cameraTransaction = null;+ cameraFrame = null;+ cameraTimer = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ transaction.resolve({ id: transaction.id, state: transaction.state });+ return true;+ }+ function cameraReceipt(target, options) {+ var resolver;+ var transaction = {+ id: ++cameraGeneration,+ state: 'running',+ target: target,+ settled: false,+ frame: null,+ timer: null,+ finished: new Promise(function (resolve) { resolver = resolve; }),+ resolve: resolver,+ cancel: function (reason, commitTarget) {+ if (transaction.settled) return false;+ if (commitTarget && transaction.target) {+ if (Object.prototype.hasOwnProperty.call(transaction.target, 'scrollLeft')) {+ container.scrollLeft = transaction.target.scrollLeft;+ } else {+ state = {+ scale: transaction.target.scale,+ x: transaction.target.x,+ y: transaction.target.y,+ mode: transaction.target.mode+ };+ apply();+ }+ }+ return finishCameraTransaction(transaction, reason || 'cancelled');+ }+ };+ return transaction;+ }+ function stopCameraMotion(reason, commitTarget) {+ if (cameraTransaction && !cameraTransaction.settled) {+ cameraTransaction.cancel(reason || 'cancelled', commitTarget === true);+ return;+ }+ if (cameraTimer) clearTimeout(cameraTimer);+ if (cameraFrame) cancelAnimationFrame(cameraFrame);+ cameraTimer = null;+ cameraFrame = null;+ container.classList.remove('is-camera-moving');+ container.classList.remove('is-camera-transaction');+ container.removeAttribute('data-camera-transaction');+ }+ function interruptCamera(reason) {+ if (Archify.guidedViews && Archify.guidedViews.cancelHandoff) {+ Archify.guidedViews.cancelHandoff(reason || 'manual');+ }+ var rendered = sampleRenderedState();+ stopCameraMotion(reason || 'manual', false);+ state = rendered;+ state.mode = 'manual';+ apply();+ renderControls();+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: reason || 'manual' });+ }+ }+ function zoom(next, options) {+ options = options || {};+ if (options.manual !== false) interruptCamera();+ var previous = state.scale;+ next = Math.max(1, Math.min(3, Math.round(next * 4) / 4));+ if (next === previous) return;+ var centerX = (svg.clientWidth || 1) / 2;+ var centerY = (svg.clientHeight || 1) / 2;+ var contentX = (centerX - state.x) / previous;+ var contentY = (centerY - state.y) / previous;+ state.scale = next;+ state.x = centerX - contentX * next;+ state.y = centerY - contentY * next;+ apply();+ }+ function reset(options) {+ options = options || {};+ if (options.automatic !== true) interruptCamera();+ else stopCameraMotion('reset', false);+ state = { scale: 1, x: 0, y: 0, mode: 'overview' };+ apply();+ if (Archify.viewerChromeLayout && typeof Archify.viewerChromeLayout.reprobe === 'function') {+ Archify.viewerChromeLayout.reprobe();+ }+ }+ function centerAt(logicalX, logicalY, options) {+ options = options || {};+ logicalX = Number(logicalX);+ logicalY = Number(logicalY);+ var metrics = contentMetrics();+ if (!metrics || !Number.isFinite(logicalX) || !Number.isFinite(logicalY)) return false;+ interruptCamera();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram')) {+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'manual';+ apply();+ var mobileTarget = (logicalX - viewBox.x) * metrics.scale - container.clientWidth / 2;+ mobileTarget = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, mobileTarget));+ autoScrollUntil = Date.now() + 80;+ try { container.scrollTo({ left: mobileTarget, behavior: options.instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = mobileTarget; }+ return true;+ }+ var minimumScale = Math.max(1, Math.min(3, Number(options.minimumScale) || 1));+ var requestedScale = Number(options.scale);+ state.scale = Math.max(minimumScale, Math.min(3, Number.isFinite(requestedScale) ? requestedScale : state.scale));+ var contentX = metrics.offsetX + (logicalX - viewBox.x) * metrics.scale;+ var contentY = metrics.offsetY + (logicalY - viewBox.y) * metrics.scale;+ state.x = metrics.width / 2 - contentX * state.scale;+ state.y = metrics.height / 2 - contentY * state.scale;+ state.mode = 'manual';+ apply();+ if (Archify.focus && Archify.focus.reposition) Archify.focus.reposition();+ return true;+ }+ function semanticIds(ids, includeNeighbors) {+ var seeds = {};+ var wanted = {};+ (ids || []).forEach(function (id) { seeds[id] = true; wanted[id] = true; });+ if (includeNeighbors) {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (seeds[from] || seeds[to]) { wanted[from] = true; wanted[to] = true; }+ });+ }+ return wanted;+ }+ function boxesFor(ids, includeNeighbors) {+ var wanted = semanticIds(ids, includeNeighbors);+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'))+ .filter(function (node) { return wanted[node.getAttribute('data-node-id')]; })+ .map(function (node) {+ try { return node.getBBox(); } catch (_) { return null; }+ })+ .filter(Boolean);+ }+ function frameDesktop(ids, options) {+ options = options || {};+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ var svgWidth = svg.clientWidth || 1;+ var svgHeight = svg.clientHeight || 1;+ var contentScale = Math.min(svgWidth / viewBox.width, svgHeight / viewBox.height);+ var contentOffsetX = (svgWidth - viewBox.width * contentScale) / 2;+ var contentOffsetY = (svgHeight - viewBox.height * contentScale) / 2;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var minY = Math.min.apply(Math, boxes.map(function (box) { return box.y; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var maxY = Math.max.apply(Math, boxes.map(function (box) { return box.y + box.height; }));+ var bounds = {+ x: contentOffsetX + minX * contentScale,+ y: contentOffsetY + minY * contentScale,+ width: Math.max(1, (maxX - minX) * contentScale),+ height: Math.max(1, (maxY - minY) * contentScale)+ };+ var padding = options.padding || 48;+ var left = padding;+ var right = svgWidth - padding;+ var top = padding;+ var bottom = svgHeight - Math.max(padding, 72);+ var containerRect = container.getBoundingClientRect();+ var visibleTop = Math.max(0, -containerRect.top);+ var visibleBottom = Math.min(svgHeight, window.innerHeight - containerRect.top);+ if (visibleBottom - visibleTop >= 240) {+ top = Math.max(top, visibleTop + padding);+ bottom = Math.min(bottom, visibleBottom - Math.max(padding, 72));+ }+ var chip = document.getElementById('focus-chip');+ if (chip && !chip.hidden) {+ var lensEnd = chip.offsetLeft + chip.offsetWidth + 24 - (svg.offsetLeft || 0);+ left = Math.max(left, Math.min(svgWidth * 0.42, lensEnd));+ }+ var routeReceipt = document.getElementById('route-probe');+ if (routeReceipt && !routeReceipt.hidden && routeReceipt.hasAttribute('data-route-journey')) {+ var receiptTop = routeReceipt.offsetTop;+ var receiptBottom = receiptTop + routeReceipt.offsetHeight;+ if (receiptTop < svgHeight / 2) top = Math.max(top, receiptBottom + 24);+ else bottom = Math.min(bottom, receiptTop - 24);+ }+ if (right <= left || bottom <= top) return false;+ var maxScale = options.maxScale || (options.includeNeighbors ? 1.9 : 2.15);+ var targetScale = Math.min((right - left) / bounds.width, (bottom - top) / bounds.height) * 0.9;+ targetScale = Math.max(1, Math.min(maxScale, targetScale));+ if (targetScale < 1.08) targetScale = 1;+ var target = {+ scale: Math.round(targetScale * 100) / 100,+ x: 0,+ y: 0,+ mode: 'semantic'+ };+ target.x = (left + right) / 2 - (bounds.x + bounds.width / 2) * target.scale;+ target.y = (top + bottom) / 2 - (bounds.y + bounds.height / 2) * target.scale;+ var start = sampleRenderedState();+ stopCameraMotion('replaced', false);+ var transaction = cameraReceipt(target, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ if (instant) {+ state = target;+ apply();+ finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ return transaction;+ }+ var duration = Math.max(180, Math.min(520, Number(options.duration) || 420));+ var startedAt = 0;+ state = start;+ state.mode = 'semantic';+ apply();+ container.classList.add('is-camera-moving');+ container.classList.add('is-camera-transaction');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ var step = function (timestamp) {+ if (cameraTransaction !== transaction || transaction.settled) return;+ if (!startedAt) startedAt = timestamp;+ var fraction = Math.max(0, Math.min(1, (timestamp - startedAt) / duration));+ var eased = 1 - Math.pow(1 - fraction, 3);+ state = {+ scale: start.scale + (target.scale - start.scale) * eased,+ x: start.x + (target.x - start.x) * eased,+ y: start.y + (target.y - start.y) * eased,+ mode: 'semantic'+ };+ apply();+ if (fraction < 1) {+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ } else {+ state = target;+ apply();+ finishCameraTransaction(transaction, 'complete');+ }+ };+ transaction.frame = requestAnimationFrame(step);+ cameraFrame = transaction.frame;+ return transaction;+ }+ function reveal(ids, options) {+ options = options || {};+ if (window.innerWidth > 720) return frameDesktop(ids, options);+ stopCameraMotion('replaced', false);+ state.scale = 1;+ state.x = 0;+ state.y = 0;+ state.mode = 'semantic';+ apply();+ if (!container.hasAttribute('data-wide-diagram')) {+ var contained = cameraReceipt({ scale: 1, x: 0, y: 0, mode: 'semantic' }, options);+ cameraTransaction = contained;+ finishCameraTransaction(contained, 'complete');+ return contained;+ }+ var boxes = boxesFor(ids, options.includeNeighbors === true);+ if (!boxes.length || !viewBox || viewBox.width <= 0) return false;+ var minX = Math.min.apply(Math, boxes.map(function (box) { return box.x; }));+ var maxX = Math.max.apply(Math, boxes.map(function (box) { return box.x + box.width; }));+ var center = ((minX + maxX) / 2 / viewBox.width) * (svg.clientWidth || 1);+ var target = Math.max(0, Math.min(svg.clientWidth - container.clientWidth, center - container.clientWidth / 2));+ var transaction = cameraReceipt({ scrollLeft: target }, options);+ cameraTransaction = transaction;+ var instant = options.instant === true || reducedMotion() || document.hidden;+ autoScrollUntil = Date.now() + (instant ? 50 : 470);+ try { container.scrollTo({ left: target, behavior: instant ? 'auto' : 'smooth' }); }+ catch (_) { container.scrollLeft = target; }+ if (instant) finishCameraTransaction(transaction, reducedMotion() ? 'reduced-motion' : (document.hidden ? 'hidden' : 'complete'));+ else {+ transaction.timer = setTimeout(function () { finishCameraTransaction(transaction, 'complete'); }, 460);+ cameraTimer = transaction.timer;+ container.classList.add('is-camera-moving');+ container.setAttribute('data-camera-transaction', String(transaction.id));+ }+ return transaction;+ }+ function syncSemantic() {+ var guided = Archify.guidedViews && typeof Archify.guidedViews.focus === 'function'+ ? Archify.guidedViews.focus() : [];+ if (guided && guided.length) return reveal(guided, { reason: 'guided-sync' });+ var active = Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null;+ if (typeof active === 'string') return reveal([active], { includeNeighbors: true, reason: 'focus-sync' });+ if (Array.isArray(active) && active.length) return reveal(active, { reason: 'selection-sync' });+ return false;+ }+ function pinControls() {+ container.style.setProperty('--archify-scroll-x', container.scrollLeft + 'px');+ }+ function onScroll() {+ pinControls();+ if (Archify.radar && typeof Archify.radar.sync === 'function') Archify.radar.sync();+ if (window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram') && Date.now() > autoScrollUntil) {+ interruptCamera();+ }+ }+ function onPointerEnd(event) {+ if (!drag) return;+ var moved = drag.moved;+ drag = null;+ container.classList.remove('is-panning');+ try { container.releasePointerCapture(event.pointerId); } catch (_) {}+ if (moved) {+ container.setAttribute('data-just-panned', 'true');+ setTimeout(function () { container.removeAttribute('data-just-panned'); }, 80);+ }+ }++ inBtn.addEventListener('click', function () { zoom(state.scale + 0.25); });+ outBtn.addEventListener('click', function () { zoom(state.scale - 0.25); });+ resetBtn.addEventListener('click', reset);+ container.addEventListener('pointerdown', function (event) {+ if (state.scale <= 1 || event.button !== 0 || event.target.closest('.diagram-nav, .focus-chip, .node-finder, .diagram-guide, .overview-map, .route-probe, .semantic-lens') || event.target.closest('[data-node-id]') || event.target.closest('[data-relationship-hit-key]')) return;+ interruptCamera();+ drag = { startX: event.clientX, startY: event.clientY, x: state.x, y: state.y, moved: false };+ container.classList.add('is-panning');+ try { container.setPointerCapture(event.pointerId); } catch (_) {}+ });+ container.addEventListener('pointermove', function (event) {+ if (!drag) return;+ var dx = event.clientX - drag.startX;+ var dy = event.clientY - drag.startY;+ if (Math.abs(dx) + Math.abs(dy) > 3) drag.moved = true;+ state.x = drag.x + dx;+ state.y = drag.y + dy;+ apply();+ });+ container.addEventListener('pointerup', onPointerEnd);+ container.addEventListener('pointercancel', onPointerEnd);+ container.addEventListener('scroll', onScroll, { passive: true });+ window.addEventListener('resize', function () {+ if (resizeFrame) cancelAnimationFrame(resizeFrame);+ resizeFrame = requestAnimationFrame(function () {+ resizeFrame = 0;+ if (state.mode === 'semantic') syncSemantic();+ else apply();+ });+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncSemantic); });+ apply();+ pinControls();+ requestAnimationFrame(syncSemantic);++ return {+ zoomIn: function () { zoom(state.scale + 0.25); },+ zoomOut: function () { zoom(state.scale - 0.25); },+ reset: reset,+ reveal: reveal,+ centerAt: centerAt,+ logicalViewport: logicalViewport,+ sync: syncSemantic,+ state: function () { return { scale: state.scale, x: state.x, y: state.y, mode: state.mode }; }+ };+ })();++ /* ============================================================+ Semantic Radar — simplified semantic bounds + live viewport.+ The radar is built at runtime so the checked artifact still contains+ one canonical SVG block, and export serialization remains untouched.+ ============================================================ */+ Archify.radar = (function () {+ var container = document.querySelector('.diagram-container');+ var diagram = container.querySelector(':scope > svg');+ var panel = document.getElementById('overview-map');+ var panelHead = panel.querySelector('.overview-map-head');+ var surface = document.getElementById('overview-map-surface');+ var status = document.getElementById('overview-map-status');+ var trigger = document.getElementById('btn-overview-map');+ var closeBtn = document.getElementById('overview-map-close');+ var expandBtn = document.getElementById('overview-map-expand');+ var feedback = document.getElementById('overview-map-feedback');+ var navigation = container.querySelector('.diagram-nav');+ var passport = document.getElementById('focus-chip');+ var namespace = 'http://www.w3.org/2000/svg';+ var viewBox = diagram.viewBox && diagram.viewBox.baseVal;+ var mapSvg = document.createElementNS(namespace, 'svg');+ var nodeLayer = document.createElementNS(namespace, 'g');+ var viewport = document.createElementNS(namespace, 'rect');+ var nodes = [];+ var viewportDrag = null;+ var panelDrag = null;+ var manualPosition = null;+ var lastPlacement = null;+ var requestedOpen = false;+ var passportYielded = false;+ var passportPreviousAriaHidden = null;+ var syncFrame = 0;+ var spaceRetryTimer = 0;+ var spaceRetryCount = 0;+ var placementGap = 16;++ mapSvg.setAttribute('role', 'group');+ mapSvg.setAttribute('aria-label', viewerText('viewer.radar.nodes'));+ mapSvg.setAttribute('preserveAspectRatio', 'xMidYMid meet');+ nodeLayer.setAttribute('class', 'overview-map-nodes');+ viewport.setAttribute('class', 'overview-map-viewport');+ viewport.setAttribute('rx', '3');+ viewport.setAttribute('ry', '3');+ mapSvg.appendChild(nodeLayer);+ mapSvg.appendChild(viewport);+ surface.appendChild(mapSvg);++ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function build() {+ if (!viewBox || viewBox.width <= 0 || viewBox.height <= 0) return false;+ mapSvg.setAttribute('viewBox', [viewBox.x, viewBox.y, viewBox.width, viewBox.height].join(' '));+ nodeLayer.textContent = '';+ nodes = [];+ Array.prototype.forEach.call(diagram.querySelectorAll('[data-node-id]'), function (node) {+ var box;+ try { box = node.getBBox(); } catch (_) { box = null; }+ if (!box || box.width <= 0 || box.height <= 0) return;+ var id = node.getAttribute('data-node-id');+ var rect = document.createElementNS(namespace, 'rect');+ rect.setAttribute('class', 'overview-map-node');+ rect.setAttribute('x', String(box.x));+ rect.setAttribute('y', String(box.y));+ rect.setAttribute('width', String(Math.max(3, box.width)));+ rect.setAttribute('height', String(Math.max(3, box.height)));+ rect.setAttribute('rx', String(Math.max(2, Math.min(8, Math.min(box.width, box.height) * 0.1))));+ rect.setAttribute('data-radar-node-id', id);+ rect.setAttribute('data-kind', node.getAttribute('data-node-kind') || 'neutral');+ rect.setAttribute('tabindex', '0');+ rect.setAttribute('role', 'button');+ rect.setAttribute('aria-label', viewerText('viewer.radar.focus', { label: nodeLabel(node, id) }));+ nodeLayer.appendChild(rect);+ nodes.push({ id: id, node: node, rect: rect });+ });+ status.textContent = viewerText('viewer.radar.fullMap', { count: nodes.length });+ return true;+ }+ function visibleRect(element) {+ if (!element || element.hidden) return null;+ var rect = element.getBoundingClientRect();+ if (rect.width <= 0 || rect.height <= 0 || rect.right <= 0 || rect.bottom <= 0 || rect.left >= window.innerWidth || rect.top >= window.innerHeight) return null;+ return { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom, width: rect.width, height: rect.height };+ }+ function panelRectAt(position) {+ return {+ left: position.left,+ top: position.top,+ right: position.left + panel.offsetWidth,+ bottom: position.top + panel.offsetHeight,+ width: panel.offsetWidth,+ height: panel.offsetHeight+ };+ }+ function rectsIntersect(first, second, gap) {+ gap = Number(gap) || 0;+ return first.left < second.right + gap &&+ first.right > second.left - gap &&+ first.top < second.bottom + gap &&+ first.bottom > second.top - gap;+ }+ function intersectionArea(first, second) {+ var width = Math.max(0, Math.min(first.right, second.right) - Math.max(first.left, second.left));+ var height = Math.max(0, Math.min(first.bottom, second.bottom) - Math.max(first.top, second.top));+ return width * height;+ }+ function clamp(value, minimum, maximum) {+ if (maximum < minimum) return minimum;+ return Math.max(minimum, Math.min(maximum, value));+ }+ function placementContext() {+ var containerRect = visibleRect(container);+ if (!containerRect) return null;+ var controlRect = visibleRect(navigation);+ var left = Math.max(placementGap, containerRect.left + placementGap);+ var top = Math.max(placementGap, containerRect.top + placementGap);+ var right = Math.min(window.innerWidth - placementGap, containerRect.right - placementGap);+ var bottom = Math.min(window.innerHeight - placementGap, containerRect.bottom - placementGap);+ if (controlRect) bottom = Math.min(bottom, controlRect.top - placementGap);+ var lens = document.getElementById('focus-chip');+ var lensRect = visibleRect(lens);+ var legendRect = visibleRect(diagram.querySelector('[data-legend]'));+ var active = diagram.querySelector('[data-focus-selected]');+ var activeRect = visibleRect(active);+ return {+ bounds: { left: left, top: top, right: right, bottom: bottom },+ hardBlockers: [lensRect, controlRect, legendRect].filter(Boolean),+ softBlockers: [activeRect].filter(Boolean),+ preferredSide: !activeRect || activeRect.left + activeRect.width / 2 > window.innerWidth / 2 ? 'left' : 'right'+ };+ }+ function positionIsValid(position, context) {+ if (!position || !context) return false;+ var rect = panelRectAt(position);+ var bounds = context.bounds;+ if (rect.left < bounds.left || rect.top < bounds.top || rect.right > bounds.right || rect.bottom > bounds.bottom) return false;+ return context.hardBlockers.every(function (blocker) { return !rectsIntersect(rect, blocker, placementGap); });+ }+ function cornerCandidates(context) {+ var bounds = context.bounds;+ var left = bounds.left;+ var right = Math.max(left, bounds.right - panel.offsetWidth);+ var top = bounds.top;+ var bottom = Math.max(top, bounds.bottom - panel.offsetHeight);+ var preferredLeft = context.preferredSide === 'left' ? left : right;+ var alternateLeft = context.preferredSide === 'left' ? right : left;+ return [+ { left: preferredLeft, top: bottom },+ { left: alternateLeft, top: bottom },+ { left: preferredLeft, top: top },+ { left: alternateLeft, top: top }+ ].filter(function (candidate, index, all) {+ return all.findIndex(function (other) { return other.left === candidate.left && other.top === candidate.top; }) === index;+ });+ }+ function nearbyCandidates(context, reference) {+ var bounds = context.bounds;+ var maximumLeft = bounds.right - panel.offsetWidth;+ var maximumTop = bounds.bottom - panel.offsetHeight;+ var requested = reference ? {+ left: clamp(reference.left, bounds.left, maximumLeft),+ top: clamp(reference.top, bounds.top, maximumTop)+ } : null;+ var horizontal = [bounds.left, maximumLeft];+ var vertical = [bounds.top, maximumTop];+ if (requested) {+ horizontal.push(requested.left);+ vertical.push(requested.top);+ }+ context.hardBlockers.forEach(function (blocker) {+ horizontal.push(+ blocker.left - placementGap - panel.offsetWidth,+ blocker.right + placementGap+ );+ vertical.push(+ blocker.top - placementGap - panel.offsetHeight,+ blocker.bottom + placementGap+ );+ });+ horizontal = horizontal.map(function (left) { return clamp(left, bounds.left, maximumLeft); });+ vertical = vertical.map(function (top) { return clamp(top, bounds.top, maximumTop); });+ var candidates = [];+ horizontal.forEach(function (left) {+ vertical.forEach(function (top) { candidates.push({ left: left, top: top }); });+ });+ return candidates.filter(function (candidate, index, all) {+ return all.findIndex(function (other) { return other.left === candidate.left && other.top === candidate.top; }) === index;+ });+ }+ function placementScore(position, context, reference, softWeight) {+ var rect = panelRectAt(position);+ var referenceLeft = reference ? reference.left : (context.preferredSide === 'left' ? context.bounds.left : context.bounds.right - panel.offsetWidth);+ var referenceTop = reference ? reference.top : context.bounds.bottom - panel.offsetHeight;+ var distance = Math.pow(position.left - referenceLeft, 2) + Math.pow(position.top - referenceTop, 2);+ var softOverlap = context.softBlockers.reduce(function (total, blocker) { return total + intersectionArea(rect, blocker); }, 0);+ return distance + softOverlap * softWeight;+ }+ function chooseRadarPlacement(context, reference, options) {+ options = options || {};+ var softWeight = Number.isFinite(options.softWeight) ? options.softWeight : 100;+ var candidates = nearbyCandidates(context, reference).concat(cornerCandidates(context));+ var valid = candidates.filter(function (candidate) { return positionIsValid(candidate, context); });+ valid.sort(function (first, second) {+ return placementScore(first, context, reference, softWeight) - placementScore(second, context, reference, softWeight);+ });+ return valid.length ? valid[0] : null;+ }+ function applyPlacement(position, remember) {+ var useLeft = position.left + panel.offsetWidth / 2 <= window.innerWidth / 2;+ panel.setAttribute('data-docked', 'true');+ panel.setAttribute('data-dock-side', useLeft ? 'left' : 'right');+ if (useLeft) {+ panel.style.setProperty('--archify-radar-left', Math.round(position.left) + 'px');+ panel.style.removeProperty('--archify-radar-right');+ } else {+ panel.style.setProperty('--archify-radar-right', Math.round(window.innerWidth - position.left - panel.offsetWidth) + 'px');+ panel.style.removeProperty('--archify-radar-left');+ }+ panel.style.setProperty('--archify-radar-top', Math.round(position.top) + 'px');+ if (remember !== false) lastPlacement = { left: position.left, top: position.top };+ }+ function resetDockingStyles() {+ panel.removeAttribute('data-docked');+ panel.removeAttribute('data-dock-side');+ panel.removeAttribute('data-panel-dragging');+ panel.removeAttribute('data-placement-invalid');+ panel.removeAttribute('data-placement-degraded');+ panel.removeAttribute('data-placement-unavailable');+ panel.removeAttribute('data-compact');+ panel.removeAttribute('title');+ panel.style.removeProperty('visibility');+ panel.style.removeProperty('--archify-radar-right');+ panel.style.removeProperty('--archify-radar-left');+ panel.style.removeProperty('--archify-radar-top');+ }+ function updateDocking() {+ var options = arguments[0] || {};+ if (panel.hidden) return false;+ if (panelDrag) return true;+ panel.removeAttribute('data-compact');+ panel.removeAttribute('data-placement-degraded');+ panel.removeAttribute('data-placement-invalid');+ panel.removeAttribute('data-placement-unavailable');+ panel.removeAttribute('title');+ panel.style.removeProperty('visibility');+ var context = placementContext();+ if (!context) {+ resetDockingStyles();+ return false;+ }+ var reference = manualPosition || lastPlacement;+ var placementOptions = { softWeight: manualPosition ? 0 : 100 };+ var placement = manualPosition && positionIsValid(manualPosition, context)+ ? manualPosition+ : chooseRadarPlacement(context, reference, placementOptions);+ var compact = false;+ if (!placement && options.allowCompact !== false) {+ compact = true;+ panel.setAttribute('data-compact', 'true');+ panel.setAttribute('data-placement-degraded', 'true');+ panel.setAttribute('title', viewerText('viewer.radar.compacted'));+ context = placementContext();+ placement = chooseRadarPlacement(context, reference, placementOptions);+ }+ if (!placement) {+ resetDockingStyles();+ panel.setAttribute('data-placement-unavailable', 'true');+ return false;+ }+ if (manualPosition && !compact) manualPosition = { left: placement.left, top: placement.top };+ applyPlacement(placement, true);+ return true;+ }+ function clearSpaceRetry() {+ if (spaceRetryTimer) window.clearTimeout(spaceRetryTimer);+ spaceRetryTimer = 0;+ }+ function yieldPassport() {+ if (!passport || passport.hidden || passportYielded) return passportYielded;+ passportPreviousAriaHidden = passport.getAttribute('aria-hidden');+ passportYielded = true;+ passport.setAttribute('data-radar-yielded', 'true');+ passport.setAttribute('aria-hidden', 'true');+ return true;+ }+ function restorePassport() {+ if (!passport || !passportYielded) return;+ passportYielded = false;+ passport.removeAttribute('data-radar-yielded');+ if (passportPreviousAriaHidden === null) passport.removeAttribute('aria-hidden');+ else passport.setAttribute('aria-hidden', passportPreviousAriaHidden);+ passportPreviousAriaHidden = null;+ }+ function reflectVisible() {+ panel.hidden = false;+ panel.removeAttribute('data-placement-unavailable');+ trigger.setAttribute('aria-expanded', 'true');+ trigger.removeAttribute('data-radar-space-limited');+ trigger.setAttribute('aria-label', viewerText('viewer.radar.close'));+ trigger.title = viewerText('viewer.nav.radar.title');+ feedback.hidden = true;+ }+ function scheduleSpaceRetry() {+ if (!requestedOpen || spaceRetryTimer || spaceRetryCount >= 4) return;+ spaceRetryCount += 1;+ spaceRetryTimer = window.setTimeout(function () {+ spaceRetryTimer = 0;+ attemptRequestedOpen();+ }, 60);+ }+ function reflectUnavailable() {+ restorePassport();+ panel.hidden = true;+ panel.setAttribute('data-placement-unavailable', 'true');+ trigger.setAttribute('aria-expanded', 'false');+ trigger.setAttribute('aria-label', viewerText('viewer.radar.cancelWaiting'));+ trigger.setAttribute('data-radar-space-limited', 'true');+ trigger.title = viewerText('viewer.radar.needsSpace');+ feedback.hidden = false;+ scheduleSpaceRetry();+ }+ function attemptRequestedOpen(options) {+ options = options || {};+ if (!requestedOpen) return false;+ panel.hidden = false;+ if (!updateDocking(options)) {+ reflectUnavailable();+ return false;+ }+ clearSpaceRetry();+ spaceRetryCount = 0;+ reflectVisible();+ sync();+ if (options.focus === true && !panel.hasAttribute('data-compact')) surface.focus();+ return true;+ }+ function expandCompactRadar() {+ if (!requestedOpen || panel.hidden || !panel.hasAttribute('data-compact')) return false;+ yieldPassport();+ if (!updateDocking({ allowCompact: false })) {+ restorePassport();+ if (!updateDocking()) {+ reflectUnavailable();+ return false;+ }+ }+ reflectVisible();+ sync();+ if (!panel.hasAttribute('data-compact')) surface.focus();+ return !panel.hasAttribute('data-compact');+ }+ function syncNow() {+ syncFrame = 0;+ if (panel.hidden || !Archify.view || typeof Archify.view.logicalViewport !== 'function') return;+ if (!updateDocking()) {+ reflectUnavailable();+ return;+ }+ if (passportYielded && panel.hasAttribute('data-compact')) {+ restorePassport();+ if (!updateDocking()) {+ reflectUnavailable();+ return;+ }+ }+ reflectVisible();+ var visible = Archify.view.logicalViewport();+ if (!visible) return;+ viewport.setAttribute('x', String(visible.x));+ viewport.setAttribute('y', String(visible.y));+ viewport.setAttribute('width', String(visible.width));+ viewport.setAttribute('height', String(visible.height));+ var full = visible.width >= viewBox.width * 0.98 && visible.height >= viewBox.height * 0.98;+ var mobileWide = window.innerWidth <= 720 && container.hasAttribute('data-wide-diagram');+ var viewportCopy = full+ ? viewerText('viewer.radar.viewport.full')+ : (mobileWide+ ? viewerText('viewer.radar.viewport.width', { percent: Math.round(visible.width / viewBox.width * 100) })+ : viewerText('viewer.radar.viewport.scale', { percent: Math.round(visible.scale * 100) }));+ status.textContent = viewerText('viewer.radar.status', { count: nodes.length, viewport: viewportCopy });+ nodes.forEach(function (item) {+ var active = item.node.hasAttribute('data-focus-selected') ||+ item.node.getAttribute('data-story-beat-state') === 'active';+ if (active) item.rect.setAttribute('data-radar-active', 'true');+ else item.rect.removeAttribute('data-radar-active');+ });+ }+ function sync() {+ if (requestedOpen && panel.hidden) {+ attemptRequestedOpen();+ return;+ }+ if (syncFrame) return;+ syncFrame = requestAnimationFrame(syncNow);+ }+ function setOpen(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next && Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (next && Archify.semanticLens && Archify.semanticLens.isOpen()) {+ Archify.semanticLens.close({ restoreFocus: false });+ }+ requestedOpen = next;+ if (next) {+ clearSpaceRetry();+ spaceRetryCount = 0;+ build();+ attemptRequestedOpen(options);+ } else {+ clearSpaceRetry();+ spaceRetryCount = 0;+ viewportDrag = null;+ panelDrag = null;+ container.classList.remove('is-panning');+ panel.hidden = true;+ resetDockingStyles();+ restorePassport();+ feedback.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ trigger.removeAttribute('data-radar-space-limited');+ trigger.setAttribute('aria-label', viewerText('viewer.nav.radar'));+ trigger.title = viewerText('viewer.nav.radar.title');+ if (options.restoreFocus === true) trigger.focus();+ }+ return next;+ }+ function toggle() { return setOpen(!requestedOpen, { focus: false }); }+ function close(options) { return setOpen(false, options); }+ function bringNodeIntoWindow(node) {+ var delay = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 540;+ window.setTimeout(function () {+ var rect = node.getBoundingClientRect();+ var safeTop = 64;+ var safeBottom = window.innerHeight - 64;+ if (rect.top >= safeTop && rect.bottom <= safeBottom) return;+ var top = Math.max(0, window.scrollY + rect.top + rect.height / 2 - window.innerHeight / 2);+ try { window.scrollTo({ top: top, behavior: delay ? 'smooth' : 'auto' }); }+ catch (_) { window.scrollTo(0, top); }+ }, delay);+ }+ function focusNode(id) {+ var main = diagram.querySelector('[data-node-id="' + id + '"]');+ if (!main) return false;+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.set === 'function') {+ Archify.focus.set(id, { toggle: false });+ }+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'radar' });+ }+ bringNodeIntoWindow(main);+ try { main.focus({ preventScroll: true }); } catch (_) { try { main.focus(); } catch (_) {} }+ sync();+ return true;+ }+ function diagramPoint(event) {+ var matrix = mapSvg.getScreenCTM();+ if (!matrix) return null;+ var point = mapSvg.createSVGPoint();+ point.x = event.clientX;+ point.y = event.clientY;+ return point.matrixTransform(matrix.inverse());+ }+ function navigate(event) {+ var point = diagramPoint(event);+ if (!point || !Archify.view || typeof Archify.view.centerAt !== 'function') return;+ Archify.view.centerAt(point.x, point.y, { minimumScale: 1.5, instant: true });+ sync();+ }+ function endViewportDrag(event) {+ if (!viewportDrag) return;+ viewportDrag = null;+ panel.removeAttribute('data-dragging');+ container.classList.remove('is-panning');+ try { surface.releasePointerCapture(event.pointerId); } catch (_) {}+ }+ function beginPanelDrag(event) {+ if (event.button !== 0 || event.target.closest('button, a, input, [role="button"]')) return;+ var context = placementContext();+ if (!context) return;+ var rect = panel.getBoundingClientRect();+ event.preventDefault();+ event.stopPropagation();+ panelDrag = {+ pointerId: event.pointerId,+ originX: event.clientX,+ originY: event.clientY,+ start: { left: rect.left, top: rect.top },+ current: { left: rect.left, top: rect.top },+ previousManual: manualPosition ? { left: manualPosition.left, top: manualPosition.top } : null+ };+ panel.setAttribute('data-panel-dragging', 'true');+ try { panelHead.setPointerCapture(event.pointerId); } catch (_) {}+ }+ function movePanelDrag(event) {+ if (!panelDrag || panelDrag.pointerId !== event.pointerId) return;+ var context = placementContext();+ if (!context) return;+ event.preventDefault();+ event.stopPropagation();+ var bounds = context.bounds;+ var position = {+ left: clamp(panelDrag.start.left + event.clientX - panelDrag.originX, bounds.left, bounds.right - panel.offsetWidth),+ top: clamp(panelDrag.start.top + event.clientY - panelDrag.originY, bounds.top, bounds.bottom - panel.offsetHeight)+ };+ panelDrag.current = position;+ if (positionIsValid(position, context)) panel.removeAttribute('data-placement-invalid');+ else panel.setAttribute('data-placement-invalid', 'true');+ applyPlacement(position, false);+ }+ function finishPanelDrag(event, cancel) {+ if (!panelDrag || panelDrag.pointerId !== event.pointerId) return;+ event.preventDefault();+ event.stopPropagation();+ var activeDrag = panelDrag;+ panelDrag = null;+ panel.removeAttribute('data-panel-dragging');+ panel.removeAttribute('data-placement-invalid');+ try { panelHead.releasePointerCapture(event.pointerId); } catch (_) {}+ var context = placementContext();+ if (!context) return;+ if (cancel) {+ manualPosition = activeDrag.previousManual;+ lastPlacement = { left: activeDrag.start.left, top: activeDrag.start.top };+ updateDocking();+ return;+ }+ var requested = activeDrag.current;+ manualPosition = { left: requested.left, top: requested.top };+ updateDocking();+ }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close({ restoreFocus: true }); });+ expandBtn.addEventListener('click', expandCompactRadar);+ panelHead.addEventListener('pointerdown', beginPanelDrag);+ panelHead.addEventListener('pointermove', movePanelDrag);+ panelHead.addEventListener('pointerup', function (event) { finishPanelDrag(event, false); });+ panelHead.addEventListener('pointercancel', function (event) { finishPanelDrag(event, true); });+ surface.addEventListener('pointerdown', function (event) {+ if (event.button !== 0 || event.target.closest('[data-radar-node-id]')) return;+ event.preventDefault();+ viewportDrag = { pointerId: event.pointerId };+ panel.setAttribute('data-dragging', 'true');+ container.classList.add('is-panning');+ try { surface.setPointerCapture(event.pointerId); } catch (_) {}+ navigate(event);+ });+ surface.addEventListener('pointermove', function (event) {+ if (!viewportDrag || viewportDrag.pointerId !== event.pointerId) return;+ navigate(event);+ });+ surface.addEventListener('pointerup', endViewportDrag);+ surface.addEventListener('pointercancel', endViewportDrag);+ surface.addEventListener('click', function (event) {+ var node = event.target.closest('[data-radar-node-id]');+ if (node) focusNode(node.getAttribute('data-radar-node-id'));+ });+ surface.addEventListener('keydown', function (event) {+ if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ close({ restoreFocus: true });+ return;+ }+ var node = event.target.closest('[data-radar-node-id]');+ if (node && (event.key === 'Enter' || event.key === ' ')) {+ event.preventDefault();+ focusNode(node.getAttribute('data-radar-node-id'));+ return;+ }+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight' && event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;+ var visible = Archify.view && Archify.view.logicalViewport ? Archify.view.logicalViewport() : null;+ if (!visible) return;+ event.preventDefault();+ var x = visible.x + visible.width / 2;+ var y = visible.y + visible.height / 2;+ var stepX = Math.max(12, visible.width * 0.24);+ var stepY = Math.max(12, visible.height * 0.24);+ if (event.key === 'ArrowLeft') x -= stepX;+ else if (event.key === 'ArrowRight') x += stepX;+ else if (event.key === 'ArrowUp') y -= stepY;+ else y += stepY;+ Archify.view.centerAt(x, y, { minimumScale: 1.5, instant: true });+ sync();+ });+ document.addEventListener('keydown', function (event) {+ if (!panelDrag || event.key !== 'Escape') return;+ finishPanelDrag({+ pointerId: panelDrag.pointerId,+ preventDefault: function () { event.preventDefault(); },+ stopPropagation: function () { event.stopPropagation(); }+ }, true);+ }, true);+ function reflow() {+ if (!requestedOpen) return;+ clearSpaceRetry();+ spaceRetryCount = 0;+ sync();+ }+ window.addEventListener('resize', reflow);+ window.addEventListener('scroll', reflow, { passive: true });+ if (typeof ResizeObserver === 'function') {+ var radarResizeObserver = new ResizeObserver(function (entries) {+ if (!requestedOpen) return;+ if (panel.hidden && entries.every(function (entry) { return entry.target === panel; })) return;+ reflow();+ });+ [container, navigation, document.getElementById('focus-chip'), panel].filter(Boolean).forEach(function (element) {+ radarResizeObserver.observe(element);+ });+ }+ requestAnimationFrame(build);++ return {+ open: function () { return setOpen(true); },+ close: close,+ toggle: toggle,+ sync: sync,+ focus: focusNode,+ isOpen: function () { return requestedOpen; },+ count: function () { return nodes.length; }+ };+ })();++ /* ============================================================+ Presentation Stage — a shareable, viewport-filling live view.+ It changes only HTML layout and URL state; SVG semantics and export+ serialization remain untouched. Escape first clears an active guided+ view/focus, then exits the stage.+ ============================================================ */+ Archify.presentation = (function () {+ var html = document.documentElement;+ var btn = document.getElementById('btn-present');+ var label = document.getElementById('present-label');+ var previousScrollY = 0;++ function active() { return html.getAttribute('data-present') === 'true'; }++ function updateUrl(next) {+ try {+ var url = new URL(window.location.href);+ if (next) url.searchParams.set('present', '1');+ else url.searchParams.delete('present');+ history.replaceState(null, '', url.pathname + url.search + url.hash);+ } catch (_) {}+ }++ function render(next) {+ btn.setAttribute('aria-pressed', next ? 'true' : 'false');+ btn.setAttribute('aria-label', viewerText(next ? 'viewer.present.exit' : 'viewer.present.enter'));+ btn.title = viewerText(next ? 'viewer.present.exit.title' : 'viewer.present.enter.title');+ label.textContent = viewerText(next ? 'viewer.present.exit.label' : 'viewer.present.present');+ }++ function setActive(next, options) {+ options = options || {};+ next = Boolean(next);+ if (next === active()) {+ render(next);+ return next;+ }+ if (next) {+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ previousScrollY = window.scrollY || 0;+ html.setAttribute('data-present', 'true');+ try { window.scrollTo(0, 0); } catch (_) {}+ } else {+ html.removeAttribute('data-present');+ }+ render(next);+ if (options.updateUrl !== false) updateUrl(next);+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ requestAnimationFrame(function () {+ if (Archify.view && typeof Archify.view.sync === 'function') Archify.view.sync();+ });+ }+ if (!next && previousScrollY) {+ try { window.scrollTo(0, previousScrollY); } catch (_) {}+ }+ });+ return next;+ }++ function toggle() { return setActive(!active()); }++ render(active());+ btn.addEventListener('click', toggle);++ return {+ enter: function () { return setActive(true); },+ exit: function () { return setActive(false); },+ toggle: toggle,+ active: active+ };+ })();++ /* ============================================================+ Node Finder — stable-ID search over the existing semantic SVG.+ Search never changes the IR or SVG geometry: selecting a result resets+ the viewport, releases a guided view, and delegates to semantic focus.+ ============================================================ */+ Archify.finder = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector('svg');+ var trigger = document.getElementById('btn-node-finder');+ var panel = document.getElementById('node-finder');+ var heading = document.getElementById('node-finder-title');+ var closeBtn = document.getElementById('node-finder-close');+ var input = document.getElementById('node-finder-input');+ var results = document.getElementById('node-finder-results');+ var empty = document.getElementById('node-finder-empty');+ var status = document.getElementById('node-finder-status');+ var visibleItems = [];++ function defaultContext() {+ return {+ kind: 'focus',+ title: viewerText('viewer.finder.title'),+ placeholder: viewerText('viewer.finder.placeholder'),+ empty: viewerText('viewer.finder.empty'),+ resultsLabel: viewerText('viewer.finder.results'),+ availableNoun: viewerText('viewer.finder.noun.nodes'),+ allowedIds: null,+ badges: null+ };+ }++ var context = defaultContext();++ function semanticType(node) {+ var authored = node.getAttribute('data-node-kind');+ if (authored) return authored;+ var types = ['frontend', 'backend', 'database', 'cloud', 'security', 'messagebus', 'external'];+ return types.find(function (type) { return node.querySelector('.c-' + type); }) || 'node';+ }++ function connectionsFor(id) {+ var count = 0;+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = from + '\u0000' + to;+ if ((from === id || to === id) && !seen[key]) {+ seen[key] = true;+ count += 1;+ }+ });+ return count;+ }++ var items = Array.prototype.map.call(svg.querySelectorAll('[data-node-id]'), function (node) {+ var id = node.getAttribute('data-node-id');+ var label = node.getAttribute('data-node-label') || (node.getAttribute('aria-label') || id).replace(/^Focus\s+/, '');+ var text = (node.textContent || '').replace(/\s+/g, ' ').trim();+ var sublabel = node.getAttribute('data-node-sublabel') || '';+ var context = node.getAttribute('data-node-context') || '';+ var tag = node.getAttribute('data-node-tag') || '';+ var brand = node.getAttribute('data-node-brand') || '';+ var type = semanticType(node);+ var sources = Archify.sourceEvidence.node(id);+ var sourceSearch = sources.map(function (source) {+ return [source.path, source.label, source.line, source.endLine].filter(Boolean).join(' ');+ }).join(' ');+ return {+ id: id,+ label: label,+ type: type,+ sublabel: sublabel,+ context: context,+ tag: tag,+ brand: brand,+ sources: sources,+ links: connectionsFor(id),+ search: (id + ' ' + label + ' ' + type + ' ' + sublabel + ' ' + context + ' ' + tag + ' ' + sourceSearch + ' ' + text).toLowerCase() + ' ' + brand.toLowerCase(),+ node: node+ };+ });++ function resultButtons() {+ return Array.prototype.slice.call(results.querySelectorAll('.node-finder-result'));+ }++ function resolveContext(options) {+ var requested = options && options.context ? options.context : null;+ if (!requested && Archify.routeProbe && typeof Archify.routeProbe.finderContext === 'function') {+ requested = Archify.routeProbe.finderContext();+ }+ if (!requested) return defaultContext();+ var resolved = defaultContext();+ Object.keys(requested).forEach(function (key) { resolved[key] = requested[key]; });+ return resolved;+ }++ function availableItems() {+ if (!context.allowedIds) return items.slice();+ return items.filter(function (item) { return context.allowedIds.indexOf(item.id) !== -1; });+ }++ function applyContext() {+ panel.setAttribute('data-context', context.kind);+ heading.textContent = context.title;+ input.placeholder = context.placeholder;+ empty.textContent = context.empty;+ results.setAttribute('aria-label', context.resultsLabel);+ }++ function select(id) {+ var item = items.find(function (candidate) { return candidate.id === id; });+ if (!item) return false;+ var routeSelection = context.kind === 'route-source' || context.kind === 'route-target';+ if (routeSelection) {+ if (!Archify.routeProbe || typeof Archify.routeProbe.choose !== 'function' || !Archify.routeProbe.choose(id)) return false;+ if (Archify.routeProbe.active() === 'target' && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'route-pick' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.view && typeof Archify.view.reset === 'function') Archify.view.reset({ automatic: true });+ Archify.focus.set(id, { toggle: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal([id], { includeNeighbors: true, reason: 'finder' });+ }+ close({ restoreFocus: false });+ try { item.node.focus({ preventScroll: true }); } catch (_) { try { item.node.focus(); } catch (_) {} }+ return true;+ }++ function render(query) {+ query = (query || '').trim().toLowerCase();+ var available = availableItems();+ visibleItems = available.filter(function (item) { return !query || item.search.indexOf(query) !== -1; });+ results.textContent = '';+ visibleItems.forEach(function (item) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'node-finder-result';+ button.setAttribute('data-node-id', item.id);+ var badge = context.badges && context.badges[item.id]+ ? context.badges[item.id]+ : context.kind === 'focus'+ ? viewerCount('viewer.finder.link', item.links)+ : String(item.links);+ var action = context.kind === 'route-source'+ ? viewerText('viewer.finder.result.routeStart', { label: item.label })+ : context.kind === 'route-target'+ ? viewerText('viewer.finder.result.routeTarget', { label: item.label, links: badge })+ : viewerCount('viewer.finder.result.focus', item.links, { label: item.label });+ button.setAttribute('aria-label', action);++ var name = document.createElement('strong');+ name.textContent = item.label;+ var links = document.createElement('em');+ links.textContent = badge;+ links.title = context.kind === 'focus' ? badge : action;+ var meta = document.createElement('small');+ meta.textContent = [viewerKindLabel(item.type), item.id, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');+ meta.title = [viewerKindLabel(item.type), item.id, item.context, item.sublabel, item.tag].filter(Boolean).join(' \u00b7 ');+ button.appendChild(name);+ button.appendChild(links);+ button.appendChild(meta);+ button.addEventListener('click', function () { select(item.id); });+ results.appendChild(button);+ });+ empty.hidden = visibleItems.length !== 0;+ status.textContent = query+ ? viewerText('viewer.finder.status.filtered', {+ visible: visibleItems.length,+ available: available.length,+ noun: context.availableNoun+ })+ : viewerText('viewer.finder.status.all', { available: available.length, noun: context.availableNoun });+ }++ function open(options) {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ context = resolveContext(options || {});+ applyContext();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ if (context.kind.indexOf('route-') === 0 && Archify.routeProbe && typeof Archify.routeProbe.finderOpening === 'function') {+ Archify.routeProbe.finderOpening();+ }+ input.value = '';+ render('');+ requestAnimationFrame(function () { input.focus(); });+ return true;+ }++ function close(options) {+ options = options || {};+ var routeContext = context.kind.indexOf('route-') === 0;+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ input.value = '';+ if (routeContext && Archify.routeProbe && typeof Archify.routeProbe.finderClosed === 'function') {+ Archify.routeProbe.finderClosed({ restoreFocus: options.restoreFocus !== false });+ } else if (options.restoreFocus !== false) {+ trigger.focus();+ }+ }++ function toggle() { return panel.hidden ? open() : (close(), false); }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ input.addEventListener('input', function () { render(input.value); });+ input.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ if (event.key === 'ArrowDown' && buttons.length) {+ event.preventDefault();+ buttons[0].focus();+ } else if (event.key === 'Enter' && visibleItems.length) {+ event.preventDefault();+ select(visibleItems[0].id);+ }+ });+ results.addEventListener('keydown', function (event) {+ var buttons = resultButtons();+ var index = buttons.indexOf(document.activeElement);+ if (index < 0 || !buttons.length) return;+ var next = null;+ if (event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ buttons[next].focus();+ }+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && !event.target.closest('[data-node-finder-trigger]')) close({ restoreFocus: false });+ });++ render('');+ return {+ open: open,+ close: close,+ toggle: toggle,+ select: select,+ isOpen: function () { return !panel.hidden; },+ context: function () { return context.kind; },+ count: items.length+ };+ })();++ /* ============================================================+ Route Probe — shortest directed path over compiled semantics.+ The graph is read from renderer-owned stable IDs and relationship+ endpoints. BFS order follows authored DOM edge order, so equal-length+ choices are deterministic without adding weights or a graph runtime.+ ============================================================ */+ Archify.routeProbe = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-route-probe');+ var panel = document.getElementById('route-probe');+ var title = document.getElementById('route-probe-title');+ var path = document.getElementById('route-probe-path');+ var status = document.getElementById('route-probe-status');+ var findBtn = document.getElementById('route-probe-find');+ var copyBtn = document.getElementById('route-probe-copy');+ var clearBtn = document.getElementById('route-probe-clear');+ var journeyControls = document.getElementById('route-journey-controls');+ var journeyPrevBtn = document.getElementById('route-journey-prev');+ var journeyPlayBtn = document.getElementById('route-journey-play');+ var journeyPlayIcon = document.getElementById('route-journey-play-icon');+ var journeyPlayLabel = document.getElementById('route-journey-play-label');+ var journeyNextBtn = document.getElementById('route-journey-next');+ var journeyOverviewBtn = document.getElementById('route-journey-overview');+ var namespace = 'http://www.w3.org/2000/svg';+ var mode = 'idle';+ var startId = null;+ var endId = null;+ var activeNodeIds = [];+ var activeEdges = [];+ var journeyIndex = -1;+ var journeyPlaying = false;+ var journeyComplete = false;+ var journeyGeneration = 0;+ var journeyTimer = null;+ var journeyStartedAt = 0;+ var journeyElapsedMs = 0;+ var journeyOwnerToken = 0;+ var JOURNEY_DWELL_MS = 1100;++ function nodes() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-node-id]'));+ }+ function edges() {+ return Array.prototype.slice.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'));+ }+ function nodesById() {+ var out = Object.create(null);+ nodes().forEach(function (node) { out[node.getAttribute('data-node-id')] = node; });+ return out;+ }+ function nodeLabel(node, fallback) {+ return node.getAttribute('data-node-label') ||+ (node.getAttribute('aria-label') || fallback).replace(/^Focus\s+/, '').split(',')[0];+ }+ function exportSnapshot() {+ if (mode !== 'result' || activeNodeIds.length < 2 || activeEdges.length !== activeNodeIds.length - 1) return null;+ var allNodes = nodes();+ var byId = nodesById();+ var seenNodeIds = Object.create(null);+ var seenEdgeKeys = Object.create(null);+ if (startId !== activeNodeIds[0] || endId !== activeNodeIds[activeNodeIds.length - 1] ||+ activeNodeIds.some(function (id) {+ if (seenNodeIds[id] || allNodes.filter(function (node) {+ return node.getAttribute('data-node-id') === id;+ }).length !== 1) return true;+ seenNodeIds[id] = true;+ return !byId[id];+ }) ||+ activeEdges.some(function (edge, index) {+ if (!edge || !svg.contains(edge)) return true;+ var edgeKey = edge.getAttribute('data-edge-key');+ var edgeId = edge.getAttribute('data-edge-id') || '';+ if (!edgeKey || seenEdgeKeys[edgeKey]) return true;+ seenEdgeKeys[edgeKey] = true;+ var fragments = Array.prototype.slice.call(svg.querySelectorAll('[data-edge-key]')).filter(function (candidate) {+ return candidate.getAttribute('data-edge-key') === edgeKey;+ });+ var drawableFragments = fragments.filter(hasDrawableGeometry);+ return !fragments.length || !fragments.every(function (fragment) {+ return fragment.getAttribute('data-edge-from') === activeNodeIds[index] &&+ fragment.getAttribute('data-edge-to') === activeNodeIds[index + 1] &&+ (fragment.getAttribute('data-edge-id') || '') === edgeId;+ }) || drawableFragments.length !== 1 || drawableFragments[0] !== edge ||+ edge.getAttribute('data-edge-from') !== activeNodeIds[index] ||+ edge.getAttribute('data-edge-to') !== activeNodeIds[index + 1];+ })) return null;+ return {+ source: { id: startId, label: nodeLabel(byId[startId], startId) },+ target: { id: endId, label: nodeLabel(byId[endId], endId) },+ nodeIds: activeNodeIds.slice(),+ hops: activeEdges.length,+ edges: activeEdges.map(function (edge) {+ return {+ key: edge.getAttribute('data-edge-key'),+ id: edge.getAttribute('data-edge-id') || '',+ from: edge.getAttribute('data-edge-from'),+ to: edge.getAttribute('data-edge-to'),+ label: edge.getAttribute('data-edge-label') || ''+ };+ })+ };+ }+ function edgeShapes(edge) {+ if (/^(path|line|polyline)$/i.test(edge.tagName)) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function removeOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-probe-overlay]'), function (overlay) {+ overlay.remove();+ });+ }+ function removeJourneyPulse(options) {+ options = options || {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-route-journey-overlay]'), function (overlay) {+ overlay.remove();+ });+ if (journeyOwnerToken && options.release !== false && Archify.motionGovernor) {+ var token = journeyOwnerToken;+ journeyOwnerToken = 0;+ Archify.motionGovernor.release(token);+ }+ }+ function stopJourneyTimer(options) {+ options = options || {};+ journeyGeneration += 1;+ if (journeyTimer) {+ if (options.preserveElapsed === true && journeyStartedAt) {+ journeyElapsedMs = Math.min(JOURNEY_DWELL_MS, journeyElapsedMs + Math.max(0, Date.now() - journeyStartedAt));+ }+ window.clearTimeout(journeyTimer);+ }+ journeyTimer = null;+ journeyStartedAt = 0;+ if (options.preserveElapsed !== true) journeyElapsedMs = 0;+ }+ function clearJourneyPresentation(options) {+ options = options || {};+ removeJourneyPulse();+ svg.removeAttribute('data-route-journey');+ panel.removeAttribute('data-route-journey');+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-journey-state');+ node.removeAttribute('data-route-journey-current');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-journey-state');+ edge.removeAttribute('data-route-journey-current');+ });+ Array.prototype.forEach.call(path.querySelectorAll('[data-route-journey-index]'), function (button, index) {+ button.removeAttribute('data-route-journey-state');+ button.removeAttribute('aria-current');+ button.setAttribute('tabindex', index === 0 ? '0' : '-1');+ });+ if (options.keepControls !== true) journeyControls.hidden = true;+ journeyControls.setAttribute('data-playing', 'false');+ }+ function resetJourneyState() {+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation();+ }+ function cleanSvgState() {+ resetJourneyState();+ svg.removeAttribute('data-route-picking');+ svg.removeAttribute('data-route-active');+ removeOverlay();+ nodes().forEach(function (node) {+ node.removeAttribute('data-route-match');+ node.removeAttribute('data-route-start');+ node.removeAttribute('data-route-end');+ node.removeAttribute('data-route-step');+ node.removeAttribute('data-route-candidate');+ node.style.removeProperty('--route-step');+ });+ edges().forEach(function (edge) {+ edge.removeAttribute('data-route-match');+ edge.removeAttribute('data-route-step');+ edge.style.removeProperty('--route-step');+ });+ panel.removeAttribute('data-route-dock');+ }+ function replaceRouteHash(value) {+ try {+ history.replaceState(null, '', location.pathname + location.search + (value ? '#route=' + value : ''));+ } catch (_) {}+ }+ function renderPlaceholder(copy) {+ path.textContent = '';+ var placeholder = document.createElement('span');+ placeholder.className = 'route-probe-placeholder';+ placeholder.textContent = copy;+ path.appendChild(placeholder);+ }+ function renderPath(ids, options) {+ options = options || {};+ var byId = nodesById();+ path.textContent = '';+ ids.forEach(function (id, index) {+ if (index) {+ var arrow = document.createElement('span');+ arrow.className = 'route-probe-arrow';+ arrow.setAttribute('aria-hidden', 'true');+ arrow.textContent = '\u2192';+ path.appendChild(arrow);+ }+ var item = document.createElement(options.interactive === true ? 'button' : 'span');+ if (options.interactive === true) {+ item.type = 'button';+ item.setAttribute('data-route-journey-index', String(index));+ item.setAttribute('data-route-node-id', id);+ item.setAttribute('tabindex', index === 0 ? '0' : '-1');+ item.setAttribute('aria-label', viewerText('viewer.route.position', {+ index: index + 1,+ total: ids.length,+ label: nodeLabel(byId[id], id)+ }));+ }+ item.className = 'route-probe-node';+ item.textContent = nodeLabel(byId[id], id);+ item.title = nodeLabel(byId[id], id) + ' · ' + id;+ if (index === 0) item.setAttribute('data-endpoint', 'start');+ if (index === ids.length - 1 && ids.length > 1) item.setAttribute('data-endpoint', 'end');+ path.appendChild(item);+ });+ }+ function setTrigger(active) {+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', viewerText(active ? 'viewer.route.trigger.clear' : 'viewer.guide.route.aria'));+ }+ function clear(options) {+ options = options || {};+ var wasActive = mode !== 'idle';+ if (Archify.finder && Archify.finder.isOpen() && typeof Archify.finder.context === 'function' && Archify.finder.context().indexOf('route-') === 0) {+ Archify.finder.close({ restoreFocus: false });+ }+ mode = 'idle';+ startId = null;+ endId = null;+ activeNodeIds = [];+ activeEdges = [];+ cleanSvgState();+ panel.hidden = true;+ panel.setAttribute('data-state', 'idle');+ panel.removeAttribute('data-finder-open');+ title.textContent = viewerText('viewer.route.start');+ renderPlaceholder(viewerText('viewer.route.pickTwo'));+ status.textContent = viewerText('viewer.route.instructions');+ findBtn.hidden = true;+ findBtn.textContent = viewerText('viewer.route.start.find');+ findBtn.setAttribute('aria-label', viewerText('viewer.route.start.find.aria'));+ copyBtn.hidden = true;+ copyBtn.textContent = viewerText('viewer.route.copy');+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();+ setTrigger(false);+ if (wasActive && options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.updateUrl !== false) replaceRouteHash('');+ if (options.restoreFocus === true) trigger.focus();+ }+ function outgoingByNode() {+ var byId = nodesById();+ var outgoing = {};+ edges().forEach(function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ if (!byId[from] || !byId[to] || from === to) return;+ if (!outgoing[from]) outgoing[from] = [];+ outgoing[from].push({ edge: edge, to: to });+ });+ return outgoing;+ }+ function reachableFrom(source) {+ var outgoing = outgoingByNode();+ var reached = {};+ var queue = [source];+ reached[source] = true;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (reached[link.to]) return;+ reached[link.to] = true;+ queue.push(link.to);+ });+ }+ return reached;+ }+ function hopDistancesFrom(source) {+ var outgoing = outgoingByNode();+ var distances = {};+ var queue = [source];+ distances[source] = 0;+ for (var cursor = 0; cursor < queue.length; cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.forEach(function (link) {+ if (Object.prototype.hasOwnProperty.call(distances, link.to)) return;+ distances[link.to] = distances[queue[cursor]] + 1;+ queue.push(link.to);+ });+ }+ return distances;+ }+ function shortestDirectedPath(source, target) {+ if (source === target) return null;+ var outgoing = outgoingByNode();+ var previous = {};+ var queue = [source];+ previous[source] = null;+ for (var cursor = 0; cursor < queue.length && !Object.prototype.hasOwnProperty.call(previous, target); cursor += 1) {+ var links = outgoing[queue[cursor]] || [];+ links.some(function (link) {+ if (Object.prototype.hasOwnProperty.call(previous, link.to)) return false;+ previous[link.to] = { from: queue[cursor], edge: link.edge };+ queue.push(link.to);+ return link.to === target;+ });+ }+ if (!Object.prototype.hasOwnProperty.call(previous, target)) return null;+ var nodeIds = [target];+ var routeEdges = [];+ var current = target;+ while (current !== source) {+ var step = previous[current];+ if (!step) return null;+ routeEdges.unshift(step.edge);+ nodeIds.unshift(step.from);+ current = step.from;+ }+ return { nodes: nodeIds, edges: routeEdges };+ }+ function traceGeometry(shape, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.setAttribute('class', 'route-probe-flow');+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--route-step', String(step));+ return clone;+ }+ function renderOverlay(routeEdges) {+ removeOverlay();+ if (!routeEdges.length) return;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-probe-overlay');+ overlay.setAttribute('data-route-probe-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ routeEdges.forEach(function (edge, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(traceGeometry(shape, step)); });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ }+ function journeyButtons() {+ return Array.prototype.slice.call(path.querySelectorAll('[data-route-journey-index]'));+ }+ function journeyMotionAllowed() {+ return html.getAttribute('data-embed') !== 'true' &&+ !document.hidden &&+ Archify.motionGovernor &&+ Archify.motionGovernor.capable === true &&+ !Archify.motionGovernor.isPaused();+ }+ function routeOverviewStatus() {+ return viewerText('viewer.route.overview.status', {+ nodes: viewerCount('viewer.route.overview.node', activeNodeIds.length),+ hops: viewerCount('viewer.route.overview.hop', activeEdges.length)+ });+ }+ function centerJourneyButton(button) {+ if (!button) return;+ var target = button.offsetLeft - Math.max(0, (path.clientWidth - button.offsetWidth) / 2);+ path.scrollLeft = Math.max(0, target);+ }+ function focusJourneyButton(index) {+ var buttons = journeyButtons();+ if (!buttons.length) return false;+ var next = Math.max(0, Math.min(buttons.length - 1, index));+ buttons.forEach(function (button, buttonIndex) {+ button.setAttribute('tabindex', buttonIndex === next ? '0' : '-1');+ });+ try { buttons[next].focus({ preventScroll: true }); } catch (_) { buttons[next].focus(); }+ centerJourneyButton(buttons[next]);+ return true;+ }+ function renderJourneyControls() {+ var hasRoute = mode === 'result' && activeNodeIds.length > 1;+ var canPlay = hasRoute && journeyMotionAllowed();+ journeyControls.hidden = !hasRoute;+ journeyControls.setAttribute('data-playing', journeyPlaying ? 'true' : 'false');+ journeyPrevBtn.disabled = !hasRoute || journeyIndex <= 0;+ journeyNextBtn.disabled = !hasRoute || journeyIndex >= activeNodeIds.length - 1;+ journeyOverviewBtn.disabled = !hasRoute || journeyIndex < 0;+ journeyPlayBtn.disabled = !canPlay;+ journeyPlayBtn.setAttribute('aria-pressed', journeyPlaying ? 'true' : 'false');+ if (journeyPlaying) {+ journeyPlayIcon.textContent = '\u275a\u275a';+ journeyPlayLabel.textContent = viewerText('viewer.route.pause.label');+ journeyPlayBtn.setAttribute('aria-label', viewerText('viewer.route.pause'));+ journeyPlayBtn.title = viewerText('viewer.route.pause');+ } else if (journeyComplete || journeyIndex === activeNodeIds.length - 1) {+ journeyPlayIcon.textContent = '\u21bb';+ journeyPlayLabel.textContent = viewerText('viewer.route.replay.label');+ journeyPlayBtn.setAttribute('aria-label', viewerText('viewer.route.replay'));+ journeyPlayBtn.title = viewerText(canPlay ? 'viewer.route.replay' : 'viewer.route.motionRequired');+ } else {+ journeyPlayIcon.textContent = '\u25b6';+ journeyPlayLabel.textContent = viewerText('viewer.route.journey');+ journeyPlayBtn.setAttribute('aria-label', viewerText('viewer.route.play'));+ journeyPlayBtn.title = viewerText(canPlay ? 'viewer.route.play' : 'viewer.route.motionRequired');+ }+ }+ function journeyGeometry(shape) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-labelledby');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-route-match');+ clone.removeAttribute('data-route-step');+ clone.removeAttribute('data-route-journey-state');+ clone.removeAttribute('data-route-journey-current');+ clone.setAttribute('class', 'route-journey-flow');+ clone.setAttribute('pathLength', '1');+ return clone;+ }+ function renderJourneyPulse(edge) {+ removeJourneyPulse();+ if (!edge || !journeyMotionAllowed()) return false;+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'route-journey-overlay');+ overlay.setAttribute('data-route-journey-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ var wrapper = document.createElementNS(namespace, 'g');+ if (edge.hasAttribute('transform')) wrapper.setAttribute('transform', edge.getAttribute('transform'));+ edgeShapes(edge).forEach(function (shape) { wrapper.appendChild(journeyGeometry(shape)); });+ if (!wrapper.childNodes.length) return false;+ overlay.appendChild(wrapper);+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ if (Archify.motionGovernor && Archify.motionGovernor.capable) {+ var token = 0;+ token = Archify.motionGovernor.claim('route', function () {+ if (journeyOwnerToken === token) journeyOwnerToken = 0;+ removeJourneyPulse({ release: false });+ });+ journeyOwnerToken = token;+ }+ overlay.addEventListener('animationend', function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, { once: true });+ window.setTimeout(function () {+ if (overlay.isConnected) removeJourneyPulse();+ }, 860);+ return true;+ }+ function applyJourneyState(index, options) {+ options = options || {};+ if (mode !== 'result' || !activeNodeIds.length) return false;+ var byId = nodesById();+ journeyIndex = Math.max(0, Math.min(activeNodeIds.length - 1, index));+ removeJourneyPulse();+ svg.setAttribute('data-route-journey', (journeyIndex + 1) + '/' + activeNodeIds.length);+ panel.setAttribute('data-route-journey', String(journeyIndex));+ activeNodeIds.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ node.setAttribute('data-route-journey-state', state);+ if (step === journeyIndex) node.setAttribute('data-route-journey-current', '');+ else node.removeAttribute('data-route-journey-current');+ });+ activeEdges.forEach(function (edge, step) {+ var destination = step + 1;+ var state = destination < journeyIndex ? 'past' : (destination === journeyIndex ? 'current' : 'future');+ edge.setAttribute('data-route-journey-state', state);+ if (destination === journeyIndex) edge.setAttribute('data-route-journey-current', '');+ else edge.removeAttribute('data-route-journey-current');+ });+ var buttons = journeyButtons();+ buttons.forEach(function (button, step) {+ var state = step < journeyIndex ? 'past' : (step === journeyIndex ? 'current' : 'future');+ button.setAttribute('data-route-journey-state', state);+ button.setAttribute('tabindex', step === journeyIndex ? '0' : '-1');+ if (step === journeyIndex) button.setAttribute('aria-current', 'step');+ else button.removeAttribute('aria-current');+ });+ if (options.center !== false) centerJourneyButton(buttons[journeyIndex]);+ var phase = viewerText(journeyPlaying+ ? 'viewer.route.phase.playing'+ : journeyComplete+ ? 'viewer.route.phase.complete'+ : 'viewer.route.phase.inspecting');+ status.textContent = viewerText('viewer.route.step', {+ index: journeyIndex + 1,+ total: activeNodeIds.length,+ phase: phase,+ label: nodeLabel(byId[activeNodeIds[journeyIndex]], activeNodeIds[journeyIndex])+ });+ if (options.pulse === true && journeyIndex > 0) renderJourneyPulse(activeEdges[journeyIndex - 1]);+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds.slice(Math.max(0, journeyIndex - 1), Math.min(activeNodeIds.length, journeyIndex + 2)), {+ includeNeighbors: false,+ reason: 'route-journey',+ maxScale: 1.65,+ padding: 64,+ duration: 360,+ instant: !journeyMotionAllowed()+ });+ }+ renderJourneyControls();+ requestDocking();+ return true;+ }+ function pauseJourney(options) {+ options = options || {};+ if (!journeyPlaying && options.complete !== true) {+ renderJourneyControls();+ return false;+ }+ stopJourneyTimer({ preserveElapsed: options.complete !== true && options.preserveElapsed !== false });+ journeyPlaying = false;+ journeyComplete = options.complete === true;+ if (journeyComplete) journeyElapsedMs = 0;+ removeJourneyPulse();+ if (journeyIndex >= 0) applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ else renderJourneyControls();+ return true;+ }+ function selectJourneyIndex(index) {+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ return applyJourneyState(index, { pulse: true, reveal: true });+ }+ function showJourneyOverview(options) {+ options = options || {};+ if (mode !== 'result') return false;+ stopJourneyTimer();+ journeyPlaying = false;+ journeyComplete = false;+ journeyIndex = -1;+ clearJourneyPresentation({ keepControls: true });+ status.textContent = routeOverviewStatus();+ renderJourneyControls();+ if (options.reveal !== false && Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(activeNodeIds, { includeNeighbors: false, reason: 'route', instant: !journeyMotionAllowed() });+ }+ requestDocking();+ return true;+ }+ function scheduleJourney() {+ if (!journeyPlaying || !journeyMotionAllowed()) {+ pauseJourney({ preserveElapsed: true });+ return false;+ }+ var generation = ++journeyGeneration;+ var remaining = Math.max(0, JOURNEY_DWELL_MS - journeyElapsedMs);+ journeyStartedAt = Date.now();+ journeyTimer = window.setTimeout(function () {+ if (generation !== journeyGeneration || !journeyPlaying) return;+ journeyTimer = null;+ journeyStartedAt = 0;+ journeyElapsedMs = 0;+ if (journeyIndex >= activeNodeIds.length - 1) {+ pauseJourney({ complete: true, preserveElapsed: false });+ return;+ }+ applyJourneyState(journeyIndex + 1, { pulse: true, reveal: true });+ // Camera and motion-owner handoff are allowed to synchronously+ // settle the previous step. The new step always starts with a fresh+ // dwell; never carry cleanup time into the next scheduler lease.+ journeyElapsedMs = 0;+ journeyStartedAt = 0;+ scheduleJourney();+ }, remaining);+ return true;+ }+ function playJourney() {+ if (mode !== 'result' || activeNodeIds.length < 2 || !journeyMotionAllowed()) {+ renderJourneyControls();+ return false;+ }+ if (journeyPlaying) return true;+ if (journeyComplete || journeyIndex >= activeNodeIds.length - 1) {+ journeyIndex = -1;+ journeyElapsedMs = 0;+ journeyComplete = false;+ }+ journeyPlaying = true;+ if (journeyIndex < 0) applyJourneyState(0, { pulse: false, reveal: true });+ else applyJourneyState(journeyIndex, { center: false, pulse: false, reveal: false });+ scheduleJourney();+ return true;+ }+ function toggleJourney() {+ return journeyPlaying ? pauseJourney({ preserveElapsed: true }) : playJourney();+ }+ function previousJourney() {+ return selectJourneyIndex(Math.max(0, journeyIndex < 0 ? 0 : journeyIndex - 1));+ }+ function nextJourney() {+ return selectJourneyIndex(Math.min(activeNodeIds.length - 1, journeyIndex + 1));+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function updateDocking() {+ if (panel.hidden) {+ panel.removeAttribute('data-route-dock');+ return;+ }+ var containerRect = container.getBoundingClientRect();+ var width = panel.offsetWidth;+ var height = panel.offsetHeight;+ if (!width || !height) return;+ var currentRect = panel.getBoundingClientRect();+ var left = currentRect.left;+ var topCandidate = {+ left: left,+ right: left + width,+ top: containerRect.top + 8,+ bottom: containerRect.top + 8 + height+ };+ var nav = container.querySelector('.diagram-nav');+ var navRect = nav ? nav.getBoundingClientRect() : null;+ var bottom = navRect ? navRect.top - 9 : containerRect.bottom - 8;+ var bottomCandidate = {+ left: left,+ right: left + width,+ top: bottom - height,+ bottom: bottom+ };+ var byId = nodesById();+ var relevant = activeNodeIds.length ? activeNodeIds : (startId ? [startId] : []);+ var blockers = relevant.map(function (id) { return byId[id]; }).filter(Boolean).map(function (node) {+ return node.getBoundingClientRect();+ });+ function score(candidate) {+ var value = blockers.reduce(function (sum, rect) { return sum + overlapArea(candidate, rect); }, 0);+ if (navRect) value += overlapArea(candidate, navRect) * 4;+ if (candidate.top < containerRect.top || candidate.bottom > containerRect.bottom) value += 1000000;+ return value;+ }+ if (score(topCandidate) <= score(bottomCandidate)) panel.setAttribute('data-route-dock', 'top');+ else panel.setAttribute('data-route-dock', 'bottom');+ }+ function requestDocking() {+ requestAnimationFrame(updateDocking);+ window.setTimeout(updateDocking, 120);+ window.setTimeout(updateDocking, 560);+ }+ function chooseStart(id) {+ var byId = nodesById();+ if (!byId[id]) return false;+ cleanSvgState();+ startId = id;+ endId = null;+ mode = 'target';+ var reached = reachableFrom(id);+ byId[id].setAttribute('data-route-start', '');+ byId[id].setAttribute('data-route-match', '');+ Object.keys(reached).forEach(function (candidateId) {+ if (candidateId !== id && byId[candidateId]) byId[candidateId].setAttribute('data-route-candidate', '');+ });+ svg.setAttribute('data-route-picking', 'target');+ panel.setAttribute('data-state', 'target');+ title.textContent = viewerText('viewer.route.destination', { label: nodeLabel(byId[id], id) });+ renderPath([id]);+ var count = Math.max(0, Object.keys(reached).length - 1);+ status.textContent = count+ ? viewerCount('viewer.route.destination.count', count)+ : viewerText('viewer.route.noOutgoing');+ findBtn.hidden = false;+ findBtn.textContent = viewerText('viewer.route.destination.find');+ findBtn.setAttribute('aria-label', viewerText('viewer.route.destination.find.aria'));+ requestDocking();+ return true;+ }+ function showResult(result, options) {+ options = options || {};+ var byId = nodesById();+ cleanSvgState();+ mode = 'result';+ startId = result.nodes[0];+ endId = result.nodes[result.nodes.length - 1];+ activeNodeIds = result.nodes.slice();+ activeEdges = result.edges.slice();+ result.nodes.forEach(function (id, step) {+ var node = byId[id];+ if (!node) return;+ node.setAttribute('data-route-match', '');+ node.setAttribute('data-route-step', String(step));+ node.style.setProperty('--route-step', String(step));+ if (step === 0) node.setAttribute('data-route-start', '');+ if (step === result.nodes.length - 1) node.setAttribute('data-route-end', '');+ });+ result.edges.forEach(function (edge, step) {+ edge.setAttribute('data-route-match', '');+ edge.setAttribute('data-route-step', String(step));+ edge.style.setProperty('--route-step', String(step));+ });+ svg.setAttribute('data-route-active', startId + '~' + endId);+ renderOverlay(result.edges);+ renderPath(result.nodes, { interactive: true });+ panel.setAttribute('data-state', 'result');+ panel.hidden = false;+ title.textContent = viewerText('viewer.route.result.title', {+ source: nodeLabel(byId[startId], startId),+ target: nodeLabel(byId[endId], endId)+ });+ findBtn.hidden = true;+ copyBtn.hidden = false;+ setTrigger(true);+ if (Archify.exportMenu && typeof Archify.exportMenu.syncRouteShare === 'function') Archify.exportMenu.syncRouteShare();+ if (options.updateUrl !== false) {+ replaceRouteHash(encodeURIComponent(startId) + '~' + encodeURIComponent(endId));+ }+ showJourneyOverview({ reveal: false });+ if (Archify.view && typeof Archify.view.reveal === 'function') {+ Archify.view.reveal(result.nodes, { includeNeighbors: false, reason: 'route' });+ }+ return true;+ }+ function choose(id, options) {+ options = options || {};+ var byId = nodesById();+ if (!byId[id]) return false;+ if (mode === 'source') return chooseStart(id);+ if (mode !== 'target') return false;+ if (id === startId) {+ panel.setAttribute('data-state', 'error');+ title.textContent = viewerText('viewer.route.differentDestination');+ status.textContent = viewerText('viewer.route.distinct');+ return false;+ }+ var result = shortestDirectedPath(startId, id);+ if (!result) {+ panel.setAttribute('data-state', 'error');+ title.textContent = viewerText('viewer.route.unreachable', { label: nodeLabel(byId[id], id) });+ status.textContent = viewerText('viewer.route.unreachable.detail', {+ target: nodeLabel(byId[id], id),+ source: nodeLabel(byId[startId], startId)+ });+ return false;+ }+ return showResult(result, options);+ }+ function begin(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.semanticLens && Archify.semanticLens.active()) {+ Archify.semanticLens.clear({ updateUrl: false, preserveView: true, closePanel: true });+ }+ var focused = options.source || (Archify.focus && typeof Archify.focus.active === 'function' ? Archify.focus.active() : null);+ if (Array.isArray(focused)) focused = null;+ clear({ updateUrl: false, preserveView: true, restoreFocus: false });+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') Archify.intentTrace.clear({ announce: false });+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ mode = 'source';+ panel.hidden = false;+ panel.setAttribute('data-state', 'source');+ svg.setAttribute('data-route-picking', 'source');+ title.textContent = viewerText('viewer.route.start');+ renderPlaceholder(viewerText('viewer.route.pickOne'));+ status.textContent = viewerText('viewer.route.start.instructions');+ findBtn.hidden = false;+ findBtn.textContent = viewerText('viewer.route.start.find');+ findBtn.setAttribute('aria-label', viewerText('viewer.route.start.find.aria'));+ copyBtn.hidden = true;+ setTrigger(true);+ if (focused && nodesById()[focused]) chooseStart(focused);+ if (options.focusNode === true && !focused) {+ var first = nodes()[0];+ if (first) {+ try { first.focus({ preventScroll: true }); } catch (_) { try { first.focus(); } catch (_) {} }+ }+ }+ return true;+ }+ function toggle(options) {+ if (mode !== 'idle') {+ clear({ restoreFocus: true });+ return false;+ }+ return begin(options);+ }+ function finderContext() {+ var byId = nodesById();+ if (mode === 'source') {+ var outgoing = outgoingByNode();+ var sourceIds = nodes().map(function (node) { return node.getAttribute('data-node-id'); }).filter(function (id) {+ return outgoing[id] && outgoing[id].length;+ });+ var sourceBadges = {};+ sourceIds.forEach(function (id) { sourceBadges[id] = viewerText('viewer.route.finder.source.badge'); });+ return {+ kind: 'route-source',+ title: viewerText('viewer.route.finder.source.title'),+ placeholder: viewerText('viewer.route.finder.source.placeholder'),+ empty: viewerText('viewer.route.finder.source.empty'),+ resultsLabel: viewerText('viewer.route.finder.source.results'),+ availableNoun: viewerText('viewer.route.finder.source.noun'),+ allowedIds: sourceIds,+ badges: sourceBadges+ };+ }+ if (mode === 'target' && startId && byId[startId]) {+ var distances = hopDistancesFrom(startId);+ var targetIds = Object.keys(distances).filter(function (id) { return id !== startId && byId[id]; });+ var targetBadges = {};+ targetIds.forEach(function (id) {+ targetBadges[id] = viewerCount('viewer.route.hop', distances[id]);+ });+ return {+ kind: 'route-target',+ title: viewerText('viewer.route.finder.target.title', { label: nodeLabel(byId[startId], startId) }),+ placeholder: viewerText('viewer.route.finder.target.placeholder'),+ empty: viewerText('viewer.route.finder.target.empty'),+ resultsLabel: viewerText('viewer.route.finder.target.results'),+ availableNoun: viewerText('viewer.route.finder.target.noun'),+ allowedIds: targetIds,+ badges: targetBadges+ };+ }+ return null;+ }+ function finderOpening() {+ panel.setAttribute('data-finder-open', 'true');+ }+ function finderClosed(options) {+ options = options || {};+ panel.removeAttribute('data-finder-open');+ requestDocking();+ if (options.restoreFocus === true && !findBtn.hidden) findBtn.focus();+ }+ function openFinder() {+ var context = finderContext();+ if (!context || !Archify.finder) return false;+ return Archify.finder.open({ context: context });+ }+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (mode !== 'result') return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#route=' + encodeURIComponent(startId) + '~' + encodeURIComponent(endId);+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed');+ copyBtn.setAttribute('aria-label', viewerText(copied ? 'viewer.route.copy.success' : 'viewer.route.copy.failed'));+ window.setTimeout(function () {+ copyBtn.textContent = viewerText('viewer.route.copy');+ copyBtn.setAttribute('aria-label', viewerText('viewer.route.copy.aria'));+ }, 1600);+ return copied;+ });+ }+ function interceptSelection(event) {+ if (mode !== 'source' && mode !== 'target') return;+ if (container.getAttribute('data-just-panned') === 'true') return;+ var node = event.target.closest('[data-node-id]');+ if (!node) return;+ if (event.type === 'keydown' && event.key !== 'Enter' && event.key !== ' ') return;+ event.preventDefault();+ event.stopImmediatePropagation();+ choose(node.getAttribute('data-node-id'));+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var route = params.get('route');+ if (!route) {+ if (mode !== 'idle') clear({ updateUrl: false, restoreFocus: false });+ return;+ }+ var parts = route.split('~');+ if (parts.length !== 2) return;+ var byId = nodesById();+ if (!byId[parts[0]] || !byId[parts[1]]) return;+ begin({ source: parts[0], focusNode: false });+ choose(parts[1], { updateUrl: false });+ } catch (_) {}+ }+ function escapeRoute(options) {+ options = options || {};+ if (journeyPlaying) {+ pauseJourney({ preserveElapsed: true });+ if (options.restoreFocus === true) journeyPlayBtn.focus();+ return 'paused';+ }+ if (journeyIndex >= 0) {+ showJourneyOverview({ reveal: true });+ if (options.restoreFocus === true) journeyOverviewBtn.focus();+ return 'overview';+ }+ clear({ restoreFocus: options.restoreFocus === true });+ return 'cleared';+ }+ function syncJourneyMotion() {+ if (journeyPlaying && !journeyMotionAllowed()) pauseJourney({ preserveElapsed: true });+ renderJourneyControls();+ return journeyMotionAllowed();+ }++ trigger.addEventListener('click', function () { toggle({ focusNode: false }); });+ findBtn.addEventListener('click', openFinder);+ clearBtn.addEventListener('click', function () { clear({ restoreFocus: true }); });+ copyBtn.addEventListener('click', copyLink);+ journeyPrevBtn.addEventListener('click', previousJourney);+ journeyPlayBtn.addEventListener('click', toggleJourney);+ journeyNextBtn.addEventListener('click', nextJourney);+ journeyOverviewBtn.addEventListener('click', function () { showJourneyOverview({ reveal: true }); });+ path.addEventListener('click', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ selectJourneyIndex(Number(button.getAttribute('data-route-journey-index')));+ });+ path.addEventListener('focusin', function (event) {+ if (journeyPlaying && event.target.closest('[data-route-journey-index]')) pauseJourney({ preserveElapsed: true });+ });+ path.addEventListener('keydown', function (event) {+ var button = event.target.closest('[data-route-journey-index]');+ if (!button) return;+ var index = Number(button.getAttribute('data-route-journey-index'));+ var next = null;+ if (event.key === 'ArrowRight') next = Math.min(activeNodeIds.length - 1, index + 1);+ else if (event.key === 'ArrowLeft') next = Math.max(0, index - 1);+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = activeNodeIds.length - 1;+ if (next !== null) {+ event.preventDefault();+ focusJourneyButton(next);+ return;+ }+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ selectJourneyIndex(index);+ }+ });+ svg.addEventListener('click', interceptSelection, true);+ svg.addEventListener('keydown', interceptSelection, true);+ container.addEventListener('scroll', updateDocking, { passive: true });+ window.addEventListener('resize', requestDocking);+ window.addEventListener('beforeprint', function () {+ if (journeyPlaying) pauseJourney({ preserveElapsed: true, reason: 'print' });+ else removeJourneyPulse();+ });+ window.addEventListener('hashchange', function () { requestAnimationFrame(syncFromHash); });+ syncFromHash();++ return {+ begin: begin,+ choose: choose,+ clear: clear,+ toggle: toggle,+ escape: escapeRoute,+ copyLink: copyLink,+ playJourney: playJourney,+ pauseJourney: pauseJourney,+ showOverview: showJourneyOverview,+ selectJourneyIndex: selectJourneyIndex,+ syncMotion: syncJourneyMotion,+ isJourneyPlaying: function () { return journeyPlaying; },+ finderContext: finderContext,+ finderOpening: finderOpening,+ finderClosed: finderClosed,+ openFinder: openFinder,+ exportSnapshot: exportSnapshot,+ active: function () { return mode === 'idle' ? null : mode; },+ result: function () {+ return mode === 'result'+ ? { source: startId, target: endId, nodes: activeNodeIds.slice(), hops: activeEdges.length, journey: journeyIndex, playing: journeyPlaying }+ : null;+ }+ };+ })();++ /* ============================================================+ Semantic Lens — a counted, viewer-only legend over data-node-kind.+ One selected kind reveals every authored relationship touching it.+ Two selected kinds compare only direct cross-kind relationships while+ preserving the full diagram as a dimmed spatial reference.+ ============================================================ */+ Archify.semanticLens = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-semantic-lens');+ var panel = document.getElementById('semantic-lens');+ var closeBtn = document.getElementById('semantic-lens-close');+ var kindsRoot = document.getElementById('semantic-lens-kinds');+ var status = document.getElementById('semantic-lens-status');+ var copyBtn = document.getElementById('semantic-lens-copy');+ var clearBtn = document.getElementById('semantic-lens-clear');+ var legendBridge = svg.querySelector('[data-legend-bridge]');+ var legendEntries = [];+ var hoveredLegendEntry = null;+ var focusedLegendEntry = null;+ var activeLegendPreview = null;+ var lensOpener = trigger;+ var selectedKinds = [];+ var namespace = 'http://www.w3.org/2000/svg';+ var finePointerQuery = window.matchMedia ? window.matchMedia('(hover: hover) and (pointer: fine)') : null;+ var MAX_LENS_FLOW_EDGES = 24;++ function nodesById() {+ var byId = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-node-id][data-node-kind]'), function (node) {+ var id = node.getAttribute('data-node-id');+ if (id && !byId[id]) byId[id] = node;+ });+ return byId;+ }+ function collectKinds() {+ var kinds = {};+ var byId = nodesById();+ Object.keys(byId).forEach(function (id) {+ var node = byId[id];+ var value = node.getAttribute('data-node-kind') || 'neutral';+ var kind = kinds[value] || (kinds[value] = { id: value, label: viewerKindLabel(value), nodes: [] });+ kind.nodes.push(node);+ });+ return Object.keys(kinds).map(function (key) { return kinds[key]; }).sort(function (a, b) {+ return b.nodes.length - a.nodes.length || a.label.localeCompare(b.label);+ });+ }+ function edgeGroups() {+ var groups = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var from = edge.getAttribute('data-edge-from');+ var to = edge.getAttribute('data-edge-to');+ var key = edge.getAttribute('data-edge-key') || [from, to, edge.getAttribute('data-edge-label') || ''].join('\u0000');+ if (!groups[key]) groups[key] = { key: key, from: from, to: to, members: [] };+ groups[key].members.push(edge);+ });+ return Object.keys(groups).map(function (key) { return groups[key]; });+ }+ function edgeShapes(edge) {+ if (!edge) return [];+ if (/^(path|line|polyline)$/i.test(edge.tagName || '')) return [edge];+ return Array.prototype.slice.call(edge.querySelectorAll('path, line, polyline'));+ }+ function legendSourceBounds(entry) {+ var bounds = null;+ Array.prototype.forEach.call(entry.children, function (child) {+ if (child.hasAttribute('data-legend-bridge-runtime')) return;+ var box;+ try { box = child.getBBox(); } catch (_) { return; }+ if (!box || !Number.isFinite(box.x) || !Number.isFinite(box.y)) return;+ var next = { left: box.x, top: box.y, right: box.x + box.width, bottom: box.y + box.height };+ if (!bounds) bounds = next;+ else {+ bounds.left = Math.min(bounds.left, next.left);+ bounds.top = Math.min(bounds.top, next.top);+ bounds.right = Math.max(bounds.right, next.right);+ bounds.bottom = Math.max(bounds.bottom, next.bottom);+ }+ });+ return bounds;+ }+ function layoutLegendEntry(entry) {+ var bounds = legendSourceBounds(entry);+ var hit = entry.querySelector('[data-legend-hit]');+ var badge = entry.querySelector('[data-legend-count-badge]');+ if (!bounds || !hit || !badge) return false;+ var count = entry.getAttribute('data-legend-count') || '0';+ var centerY = (bounds.top + bounds.bottom) / 2;+ var badgeWidth = Math.max(14, count.length * 5 + 8);+ var badgeX = bounds.right + 3;+ var hitX = bounds.left - 5;+ var hitRight = badgeX + badgeWidth + 4;+ hit.setAttribute('x', hitX.toFixed(2));+ hit.setAttribute('y', (centerY - 12).toFixed(2));+ hit.setAttribute('width', Math.max(24, hitRight - hitX).toFixed(2));+ hit.setAttribute('height', '24');+ hit.setAttribute('rx', '4');+ var badgeRect = badge.querySelector('rect');+ var badgeText = badge.querySelector('text');+ badgeRect.setAttribute('x', badgeX.toFixed(2));+ badgeRect.setAttribute('y', (centerY - 7).toFixed(2));+ badgeRect.setAttribute('width', badgeWidth.toFixed(2));+ badgeRect.setAttribute('height', '14');+ badgeRect.setAttribute('rx', '7');+ badgeText.setAttribute('x', (badgeX + badgeWidth / 2).toFixed(2));+ badgeText.setAttribute('y', (centerY + 2.5).toFixed(2));+ return true;+ }+ function layoutLegendBridge() {+ legendEntries.forEach(layoutLegendEntry);+ if (!legendBridge) return;+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-zero]'), layoutLegendEntry);+ }+ function decorateLegendBridge() {+ legendEntries = [];+ if (!legendBridge || html.getAttribute('data-embed') === 'true') return false;+ var facts = {};+ collectKinds().forEach(function (kind) { facts[kind.id] = kind; });+ Array.prototype.forEach.call(legendBridge.querySelectorAll('[data-legend-kind]'), function (entry) {+ var kind = entry.getAttribute('data-legend-kind');+ var fact = facts[kind];+ var count = fact ? fact.nodes.length : 0;+ entry.setAttribute('data-legend-count', String(count));+ var hit = document.createElementNS(namespace, 'rect');+ hit.setAttribute('data-legend-bridge-runtime', '');+ hit.setAttribute('data-legend-hit', '');+ hit.setAttribute('aria-hidden', 'true');+ entry.insertBefore(hit, entry.firstChild);+ var badge = document.createElementNS(namespace, 'g');+ badge.setAttribute('data-legend-bridge-runtime', '');+ badge.setAttribute('data-legend-count-badge', '');+ badge.setAttribute('aria-hidden', 'true');+ badge.appendChild(document.createElementNS(namespace, 'rect'));+ var countText = document.createElementNS(namespace, 'text');+ countText.textContent = String(count);+ badge.appendChild(countText);+ entry.appendChild(badge);+ if (!fact || !count) {+ entry.setAttribute('data-legend-zero', '');+ return;+ }+ entry.setAttribute('role', 'button');+ entry.setAttribute('tabindex', legendEntries.length ? '-1' : '0');+ var visibleLabel = entry.getAttribute('data-legend-label') || fact.label;+ entry.setAttribute('aria-label', viewerCount('viewer.lens.legend.inspect', count, { label: visibleLabel }));+ entry.setAttribute('aria-pressed', 'false');+ entry.setAttribute('aria-haspopup', 'dialog');+ entry.setAttribute('aria-controls', 'semantic-lens');+ entry.setAttribute('aria-expanded', 'false');+ legendEntries.push(entry);+ });+ if (!legendEntries.length) return false;+ legendBridge.setAttribute('role', legendEntries.length >= 3 ? 'toolbar' : 'group');+ legendBridge.setAttribute('aria-label', viewerText('viewer.lens.legend'));+ syncLegendBridge();+ layoutLegendBridge();+ try {+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(layoutLegendBridge);+ } catch (_) {}+ return true;+ }+ function syncLegendBridge() {+ legendEntries.forEach(function (entry) {+ var selected = selectedKinds.indexOf(entry.getAttribute('data-legend-kind')) >= 0;+ entry.setAttribute('aria-pressed', selected ? 'true' : 'false');+ entry.setAttribute('aria-expanded', !panel.hidden && lensOpener === entry ? 'true' : 'false');+ if (selected) entry.setAttribute('data-legend-selected', '');+ else entry.removeAttribute('data-legend-selected');+ });+ }+ function clearLegendPreview() {+ activeLegendPreview = null;+ svg.removeAttribute('data-legend-preview-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-legend-preview-match], [data-legend-preview-selected], [data-legend-preview-peer]'), function (element) {+ element.removeAttribute('data-legend-preview-match');+ element.removeAttribute('data-legend-preview-selected');+ element.removeAttribute('data-legend-preview-peer');+ });+ }+ function strongerLegendOwnerActive() {+ return selectedKinds.length > 0 || !panel.hidden || html.getAttribute('data-present') === 'true' ||+ svg.hasAttribute('data-focus-active') || svg.hasAttribute('data-intent-trace-active') ||+ svg.hasAttribute('data-route-picking') || svg.hasAttribute('data-route-active') ||+ svg.hasAttribute('data-story-active') || svg.hasAttribute('data-relationship-preview-active');+ }+ function previewLegendKind(entry) {+ clearLegendPreview();+ if (!entry || strongerLegendOwnerActive()) return false;+ var kind = entry.getAttribute('data-legend-kind');+ var byId = nodesById();+ var matches = Object.keys(byId).filter(function (id) {+ return (byId[id].getAttribute('data-node-kind') || 'neutral') === kind;+ });+ if (!matches.length) return false;+ var chosen = {};+ matches.forEach(function (id) {+ chosen[id] = true;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-selected', '');+ });+ edgeGroups().forEach(function (edge) {+ if (!chosen[edge.from] && !chosen[edge.to]) return;+ edge.members.forEach(function (member) { member.setAttribute('data-legend-preview-match', ''); });+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id] || chosen[id]) return;+ byId[id].setAttribute('data-legend-preview-match', '');+ byId[id].setAttribute('data-legend-preview-peer', '');+ });+ });+ svg.setAttribute('data-legend-preview-active', kind);+ activeLegendPreview = entry;+ return true;+ }+ function syncLegendPreview() {+ var next = focusedLegendEntry || hoveredLegendEntry;+ if (next === activeLegendPreview) return;+ clearLegendPreview();+ if (next) previewLegendKind(next);+ }+ function activateLegendEntry(entry) {+ if (!entry || entry.getAttribute('role') !== 'button') return false;+ clearLegendPreview();+ select(entry.getAttribute('data-legend-kind'));+ return open({ opener: entry });+ }+ function removeFlowOverlay() {+ Array.prototype.forEach.call(svg.querySelectorAll('[data-semantic-lens-overlay]'), function (element) {+ element.remove();+ });+ svg.removeAttribute('data-lens-flow-count');+ svg.removeAttribute('data-lens-flow-density');+ }+ function flowGeometry(shape, direction, step) {+ var clone = shape.cloneNode(false);+ clone.removeAttribute('id');+ clone.removeAttribute('class');+ clone.removeAttribute('style');+ clone.removeAttribute('marker-start');+ clone.removeAttribute('marker-mid');+ clone.removeAttribute('marker-end');+ clone.removeAttribute('role');+ clone.removeAttribute('aria-label');+ clone.removeAttribute('aria-hidden');+ clone.removeAttribute('data-animate');+ clone.removeAttribute('data-edge-from');+ clone.removeAttribute('data-edge-to');+ clone.removeAttribute('data-edge-key');+ clone.removeAttribute('data-edge-id');+ clone.removeAttribute('data-edge-label');+ clone.removeAttribute('data-lens-match');+ clone.setAttribute('class', 'semantic-lens-flow');+ clone.setAttribute('data-direction', direction);+ clone.setAttribute('pathLength', '1');+ clone.style.setProperty('--lens-flow-delay', (step * 0.08).toFixed(2) + 's');+ return clone;+ }+ function renderFlowOverlay(entries) {+ removeFlowOverlay();+ svg.setAttribute('data-lens-flow-count', String(entries.length));+ if (!entries.length || html.getAttribute('data-embed') === 'true') return false;+ if (entries.length > MAX_LENS_FLOW_EDGES) {+ svg.setAttribute('data-lens-flow-density', 'quiet');+ return false;+ }+ var overlay = document.createElementNS(namespace, 'g');+ overlay.setAttribute('class', 'semantic-lens-overlay');+ overlay.setAttribute('data-semantic-lens-overlay', '');+ overlay.setAttribute('aria-hidden', 'true');+ entries.forEach(function (entry, step) {+ var wrapper = document.createElementNS(namespace, 'g');+ if (entry.edge.members[0].hasAttribute('transform')) {+ wrapper.setAttribute('transform', entry.edge.members[0].getAttribute('transform'));+ }+ edgeShapes(entry.edge.members[0]).forEach(function (shape) {+ wrapper.appendChild(flowGeometry(shape, entry.direction, step));+ });+ if (wrapper.childNodes.length) overlay.appendChild(wrapper);+ });+ if (!overlay.childNodes.length) return false;+ var firstNode = svg.querySelector('[data-node-id]');+ if (firstNode) svg.insertBefore(overlay, firstNode);+ else svg.appendChild(overlay);+ return true;+ }+ function cleanSvgState() {+ removeFlowOverlay();+ svg.removeAttribute('data-lens-active');+ Array.prototype.forEach.call(svg.querySelectorAll('[data-lens-match], [data-lens-selected], [data-lens-peer]'), function (element) {+ element.removeAttribute('data-lens-match');+ element.removeAttribute('data-lens-selected');+ element.removeAttribute('data-lens-peer');+ });+ }+ function renderKinds() {+ kindsRoot.textContent = '';+ collectKinds().forEach(function (kind) {+ var button = document.createElement('button');+ button.type = 'button';+ button.className = 'semantic-lens-kind';+ button.setAttribute('data-kind', kind.id);+ button.setAttribute('aria-pressed', selectedKinds.indexOf(kind.id) >= 0 ? 'true' : 'false');+ button.setAttribute('aria-label', viewerCount('viewer.lens.kind.count', kind.nodes.length, { label: kind.label }));+ button.disabled = selectedKinds.length >= 2 && selectedKinds.indexOf(kind.id) === -1;+ var swatch = document.createElement('span');+ swatch.className = 'semantic-lens-swatch';+ swatch.setAttribute('aria-hidden', 'true');+ var label = document.createElement('strong');+ label.textContent = kind.label;+ var count = document.createElement('em');+ count.textContent = String(kind.nodes.length);+ button.appendChild(swatch);+ button.appendChild(label);+ button.appendChild(count);+ kindsRoot.appendChild(button);+ });+ }+ function updateHash() {+ try {+ var hash = selectedKinds.length+ ? '#lens=' + selectedKinds.map(encodeURIComponent).join('~')+ : '';+ history.replaceState(null, '', location.pathname + location.search + hash);+ } catch (_) {}+ }+ function updateTrigger() {+ var active = selectedKinds.length > 0;+ trigger.setAttribute('aria-pressed', active ? 'true' : 'false');+ trigger.setAttribute('aria-label', viewerText(active ? 'viewer.lens.openActive' : 'viewer.lens.open'));+ copyBtn.hidden = !active;+ syncLegendBridge();+ }+ function overlapArea(a, b) {+ var width = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));+ var height = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));+ return width * height;+ }+ function dockPanel(byId) {+ panel.removeAttribute('data-dock-side');+ if (panel.hidden || window.innerWidth <= 720) return 'right';+ var panelRect = panel.getBoundingClientRect();+ var containerRect = container.getBoundingClientRect();+ if (!panelRect.width || !panelRect.height) return 'right';+ var selectedRects = Object.keys(byId).filter(function (id) {+ return selectedKinds.indexOf(byId[id].getAttribute('data-node-kind') || 'neutral') >= 0;+ }).map(function (id) { return byId[id].getBoundingClientRect(); });+ var top = panelRect.top;+ var width = panelRect.width;+ var leftCandidate = { left: containerRect.left + 16, right: containerRect.left + 16 + width, top: top, bottom: panelRect.bottom };+ var rightCandidate = { left: containerRect.right - 16 - width, right: containerRect.right - 16, top: top, bottom: panelRect.bottom };+ var leftScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(leftCandidate, rect); }, 0);+ var rightScore = selectedRects.reduce(function (score, rect) { return score + overlapArea(rightCandidate, rect); }, 0);+ var legend = svg.querySelector('[data-legend]');+ var nav = container.querySelector('.diagram-nav');+ var protectedRects = [legend, nav].filter(function (element) {+ return element && !element.hidden && window.getComputedStyle(element).display !== 'none';+ }).map(function (element) { return element.getBoundingClientRect(); });+ leftScore += protectedRects.reduce(function (score, rect) {+ return score + overlapArea(leftCandidate, rect) * 1000;+ }, 0);+ rightScore += protectedRects.reduce(function (score, rect) {+ return score + overlapArea(rightCandidate, rect) * 1000;+ }, 0);+ var side = leftScore < rightScore ? 'left' : 'right';+ panel.setAttribute('data-dock-side', side);+ return side;+ }+ function applySelection(options) {+ options = options || {};+ cleanSvgState();+ var byId = nodesById();+ var nodeKind = {};+ Object.keys(byId).forEach(function (id) { nodeKind[id] = byId[id].getAttribute('data-node-kind') || 'neutral'; });+ if (!selectedKinds.length) {+ status.textContent = viewerText('viewer.lens.choose');+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return false;+ }++ var chosen = {};+ selectedKinds.forEach(function (kind) { chosen[kind] = true; });+ Object.keys(byId).forEach(function (id) {+ if (!chosen[nodeKind[id]]) return;+ byId[id].setAttribute('data-lens-match', '');+ byId[id].setAttribute('data-lens-selected', '');+ });++ var touching = 0;+ var forward = 0;+ var reverse = 0;+ var crossKind = selectedKinds.length === 2;+ var matchedFlow = [];+ edgeGroups().forEach(function (edge) {+ var fromKind = nodeKind[edge.from];+ var toKind = nodeKind[edge.to];+ var match = false;+ if (crossKind) {+ if (fromKind === selectedKinds[0] && toKind === selectedKinds[1]) { match = true; forward += 1; }+ if (fromKind === selectedKinds[1] && toKind === selectedKinds[0]) { match = true; reverse += 1; }+ } else if (fromKind === selectedKinds[0] || toKind === selectedKinds[0]) {+ match = true;+ touching += 1;+ }+ if (!match) return;+ var direction = 'within';+ if (crossKind) {+ direction = fromKind === selectedKinds[0] ? 'forward' : 'reverse';+ } else {+ direction = fromKind === selectedKinds[0] && toKind !== selectedKinds[0] ? 'out'+ : (toKind === selectedKinds[0] && fromKind !== selectedKinds[0] ? 'in' : 'within');+ }+ matchedFlow.push({ edge: edge, direction: direction });+ edge.members.forEach(function (member) { member.setAttribute('data-lens-match', ''); });+ if (!crossKind) {+ [edge.from, edge.to].forEach(function (id) {+ if (!byId[id]) return;+ byId[id].setAttribute('data-lens-match', '');+ if (!chosen[nodeKind[id]]) byId[id].setAttribute('data-lens-peer', '');+ });+ }+ });++ svg.setAttribute('data-lens-active', selectedKinds.join(' '));+ renderFlowOverlay(matchedFlow);+ if (crossKind) {+ var total = forward + reverse;+ status.textContent = viewerCount('viewer.lens.compare', total, {+ first: viewerKindLabel(selectedKinds[0]),+ second: viewerKindLabel(selectedKinds[1]),+ forward: forward,+ reverse: reverse+ });+ } else {+ var nodeCount = collectKinds().filter(function (kind) { return kind.id === selectedKinds[0]; })[0].nodes.length;+ status.textContent = viewerText('viewer.lens.single', {+ nodes: viewerCount('viewer.lens.node', nodeCount, { label: viewerKindLabel(selectedKinds[0]) }),+ relationships: viewerCount('viewer.lens.relationship', touching)+ });+ }+ updateTrigger();+ renderKinds();+ dockPanel(byId);+ if (options.updateUrl !== false) updateHash();+ return true;+ }+ function prepareForLens() {+ clearLegendPreview();+ if (Archify.focus && typeof Archify.focus.clear === 'function') {+ Archify.focus.clear({ updateUrl: false, preserveView: true });+ }+ if (Archify.routeProbe && typeof Archify.routeProbe.clear === 'function') {+ Archify.routeProbe.clear({ updateUrl: false, restoreFocus: false });+ }+ if (Archify.guidedViews && typeof Archify.guidedViews.showAll === 'function') {+ Archify.guidedViews.showAll({ clearFocus: false, updateUrl: false });+ }+ if (Archify.intentTrace && typeof Archify.intentTrace.clear === 'function') {+ Archify.intentTrace.clear({ announce: false });+ }+ }+ function select(kind, options) {+ options = options || {};+ clearLegendPreview();+ var exists = collectKinds().some(function (entry) { return entry.id === kind; });+ if (!exists) return false;+ var index = selectedKinds.indexOf(kind);+ if (index >= 0) selectedKinds.splice(index, 1);+ else {+ if (selectedKinds.length >= 2) return false;+ if (!selectedKinds.length) prepareForLens();+ selectedKinds.push(kind);+ }+ return applySelection(options);+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ trigger.setAttribute('aria-expanded', 'false');+ updateTrigger();+ if (options.restoreFocus !== false && lensOpener && typeof lensOpener.focus === 'function') lensOpener.focus();+ return false;+ }+ function open(options) {+ options = options || {};+ if (html.getAttribute('data-embed') === 'true') return false;+ lensOpener = options.opener || trigger;+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.guide && Archify.guide.isOpen()) Archify.guide.close({ restoreFocus: false });+ renderKinds();+ panel.hidden = false;+ trigger.setAttribute('aria-expanded', 'true');+ updateTrigger();+ requestAnimationFrame(function () {+ dockPanel(nodesById());+ var activeButton = kindsRoot.querySelector('[aria-pressed="true"]');+ var firstButton = activeButton || kindsRoot.querySelector('button:not(:disabled)');+ if (firstButton) firstButton.focus();+ });+ return true;+ }+ function toggle() { return panel.hidden ? open({ opener: trigger }) : close(); }+ function clear(options) {+ options = options || {};+ selectedKinds = [];+ cleanSvgState();+ panel.removeAttribute('data-dock-side');+ updateTrigger();+ renderKinds();+ status.textContent = viewerText('viewer.lens.choose');+ if (options.updateUrl !== false) updateHash();+ if (options.preserveView !== true && Archify.view && typeof Archify.view.reset === 'function') {+ Archify.view.reset({ automatic: true });+ }+ if (options.closePanel === true) close({ restoreFocus: false });+ return false;+ }+ function fallbackCopy(value) {+ var field = document.createElement('textarea');+ field.value = value;+ field.setAttribute('readonly', '');+ field.style.position = 'fixed';+ field.style.opacity = '0';+ document.body.appendChild(field);+ field.select();+ var copied = false;+ try { copied = document.execCommand('copy'); } catch (_) {}+ field.remove();+ return copied;+ }+ function copyLink() {+ if (!selectedKinds.length) return Promise.resolve(false);+ var value = location.href.replace(/#.*$/, '') + '#lens=' + selectedKinds.map(encodeURIComponent).join('~');+ var copy = navigator.clipboard && typeof navigator.clipboard.writeText === 'function'+ ? navigator.clipboard.writeText(value).then(function () { return true; }).catch(function () { return fallbackCopy(value); })+ : Promise.resolve(fallbackCopy(value));+ return copy.then(function (copied) {+ copyBtn.textContent = viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed');+ window.setTimeout(function () { copyBtn.textContent = viewerText('viewer.common.copyLink'); }, 1600);+ return copied;+ });+ }+ function syncFromHash() {+ try {+ var params = new URLSearchParams(location.hash.replace(/^#/, ''));+ var value = params.get('lens');+ if (!value) {+ if (selectedKinds.length) clear({ updateUrl: false, preserveView: true });+ return;+ }+ var available = collectKinds().map(function (kind) { return kind.id; });+ var requested = value.split('~').filter(function (kind, index, list) {+ return available.indexOf(kind) >= 0 && list.indexOf(kind) === index;+ }).slice(0, 2);+ if (!requested.length) return;+ prepareForLens();+ selectedKinds = requested;+ applySelection({ updateUrl: false });+ } catch (_) {}+ }++ trigger.addEventListener('click', toggle);+ if (decorateLegendBridge()) {+ legendBridge.addEventListener('click', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (entry) activateLegendEntry(entry);+ });+ legendBridge.addEventListener('pointerover', function (event) {+ if (event.pointerType === 'touch' || (finePointerQuery && !finePointerQuery.matches)) return;+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ hoveredLegendEntry = entry;+ syncLegendPreview();+ });+ legendBridge.addEventListener('pointerout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (hoveredLegendEntry === entry) hoveredLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusin', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ focusedLegendEntry = entry;+ legendEntries.forEach(function (candidate) {+ candidate.setAttribute('tabindex', candidate === entry ? '0' : '-1');+ });+ syncLegendPreview();+ });+ legendBridge.addEventListener('focusout', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry || (event.relatedTarget && entry.contains(event.relatedTarget))) return;+ if (focusedLegendEntry === entry) focusedLegendEntry = null;+ syncLegendPreview();+ });+ legendBridge.addEventListener('keydown', function (event) {+ var entry = event.target.closest('[data-legend-kind][role="button"]');+ if (!entry) return;+ if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault();+ activateLegendEntry(entry);+ return;+ }+ var index = legendEntries.indexOf(entry);+ var next = null;+ if (event.key === 'ArrowRight') next = (index + 1) % legendEntries.length;+ else if (event.key === 'ArrowLeft') next = (index - 1 + legendEntries.length) % legendEntries.length;+ else if (event.key === 'Home') next = 0;+ else if (event.key === 'End') next = legendEntries.length - 1;+ if (next === null) return;+ event.preventDefault();+ legendEntries.forEach(function (candidate, candidateIndex) {+ candidate.setAttribute('tabindex', candidateIndex === next ? '0' : '-1');+ });+ legendEntries[next].focus();+ });+ }+ closeBtn.addEventListener('click', function () { close(); });+ clearBtn.addEventListener('click', function () { clear({ preserveView: true }); });+ copyBtn.addEventListener('click', copyLink);+ kindsRoot.addEventListener('click', function (event) {+ var button = event.target.closest('[data-kind]');+ if (!button || button.disabled) return;+ select(button.getAttribute('data-kind'));+ });+ kindsRoot.addEventListener('keydown', function (event) {+ var buttons = Array.prototype.slice.call(kindsRoot.querySelectorAll('button:not(:disabled)'));+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && (event.key === 'ArrowRight' || event.key === 'ArrowDown')) next = (index + 1) % buttons.length;+ else if (index >= 0 && (event.key === 'ArrowLeft' || event.key === 'ArrowUp')) next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) { event.preventDefault(); buttons[next].focus(); }+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key !== 'Escape') return;+ event.preventDefault();+ event.stopPropagation();+ close();+ });+ document.addEventListener('click', function (event) {+ var eventPath = typeof event.composedPath === 'function' ? event.composedPath() : [];+ var clickedInside = eventPath.indexOf(panel) >= 0 || panel.contains(event.target);+ var clickedLauncher = event.target === trigger || legendEntries.some(function (entry) {+ return event.target === entry || entry.contains(event.target);+ });+ if (!panel.hidden && !clickedInside && !clickedLauncher) close({ restoreFocus: false });+ });+ window.addEventListener('hashchange', syncFromHash);+ window.addEventListener('resize', function () {+ if (!panel.hidden && selectedKinds.length) dockPanel(nodesById());+ layoutLegendBridge();+ });+ renderKinds();+ syncFromHash();++ return {+ open: open,+ close: close,+ toggle: toggle,+ clear: clear,+ clearPreview: clearLegendPreview,+ select: select,+ copyLink: copyLink,+ isOpen: function () { return !panel.hidden; },+ active: function () { return selectedKinds.length ? selectedKinds.slice() : null; },+ kinds: function () { return collectKinds().map(function (kind) { return { id: kind.id, count: kind.nodes.length }; }); }+ };+ })();++ /* ============================================================+ Diagram Guide — a factual command deck over existing interactions.+ Counts come from compiled semantics; actions delegate to Finder, Route+ Probe, Semantic Radar, Semantic Lens, Story Trail, Presentation, theme, export, and+ camera without adding a second command implementation or SVG state.+ ============================================================ */+ Archify.guide = (function () {+ var html = document.documentElement;+ var container = document.querySelector('.diagram-container');+ var svg = container.querySelector(':scope > svg');+ var trigger = document.getElementById('btn-diagram-guide');+ var panel = document.getElementById('diagram-guide');+ var closeBtn = document.getElementById('diagram-guide-close');+ var stats = document.getElementById('diagram-guide-stats');+ var actions = document.getElementById('diagram-guide-actions');+ var feedback = document.getElementById('diagram-guide-feedback');+ var storyBtn = actions.querySelector('[data-guide-action="story"]');+ var storyCopy = document.getElementById('diagram-guide-story-copy');+ var routePanel = document.getElementById('route-probe');++ function viewCount() {+ return Archify.guidedViews && Number(Archify.guidedViews.count) || 0;+ }+ function relationshipCount() {+ var seen = {};+ Array.prototype.forEach.call(svg.querySelectorAll('[data-edge-from][data-edge-to]'), function (edge) {+ var key = edge.getAttribute('data-edge-key') || [+ edge.getAttribute('data-edge-from'),+ edge.getAttribute('data-edge-to'),+ edge.getAttribute('data-edge-label') || ''+ ].join('\u0000');+ seen[key] = true;+ });+ return Object.keys(seen).length;+ }+ function renderFacts() {+ var nodes = svg.querySelectorAll('[data-node-id]').length;+ var relationships = relationshipCount();+ var views = viewCount();+ stats.textContent = viewerText('viewer.guide.facts', {+ nodes: viewerCount('viewer.guide.fact.node', nodes),+ relationships: viewerCount('viewer.guide.fact.relationship', relationships),+ views: viewerCount('viewer.guide.fact.view', views)+ });+ storyBtn.disabled = views === 0;+ storyBtn.setAttribute('aria-disabled', views === 0 ? 'true' : 'false');+ storyCopy.textContent = views+ ? viewerCount('viewer.guide.story.available', views)+ : viewerText('viewer.guide.story.unavailable');+ }+ function actionButtons() {+ return Array.prototype.slice.call(actions.querySelectorAll('.diagram-guide-action:not(:disabled)'));+ }+ function close(options) {+ options = options || {};+ panel.hidden = true;+ html.removeAttribute('data-guide-open');+ routePanel.removeAttribute('data-guide-open');+ trigger.setAttribute('aria-expanded', 'false');+ trigger.setAttribute('aria-label', viewerText('viewer.guide.open'));+ feedback.textContent = '';+ if (options.restoreFocus !== false) trigger.focus();+ return false;+ }+ function open() {+ if (html.getAttribute('data-embed') === 'true') return false;+ if (Archify.semanticLens && typeof Archify.semanticLens.clearPreview === 'function') Archify.semanticLens.clearPreview();+ if (Archify.exportMenu && Archify.exportMenu.isOpen()) Archify.exportMenu.close(false);+ if (Archify.finder && Archify.finder.isOpen()) Archify.finder.close({ restoreFocus: false });+ if (Archify.radar && Archify.radar.isOpen()) Archify.radar.close({ restoreFocus: false });+ if (Archify.semanticLens && Archify.semanticLens.isOpen()) Archify.semanticLens.close({ restoreFocus: false });+ if (Archify.guidedViews && Archify.guidedViews.isPlaying && Archify.guidedViews.isPlaying()) {+ Archify.guidedViews.pause();+ }+ if (Archify.routeProbe && Archify.routeProbe.isJourneyPlaying && Archify.routeProbe.isJourneyPlaying()) {+ Archify.routeProbe.pauseJourney({ preserveElapsed: true, reason: 'guide' });+ }+ renderFacts();+ panel.hidden = false;+ html.setAttribute('data-guide-open', 'true');+ routePanel.setAttribute('data-guide-open', 'true');+ trigger.setAttribute('aria-expanded', 'true');+ trigger.setAttribute('aria-label', viewerText('viewer.guide.close'));+ feedback.textContent = '';+ requestAnimationFrame(function () {+ var first = actionButtons()[0];+ if (first) first.focus();+ });+ return true;+ }+ function toggle() { return panel.hidden ? open() : close(); }+ function execute(action) {+ feedback.textContent = '';+ if (action === 'story' && !viewCount()) {+ feedback.textContent = viewerText('viewer.guide.noStory');+ return false;+ }+ close({ restoreFocus: false });+ if (action === 'find') return Archify.finder.open();+ if (action === 'route') return Archify.routeProbe.begin({ focusNode: true });+ if (action === 'map') return Archify.radar.open();+ if (action === 'lens') return Archify.semanticLens.open();+ if (action === 'story') return Archify.guidedViews.play();+ if (action === 'present') return Archify.presentation.enter();+ if (action === 'export') return Archify.exportMenu.open();+ if (action === 'theme') return Archify.theme.toggle();+ if (action === 'preset') return Archify.preset.cycle();+ if (action === 'reset') return Archify.view.reset();+ if (action === 'zoom-in') return Archify.view.zoomIn();+ if (action === 'zoom-out') return Archify.view.zoomOut();+ return false;+ }+ function actionForKey(key) {+ return {+ '/': 'find',+ r: 'route',+ m: 'map',+ l: 'lens',+ p: 'story',+ f: 'present',+ e: 'export',+ t: 'theme',+ s: 'preset',+ '0': 'reset',+ '+': 'zoom-in',+ '=': 'zoom-in',+ '-': 'zoom-out'+ }[key] || null;+ }++ trigger.addEventListener('click', toggle);+ closeBtn.addEventListener('click', function () { close(); });+ actions.addEventListener('click', function (event) {+ var button = event.target.closest('[data-guide-action]');+ if (!button || button.disabled) return;+ event.stopPropagation();+ execute(button.getAttribute('data-guide-action'));+ });+ panel.addEventListener('keydown', function (event) {+ if (event.key === 'Escape' || event.key === '?') {+ event.preventDefault();+ event.stopPropagation();+ close();+ return;+ }+ var buttons = actionButtons();+ var index = buttons.indexOf(document.activeElement);+ var next = null;+ if (index >= 0 && event.key === 'ArrowRight') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowDown') next = (index + 1) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowLeft') next = (index - 1 + buttons.length) % buttons.length;+ else if (index >= 0 && event.key === 'ArrowUp') next = (index - 1 + buttons.length) % buttons.length;+ else if (event.key === 'Home' && buttons.length) next = 0;+ else if (event.key === 'End' && buttons.length) next = buttons.length - 1;+ if (next !== null) {+ event.preventDefault();+ event.stopPropagation();+ buttons[next].focus();+ return;+ }+ var action = actionForKey(event.key.length === 1 ? event.key.toLowerCase() : event.key);+ if (!action) return;+ event.preventDefault();+ event.stopPropagation();+ execute(action);+ });+ document.addEventListener('click', function (event) {+ if (!panel.hidden && !panel.contains(event.target) && event.target !== trigger) close({ restoreFocus: false });+ });++ renderFacts();+ return {+ open: open,+ close: close,+ toggle: toggle,+ execute: execute,+ isOpen: function () { return !panel.hidden; },+ facts: function () {+ return {+ nodes: svg.querySelectorAll('[data-node-id]').length,+ relationships: relationshipCount(),+ views: viewCount()+ };+ }+ };+ })();++ /* ============================================================+ Global keyboard shortcuts+ ? -> open Diagram Guide+ T -> toggle theme+ S -> cycle visual style+ E -> open export menu+ F -> toggle presentation stage+ M -> toggle Semantic Radar+ L -> toggle Semantic Lens+ R -> start/clear Route Probe+ / -> open node finder or the active route endpoint picker+ + / - -> zoom, 0 -> reset view+ Escape -> clear temporary trace/focus/view first, then exit presentation+ Ignored when focus is inside an input/textarea/contenteditable.+ ============================================================ */+ document.addEventListener('keydown', function (e) {+ if (e.metaKey || e.ctrlKey || e.altKey) return;+ if (e.defaultPrevented) return;+ var t = e.target;+ if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;+ if (Archify.preset && Archify.preset.isOpen() && e.key !== 'Escape' && e.key !== 's' && e.key !== 'S') {+ Archify.preset.close(false);+ }+ if (e.key === '?') {+ e.preventDefault();+ Archify.guide.toggle();+ } else if (e.key === '/') {+ e.preventDefault();+ Archify.finder.open();+ } else if (e.key === 't' || e.key === 'T') {+ e.preventDefault();+ Archify.theme.toggle();+ } else if (e.key === 's' || e.key === 'S') {+ e.preventDefault();+ Archify.preset.cycle();+ } else if (e.key === 'e' || e.key === 'E') {+ e.preventDefault();+ if (!Archify.exportMenu.isOpen()) Archify.exportMenu.open();+ } else if (e.key === 'f' || e.key === 'F') {+ e.preventDefault();+ Archify.presentation.toggle();+ } else if (e.key === 'm' || e.key === 'M') {+ e.preventDefault();+ Archify.radar.toggle();+ } else if (e.key === 'l' || e.key === 'L') {+ e.preventDefault();+ Archify.semanticLens.toggle();+ } else if (e.key === 'r' || e.key === 'R') {+ e.preventDefault();+ Archify.routeProbe.toggle({ focusNode: true });+ } else if (e.key === '+' || e.key === '=') {+ e.preventDefault();+ Archify.view.zoomIn();+ } else if (e.key === '-') {+ e.preventDefault();+ Archify.view.zoomOut();+ } else if (e.key === '0') {+ e.preventDefault();+ Archify.view.reset();+ } else if (e.key === 'Escape' && Archify.preset.isOpen()) {+ e.preventDefault();+ Archify.preset.close(true);+ } else if (e.key === 'Escape' && Archify.semanticLens.isOpen()) {+ e.preventDefault();+ Archify.semanticLens.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.semanticLens.active()) {+ e.preventDefault();+ Archify.semanticLens.clear({ preserveView: true });+ } else if (e.key === 'Escape' && Archify.guide.isOpen()) {+ e.preventDefault();+ Archify.guide.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.radar.isOpen()) {+ e.preventDefault();+ Archify.radar.close({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.routeProbe.active()) {+ e.preventDefault();+ Archify.routeProbe.escape({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.intentTrace.active()) {+ e.preventDefault();+ Archify.intentTrace.clear();+ } else if (e.key === 'Escape' && Archify.focus.active()) {+ e.preventDefault();+ Archify.focus.clear({ restoreFocus: true });+ } else if (e.key === 'Escape' && Archify.presentation.active()) {+ e.preventDefault();+ Archify.presentation.exit();+ }+ });+ </script>+</body>+</html>diff --git a/generated/maka-regenerated.workflow.json b/generated/maka-regenerated.workflow.jsonnew file mode 100644index 00000000..749d7112--- /dev/null+++ b/generated/maka-regenerated.workflow.json@@ -0,0 +1,107 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": {+ "title": "Maka 托管执行、受控工具与可恢复事实",+ "locale": "zh-CN",+ "quality_profile": "showcase",+ "output": "generated/maka-regenerated.workflow.html",+ "views": [+ {+ "id": "turn_spine",+ "label": "托管回合主链",+ "focus": ["request_portal", "host_kernel", "session_owner", "turn_driver", "flow_adapter", "response_surface"],+ "note": "请求进入 Runtime Host,由 SessionManager 编排回合并经 Flow 流式返回结果。"+ },+ {+ "id": "guarded_effect",+ "label": "受控工具副作用",+ "focus": ["turn_driver", "boundary_gate", "tool_runtime", "artifact_store", "runtime_ledger"],+ "note": "工具调用先通过 ExecutionBoundary,再发布文件结果并写入 RuntimeEvent 账本。"+ },+ {+ "id": "durable_resume",+ "label": "规范事实恢复",+ "focus": ["runtime_ledger", "resume_planner", "host_kernel", "session_owner"],+ "note": "恢复规划器读取事件与 Artifact 引用,验证后重新进入 Host 托管链。"+ }+ ]+ },+ "lanes": [+ { "id": "product_surface", "label": "产品请求与反馈" },+ { "id": "managed_runtime", "label": "Runtime Host、Session 与 Turn" },+ { "id": "bounded_execution", "label": "模型调用与受控副作用", "variant": "exception" },+ { "id": "durable_state", "label": "Artifact、事件账本与恢复" }+ ],+ "phases": [+ { "id": "host_intake", "label": "接入托管", "fromCol": 0, "toCol": 1 },+ { "id": "turn_drive", "label": "编排并驱动 Turn", "fromCol": 2, "toCol": 3, "variant": "emphasis" },+ { "id": "effect_record", "label": "执行与记账", "fromCol": 4, "toCol": 4, "variant": "security" },+ { "id": "feedback_resume", "label": "反馈与恢复", "fromCol": 5, "toCol": 5, "variant": "dashed" }+ ],+ "groups": [+ { "id": "host_control", "label": "Host 执行权威", "lane": "managed_runtime", "fromCol": 1, "toCol": 3, "variant": "emphasis" },+ { "id": "execution_guard", "label": "ExecutionBoundary", "lane": "bounded_execution", "fromCol": 3, "toCol": 5, "variant": "security" },+ { "id": "durable_authority", "label": "规范恢复事实", "lane": "durable_state", "fromCol": 4, "toCol": 5, "variant": "dashed" }+ ],+ "mainPath": ["request_portal", "host_kernel", "session_owner", "turn_driver", "flow_adapter", "response_surface"],+ "semanticChecks": {+ "allowedRoots": ["request_portal"],+ "allowedTerminals": ["response_surface"],+ "requiredEdges": [+ { "from": "artifact_store", "to": "runtime_ledger" },+ { "from": "runtime_ledger", "to": "resume_planner" },+ { "from": "resume_planner", "to": "host_kernel" }+ ],+ "requiredPaths": [+ { "from": "request_portal", "to": "response_surface" },+ { "from": "tool_runtime", "to": "runtime_ledger" },+ { "from": "runtime_ledger", "to": "session_owner" }+ ]+ },+ "nodes": [+ { "id": "request_portal", "lane": "product_surface", "col": 0, "type": "frontend", "label": "提交产品请求", "sublabel": "Desktop / CLI", "width": 122 },+ { "id": "response_surface", "lane": "product_surface", "col": 5, "type": "frontend", "label": "流式反馈与终态", "sublabel": "界面更新及最终结果", "width": 132 },+ { "id": "host_kernel", "lane": "managed_runtime", "col": 1, "type": "backend", "label": "RuntimeHostKernel", "sublabel": "根目录唯一执行权威", "width": 152 },+ { "id": "session_owner", "lane": "managed_runtime", "col": 2, "type": "backend", "label": "SessionManager", "sublabel": "Session / Turn 所有者", "width": 146 },+ { "id": "turn_driver", "lane": "managed_runtime", "col": 3, "type": "backend", "label": "AgentRun / RuntimeRunner", "sublabel": "事件驱动的 Turn 编排", "width": 170 },+ { "id": "flow_adapter", "lane": "bounded_execution", "col": 4, "type": "cloud", "label": "AiSdkFlow / Backend", "sublabel": "模型调用与 RuntimeEvent 映射", "width": 150 },+ { "id": "boundary_gate", "lane": "bounded_execution", "col": 3, "type": "security", "label": "ExecutionBoundary", "sublabel": "权限与 sandbox 准入", "width": 158 },+ { "id": "tool_runtime", "lane": "bounded_execution", "col": 5, "type": "messagebus", "label": "ToolRuntime", "sublabel": "执行、终止与结果结算", "width": 148 },+ { "id": "artifact_store", "lane": "durable_state", "col": 5, "type": "database", "label": "ArtifactStore", "sublabel": "文件结果与引用发布", "width": 144 },+ { "id": "runtime_ledger", "lane": "durable_state", "col": 4, "type": "database", "label": "SqliteRuntimeStore", "sublabel": "RuntimeEvent 规范账本", "width": 158 },+ { "id": "resume_planner", "lane": "durable_state", "col": 0, "type": "backend", "label": "RuntimeContinuationPlanner", "sublabel": "读取事实并验证恢复", "width": 186 }+ ],+ "edges": [+ { "id": "open_host", "from": "request_portal", "to": "host_kernel", "label": "Host 连接", "variant": "emphasis", "role": "main" },+ { "id": "submit_session_command", "from": "host_kernel", "to": "session_owner", "label": "托管命令", "variant": "emphasis", "role": "main" },+ { "id": "start_or_resume_turn", "from": "session_owner", "to": "turn_driver", "label": "启动 / 续接", "variant": "emphasis", "role": "main" },+ { "id": "dispatch_model_flow", "from": "turn_driver", "to": "flow_adapter", "label": "请求 / stream", "variant": "emphasis", "role": "main" },+ { "id": "emit_response", "from": "flow_adapter", "to": "response_surface", "label": "增量事件", "variant": "emphasis", "role": "main" },+ { "id": "ask_for_effect", "from": "turn_driver", "to": "boundary_gate", "label": "工具调用", "variant": "security", "role": "branch" },+ { "id": "admit_effect", "from": "boundary_gate", "to": "tool_runtime", "label": "准入后执行", "variant": "security", "role": "branch" },+ { "id": "publish_file_result", "from": "tool_runtime", "to": "artifact_store", "label": "文件型结果", "variant": "dashed", "role": "async" },+ { "id": "record_artifact_ref", "from": "artifact_store", "to": "runtime_ledger", "label": "Artifact 引用", "variant": "dashed", "role": "return" },+ { "id": "record_runtime_events", "from": "flow_adapter", "to": "runtime_ledger", "label": "写入 RuntimeEvent", "variant": "dashed", "role": "async", "bias": 0.2 },+ { "id": "read_resume_facts", "from": "runtime_ledger", "to": "resume_planner", "label": "读取事件与 Artifact 引用", "variant": "dashed", "role": "return" },+ { "id": "reenter_host", "from": "resume_planner", "to": "host_kernel", "label": "验证恢复计划", "variant": "emphasis", "role": "branch" }+ ],+ "cards": [+ {+ "dot": "emerald",+ "title": "托管权威不下沉",+ "items": [+ "RuntimeHostKernel 保持根目录唯一执行权威",+ "SessionManager 与 RuntimeRunner 管理 Session、Turn 和续接"+ ]+ },+ {+ "dot": "violet",+ "title": "恢复依赖规范事实",+ "items": [+ "ArtifactStore 发布文件结果并把引用写入 RuntimeEvent",+ "RuntimeContinuationPlanner 从 SQLite 账本恢复后重新进入 Host"+ ]+ }+ ]+}diff --git a/generated/maka-regenerated.workflow.visual-check.1440x900.dark.png b/generated/maka-regenerated.workflow.visual-check.1440x900.dark.pngnew file mode 100644index 00000000..6f2753adBinary files /dev/null and b/generated/maka-regenerated.workflow.visual-check.1440x900.dark.png differdiff --git a/generated/maka-regenerated.workflow.visual-check.1440x900.light.png b/generated/maka-regenerated.workflow.visual-check.1440x900.light.pngnew file mode 100644index 00000000..28be4370Binary files /dev/null and b/generated/maka-regenerated.workflow.visual-check.1440x900.light.png differdiff --git a/generated/maka-regenerated.workflow.visual-check.2048x1320.dark.png b/generated/maka-regenerated.workflow.visual-check.2048x1320.dark.pngnew file mode 100644index 00000000..082dc478Binary files /dev/null and b/generated/maka-regenerated.workflow.visual-check.2048x1320.dark.png differdiff --git a/generated/maka-regenerated.workflow.visual-check.2048x1320.light.png b/generated/maka-regenerated.workflow.visual-check.2048x1320.light.pngnew file mode 100644index 00000000..f97ff118Binary files /dev/null and b/generated/maka-regenerated.workflow.visual-check.2048x1320.light.png differdiff --git a/generated/maka-regenerated.workflow.visual-check.html b/generated/maka-regenerated.workflow.visual-check.htmlnew file mode 100644index 00000000..5dab69d6--- /dev/null+++ b/generated/maka-regenerated.workflow.visual-check.html@@ -0,0 +1,32 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width,initial-scale=1">+<title>Archify visual-check · maka-regenerated.workflow.html</title>+<style>+*{box-sizing:border-box}body{margin:0;padding:24px;background:#e9eef5;color:#172033;font:14px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}header{max-width:1500px;margin:0 auto 18px}h1{margin:0 0 6px;font-size:20px}p{margin:0;color:#526176}.grid{max-width:1500px;margin:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}figure{margin:0;padding:10px;background:white;border:1px solid #c9d4e3;border-radius:12px;box-shadow:0 10px 30px rgba(15,23,42,.08)}img{display:block;width:100%;height:auto;border:1px solid #e2e8f0}figcaption{padding:9px 4px 2px;color:#526176}@media(max-width:900px){.grid{grid-template-columns:1fr}}+</style>+</head>+<body>+<header><h1>Archify visual-check</h1><p>maka-regenerated.workflow.html · automated containment pass · visual review pending</p></header>+<main class="grid">+ <figure>+ <img src="maka-regenerated.workflow.visual-check.1440x900.light.png" alt="light 1440 by 900">+ <figcaption><strong>LIGHT</strong> · 1440×900 · containment pass</figcaption>+ </figure>+ <figure>+ <img src="maka-regenerated.workflow.visual-check.1440x900.dark.png" alt="dark 1440 by 900">+ <figcaption><strong>DARK</strong> · 1440×900 · containment pass</figcaption>+ </figure>+ <figure>+ <img src="maka-regenerated.workflow.visual-check.2048x1320.light.png" alt="light 2048 by 1320">+ <figcaption><strong>LIGHT</strong> · 2048×1320 · containment pass</figcaption>+ </figure>+ <figure>+ <img src="maka-regenerated.workflow.visual-check.2048x1320.dark.png" alt="dark 2048 by 1320">+ <figcaption><strong>DARK</strong> · 2048×1320 · containment pass</figcaption>+ </figure>+</main>+</body>+</html>diff --git a/generated/maka-regenerated.workflow.visual-check.json b/generated/maka-regenerated.workflow.visual-check.jsonnew file mode 100644index 00000000..c563d406--- /dev/null+++ b/generated/maka-regenerated.workflow.visual-check.json@@ -0,0 +1,482 @@+{+ "schemaVersion": 1,+ "ok": true,+ "command": "visual-check",+ "status": "pass",+ "visualReview": "pending",+ "artifact": {+ "path": "/Users/sunhonghao/.codex/worktrees/19a3/archify/generated/maka-regenerated.workflow.html",+ "sha256": "b27863e495828b0a8f328e18dbe019c96a0ac48db2e126d63ae59fe67d53fa47",+ "bytes": 719120+ },+ "state": {+ "detail": "read",+ "motion": "still"+ },+ "chrome": {+ "status": "available",+ "executable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"+ },+ "containment": {+ "status": "pass",+ "viewports": [+ {+ "width": 1440,+ "height": 900,+ "theme": "light",+ "innerWidth": 1440,+ "innerHeight": 900,+ "scrollWidth": 1440,+ "scrollHeight": 900,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1131,+ "diagramWidth": 1101,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.120452708164915,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1600,+ "height": 1000,+ "theme": "light",+ "innerWidth": 1600,+ "innerHeight": 1000,+ "scrollWidth": 1600,+ "scrollHeight": 1000,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1263,+ "diagramWidth": 1233,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.974130962004851,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1920,+ "height": 1080,+ "theme": "light",+ "innerWidth": 1920,+ "innerHeight": 1080,+ "scrollWidth": 1920,+ "scrollHeight": 1080,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1415,+ "diagramWidth": 1385,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 2048,+ "height": 1320,+ "theme": "light",+ "innerWidth": 2048,+ "innerHeight": 1320,+ "scrollWidth": 2048,+ "scrollHeight": 1320,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1792,+ "diagramWidth": 1742,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ }+ ]+ },+ "readability": {+ "status": "pass",+ "minimumProjectedNodeTextPx": 6,+ "viewports": [+ {+ "width": 1440,+ "height": 900,+ "theme": "light",+ "innerWidth": 1440,+ "innerHeight": 900,+ "scrollWidth": 1440,+ "scrollHeight": 900,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1131,+ "diagramWidth": 1101,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.120452708164915,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1600,+ "height": 1000,+ "theme": "light",+ "innerWidth": 1600,+ "innerHeight": 1000,+ "scrollWidth": 1600,+ "scrollHeight": 1000,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1263,+ "diagramWidth": 1233,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.974130962004851,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1920,+ "height": 1080,+ "theme": "light",+ "innerWidth": 1920,+ "innerHeight": 1080,+ "scrollWidth": 1920,+ "scrollHeight": 1080,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1415,+ "diagramWidth": 1385,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 2048,+ "height": 1320,+ "theme": "light",+ "innerWidth": 2048,+ "innerHeight": 1320,+ "scrollWidth": 2048,+ "scrollHeight": 1320,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1792,+ "diagramWidth": 1742,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ }+ ]+ },+ "viewerChrome": {+ "status": "pass",+ "viewports": [+ {+ "width": 1440,+ "height": 900,+ "theme": "light",+ "innerWidth": 1440,+ "innerHeight": 900,+ "scrollWidth": 1440,+ "scrollHeight": 900,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1131,+ "diagramWidth": 1101,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.120452708164915,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1600,+ "height": 1000,+ "theme": "light",+ "innerWidth": 1600,+ "innerHeight": 1000,+ "scrollWidth": 1600,+ "scrollHeight": 1000,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1263,+ "diagramWidth": 1233,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.974130962004851,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 1920,+ "height": 1080,+ "theme": "light",+ "innerWidth": 1920,+ "innerHeight": 1080,+ "scrollWidth": 1920,+ "scrollHeight": 1080,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1415,+ "diagramWidth": 1385,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ },+ {+ "width": 2048,+ "height": 1320,+ "theme": "light",+ "innerWidth": 2048,+ "innerHeight": 1320,+ "scrollWidth": 2048,+ "scrollHeight": 1320,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1792,+ "diagramWidth": 1742,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light"+ }+ ]+ },+ "captures": {+ "status": "pass",+ "screenshots": [+ {+ "width": 1440,+ "height": 900,+ "theme": "light",+ "innerWidth": 1440,+ "innerHeight": 900,+ "scrollWidth": 1440,+ "scrollHeight": 900,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1131,+ "diagramWidth": 1101,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.120452708164915,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light",+ "file": "maka-regenerated.workflow.visual-check.1440x900.light.png"+ },+ {+ "width": 1440,+ "height": 900,+ "theme": "dark",+ "innerWidth": 1440,+ "innerHeight": 900,+ "scrollWidth": 1440,+ "scrollHeight": 900,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1131,+ "diagramWidth": 1101,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 7.120452708164915,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "dark",+ "file": "maka-regenerated.workflow.visual-check.1440x900.dark.png"+ },+ {+ "width": 2048,+ "height": 1320,+ "theme": "light",+ "innerWidth": 2048,+ "innerHeight": 1320,+ "scrollWidth": 2048,+ "scrollHeight": 1320,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1792,+ "diagramWidth": 1742,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "light",+ "file": "maka-regenerated.workflow.visual-check.2048x1320.light.png"+ },+ {+ "width": 2048,+ "height": 1320,+ "theme": "dark",+ "innerWidth": 2048,+ "innerHeight": 1320,+ "scrollWidth": 2048,+ "scrollHeight": 1320,+ "overflowX": false,+ "overflowY": false,+ "ok": true,+ "readerWidth": 1792,+ "diagramWidth": 1742,+ "viewBoxWidth": 1237,+ "minimumProjectedNodeTextPx": 8,+ "minimumProjectedNodeText": "Desktop / CLI",+ "minimumProjectedNodeTextDetail": "context",+ "minimumRequiredNodeTextPx": 6,+ "readabilityOk": true,+ "hasLegend": true,+ "hasNavigationDock": true,+ "legendDockIntersectionArea": 0,+ "viewerChromeReserve": 0,+ "viewerChromeActive": false,+ "viewerChromeOk": true,+ "resolvedTheme": "dark",+ "file": "maka-regenerated.workflow.visual-check.2048x1320.dark.png"+ }+ ],+ "contactSheet": "maka-regenerated.workflow.visual-check.html"+ },+ "sidecars": {+ "receipt": "maka-regenerated.workflow.visual-check.json",+ "contactSheet": "maka-regenerated.workflow.visual-check.html"+ }+}diff --git a/scripts/build-gallery.mjs b/scripts/build-gallery.mjsindex 427ee5a7..36d71f5b 100644--- a/scripts/build-gallery.mjs+++ b/scripts/build-gallery.mjs@@ -28,8 +28,8 @@ const CASES = [featured: true,titleEn: 'Agent Tool Call',titleZh: '智能体工具调用',- descriptionEn: 'A policy-aware agent loop with planning, approval, tool execution, exception handling, and observability lanes.',- descriptionZh: '包含规划、审批、工具执行、异常处理与可观测泳道的策略感知智能体闭环。',+ descriptionEn: 'Four consolidated lanes trace a policy-aware agent loop across user interaction, agent runtime, policy and recovery, and tool execution with evidence.',+ descriptionZh: '四条整合泳道呈现策略感知的智能体闭环:用户交互、智能体运行时、策略与恢复,以及带证据的工具执行。',},{id: 'deployment-ownership',diff --git a/scripts/package-smoke.mjs b/scripts/package-smoke.mjsindex 76847d03..e5771f84 100644--- a/scripts/package-smoke.mjs+++ b/scripts/package-smoke.mjs@@ -202,6 +202,49 @@ try {}}+ const workflowLayout = JSON.parse(run([+ 'validate', 'workflow', path.join(skillRoot, 'examples', fixtures[1][1]),+ '--layout-json', '--quality', 'showcase',+ ]));+ if (workflowLayout.contract !== 'readable-v2'+ || workflowLayout.columns?.length !== 6+ || workflowLayout.diagnostics?.length !== 0) {+ throw new Error('packaged workflow compiler did not expose a passing readable-v2 layout receipt');+ }++ const legacyWorkflow = {+ schema_version: 1,+ diagram_type: 'workflow',+ meta: { title: 'Package migration smoke', viewBox: [720, 400], legend: { mode: 'hidden' } },+ lanes: [{ id: 'main', label: 'Main' }],+ nodes: [+ { id: 'source', lane: 'main', col: 0, type: 'frontend', label: 'Source' },+ { id: 'target', lane: 'main', col: 2, type: 'backend', label: 'Target' },+ ],+ edges: [{ id: 'flow', from: 'source', to: 'target', label: 'request' }],+ };+ const legacyWorkflowPath = path.join(scratch, 'legacy.workflow.json');+ const migratedWorkflowPath = path.join(scratch, 'migrated.workflow.json');+ const migratedAgainPath = path.join(scratch, 'migrated-again.workflow.json');+ fs.writeFileSync(legacyWorkflowPath, `${JSON.stringify(legacyWorkflow, null, 2)}\n`);+ const migrationReceipt = JSON.parse(run([+ 'migrate', 'workflow', legacyWorkflowPath, migratedWorkflowPath,+ '--to-schema', '2', '--json',+ ]));+ if (!migrationReceipt.ok || migrationReceipt.fromSchemaVersion !== 1+ || migrationReceipt.toSchemaVersion !== 2 || !fs.existsSync(migratedWorkflowPath)) {+ throw new Error('packaged workflow migrator did not produce a schema-v2 destination');+ }+ const idempotenceReceipt = JSON.parse(run([+ 'migrate', 'workflow', migratedWorkflowPath, migratedAgainPath,+ '--to-schema', '2', '--json',+ ]));+ if (!idempotenceReceipt.ok || idempotenceReceipt.fromSchemaVersion !== 2+ || idempotenceReceipt.source?.sha256 !== idempotenceReceipt.destination?.sha256+ || !fs.readFileSync(migratedWorkflowPath).equals(fs.readFileSync(migratedAgainPath))) {+ throw new Error('packaged workflow migrator did not preserve byte-identical v2 idempotence');+ }+const deployment = path.join(scratch, 'deployment.html');run(['render', 'architecture', path.join(skillRoot, 'examples', fixtures[0][1]), deployment]);run(['check', deployment]);