"use strict"; let registry = []; let champions = []; const sectorUseCases = { tourism: [ { title: "Supplier and booking request routing", description: "Classify multilingual requests, retrieve the relevant reservation or supplier record, and route the proposed action to a staff member for approval.", tasks: ["agent"] }, { title: "Disruption triage across properties", description: "Coordinate cancellations, late arrivals, maintenance incidents, and supplier disruptions across shared property systems.", tasks: ["agent"] }, { title: "Multilingual service operations", description: "Summarise incoming messages, retain citations to the original request, and prepare a reviewed response in the guest or supplier language.", tasks: ["docs", "agent"] } ], manufacturing: [ { title: "Human-supervised visual quality inspection", description: "Flag likely defects on the production line while keeping acceptance and rejection decisions with trained operators.", tasks: ["vision"] }, { title: "Inspection evidence and rework analysis", description: "Link inspection images to acceptance criteria and production records to identify repeat causes of rework.", tasks: ["docs"] } ], logistics: [ { title: "Shipment exception routing", description: "Detect delayed or incomplete shipments and assign each case to the correct operational team with an auditable reason.", tasks: ["agent"] }, { title: "Freight document triage", description: "Classify multilingual freight documents, identify missing evidence, and prepare cases for human review.", tasks: ["docs"] } ], public: [ { title: "Citation-backed permit review", description: "Retrieve the applicable rules and evidence for a permit case while leaving the accountable decision with a public official.", tasks: ["docs"] }, { title: "Case-file completeness checks", description: "Identify missing documents and conflicting information before a case enters the formal assessment workflow.", tasks: ["docs", "agent"] } ] }; const labels = { task: { all: "Any capability", docs: "Document intelligence", audio: "Speech transcription", vision: "Visual inspection", agent: "Workflow agent" }, sector: { tourism: "Tourism and hospitality", manufacturing: "Manufacturing", logistics: "Transport and logistics", public: "Public services" }, deployment: { all: "Any verified deployment", local: "Company-controlled infrastructure", eu: "Managed inference in the EU" }, language: { all: "Any language", multi: "Multilingual", fr: "French", nl: "Dutch", de: "German" }, assurance: { standard: "Standard business use", sensitive: "Sensitive operational data" } }; const form = document.querySelector("#search-form"); const task = document.querySelector("#task"); const sector = document.querySelector("#sector"); const deployment = document.querySelector("#deployment"); const language = document.querySelector("#language"); const assurance = document.querySelector("#assurance"); const requirement = document.querySelector("#requirement"); const results = document.querySelector("#results"); const resultCount = document.querySelector("#result-count"); const championRecommendationsPanel = document.querySelector("#champion-recommendations"); const brief = document.querySelector("#build-brief"); const actionMessage = document.querySelector("#action-message"); function valueLabel(group, value) { return labels[group][value] || value; } function escapeHtml(value) { return String(value).replace(/[&<>"']/g, character => ({ "&": "&", "<": "<", ">": ">", "\"": """, "'": "'" })[character]); } function findMatches() { return registry.filter(tool => (task.value === "all" || tool.tasks.includes(task.value)) && (deployment.value === "all" || tool.deployment.includes(deployment.value)) && (language.value === "all" || tool.languages.includes(language.value)) && tool.assurance.includes(assurance.value) ); } function recommendedChampions() { const exact = champions.filter(champion => champion.sectors.includes(sector.value) && (task.value === "all" || champion.tasks.includes(task.value))); const related = champions.filter(champion => !exact.includes(champion) && (champion.sectors.includes(sector.value) || task.value === "all" || champion.tasks.includes(task.value)) ); return [...exact, ...related].slice(0, 2); } function moreUseCases() { const useCases = sectorUseCases[sector.value] || []; return `
Show more use cases${useCases.length} in this sector
${useCases.map(useCase => `
${useCase.title}

${useCase.description}

`).join("")}
`; } function championRecommendations() { const recommendations = recommendedChampions(); const capabilityLabel = valueLabel("task", task.value); const sectorLabel = valueLabel("sector", sector.value); const requirementText = requirement.value.trim() || "Define the operational problem this tool should address."; return `
03

Implementation champions

${recommendations.length} source-backed recommendations

Use case ${escapeHtml(capabilityLabel)} for ${escapeHtml(sectorLabel)}

${escapeHtml(requirementText)}

${moreUseCases()}

European organizations with a named public implementation reference. Open the source to assess transferability.

${recommendations.map((champion, index) => `
${champion.company}${champion.country}
${champion.implementation}${champion.evidence.publisher} · ${champion.evidence.level === "case_study" ? "case study" : "public reference"}
${champion.outcome}
View evidence
`).join("")}
`; } function renderChampionRecommendations() { championRecommendationsPanel.innerHTML = championRecommendations(); } function renderMatches(matches) { brief.hidden = true; actionMessage.textContent = ""; resultCount.textContent = `${matches.length} European ${matches.length === 1 ? "capability" : "capabilities"} meet the requirement`; results.innerHTML = `
EU/EEA stewardship is source-backed. GitHub activity, licence, release, and security signals are refreshed by the catalogue scanner; review flags remain visible.
${matches.map(tool => ` `).join("")}
CapabilityDeploymentLicenceStatus
${tool.name}${tool.description}${tool.steward.country} · ${tool.github_metrics.stars.toLocaleString()} GitHub stars · evidence score ${tool.verification.score}/100 ${tool.deployment.includes("local") ? "Company controlled" : "EU managed"} ${tool.licence} ${tool.maturity}
Reviewed ${tool.verification.reviewed_at}
`; results.querySelectorAll(".row-action").forEach(button => button.addEventListener("click", () => { const selected = button.classList.toggle("selected"); button.textContent = selected ? "Shortlisted" : "Shortlist"; })); renderChampionRecommendations(); } function renderNoMatch() { brief.hidden = true; actionMessage.textContent = ""; resultCount.textContent = "No catalogued European capability meets all requirements"; results.innerHTML = `

Capability gap identified

Do not force-fit an unsuitable tool. Convert this requirement into a reusable open build.

Requirement submitted

Capability
${valueLabel("task", task.value)}
Sector
${valueLabel("sector", sector.value)}
Deployment
${valueLabel("deployment", deployment.value)}
Language
${valueLabel("language", language.value)}
Assurance
${valueLabel("assurance", assurance.value)}

The Commons can validate shared demand, commission an open implementation, and publish the resulting assets for reuse.

`; document.querySelector("#create-brief").addEventListener("click", createBuildBrief); renderChampionRecommendations(); } function createBuildBrief() { document.querySelector("#brief-need").textContent = requirement.value.trim() || "Operational need to be validated with participating companies."; document.querySelector("#brief-capability").textContent = valueLabel("task", task.value); document.querySelector("#brief-sector").textContent = valueLabel("sector", sector.value); document.querySelector("#brief-deployment").textContent = valueLabel("deployment", deployment.value); document.querySelector("#brief-language").textContent = valueLabel("language", language.value); document.querySelector("#brief-assurance").textContent = valueLabel("assurance", assurance.value); document.querySelector("#brief-champion-list").innerHTML = recommendedChampions().map(champion => `
${champion.company}${champion.outcome} · ${champion.evidence.publisher}
` ).join(""); brief.hidden = false; brief.scrollIntoView({ behavior: "smooth", block: "start" }); } function runSearch(event) { if (event) event.preventDefault(); const matches = findMatches(); if (matches.length) renderMatches(matches); else renderNoMatch(); } form.addEventListener("submit", runSearch); sector.addEventListener("change", runSearch); document.querySelector("#copy-brief").addEventListener("click", async () => { const text = [ "OPEN EU COMMONS — BUILD BRIEF OAC-2026-014", `Need: ${document.querySelector("#brief-need").textContent}`, `Capability: ${document.querySelector("#brief-capability").textContent}`, `Sector: ${valueLabel("sector", sector.value)}`, `Deployment: ${document.querySelector("#brief-deployment").textContent}`, `Language: ${document.querySelector("#brief-language").textContent}`, `Assurance: ${document.querySelector("#brief-assurance").textContent}`, `Source-backed implementation examples: ${recommendedChampions().map(champion => champion.company).join(", ")}`, "Public contribution scenario: up to €420,000", "Delivery: problem validation, working reference, independent pilot, public release." ].join("\n"); try { await navigator.clipboard.writeText(text); actionMessage.textContent = "Build brief copied."; } catch (_) { actionMessage.textContent = "Copy unavailable in this browser."; } }); document.querySelector("#register-demand").addEventListener("click", () => { const calls = document.querySelector("#open-calls"); calls.textContent = String(Number(calls.textContent) + 1); actionMessage.textContent = "Demand signal registered for validation."; }); async function loadCatalogue() { resultCount.textContent = "Loading the European catalogue"; try { const response = await fetch("data/catalogue.json", { cache: "no-store" }); if (!response.ok) throw new Error(`Catalogue request failed: ${response.status}`); const catalogue = await response.json(); registry = catalogue.projects; champions = catalogue.champions; document.querySelector("#verified-packages").textContent = String(catalogue.summary.verified_projects); document.querySelector("#catalogued-packages").textContent = String(catalogue.summary.projects); document.querySelector("#discovery-candidates").textContent = String(catalogue.summary.discovery_candidates); document.querySelector("#last-review").textContent = catalogue.generated_at.slice(0, 10); runSearch(); } catch (error) { resultCount.textContent = "Catalogue unavailable"; results.innerHTML = `

Could not load catalogue

${error.message}

`; championRecommendationsPanel.innerHTML = `
03

Implementation champions

Recommendations unavailable

`; } } loadCatalogue();