@kanonak-protocol/sdk 3.44.9 → 3.44.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4FR4GLUX.js +116 -0
- package/dist/index.js +1 -1
- package/dist/look/LookRenderer.d.ts +8 -0
- package/dist/transformations/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-G44YB2H2.js +0 -116
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import{a as ke}from"./chunk-NIGFQYVA.js";import{a as se,c as Me}from"./chunk-FMYLEPMC.js";import{c as ee,d as P,g as X,h as $e,i as je,j as V,k as ue,l as D}from"./chunk-W6T7MOKY.js";function Be(f){let e=f.replace(/\r\n/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`),t=[],n=0;for(;n<e.length;){let s=e[n];if(s.trim()===""){n++;continue}let a=/^(\s*)```(\S*)\s*$/.exec(s);if(a){let i=a[2],c=[];for(n++;n<e.length&&!/^(\s*)```\s*$/.test(e[n]);)c.push(e[n]),n++;n++;let l=De(c.join(`
|
|
4
|
+
`)),p=i?` class="language-${He(i)}"`:"";t.push(`<pre><code${p}>${l}</code></pre>`);continue}let r=/^(#{1,6})\s+(.*)$/.exec(s);if(r){let i=r[1].length,c=ge(r[2].trim());t.push(`<h${i}>${c}</h${i}>`),n++;continue}if(s.includes("|")&&n+1<e.length&&Ve(e[n+1])){let i=we(s),c=on(e[n+1]);n+=2;let l=[];for(;n<e.length&&e[n].trim()!==""&&e[n].includes("|");)l.push(we(e[n])),n++;t.push(cn(i,c,l));continue}if(/^\s*[-*]\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*[-*]\s+/.test(e[n]);){let c=[e[n].replace(/^\s*[-*]\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ge(c.join(" ").trim())}</li>`)}t.push(`<ul>
|
|
5
|
+
${i.join(`
|
|
6
|
+
`)}
|
|
7
|
+
</ul>`);continue}if(/^\s*\d+\.\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*\d+\.\s+/.test(e[n]);){let c=[e[n].replace(/^\s*\d+\.\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*\d+\.\s+/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ge(c.join(" ").trim())}</li>`)}t.push(`<ol>
|
|
8
|
+
${i.join(`
|
|
9
|
+
`)}
|
|
10
|
+
</ol>`);continue}let o=[s];for(n++;n<e.length&&e[n].trim()!==""&&!/^(#{1,6})\s+/.test(e[n])&&!/^(\s*)```/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n])&&!(e[n].includes("|")&&n+1<e.length&&Ve(e[n+1]));)o.push(e[n]),n++;t.push(`<p>${ge(o.join(" "))}</p>`)}return t.join(`
|
|
11
|
+
`)}function Ve(f){return f.includes("-")?/^[\s|:-]+$/.test(f):!1}function we(f){let e=f.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function on(f){return we(f).map(e=>{let t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function cn(f,e,t){let n=r=>{let o=e[r];return o?` style="text-align:${o}"`:""},s=f.map((r,o)=>`<th${n(o)}>${ge(r)}</th>`).join(""),a=t.map(r=>`<tr>${r.map((i,c)=>`<td${n(c)}>${ge(i)}</td>`).join("")}</tr>`).join(`
|
|
12
|
+
`);return`<table>
|
|
13
|
+
<thead><tr>${s}</tr></thead>
|
|
14
|
+
<tbody>
|
|
15
|
+
${a}
|
|
16
|
+
</tbody>
|
|
17
|
+
</table>`}function ge(f){let e=De(f);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,s)=>`<a href="${He(s)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,s)=>`${n}<em>${s}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,s)=>`${n}<em>${s}</em>`),e}function De(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function He(f){return f.replace(/"/g,""").replace(/&/g,"&")}var ye={publisher:"kanonak.org",package_:"derivation",name:"look"},xe={publisher:"kanonak.org",package_:"derivation",name:"tokens"},ae={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},N={publisher:"kanonak.org",package_:"core-rdf",name:"label"},he={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},ln={publisher:"kanonak.org",package_:"look",name:"Hero"},un={publisher:"kanonak.org",package_:"look",name:"PropertyList"},dn={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},pn={publisher:"kanonak.org",package_:"look",name:"ChipRow"},fn={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},kn={publisher:"kanonak.org",package_:"look",name:"ReferencedBy"},Ge={publisher:"kanonak.org",package_:"look",name:"Markdown"},ve={publisher:"kanonak.org",package_:"look",name:"NavGroup"},Ue={publisher:"kanonak.org",package_:"look",name:"NavLink"},We={publisher:"kanonak.org",package_:"look",name:"target"},gn={publisher:"kanonak.org",package_:"look",name:"ResourceGrid"},hn={publisher:"kanonak.org",package_:"look",name:"Timeline"},mn={publisher:"kanonak.org",package_:"look",name:"VersionDiff"},bn={publisher:"kanonak.org",package_:"look",name:"Figure"},$n={publisher:"kanonak.org",package_:"look",name:"StatRow"},jn={publisher:"kanonak.org",package_:"look",name:"Horizon"},vn={publisher:"kanonak.org",package_:"look",name:"PackageContents"},Le={publisher:"kanonak.org",package_:"core-kanonak",name:"Package"},_n={publisher:"kanonak.org",package_:"look",name:"FeaturedResource"},Rn={publisher:"kanonak.org",package_:"look",name:"PublisherPackages"},Sn={publisher:"kanonak.org",package_:"look",name:"PublisherView"},Kn={publisher:"kanonak.org",package_:"look",name:"Distribution"},yn={publisher:"kanonak.org",package_:"look",name:"alphaPath"},xn={publisher:"kanonak.org",package_:"look",name:"betaPath"},ze={publisher:"kanonak.org",package_:"look",name:"SectionHeading"},Ln={publisher:"kanonak.org",package_:"look",name:"SectionNav"},Ye={publisher:"kanonak.org",package_:"look",name:"heading"},On={publisher:"kanonak.org",package_:"look",name:"note"},wn={publisher:"kanonak.org",package_:"look",name:"VersionDelta"},Un={publisher:"kanonak.org",package_:"look",name:"TimePlot"},Fn={publisher:"kanonak.org",package_:"look",name:"Details"},In={publisher:"kanonak.org",package_:"look",name:"skip"},En={publisher:"kanonak.org",package_:"derivation",name:"derivations"},Tn={publisher:"kanonak.org",package_:"look",name:"laneBy"},Pn={publisher:"kanonak.org",package_:"look",name:"stats"},Cn={publisher:"kanonak.org",package_:"look",name:"statPath"},An={publisher:"kanonak.org",package_:"look",name:"statLabel"},qe={publisher:"kanonak.org",package_:"look",name:"labelPath"},Nn={publisher:"kanonak.org",package_:"look",name:"badgePath"},Fe={publisher:"kanonak.org",package_:"look",name:"orderBy"},Je={publisher:"kanonak.org",package_:"look",name:"track"},_e={publisher:"kanonak.org",package_:"look",name:"metricPath"},Ie={publisher:"kanonak.org",package_:"look",name:"hueBy"},Ze={publisher:"kanonak.org",package_:"look",name:"lowerPath"},Xe={publisher:"kanonak.org",package_:"look",name:"upperPath"},Mn={publisher:"kanonak.org",package_:"look",name:"axisMin"},Vn={publisher:"kanonak.org",package_:"look",name:"axisMax"},Bn={publisher:"kanonak.org",package_:"look",name:"valueLabel"};var Qe={publisher:"kanonak.org",package_:"look",name:"semanticSvg"},Dn={publisher:"kanonak.org",package_:"look",name:"tierChip"},Hn={publisher:"kanonak.org",package_:"look",name:"tierIcon"},Gn={publisher:"kanonak.org",package_:"look",name:"tierCard"},Wn={publisher:"kanonak.org",package_:"look",name:"tierFull"},zn={publisher:"kanonak.org",package_:"core-rdf",name:"type"},Ee={publisher:"kanonak.org",package_:"look",name:"bands"},Yn={publisher:"kanonak.org",package_:"look",name:"title"},qn={publisher:"kanonak.org",package_:"look",name:"eyebrow"},Jn={publisher:"kanonak.org",package_:"look",name:"subtitle"},en={publisher:"kanonak.org",package_:"look",name:"badges"},J={publisher:"kanonak.org",package_:"look",name:"source"},Zn={publisher:"kanonak.org",package_:"look",name:"via"},Xn={publisher:"kanonak.org",package_:"look",name:"size"},Qn={publisher:"kanonak.org",package_:"look",name:"icon"},et={publisher:"kanonak.org",package_:"look",name:"chips"},Te={publisher:"kanonak.org",package_:"look",name:"entries"},nt={publisher:"kanonak.org",package_:"look",name:"urlForm"},Ne=class{constructor(e){this.catalog=e}catalog;findCascadedLook(e){let t=Re(e);if(t)return{declaration:t,sourceClass:{publisher:C(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name}};let n=new Set,s=de(e);for(;s.length>0;){let a=s.shift(),r=tt(a.subject),o=Q(r);if(n.has(o))continue;n.add(o);let i=re(this.catalog,r);for(let c of i){let l=Re(c);if(l)return{declaration:l,sourceClass:{publisher:r.publisher,package_:r.package_,name:r.name}}}for(let c of i)for(let l of Se(c))s.push(l)}if(!n.has(Q(ae)))for(let a of re(this.catalog,ae)){let r=Re(a);if(r)return{declaration:r,sourceClass:{...ae}}}}findCascadedTokens(e){let t=new Map;for(let[a,r]of Pe(e))t.has(a)||t.set(a,r);let n=new Set,s=de(e);for(;s.length>0;){let a=s.shift(),r=Q(a.subject);if(n.has(r))continue;n.add(r);let o=re(this.catalog,a.subject);if(o.length!==0)for(let i of o){for(let[c,l]of Pe(i))t.has(c)||t.set(c,l);for(let c of Se(i))s.push(c)}}if(!n.has(Q(ae))){let a=re(this.catalog,ae);for(let r of a)for(let[o,i]of Pe(r))t.has(o)||t.set(o,i)}return t}renderSvg(e){let t=b(e,N)??e.name,n=(t.trim().charAt(0)||"?").toUpperCase(),s=`${e.namespace??""}/${e.name}`,a={label:t,firstLetter:n,uri:s},r=this.collectCascadedSvgTiers(e),o=h=>this.applyPlaceholders(h,e,a),i=o(r.tierChip??""),c=o(r.tierIcon??""),l=o(r.tierCard??""),p=o(r.tierFull??""),k=[...this.findCascadedTokens(e)].map(([h,g])=>`--kan-${h}: ${g};`).join(" ");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" style="${oe(k)}">
|
|
18
|
+
<style>
|
|
19
|
+
.tier-chip,.tier-icon,.tier-card{display:none}
|
|
20
|
+
.tier-full{display:block}
|
|
21
|
+
@media (max-width:400px){.tier-full{display:none}.tier-card{display:block}}
|
|
22
|
+
@media (max-width:160px){.tier-card{display:none}.tier-icon{display:block}}
|
|
23
|
+
@media (max-width:60px){.tier-icon{display:none}.tier-chip{display:block}}
|
|
24
|
+
</style>
|
|
25
|
+
<g class="tier-chip">${i}</g>
|
|
26
|
+
<g class="tier-icon">${c}</g>
|
|
27
|
+
<g class="tier-card">${l}</g>
|
|
28
|
+
<g class="tier-full">${p}</g>
|
|
29
|
+
</svg>`}applyPlaceholders(e,t,n){return e.replace(/\{\{([^}]+)\}\}/g,(s,a)=>{let r=a.trim();if(n[r]!==void 0)return oe(n[r]);let o=r.indexOf(":");if(o>0){let c=r.slice(0,o),l=r.slice(o+1).trim();if(c==="delta"||c==="deltaArrow"||c==="deltaColor"||c==="deltaDir"){let p=this.metricDelta(t,l);return c==="deltaColor"?p?p.dir==="up"?"#34d399":p.dir==="down"?"#f87171":"#9aa5b8":"#9aa5b8":c==="deltaDir"?p?p.dir:"new":p?c==="deltaArrow"?p.dir==="up"?"\u25B2":p.dir==="down"?"\u25BC":"\u2014":oe(`${p.delta>0?"+":""}${p.delta.toFixed(2)}`):""}if(c==="svg")return this.resolvePath(t,l)??""}let i=this.resolvePath(t,r);return i===void 0?`{{${r}}}`:oe(i)})}metricDelta(e,t){let n=k=>{let h=this.resolvePath(k,t),g=h===void 0?NaN:parseFloat(h);return Number.isFinite(g)?g:void 0},s=n(e);if(s===void 0)return;let a=k=>this.parseVersion((k.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},r=(k,h)=>k.major-h.major||k.minor-h.minor||k.patch-h.patch,o={publisher:C(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name},i=a(e),c,l;for(let k of re(this.catalog,o)){let h=a(k);r(h,i)<0&&(!l||r(h,l)>0)&&(c=k,l=h)}if(!c)return;let p=n(c);if(p===void 0)return;let u=s-p;return{delta:u,dir:Math.abs(u)<.005?"flat":u>0?"up":"down"}}resolvePath(e,t){let n=t.split("/").map(s=>s.trim()).filter(s=>s.length>0);if(n.length!==0)return this.resolvePathSteps(e,n)}resolvePathSteps(e,t){let n=st(t[0]),s=at(e,n);if(!s)return;let a=t.length===1;if(s instanceof ue)return a?void 0:this.resolvePathSteps(s.object,t.slice(1));if(s instanceof V&&s.object instanceof P){let r=s.object.subject,o=re(this.catalog,r);if(o.length===0){let c=H(this.catalog,r);c&&o.push(c)}if(a){for(let c of o){let l=b(c,N);if(l!==void 0)return l}return r.name}let i=t.slice(1);for(let c of o){let l=this.resolvePathSteps(c,i);if(l!==void 0)return l}return}if(a&&(s instanceof X||s instanceof $e||s instanceof je))return String(s.object)}collectCascadedSvgTiers(e){let t={},n=r=>{let o=ne(r,Qe);if(!(o instanceof ue))return;let i=o.object,c=b(i,Dn),l=b(i,Hn),p=b(i,Gn),u=b(i,Wn);t.tierChip===void 0&&c!==void 0&&(t.tierChip=c),t.tierIcon===void 0&&l!==void 0&&(t.tierIcon=l),t.tierCard===void 0&&p!==void 0&&(t.tierCard=p),t.tierFull===void 0&&u!==void 0&&(t.tierFull=u)};n(e);let s=new Set,a=de(e);for(;a.length>0;){let r=a.shift(),o=Q(r.subject);if(s.has(o))continue;s.add(o);let i=re(this.catalog,r.subject);for(let c of i){n(c);for(let l of Se(c))a.push(l)}}if(!s.has(Q(ae)))for(let r of re(this.catalog,ae))n(r);return t}renderStylesheet(e){let t=this.findCascadedTokens(e),n=[];for(let[r,o]of t)n.push(` --kan-${r}: ${o};`);let s=n.length>0?`:root {
|
|
30
|
+
${n.join(`
|
|
31
|
+
`)}
|
|
32
|
+
}`:":root { /* no tokens resolved */ }",a=this.findBaseStylesheet(C(e))??"";return`${s}
|
|
33
|
+
${a}`}findBaseStylesheet(e){let t="kanonak.org/site/content",n,s;for(let r of this.catalog){if(!(r instanceof ee)||r.name!=="base-stylesheet")continue;let o=r.namespace||"";o.startsWith(`${e}/look-styles@`)?n=r:o.startsWith("kanonak.org/look-styles@")&&(s=r)}let a=n??s;if(a)for(let r of a.statement){let o=r.predicate?.subject;if(!o)continue;if(`${o.publisher}/${o.package_}/${o.name}`===t&&r instanceof X)return r.object}}renderHtml(e){let t=this.findCascadedLook(e);if(!t)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let n=nn(t.declaration);if(n.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let s=C(e),a=this.collectSectionHeadings(n),r=[];for(let o of n)r.push(this.renderBand(o,e,s,a));return r.join(`
|
|
34
|
+
`)}collectSectionHeadings(e){let t=[];for(let n of e){let s=me(n);if(!s||!R(s,ze))continue;let a=b(n,Ye);a&&t.push({slug:sn(a),label:a})}return t}renderPublisherIndex(e,t,n){let s=n?this.renderNavGroup(n,e):"",a=t.map(o=>{let i=o.comment?`<p class="kan-resource-card-subtitle">${d(o.comment)}</p>`:"";return`<a class="kan-resource-card" href="${d(o.href)}"><h3 class="kan-resource-card-title">${d(o.label)}</h3>${i}</a>`}).join(`
|
|
35
|
+
`),r=`<header class="kan-hero">
|
|
36
|
+
<h1 class="kan-hero-title">${d(e)}</h1>
|
|
37
|
+
</header>
|
|
38
|
+
<section class="kan-resource-grid">
|
|
39
|
+
${a}
|
|
40
|
+
</section>`;return`<!doctype html>
|
|
41
|
+
<html lang="en">
|
|
42
|
+
<head>
|
|
43
|
+
<meta charset="utf-8">
|
|
44
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
45
|
+
<title>${d(e)}</title>
|
|
46
|
+
<link rel="stylesheet" href="index.css">
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
${s}
|
|
50
|
+
<main class="kan-main">
|
|
51
|
+
${r}
|
|
52
|
+
</main>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
55
|
+
`}renderPublisherIndexStylesheet(e){return e?this.renderStylesheet(e):""}hasDeclaredView(e){let t=this.findCascadedLook(e);return t?!(s=>s.publisher===ae.publisher&&s.package_===ae.package_&&s.name===ae.name||s.publisher===Le.publisher&&s.package_===Le.package_&&s.name===Le.name)(t.sourceClass):!1}renderPackageVersionList(e,t,n){let s=C(n),a=this.renderNavGroup(n,s),r=this.renderBreadcrumb(n,s,{bareOverview:!0}),o=t.map(c=>`<a class="kan-resource-card" href="/${d(e)}/${d(c)}/"><h3 class="kan-resource-card-title">${d(c)}</h3></a>`).join(`
|
|
56
|
+
`),i=`<header class="kan-hero">
|
|
57
|
+
<span class="kan-hero-eyebrow">PACKAGE</span>
|
|
58
|
+
<h1 class="kan-hero-title">${d(e)}</h1>
|
|
59
|
+
</header>
|
|
60
|
+
<section class="kan-resource-grid">
|
|
61
|
+
${o}
|
|
62
|
+
</section>`;return`<!doctype html>
|
|
63
|
+
<html lang="en">
|
|
64
|
+
<head>
|
|
65
|
+
<meta charset="utf-8">
|
|
66
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
67
|
+
<title>${d(e)}</title>
|
|
68
|
+
<link rel="stylesheet" href="${d(n.name)}.css">
|
|
69
|
+
</head>
|
|
70
|
+
<body>
|
|
71
|
+
${a}
|
|
72
|
+
${r}
|
|
73
|
+
<main class="kan-main">
|
|
74
|
+
${i}
|
|
75
|
+
</main>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|
|
78
|
+
`}renderDocument(e,t){let n=this.renderHtml(e),s=this.readPropertyValueText(e,N)??e.name,a=t?.rootIndex?"index.css":`${e.name}.css`,r=!t?.rootIndex&&this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${d(e.name)}.svg" alt=""></figure>
|
|
79
|
+
`:"",o=C(e),i=this.renderNavGroup(e,o),c=t?.rootIndex?"":this.renderBreadcrumb(e,o,t);return`<!doctype html>
|
|
80
|
+
<html lang="en">
|
|
81
|
+
<head>
|
|
82
|
+
<meta charset="utf-8">
|
|
83
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
84
|
+
<title>${d(s)}</title>
|
|
85
|
+
<link rel="stylesheet" href="${d(a)}">
|
|
86
|
+
</head>
|
|
87
|
+
<body>
|
|
88
|
+
${i}
|
|
89
|
+
${c}
|
|
90
|
+
<main class="kan-main">
|
|
91
|
+
${r}${n}
|
|
92
|
+
</main>
|
|
93
|
+
</body>
|
|
94
|
+
</html>
|
|
95
|
+
`}hasSvgDerivation(e){let t=new Set,n=de(e);for(;n.length>0;){let s=n.shift(),a=Q(s.subject);if(t.has(a))continue;t.add(a);let r=H(this.catalog,s.subject);if(r){for(let o of r.statement)if(o instanceof D&&ie(o,"kanonak.org","derivation","derivations")){for(let i of o.object??[])if(i instanceof se)for(let c of i.statement){if(!(c instanceof V)||!ie(c,"kanonak.org","derivation","format")||!(c.object instanceof P))continue;let l=c.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let o of Se(r))n.push(o)}}return!1}renderBand(e,t,n,s=[]){let a=me(e);return a?R(a,Ln)?this.renderSectionNav(s):R(a,ln)?this.renderHero(e,t,n):R(a,un)?this.renderPropertyList(e,t,n):R(a,dn)?this.renderBadgeRow(e,t,n):R(a,pn)?this.renderChipRow(e,t,n):R(a,fn)?this.renderReferenceList(e,t,n):R(a,kn)?this.renderReferencedBy(e,t,n):R(a,Ge)?this.renderMarkdown(e,t,n):R(a,ve)?this.renderNavGroup(t,n):R(a,gn)?this.renderResourceGrid(e,n,t):R(a,hn)?this.renderTimeline(e,n):R(a,mn)?this.renderVersionDiff(e,n):R(a,bn)?this.renderFigure(e,t,n):R(a,$n)?this.renderStatRow(e,t):R(a,jn)?this.renderHorizon(e,t,n):R(a,vn)?this.renderPackageContents(t,n):R(a,_n)?this.renderFeaturedResource(e,n):R(a,Rn)?this.renderPublisherPackages(n):R(a,Kn)?this.renderDistribution(e,t):R(a,ze)?this.renderSectionHeading(e):R(a,wn)?this.renderVersionDelta(e,t):R(a,Un)?this.renderTimePlot(e,t,n):R(a,Fn)?this.renderDetails(e,t,n):`<!-- LookRenderer: unsupported band ${a.publisher}/${a.package_}/${a.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}collectTrackedSeries(e,t,n,s){let{hueBy:a,lowerPath:r,upperPath:o}=s??{},i=new Map,c=e.length,l=(p,u)=>{let k=this.resolvePath(p,u);return k===void 0?NaN:parseFloat(k)};return e.forEach((p,u)=>{let k=this.readPropertyValueReferences(p,t);for(let h of k){let g=H(this.catalog,{publisher:h.subject.publisher,package_:h.subject.package_,name:h.subject.name,...h.subject.version?{version:h.subject.version}:{}});if(!g)continue;let m=h.subject.name,v=i.get(m);v||(v={key:m,label:b(g,N)??m,points:new Array(c).fill(null),...r?{lower:new Array(c).fill(null)}:{},...o?{upper:new Array(c).fill(null)}:{}},i.set(m,v));let K=l(g,n);if(Number.isFinite(K)&&(v.points[u]=K),r&&v.lower){let _=l(g,r);Number.isFinite(_)&&(v.lower[u]=_)}if(o&&v.upper){let _=l(g,o);Number.isFinite(_)&&(v.upper[u]=_)}if(a){let _=l(g,a);Number.isFinite(_)&&(v.hue=_)}v.lastSubject=g}}),[...i.values()]}hrefForSubject(e,t,n="="){let s=e.namespace||"",a=s.split("/")[1]?.split("@")[0]??"",r=s.split("@")[1]??"",o=r?this.parseVersion(r):void 0;return ke.formatResourceUrl({publisher:C(e),package_:a,name:e.name,...o?{version:o}:{}},n,{contextPublisher:t})}renderVersionDiff(e,t){let n=E(e,J);if(!n)return"<!-- LookRenderer.VersionDiff: no look.source -->";let s=b(e,_e),a=E(e,Je);if(!a||!s)return"<!-- LookRenderer.VersionDiff: needs look.track + look.metricPath -->";let r=E(e,Fe),o=b(e,Ie),i=this.findInstancesOfClass(n);if(i.length===0)return"<!-- LookRenderer.VersionDiff: no instances -->";let c=k=>r?this.readPropertyValueText(k,r)??"":"",l=i.slice().sort((k,h)=>c(k).localeCompare(c(h))),p=this.collectTrackedSeries(l,a,s,{hueBy:o});return p.length===0?"<!-- LookRenderer.VersionDiff: no tracked series -->":`<section class="kan-vdiff">${p.map((k,h)=>{let g=k.hue!==void 0?k.hue:Math.round(h*360/p.length),m=k.points.filter(x=>x!==null);if(m.length===0)return"";let v=m[0],K=m[m.length-1],_=K-v,U;if(Math.abs(_)>=.005){let x=_>0?"up":"down",F=_>0?"\u25B2":"\u25BC";U=`<span class="kan-vdiff-delta ${x}">${_>0?"+":""}${_.toFixed(2)} ${F}</span>`}else U='<span class="kan-vdiff-delta flat">\u2014</span>';let T=k.lastSubject&&this.isLinkable(C(k.lastSubject),t)?`<a href="${d(this.hrefForSubject(k.lastSubject,t))}">${d(k.label)}</a>`:d(k.label);return`<div class="kan-vdiff-row" style="--kan-vdiff-hue:${g}"><span class="kan-vdiff-label">${T}</span><span class="kan-vdiff-start">${v.toFixed(2)}</span>`+this.sparkline(k.points,g)+`<span class="kan-vdiff-end">${K.toFixed(2)}</span>`+U+"</div>"}).join("")}</section>`}sparkline(e,t){let r=`hsl(${t},65%,60%)`,o=e.filter(m=>m!==null);if(o.length===0)return'<svg class="kan-vdiff-spark" viewBox="0 0 132 30" xmlns="http://www.w3.org/2000/svg"></svg>';let i=Math.min(...o),l=Math.max(...o)-i,p=e.length,u=m=>p<=1?132/2:4+m/(p-1)*124,k=m=>l<1e-9?30/2:26-(m-i)/l*22,h=[],g=[];return e.forEach((m,v)=>{if(m===null)return;let K=u(v),_=k(m);h.push(`${K.toFixed(1)},${_.toFixed(1)}`),g.push(`<circle cx="${K.toFixed(1)}" cy="${_.toFixed(1)}" r="2" fill="${r}"/>`)}),`<svg class="kan-vdiff-spark" viewBox="0 0 132 30" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" role="img"><polyline points="${h.join(" ")}" fill="none" stroke="${r}" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>`+g.join("")+"</svg>"}svgUrlForSubject(e,t,n="="){return`${this.hrefForSubject(e,t,n)}.svg`}renderFigure(e,t,n){let s=t,a=E(e,J);if(a){let l=H(this.catalog,a);l&&(s=l)}let r=this.svgUrlForSubject(s,n),o=b(s,N)??s.name,i=b(e,Xn);return`<figure class="kan-figure${i==="small"||i==="medium"||i==="large"?` kan-figure-${i}`:""}"><img class="kan-figure-img" src="${d(r)}" alt="${d(o)}" loading="lazy"/></figure>`}renderStatRow(e,t){let n=ne(e,Pn),s=this.gatherValueItems(n).filter(r=>r instanceof se);if(s.length===0)return"<!-- LookRenderer.StatRow: no look.stats -->";let a=[];for(let r of s){let o=b(r,Cn);if(!o)continue;let i=this.resolvePath(t,o);if(i===void 0)continue;let c=b(r,An)??"";a.push('<div class="kan-stat">'+(c?`<span class="kan-stat-label">${d(c)}</span>`:"")+`<span class="kan-stat-val">${d(i)}</span></div>`)}return a.length===0?"":`<div class="kan-stat-row">${a.join("")}</div>`}renderHorizon(e,t,n){let s=E(e,J);if(!s)return"<!-- LookRenderer.Horizon: no look.source -->";let a=this.gatherValueItems(ne(t,s)).filter(o=>o instanceof se);return a.length===0?"":`<section class="kan-horizon">${a.map(o=>this.renderConditionNode(o,n,0)).join("")}</section>`}renderConditionNode(e,t,n){let s=me(e),a=s?this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name:"Condition",r=[],o=[];for(let u of e.statement){let k=u.predicate?.subject;if(!k||k.name==="type")continue;let h=this.readLabelForUri({publisher:k.publisher,package_:k.package_,name:k.name})??k.name;if(u instanceof X||u instanceof $e||u instanceof je)r.push(`<div class="kan-cond-field"><span class="kan-cond-key">${d(h)}</span><span class="kan-cond-v">${d(String(u.object))}</span></div>`);else if(u instanceof V&&u.object instanceof P){let g=u.object.subject,m=this.readLabelForUri({publisher:g.publisher,package_:g.package_,name:g.name})??g.name;r.push(`<div class="kan-cond-field"><span class="kan-cond-key">${d(h)}</span><span class="kan-cond-v">${d(m)}</span></div>`)}else if(u instanceof ue)o.push(this.renderConditionNode(u.object,t,n+1));else if(u instanceof D)for(let g of u.object??[])g instanceof se&&o.push(this.renderConditionNode(g,t,n+1))}let i=r.length?`<div class="kan-cond-fields">${r.join("")}</div>`:"",c=o.length?`<div class="kan-cond-children">${o.join("")}</div>`:"",l=o.length>0,p=l?`<span class="kan-cond-op">${d(a)}</span>`:`<div class="kan-cond-type">${d(a)}</div>`;return`<div class="kan-cond ${l?"kan-cond-branch":"kan-cond-leaf"}">${p}${i}${c}</div>`}renderSectionHeading(e){let t=e,n=b(t,Ye);if(!n)return"<!-- LookRenderer.SectionHeading: no look.heading -->";let s=b(t,On);return`<div class="kan-section" id="${sn(n)}"><h2 class="kan-section-title">${d(n)}</h2>`+(s?`<p class="kan-section-note">${d(s)}</p>`:"")+"</div>"}renderSectionNav(e){return e.length===0?"<!-- LookRenderer.SectionNav: no section headings in this view -->":`<nav class="kan-section-nav" aria-label="On this page">${e.map(n=>`<a class="kan-section-nav-link" href="#${d(n.slug)}">${d(n.label)}</a>`).join("")}</nav>`}renderVersionDelta(e,t){let s=b(e,_e);if(!s)return"<!-- LookRenderer.VersionDelta: no look.metricPath -->";let a=O=>{let I=this.resolvePath(O,s),G=I===void 0?NaN:parseFloat(I);return Number.isFinite(G)?G:void 0},r=a(t);if(r===void 0)return"";let o=O=>this.parseVersion((O.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},i=(O,I)=>O.major-I.major||O.minor-I.minor||O.patch-I.patch,c={publisher:C(t),package_:(t.namespace||"").split("/")[1]?.split("@")[0]??"",name:t.name},l=o(t),p,u;for(let O of re(this.catalog,c)){let I=o(O);i(I,l)<0&&(!u||i(I,u)>0)&&(p=O,u=I)}if(!p||!u)return'<div class="kan-delta kan-delta-first">First tracked in this version</div>';let k=a(p);if(k===void 0)return"";let h=r-k,g=Math.abs(h)<.005?"flat":h>0?"up":"down",m=g==="up"?"\u25B2":g==="down"?"\u25BC":"\u2014",v=g==="up"?"#34d399":g==="down"?"#f87171":"var(--kan-text-faint)",K=`${u.major}.${u.minor}.${u.patch}`,_=320,U=46,T=14,x=30,F=O=>T+Math.min(1,Math.max(0,O))*(_-2*T),L=F(k),A=F(r),ce=`<svg class="kan-delta-track" viewBox="0 0 ${_} ${U}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${T}" y1="${x}" x2="${_-T}" y2="${x}" class="kan-delta-base"/><line x1="${L.toFixed(1)}" y1="${x}" x2="${A.toFixed(1)}" y2="${x}" stroke="${v}" stroke-width="3"/><circle cx="${L.toFixed(1)}" cy="${x}" r="4" class="kan-delta-prev"/><circle cx="${A.toFixed(1)}" cy="${x}" r="5.5" fill="${v}"/><text x="${L.toFixed(1)}" y="${x-9}" text-anchor="middle" class="kan-delta-tick kan-delta-tick-prev">${k.toFixed(2)}</text><text x="${A.toFixed(1)}" y="${x+17}" text-anchor="middle" class="kan-delta-tick">${r.toFixed(2)}</text></svg>`;return`<div class="kan-delta"><div class="kan-delta-head"><span class="kan-delta-vs">vs ${d(K)}</span><span class="kan-delta-badge ${g}">${h>0?"+":""}${h.toFixed(2)} ${m}</span></div>`+ce+"</div>"}renderTimePlot(e,t,n){let s=E(e,J),a=E(e,Fe);if(!s||!a)return"<!-- LookRenderer.TimePlot: needs look.source + look.orderBy -->";let r=e,o=b(r,Tn),i=b(r,qe),c=[];for(let j of this.readPropertyValueReferences(t,s)){let M=H(this.catalog,{publisher:j.subject.publisher,package_:j.subject.package_,name:j.subject.name,...j.subject.version?{version:j.subject.version}:{}});if(!M)continue;let S=this.readPropertyValueText(M,a)??"",y=Date.parse(S);if(!Number.isFinite(y))continue;let Z=o?this.resolvePath(M,o)??"":"",$=(i?this.resolvePath(M,i):void 0)??b(M,N)??M.name;c.push({t:y,dateStr:S,lane:Z,label:$,href:this.hrefForSubject(M,n),linkable:this.isLinkable(C(M),n)})}if(c.length===0)return"<!-- LookRenderer.TimePlot: no dated points -->";let l=[];for(let j of c)l.includes(j.lane)||l.push(j.lane);let p=Math.min(...c.map(j=>j.t)),u=Math.max(...c.map(j=>j.t));u===p&&(u=p+1);let k=l.some(j=>j),h=720,g=k?96:16,m=18,v=12,K=24,_=36,U=v+l.length*_+K,T=g,x=h-m,F=x-T,L=j=>T+(j-p)/(u-p)*F,A=j=>v+j*_+_/2,ce=j=>Math.round(j*360/Math.max(1,l.length)),O=[];l.forEach((j,M)=>{let S=A(M);O.push(`<line x1="${T}" y1="${S.toFixed(1)}" x2="${x}" y2="${S.toFixed(1)}" class="kan-plot-guide"/>`),j&&O.push(`<text x="${(g-8).toFixed(1)}" y="${(S+4).toFixed(1)}" text-anchor="end" class="kan-plot-lane">${oe(j)}</text>`)});let I={},G=[];for(let j of c){let M=l.indexOf(j.lane),y=((I[j.lane]=(I[j.lane]??0)+1)%3-1)*7,Z=L(j.t),$=A(M)+y,w=`${Ke(j.dateStr)} \xB7 ${j.label}`,W=`<circle cx="${Z.toFixed(1)}" cy="${$.toFixed(1)}" r="5" fill="hsl(${ce(M)},65%,60%)" class="kan-plot-pt"><title>${oe(w)}</title></circle>`;G.push(j.linkable?`<a href="${d(j.href)}" class="kan-plot-link">${W}</a>`:W)}let pe=`<text x="${T}" y="${(U-6).toFixed(1)}" text-anchor="start" class="kan-plot-axis">${oe(Ke(new Date(p).toISOString()))}</text><text x="${x}" y="${(U-6).toFixed(1)}" text-anchor="end" class="kan-plot-axis">${oe(Ke(new Date(u).toISOString()))}</text>`;return`<section class="kan-plot">${`<svg class="kan-plot-svg" viewBox="0 0 ${h} ${U}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+O.join("")+G.join("")+pe+"</svg>"}</section>`}renderDetails(e,t,n){let s=Ce(e,In),a=this.detailRows(t,n,s);return a?`<dl class="kan-details">${a}</dl>`:"<!-- LookRenderer.Details: no properties -->"}detailRows(e,t,n){let s=[];for(let a of e.statement){let r=a.predicate?.subject;if(!r||this.isMetaPredicate(r)||n.some(c=>R(c,r)))continue;let o=this.readLabelForUri({publisher:r.publisher,package_:r.package_,name:r.name})??r.name,i=this.detailValue(a,t,n);i&&s.push(`<dt class="kan-details-key">${d(o)}</dt><dd class="kan-details-val">${i}</dd>`)}return s.join("")}detailValue(e,t,n){if(e instanceof X)return ot(e.object);if(e instanceof $e||e instanceof je)return d(String(e.object));if(e instanceof V&&e.object instanceof P)return this.detailReferenceLink(e.object,t);if(e instanceof ue)return this.detailEmbedded(e.object,t,n);if(e instanceof D){let s=e.object??[];return s.length>0&&s.every(a=>a instanceof se)?s.map(a=>this.detailEmbedded(a,t,n)).join(""):s.map(a=>a instanceof P?this.detailReferenceLink(a,t):a instanceof se?this.detailEmbedded(a,t,n):d(String(a))).filter(a=>a).join(", ")}return""}detailReferenceLink(e,t){let n=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name;if(!this.isLinkable(e.subject.publisher,t))return`<span class="kan-link-plain">${d(n)}</span>`;let s=this.urlForReference(e,void 0,t);return`<img class="kan-md-chip" src="${d(`${s}.svg`)}" alt="" loading="lazy"><a class="kan-link" href="${d(s)}">${d(n)}</a>`}detailEmbedded(e,t,n){let s=me(e),a=s?this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name:"",r=this.detailRows(e,t,n);return'<div class="kan-details-embed">'+(a?`<span class="kan-details-type">${d(a)}</span>`:"")+(r?`<dl class="kan-details">${r}</dl>`:"")+"</div>"}isMetaPredicate(e){return R(e,zn)||R(e,N)||R(e,he)||R(e,ye)||R(e,xe)||R(e,En)||R(e,Qe)}renderPackageContents(e,t){let n=e.namespace||"";if(!n)return"";let s=this.catalog.filter(r=>r instanceof ee&&r.namespace===n&&r.name!==e.name);return s.length===0?`<!-- LookRenderer.PackageContents: no members in ${n} -->`:(s.sort((r,o)=>{let i=b(r,N)??r.name,c=b(o,N)??o.name;return i.localeCompare(c)}),`<section class="kan-pkg-grid">${s.map(r=>{let o=b(r,N)??r.name,i=b(r,he),c=i?Ae(i,160):"",l=this.hrefForSubject(r,t),p=this.svgUrlForSubject(r,t);return`<a class="kan-pkg-card" href="${d(l)}"><img class="kan-pkg-card-svg" src="${d(p)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(o)}</span>`+(c?`<span class="kan-pkg-card-comment">${d(c)}</span>`:"")+"</span></a>"}).join("")}</section>`)}renderReferencedBy(e,t,n){let s=E(e,Zn),a={publisher:C(t),package_:(t.namespace||"").split("/")[1]?.split("@")[0]??"",name:t.name},r=Q(a),o=u=>this.parseVersion((u.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},i=(u,k)=>u.major-k.major||u.minor-k.minor||u.patch-k.patch,c=new Map;for(let u of this.catalog){if(!(u instanceof ee))continue;let k=Q({publisher:C(u),package_:(u.namespace||"").split("/")[1]?.split("@")[0]??"",name:u.name});if(k===r||!this.referencesTarget(u,r,s))continue;let h=c.get(k);(!h||i(o(u),o(h))>0)&&c.set(k,u)}let l=[...c.values()];return l.length===0?"<!-- LookRenderer.ReferencedBy: no incoming references -->":(l.sort((u,k)=>{let h=b(u,N)??u.name,g=b(k,N)??k.name;return h.localeCompare(g)}),`<section class="kan-pkg-grid">${l.map(u=>{let k=b(u,N)??u.name,h=b(u,he),g=h?Ae(h,160):"",m=`<span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(k)}</span>`+(g?`<span class="kan-pkg-card-comment">${d(g)}</span>`:"")+"</span>";if(!this.isLinkable(C(u),n))return`<span class="kan-pkg-card">${m}</span>`;let v=this.hrefForSubject(u,n),K=this.svgUrlForSubject(u,n);return`<a class="kan-pkg-card" href="${d(v)}"><img class="kan-pkg-card-svg" src="${d(K)}" alt="" loading="lazy"/>`+m+"</a>"}).join("")}</section>`)}referencesTarget(e,t,n){for(let s of e.statement){let a=s.predicate?.subject;if(a?.name==="type"||n&&!(a&&Q(a)===Q(n)))continue;let r=[];if(s instanceof V&&s.object instanceof P)r.push(s.object);else if(s instanceof D)for(let o of s.object??[])o instanceof P&&r.push(o);for(let o of r)if(Q(o.subject)===t)return!0}return!1}renderFeaturedResource(e,t){let n=E(e,J);if(!n)return"<!-- LookRenderer.FeaturedResource: no look.source -->";let s=re(this.catalog,n),a=c=>this.parseVersion((c.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},r=s.length>0?s.slice().sort((c,l)=>{let p=a(c),u=a(l);return u.major-p.major||u.minor-p.minor||u.patch-p.patch})[0]:H(this.catalog,n);if(!r)return`<!-- LookRenderer.FeaturedResource: ${n.publisher}/${n.package_}/${n.name} not found -->`;let o=this.renderHtml(r),i=this.hrefForSubject(r,t);return`<section class="kan-featured"><a class="kan-featured-permalink" href="${d(i)}">View full resource \u2192</a>`+o+"</section>"}renderDistribution(e,t){let n=e,s=S=>{let y=b(n,S);if(!y)return;let Z=this.resolvePath(t,y),$=Z===void 0?NaN:parseFloat(Z);return Number.isFinite($)?$:void 0},a=s(yn),r=s(xn);if(a===void 0||r===void 0||a<=0||r<=0)return"<!-- LookRenderer.Distribution: needs resolvable alphaPath + betaPath (> 0) -->";let o=s(_e)??a/(a+r),i=s(Ze),c=s(Xe),l=s(Ie),p=l!==void 0?`hsl(${l},65%,60%)`:"var(--kan-accent)",u=S=>Number.isInteger(S)?String(S):S.toFixed(1),k=280,h=168,g={top:14,right:14,bottom:24,left:14},m=k-g.left-g.right,v=h-g.top-g.bottom,K=120,_=1e-4,U=[],T=[],x=0;for(let S=0;S<=K;S++){let y=S/K;y<_?y=_:y>1-_&&(y=1-_);let Z=Math.exp((a-1)*Math.log(y)+(r-1)*Math.log(1-y));U.push(y),T.push(Z),Z>x&&(x=Z)}let F=S=>g.left+Math.min(1,Math.max(0,S))*m,L=S=>g.top+(1-(x>0?S/x:0))*v,A=g.top+v,ce=U.map((S,y)=>`${F(S).toFixed(1)},${L(T[y]).toFixed(1)}`),O=`M${F(0).toFixed(1)},${A.toFixed(1)} L${ce.join(" L")} L${F(1).toFixed(1)},${A.toFixed(1)} Z`,I="";if(i!==void 0&&c!==void 0&&c>i){let S=[`${F(i).toFixed(1)},${A.toFixed(1)}`];for(let y=0;y<=K;y++)U[y]>=i&&U[y]<=c&&S.push(`${F(U[y]).toFixed(1)},${L(T[y]).toFixed(1)}`);S.push(`${F(c).toFixed(1)},${A.toFixed(1)}`),I=`<path d="M${S.join(" L")} Z" fill="${p}" fill-opacity="0.3"/>`}let G=F(o),pe=`<line x1="${G.toFixed(1)}" y1="${g.top.toFixed(1)}" x2="${G.toFixed(1)}" y2="${A.toFixed(1)}" stroke="${p}" stroke-width="1.5" stroke-dasharray="3 3"/><text x="${G.toFixed(1)}" y="${(g.top-3).toFixed(1)}" text-anchor="middle" class="kan-dist-mean">\u03BC ${o.toFixed(2)}</text>`,be=`<text x="${F(0).toFixed(1)}" y="${(A+15).toFixed(1)}" text-anchor="start" class="kan-dist-axis">0</text><text x="${F(1).toFixed(1)}" y="${(A+15).toFixed(1)}" text-anchor="end" class="kan-dist-axis">1</text>`,j=`<svg class="kan-dist-svg" viewBox="0 0 ${k} ${h}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${g.left}" y1="${A.toFixed(1)}" x2="${(k-g.right).toFixed(1)}" y2="${A.toFixed(1)}" class="kan-dist-base"/><path d="${O}" fill="${p}" fill-opacity="0.12"/>`+I+`<polyline points="${ce.join(" ")}" fill="none" stroke="${p}" stroke-width="2"/>`+pe+be+"</svg>",M=i!==void 0&&c!==void 0?` \xB7 95% CI [${i.toFixed(2)}\u2013${c.toFixed(2)}]`:"";return`<figure class="kan-dist">${j}<figcaption class="kan-dist-caption">Beta(${u(a)}, ${u(r)})${M}</figcaption></figure>`}renderPublisherPackages(e){let t=new Map,n=o=>this.parseVersion((o.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},s=(o,i)=>o.major>i.major||o.major===i.major&&(o.minor>i.minor||o.minor===i.minor&&o.patch>i.patch);for(let o of this.catalog){if(!(o instanceof ee)||C(o)!==e)continue;let i=(o.namespace||"").split("/")[1]?.split("@")[0]??"";if(!i||o.name!==i)continue;let c=t.get(i);(!c||s(n(o),n(c)))&&t.set(i,o)}let a=[...t.entries()].sort((o,i)=>o[0].localeCompare(i[0]));return a.length===0?"":`<section class="kan-pkg-grid">${a.map(([o,i])=>{let c=b(i,N)??o,l=b(i,he),p=l?Ae(l,160):"",u=this.svgUrlForSubject(i,e);return`<a class="kan-pkg-card" href="/${d(o)}"><img class="kan-pkg-card-svg" src="${d(u)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(c)}</span>`+(p?`<span class="kan-pkg-card-comment">${d(p)}</span>`:"")+"</span></a>"}).join("")}</section>`}findPublisherRootView(e){for(let t of this.catalog){if(!(t instanceof ee)||C(t)!==e)continue;let n=Re(t);if(!n)continue;let s=me(n);if(s&&R(s,Sn))return t}}renderTimeline(e,t){let n=E(e,J);if(!n)return"<!-- LookRenderer.Timeline: no look.source -->";let s=E(e,Fe),a=this.findInstancesOfClass(n);if(a.length===0)return"<!-- LookRenderer.Timeline: no instances -->";let r=p=>s?this.readPropertyValueText(p,s)??"":"",o=a.slice().sort((p,u)=>r(p).localeCompare(r(u))),i=E(e,Je),c=b(e,_e);return i&&c?this.renderTrajectoryChart(o,i,c,e,t,r):`<section class="kan-timeline"><ol>
|
|
96
|
+
${o.map(p=>{let u=p.namespace||"",k=u.split("/")[1]?.split("@")[0]??"",h=u.split("@")[1]??"",g=h?this.parseVersion(h):void 0,m=ke.formatResourceUrl({publisher:C(p),package_:k,name:p.name,...g?{version:g}:{}},"=",{contextPublisher:t}),v=r(p),K=v?`<span class="kan-timeline-date">${d(v)}</span>`:"",_=h||p.name;return`<li class="kan-timeline-node"><a href="${d(m)}"><span class="kan-timeline-key">${d(_)}</span>${K}</a></li>`}).join(`
|
|
97
|
+
`)}
|
|
98
|
+
</ol></section>`}renderTrajectoryChart(e,t,n,s,a,r){let o=s,i=b(o,Ie),c=b(o,Ze),l=b(o,Xe),p=b(o,Bn),u=tn(o,Mn),k=tn(o,Vn),h=e.length,g=this.collectTrackedSeries(e,t,n,{hueBy:i,lowerPath:c,upperPath:l});if(g.length===0)return"<!-- LookRenderer.Timeline: no tracked series -->";let m=[];for(let $ of g){for(let w of $.points)w!==null&&m.push(w);for(let w of $.lower??[])w!==null&&m.push(w);for(let w of $.upper??[])w!==null&&m.push(w)}if(m.length===0)return"<!-- LookRenderer.Timeline: no metric values -->";let v=Math.min(...m),K=Math.max(...m);K-v<1e-9&&(v-=.5,K+=.5);let _=(K-v)*.08,U=u!==void 0?u:v-_,T=k!==void 0?k:K+_;T-U<1e-9&&(T=U+1);let x=1e3,F=440,L={top:28,right:24,bottom:56,left:52},A=x-L.left-L.right,ce=F-L.top-L.bottom,O=$=>h<=1?L.left+A/2:L.left+$/(h-1)*A,I=$=>L.top+(1-($-U)/(T-U))*ce,G=($,w)=>$.hue!==void 0?$.hue:Math.round(w*360/g.length),pe=[];for(let $=0;$<5;$++){let w=U+$*(T-U)/4,W=I(w);pe.push(`<line x1="${L.left}" y1="${W.toFixed(1)}" x2="${(x-L.right).toFixed(1)}" y2="${W.toFixed(1)}" class="kan-fan-grid"/>`),pe.push(`<text x="${(L.left-8).toFixed(1)}" y="${(W+4).toFixed(1)}" class="kan-fan-axis" text-anchor="end">${w.toFixed(2)}</text>`)}let be=[];e.forEach(($,w)=>{let W=this.hrefForSubject($,a),z=($.namespace||"").split("@")[1]??"",B=O(w),Y=Ke(r($));be.push(`<a href="${d(W)}" class="kan-fan-xtick"><line x1="${B.toFixed(1)}" y1="${L.top}" x2="${B.toFixed(1)}" y2="${(F-L.bottom).toFixed(1)}" class="kan-fan-vline"/><text x="${B.toFixed(1)}" y="${(F-L.bottom+20).toFixed(1)}" class="kan-fan-xlabel" text-anchor="middle">${oe(z||$.name)}</text>`+(Y?`<text x="${B.toFixed(1)}" y="${(F-L.bottom+36).toFixed(1)}" class="kan-fan-xdate" text-anchor="middle">${oe(Y)}</text>`:"")+"</a>")});let j=[];g.forEach(($,w)=>{if(!$.lower||!$.upper)return;let W=G($,w),z=[],B=[];for(let q=0;q<h;q++){let fe=$.upper[q],le=$.lower[q];fe==null||le===null||le===void 0||(z.push(`${O(q).toFixed(1)},${I(fe).toFixed(1)}`),B.unshift(`${O(q).toFixed(1)},${I(le).toFixed(1)}`))}let Y=z.concat(B);Y.length<3||j.push(`<polygon class="kan-fan-band" points="${Y.join(" ")}" fill="hsl(${W},65%,60%)"/>`)});let M=[];g.forEach(($,w)=>{let z=`hsl(${G($,w)},65%,60%)`,B=[],Y=[];$.points.forEach((q,fe)=>{if(q===null)return;let le=O(fe),te=I(q);B.push(`${le.toFixed(1)},${te.toFixed(1)}`),Y.push(`<circle cx="${le.toFixed(1)}" cy="${te.toFixed(1)}" r="3.5" fill="${z}"/>`)}),B.length!==0&&M.push(`<g class="kan-fan-series" data-series="${d($.key)}"><polyline points="${B.join(" ")}" fill="none" stroke="${z}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`+Y.join("")+"</g>")});let S=`<svg class="kan-fan-svg" viewBox="0 0 ${x} ${F}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+pe.join("")+be.join("")+j.join("")+M.join("")+"</svg>",y=p?`${d(p)}=`:"",Z=g.map(($,w)=>{let W=G($,w),z=$.points.filter(te=>te!==null),B=z.length?z[0]:void 0,Y=z.length?z[z.length-1]:void 0,q="";if(Y!==void 0&&B!==void 0){let te=Y-B;if(Math.abs(te)>=.005){let an=te>0?"up":"down",rn=te>0?"\u25B2":"\u25BC";q=` <span class="kan-fan-delta ${an}">${te>0?"+":""}${te.toFixed(2)} ${rn}</span>`}else q=' <span class="kan-fan-delta flat">\u2014</span>'}let fe=Y!==void 0?`${y}${Y.toFixed(2)}`:"\u2014",le=$.lastSubject&&this.isLinkable(C($.lastSubject),a)?`<a href="${d(this.hrefForSubject($.lastSubject,a))}">${d($.label)}</a>`:d($.label);return`<div class="kan-fan-legend-item" style="--kan-fan-hue:${W}"><span class="kan-fan-swatch"></span><span class="kan-fan-legend-label">${le}</span><span class="kan-fan-legend-cur">${fe}${q}</span></div>`});return`<section class="kan-fan"><div class="kan-fan-chart">${S}</div><div class="kan-fan-legend">${Z.join("")}</div></section>`}renderResourceGrid(e,t,n){let s=E(e,J);if(!s)return"<!-- LookRenderer.ResourceGrid: no look.source -->";let a=H(this.catalog,s),r=a?de(a).some(c=>{let l=c.subject.name;return l==="ObjectProperty"||l==="DatatypeProperty"||l==="Property"}):!1,o=[];if(r&&n){let c=this.readPropertyValueReferences(n,s);for(let l of c){let p=H(this.catalog,{publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name,...l.subject.version?{version:l.subject.version}:{}});p&&o.push(p)}}else o=this.findInstancesOfClass(s);if(o.length===0)return`<!-- LookRenderer.ResourceGrid: no resources for ${s.publisher}/${s.package_}/${s.name} -->`;let i=[];for(let c of o){let l=b(c,N)??c.name,p=b(c,he),u=c.namespace||"",k=u.split("/")[1]?.split("@")[0]??"",h=u.split("@")[1]??"",g=h?this.parseVersion(h):void 0,m=ke.formatResourceUrl({publisher:C(c),package_:k,name:c.name,...g?{version:g}:{}},"=",{contextPublisher:t}),v=p?`<p class="kan-resource-card-subtitle">${d(p)}</p>`:"",K=`<h3 class="kan-resource-card-title">${d(l)}</h3>${v}`;i.push(this.isLinkable(C(c),t)?`<a class="kan-resource-card" href="${d(m)}">${K}</a>`:`<span class="kan-resource-card">${K}</span>`)}return`<section class="kan-resource-grid">
|
|
99
|
+
${i.join(`
|
|
100
|
+
`)}
|
|
101
|
+
</section>`}parseVersion(e){let t=e.split(".").map(Number);if(!(t.length!==3||t.some(n=>Number.isNaN(n))))return{major:t[0],minor:t[1],patch:t[2]}}findInstancesOfClass(e){let t=[];for(let n of this.catalog){if(!(n instanceof ee))continue;de(n).map(r=>r.subject).some(r=>r.publisher===e.publisher&&r.package_===e.package_&&r.name===e.name)&&t.push(n)}return t}renderBreadcrumb(e,t,n){let a=(e.namespace||"").split("/");if(a.length<2)return"";let r=a[0],o=a[1]??"",i=o.split("@")[0]??"",c=o.split("@")[1]??"";if(!r||!i)return"";if(n?.bareOverview)return`<nav class="kan-breadcrumb"><ol>
|
|
102
|
+
<li><a href="/">${d(r)}</a></li>
|
|
103
|
+
<li aria-current="page">${d(i)}</li>
|
|
104
|
+
</ol></nav>`;let l=e.name,u=!!H(this.catalog,{publisher:r,package_:i,name:i}),k=c?`${i}@${c}`:i,h=c?`/${i}/${c}/${i}`:`/${i}/${i}`,g=e.name===i,m=[];return m.push(`<li><a href="/">${d(r)}</a></li>`),g?m.push(`<li aria-current="page">${d(k)}</li>`):(m.push(u?`<li><a href="${d(h)}">${d(k)}</a></li>`:`<li>${d(k)}</li>`),m.push(`<li aria-current="page">${d(l)}</li>`)),`<nav class="kan-breadcrumb"><ol>
|
|
105
|
+
${m.join(`
|
|
106
|
+
`)}
|
|
107
|
+
</ol></nav>`}renderNavGroup(e,t){let n=this.findNavGroupForPublisher(t);if(!n)return"";let s=ne(n,Te);if(!(s instanceof D))return"";let a=s.object??[];if(a.length===0)return"";let r=[];for(let o of a){if(!(o instanceof P))continue;let i=H(this.catalog,{publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name}),{href:c,label:l}=this.resolveNavEntry(o,i,t),p=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,u=c===p?' aria-current="page"':"";r.push(`<li><a class="kan-nav-link" href="${d(c)}"${u}>${d(l)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
|
|
108
|
+
${r.join(`
|
|
109
|
+
`)}
|
|
110
|
+
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&de(t).map(i=>i.subject).some(i=>i.publisher===Ue.publisher&&i.package_===Ue.package_&&i.name===Ue.name)){let i=b(t,N),c=ne(t,We);if(c instanceof V&&c.object instanceof P){let l=c.object,p=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,We,n),label:i??p??l.subject.name}}}let s=ke.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:n}),a=t?b(t,N)??e.subject.name:e.subject.name;return{href:s,label:a}}findNavGroupForPublisher(e){for(let t of this.catalog){if(!(t instanceof ee)||!(t.namespace||"").startsWith(`${e}/`))continue;if(de(t).map(r=>r.subject).some(r=>r.publisher===ve.publisher&&r.package_===ve.package_&&r.name===ve.name))return t}}renderMarkdown(e,t,n){let s=E(e,J);if(!s)return"<!-- LookRenderer.Markdown: no look.source -->";let a=ne(t,s),r=new Map,o;if(a instanceof Me?o=this.resolveMarkdownLinks(a,n,r):a instanceof X?o=a.object:o=this.readPropertyValueText(t,s),!o)return"";let i=Be(o);for(let[c,l]of r){let p=new RegExp('(<a href="'+rt(c)+'">)([^<]*)(</a>)',"g");i=i.replace(p,`$1<img class="kan-md-chip" src="${d(l)}" alt="" loading="lazy">$2$3`)}return`<section class="kan-markdown">
|
|
111
|
+
${i}
|
|
112
|
+
</section>`}resolveMarkdownLinks(e,t,n){let s=e.object,a=[...e.links].sort((r,o)=>o.startOffset-r.startOffset);for(let r of a){let o;if(r.target&&this.isLinkable(r.target.subject.publisher,t)){let i=r.target.subject,c=(r.displayText??this.readLabelForUri({publisher:i.publisher,package_:i.package_,name:i.name})??r.reference).replace(/[[\]]/g,""),l=ke.formatResourceUrl({publisher:i.publisher,package_:i.package_,name:i.name,...i.version?{version:i.version}:{}},"=",{contextPublisher:t});n&&n.set(l,`${l}.svg`),o=`[${c}](${l})`}else if(r.target){let i=r.target.subject;o=(r.displayText??this.readLabelForUri({publisher:i.publisher,package_:i.package_,name:i.name})??r.reference).replace(/[[\]]/g,"")}else o=r.displayText??r.reference;s=s.slice(0,r.startOffset)+o+s.slice(r.endOffset)}return s}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=nn(t.declaration),s=[];for(let a of n){let r=me(a);if(!r||!R(r,Ge))continue;let o=E(a,J);if(!o)continue;let i=this.readPropertyValueText(e,o);i&&s.push(i)}return s.length>0?s.join(`
|
|
113
|
+
|
|
114
|
+
`):void 0}renderHero(e,t,n){let s=ne(e,Qn),a=s instanceof je?s.object===!0:s instanceof X&&s.object==="true",r=[a?'<header class="kan-hero kan-hero-has-icon">':'<header class="kan-hero">'];if(a){let u=this.svgUrlForSubject(t,n);r.push(`<img class="kan-hero-icon" src="${d(u)}" alt="" loading="lazy"/>`)}a&&r.push('<div class="kan-hero-text">');let o=E(e,qn);if(o){let u=this.readPropertyValueText(t,o);u&&r.push(`<span class="kan-hero-eyebrow">${d(Oe(u)??u)}</span>`)}let i=E(e,Yn),c="";i&&(c=this.readPropertyValueText(t,i)??""),c||(c=t.name),r.push(`<h1 class="kan-hero-title">${d(Oe(c)??c)}</h1>`);let l=E(e,Jn);if(l){let u=this.readPropertyValueText(t,l);u&&r.push(`<p class="kan-hero-subtitle">${d(Oe(u)??u)}</p>`)}let p=E(e,en);if(p){let u=this.readPropertyValueReferences(t,p);if(u.length>0){let k=u.map(h=>this.renderBadge(h,en,n)).join("");r.push(`<div class="kan-hero-badges">${k}</div>`)}}return a&&r.push("</div>"),r.push("</header>"),r.join(`
|
|
115
|
+
`)}renderPropertyList(e,t,n){let s=E(e,J);if(!s)return"<!-- LookRenderer: PropertyList missing look.source -->";let a=this.readLabelForUri(s)??s.name,r=ne(t,s),o=this.gatherValueItems(r),i=o.length>0?o.map(c=>`<li>${this.renderInlineValue(c,J,n)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${d(a)}</h3>`,`<ul class="kan-property-list-items">${i}</ul>`,"</section>"].join(`
|
|
116
|
+
`)}renderBadgeRow(e,t,n){let s=E(e,J);if(!s)return"<!-- LookRenderer: BadgeRow missing look.source -->";let a=this.readPropertyValueReferences(t,s);return a.length===0?"":`<div class="kan-badge-row">${a.map(o=>this.renderBadge(o,J,n)).join("")}</div>`}renderChipRow(e,t,n){let s=Ce(e,et);if(s.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let a=[];for(let r of s){let o=ne(t,r);if(!o)continue;let i=this.readLabelForUri(r)??r.name,c=this.renderStatementInlineValue(o,r,n);c&&a.push(`<span class="kan-chip"><span class="kan-chip-key">${d(i)}</span> <span class="kan-chip-val">${c}</span></span>`)}return a.length===0?"":`<div class="kan-chip-row">${a.join("")}</div>`}renderReferenceList(e,t,n){let s=Ce(e,Te);if(s.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let a=b(e,qe),r=b(e,Nn),o=[];for(let i of s){let c=this.readPropertyValueReferences(t,i);if(c.length===0)continue;let l=this.readLabelForUri(i)??i.name;if(a){let p=c.map(u=>this.renderDetailRow(u,a,r,n)).filter(u=>u).join("");p&&o.push(`<dt>${d(l)}</dt><dd><ul class="kan-ref-rows">${p}</ul></dd>`)}else{let p=c.map(u=>this.renderReferenceLink(u,Te,n)).join(", ");o.push(`<dt>${d(l)}</dt><dd>${p}</dd>`)}}return o.length===0?"":`<dl class="kan-reference-list">${o.join("")}</dl>`}renderDetailRow(e,t,n,s){let a=H(this.catalog,{publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name,...e.subject.version?{version:e.subject.version}:{}});if(!a)return"";let r=this.resolvePath(a,t)??b(a,N)??a.name,o="";if(n){let p=this.resolvePath(a,n);p&&(o=`<span class="kan-ref-badge">${d(p)}</span>`)}let i=`<span class="kan-ref-text">${d(r)}</span>${o}`;if(!this.isLinkable(C(a),s))return`<li class="kan-ref-row"><span class="kan-ref-rowlink">${i}</span></li>`;let c=this.hrefForSubject(a,s),l=this.svgUrlForSubject(a,s);return`<li class="kan-ref-row"><a class="kan-ref-rowlink" href="${d(c)}"><img class="kan-ref-icon" src="${d(l)}" alt="" loading="lazy"/>`+i+"</a></li>"}readPropertyValueText(e,t){let n=ne(e,t);if(n){if(n instanceof X)return n.object;if(n instanceof V){let s=n.object;return this.readLabelForUri({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name})??s.subject.name}if(n instanceof D)return(n.object??[]).map(a=>a instanceof P?this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name:a instanceof se?a.name??"":String(a)).filter(a=>a).join(", ")}}readPropertyValueReferences(e,t){let n=ne(e,t);if(!n)return[];if(n instanceof V)return[n.object];if(n instanceof D){let s=[];for(let a of n.object??[])a instanceof P&&s.push(a);return s}return[]}gatherValueItems(e){return e?e instanceof D?e.object??[]:e instanceof V?[e.object]:e instanceof ue?[e.object]:e instanceof X?[e.object]:[]:[]}renderInlineValue(e,t,n){return e instanceof P?this.renderReferenceLink(e,t,n):e instanceof se?d(e.name??"(embedded)"):typeof e=="string"?d(e):typeof e=="number"||typeof e=="boolean"?d(String(e)):""}renderStatementInlineValue(e,t,n){return e instanceof X?d(e.object):e instanceof V?this.renderReferenceLink(e.object,t,n):e instanceof D?(e.object??[]).map(a=>this.renderInlineValue(a,t,n)).filter(a=>a).join(", "):""}renderReferenceLink(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name;if(!this.isLinkable(e.subject.publisher,n))return`<span class="kan-link-plain">${d(s)}</span>`;let a=this.urlForReference(e,t,n);return`<a class="kan-link" href="${d(a)}">${d(s)}</a>`}isLinkable(e,t){return e===t}renderBadge(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,a=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),r=a?` title="${d(a)}"`:"";if(!this.isLinkable(e.subject.publisher,n))return`<span class="kan-badge"${r}>${d(s)}</span>`;let o=this.urlForReference(e,t,n);return`<a class="kan-badge" href="${d(o)}"${r}>${d(s)}</a>`}urlForReference(e,t,n){let s=t?this.getUrlFormForProperty(t):"=";return ke.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},s,{contextPublisher:n})}getUrlFormForProperty(e){let t=H(this.catalog,e);if(!t)return"=";let n=b(t,nt);return n==="*"||n==="^"||n==="~"||n==="="?n:"="}readLabelForUri(e){let t=H(this.catalog,e);if(t)return b(t,N)}readCommentForUri(e){let t=H(this.catalog,e);if(t)return b(t,he)}};function Pe(f){let e=new Map;for(let t of f.statement){if(!(t instanceof ue)||!ie(t,xe.publisher,xe.package_,xe.name))continue;let n=t.object;for(let s of n.statement){if(!(s instanceof X))continue;let a=s.predicate?.subject?.name;if(!a)continue;let r=s.object;e.has(a)||e.set(a,r)}}return e}function Re(f){for(let e of f.statement)if(e instanceof ue&&ie(e,ye.publisher,ye.package_,ye.name))return e.object}function nn(f){for(let e of f.statement){if(!(e instanceof D)||!ie(e,Ee.publisher,Ee.package_,Ee.name))continue;let t=[];for(let n of e.object??[])n instanceof se&&t.push(n);return t}return[]}function me(f){for(let e of f.statement)if(e instanceof V&&e.predicate?.subject?.name==="type"&&e.object instanceof P){let t=e.object.subject;return{publisher:t.publisher,package_:t.package_,name:t.name}}}function E(f,e){for(let t of f.statement)if(t instanceof V&&ie(t,e.publisher,e.package_,e.name)&&t.object instanceof P){let n=t.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function Ce(f,e){for(let t of f.statement){if(!(t instanceof D)||!ie(t,e.publisher,e.package_,e.name))continue;let n=[];for(let s of t.object??[])s instanceof P&&n.push({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name});return n}return[]}function ne(f,e){for(let t of f.statement)if(ie(t,e.publisher,e.package_,e.name))return t}function b(f,e){for(let t of f.statement)if(t instanceof X&&ie(t,e.publisher,e.package_,e.name))return t.object}function tn(f,e){for(let t of f.statement)if(t instanceof $e&&ie(t,e.publisher,e.package_,e.name))return t.object}function de(f){let e=[];for(let t of f.statement)if(t instanceof V){if(t.predicate?.subject?.name!=="type")continue;t.object instanceof P&&e.push(t.object)}else if(t instanceof D){if(t.predicate?.subject?.name!=="type")continue;for(let n of t.object??[])n instanceof P&&e.push(n)}return e}function Se(f){let e=[];for(let t of f.statement)if(t instanceof V){if(t.predicate?.subject?.name!=="subClassOf")continue;t.object instanceof P&&e.push(t.object)}else if(t instanceof D){if(t.predicate?.subject?.name!=="subClassOf")continue;for(let n of t.object??[])n instanceof P&&e.push(n)}return e}function re(f,e){let t=[];for(let n of f){if(!(n instanceof ee)||n.name!==e.name)continue;(n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&t.push(n)}return t}function H(f,e){let t="version"in e?e.version:void 0;if(t){let n=`${e.publisher}/${e.package_}@${t.major}.${t.minor}.${t.patch}`;for(let s of f)if(s instanceof ee&&s.name===e.name&&s.namespace===n)return s}for(let n of f){if(!(n instanceof ee)||n.name!==e.name)continue;if((n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return n}}function ie(f,e,t,n){let s=f.predicate?.subject;return s?s.publisher===e&&s.package_===t&&s.name===n:!1}function R(f,e){return f.publisher===e.publisher&&f.package_===e.package_&&f.name===e.name}function Q(f){return`${f.publisher}/${f.package_}/${f.name}`}function tt(f){return f.name==="Package"?{...Le}:f}function C(f){let e=f.namespace||"",t=e.indexOf("/");return t>=0?e.substring(0,t):e}function d(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function st(f){let e=f.lastIndexOf(".");return e>=0?f.substring(e+1):f}function at(f,e){for(let t of f.statement)if(t.predicate?.subject?.name===e)return t}function oe(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ae(f,e){return f.length<=e?f:f.slice(0,e).replace(/\s+\S*$/,"")+"\u2026"}function sn(f){return f.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function rt(f){return f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(f){let e=Oe(f);if(e)return d(e);if(/^https?:\/\//i.test(f)){let t=f;try{t=new URL(f).hostname.replace(/^www\./,"")}catch{}return`<a class="kan-link" href="${d(f)}" target="_blank" rel="noopener">${d(t)} \u2197</a>`}return d(f)}function Oe(f){let e=/^(\d{4})-(\d{2})-(\d{2})([T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.exec(f.trim());if(!e)return;let t=Date.parse(f);if(!Number.isFinite(t))return;let n=new Date(t),a=`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getUTCMonth()]} ${n.getUTCDate()}, ${n.getUTCFullYear()}`;if(!e[4])return a;let r=n.getUTCHours(),o=(r+11)%12+1,i=r>=12?"PM":"AM";return`${a} \xB7 ${o}:${String(n.getUTCMinutes()).padStart(2,"0")} ${i} UTC`}function Ke(f){if(!f)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(f);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:f}export{Be as a,Ne as b};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as et,b as tt,c as rt,d as nt,e as ot,f as at,g as it,h as st,i as ct,j as lt}from"./chunk-IOJMTW4T.js";import{b as Xt}from"./chunk-
|
|
1
|
+
import{a as et,b as tt,c as rt,d as nt,e as ot,f as at,g as it,h as st,i as ct,j as lt}from"./chunk-IOJMTW4T.js";import{b as Xt}from"./chunk-4FR4GLUX.js";import{a as Xe,b as Ze,c as Qe,d as b,e as S,f as i}from"./chunk-RCI34BYO.js";import{a as Yt}from"./chunk-BFZZ6YGX.js";import{a as Te,b as je,c as Le,d as Fe,e as Ne}from"./chunk-5AH6GIPO.js";import{a as Be,b as De,c as Oe,d as Ae}from"./chunk-VHUJSHH7.js";import{a as ut,b as pt,c as mt,d as ft}from"./chunk-NIJV5UYW.js";import{a as Ye,b as yt,c as gt,d as ht,e as bt}from"./chunk-4TJZIM7A.js";import{a as kt}from"./chunk-NIGFQYVA.js";import{A as Gt,B as Wt,C as Jt,D as qt,a as St,b as Ct,c as Pt,d as Rt,e as wt,f as xt,g as $t,h as vt,i as Et,j as Kt,k as Bt,l as It,m as Tt,n as jt,o as Lt,p as Ft,q as Nt,r as Dt,s as Ot,t as At,u as Ut,v as Mt,w as Vt,x as Ht,y as _t,z as zt}from"./chunk-SKTXJV4T.js";import"./chunk-FJ35VIV6.js";import{a as F,b as D,c as _e,d as We,e as Je,f as qe}from"./chunk-FMYLEPMC.js";import{a as Ue,b as j,c as L,d as N,e as Ve,f as He,g as O,h as A,i as U,j as M,k as V,l as H}from"./chunk-W6T7MOKY.js";import{a as Ie}from"./chunk-7CUTGGH3.js";import{a as Pe,b as Re,c as we,d as xe,e as $e,f as ve,g as Ee,h as Ke}from"./chunk-FQHALFRR.js";import{b as ze,c as Ge}from"./chunk-HEMBMX7T.js";import{a as Me}from"./chunk-FUUTGGJS.js";import{a as dt}from"./chunk-ODIECDN7.js";import{VersionOperator as io}from"@kanonak-protocol/types/document/models/enums";import{existsSync as yr,readFileSync as gr}from"fs";import{homedir as hr}from"os";import{join as kr}from"path";import{execFile as Zt}from"child_process";import{promisify as Qt}from"util";var C=Qt(Zt),P="kanonak",R="/usr/bin/security",p=class{async get(e){let r=i(e);try{let{stdout:n}=await C(R,["find-generic-password","-s",P,"-a",r,"-w"],{timeout:1e4});try{return JSON.parse(n.trim())}catch{throw new Error(`Stored credential for '${r}' is corrupted (not valid JSON).
|
|
2
2
|
Run 'kanonak logout ${r}' then 'kanonak login ${r}' to fix.`)}}catch(n){if(X(n,44))return null;throw new Error(`macOS Keychain read failed for '${r}': ${w(n)}
|
|
3
3
|
The Keychain may be locked or inaccessible.
|
|
4
4
|
Try unlocking it via Keychain Access.app or running 'security unlock-keychain'.`)}}async store(e,r){let n=i(e),o=JSON.stringify(r);try{await C(R,["add-generic-password","-s",P,"-a",n,"-U","-w",o],{timeout:1e4})}catch(a){throw new Error(`macOS Keychain write failed for '${n}': ${w(a)}
|
|
@@ -524,6 +524,14 @@ export declare class LookRenderer {
|
|
|
524
524
|
* path-only URLs; cross-publisher refs render as full `https://...`.
|
|
525
525
|
*/
|
|
526
526
|
private renderReferenceLink;
|
|
527
|
+
/**
|
|
528
|
+
* Whether a reference to `targetPublisher` should render as a link on a
|
|
529
|
+
* page being rendered for `contextPublisher`. We only link resources of
|
|
530
|
+
* the publisher the page belongs to — that's the publisher whose pages
|
|
531
|
+
* this render is producing; cross-publisher targets may not be served
|
|
532
|
+
* anywhere, so they render as plain text rather than dead links.
|
|
533
|
+
*/
|
|
534
|
+
private isLinkable;
|
|
527
535
|
/**
|
|
528
536
|
* Render a Kanonak resource reference as a styled type badge with a
|
|
529
537
|
* tooltip from the target's rdfs.comment. Same URL-form rules as
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as E,c as F,d as f,f as M}from"../chunk-2JQMUZWN.js";import{a as X,b as ye}from"../chunk-
|
|
1
|
+
import{b as E,c as F,d as f,f as M}from"../chunk-2JQMUZWN.js";import{a as X,b as ye}from"../chunk-4FR4GLUX.js";import{a as Oe}from"../chunk-BFZZ6YGX.js";import"../chunk-NIJV5UYW.js";import"../chunk-NIGFQYVA.js";import{a as Ue}from"../chunk-FJ35VIV6.js";import{a as C,c as Re,f as Ce}from"../chunk-FMYLEPMC.js";import{b as K,c as w,d as b,g as L,h as U,i as O,j,k as T,l as S}from"../chunk-W6T7MOKY.js";import{a as Le}from"../chunk-7CUTGGH3.js";import"../chunk-HEMBMX7T.js";import"../chunk-FUUTGGJS.js";var gt="kanonak.org",yt="document-ast",m=t=>({publisher:gt,package_:yt,name:t}),k={Document:m("Document"),Block:m("Block"),Inline:m("Inline"),StructuredValue:m("StructuredValue"),Heading:m("Heading"),Paragraph:m("Paragraph"),RawBlock:m("RawBlock"),Text:m("Text"),StructuredMap:m("StructuredMap"),StructuredEntry:m("StructuredEntry"),StructuredList:m("StructuredList"),StringScalar:m("StringScalar"),IntegerScalar:m("IntegerScalar"),EscapeHint:m("EscapeHint"),MediaType:m("MediaType"),metadata:m("metadata"),children:m("children"),level:m("level"),inlines:m("inlines"),text:m("text"),entries:m("entries"),key:m("key"),value:m("value"),escapeHint:m("escapeHint"),items:m("items"),stringValue:m("stringValue"),integerValue:m("integerValue"),rawContent:m("rawContent"),mediaType:m("mediaType"),mimeType:m("mimeType"),ESC_RAW:m("esc-raw"),ESC_YAML_SAFE:m("esc-yaml-safe"),ESC_TOML_STRING:m("esc-toml-string"),ESC_TOML_MULTILINE:m("esc-toml-multiline"),ESC_JSON:m("esc-json"),ESC_DYNAMODB_BOOL:m("esc-dynamodb-bool"),ESC_DYNAMODB_NUMBER:m("esc-dynamodb-number"),ESC_DYNAMODB_NULL:m("esc-dynamodb-null"),TEXT_PLAIN:m("text-plain"),TEXT_MARKDOWN:m("text-markdown"),TEXT_HTML:m("text-html"),TEXT_CSS:m("text-css"),APPLICATION_JSON:m("application-json"),TEXT_YAML:m("text-yaml"),IMAGE_SVG_XML:m("image-svg-xml"),ResourceLink:m("ResourceLink"),target:m("target"),linkLabel:m("linkLabel"),PropertyList:m("PropertyList"),propertyEntries:m("propertyEntries"),PropertyEntry:m("PropertyEntry"),propertyKey:m("propertyKey"),propertyValue:m("propertyValue"),Table:m("Table"),tableColumnLabels:m("tableColumnLabels"),tableRows:m("tableRows"),TableRow:m("TableRow"),tableCells:m("tableCells")};function Ne(t,e){return t.publisher===e.publisher&&t.package_===e.package_&&t.name===e.name}var Y=class{backendUri="kanonak.org/transformations/markdown-with-frontmatter";render(e,n){let r=kt(e.metadata,n),a=wt(e.children),u=["---",...r,"---","",a].join(`
|
|
2
2
|
`);return n?.trailingNewline&&(u.endsWith(`
|
|
3
3
|
`)||(u+=`
|
|
4
4
|
`)),u}};function kt(t,e){if(!t)return[];let n=new Map;for(let c of t.entries)n.set(ue(c.key),c);let r=new Map;if(e?.metadataRenames)for(let[c,l]of e.metadataRenames)r.set(ue(c),l);let i=(e?.metadataKeys??t.entries.map(c=>c.key)).map(ue),u=[];for(let c of i){let l=n.get(c);if(!l)continue;let p=r.get(c),y=ue(p??c),h=Ie(l.value,l.escapeHint);h!==void 0&&u.push(`${y}: ${h}`)}return u}function ue(t){let e=t.lastIndexOf(".");return e===-1?t:t.substring(e+1)||t}function Ie(t,e){switch(t.kind){case"StringScalar":return ht(t.stringValue,e);case"IntegerScalar":return String(t.integerValue);case"StructuredList":{let n=[];for(let r of t.items){let a=Ie(r,e);a!==void 0&&n.push(a)}return n.join(", ")}case"StructuredMap":return;default:return}}function ht(t,e){return!e||Ne(e,k.ESC_RAW)?t:Ne(e,k.ESC_YAML_SAFE)?bt(t):t}function bt(t){return t.includes(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanonak-protocol/sdk",
|
|
3
|
-
"version": "3.44.
|
|
3
|
+
"version": "3.44.10",
|
|
4
4
|
"description": "Kanonak Protocol SDK - Document repository and parsing implementations for TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"yaml-parser"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@kanonak-protocol/types": "^3.44.
|
|
116
|
+
"@kanonak-protocol/types": "^3.44.10",
|
|
117
117
|
"ignore": "^7.0.5",
|
|
118
118
|
"js-yaml": "^4.1.0",
|
|
119
119
|
"yaml": "^2.7.0"
|
package/dist/chunk-G44YB2H2.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import{a as ke}from"./chunk-NIGFQYVA.js";import{a as se,c as Me}from"./chunk-FMYLEPMC.js";import{c as Q,d as T,g as Z,h as $e,i as je,j as M,k as ue,l as B}from"./chunk-W6T7MOKY.js";function Be(f){let e=f.replace(/\r\n/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),t=[],n=0;for(;n<e.length;){let s=e[n];if(s.trim()===""){n++;continue}let a=/^(\s*)```(\S*)\s*$/.exec(s);if(a){let i=a[2],c=[];for(n++;n<e.length&&!/^(\s*)```\s*$/.test(e[n]);)c.push(e[n]),n++;n++;let l=De(c.join(`
|
|
4
|
-
`)),p=i?` class="language-${He(i)}"`:"";t.push(`<pre><code${p}>${l}</code></pre>`);continue}let r=/^(#{1,6})\s+(.*)$/.exec(s);if(r){let i=r[1].length,c=ge(r[2].trim());t.push(`<h${i}>${c}</h${i}>`),n++;continue}if(s.includes("|")&&n+1<e.length&&Ve(e[n+1])){let i=we(s),c=on(e[n+1]);n+=2;let l=[];for(;n<e.length&&e[n].trim()!==""&&e[n].includes("|");)l.push(we(e[n])),n++;t.push(cn(i,c,l));continue}if(/^\s*[-*]\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*[-*]\s+/.test(e[n]);){let c=[e[n].replace(/^\s*[-*]\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ge(c.join(" ").trim())}</li>`)}t.push(`<ul>
|
|
5
|
-
${i.join(`
|
|
6
|
-
`)}
|
|
7
|
-
</ul>`);continue}if(/^\s*\d+\.\s+/.test(s)){let i=[];for(;n<e.length&&/^\s*\d+\.\s+/.test(e[n]);){let c=[e[n].replace(/^\s*\d+\.\s+/,"")];for(n++;n<e.length&&e[n].trim()!==""&&!/^\s*\d+\.\s+/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n]);)c.push(e[n]),n++;n<e.length&&e[n].trim()===""&&n++,i.push(`<li>${ge(c.join(" ").trim())}</li>`)}t.push(`<ol>
|
|
8
|
-
${i.join(`
|
|
9
|
-
`)}
|
|
10
|
-
</ol>`);continue}let o=[s];for(n++;n<e.length&&e[n].trim()!==""&&!/^(#{1,6})\s+/.test(e[n])&&!/^(\s*)```/.test(e[n])&&!/^\s*[-*]\s+/.test(e[n])&&!/^\s*\d+\.\s+/.test(e[n])&&!(e[n].includes("|")&&n+1<e.length&&Ve(e[n+1]));)o.push(e[n]),n++;t.push(`<p>${ge(o.join(" "))}</p>`)}return t.join(`
|
|
11
|
-
`)}function Ve(f){return f.includes("-")?/^[\s|:-]+$/.test(f):!1}function we(f){let e=f.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(t=>t.trim())}function on(f){return we(f).map(e=>{let t=e.startsWith(":"),n=e.endsWith(":");return t&&n?"center":n?"right":t?"left":null})}function cn(f,e,t){let n=r=>{let o=e[r];return o?` style="text-align:${o}"`:""},s=f.map((r,o)=>`<th${n(o)}>${ge(r)}</th>`).join(""),a=t.map(r=>`<tr>${r.map((i,c)=>`<td${n(c)}>${ge(i)}</td>`).join("")}</tr>`).join(`
|
|
12
|
-
`);return`<table>
|
|
13
|
-
<thead><tr>${s}</tr></thead>
|
|
14
|
-
<tbody>
|
|
15
|
-
${a}
|
|
16
|
-
</tbody>
|
|
17
|
-
</table>`}function ge(f){let e=De(f);return e=e.replace(/`([^`\n]+)`/g,(t,n)=>`<code>${n}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(t,n,s)=>`<a href="${He(s)}">${n}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(t,n)=>`<strong>${n}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(t,n,s)=>`${n}<em>${s}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(t,n,s)=>`${n}<em>${s}</em>`),e}function De(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function He(f){return f.replace(/"/g,""").replace(/&/g,"&")}var ye={publisher:"kanonak.org",package_:"derivation",name:"look"},xe={publisher:"kanonak.org",package_:"derivation",name:"tokens"},ae={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},A={publisher:"kanonak.org",package_:"core-rdf",name:"label"},he={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},ln={publisher:"kanonak.org",package_:"look",name:"Hero"},un={publisher:"kanonak.org",package_:"look",name:"PropertyList"},dn={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},pn={publisher:"kanonak.org",package_:"look",name:"ChipRow"},fn={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},kn={publisher:"kanonak.org",package_:"look",name:"ReferencedBy"},Ge={publisher:"kanonak.org",package_:"look",name:"Markdown"},ve={publisher:"kanonak.org",package_:"look",name:"NavGroup"},Ue={publisher:"kanonak.org",package_:"look",name:"NavLink"},We={publisher:"kanonak.org",package_:"look",name:"target"},gn={publisher:"kanonak.org",package_:"look",name:"ResourceGrid"},hn={publisher:"kanonak.org",package_:"look",name:"Timeline"},mn={publisher:"kanonak.org",package_:"look",name:"VersionDiff"},bn={publisher:"kanonak.org",package_:"look",name:"Figure"},$n={publisher:"kanonak.org",package_:"look",name:"StatRow"},jn={publisher:"kanonak.org",package_:"look",name:"Horizon"},vn={publisher:"kanonak.org",package_:"look",name:"PackageContents"},Oe={publisher:"kanonak.org",package_:"core-kanonak",name:"Package"},_n={publisher:"kanonak.org",package_:"look",name:"FeaturedResource"},Rn={publisher:"kanonak.org",package_:"look",name:"PublisherPackages"},Sn={publisher:"kanonak.org",package_:"look",name:"PublisherView"},Kn={publisher:"kanonak.org",package_:"look",name:"Distribution"},yn={publisher:"kanonak.org",package_:"look",name:"alphaPath"},xn={publisher:"kanonak.org",package_:"look",name:"betaPath"},ze={publisher:"kanonak.org",package_:"look",name:"SectionHeading"},On={publisher:"kanonak.org",package_:"look",name:"SectionNav"},Ye={publisher:"kanonak.org",package_:"look",name:"heading"},Ln={publisher:"kanonak.org",package_:"look",name:"note"},wn={publisher:"kanonak.org",package_:"look",name:"VersionDelta"},Un={publisher:"kanonak.org",package_:"look",name:"TimePlot"},Fn={publisher:"kanonak.org",package_:"look",name:"Details"},In={publisher:"kanonak.org",package_:"look",name:"skip"},En={publisher:"kanonak.org",package_:"derivation",name:"derivations"},Pn={publisher:"kanonak.org",package_:"look",name:"laneBy"},Tn={publisher:"kanonak.org",package_:"look",name:"stats"},Cn={publisher:"kanonak.org",package_:"look",name:"statPath"},An={publisher:"kanonak.org",package_:"look",name:"statLabel"},qe={publisher:"kanonak.org",package_:"look",name:"labelPath"},Nn={publisher:"kanonak.org",package_:"look",name:"badgePath"},Fe={publisher:"kanonak.org",package_:"look",name:"orderBy"},Je={publisher:"kanonak.org",package_:"look",name:"track"},_e={publisher:"kanonak.org",package_:"look",name:"metricPath"},Ie={publisher:"kanonak.org",package_:"look",name:"hueBy"},Ze={publisher:"kanonak.org",package_:"look",name:"lowerPath"},Xe={publisher:"kanonak.org",package_:"look",name:"upperPath"},Mn={publisher:"kanonak.org",package_:"look",name:"axisMin"},Vn={publisher:"kanonak.org",package_:"look",name:"axisMax"},Bn={publisher:"kanonak.org",package_:"look",name:"valueLabel"};var Qe={publisher:"kanonak.org",package_:"look",name:"semanticSvg"},Dn={publisher:"kanonak.org",package_:"look",name:"tierChip"},Hn={publisher:"kanonak.org",package_:"look",name:"tierIcon"},Gn={publisher:"kanonak.org",package_:"look",name:"tierCard"},Wn={publisher:"kanonak.org",package_:"look",name:"tierFull"},zn={publisher:"kanonak.org",package_:"core-rdf",name:"type"},Ee={publisher:"kanonak.org",package_:"look",name:"bands"},Yn={publisher:"kanonak.org",package_:"look",name:"title"},qn={publisher:"kanonak.org",package_:"look",name:"eyebrow"},Jn={publisher:"kanonak.org",package_:"look",name:"subtitle"},en={publisher:"kanonak.org",package_:"look",name:"badges"},q={publisher:"kanonak.org",package_:"look",name:"source"},Zn={publisher:"kanonak.org",package_:"look",name:"via"},Xn={publisher:"kanonak.org",package_:"look",name:"size"},Qn={publisher:"kanonak.org",package_:"look",name:"icon"},et={publisher:"kanonak.org",package_:"look",name:"chips"},Pe={publisher:"kanonak.org",package_:"look",name:"entries"},nt={publisher:"kanonak.org",package_:"look",name:"urlForm"},Ne=class{constructor(e){this.catalog=e}catalog;findCascadedLook(e){let t=Re(e);if(t)return{declaration:t,sourceClass:{publisher:H(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name}};let n=new Set,s=de(e);for(;s.length>0;){let a=s.shift(),r=tt(a.subject),o=X(r);if(n.has(o))continue;n.add(o);let i=re(this.catalog,r);for(let c of i){let l=Re(c);if(l)return{declaration:l,sourceClass:{publisher:r.publisher,package_:r.package_,name:r.name}}}for(let c of i)for(let l of Se(c))s.push(l)}if(!n.has(X(ae)))for(let a of re(this.catalog,ae)){let r=Re(a);if(r)return{declaration:r,sourceClass:{...ae}}}}findCascadedTokens(e){let t=new Map;for(let[a,r]of Te(e))t.has(a)||t.set(a,r);let n=new Set,s=de(e);for(;s.length>0;){let a=s.shift(),r=X(a.subject);if(n.has(r))continue;n.add(r);let o=re(this.catalog,a.subject);if(o.length!==0)for(let i of o){for(let[c,l]of Te(i))t.has(c)||t.set(c,l);for(let c of Se(i))s.push(c)}}if(!n.has(X(ae))){let a=re(this.catalog,ae);for(let r of a)for(let[o,i]of Te(r))t.has(o)||t.set(o,i)}return t}renderSvg(e){let t=m(e,A)??e.name,n=(t.trim().charAt(0)||"?").toUpperCase(),s=`${e.namespace??""}/${e.name}`,a={label:t,firstLetter:n,uri:s},r=this.collectCascadedSvgTiers(e),o=h=>this.applyPlaceholders(h,e,a),i=o(r.tierChip??""),c=o(r.tierIcon??""),l=o(r.tierCard??""),p=o(r.tierFull??""),k=[...this.findCascadedTokens(e)].map(([h,g])=>`--kan-${h}: ${g};`).join(" ");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" style="${oe(k)}">
|
|
18
|
-
<style>
|
|
19
|
-
.tier-chip,.tier-icon,.tier-card{display:none}
|
|
20
|
-
.tier-full{display:block}
|
|
21
|
-
@media (max-width:400px){.tier-full{display:none}.tier-card{display:block}}
|
|
22
|
-
@media (max-width:160px){.tier-card{display:none}.tier-icon{display:block}}
|
|
23
|
-
@media (max-width:60px){.tier-icon{display:none}.tier-chip{display:block}}
|
|
24
|
-
</style>
|
|
25
|
-
<g class="tier-chip">${i}</g>
|
|
26
|
-
<g class="tier-icon">${c}</g>
|
|
27
|
-
<g class="tier-card">${l}</g>
|
|
28
|
-
<g class="tier-full">${p}</g>
|
|
29
|
-
</svg>`}applyPlaceholders(e,t,n){return e.replace(/\{\{([^}]+)\}\}/g,(s,a)=>{let r=a.trim();if(n[r]!==void 0)return oe(n[r]);let o=r.indexOf(":");if(o>0){let c=r.slice(0,o),l=r.slice(o+1).trim();if(c==="delta"||c==="deltaArrow"||c==="deltaColor"||c==="deltaDir"){let p=this.metricDelta(t,l);return c==="deltaColor"?p?p.dir==="up"?"#34d399":p.dir==="down"?"#f87171":"#9aa5b8":"#9aa5b8":c==="deltaDir"?p?p.dir:"new":p?c==="deltaArrow"?p.dir==="up"?"\u25B2":p.dir==="down"?"\u25BC":"\u2014":oe(`${p.delta>0?"+":""}${p.delta.toFixed(2)}`):""}if(c==="svg")return this.resolvePath(t,l)??""}let i=this.resolvePath(t,r);return i===void 0?`{{${r}}}`:oe(i)})}metricDelta(e,t){let n=k=>{let h=this.resolvePath(k,t),g=h===void 0?NaN:parseFloat(h);return Number.isFinite(g)?g:void 0},s=n(e);if(s===void 0)return;let a=k=>this.parseVersion((k.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},r=(k,h)=>k.major-h.major||k.minor-h.minor||k.patch-h.patch,o={publisher:H(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name},i=a(e),c,l;for(let k of re(this.catalog,o)){let h=a(k);r(h,i)<0&&(!l||r(h,l)>0)&&(c=k,l=h)}if(!c)return;let p=n(c);if(p===void 0)return;let u=s-p;return{delta:u,dir:Math.abs(u)<.005?"flat":u>0?"up":"down"}}resolvePath(e,t){let n=t.split("/").map(s=>s.trim()).filter(s=>s.length>0);if(n.length!==0)return this.resolvePathSteps(e,n)}resolvePathSteps(e,t){let n=st(t[0]),s=at(e,n);if(!s)return;let a=t.length===1;if(s instanceof ue)return a?void 0:this.resolvePathSteps(s.object,t.slice(1));if(s instanceof M&&s.object instanceof T){let r=s.object.subject,o=re(this.catalog,r);if(o.length===0){let c=D(this.catalog,r);c&&o.push(c)}if(a){for(let c of o){let l=m(c,A);if(l!==void 0)return l}return r.name}let i=t.slice(1);for(let c of o){let l=this.resolvePathSteps(c,i);if(l!==void 0)return l}return}if(a&&(s instanceof Z||s instanceof $e||s instanceof je))return String(s.object)}collectCascadedSvgTiers(e){let t={},n=r=>{let o=ee(r,Qe);if(!(o instanceof ue))return;let i=o.object,c=m(i,Dn),l=m(i,Hn),p=m(i,Gn),u=m(i,Wn);t.tierChip===void 0&&c!==void 0&&(t.tierChip=c),t.tierIcon===void 0&&l!==void 0&&(t.tierIcon=l),t.tierCard===void 0&&p!==void 0&&(t.tierCard=p),t.tierFull===void 0&&u!==void 0&&(t.tierFull=u)};n(e);let s=new Set,a=de(e);for(;a.length>0;){let r=a.shift(),o=X(r.subject);if(s.has(o))continue;s.add(o);let i=re(this.catalog,r.subject);for(let c of i){n(c);for(let l of Se(c))a.push(l)}}if(!s.has(X(ae)))for(let r of re(this.catalog,ae))n(r);return t}renderStylesheet(e){let t=this.findCascadedTokens(e),n=[];for(let[r,o]of t)n.push(` --kan-${r}: ${o};`);let s=n.length>0?`:root {
|
|
30
|
-
${n.join(`
|
|
31
|
-
`)}
|
|
32
|
-
}`:":root { /* no tokens resolved */ }",a=this.findBaseStylesheet(H(e))??"";return`${s}
|
|
33
|
-
${a}`}findBaseStylesheet(e){let t="kanonak.org/site/content",n,s;for(let r of this.catalog){if(!(r instanceof Q)||r.name!=="base-stylesheet")continue;let o=r.namespace||"";o.startsWith(`${e}/look-styles@`)?n=r:o.startsWith("kanonak.org/look-styles@")&&(s=r)}let a=n??s;if(a)for(let r of a.statement){let o=r.predicate?.subject;if(!o)continue;if(`${o.publisher}/${o.package_}/${o.name}`===t&&r instanceof Z)return r.object}}renderHtml(e){let t=this.findCascadedLook(e);if(!t)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let n=nn(t.declaration);if(n.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let s=H(e),a=this.collectSectionHeadings(n),r=[];for(let o of n)r.push(this.renderBand(o,e,s,a));return r.join(`
|
|
34
|
-
`)}collectSectionHeadings(e){let t=[];for(let n of e){let s=me(n);if(!s||!R(s,ze))continue;let a=m(n,Ye);a&&t.push({slug:sn(a),label:a})}return t}renderPublisherIndex(e,t,n){let s=n?this.renderNavGroup(n,e):"",a=t.map(o=>{let i=o.comment?`<p class="kan-resource-card-subtitle">${d(o.comment)}</p>`:"";return`<a class="kan-resource-card" href="${d(o.href)}"><h3 class="kan-resource-card-title">${d(o.label)}</h3>${i}</a>`}).join(`
|
|
35
|
-
`),r=`<header class="kan-hero">
|
|
36
|
-
<h1 class="kan-hero-title">${d(e)}</h1>
|
|
37
|
-
</header>
|
|
38
|
-
<section class="kan-resource-grid">
|
|
39
|
-
${a}
|
|
40
|
-
</section>`;return`<!doctype html>
|
|
41
|
-
<html lang="en">
|
|
42
|
-
<head>
|
|
43
|
-
<meta charset="utf-8">
|
|
44
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
45
|
-
<title>${d(e)}</title>
|
|
46
|
-
<link rel="stylesheet" href="index.css">
|
|
47
|
-
</head>
|
|
48
|
-
<body>
|
|
49
|
-
${s}
|
|
50
|
-
<main class="kan-main">
|
|
51
|
-
${r}
|
|
52
|
-
</main>
|
|
53
|
-
</body>
|
|
54
|
-
</html>
|
|
55
|
-
`}renderPublisherIndexStylesheet(e){return e?this.renderStylesheet(e):""}hasDeclaredView(e){let t=this.findCascadedLook(e);return t?!(s=>s.publisher===ae.publisher&&s.package_===ae.package_&&s.name===ae.name||s.publisher===Oe.publisher&&s.package_===Oe.package_&&s.name===Oe.name)(t.sourceClass):!1}renderPackageVersionList(e,t,n){let s=H(n),a=this.renderNavGroup(n,s),r=this.renderBreadcrumb(n,s,{bareOverview:!0}),o=t.map(c=>`<a class="kan-resource-card" href="/${d(e)}/${d(c)}/"><h3 class="kan-resource-card-title">${d(c)}</h3></a>`).join(`
|
|
56
|
-
`),i=`<header class="kan-hero">
|
|
57
|
-
<span class="kan-hero-eyebrow">PACKAGE</span>
|
|
58
|
-
<h1 class="kan-hero-title">${d(e)}</h1>
|
|
59
|
-
</header>
|
|
60
|
-
<section class="kan-resource-grid">
|
|
61
|
-
${o}
|
|
62
|
-
</section>`;return`<!doctype html>
|
|
63
|
-
<html lang="en">
|
|
64
|
-
<head>
|
|
65
|
-
<meta charset="utf-8">
|
|
66
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
67
|
-
<title>${d(e)}</title>
|
|
68
|
-
<link rel="stylesheet" href="${d(n.name)}.css">
|
|
69
|
-
</head>
|
|
70
|
-
<body>
|
|
71
|
-
${a}
|
|
72
|
-
${r}
|
|
73
|
-
<main class="kan-main">
|
|
74
|
-
${i}
|
|
75
|
-
</main>
|
|
76
|
-
</body>
|
|
77
|
-
</html>
|
|
78
|
-
`}renderDocument(e,t){let n=this.renderHtml(e),s=this.readPropertyValueText(e,A)??e.name,a=t?.rootIndex?"index.css":`${e.name}.css`,r=!t?.rootIndex&&this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${d(e.name)}.svg" alt=""></figure>
|
|
79
|
-
`:"",o=H(e),i=this.renderNavGroup(e,o),c=t?.rootIndex?"":this.renderBreadcrumb(e,o,t);return`<!doctype html>
|
|
80
|
-
<html lang="en">
|
|
81
|
-
<head>
|
|
82
|
-
<meta charset="utf-8">
|
|
83
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
84
|
-
<title>${d(s)}</title>
|
|
85
|
-
<link rel="stylesheet" href="${d(a)}">
|
|
86
|
-
</head>
|
|
87
|
-
<body>
|
|
88
|
-
${i}
|
|
89
|
-
${c}
|
|
90
|
-
<main class="kan-main">
|
|
91
|
-
${r}${n}
|
|
92
|
-
</main>
|
|
93
|
-
</body>
|
|
94
|
-
</html>
|
|
95
|
-
`}hasSvgDerivation(e){let t=new Set,n=de(e);for(;n.length>0;){let s=n.shift(),a=X(s.subject);if(t.has(a))continue;t.add(a);let r=D(this.catalog,s.subject);if(r){for(let o of r.statement)if(o instanceof B&&ie(o,"kanonak.org","derivation","derivations")){for(let i of o.object??[])if(i instanceof se)for(let c of i.statement){if(!(c instanceof M)||!ie(c,"kanonak.org","derivation","format")||!(c.object instanceof T))continue;let l=c.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let o of Se(r))n.push(o)}}return!1}renderBand(e,t,n,s=[]){let a=me(e);return a?R(a,On)?this.renderSectionNav(s):R(a,ln)?this.renderHero(e,t,n):R(a,un)?this.renderPropertyList(e,t,n):R(a,dn)?this.renderBadgeRow(e,t,n):R(a,pn)?this.renderChipRow(e,t,n):R(a,fn)?this.renderReferenceList(e,t,n):R(a,kn)?this.renderReferencedBy(e,t,n):R(a,Ge)?this.renderMarkdown(e,t,n):R(a,ve)?this.renderNavGroup(t,n):R(a,gn)?this.renderResourceGrid(e,n,t):R(a,hn)?this.renderTimeline(e,n):R(a,mn)?this.renderVersionDiff(e,n):R(a,bn)?this.renderFigure(e,t,n):R(a,$n)?this.renderStatRow(e,t):R(a,jn)?this.renderHorizon(e,t,n):R(a,vn)?this.renderPackageContents(t,n):R(a,_n)?this.renderFeaturedResource(e,n):R(a,Rn)?this.renderPublisherPackages(n):R(a,Kn)?this.renderDistribution(e,t):R(a,ze)?this.renderSectionHeading(e):R(a,wn)?this.renderVersionDelta(e,t):R(a,Un)?this.renderTimePlot(e,t,n):R(a,Fn)?this.renderDetails(e,t,n):`<!-- LookRenderer: unsupported band ${a.publisher}/${a.package_}/${a.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}collectTrackedSeries(e,t,n,s){let{hueBy:a,lowerPath:r,upperPath:o}=s??{},i=new Map,c=e.length,l=(p,u)=>{let k=this.resolvePath(p,u);return k===void 0?NaN:parseFloat(k)};return e.forEach((p,u)=>{let k=this.readPropertyValueReferences(p,t);for(let h of k){let g=D(this.catalog,{publisher:h.subject.publisher,package_:h.subject.package_,name:h.subject.name,...h.subject.version?{version:h.subject.version}:{}});if(!g)continue;let b=h.subject.name,j=i.get(b);j||(j={key:b,label:m(g,A)??b,points:new Array(c).fill(null),...r?{lower:new Array(c).fill(null)}:{},...o?{upper:new Array(c).fill(null)}:{}},i.set(b,j));let x=l(g,n);if(Number.isFinite(x)&&(j.points[u]=x),r&&j.lower){let _=l(g,r);Number.isFinite(_)&&(j.lower[u]=_)}if(o&&j.upper){let _=l(g,o);Number.isFinite(_)&&(j.upper[u]=_)}if(a){let _=l(g,a);Number.isFinite(_)&&(j.hue=_)}j.lastSubject=g}}),[...i.values()]}hrefForSubject(e,t,n="="){let s=e.namespace||"",a=s.split("/")[1]?.split("@")[0]??"",r=s.split("@")[1]??"",o=r?this.parseVersion(r):void 0;return ke.formatResourceUrl({publisher:H(e),package_:a,name:e.name,...o?{version:o}:{}},n,{contextPublisher:t})}renderVersionDiff(e,t){let n=E(e,q);if(!n)return"<!-- LookRenderer.VersionDiff: no look.source -->";let s=m(e,_e),a=E(e,Je);if(!a||!s)return"<!-- LookRenderer.VersionDiff: needs look.track + look.metricPath -->";let r=E(e,Fe),o=m(e,Ie),i=this.findInstancesOfClass(n);if(i.length===0)return"<!-- LookRenderer.VersionDiff: no instances -->";let c=k=>r?this.readPropertyValueText(k,r)??"":"",l=i.slice().sort((k,h)=>c(k).localeCompare(c(h))),p=this.collectTrackedSeries(l,a,s,{hueBy:o});return p.length===0?"<!-- LookRenderer.VersionDiff: no tracked series -->":`<section class="kan-vdiff">${p.map((k,h)=>{let g=k.hue!==void 0?k.hue:Math.round(h*360/p.length),b=k.points.filter(y=>y!==null);if(b.length===0)return"";let j=b[0],x=b[b.length-1],_=x-j,U;if(Math.abs(_)>=.005){let y=_>0?"up":"down",F=_>0?"\u25B2":"\u25BC";U=`<span class="kan-vdiff-delta ${y}">${_>0?"+":""}${_.toFixed(2)} ${F}</span>`}else U='<span class="kan-vdiff-delta flat">\u2014</span>';let P=k.lastSubject?`<a href="${d(this.hrefForSubject(k.lastSubject,t))}">${d(k.label)}</a>`:d(k.label);return`<div class="kan-vdiff-row" style="--kan-vdiff-hue:${g}"><span class="kan-vdiff-label">${P}</span><span class="kan-vdiff-start">${j.toFixed(2)}</span>`+this.sparkline(k.points,g)+`<span class="kan-vdiff-end">${x.toFixed(2)}</span>`+U+"</div>"}).join("")}</section>`}sparkline(e,t){let r=`hsl(${t},65%,60%)`,o=e.filter(b=>b!==null);if(o.length===0)return'<svg class="kan-vdiff-spark" viewBox="0 0 132 30" xmlns="http://www.w3.org/2000/svg"></svg>';let i=Math.min(...o),l=Math.max(...o)-i,p=e.length,u=b=>p<=1?132/2:4+b/(p-1)*124,k=b=>l<1e-9?30/2:26-(b-i)/l*22,h=[],g=[];return e.forEach((b,j)=>{if(b===null)return;let x=u(j),_=k(b);h.push(`${x.toFixed(1)},${_.toFixed(1)}`),g.push(`<circle cx="${x.toFixed(1)}" cy="${_.toFixed(1)}" r="2" fill="${r}"/>`)}),`<svg class="kan-vdiff-spark" viewBox="0 0 132 30" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" role="img"><polyline points="${h.join(" ")}" fill="none" stroke="${r}" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>`+g.join("")+"</svg>"}svgUrlForSubject(e,t,n="="){return`${this.hrefForSubject(e,t,n)}.svg`}renderFigure(e,t,n){let s=t,a=E(e,q);if(a){let l=D(this.catalog,a);l&&(s=l)}let r=this.svgUrlForSubject(s,n),o=m(s,A)??s.name,i=m(e,Xn);return`<figure class="kan-figure${i==="small"||i==="medium"||i==="large"?` kan-figure-${i}`:""}"><img class="kan-figure-img" src="${d(r)}" alt="${d(o)}" loading="lazy"/></figure>`}renderStatRow(e,t){let n=ee(e,Tn),s=this.gatherValueItems(n).filter(r=>r instanceof se);if(s.length===0)return"<!-- LookRenderer.StatRow: no look.stats -->";let a=[];for(let r of s){let o=m(r,Cn);if(!o)continue;let i=this.resolvePath(t,o);if(i===void 0)continue;let c=m(r,An)??"";a.push('<div class="kan-stat">'+(c?`<span class="kan-stat-label">${d(c)}</span>`:"")+`<span class="kan-stat-val">${d(i)}</span></div>`)}return a.length===0?"":`<div class="kan-stat-row">${a.join("")}</div>`}renderHorizon(e,t,n){let s=E(e,q);if(!s)return"<!-- LookRenderer.Horizon: no look.source -->";let a=this.gatherValueItems(ee(t,s)).filter(o=>o instanceof se);return a.length===0?"":`<section class="kan-horizon">${a.map(o=>this.renderConditionNode(o,n,0)).join("")}</section>`}renderConditionNode(e,t,n){let s=me(e),a=s?this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name:"Condition",r=[],o=[];for(let u of e.statement){let k=u.predicate?.subject;if(!k||k.name==="type")continue;let h=this.readLabelForUri({publisher:k.publisher,package_:k.package_,name:k.name})??k.name;if(u instanceof Z||u instanceof $e||u instanceof je)r.push(`<div class="kan-cond-field"><span class="kan-cond-key">${d(h)}</span><span class="kan-cond-v">${d(String(u.object))}</span></div>`);else if(u instanceof M&&u.object instanceof T){let g=u.object.subject,b=this.readLabelForUri({publisher:g.publisher,package_:g.package_,name:g.name})??g.name;r.push(`<div class="kan-cond-field"><span class="kan-cond-key">${d(h)}</span><span class="kan-cond-v">${d(b)}</span></div>`)}else if(u instanceof ue)o.push(this.renderConditionNode(u.object,t,n+1));else if(u instanceof B)for(let g of u.object??[])g instanceof se&&o.push(this.renderConditionNode(g,t,n+1))}let i=r.length?`<div class="kan-cond-fields">${r.join("")}</div>`:"",c=o.length?`<div class="kan-cond-children">${o.join("")}</div>`:"",l=o.length>0,p=l?`<span class="kan-cond-op">${d(a)}</span>`:`<div class="kan-cond-type">${d(a)}</div>`;return`<div class="kan-cond ${l?"kan-cond-branch":"kan-cond-leaf"}">${p}${i}${c}</div>`}renderSectionHeading(e){let t=e,n=m(t,Ye);if(!n)return"<!-- LookRenderer.SectionHeading: no look.heading -->";let s=m(t,Ln);return`<div class="kan-section" id="${sn(n)}"><h2 class="kan-section-title">${d(n)}</h2>`+(s?`<p class="kan-section-note">${d(s)}</p>`:"")+"</div>"}renderSectionNav(e){return e.length===0?"<!-- LookRenderer.SectionNav: no section headings in this view -->":`<nav class="kan-section-nav" aria-label="On this page">${e.map(n=>`<a class="kan-section-nav-link" href="#${d(n.slug)}">${d(n.label)}</a>`).join("")}</nav>`}renderVersionDelta(e,t){let s=m(e,_e);if(!s)return"<!-- LookRenderer.VersionDelta: no look.metricPath -->";let a=L=>{let I=this.resolvePath(L,s),G=I===void 0?NaN:parseFloat(I);return Number.isFinite(G)?G:void 0},r=a(t);if(r===void 0)return"";let o=L=>this.parseVersion((L.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},i=(L,I)=>L.major-I.major||L.minor-I.minor||L.patch-I.patch,c={publisher:H(t),package_:(t.namespace||"").split("/")[1]?.split("@")[0]??"",name:t.name},l=o(t),p,u;for(let L of re(this.catalog,c)){let I=o(L);i(I,l)<0&&(!u||i(I,u)>0)&&(p=L,u=I)}if(!p||!u)return'<div class="kan-delta kan-delta-first">First tracked in this version</div>';let k=a(p);if(k===void 0)return"";let h=r-k,g=Math.abs(h)<.005?"flat":h>0?"up":"down",b=g==="up"?"\u25B2":g==="down"?"\u25BC":"\u2014",j=g==="up"?"#34d399":g==="down"?"#f87171":"var(--kan-text-faint)",x=`${u.major}.${u.minor}.${u.patch}`,_=320,U=46,P=14,y=30,F=L=>P+Math.min(1,Math.max(0,L))*(_-2*P),O=F(k),C=F(r),ce=`<svg class="kan-delta-track" viewBox="0 0 ${_} ${U}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${P}" y1="${y}" x2="${_-P}" y2="${y}" class="kan-delta-base"/><line x1="${O.toFixed(1)}" y1="${y}" x2="${C.toFixed(1)}" y2="${y}" stroke="${j}" stroke-width="3"/><circle cx="${O.toFixed(1)}" cy="${y}" r="4" class="kan-delta-prev"/><circle cx="${C.toFixed(1)}" cy="${y}" r="5.5" fill="${j}"/><text x="${O.toFixed(1)}" y="${y-9}" text-anchor="middle" class="kan-delta-tick kan-delta-tick-prev">${k.toFixed(2)}</text><text x="${C.toFixed(1)}" y="${y+17}" text-anchor="middle" class="kan-delta-tick">${r.toFixed(2)}</text></svg>`;return`<div class="kan-delta"><div class="kan-delta-head"><span class="kan-delta-vs">vs ${d(x)}</span><span class="kan-delta-badge ${g}">${h>0?"+":""}${h.toFixed(2)} ${b}</span></div>`+ce+"</div>"}renderTimePlot(e,t,n){let s=E(e,q),a=E(e,Fe);if(!s||!a)return"<!-- LookRenderer.TimePlot: needs look.source + look.orderBy -->";let r=e,o=m(r,Pn),i=m(r,qe),c=[];for(let v of this.readPropertyValueReferences(t,s)){let N=D(this.catalog,{publisher:v.subject.publisher,package_:v.subject.package_,name:v.subject.name,...v.subject.version?{version:v.subject.version}:{}});if(!N)continue;let S=this.readPropertyValueText(N,a)??"",K=Date.parse(S);if(!Number.isFinite(K))continue;let J=o?this.resolvePath(N,o)??"":"",$=(i?this.resolvePath(N,i):void 0)??m(N,A)??N.name;c.push({t:K,dateStr:S,lane:J,label:$,href:this.hrefForSubject(N,n)})}if(c.length===0)return"<!-- LookRenderer.TimePlot: no dated points -->";let l=[];for(let v of c)l.includes(v.lane)||l.push(v.lane);let p=Math.min(...c.map(v=>v.t)),u=Math.max(...c.map(v=>v.t));u===p&&(u=p+1);let k=l.some(v=>v),h=720,g=k?96:16,b=18,j=12,x=24,_=36,U=j+l.length*_+x,P=g,y=h-b,F=y-P,O=v=>P+(v-p)/(u-p)*F,C=v=>j+v*_+_/2,ce=v=>Math.round(v*360/Math.max(1,l.length)),L=[];l.forEach((v,N)=>{let S=C(N);L.push(`<line x1="${P}" y1="${S.toFixed(1)}" x2="${y}" y2="${S.toFixed(1)}" class="kan-plot-guide"/>`),v&&L.push(`<text x="${(g-8).toFixed(1)}" y="${(S+4).toFixed(1)}" text-anchor="end" class="kan-plot-lane">${oe(v)}</text>`)});let I={},G=[];for(let v of c){let N=l.indexOf(v.lane),K=((I[v.lane]=(I[v.lane]??0)+1)%3-1)*7,J=O(v.t),$=C(N)+K,w=`${Ke(v.dateStr)} \xB7 ${v.label}`;G.push(`<a href="${d(v.href)}" class="kan-plot-link"><circle cx="${J.toFixed(1)}" cy="${$.toFixed(1)}" r="5" fill="hsl(${ce(N)},65%,60%)" class="kan-plot-pt"><title>${oe(w)}</title></circle></a>`)}let pe=`<text x="${P}" y="${(U-6).toFixed(1)}" text-anchor="start" class="kan-plot-axis">${oe(Ke(new Date(p).toISOString()))}</text><text x="${y}" y="${(U-6).toFixed(1)}" text-anchor="end" class="kan-plot-axis">${oe(Ke(new Date(u).toISOString()))}</text>`;return`<section class="kan-plot">${`<svg class="kan-plot-svg" viewBox="0 0 ${h} ${U}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+L.join("")+G.join("")+pe+"</svg>"}</section>`}renderDetails(e,t,n){let s=Ce(e,In),a=this.detailRows(t,n,s);return a?`<dl class="kan-details">${a}</dl>`:"<!-- LookRenderer.Details: no properties -->"}detailRows(e,t,n){let s=[];for(let a of e.statement){let r=a.predicate?.subject;if(!r||this.isMetaPredicate(r)||n.some(c=>R(c,r)))continue;let o=this.readLabelForUri({publisher:r.publisher,package_:r.package_,name:r.name})??r.name,i=this.detailValue(a,t,n);i&&s.push(`<dt class="kan-details-key">${d(o)}</dt><dd class="kan-details-val">${i}</dd>`)}return s.join("")}detailValue(e,t,n){if(e instanceof Z)return ot(e.object);if(e instanceof $e||e instanceof je)return d(String(e.object));if(e instanceof M&&e.object instanceof T)return this.detailReferenceLink(e.object,t);if(e instanceof ue)return this.detailEmbedded(e.object,t,n);if(e instanceof B){let s=e.object??[];return s.length>0&&s.every(a=>a instanceof se)?s.map(a=>this.detailEmbedded(a,t,n)).join(""):s.map(a=>a instanceof T?this.detailReferenceLink(a,t):a instanceof se?this.detailEmbedded(a,t,n):d(String(a))).filter(a=>a).join(", ")}return""}detailReferenceLink(e,t){let n=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,s=this.urlForReference(e,void 0,t);return`<img class="kan-md-chip" src="${d(`${s}.svg`)}" alt="" loading="lazy"><a class="kan-link" href="${d(s)}">${d(n)}</a>`}detailEmbedded(e,t,n){let s=me(e),a=s?this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name:"",r=this.detailRows(e,t,n);return'<div class="kan-details-embed">'+(a?`<span class="kan-details-type">${d(a)}</span>`:"")+(r?`<dl class="kan-details">${r}</dl>`:"")+"</div>"}isMetaPredicate(e){return R(e,zn)||R(e,A)||R(e,he)||R(e,ye)||R(e,xe)||R(e,En)||R(e,Qe)}renderPackageContents(e,t){let n=e.namespace||"";if(!n)return"";let s=this.catalog.filter(r=>r instanceof Q&&r.namespace===n&&r.name!==e.name);return s.length===0?`<!-- LookRenderer.PackageContents: no members in ${n} -->`:(s.sort((r,o)=>{let i=m(r,A)??r.name,c=m(o,A)??o.name;return i.localeCompare(c)}),`<section class="kan-pkg-grid">${s.map(r=>{let o=m(r,A)??r.name,i=m(r,he),c=i?Ae(i,160):"",l=this.hrefForSubject(r,t),p=this.svgUrlForSubject(r,t);return`<a class="kan-pkg-card" href="${d(l)}"><img class="kan-pkg-card-svg" src="${d(p)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(o)}</span>`+(c?`<span class="kan-pkg-card-comment">${d(c)}</span>`:"")+"</span></a>"}).join("")}</section>`)}renderReferencedBy(e,t,n){let s=E(e,Zn),a={publisher:H(t),package_:(t.namespace||"").split("/")[1]?.split("@")[0]??"",name:t.name},r=X(a),o=u=>this.parseVersion((u.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},i=(u,k)=>u.major-k.major||u.minor-k.minor||u.patch-k.patch,c=new Map;for(let u of this.catalog){if(!(u instanceof Q))continue;let k=X({publisher:H(u),package_:(u.namespace||"").split("/")[1]?.split("@")[0]??"",name:u.name});if(k===r||!this.referencesTarget(u,r,s))continue;let h=c.get(k);(!h||i(o(u),o(h))>0)&&c.set(k,u)}let l=[...c.values()];return l.length===0?"<!-- LookRenderer.ReferencedBy: no incoming references -->":(l.sort((u,k)=>{let h=m(u,A)??u.name,g=m(k,A)??k.name;return h.localeCompare(g)}),`<section class="kan-pkg-grid">${l.map(u=>{let k=m(u,A)??u.name,h=m(u,he),g=h?Ae(h,160):"",b=this.hrefForSubject(u,n),j=this.svgUrlForSubject(u,n);return`<a class="kan-pkg-card" href="${d(b)}"><img class="kan-pkg-card-svg" src="${d(j)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(k)}</span>`+(g?`<span class="kan-pkg-card-comment">${d(g)}</span>`:"")+"</span></a>"}).join("")}</section>`)}referencesTarget(e,t,n){for(let s of e.statement){let a=s.predicate?.subject;if(a?.name==="type"||n&&!(a&&X(a)===X(n)))continue;let r=[];if(s instanceof M&&s.object instanceof T)r.push(s.object);else if(s instanceof B)for(let o of s.object??[])o instanceof T&&r.push(o);for(let o of r)if(X(o.subject)===t)return!0}return!1}renderFeaturedResource(e,t){let n=E(e,q);if(!n)return"<!-- LookRenderer.FeaturedResource: no look.source -->";let s=re(this.catalog,n),a=c=>this.parseVersion((c.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},r=s.length>0?s.slice().sort((c,l)=>{let p=a(c),u=a(l);return u.major-p.major||u.minor-p.minor||u.patch-p.patch})[0]:D(this.catalog,n);if(!r)return`<!-- LookRenderer.FeaturedResource: ${n.publisher}/${n.package_}/${n.name} not found -->`;let o=this.renderHtml(r),i=this.hrefForSubject(r,t);return`<section class="kan-featured"><a class="kan-featured-permalink" href="${d(i)}">View full resource \u2192</a>`+o+"</section>"}renderDistribution(e,t){let n=e,s=S=>{let K=m(n,S);if(!K)return;let J=this.resolvePath(t,K),$=J===void 0?NaN:parseFloat(J);return Number.isFinite($)?$:void 0},a=s(yn),r=s(xn);if(a===void 0||r===void 0||a<=0||r<=0)return"<!-- LookRenderer.Distribution: needs resolvable alphaPath + betaPath (> 0) -->";let o=s(_e)??a/(a+r),i=s(Ze),c=s(Xe),l=s(Ie),p=l!==void 0?`hsl(${l},65%,60%)`:"var(--kan-accent)",u=S=>Number.isInteger(S)?String(S):S.toFixed(1),k=280,h=168,g={top:14,right:14,bottom:24,left:14},b=k-g.left-g.right,j=h-g.top-g.bottom,x=120,_=1e-4,U=[],P=[],y=0;for(let S=0;S<=x;S++){let K=S/x;K<_?K=_:K>1-_&&(K=1-_);let J=Math.exp((a-1)*Math.log(K)+(r-1)*Math.log(1-K));U.push(K),P.push(J),J>y&&(y=J)}let F=S=>g.left+Math.min(1,Math.max(0,S))*b,O=S=>g.top+(1-(y>0?S/y:0))*j,C=g.top+j,ce=U.map((S,K)=>`${F(S).toFixed(1)},${O(P[K]).toFixed(1)}`),L=`M${F(0).toFixed(1)},${C.toFixed(1)} L${ce.join(" L")} L${F(1).toFixed(1)},${C.toFixed(1)} Z`,I="";if(i!==void 0&&c!==void 0&&c>i){let S=[`${F(i).toFixed(1)},${C.toFixed(1)}`];for(let K=0;K<=x;K++)U[K]>=i&&U[K]<=c&&S.push(`${F(U[K]).toFixed(1)},${O(P[K]).toFixed(1)}`);S.push(`${F(c).toFixed(1)},${C.toFixed(1)}`),I=`<path d="M${S.join(" L")} Z" fill="${p}" fill-opacity="0.3"/>`}let G=F(o),pe=`<line x1="${G.toFixed(1)}" y1="${g.top.toFixed(1)}" x2="${G.toFixed(1)}" y2="${C.toFixed(1)}" stroke="${p}" stroke-width="1.5" stroke-dasharray="3 3"/><text x="${G.toFixed(1)}" y="${(g.top-3).toFixed(1)}" text-anchor="middle" class="kan-dist-mean">\u03BC ${o.toFixed(2)}</text>`,be=`<text x="${F(0).toFixed(1)}" y="${(C+15).toFixed(1)}" text-anchor="start" class="kan-dist-axis">0</text><text x="${F(1).toFixed(1)}" y="${(C+15).toFixed(1)}" text-anchor="end" class="kan-dist-axis">1</text>`,v=`<svg class="kan-dist-svg" viewBox="0 0 ${k} ${h}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${g.left}" y1="${C.toFixed(1)}" x2="${(k-g.right).toFixed(1)}" y2="${C.toFixed(1)}" class="kan-dist-base"/><path d="${L}" fill="${p}" fill-opacity="0.12"/>`+I+`<polyline points="${ce.join(" ")}" fill="none" stroke="${p}" stroke-width="2"/>`+pe+be+"</svg>",N=i!==void 0&&c!==void 0?` \xB7 95% CI [${i.toFixed(2)}\u2013${c.toFixed(2)}]`:"";return`<figure class="kan-dist">${v}<figcaption class="kan-dist-caption">Beta(${u(a)}, ${u(r)})${N}</figcaption></figure>`}renderPublisherPackages(e){let t=new Map,n=o=>this.parseVersion((o.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},s=(o,i)=>o.major>i.major||o.major===i.major&&(o.minor>i.minor||o.minor===i.minor&&o.patch>i.patch);for(let o of this.catalog){if(!(o instanceof Q)||H(o)!==e)continue;let i=(o.namespace||"").split("/")[1]?.split("@")[0]??"";if(!i||o.name!==i)continue;let c=t.get(i);(!c||s(n(o),n(c)))&&t.set(i,o)}let a=[...t.entries()].sort((o,i)=>o[0].localeCompare(i[0]));return a.length===0?"":`<section class="kan-pkg-grid">${a.map(([o,i])=>{let c=m(i,A)??o,l=m(i,he),p=l?Ae(l,160):"",u=this.svgUrlForSubject(i,e);return`<a class="kan-pkg-card" href="/${d(o)}"><img class="kan-pkg-card-svg" src="${d(u)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(c)}</span>`+(p?`<span class="kan-pkg-card-comment">${d(p)}</span>`:"")+"</span></a>"}).join("")}</section>`}findPublisherRootView(e){for(let t of this.catalog){if(!(t instanceof Q)||H(t)!==e)continue;let n=Re(t);if(!n)continue;let s=me(n);if(s&&R(s,Sn))return t}}renderTimeline(e,t){let n=E(e,q);if(!n)return"<!-- LookRenderer.Timeline: no look.source -->";let s=E(e,Fe),a=this.findInstancesOfClass(n);if(a.length===0)return"<!-- LookRenderer.Timeline: no instances -->";let r=p=>s?this.readPropertyValueText(p,s)??"":"",o=a.slice().sort((p,u)=>r(p).localeCompare(r(u))),i=E(e,Je),c=m(e,_e);return i&&c?this.renderTrajectoryChart(o,i,c,e,t,r):`<section class="kan-timeline"><ol>
|
|
96
|
-
${o.map(p=>{let u=p.namespace||"",k=u.split("/")[1]?.split("@")[0]??"",h=u.split("@")[1]??"",g=h?this.parseVersion(h):void 0,b=ke.formatResourceUrl({publisher:H(p),package_:k,name:p.name,...g?{version:g}:{}},"=",{contextPublisher:t}),j=r(p),x=j?`<span class="kan-timeline-date">${d(j)}</span>`:"",_=h||p.name;return`<li class="kan-timeline-node"><a href="${d(b)}"><span class="kan-timeline-key">${d(_)}</span>${x}</a></li>`}).join(`
|
|
97
|
-
`)}
|
|
98
|
-
</ol></section>`}renderTrajectoryChart(e,t,n,s,a,r){let o=s,i=m(o,Ie),c=m(o,Ze),l=m(o,Xe),p=m(o,Bn),u=tn(o,Mn),k=tn(o,Vn),h=e.length,g=this.collectTrackedSeries(e,t,n,{hueBy:i,lowerPath:c,upperPath:l});if(g.length===0)return"<!-- LookRenderer.Timeline: no tracked series -->";let b=[];for(let $ of g){for(let w of $.points)w!==null&&b.push(w);for(let w of $.lower??[])w!==null&&b.push(w);for(let w of $.upper??[])w!==null&&b.push(w)}if(b.length===0)return"<!-- LookRenderer.Timeline: no metric values -->";let j=Math.min(...b),x=Math.max(...b);x-j<1e-9&&(j-=.5,x+=.5);let _=(x-j)*.08,U=u!==void 0?u:j-_,P=k!==void 0?k:x+_;P-U<1e-9&&(P=U+1);let y=1e3,F=440,O={top:28,right:24,bottom:56,left:52},C=y-O.left-O.right,ce=F-O.top-O.bottom,L=$=>h<=1?O.left+C/2:O.left+$/(h-1)*C,I=$=>O.top+(1-($-U)/(P-U))*ce,G=($,w)=>$.hue!==void 0?$.hue:Math.round(w*360/g.length),pe=[];for(let $=0;$<5;$++){let w=U+$*(P-U)/4,ne=I(w);pe.push(`<line x1="${O.left}" y1="${ne.toFixed(1)}" x2="${(y-O.right).toFixed(1)}" y2="${ne.toFixed(1)}" class="kan-fan-grid"/>`),pe.push(`<text x="${(O.left-8).toFixed(1)}" y="${(ne+4).toFixed(1)}" class="kan-fan-axis" text-anchor="end">${w.toFixed(2)}</text>`)}let be=[];e.forEach(($,w)=>{let ne=this.hrefForSubject($,a),W=($.namespace||"").split("@")[1]??"",V=L(w),z=Ke(r($));be.push(`<a href="${d(ne)}" class="kan-fan-xtick"><line x1="${V.toFixed(1)}" y1="${O.top}" x2="${V.toFixed(1)}" y2="${(F-O.bottom).toFixed(1)}" class="kan-fan-vline"/><text x="${V.toFixed(1)}" y="${(F-O.bottom+20).toFixed(1)}" class="kan-fan-xlabel" text-anchor="middle">${oe(W||$.name)}</text>`+(z?`<text x="${V.toFixed(1)}" y="${(F-O.bottom+36).toFixed(1)}" class="kan-fan-xdate" text-anchor="middle">${oe(z)}</text>`:"")+"</a>")});let v=[];g.forEach(($,w)=>{if(!$.lower||!$.upper)return;let ne=G($,w),W=[],V=[];for(let Y=0;Y<h;Y++){let fe=$.upper[Y],le=$.lower[Y];fe==null||le===null||le===void 0||(W.push(`${L(Y).toFixed(1)},${I(fe).toFixed(1)}`),V.unshift(`${L(Y).toFixed(1)},${I(le).toFixed(1)}`))}let z=W.concat(V);z.length<3||v.push(`<polygon class="kan-fan-band" points="${z.join(" ")}" fill="hsl(${ne},65%,60%)"/>`)});let N=[];g.forEach(($,w)=>{let W=`hsl(${G($,w)},65%,60%)`,V=[],z=[];$.points.forEach((Y,fe)=>{if(Y===null)return;let le=L(fe),te=I(Y);V.push(`${le.toFixed(1)},${te.toFixed(1)}`),z.push(`<circle cx="${le.toFixed(1)}" cy="${te.toFixed(1)}" r="3.5" fill="${W}"/>`)}),V.length!==0&&N.push(`<g class="kan-fan-series" data-series="${d($.key)}"><polyline points="${V.join(" ")}" fill="none" stroke="${W}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`+z.join("")+"</g>")});let S=`<svg class="kan-fan-svg" viewBox="0 0 ${y} ${F}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+pe.join("")+be.join("")+v.join("")+N.join("")+"</svg>",K=p?`${d(p)}=`:"",J=g.map(($,w)=>{let ne=G($,w),W=$.points.filter(te=>te!==null),V=W.length?W[0]:void 0,z=W.length?W[W.length-1]:void 0,Y="";if(z!==void 0&&V!==void 0){let te=z-V;if(Math.abs(te)>=.005){let an=te>0?"up":"down",rn=te>0?"\u25B2":"\u25BC";Y=` <span class="kan-fan-delta ${an}">${te>0?"+":""}${te.toFixed(2)} ${rn}</span>`}else Y=' <span class="kan-fan-delta flat">\u2014</span>'}let fe=z!==void 0?`${K}${z.toFixed(2)}`:"\u2014",le=$.lastSubject?`<a href="${d(this.hrefForSubject($.lastSubject,a))}">${d($.label)}</a>`:d($.label);return`<div class="kan-fan-legend-item" style="--kan-fan-hue:${ne}"><span class="kan-fan-swatch"></span><span class="kan-fan-legend-label">${le}</span><span class="kan-fan-legend-cur">${fe}${Y}</span></div>`});return`<section class="kan-fan"><div class="kan-fan-chart">${S}</div><div class="kan-fan-legend">${J.join("")}</div></section>`}renderResourceGrid(e,t,n){let s=E(e,q);if(!s)return"<!-- LookRenderer.ResourceGrid: no look.source -->";let a=D(this.catalog,s),r=a?de(a).some(c=>{let l=c.subject.name;return l==="ObjectProperty"||l==="DatatypeProperty"||l==="Property"}):!1,o=[];if(r&&n){let c=this.readPropertyValueReferences(n,s);for(let l of c){let p=D(this.catalog,{publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name,...l.subject.version?{version:l.subject.version}:{}});p&&o.push(p)}}else o=this.findInstancesOfClass(s);if(o.length===0)return`<!-- LookRenderer.ResourceGrid: no resources for ${s.publisher}/${s.package_}/${s.name} -->`;let i=[];for(let c of o){let l=m(c,A)??c.name,p=m(c,he),u=c.namespace||"",k=u.split("/")[1]?.split("@")[0]??"",h=u.split("@")[1]??"",g=h?this.parseVersion(h):void 0,b=ke.formatResourceUrl({publisher:H(c),package_:k,name:c.name,...g?{version:g}:{}},"=",{contextPublisher:t}),j=p?`<p class="kan-resource-card-subtitle">${d(p)}</p>`:"";i.push(`<a class="kan-resource-card" href="${d(b)}"><h3 class="kan-resource-card-title">${d(l)}</h3>${j}</a>`)}return`<section class="kan-resource-grid">
|
|
99
|
-
${i.join(`
|
|
100
|
-
`)}
|
|
101
|
-
</section>`}parseVersion(e){let t=e.split(".").map(Number);if(!(t.length!==3||t.some(n=>Number.isNaN(n))))return{major:t[0],minor:t[1],patch:t[2]}}findInstancesOfClass(e){let t=[];for(let n of this.catalog){if(!(n instanceof Q))continue;de(n).map(r=>r.subject).some(r=>r.publisher===e.publisher&&r.package_===e.package_&&r.name===e.name)&&t.push(n)}return t}renderBreadcrumb(e,t,n){let a=(e.namespace||"").split("/");if(a.length<2)return"";let r=a[0],o=a[1]??"",i=o.split("@")[0]??"",c=o.split("@")[1]??"";if(!r||!i)return"";if(n?.bareOverview)return`<nav class="kan-breadcrumb"><ol>
|
|
102
|
-
<li><a href="/">${d(r)}</a></li>
|
|
103
|
-
<li aria-current="page">${d(i)}</li>
|
|
104
|
-
</ol></nav>`;let l=e.name,u=!!D(this.catalog,{publisher:r,package_:i,name:i}),k=c?`${i}@${c}`:i,h=c?`/${i}/${c}/${i}`:`/${i}/${i}`,g=e.name===i,b=[];return b.push(`<li><a href="/">${d(r)}</a></li>`),g?b.push(`<li aria-current="page">${d(k)}</li>`):(b.push(u?`<li><a href="${d(h)}">${d(k)}</a></li>`:`<li>${d(k)}</li>`),b.push(`<li aria-current="page">${d(l)}</li>`)),`<nav class="kan-breadcrumb"><ol>
|
|
105
|
-
${b.join(`
|
|
106
|
-
`)}
|
|
107
|
-
</ol></nav>`}renderNavGroup(e,t){let n=this.findNavGroupForPublisher(t);if(!n)return"";let s=ee(n,Pe);if(!(s instanceof B))return"";let a=s.object??[];if(a.length===0)return"";let r=[];for(let o of a){if(!(o instanceof T))continue;let i=D(this.catalog,{publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name}),{href:c,label:l}=this.resolveNavEntry(o,i,t),p=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,u=c===p?' aria-current="page"':"";r.push(`<li><a class="kan-nav-link" href="${d(c)}"${u}>${d(l)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
|
|
108
|
-
${r.join(`
|
|
109
|
-
`)}
|
|
110
|
-
</ul></nav>`}resolveNavEntry(e,t,n){if(t&&de(t).map(i=>i.subject).some(i=>i.publisher===Ue.publisher&&i.package_===Ue.package_&&i.name===Ue.name)){let i=m(t,A),c=ee(t,We);if(c instanceof M&&c.object instanceof T){let l=c.object,p=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,We,n),label:i??p??l.subject.name}}}let s=ke.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:n}),a=t?m(t,A)??e.subject.name:e.subject.name;return{href:s,label:a}}findNavGroupForPublisher(e){for(let t of this.catalog){if(!(t instanceof Q)||!(t.namespace||"").startsWith(`${e}/`))continue;if(de(t).map(r=>r.subject).some(r=>r.publisher===ve.publisher&&r.package_===ve.package_&&r.name===ve.name))return t}}renderMarkdown(e,t,n){let s=E(e,q);if(!s)return"<!-- LookRenderer.Markdown: no look.source -->";let a=ee(t,s),r=new Map,o;if(a instanceof Me?o=this.resolveMarkdownLinks(a,n,r):a instanceof Z?o=a.object:o=this.readPropertyValueText(t,s),!o)return"";let i=Be(o);for(let[c,l]of r){let p=new RegExp('(<a href="'+rt(c)+'">)([^<]*)(</a>)',"g");i=i.replace(p,`$1<img class="kan-md-chip" src="${d(l)}" alt="" loading="lazy">$2$3`)}return`<section class="kan-markdown">
|
|
111
|
-
${i}
|
|
112
|
-
</section>`}resolveMarkdownLinks(e,t,n){let s=e.object,a=[...e.links].sort((r,o)=>o.startOffset-r.startOffset);for(let r of a){let o;if(r.target){let i=r.target.subject,c=(r.displayText??this.readLabelForUri({publisher:i.publisher,package_:i.package_,name:i.name})??r.reference).replace(/[[\]]/g,""),l=ke.formatResourceUrl({publisher:i.publisher,package_:i.package_,name:i.name,...i.version?{version:i.version}:{}},"=",{contextPublisher:t});n&&n.set(l,`${l}.svg`),o=`[${c}](${l})`}else o=r.displayText??r.reference;s=s.slice(0,r.startOffset)+o+s.slice(r.endOffset)}return s}renderRawMarkdown(e){let t=this.findCascadedLook(e);if(!t)return;let n=nn(t.declaration),s=[];for(let a of n){let r=me(a);if(!r||!R(r,Ge))continue;let o=E(a,q);if(!o)continue;let i=this.readPropertyValueText(e,o);i&&s.push(i)}return s.length>0?s.join(`
|
|
113
|
-
|
|
114
|
-
`):void 0}renderHero(e,t,n){let s=ee(e,Qn),a=s instanceof je?s.object===!0:s instanceof Z&&s.object==="true",r=[a?'<header class="kan-hero kan-hero-has-icon">':'<header class="kan-hero">'];if(a){let u=this.svgUrlForSubject(t,n);r.push(`<img class="kan-hero-icon" src="${d(u)}" alt="" loading="lazy"/>`)}a&&r.push('<div class="kan-hero-text">');let o=E(e,qn);if(o){let u=this.readPropertyValueText(t,o);u&&r.push(`<span class="kan-hero-eyebrow">${d(Le(u)??u)}</span>`)}let i=E(e,Yn),c="";i&&(c=this.readPropertyValueText(t,i)??""),c||(c=t.name),r.push(`<h1 class="kan-hero-title">${d(Le(c)??c)}</h1>`);let l=E(e,Jn);if(l){let u=this.readPropertyValueText(t,l);u&&r.push(`<p class="kan-hero-subtitle">${d(Le(u)??u)}</p>`)}let p=E(e,en);if(p){let u=this.readPropertyValueReferences(t,p);if(u.length>0){let k=u.map(h=>this.renderBadge(h,en,n)).join("");r.push(`<div class="kan-hero-badges">${k}</div>`)}}return a&&r.push("</div>"),r.push("</header>"),r.join(`
|
|
115
|
-
`)}renderPropertyList(e,t,n){let s=E(e,q);if(!s)return"<!-- LookRenderer: PropertyList missing look.source -->";let a=this.readLabelForUri(s)??s.name,r=ee(t,s),o=this.gatherValueItems(r),i=o.length>0?o.map(c=>`<li>${this.renderInlineValue(c,q,n)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${d(a)}</h3>`,`<ul class="kan-property-list-items">${i}</ul>`,"</section>"].join(`
|
|
116
|
-
`)}renderBadgeRow(e,t,n){let s=E(e,q);if(!s)return"<!-- LookRenderer: BadgeRow missing look.source -->";let a=this.readPropertyValueReferences(t,s);return a.length===0?"":`<div class="kan-badge-row">${a.map(o=>this.renderBadge(o,q,n)).join("")}</div>`}renderChipRow(e,t,n){let s=Ce(e,et);if(s.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let a=[];for(let r of s){let o=ee(t,r);if(!o)continue;let i=this.readLabelForUri(r)??r.name,c=this.renderStatementInlineValue(o,r,n);c&&a.push(`<span class="kan-chip"><span class="kan-chip-key">${d(i)}</span> <span class="kan-chip-val">${c}</span></span>`)}return a.length===0?"":`<div class="kan-chip-row">${a.join("")}</div>`}renderReferenceList(e,t,n){let s=Ce(e,Pe);if(s.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let a=m(e,qe),r=m(e,Nn),o=[];for(let i of s){let c=this.readPropertyValueReferences(t,i);if(c.length===0)continue;let l=this.readLabelForUri(i)??i.name;if(a){let p=c.map(u=>this.renderDetailRow(u,a,r,n)).filter(u=>u).join("");p&&o.push(`<dt>${d(l)}</dt><dd><ul class="kan-ref-rows">${p}</ul></dd>`)}else{let p=c.map(u=>this.renderReferenceLink(u,Pe,n)).join(", ");o.push(`<dt>${d(l)}</dt><dd>${p}</dd>`)}}return o.length===0?"":`<dl class="kan-reference-list">${o.join("")}</dl>`}renderDetailRow(e,t,n,s){let a=D(this.catalog,{publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name,...e.subject.version?{version:e.subject.version}:{}});if(!a)return"";let r=this.resolvePath(a,t)??m(a,A)??a.name,o=this.hrefForSubject(a,s),i=this.svgUrlForSubject(a,s),c="";if(n){let l=this.resolvePath(a,n);l&&(c=`<span class="kan-ref-badge">${d(l)}</span>`)}return`<li class="kan-ref-row"><a class="kan-ref-rowlink" href="${d(o)}"><img class="kan-ref-icon" src="${d(i)}" alt="" loading="lazy"/><span class="kan-ref-text">${d(r)}</span>${c}</a></li>`}readPropertyValueText(e,t){let n=ee(e,t);if(n){if(n instanceof Z)return n.object;if(n instanceof M){let s=n.object;return this.readLabelForUri({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name})??s.subject.name}if(n instanceof B)return(n.object??[]).map(a=>a instanceof T?this.readLabelForUri({publisher:a.subject.publisher,package_:a.subject.package_,name:a.subject.name})??a.subject.name:a instanceof se?a.name??"":String(a)).filter(a=>a).join(", ")}}readPropertyValueReferences(e,t){let n=ee(e,t);if(!n)return[];if(n instanceof M)return[n.object];if(n instanceof B){let s=[];for(let a of n.object??[])a instanceof T&&s.push(a);return s}return[]}gatherValueItems(e){return e?e instanceof B?e.object??[]:e instanceof M?[e.object]:e instanceof ue?[e.object]:e instanceof Z?[e.object]:[]:[]}renderInlineValue(e,t,n){return e instanceof T?this.renderReferenceLink(e,t,n):e instanceof se?d(e.name??"(embedded)"):typeof e=="string"?d(e):typeof e=="number"||typeof e=="boolean"?d(String(e)):""}renderStatementInlineValue(e,t,n){return e instanceof Z?d(e.object):e instanceof M?this.renderReferenceLink(e.object,t,n):e instanceof B?(e.object??[]).map(a=>this.renderInlineValue(a,t,n)).filter(a=>a).join(", "):""}renderReferenceLink(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,a=this.urlForReference(e,t,n);return`<a class="kan-link" href="${d(a)}">${d(s)}</a>`}renderBadge(e,t,n){let s=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,a=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),r=this.urlForReference(e,t,n),o=a?` title="${d(a)}"`:"";return`<a class="kan-badge" href="${d(r)}"${o}>${d(s)}</a>`}urlForReference(e,t,n){let s=t?this.getUrlFormForProperty(t):"=";return ke.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},s,{contextPublisher:n})}getUrlFormForProperty(e){let t=D(this.catalog,e);if(!t)return"=";let n=m(t,nt);return n==="*"||n==="^"||n==="~"||n==="="?n:"="}readLabelForUri(e){let t=D(this.catalog,e);if(t)return m(t,A)}readCommentForUri(e){let t=D(this.catalog,e);if(t)return m(t,he)}};function Te(f){let e=new Map;for(let t of f.statement){if(!(t instanceof ue)||!ie(t,xe.publisher,xe.package_,xe.name))continue;let n=t.object;for(let s of n.statement){if(!(s instanceof Z))continue;let a=s.predicate?.subject?.name;if(!a)continue;let r=s.object;e.has(a)||e.set(a,r)}}return e}function Re(f){for(let e of f.statement)if(e instanceof ue&&ie(e,ye.publisher,ye.package_,ye.name))return e.object}function nn(f){for(let e of f.statement){if(!(e instanceof B)||!ie(e,Ee.publisher,Ee.package_,Ee.name))continue;let t=[];for(let n of e.object??[])n instanceof se&&t.push(n);return t}return[]}function me(f){for(let e of f.statement)if(e instanceof M&&e.predicate?.subject?.name==="type"&&e.object instanceof T){let t=e.object.subject;return{publisher:t.publisher,package_:t.package_,name:t.name}}}function E(f,e){for(let t of f.statement)if(t instanceof M&&ie(t,e.publisher,e.package_,e.name)&&t.object instanceof T){let n=t.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function Ce(f,e){for(let t of f.statement){if(!(t instanceof B)||!ie(t,e.publisher,e.package_,e.name))continue;let n=[];for(let s of t.object??[])s instanceof T&&n.push({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name});return n}return[]}function ee(f,e){for(let t of f.statement)if(ie(t,e.publisher,e.package_,e.name))return t}function m(f,e){for(let t of f.statement)if(t instanceof Z&&ie(t,e.publisher,e.package_,e.name))return t.object}function tn(f,e){for(let t of f.statement)if(t instanceof $e&&ie(t,e.publisher,e.package_,e.name))return t.object}function de(f){let e=[];for(let t of f.statement)if(t instanceof M){if(t.predicate?.subject?.name!=="type")continue;t.object instanceof T&&e.push(t.object)}else if(t instanceof B){if(t.predicate?.subject?.name!=="type")continue;for(let n of t.object??[])n instanceof T&&e.push(n)}return e}function Se(f){let e=[];for(let t of f.statement)if(t instanceof M){if(t.predicate?.subject?.name!=="subClassOf")continue;t.object instanceof T&&e.push(t.object)}else if(t instanceof B){if(t.predicate?.subject?.name!=="subClassOf")continue;for(let n of t.object??[])n instanceof T&&e.push(n)}return e}function re(f,e){let t=[];for(let n of f){if(!(n instanceof Q)||n.name!==e.name)continue;(n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&t.push(n)}return t}function D(f,e){let t="version"in e?e.version:void 0;if(t){let n=`${e.publisher}/${e.package_}@${t.major}.${t.minor}.${t.patch}`;for(let s of f)if(s instanceof Q&&s.name===e.name&&s.namespace===n)return s}for(let n of f){if(!(n instanceof Q)||n.name!==e.name)continue;if((n.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return n}}function ie(f,e,t,n){let s=f.predicate?.subject;return s?s.publisher===e&&s.package_===t&&s.name===n:!1}function R(f,e){return f.publisher===e.publisher&&f.package_===e.package_&&f.name===e.name}function X(f){return`${f.publisher}/${f.package_}/${f.name}`}function tt(f){return f.name==="Package"?{...Oe}:f}function H(f){let e=f.namespace||"",t=e.indexOf("/");return t>=0?e.substring(0,t):e}function d(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function st(f){let e=f.lastIndexOf(".");return e>=0?f.substring(e+1):f}function at(f,e){for(let t of f.statement)if(t.predicate?.subject?.name===e)return t}function oe(f){return f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ae(f,e){return f.length<=e?f:f.slice(0,e).replace(/\s+\S*$/,"")+"\u2026"}function sn(f){return f.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function rt(f){return f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ot(f){let e=Le(f);if(e)return d(e);if(/^https?:\/\//i.test(f)){let t=f;try{t=new URL(f).hostname.replace(/^www\./,"")}catch{}return`<a class="kan-link" href="${d(f)}" target="_blank" rel="noopener">${d(t)} \u2197</a>`}return d(f)}function Le(f){let e=/^(\d{4})-(\d{2})-(\d{2})([T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.exec(f.trim());if(!e)return;let t=Date.parse(f);if(!Number.isFinite(t))return;let n=new Date(t),a=`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getUTCMonth()]} ${n.getUTCDate()}, ${n.getUTCFullYear()}`;if(!e[4])return a;let r=n.getUTCHours(),o=(r+11)%12+1,i=r>=12?"PM":"AM";return`${a} \xB7 ${o}:${String(n.getUTCMinutes()).padStart(2,"0")} ${i} UTC`}function Ke(f){if(!f)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(f);return e?`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][parseInt(e[2],10)-1]??e[2]} ${parseInt(e[3],10)}`:f}export{Be as a,Ne as b};
|