@kanonak-protocol/sdk 3.51.0 → 3.53.0

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.
@@ -0,0 +1,102 @@
1
+ import{a as me}from"./chunk-NIGFQYVA.js";import{a as z,c as Le}from"./chunk-H2LEQLVD.js";import{a as Te,f as Ce,h as Ae,i as ve,k as Ze}from"./chunk-Q4DKP5DO.js";import{a as ye,e as oe}from"./chunk-FQHALFRR.js";import{c as J,d as S,g as B,h as pe,i as re,j as x,k as X,l as D}from"./chunk-W6T7MOKY.js";import{a as Xe}from"./chunk-FUUTGGJS.js";var be="kanonak.org",tn="look",Re="core-rdf",Kn={publisher:be,package_:tn,name:"displayLabel"},yn={publisher:be,package_:tn,name:"displaySummary"},Ln={publisher:be,package_:Re,name:"type"},Un={publisher:be,package_:Re,name:"subClassOf"},On={publisher:be,package_:Re,name:"label"},In={publisher:be,package_:Re,name:"comment"},Qe=new Xe(be,Re,"Resource");function E(g,e){let n=en(g,e,Kn)??On,a=en(g,e,yn)??In,t=Ae(e,n)??e.name,o=Ae(e,a);return{label:t,summary:o}}function en(g,e,n){let a=ve(e,n);if(a)return a;let t=new Set,o=nn(e,Ln);for(;o.length>0;){let s=o.shift(),i=Te(s);if(t.has(i))continue;t.add(i);let c=Ce(g,s);if(!c)continue;let r=ve(c,n);if(r)return r;o.push(...nn(c,Un))}if(!t.has(Te(Qe))){let s=Ce(g,Qe);if(s){let i=ve(s,n);if(i)return i}}}function nn(g,e){let n=ve(g,e);if(n)return[n];let a=[];for(let t of Ze(g,e))t instanceof S&&a.push(t.subject);return a}function Me(g,e={}){let n=g.replace(/\r\n/g,`
2
+ `).split(`
3
+ `),a=[],t=0;for(;t<n.length;){let o=n[t];if(o.trim()===""){t++;continue}let s=/^(\s*)```(\S*)\s*$/.exec(o);if(s){let r=s[2],l=[];for(t++;t<n.length&&!/^(\s*)```\s*$/.test(n[t]);)l.push(n[t]),t++;t++;let u=l.join(`
4
+ `),p=r&&e.highlight?e.highlight(r,u):je(u),k=r?` class="language-${sn(r)}"`:"";a.push(`<pre class="kan-code"><code${k}>${p}</code></pre>`);continue}let i=/^(#{1,6})\s+(.*)$/.exec(o);if(i){let r=i[1].length,l=$e(i[2].trim());a.push(`<h${r}>${l}</h${r}>`),t++;continue}if(o.includes("|")&&t+1<n.length&&an(n[t+1])){let r=Pe(o),l=wn(n[t+1]);t+=2;let u=[];for(;t<n.length&&n[t].trim()!==""&&n[t].includes("|");)u.push(Pe(n[t])),t++;a.push(xn(r,l,u));continue}if(/^\s*[-*]\s+/.test(o)){let r=[];for(;t<n.length&&/^\s*[-*]\s+/.test(n[t]);){let l=[n[t].replace(/^\s*[-*]\s+/,"")];for(t++;t<n.length&&n[t].trim()!==""&&!/^\s*[-*]\s+/.test(n[t])&&!/^\s*\d+\.\s+/.test(n[t]);)l.push(n[t]),t++;t<n.length&&n[t].trim()===""&&t++,r.push(`<li>${$e(l.join(" ").trim())}</li>`)}a.push(`<ul>
5
+ ${r.join(`
6
+ `)}
7
+ </ul>`);continue}if(/^\s*\d+\.\s+/.test(o)){let r=[];for(;t<n.length&&/^\s*\d+\.\s+/.test(n[t]);){let l=[n[t].replace(/^\s*\d+\.\s+/,"")];for(t++;t<n.length&&n[t].trim()!==""&&!/^\s*\d+\.\s+/.test(n[t])&&!/^\s*[-*]\s+/.test(n[t]);)l.push(n[t]),t++;t<n.length&&n[t].trim()===""&&t++,r.push(`<li>${$e(l.join(" ").trim())}</li>`)}a.push(`<ol>
8
+ ${r.join(`
9
+ `)}
10
+ </ol>`);continue}let c=[o];for(t++;t<n.length&&n[t].trim()!==""&&!/^(#{1,6})\s+/.test(n[t])&&!/^(\s*)```/.test(n[t])&&!/^\s*[-*]\s+/.test(n[t])&&!/^\s*\d+\.\s+/.test(n[t])&&!(n[t].includes("|")&&t+1<n.length&&an(n[t+1]));)c.push(n[t]),t++;a.push(`<p>${$e(c.join(" "))}</p>`)}return a.join(`
11
+ `)}function an(g){return g.includes("-")?/^[\s|:-]+$/.test(g):!1}function Pe(g){let e=g.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&(e=e.slice(0,-1)),e.split("|").map(n=>n.trim())}function wn(g){return Pe(g).map(e=>{let n=e.startsWith(":"),a=e.endsWith(":");return n&&a?"center":a?"right":n?"left":null})}function xn(g,e,n){let a=s=>{let i=e[s];return i?` style="text-align:${i}"`:""},t=g.map((s,i)=>`<th${a(i)}>${$e(s)}</th>`).join(""),o=n.map(s=>`<tr>${s.map((c,r)=>`<td${a(r)}>${$e(c)}</td>`).join("")}</tr>`).join(`
12
+ `);return`<table>
13
+ <thead><tr>${t}</tr></thead>
14
+ <tbody>
15
+ ${o}
16
+ </tbody>
17
+ </table>`}function $e(g){let e=je(g);return e=e.replace(/`([^`\n]+)`/g,(n,a)=>`<code>${a}</code>`),e=e.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(n,a,t)=>`<a href="${sn(t)}">${a}</a>`),e=e.replace(/\*\*([^*\n]+)\*\*/g,(n,a)=>`<strong>${a}</strong>`),e=e.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g,(n,a,t)=>`${a}<em>${t}</em>`),e=e.replace(/(^|[\s(])_([^_\n]+)_(?=[\s).,;:!?]|$)/g,(n,a,t)=>`${a}<em>${t}</em>`),e}function je(g){return g.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function sn(g){return g.replace(/"/g,"&quot;").replace(/&/g,"&amp;")}var Ue=class{byLang=new Map;constructor(e){for(let n of e){if(!n.language)continue;let a=[];for(let t of n.rules){if(!t.tokenClass||!t.pattern)continue;let o;try{o=new RegExp(t.pattern,"y")}catch{continue}a.push({tokenClass:t.tokenClass,re:o})}this.byLang.set(n.language,a)}}has(e){return this.byLang.has(e)}highlight(e,n){let a=this.byLang.get(e);return!a||a.length===0?je(n):n.split(`
18
+ `).map(t=>this.highlightLine(t,a)).join(`
19
+ `)}highlightLine(e,n){let a="",t=0;for(;t<e.length;){let o=!1;for(let s of n){s.re.lastIndex=t;let i=s.re.exec(e);if(i&&i[0].length>0){a+=`<span class="kan-tok-${s.tokenClass}">${je(i[0])}</span>`,t+=i[0].length,o=!0;break}}o||(a+=je(e[t]),t++)}return a}};var xe={publisher:"kanonak.org",package_:"derivation",name:"look"},Ee={publisher:"kanonak.org",package_:"derivation",name:"tokens"},ce={publisher:"kanonak.org",package_:"core-rdf",name:"Resource"},Ve={publisher:"kanonak.org",package_:"core-rdf",name:"label"},on={publisher:"kanonak.org",package_:"core-rdf",name:"comment"},En={publisher:"kanonak.org",package_:"core-rdf",name:"range"},Fn={publisher:"kanonak.org",package_:"core-rdf",name:"Class"},Tn={publisher:"kanonak.org",package_:"core-owl",name:"Class"},Cn={publisher:"kanonak.org",package_:"look",name:"Hero"},An={publisher:"kanonak.org",package_:"look",name:"PropertyList"},Pn={publisher:"kanonak.org",package_:"look",name:"PropertyTable"},Mn={publisher:"kanonak.org",package_:"look",name:"BadgeRow"},Vn={publisher:"kanonak.org",package_:"look",name:"ChipRow"},Nn={publisher:"kanonak.org",package_:"look",name:"ReferenceList"},Dn={publisher:"kanonak.org",package_:"look",name:"ReferencedBy"},Hn={publisher:"kanonak.org",package_:"look",name:"Instances"},rn={publisher:"kanonak.org",package_:"look",name:"Markdown"},Bn={publisher:"kanonak.org",package_:"look",name:"NavGroup"},Gn={publisher:"kanonak.org",package_:"look",name:"nav"},Ne={publisher:"kanonak.org",package_:"look",name:"NavLink"},Wn={publisher:"kanonak.org",package_:"look",name:"footer"},zn={publisher:"kanonak.org",package_:"look",name:"text"},Yn={publisher:"kanonak.org",package_:"look",name:"links"},cn={publisher:"kanonak.org",package_:"look",name:"target"},qn={publisher:"kanonak.org",package_:"look",name:"ResourceGrid"},Jn={publisher:"kanonak.org",package_:"look",name:"Timeline"},Xn={publisher:"kanonak.org",package_:"look",name:"VersionDiff"},Zn={publisher:"kanonak.org",package_:"look",name:"Figure"},Qn={publisher:"kanonak.org",package_:"look",name:"StatRow"},et={publisher:"kanonak.org",package_:"look",name:"Horizon"},nt={publisher:"kanonak.org",package_:"look",name:"PackageContents"},De={publisher:"kanonak.org",package_:"core-kanonak",name:"Package"},tt={publisher:"kanonak.org",package_:"core-kanonak",name:"Publisher"},at={publisher:"kanonak.org",package_:"look",name:"FeaturedResource"},st={publisher:"kanonak.org",package_:"look",name:"PublisherPackages"},ot={publisher:"kanonak.org",package_:"look",name:"packages"},rt={publisher:"kanonak.org",package_:"code-grammars",name:"CodeGrammar"},it={publisher:"kanonak.org",package_:"code-grammars",name:"language"},ct={publisher:"kanonak.org",package_:"code-grammars",name:"rule"},lt={publisher:"kanonak.org",package_:"code-grammars",name:"tokenClass"},ut={publisher:"kanonak.org",package_:"code-grammars",name:"pattern"},dt={publisher:"kanonak.org",package_:"look",name:"Links"},pt={publisher:"kanonak.org",package_:"link",name:"url"},ft={publisher:"kanonak.org",package_:"link",name:"links"};var kt={publisher:"kanonak.org",package_:"look",name:"Distribution"},gt={publisher:"kanonak.org",package_:"look",name:"alphaPath"},ht={publisher:"kanonak.org",package_:"look",name:"betaPath"},ln={publisher:"kanonak.org",package_:"look",name:"SectionHeading"},mt={publisher:"kanonak.org",package_:"look",name:"SectionNav"},un={publisher:"kanonak.org",package_:"look",name:"heading"},bt={publisher:"kanonak.org",package_:"look",name:"note"},$t={publisher:"kanonak.org",package_:"look",name:"VersionDelta"},jt={publisher:"kanonak.org",package_:"look",name:"TimePlot"},_t={publisher:"kanonak.org",package_:"look",name:"Details"},vt={publisher:"kanonak.org",package_:"look",name:"EmbeddedViews"},Rt={publisher:"kanonak.org",package_:"look",name:"skip"},St={publisher:"kanonak.org",package_:"derivation",name:"derivations"},Kt={publisher:"kanonak.org",package_:"look",name:"laneBy"},yt={publisher:"kanonak.org",package_:"look",name:"stats"},Lt={publisher:"kanonak.org",package_:"look",name:"statPath"},Ut={publisher:"kanonak.org",package_:"look",name:"statLabel"},dn={publisher:"kanonak.org",package_:"look",name:"labelPath"},Ot={publisher:"kanonak.org",package_:"look",name:"badgePath"},He={publisher:"kanonak.org",package_:"look",name:"orderBy"},pn={publisher:"kanonak.org",package_:"look",name:"track"},Oe={publisher:"kanonak.org",package_:"look",name:"metricPath"},Be={publisher:"kanonak.org",package_:"look",name:"hueBy"},fn={publisher:"kanonak.org",package_:"look",name:"lowerPath"},kn={publisher:"kanonak.org",package_:"look",name:"upperPath"},It={publisher:"kanonak.org",package_:"look",name:"axisMin"},wt={publisher:"kanonak.org",package_:"look",name:"axisMax"},xt={publisher:"kanonak.org",package_:"look",name:"valueLabel"};var gn={publisher:"kanonak.org",package_:"look",name:"semanticSvg"},Et={publisher:"kanonak.org",package_:"look",name:"tierChip"},Ft={publisher:"kanonak.org",package_:"look",name:"tierIcon"},Tt={publisher:"kanonak.org",package_:"look",name:"tierCard"},Ct={publisher:"kanonak.org",package_:"look",name:"tierFull"},At={publisher:"kanonak.org",package_:"core-rdf",name:"type"},hn=6,Ge={publisher:"kanonak.org",package_:"look",name:"bands"},Pt={publisher:"kanonak.org",package_:"look",name:"title"},Mt={publisher:"kanonak.org",package_:"look",name:"eyebrow"},Vt={publisher:"kanonak.org",package_:"look",name:"subtitle"},mn={publisher:"kanonak.org",package_:"look",name:"badges"},Y={publisher:"kanonak.org",package_:"look",name:"source"},Nt={publisher:"kanonak.org",package_:"look",name:"via"},Dt={publisher:"kanonak.org",package_:"look",name:"size"},Ht={publisher:"kanonak.org",package_:"look",name:"icon"},Bt={publisher:"kanonak.org",package_:"look",name:"avatar"},Gt={publisher:"kanonak.org",package_:"look",name:"contents"},Wt={publisher:"kanonak.org",package_:"look",name:"transitive"},zt={publisher:"kanonak.org",package_:"look",name:"chips"},bn={publisher:"kanonak.org",package_:"look",name:"entries"},Yt={publisher:"kanonak.org",package_:"look",name:"urlForm"},Je=class{constructor(e){this.catalog=e}catalog;_codeHighlighter;findCascadedLook(e){let n=qt(e)?void 0:Ie(e);return n?{declaration:n,sourceClass:{publisher:P(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name}}:this.lookFromTypeRefs(ae(e))}lookFromTypeRefs(e){let n=new Set,a=[...e];for(;a.length>0;){let o=a.shift().subject,s=V(o);if(n.has(s))continue;n.add(s);let i=le(this.catalog,o);for(let c of i){let r=Ie(c);if(r)return{declaration:r,sourceClass:{publisher:o.publisher,package_:o.package_,name:o.name}}}for(let c of i)for(let r of Ke(c))a.push(r)}if(!n.has(V(ce)))for(let t of le(this.catalog,ce)){let o=Ie(t);if(o)return{declaration:o,sourceClass:{...ce}}}}findCascadedTokens(e){let n=new Map;for(let[o,s]of We(e))n.has(o)||n.set(o,s);let a=new Set,t=ae(e);for(;t.length>0;){let o=t.shift(),s=V(o.subject);if(a.has(s))continue;a.add(s);let i=le(this.catalog,o.subject);if(i.length!==0)for(let c of i){for(let[r,l]of We(c))n.has(r)||n.set(r,l);for(let r of Ke(c))t.push(r)}}if(!a.has(V(ce))){let o=le(this.catalog,ce);for(let s of o)for(let[i,c]of We(s))n.has(i)||n.set(i,c)}return n}renderSvg(e){let n=E(this.catalog,e).label,a=(n.trim().charAt(0)||"?").toUpperCase(),t=`${e.namespace??""}/${e.name}`,o={label:n,firstLetter:a,uri:t},s=this.collectCascadedSvgTiers(e),i=h=>this.applyPlaceholders(h,e,o),c=i(s.tierChip??""),r=i(s.tierIcon??""),l=i(s.tierCard??""),u=i(s.tierFull??""),k=[...this.findCascadedTokens(e)].map(([h,f])=>`--kan-${h}: ${f};`).join(" ");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" style="${ue(k)}">
20
+ <style>
21
+ .tier-chip,.tier-icon,.tier-card{display:none}
22
+ .tier-full{display:block}
23
+ @media (max-width:400px){.tier-full{display:none}.tier-card{display:block}}
24
+ @media (max-width:160px){.tier-card{display:none}.tier-icon{display:block}}
25
+ @media (max-width:60px){.tier-icon{display:none}.tier-chip{display:block}}
26
+ </style>
27
+ <g class="tier-chip">${c}</g>
28
+ <g class="tier-icon">${r}</g>
29
+ <g class="tier-card">${l}</g>
30
+ <g class="tier-full">${u}</g>
31
+ </svg>`}applyPlaceholders(e,n,a){return e.replace(/\{\{([^}]+)\}\}/g,(t,o)=>{let s=o.trim();if(a[s]!==void 0)return ue(a[s]);let i=s.indexOf(":");if(i>0){let r=s.slice(0,i),l=s.slice(i+1).trim();if(r==="delta"||r==="deltaArrow"||r==="deltaColor"||r==="deltaDir"){let u=this.metricDelta(n,l);return r==="deltaColor"?u?u.dir==="up"?"#34d399":u.dir==="down"?"#f87171":"#9aa5b8":"#9aa5b8":r==="deltaDir"?u?u.dir:"new":u?r==="deltaArrow"?u.dir==="up"?"\u25B2":u.dir==="down"?"\u25BC":"\u2014":ue(`${u.delta>0?"+":""}${u.delta.toFixed(2)}`):""}if(r==="svg")return this.resolvePath(n,l)??""}let c=this.resolvePath(n,s);return c===void 0?`{{${s}}}`:ue(c)})}metricDelta(e,n){let a=k=>{let h=this.resolvePath(k,n),f=h===void 0?NaN:parseFloat(h);return Number.isFinite(f)?f:void 0},t=a(e);if(t===void 0)return;let o=k=>oe((k.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},s=(k,h)=>k.major-h.major||k.minor-h.minor||k.patch-h.patch,i={publisher:P(e),package_:(e.namespace||"").split("/")[1]?.split("@")[0]??"",name:e.name},c=o(e),r,l;for(let k of le(this.catalog,i)){let h=o(k);s(h,c)<0&&(!l||s(h,l)>0)&&(r=k,l=h)}if(!r)return;let u=a(r);if(u===void 0)return;let p=t-u;return{delta:p,dir:Math.abs(p)<.005?"flat":p>0?"up":"down"}}resolvePath(e,n){let a=n.split("/").map(t=>t.trim()).filter(t=>t.length>0);if(a.length!==0)return this.resolvePathSteps(e,a)}resolvePathSteps(e,n){let a=Jt(n[0]),t=Xt(e,a);if(!t)return;let o=n.length===1;if(t instanceof X)return o?void 0:this.resolvePathSteps(t.object,n.slice(1));if(t instanceof x&&t.object instanceof S){let s=t.object.subject,i=le(this.catalog,s);if(i.length===0){let r=G(this.catalog,s);r&&i.push(r)}if(o){for(let r of i){let l=E(this.catalog,r);if(l.label!==r.name)return l.label}return s.name}let c=n.slice(1);for(let r of i){let l=this.resolvePathSteps(r,c);if(l!==void 0)return l}return}if(o&&(t instanceof B||t instanceof pe||t instanceof re))return String(t.object)}collectCascadedSvgTiers(e){let n={},a=s=>{let i=M(s,gn);if(!(i instanceof X))return;let c=i.object,r=L(c,Et),l=L(c,Ft),u=L(c,Tt),p=L(c,Ct);n.tierChip===void 0&&r!==void 0&&(n.tierChip=r),n.tierIcon===void 0&&l!==void 0&&(n.tierIcon=l),n.tierCard===void 0&&u!==void 0&&(n.tierCard=u),n.tierFull===void 0&&p!==void 0&&(n.tierFull=p)};a(e);let t=new Set,o=ae(e);for(;o.length>0;){let s=o.shift(),i=V(s.subject);if(t.has(i))continue;t.add(i);let c=le(this.catalog,s.subject);for(let r of c){a(r);for(let l of Ke(r))o.push(l)}}if(!t.has(V(ce)))for(let s of le(this.catalog,ce))a(s);return n}renderStylesheet(e){let n=this.findCascadedTokens(e),a=[];for(let[s,i]of n)a.push(` --kan-${s}: ${i};`);let t=a.length>0?`:root {
32
+ ${a.join(`
33
+ `)}
34
+ }`:":root { /* no tokens resolved */ }",o=this.findBaseStylesheet(P(e))??"";return`${t}
35
+ ${o}`}findBaseStylesheet(e){let n="kanonak.org/site/content",a=r=>oe((r.namespace||"").split("@")[1]??""),t,o,s,i;for(let r of this.catalog){if(!(r instanceof J)||r.name!=="base-stylesheet")continue;let l=r.namespace||"";if(l.startsWith(`${e}/look-styles@`)){let u=a(r);u&&(!o||ye(u,o)>0)&&(t=r,o=u)}else if(l.startsWith("kanonak.org/look-styles@")){let u=a(r);u&&(!i||ye(u,i)>0)&&(s=r,i=u)}}let c=t??s;if(c)for(let r of c.statement){let l=r.predicate?.subject;if(!l)continue;if(`${l.publisher}/${l.package_}/${l.name}`===n&&r instanceof B)return r.object}}renderHtml(e){let n=this.findCascadedLook(e);if(!n)return`<!-- LookRenderer: no derivation.look found for ${e.namespace}/${e.name} -->`;let a=ze(n.declaration);if(a.length===0)return"<!-- LookRenderer: look declaration has no bands -->";let t=P(e),o=this.collectSectionHeadings(a),s=[];for(let i of a)s.push(this.renderBand(i,e,t,o));return s.join(`
36
+ `)}collectSectionHeadings(e){let n=[];for(let a of e){let t=Se(a);if(!t||!v(t,ln))continue;let o=L(a,un);o&&n.push({slug:jn(o),label:o})}return n}publisherSubject(e){for(let a of this.catalog)if(a instanceof J&&P(a)===e&&ae(a).some(t=>v(t.subject,tt)))return a;let n=new J;return n.namespace=e,n.name=e,n.statement=[x.parse("kanonak.org/core-rdf/type","kanonak.org/core-kanonak/Publisher"),B.parse("kanonak.org/core-rdf/label",e)],n}hasDeclaredView(e){let n=this.findCascadedLook(e);return n?!(t=>t.publisher===ce.publisher&&t.package_===ce.package_&&t.name===ce.name||t.publisher===De.publisher&&t.package_===De.package_&&t.name===De.name)(n.sourceClass):!1}renderPackageVersionList(e,n,a){let t=P(a),o=this.renderNavGroup(a,t),s=this.renderBreadcrumb(a,t,{bareOverview:!0}),i=n.map(r=>`<a class="kan-resource-card" href="/${d(e)}/${d(r)}/"><h3 class="kan-resource-card-title">${d(r)}</h3></a>`).join(`
37
+ `),c=`<header class="kan-hero">
38
+ <span class="kan-hero-eyebrow">PACKAGE</span>
39
+ <h1 class="kan-hero-title">${d(e)}</h1>
40
+ </header>
41
+ <section class="kan-resource-grid">
42
+ ${i}
43
+ </section>`;return`<!doctype html>
44
+ <html lang="en">
45
+ <head>
46
+ <meta charset="utf-8">
47
+ <meta name="viewport" content="width=device-width, initial-scale=1">
48
+ <title>${d(e)}</title>
49
+ <link rel="stylesheet" href="${d(a.name)}.css">
50
+ </head>
51
+ <body>
52
+ ${o}
53
+ ${s}
54
+ <main class="kan-main">
55
+ ${c}
56
+ </main>
57
+ </body>
58
+ </html>
59
+ `}renderDocument(e,n){let a=this.renderHtml(e),t=E(this.catalog,e).label,o=n?.rootIndex?"index.css":`${e.name}.css`,s=!n?.rootIndex&&this.hasSvgDerivation(e)?`<figure class="kan-figure"><img src="${d(e.name)}.svg" alt=""></figure>
60
+ `:"",i=P(e),c=this.renderNavGroup(e,i),r=this.renderSiteFooter(i),l=n?.rootIndex?"":this.renderBreadcrumb(e,i,n);return`<!doctype html>
61
+ <html lang="en">
62
+ <head>
63
+ <meta charset="utf-8">
64
+ <meta name="viewport" content="width=device-width, initial-scale=1">
65
+ <title>${d(t)}</title>
66
+ <link rel="stylesheet" href="${d(o)}">
67
+ </head>
68
+ <body>
69
+ ${c}
70
+ ${l}
71
+ <main class="kan-main">
72
+ ${s}${a}
73
+ </main>
74
+ ${r}
75
+ </body>
76
+ </html>
77
+ `}hasSvgDerivation(e){let n=new Set,a=ae(e);for(;a.length>0;){let t=a.shift(),o=V(t.subject);if(n.has(o))continue;n.add(o);let s=G(this.catalog,t.subject);if(s){for(let i of s.statement)if(i instanceof D&&de(i,"kanonak.org","derivation","derivations")){for(let c of i.object??[])if(c instanceof z)for(let r of c.statement){if(!(r instanceof x)||!de(r,"kanonak.org","derivation","format")||!(r.object instanceof S))continue;let l=r.object.subject;if(l.publisher==="kanonak.org"&&l.package_==="formats"&&l.name==="svg")return!0}}for(let i of Ke(s))a.push(i)}}return!1}renderBand(e,n,a,t=[],o=""){let s=Se(e);return s?v(s,mt)?this.renderSectionNav(t):v(s,Cn)?this.renderHero(e,n,a):v(s,An)?this.renderPropertyList(e,n,a):v(s,Pn)?this.renderPropertyTable(e,n,a,o):v(s,Mn)?this.renderBadgeRow(e,n,a):v(s,Vn)?this.renderChipRow(e,n,a):v(s,Nn)?this.renderReferenceList(e,n,a):v(s,Dn)?this.renderReferencedBy(e,n,a):v(s,Hn)?this.renderInstances(e,n,a):v(s,rn)?this.renderMarkdown(e,n,a):v(s,dt)?this.renderLinks(e,n):v(s,Bn)?this.renderNavGroup(n,a):v(s,qn)?this.renderResourceGrid(e,a,n):v(s,Jn)?this.renderTimeline(e,a):v(s,Xn)?this.renderVersionDiff(e,a):v(s,Zn)?this.renderFigure(e,n,a):v(s,Qn)?this.renderStatRow(e,n):v(s,et)?this.renderHorizon(e,n,a):v(s,nt)?this.renderPackageContents(n,a):v(s,at)?this.renderFeaturedResource(e,a):v(s,st)?this.renderPublisherPackages(e,a):v(s,kt)?this.renderDistribution(e,n):v(s,ln)?this.renderSectionHeading(e):v(s,$t)?this.renderVersionDelta(e,n):v(s,jt)?this.renderTimePlot(e,n,a):v(s,_t)?this.renderDetails(e,n,a):v(s,vt)?this.renderEmbeddedViews(e,n,a,o):`<!-- LookRenderer: unsupported band ${s.publisher}/${s.package_}/${s.name} -->`:"<!-- LookRenderer: band has no rdf:type -->"}collectTrackedSeries(e,n,a,t){let{hueBy:o,lowerPath:s,upperPath:i}=t??{},c=new Map,r=e.length,l=(u,p)=>{let k=this.resolvePath(u,p);return k===void 0?NaN:parseFloat(k)};return e.forEach((u,p)=>{let k=this.readPropertyValueReferences(u,n);for(let h of k){let f=G(this.catalog,{publisher:h.subject.publisher,package_:h.subject.package_,name:h.subject.name,...h.subject.version?{version:h.subject.version}:{}});if(!f)continue;let m=h.subject.name,b=c.get(m);b||(b={key:m,label:E(this.catalog,f).label,points:new Array(r).fill(null),...s?{lower:new Array(r).fill(null)}:{},...i?{upper:new Array(r).fill(null)}:{}},c.set(m,b));let j=l(f,a);if(Number.isFinite(j)&&(b.points[p]=j),s&&b.lower){let $=l(f,s);Number.isFinite($)&&(b.lower[p]=$)}if(i&&b.upper){let $=l(f,i);Number.isFinite($)&&(b.upper[p]=$)}if(o){let $=l(f,o);Number.isFinite($)&&(b.hue=$)}b.lastSubject=f}}),[...c.values()]}hrefForSubject(e,n,a="="){let t=e.namespace||"",o=t.split("/")[1]?.split("@")[0]??"",s=t.split("@")[1]??"",i=s?oe(s):void 0;return me.formatResourceUrl({publisher:P(e),package_:o,name:e.name,...i?{version:i}:{}},a,{contextPublisher:n})}renderVersionDiff(e,n){let a=F(e,Y);if(!a)return"<!-- LookRenderer.VersionDiff: no look.source -->";let t=L(e,Oe),o=F(e,pn);if(!o||!t)return"<!-- LookRenderer.VersionDiff: needs look.track + look.metricPath -->";let s=F(e,He),i=L(e,Be),c=this.findInstancesOfClass(a);if(c.length===0)return"<!-- LookRenderer.VersionDiff: no instances -->";let r=k=>s?this.readPropertyValueText(k,s)??"":"",l=c.slice().sort((k,h)=>r(k).localeCompare(r(h))),u=this.collectTrackedSeries(l,o,t,{hueBy:i});return u.length===0?"<!-- LookRenderer.VersionDiff: no tracked series -->":`<section class="kan-vdiff">${u.map((k,h)=>{let f=k.hue!==void 0?k.hue:Math.round(h*360/u.length),m=k.points.filter(y=>y!==null);if(m.length===0)return"";let b=m[0],j=m[m.length-1],$=j-b,K;if(Math.abs($)>=.005){let y=$>0?"up":"down",w=$>0?"\u25B2":"\u25BC";K=`<span class="kan-vdiff-delta ${y}">${$>0?"+":""}${$.toFixed(2)} ${w}</span>`}else K='<span class="kan-vdiff-delta flat">\u2014</span>';let O=k.lastSubject&&this.isLinkable(P(k.lastSubject),n)?`<a href="${d(this.hrefForSubject(k.lastSubject,n))}">${d(k.label)}</a>`:d(k.label);return`<div class="kan-vdiff-row" style="--kan-vdiff-hue:${f}"><span class="kan-vdiff-label">${O}</span><span class="kan-vdiff-start">${b.toFixed(2)}</span>`+this.sparkline(k.points,f)+`<span class="kan-vdiff-end">${j.toFixed(2)}</span>`+K+"</div>"}).join("")}</section>`}sparkline(e,n){let s=`hsl(${n},65%,60%)`,i=e.filter(m=>m!==null);if(i.length===0)return'<svg class="kan-vdiff-spark" viewBox="0 0 132 30" xmlns="http://www.w3.org/2000/svg"></svg>';let c=Math.min(...i),l=Math.max(...i)-c,u=e.length,p=m=>u<=1?132/2:4+m/(u-1)*124,k=m=>l<1e-9?30/2:26-(m-c)/l*22,h=[],f=[];return e.forEach((m,b)=>{if(m===null)return;let j=p(b),$=k(m);h.push(`${j.toFixed(1)},${$.toFixed(1)}`),f.push(`<circle cx="${j.toFixed(1)}" cy="${$.toFixed(1)}" r="2" fill="${s}"/>`)}),`<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="${s}" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>`+f.join("")+"</svg>"}svgUrlForSubject(e,n,a="="){return`${this.hrefForSubject(e,n,a)}.svg`}renderFigure(e,n,a){let t=n,o=F(e,Y);if(o){let l=G(this.catalog,o);l&&(t=l)}let s=this.svgUrlForSubject(t,a),i=E(this.catalog,t).label,c=L(e,Dt);return`<figure class="kan-figure${c==="small"||c==="medium"||c==="large"?` kan-figure-${c}`:""}"><img class="kan-figure-img" src="${d(s)}" alt="${d(i)}" loading="lazy"/></figure>`}renderStatRow(e,n){let a=M(e,yt),t=this.gatherValueItems(a).filter(s=>s instanceof z);if(t.length===0)return"<!-- LookRenderer.StatRow: no look.stats -->";let o=[];for(let s of t){let i=L(s,Lt);if(!i)continue;let c=this.resolvePath(n,i);if(c===void 0)continue;let r=L(s,Ut)??"";o.push('<div class="kan-stat">'+(r?`<span class="kan-stat-label">${d(r)}</span>`:"")+`<span class="kan-stat-val">${d(c)}</span></div>`)}return o.length===0?"":`<div class="kan-stat-row">${o.join("")}</div>`}renderHorizon(e,n,a){let t=F(e,Y);if(!t)return"<!-- LookRenderer.Horizon: no look.source -->";let o=this.gatherValueItems(M(n,t)).filter(i=>i instanceof z);return o.length===0?"":`<section class="kan-horizon">${o.map(i=>this.renderConditionNode(i,a,0)).join("")}</section>`}renderConditionNode(e,n,a){let t=Se(e),o=t?this.readLabelForUri({publisher:t.publisher,package_:t.package_,name:t.name})??t.name:"Condition",s=[],i=[];for(let p of e.statement){let k=p.predicate?.subject;if(!k||k.name==="type")continue;let h=this.readLabelForUri({publisher:k.publisher,package_:k.package_,name:k.name})??k.name;if(p instanceof B||p instanceof pe||p instanceof re)s.push(`<div class="kan-cond-field"><span class="kan-cond-key">${d(h)}</span><span class="kan-cond-v">${d(String(p.object))}</span></div>`);else if(p instanceof x&&p.object instanceof S){let f=p.object.subject,m=this.readLabelForUri({publisher:f.publisher,package_:f.package_,name:f.name})??f.name;s.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(p instanceof X)i.push(this.renderConditionNode(p.object,n,a+1));else if(p instanceof D)for(let f of p.object??[])f instanceof z&&i.push(this.renderConditionNode(f,n,a+1))}let c=s.length?`<div class="kan-cond-fields">${s.join("")}</div>`:"",r=i.length?`<div class="kan-cond-children">${i.join("")}</div>`:"",l=i.length>0,u=l?`<span class="kan-cond-op">${d(o)}</span>`:`<div class="kan-cond-type">${d(o)}</div>`;return`<div class="kan-cond ${l?"kan-cond-branch":"kan-cond-leaf"}">${u}${c}${r}</div>`}renderSectionHeading(e){let n=e,a=L(n,un);if(!a)return"<!-- LookRenderer.SectionHeading: no look.heading -->";let t=L(n,bt);return`<div class="kan-section" id="${jn(a)}"><h2 class="kan-section-title">${d(a)}</h2>`+(t?`<p class="kan-section-note">${d(t)}</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(a=>`<a class="kan-section-nav-link" href="#${d(a.slug)}">${d(a.label)}</a>`).join("")}</nav>`}renderVersionDelta(e,n){let t=L(e,Oe);if(!t)return"<!-- LookRenderer.VersionDelta: no look.metricPath -->";let o=C=>{let N=this.resolvePath(C,t),Z=N===void 0?NaN:parseFloat(N);return Number.isFinite(Z)?Z:void 0},s=o(n);if(s===void 0)return"";let i=C=>oe((C.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},c=(C,N)=>C.major-N.major||C.minor-N.minor||C.patch-N.patch,r={publisher:P(n),package_:(n.namespace||"").split("/")[1]?.split("@")[0]??"",name:n.name},l=i(n),u,p;for(let C of le(this.catalog,r)){let N=i(C);c(N,l)<0&&(!p||c(N,p)>0)&&(u=C,p=N)}if(!u||!p)return'<div class="kan-delta kan-delta-first">First tracked in this version</div>';let k=o(u);if(k===void 0)return"";let h=s-k,f=Math.abs(h)<.005?"flat":h>0?"up":"down",m=f==="up"?"\u25B2":f==="down"?"\u25BC":"\u2014",b=f==="up"?"#34d399":f==="down"?"#f87171":"var(--kan-text-faint)",j=`${p.major}.${p.minor}.${p.patch}`,$=320,K=46,O=14,y=30,w=C=>O+Math.min(1,Math.max(0,C))*($-2*O),T=w(k),H=w(s),fe=`<svg class="kan-delta-track" viewBox="0 0 ${$} ${K}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${O}" y1="${y}" x2="${$-O}" y2="${y}" class="kan-delta-base"/><line x1="${T.toFixed(1)}" y1="${y}" x2="${H.toFixed(1)}" y2="${y}" stroke="${b}" stroke-width="3"/><circle cx="${T.toFixed(1)}" cy="${y}" r="4" class="kan-delta-prev"/><circle cx="${H.toFixed(1)}" cy="${y}" r="5.5" fill="${b}"/><text x="${T.toFixed(1)}" y="${y-9}" text-anchor="middle" class="kan-delta-tick kan-delta-tick-prev">${k.toFixed(2)}</text><text x="${H.toFixed(1)}" y="${y+17}" text-anchor="middle" class="kan-delta-tick">${s.toFixed(2)}</text></svg>`;return`<div class="kan-delta"><div class="kan-delta-head"><span class="kan-delta-vs">vs ${d(j)}</span><span class="kan-delta-badge ${f}">${h>0?"+":""}${h.toFixed(2)} ${m}</span></div>`+fe+"</div>"}renderTimePlot(e,n,a){let t=F(e,Y),o=F(e,He);if(!t||!o)return"<!-- LookRenderer.TimePlot: needs look.source + look.orderBy -->";let s=e,i=L(s,Kt),c=L(s,dn),r=[];for(let R of this.readPropertyValueReferences(n,t)){let W=G(this.catalog,{publisher:R.subject.publisher,package_:R.subject.package_,name:R.subject.name,...R.subject.version?{version:R.subject.version}:{}});if(!W)continue;let U=this.readPropertyValueText(W,o)??"",I=Date.parse(U);if(!Number.isFinite(I))continue;let se=i?this.resolvePath(W,i)??"":"",_=(c?this.resolvePath(W,c):void 0)??E(this.catalog,W).label;r.push({t:I,dateStr:U,lane:se,label:_,href:this.hrefForSubject(W,a),linkable:this.isLinkable(P(W),a)})}if(r.length===0)return"<!-- LookRenderer.TimePlot: no dated points -->";let l=[];for(let R of r)l.includes(R.lane)||l.push(R.lane);let u=Math.min(...r.map(R=>R.t)),p=Math.max(...r.map(R=>R.t));p===u&&(p=u+1);let k=l.some(R=>R),h=720,f=k?96:16,m=18,b=12,j=24,$=36,K=b+l.length*$+j,O=f,y=h-m,w=y-O,T=R=>O+(R-u)/(p-u)*w,H=R=>b+R*$+$/2,fe=R=>Math.round(R*360/Math.max(1,l.length)),C=[];l.forEach((R,W)=>{let U=H(W);C.push(`<line x1="${O}" y1="${U.toFixed(1)}" x2="${y}" y2="${U.toFixed(1)}" class="kan-plot-guide"/>`),R&&C.push(`<text x="${(f-8).toFixed(1)}" y="${(U+4).toFixed(1)}" text-anchor="end" class="kan-plot-lane">${ue(R)}</text>`)});let N={},Z=[];for(let R of r){let W=l.indexOf(R.lane),I=((N[R.lane]=(N[R.lane]??0)+1)%3-1)*7,se=T(R.t),_=H(W)+I,A=`${we(R.dateStr)} \xB7 ${R.label}`,Q=`<circle cx="${se.toFixed(1)}" cy="${_.toFixed(1)}" r="5" fill="hsl(${fe(W)},65%,60%)" class="kan-plot-pt"><title>${ue(A)}</title></circle>`;Z.push(R.linkable?`<a href="${d(R.href)}" class="kan-plot-link">${Q}</a>`:Q)}let ge=`<text x="${O}" y="${(K-6).toFixed(1)}" text-anchor="start" class="kan-plot-axis">${ue(we(new Date(u).toISOString()))}</text><text x="${y}" y="${(K-6).toFixed(1)}" text-anchor="end" class="kan-plot-axis">${ue(we(new Date(p).toISOString()))}</text>`;return`<section class="kan-plot">${`<svg class="kan-plot-svg" viewBox="0 0 ${h} ${K}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+C.join("")+Z.join("")+ge+"</svg>"}</section>`}renderDetails(e,n,a){let t=Ye(e,Rt),o=this.detailRows(n,a,t);return o?`<dl class="kan-details">${o}</dl>`:"<!-- LookRenderer.Details: no properties -->"}detailRows(e,n,a){let t=[];for(let o of e.statement){let s=o.predicate?.subject;if(!s||this.isMetaPredicate(s)||a.some(r=>v(r,s)))continue;let i=this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name,c=this.detailValue(o,n,a);c&&t.push(`<dt class="kan-details-key">${d(i)}</dt><dd class="kan-details-val">${c}</dd>`)}return t.join("")}detailValue(e,n,a){if(e instanceof B)return vn(e.object);if(e instanceof pe||e instanceof re)return d(String(e.object));if(e instanceof x&&e.object instanceof S)return this.detailReferenceLink(e.object,n);if(e instanceof X)return this.detailEmbedded(e.object,n,a);if(e instanceof D){let t=e.object??[];return t.length>0&&t.every(o=>o instanceof z)?t.map(o=>this.detailEmbedded(o,n,a)).join(""):t.map(o=>o instanceof S?this.detailReferenceLink(o,n):o instanceof z?this.detailEmbedded(o,n,a):d(String(o))).filter(o=>o).join(", ")}return""}detailReferenceLink(e,n){let a=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(a)}</span>`;let t=this.urlForReference(e,void 0,n);return`<img class="kan-md-chip" src="${d(`${t}.svg`)}" alt="" loading="lazy"><a class="kan-link" href="${d(t)}">${d(a)}</a>`}detailEmbedded(e,n,a){let t=Se(e),o=t?this.readLabelForUri({publisher:t.publisher,package_:t.package_,name:t.name})??t.name:"",s=this.detailRows(e,n,a);return'<div class="kan-details-embed">'+(o?`<span class="kan-details-type">${d(o)}</span>`:"")+(s?`<dl class="kan-details">${s}</dl>`:"")+"</div>"}rangeTypeRefs(e){let n=G(this.catalog,e);if(!n)return[];let a=M(n,En);return a instanceof x&&a.object instanceof S?[a.object]:[]}renderEmbeddedViews(e,n,a,t=""){let o=F(e,Y);if(!o)return"<!-- LookRenderer: EmbeddedViews missing look.source -->";let s=this.gatherValueItems(M(n,o)).filter(k=>k instanceof z);if(s.length===0)return"";let i=t?`${t}.${o.name}`:o.name,c=M(e,Gt),r=c instanceof re?c.object===!0:c instanceof B&&c.object==="true",l=[],u=s.map(k=>{let h=k,f=k.name?`${i}.${k.name}`:"";if(r&&f){let y=E(this.catalog,h).label||k.name||f;l.push(`<a class="kan-section-nav-link" href="#${d(f)}">${d(y)}</a>`)}let m=ae(h),b=m.length>0?m:this.rangeTypeRefs(o),j=Ie(h)?this.findCascadedLook(h):this.lookFromTypeRefs(b),$="";if(j)$=ze(j.declaration).map(y=>this.renderBand(y,h,a,[],f)).join(`
78
+ `);else{let y=this.detailRows(k,a,[]);$=y?`<dl class="kan-details">${y}</dl>`:""}let K=f?` id="${d(f)}"`:"",O=f?this.anchorLink(f):"";return`<section class="kan-embedded-view"${K}>${O}${$}</section>`});return`<div class="kan-embedded-views">${l.length>0?`<nav class="kan-section-nav" aria-label="On this page">${l.join("")}</nav>
79
+ `:""}${u.join(`
80
+ `)}</div>`}anchorLink(e){return`<a class="kan-anchor" href="#${d(e)}" title="${d(e)}" aria-label="Link to this resource">#</a>`}isMetaPredicate(e){return v(e,At)||v(e,Ve)||v(e,on)||v(e,xe)||v(e,Ee)||v(e,St)||v(e,gn)||v(e,ft)}renderPackageContents(e,n){let a=e.namespace||"";if(!a)return"";let t=this.catalog.filter(s=>s instanceof J&&s.namespace===a&&s.name!==e.name);return t.length===0?`<!-- LookRenderer.PackageContents: no members in ${a} -->`:(t.sort((s,i)=>{let c=E(this.catalog,s).label,r=E(this.catalog,i).label;return c.localeCompare(r)}),`<section class="kan-pkg-grid">${t.map(s=>{let i=E(this.catalog,s),c=i.label,r=i.summary,l=r?qe(r,160):"",u=this.hrefForSubject(s,n),p=this.svgUrlForSubject(s,n);return`<a class="kan-pkg-card" href="${d(u)}"><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(c)}</span>`+(l?`<span class="kan-pkg-card-comment">${d(l)}</span>`:"")+"</span></a>"}).join("")}</section>`)}renderReferencedBy(e,n,a){let t=F(e,Nt),o={publisher:P(n),package_:(n.namespace||"").split("/")[1]?.split("@")[0]??"",name:n.name},s=V(o),i=p=>oe((p.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},c=(p,k)=>p.major-k.major||p.minor-k.minor||p.patch-k.patch,r=new Map;for(let p of this.catalog){if(!(p instanceof J))continue;let k=V({publisher:P(p),package_:(p.namespace||"").split("/")[1]?.split("@")[0]??"",name:p.name});if(k!==s)for(let h of p.statement){let f=h.predicate?.subject;if(!f||f.name==="type"||t&&V(f)!==V(t))continue;let m=[];if(h instanceof x&&h.object instanceof S)m.push(h.object);else if(h instanceof D)for(let K of h.object??[])K instanceof S&&m.push(K);if(!m.some(K=>V(K.subject)===s))continue;let b=V(f),j=r.get(b);j||(j={label:this.readLabelForUri(f)??f.name,best:new Map},r.set(b,j));let $=j.best.get(k);(!$||c(i(p),i($))>0)&&j.best.set(k,p)}}return r.size===0?"<!-- LookRenderer.ReferencedBy: no incoming references -->":`<div class="kan-section"><h2 class="kan-section-title">Referenced by</h2></div>${[...r.values()].sort((p,k)=>p.label.localeCompare(k.label)).map(p=>{let h=[...p.best.values()].sort((f,m)=>E(this.catalog,f).label.localeCompare(E(this.catalog,m).label)).map(f=>this.resourceCard(f,a,n.namespace??void 0)).join("");return`<div class="kan-rel-group"><h3 class="kan-rel-prop"><span class="kan-rel-dir" title="incoming \u2014 references this resource">\u2190</span> ${d(p.label)}</h3><section class="kan-pkg-grid">${h}</section></div>`}).join("")}`}resourceCard(e,n,a){let t=E(this.catalog,e),o=t.summary?qe(t.summary,160):"",s=ae(e).map(m=>this.readLabelForUri({publisher:m.subject.publisher,package_:m.subject.package_,name:m.subject.name})??m.subject.name),c='<span class="kan-pkg-card-body">'+(s.length>0?`<span class="kan-card-types">${s.map(m=>`<span class="kan-card-type">${d(m)}</span>`).join("")}</span>`:"")+`<span class="kan-pkg-card-title">${d(t.label)}</span>`+(o?`<span class="kan-pkg-card-comment">${d(o)}</span>`:"")+"</span>",r=this.isLinkable(P(e),n),l=r?`<a class="kan-pkg-card-link" href="${d(this.hrefForSubject(e,n))}"><img class="kan-pkg-card-svg" src="${d(this.svgUrlForSubject(e,n))}" alt="" loading="lazy"/>`+c+"</a>":`<span class="kan-pkg-card-link">${c}</span>`,u=e.namespace||"",p=u.split("/")[0]??"",[k,h]=(u.split("/")[1]??"").split("@"),f="";if(k&&u!==a){let m=h?`<span class="kan-card-at">@</span><span class="kan-card-ver">${d(h)}</span>`:"";if(r){let b=`<span class="kan-card-pkg">${d(k)}</span>${m}`;f=`<a class="kan-pkg-card-foot" href="/${d(k)}${h?"/"+d(h):""}" title="${d(h?`${k}@${h}`:k)}">${b}</a>`}else{let b=`<span class="kan-card-pub">${d(p)}/</span><span class="kan-card-pkg">${d(k)}</span>${m}`;f=`<span class="kan-pkg-card-foot" title="${d(h?`${p}/${k}@${h}`:`${p}/${k}`)}">${b}</span>`}}return`<div class="kan-pkg-card kan-pkg-card--foot">${l}${f}</div>`}renderInstances(e,n,a){let t={publisher:P(n),package_:(n.namespace||"").split("/")[1]?.split("@")[0]??"",name:n.name},o=M(e,Wt),s=o instanceof re?o.object===!0:o instanceof B&&o.object==="true",i=s?this.subclassClosure(t):new Set([V(t)]),c=b=>oe((b.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},r=(b,j)=>b.major-j.major||b.minor-j.minor||b.patch-j.patch,l=new Map;for(let b of this.catalog){if(!(b instanceof J)||!ae(b).some(O=>i.has(V(O.subject))))continue;let $=V({publisher:P(b),package_:(b.namespace||"").split("/")[1]?.split("@")[0]??"",name:b.name}),K=l.get($);(!K||r(c(b),c(K))>0)&&l.set($,b)}let u=[...l.values()];if(u.length===0)return"<!-- LookRenderer.Instances: none -->";u.sort((b,j)=>E(this.catalog,b).label.localeCompare(E(this.catalog,j).label));let p=48,k=u.slice(0,p),h=k.map(b=>this.resourceCard(b,a,n.namespace??void 0)),f=u.length>p?` <span class="kan-count">${k.length} of ${u.length}</span>`:` <span class="kan-count">${u.length}</span>`;return`<div class="kan-section"><h2 class="kan-section-title">${s?"Instances (including subtypes)":"Instances"}${f}</h2></div><section class="kan-pkg-grid">${h.join("")}</section>`}subclassClosure(e){let n=new Set([V(e)]),a=!0;for(;a;){a=!1;for(let t of this.catalog){if(!(t instanceof J))continue;let o=V({publisher:P(t),package_:(t.namespace||"").split("/")[1]?.split("@")[0]??"",name:t.name});if(!n.has(o)){for(let s of Ke(t))if(n.has(V(s.subject))){n.add(o),a=!0;break}}}}return n}referencesTarget(e,n,a){for(let t of e.statement){let o=t.predicate?.subject;if(o?.name==="type"||a&&!(o&&V(o)===V(a)))continue;let s=[];if(t instanceof x&&t.object instanceof S)s.push(t.object);else if(t instanceof D)for(let i of t.object??[])i instanceof S&&s.push(i);for(let i of s)if(V(i.subject)===n)return!0}return!1}renderFeaturedResource(e,n){let a=F(e,Y);if(!a)return"<!-- LookRenderer.FeaturedResource: no look.source -->";let t=le(this.catalog,a),o=r=>oe((r.namespace||"").split("@")[1]??"")??{major:0,minor:0,patch:0},s=t.length>0?t.slice().sort((r,l)=>{let u=o(r),p=o(l);return p.major-u.major||p.minor-u.minor||p.patch-u.patch})[0]:G(this.catalog,a);if(!s)return`<!-- LookRenderer.FeaturedResource: ${a.publisher}/${a.package_}/${a.name} not found -->`;let i=this.renderHtml(s),c=this.hrefForSubject(s,n);return`<section class="kan-featured"><a class="kan-featured-permalink" href="${d(c)}">View full resource \u2192</a>`+i+"</section>"}renderDistribution(e,n){let a=e,t=U=>{let I=L(a,U);if(!I)return;let se=this.resolvePath(n,I),_=se===void 0?NaN:parseFloat(se);return Number.isFinite(_)?_:void 0},o=t(gt),s=t(ht);if(o===void 0||s===void 0||o<=0||s<=0)return"<!-- LookRenderer.Distribution: needs resolvable alphaPath + betaPath (> 0) -->";let i=t(Oe)??o/(o+s),c=t(fn),r=t(kn),l=t(Be),u=l!==void 0?`hsl(${l},65%,60%)`:"var(--kan-accent)",p=U=>Number.isInteger(U)?String(U):U.toFixed(1),k=280,h=168,f={top:14,right:14,bottom:24,left:14},m=k-f.left-f.right,b=h-f.top-f.bottom,j=120,$=1e-4,K=[],O=[],y=0;for(let U=0;U<=j;U++){let I=U/j;I<$?I=$:I>1-$&&(I=1-$);let se=Math.exp((o-1)*Math.log(I)+(s-1)*Math.log(1-I));K.push(I),O.push(se),se>y&&(y=se)}let w=U=>f.left+Math.min(1,Math.max(0,U))*m,T=U=>f.top+(1-(y>0?U/y:0))*b,H=f.top+b,fe=K.map((U,I)=>`${w(U).toFixed(1)},${T(O[I]).toFixed(1)}`),C=`M${w(0).toFixed(1)},${H.toFixed(1)} L${fe.join(" L")} L${w(1).toFixed(1)},${H.toFixed(1)} Z`,N="";if(c!==void 0&&r!==void 0&&r>c){let U=[`${w(c).toFixed(1)},${H.toFixed(1)}`];for(let I=0;I<=j;I++)K[I]>=c&&K[I]<=r&&U.push(`${w(K[I]).toFixed(1)},${T(O[I]).toFixed(1)}`);U.push(`${w(r).toFixed(1)},${H.toFixed(1)}`),N=`<path d="M${U.join(" L")} Z" fill="${u}" fill-opacity="0.3"/>`}let Z=w(i),ge=`<line x1="${Z.toFixed(1)}" y1="${f.top.toFixed(1)}" x2="${Z.toFixed(1)}" y2="${H.toFixed(1)}" stroke="${u}" stroke-width="1.5" stroke-dasharray="3 3"/><text x="${Z.toFixed(1)}" y="${(f.top-3).toFixed(1)}" text-anchor="middle" class="kan-dist-mean">\u03BC ${i.toFixed(2)}</text>`,_e=`<text x="${w(0).toFixed(1)}" y="${(H+15).toFixed(1)}" text-anchor="start" class="kan-dist-axis">0</text><text x="${w(1).toFixed(1)}" y="${(H+15).toFixed(1)}" text-anchor="end" class="kan-dist-axis">1</text>`,R=`<svg class="kan-dist-svg" viewBox="0 0 ${k} ${h}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img"><line x1="${f.left}" y1="${H.toFixed(1)}" x2="${(k-f.right).toFixed(1)}" y2="${H.toFixed(1)}" class="kan-dist-base"/><path d="${C}" fill="${u}" fill-opacity="0.12"/>`+N+`<polyline points="${fe.join(" ")}" fill="none" stroke="${u}" stroke-width="2"/>`+ge+_e+"</svg>",W=c!==void 0&&r!==void 0?` \xB7 95% CI [${c.toFixed(2)}\u2013${r.toFixed(2)}]`:"";return`<figure class="kan-dist">${R}<figcaption class="kan-dist-caption">Beta(${p(o)}, ${p(s)})${W}</figcaption></figure>`}renderPublisherPackages(e,n){let a=new Map;for(let c of this.catalog){if(!(c instanceof J)||P(c)!==n)continue;let r=(c.namespace||"").split("/")[1]?.split("@")[0]??"";if(!r||c.name!==r)continue;let l=a.get(r),u=oe((c.namespace||"").split("@")[1]??""),p=l?oe((l.namespace||"").split("@")[1]??""):void 0;(!l||u&&(!p||ye(u,p)>0))&&a.set(r,c)}let t,o=M(e,ot),s=o instanceof D?o.object??[]:o instanceof x&&o.object instanceof S?[o.object]:[];if(s.length>0){t=[];for(let c of s){if(!(c instanceof S))continue;let r=c.subject.package_,l=a.get(r);l&&t.push([r,l])}}else t=[...a.entries()].sort((c,r)=>c[0].localeCompare(r[0]));return t.length===0?"":`<section class="kan-pkg-grid">${t.map(([c,r])=>{let l=E(this.catalog,r),u=l.label,p=l.summary,k=p?qe(p,160):"",h=this.svgUrlForSubject(r,n);return`<a class="kan-pkg-card" href="/${d(c)}"><img class="kan-pkg-card-svg" src="${d(h)}" alt="" loading="lazy"/><span class="kan-pkg-card-body"><span class="kan-pkg-card-title">${d(u)}</span>`+(k?`<span class="kan-pkg-card-comment">${d(k)}</span>`:"")+"</span></a>"}).join("")}</section>`}renderTimeline(e,n){let a=F(e,Y);if(!a)return"<!-- LookRenderer.Timeline: no look.source -->";let t=F(e,He),o=this.findInstancesOfClass(a);if(o.length===0)return"<!-- LookRenderer.Timeline: no instances -->";let s=u=>t?this.readPropertyValueText(u,t)??"":"",i=o.slice().sort((u,p)=>s(u).localeCompare(s(p))),c=F(e,pn),r=L(e,Oe);return c&&r?this.renderTrajectoryChart(i,c,r,e,n,s):`<section class="kan-timeline"><ol>
81
+ ${i.map(u=>{let p=u.namespace||"",k=p.split("/")[1]?.split("@")[0]??"",h=p.split("@")[1]??"",f=h?oe(h):void 0,m=me.formatResourceUrl({publisher:P(u),package_:k,name:u.name,...f?{version:f}:{}},"=",{contextPublisher:n}),b=s(u),j=b?`<span class="kan-timeline-date">${d(b)}</span>`:"",$=h||u.name;return`<li class="kan-timeline-node"><a href="${d(m)}"><span class="kan-timeline-key">${d($)}</span>${j}</a></li>`}).join(`
82
+ `)}
83
+ </ol></section>`}renderTrajectoryChart(e,n,a,t,o,s){let i=t,c=L(i,Be),r=L(i,fn),l=L(i,kn),u=L(i,xt),p=$n(i,It),k=$n(i,wt),h=e.length,f=this.collectTrackedSeries(e,n,a,{hueBy:c,lowerPath:r,upperPath:l});if(f.length===0)return"<!-- LookRenderer.Timeline: no tracked series -->";let m=[];for(let _ of f){for(let A of _.points)A!==null&&m.push(A);for(let A of _.lower??[])A!==null&&m.push(A);for(let A of _.upper??[])A!==null&&m.push(A)}if(m.length===0)return"<!-- LookRenderer.Timeline: no metric values -->";let b=Math.min(...m),j=Math.max(...m);j-b<1e-9&&(b-=.5,j+=.5);let $=(j-b)*.08,K=p!==void 0?p:b-$,O=k!==void 0?k:j+$;O-K<1e-9&&(O=K+1);let y=1e3,w=440,T={top:28,right:24,bottom:56,left:52},H=y-T.left-T.right,fe=w-T.top-T.bottom,C=_=>h<=1?T.left+H/2:T.left+_/(h-1)*H,N=_=>T.top+(1-(_-K)/(O-K))*fe,Z=(_,A)=>_.hue!==void 0?_.hue:Math.round(A*360/f.length),ge=[];for(let _=0;_<5;_++){let A=K+_*(O-K)/4,Q=N(A);ge.push(`<line x1="${T.left}" y1="${Q.toFixed(1)}" x2="${(y-T.right).toFixed(1)}" y2="${Q.toFixed(1)}" class="kan-fan-grid"/>`),ge.push(`<text x="${(T.left-8).toFixed(1)}" y="${(Q+4).toFixed(1)}" class="kan-fan-axis" text-anchor="end">${A.toFixed(2)}</text>`)}let _e=[];e.forEach((_,A)=>{let Q=this.hrefForSubject(_,o),ee=(_.namespace||"").split("@")[1]??"",q=C(A),ne=we(s(_));_e.push(`<a href="${d(Q)}" class="kan-fan-xtick"><line x1="${q.toFixed(1)}" y1="${T.top}" x2="${q.toFixed(1)}" y2="${(w-T.bottom).toFixed(1)}" class="kan-fan-vline"/><text x="${q.toFixed(1)}" y="${(w-T.bottom+20).toFixed(1)}" class="kan-fan-xlabel" text-anchor="middle">${ue(ee||_.name)}</text>`+(ne?`<text x="${q.toFixed(1)}" y="${(w-T.bottom+36).toFixed(1)}" class="kan-fan-xdate" text-anchor="middle">${ue(ne)}</text>`:"")+"</a>")});let R=[];f.forEach((_,A)=>{if(!_.lower||!_.upper)return;let Q=Z(_,A),ee=[],q=[];for(let te=0;te<h;te++){let he=_.upper[te],ke=_.lower[te];he==null||ke===null||ke===void 0||(ee.push(`${C(te).toFixed(1)},${N(he).toFixed(1)}`),q.unshift(`${C(te).toFixed(1)},${N(ke).toFixed(1)}`))}let ne=ee.concat(q);ne.length<3||R.push(`<polygon class="kan-fan-band" points="${ne.join(" ")}" fill="hsl(${Q},65%,60%)"/>`)});let W=[];f.forEach((_,A)=>{let ee=`hsl(${Z(_,A)},65%,60%)`,q=[],ne=[];_.points.forEach((te,he)=>{if(te===null)return;let ke=C(he),ie=N(te);q.push(`${ke.toFixed(1)},${ie.toFixed(1)}`),ne.push(`<circle cx="${ke.toFixed(1)}" cy="${ie.toFixed(1)}" r="3.5" fill="${ee}"/>`)}),q.length!==0&&W.push(`<g class="kan-fan-series" data-series="${d(_.key)}"><polyline points="${q.join(" ")}" fill="none" stroke="${ee}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`+ne.join("")+"</g>")});let U=`<svg class="kan-fan-svg" viewBox="0 0 ${y} ${w}" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" role="img">`+ge.join("")+_e.join("")+R.join("")+W.join("")+"</svg>",I=u?`${d(u)}=`:"",se=f.map((_,A)=>{let Q=Z(_,A),ee=_.points.filter(ie=>ie!==null),q=ee.length?ee[0]:void 0,ne=ee.length?ee[ee.length-1]:void 0,te="";if(ne!==void 0&&q!==void 0){let ie=ne-q;if(Math.abs(ie)>=.005){let Rn=ie>0?"up":"down",Sn=ie>0?"\u25B2":"\u25BC";te=` <span class="kan-fan-delta ${Rn}">${ie>0?"+":""}${ie.toFixed(2)} ${Sn}</span>`}else te=' <span class="kan-fan-delta flat">\u2014</span>'}let he=ne!==void 0?`${I}${ne.toFixed(2)}`:"\u2014",ke=_.lastSubject&&this.isLinkable(P(_.lastSubject),o)?`<a href="${d(this.hrefForSubject(_.lastSubject,o))}">${d(_.label)}</a>`:d(_.label);return`<div class="kan-fan-legend-item" style="--kan-fan-hue:${Q}"><span class="kan-fan-swatch"></span><span class="kan-fan-legend-label">${ke}</span><span class="kan-fan-legend-cur">${he}${te}</span></div>`});return`<section class="kan-fan"><div class="kan-fan-chart">${U}</div><div class="kan-fan-legend">${se.join("")}</div></section>`}renderResourceGrid(e,n,a){let t=F(e,Y);if(!t)return"<!-- LookRenderer.ResourceGrid: no look.source -->";let o=G(this.catalog,t),s=o?ae(o).some(r=>{let l=r.subject.name;return l==="ObjectProperty"||l==="DatatypeProperty"||l==="Property"}):!1,i=[];if(s&&a){let r=this.readPropertyValueReferences(a,t);for(let l of r){let u=G(this.catalog,{publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name,...l.subject.version?{version:l.subject.version}:{}});u&&i.push(u)}}else i=this.findInstancesOfClass(t);if(i.length===0)return`<!-- LookRenderer.ResourceGrid: no resources for ${t.publisher}/${t.package_}/${t.name} -->`;let c=[];for(let r of i){let l=E(this.catalog,r),u=l.label,p=l.summary,k=r.namespace||"",h=k.split("/")[1]?.split("@")[0]??"",f=k.split("@")[1]??"",m=f?oe(f):void 0,b=me.formatResourceUrl({publisher:P(r),package_:h,name:r.name,...m?{version:m}:{}},"=",{contextPublisher:n}),j=p?`<p class="kan-resource-card-subtitle">${d(p)}</p>`:"",$=`<h3 class="kan-resource-card-title">${d(u)}</h3>${j}`;c.push(this.isLinkable(P(r),n)?`<a class="kan-resource-card" href="${d(b)}">${$}</a>`:`<span class="kan-resource-card">${$}</span>`)}return`<section class="kan-resource-grid">
84
+ ${c.join(`
85
+ `)}
86
+ </section>`}findInstancesOfClass(e){let n=[];for(let a of this.catalog){if(!(a instanceof J))continue;ae(a).map(s=>s.subject).some(s=>s.publisher===e.publisher&&s.package_===e.package_&&s.name===e.name)&&n.push(a)}return n}renderBreadcrumb(e,n,a){let o=(e.namespace||"").split("/");if(o.length<2)return"";let s=o[0],i=o[1]??"",c=i.split("@")[0]??"",r=i.split("@")[1]??"";if(!s||!c)return"";if(a?.bareOverview)return`<nav class="kan-breadcrumb"><ol>
87
+ <li><a href="/">${d(s)}</a></li>
88
+ <li aria-current="page">${d(c)}</li>
89
+ </ol></nav>`;let l=e.name,p=!!G(this.catalog,{publisher:s,package_:c,name:c}),k=r?`${c}@${r}`:c,h=r?`/${c}/${r}/${c}`:`/${c}/${c}`,f=e.name===c,m=[];return m.push(`<li><a href="/">${d(s)}</a></li>`),f?m.push(`<li aria-current="page">${d(k)}</li>`):(m.push(p?`<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>
90
+ ${m.join(`
91
+ `)}
92
+ </ol></nav>`}renderNavGroup(e,n){let a=M(this.publisherSubject(n),Gn),t=a instanceof D?a.object??[]:a instanceof x&&a.object instanceof S?[a.object]:[];if(t.length===0)return"";let o=[];for(let s of t){if(!(s instanceof S))continue;let i=G(this.catalog,{publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name}),{href:c,label:r}=this.resolveNavEntry(s,i,n),l=`/${e.namespace?.split("/")[1]?.split("@")[0]}/${(e.namespace||"").split("@")[1]}/${e.name}`,u=c===l?' aria-current="page"':"";o.push(`<li><a class="kan-nav-link" href="${d(c)}"${u}>${d(r)}</a></li>`)}return`<nav class="kan-site-nav"><ul>
93
+ ${o.join(`
94
+ `)}
95
+ </ul></nav>`}renderSiteFooter(e){let n=M(this.publisherSubject(e),Wn),a;if(n instanceof X?a=n.object:n instanceof x&&n.object instanceof S&&(a=G(this.catalog,{publisher:n.object.subject.publisher,package_:n.object.subject.package_,name:n.object.subject.name})),!a)return"";let t=L(a,zn),o=M(a,Yn),s=o instanceof D?o.object??[]:o instanceof x&&o.object instanceof S?[o.object]:[],i=[];for(let r of s){if(!(r instanceof S))continue;let l=G(this.catalog,{publisher:r.subject.publisher,package_:r.subject.package_,name:r.subject.name}),{href:u,label:p}=this.resolveNavEntry(r,l,e);i.push(`<a class="kan-footer-link" href="${d(u)}">${d(p)}</a>`)}if(!t&&i.length===0)return"";let c=[];return i.length>0&&c.push(`<div class="kan-footer-links">${i.join("")}</div>`),t&&c.push(`<p class="kan-footer-text">${d(t)}</p>`),`<footer class="kan-site-footer">${c.join(`
96
+ `)}</footer>`}resolveNavEntry(e,n,a){if(n&&ae(n).map(c=>c.subject).some(c=>c.publisher===Ne.publisher&&c.package_===Ne.package_&&c.name===Ne.name)){let c=L(n,Ve),r=M(n,cn);if(r instanceof x&&r.object instanceof S){let l=r.object,u=this.readLabelForUri({publisher:l.subject.publisher,package_:l.subject.package_,name:l.subject.name});return{href:this.urlForReference(l,cn,a),label:c??u??l.subject.name}}}let t=me.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},"*",{contextPublisher:a}),o=n?E(this.catalog,n).label:e.subject.name;return{href:t,label:o}}codeHighlighter(){return this._codeHighlighter||(this._codeHighlighter=new Ue(this.collectGrammars())),this._codeHighlighter}collectGrammars(){let e=[];for(let n of this.catalog){if(!(n instanceof J)||!ae(n).some(i=>v(i.subject,rt)))continue;let a=L(n,it);if(!a)continue;let t=M(n,ct),o=t instanceof D?t.object??[]:[],s=[];for(let i of o){if(!(i instanceof z))continue;let c=F(i,lt),r=L(i,ut);!c||!r||s.push({tokenClass:c.name,pattern:r})}e.push({language:a,rules:s})}return e}renderLinks(e,n){let a=F(e,Y);if(!a)return"";let t=M(n,a),o=[];t instanceof D?o=t.object??[]:t instanceof X?o=[t.object]:t instanceof x&&t.object instanceof S&&(o=[t.object]);let s=[];for(let i of o){let c;if(i instanceof z?c=i:i instanceof S&&(c=G(this.catalog,{publisher:i.subject.publisher,package_:i.subject.package_,name:i.subject.name})),!c)continue;let r=L(c,pt);if(!r)continue;let l=L(c,Ve)??r,u=L(c,on),p=u?` title="${d(u)}"`:"";s.push(`<a class="kan-extlink" href="${d(r)}"${p} target="_blank" rel="noopener noreferrer">${d(l)}</a>`)}return s.length===0?"":`<section class="kan-extlink-row">${s.join("")}</section>`}renderMarkdown(e,n,a){let t=F(e,Y);if(!t)return"<!-- LookRenderer.Markdown: no look.source -->";let o=M(n,t),s=new Map,i;if(o instanceof Le?i=this.resolveMarkdownLinks(o,a,s):o instanceof B?i=o.object:i=this.readPropertyValueText(n,t),!i)return"";let c=this.codeHighlighter(),r=Me(i,{highlight:(l,u)=>c.highlight(l,u)});for(let[l,u]of s){let p=new RegExp('(<a href="'+_n(l)+'">)([^<]*)(</a>)',"g");r=r.replace(p,`$1<img class="kan-md-chip" src="${d(u)}" alt="" loading="lazy">$2$3`)}return`<section class="kan-markdown">
97
+ ${r}
98
+ </section>`}resolveMarkdownLinks(e,n,a){let t=e.object,o=[...e.links].sort((s,i)=>i.startOffset-s.startOffset);for(let s of o){let i;if(s.target&&this.isLinkable(s.target.subject.publisher,n)){let c=s.target.subject,r=(s.displayText??this.readLabelForUri({publisher:c.publisher,package_:c.package_,name:c.name})??s.reference).replace(/[[\]]/g,""),l=me.formatResourceUrl({publisher:c.publisher,package_:c.package_,name:c.name,...c.version?{version:c.version}:{}},"=",{contextPublisher:n});a&&a.set(l,`${l}.svg`),i=`[${r}](${l})`}else if(s.target){let c=s.target.subject;i=(s.displayText??this.readLabelForUri({publisher:c.publisher,package_:c.package_,name:c.name})??s.reference).replace(/[[\]]/g,"")}else i=s.displayText??s.reference;t=t.slice(0,s.startOffset)+i+t.slice(s.endOffset)}return t}renderRawMarkdown(e){let n=this.findCascadedLook(e);if(!n)return;let a=ze(n.declaration),t=[];for(let o of a){let s=Se(o);if(!s||!v(s,rn))continue;let i=F(o,Y);if(!i)continue;let c=this.readPropertyValueText(e,i);c&&t.push(c)}return t.length>0?t.join(`
99
+
100
+ `):void 0}renderHero(e,n,a){let t=f=>{let m=M(e,f);return m instanceof re?m.object===!0:m instanceof B&&m.object==="true"},o=t(Bt),s=!o&&t(Ht),i=o||s,r=[`<header class="${o?"kan-hero kan-hero-has-avatar":s?"kan-hero kan-hero-has-icon":"kan-hero"}">`];if(i){let f=this.svgUrlForSubject(n,a),m=o?"kan-hero-avatar":"kan-hero-icon";r.push(`<img class="${m}" src="${d(f)}" alt="" loading="lazy"/>`),r.push('<div class="kan-hero-text">')}let l=F(e,Mt);if(l){let f=this.readPropertyValueText(n,l);f&&r.push(`<span class="kan-hero-eyebrow">${d(Fe(f)??f)}</span>`)}let u=F(e,Pt),p="";u&&(p=this.readPropertyValueText(n,u)??""),p||(p=E(this.catalog,n).label),r.push(`<h1 class="kan-hero-title">${d(Fe(p)??p)}</h1>`);let k=F(e,Vt);if(k){let f=this.readPropertyValueText(n,k);f&&r.push(`<p class="kan-hero-subtitle">${d(Fe(f)??f)}</p>`)}let h=F(e,mn);if(h){let f=this.readPropertyValueReferences(n,h);if(f.length>0){let m=f.map(b=>this.renderBadge(b,mn,a)).join("");r.push(`<div class="kan-hero-badges">${m}</div>`)}}return i&&r.push("</div>"),r.push("</header>"),r.join(`
101
+ `)}renderPropertyList(e,n,a){let t=F(e,Y);if(!t)return"<!-- LookRenderer: PropertyList missing look.source -->";let o=this.readLabelForUri(t)??t.name,s=M(n,t),i=this.gatherValueItems(s),c=i.length>0?i.map(r=>`<li>${this.renderInlineValue(r,Y,a)}</li>`).join(""):'<li class="kan-empty">(no values)</li>';return['<section class="kan-property-list">',`<h3 class="kan-property-list-title">${d(o)}</h3>`,`<ul class="kan-property-list-items">${c}</ul>`,"</section>"].join(`
102
+ `)}renderPropertyTable(e,n,a,t=""){let o=F(e,Y);if(!o)return"<!-- LookRenderer: PropertyTable missing look.source -->";let s=this.gatherValueItems(M(n,o)).filter(r=>r instanceof z);if(s.length===0)return"";let i=this.readLabelForUri(o)??o.name,c=t?`${t}.${o.name}`:o.name;return this.renderEmbeddedTable(s,a,i,c)}renderEmbeddedTable(e,n,a,t){let o=[],s=new Set;for(let f of e)for(let m of f.statement){let b=m.predicate?.subject;if(!b||this.isMetaPredicate(b))continue;let j=`${b.publisher}/${b.package_}/${b.name}`;s.has(j)||(s.add(j),o.push({uri:{publisher:b.publisher,package_:b.package_,name:b.name},label:this.readLabelForUri(b)??b.name}))}if(o.length===0)return"";let i=e.map(f=>E(this.catalog,f).label),c=e.some((f,m)=>i[m]!==""&&i[m]!==f.name),r=!!t,l=(r?'<th class="kan-anchor-col"></th>':"")+(c?"<th></th>":"")+o.map(f=>`<th>${d(f.label)}</th>`).join(""),u=e.map((f,m)=>{let b=r&&f.name?`${t}.${f.name}`:"",j=b?` id="${d(b)}"`:"",$=r?`<td class="kan-anchor-col">${b?this.anchorLink(b):""}</td>`:"",K=c?`<th scope="row">${d(i[m]??"")}</th>`:"",O=o.map(y=>{let w=M(f,y.uri);return`<td>${w?this.tableCellValue(w,n):""}</td>`}).join("");return`<tr${j}>${$}${K}${O}</tr>`}).join(""),p=r&&t?` id="${d(t)}"`:"",k=r&&t?this.anchorLink(t):"",h=a?`<caption>${d(a)}${k}</caption>`:"";return`<table class="kan-property-table"${p}>${h}<thead><tr>${l}</tr></thead><tbody>${u}</tbody></table>`}tableCellValue(e,n){if(e instanceof Le)return this.statementToMarkdownHtml(e,n);if(e instanceof B)return vn(e.object);if(e instanceof pe||e instanceof re)return d(String(e.object));if(e instanceof x&&e.object instanceof S)return this.detailReferenceLink(e.object,n);if(e instanceof X)return this.renderEmbeddedTable([e.object],n);if(e instanceof D){let a=e.object??[],t=a.filter(o=>o instanceof z);return t.length>0&&t.length===a.length?this.renderEmbeddedTable(t,n):a.map(o=>o instanceof S?this.detailReferenceLink(o,n):o instanceof z?this.renderEmbeddedTable([o],n):d(String(o))).filter(o=>o).join(", ")}return""}statementToMarkdownHtml(e,n){let a=new Map,t;if(e instanceof Le?t=this.resolveMarkdownLinks(e,n,a):e instanceof B&&(t=e.object),!t)return"";let o=this.codeHighlighter(),s=Me(t,{highlight:(i,c)=>o.highlight(i,c)});for(let[i,c]of a){let r=new RegExp('(<a href="'+_n(i)+'">)([^<]*)(</a>)',"g");s=s.replace(r,`$1<img class="kan-md-chip" src="${d(c)}" alt="" loading="lazy">$2$3`)}return s}renderBadgeRow(e,n,a){let t=F(e,Y);if(!t)return"<!-- LookRenderer: BadgeRow missing look.source -->";let o=this.readPropertyValueReferences(n,t);return o.length===0?"":`<div class="kan-badge-row">${o.map(i=>this.renderBadge(i,Y,a)).join("")}</div>`}renderChipRow(e,n,a){let t=Ye(e,zt);if(t.length===0)return"<!-- LookRenderer: ChipRow has no look.chips -->";let o=[];for(let s of t){let i=M(n,s);if(!i)continue;let c=this.readLabelForUri(s)??s.name,r=this.renderStatementInlineValue(i,s,a);r&&o.push(`<span class="kan-chip"><span class="kan-chip-key">${d(c)}</span> <span class="kan-chip-val">${r}</span></span>`)}return o.length===0?"":`<div class="kan-chip-row">${o.join("")}</div>`}renderReferenceList(e,n,a){let t=Ye(e,bn);if(t.length===0)return"<!-- LookRenderer: ReferenceList has no look.entries -->";let o=L(e,dn),s=L(e,Ot),i=[];for(let c of t){let r=this.readPropertyValueReferences(n,c);if(r.length===0)continue;let l=this.readLabelForUri(c)??c.name;if(o){let u=r.map(p=>this.renderDetailRow(p,o,s,a)).filter(p=>p).join("");u&&i.push(`<dt>${d(l)}</dt><dd><ul class="kan-ref-rows">${u}</ul></dd>`)}else{let u=r.map(p=>this.renderReferenceLink(p,bn,a)).join(", ");i.push(`<dt>${d(l)}</dt><dd>${u}</dd>`)}}return i.length===0?"":`<dl class="kan-reference-list">${i.join("")}</dl>`}renderDetailRow(e,n,a,t){let o=G(this.catalog,{publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name,...e.subject.version?{version:e.subject.version}:{}});if(!o)return"";let s=this.resolvePath(o,n)??E(this.catalog,o).label,i="";if(a){let u=this.resolvePath(o,a);u&&(i=`<span class="kan-ref-badge">${d(u)}</span>`)}let c=`<span class="kan-ref-text">${d(s)}</span>${i}`;if(!this.isLinkable(P(o),t))return`<li class="kan-ref-row"><span class="kan-ref-rowlink">${c}</span></li>`;let r=this.hrefForSubject(o,t),l=this.svgUrlForSubject(o,t);return`<li class="kan-ref-row"><a class="kan-ref-rowlink" href="${d(r)}"><img class="kan-ref-icon" src="${d(l)}" alt="" loading="lazy"/>`+c+"</a></li>"}readPropertyValueText(e,n){let a=M(e,n);if(a){if(a instanceof B)return a.object;if(a instanceof x){let t=a.object;return this.readLabelForUri({publisher:t.subject.publisher,package_:t.subject.package_,name:t.subject.name})??t.subject.name}if(a instanceof X)return this.readEmbeddedText(a.object,0)||void 0;if(a instanceof D)return(a.object??[]).map(o=>o instanceof S?this.readLabelForUri({publisher:o.subject.publisher,package_:o.subject.package_,name:o.subject.name})??o.subject.name:o instanceof z?this.readEmbeddedText(o,0):String(o)).filter(o=>o).join(", ")}}readEmbeddedText(e,n){if(n>=hn)return"\u2026";let a=[];for(let t of e.statement)if(t.predicate?.subject?.name!=="type")if(t instanceof B)a.push(t.object);else if(t instanceof pe||t instanceof re)a.push(String(t.object));else if(t instanceof x){let s=t.object;a.push(this.readLabelForUri({publisher:s.subject.publisher,package_:s.subject.package_,name:s.subject.name})??s.subject.name)}else t instanceof X&&a.push(this.readEmbeddedText(t.object,n+1));return a.filter(t=>t).join(", ")}readPropertyValueReferences(e,n){let a=M(e,n);if(!a)return[];if(a instanceof x)return[a.object];if(a instanceof D){let t=[];for(let o of a.object??[])o instanceof S&&t.push(o);return t}return[]}gatherValueItems(e){return e?e instanceof D?e.object??[]:e instanceof x?[e.object]:e instanceof X?[e.object]:e instanceof B?[e.object]:e instanceof pe||e instanceof re?[e.object]:[]:[]}renderInlineValue(e,n,a,t=0){return e instanceof S?this.renderReferenceLink(e,n,a):e instanceof z?this.renderEmbeddedInline(e,a,t):typeof e=="string"?d(e):typeof e=="number"||typeof e=="boolean"?d(String(e)):""}renderStatementInlineValue(e,n,a,t=0){return e instanceof B?d(e.object):e instanceof pe||e instanceof re?d(String(e.object)):e instanceof x?this.renderReferenceLink(e.object,n,a):e instanceof X?this.renderEmbeddedInline(e.object,a,t):e instanceof D?(e.object??[]).map(s=>this.renderInlineValue(s,n,a,t)).filter(s=>s).join(", "):""}renderEmbeddedInline(e,n,a=0){if(a>=hn)return"\u2026";let t=[];for(let o of e.statement){let s=o.predicate?.subject;if(!s||s.name==="type")continue;let i=this.readLabelForUri({publisher:s.publisher,package_:s.package_,name:s.name})??s.name,c=this.renderStatementInlineValue(o,s,n,a+1);c&&t.push(`<dt>${d(i)}</dt><dd>${c}</dd>`)}return t.length?`<dl class="kan-embedded">${t.join("")}</dl>`:""}renderReferenceLink(e,n,a){let t=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name;if(!this.isLinkable(e.subject.publisher,a))return`<span class="kan-link-plain">${d(t)}</span>`;let o=this.urlForReference(e,n,a);return`<a class="kan-link" href="${d(o)}">${d(t)}</a>`}isLinkable(e,n){return e===n}renderBadge(e,n,a){let t=this.readLabelForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name})??e.subject.name,o=this.readCommentForUri({publisher:e.subject.publisher,package_:e.subject.package_,name:e.subject.name}),s=o?` title="${d(o)}"`:"";if(!this.isLinkable(e.subject.publisher,a))return`<span class="kan-badge"${s}>${d(t)}</span>`;let i=this.urlForReference(e,n,a);return`<a class="kan-badge" href="${d(i)}"${s}>${d(t)}</a>`}urlForReference(e,n,a){let t=n?this.getUrlFormForProperty(n):"=";return me.formatResourceUrl({publisher:e.subject.publisher,package_:e.subject.package_,...e.subject.version?{version:e.subject.version}:{},name:e.subject.name},t,{contextPublisher:a})}getUrlFormForProperty(e){let n=G(this.catalog,e);if(!n)return"=";let a=L(n,Yt);return a==="*"||a==="^"||a==="~"||a==="="?a:"="}readLabelForUri(e){let n=G(this.catalog,e);if(n)return E(this.catalog,n).label}readCommentForUri(e){let n=G(this.catalog,e);if(n)return E(this.catalog,n).summary}};function We(g){let e=new Map;for(let n of g.statement){if(!(n instanceof X)||!de(n,Ee.publisher,Ee.package_,Ee.name))continue;let a=n.object;for(let t of a.statement){if(!(t instanceof B))continue;let o=t.predicate?.subject?.name;if(!o)continue;let s=t.object;e.has(o)||e.set(o,s)}}return e}function Ie(g){for(let e of g.statement)if(e instanceof X&&de(e,xe.publisher,xe.package_,xe.name))return e.object}function ze(g){for(let e of g.statement){if(!(e instanceof D)||!de(e,Ge.publisher,Ge.package_,Ge.name))continue;let n=[];for(let a of e.object??[])a instanceof z&&n.push(a);return n}return[]}function Se(g){for(let e of g.statement)if(e instanceof x&&e.predicate?.subject?.name==="type"&&e.object instanceof S){let n=e.object.subject;return{publisher:n.publisher,package_:n.package_,name:n.name}}}function F(g,e){for(let n of g.statement)if(n instanceof x&&de(n,e.publisher,e.package_,e.name)&&n.object instanceof S){let a=n.object.subject;return{publisher:a.publisher,package_:a.package_,name:a.name}}}function Ye(g,e){for(let n of g.statement){if(!(n instanceof D)||!de(n,e.publisher,e.package_,e.name))continue;let a=[];for(let t of n.object??[])t instanceof S&&a.push({publisher:t.subject.publisher,package_:t.subject.package_,name:t.subject.name});return a}return[]}function M(g,e){for(let n of g.statement)if(de(n,e.publisher,e.package_,e.name))return n}function L(g,e){for(let n of g.statement)if(n instanceof B&&de(n,e.publisher,e.package_,e.name))return n.object}function $n(g,e){for(let n of g.statement)if(n instanceof pe&&de(n,e.publisher,e.package_,e.name))return n.object}function qt(g){for(let e of ae(g))if(v(e.subject,Fn)||v(e.subject,Tn))return!0;return!1}function ae(g){let e=[];for(let n of g.statement)if(n instanceof x){if(n.predicate?.subject?.name!=="type")continue;n.object instanceof S&&e.push(n.object)}else if(n instanceof D){if(n.predicate?.subject?.name!=="type")continue;for(let a of n.object??[])a instanceof S&&e.push(a)}return e}function Ke(g){let e=[];for(let n of g.statement)if(n instanceof x){if(n.predicate?.subject?.name!=="subClassOf")continue;n.object instanceof S&&e.push(n.object)}else if(n instanceof D){if(n.predicate?.subject?.name!=="subClassOf")continue;for(let a of n.object??[])a instanceof S&&e.push(a)}return e}function le(g,e){let n=[];for(let a of g){if(!(a instanceof J)||a.name!==e.name)continue;(a.namespace||"").startsWith(`${e.publisher}/${e.package_}@`)&&n.push(a)}return n}function G(g,e){let n="version"in e?e.version:void 0;if(n){let a=`${e.publisher}/${e.package_}@${n.major}.${n.minor}.${n.patch}`;for(let t of g)if(t instanceof J&&t.name===e.name&&t.namespace===a)return t}for(let a of g){if(!(a instanceof J)||a.name!==e.name)continue;if((a.namespace||"").startsWith(`${e.publisher}/${e.package_}@`))return a}}function de(g,e,n,a){let t=g.predicate?.subject;return t?t.publisher===e&&t.package_===n&&t.name===a:!1}function v(g,e){return g.publisher===e.publisher&&g.package_===e.package_&&g.name===e.name}function V(g){return`${g.publisher}/${g.package_}/${g.name}`}function P(g){let e=g.namespace||"",n=e.indexOf("/");return n>=0?e.substring(0,n):e}function d(g){return g.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Jt(g){let e=g.lastIndexOf(".");return e>=0?g.substring(e+1):g}function Xt(g,e){for(let n of g.statement)if(n.predicate?.subject?.name===e)return n}function ue(g){return g.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function qe(g,e){return g.length<=e?g:g.slice(0,e).replace(/\s+\S*$/,"")+"\u2026"}function jn(g){return g.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function _n(g){return g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vn(g){let e=Fe(g);return d(e||g)}function Fe(g){let e=/^(\d{4})-(\d{2})-(\d{2})([T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/.exec(g.trim());if(!e)return;let n=Date.parse(g);if(!Number.isFinite(n))return;let a=new Date(n),o=`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getUTCMonth()]} ${a.getUTCDate()}, ${a.getUTCFullYear()}`;if(!e[4])return o;let s=a.getUTCHours(),i=(s+11)%12+1,c=s>=12?"PM":"AM";return`${o} \xB7 ${i}:${String(a.getUTCMinutes()).padStart(2,"0")} ${c} UTC`}function we(g){if(!g)return"";let e=/^(\d{4})-(\d{2})-(\d{2})/.exec(g);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)}`:g}export{E as a,Me as b,Je as c};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as ct,b as lt,c as dt,d as ut,e as pt}from"./chunk-GQQAXZDK.js";import{a as or,c as ar}from"./chunk-2WQR7OHH.js";import{a as at,b as it,c as st,d as b,e as S,f as i}from"./chunk-XWKCX5ZS.js";import{a as nr}from"./chunk-IIODYDKS.js";import"./chunk-3NEUHF7E.js";import{a as Te,b as je,c as Le,d as Fe,e as De,f as Ue,g as Ve,h as He}from"./chunk-MOFATNEC.js";import{a as Ie,b as Ne,c as Oe,d as Ae}from"./chunk-VHUJSHH7.js";import{a as ft,b as yt,c as gt,d as ht}from"./chunk-KDJYZ2YM.js";import{a as kt,b as $t}from"./chunk-DC774EQL.js";import{a as Ct}from"./chunk-NIGFQYVA.js";import{A as Qt,B as er,C as tr,E as rr,a as vt,b as Et,c as Kt,d as It,e as Bt,f as Tt,g as jt,h as Lt,i as Ft,j as Dt,k as Nt,l as Ot,m as At,n as Ut,o as Vt,p as Ht,q as Mt,r as _t,s as zt,t as Gt,u as Wt,v as Jt,w as qt,x as Yt,y as Xt,z as Zt}from"./chunk-PPORQS4M.js";import{a as tt,b as rt,c as nt}from"./chunk-IO5RBK3J.js";import{a as F,b as N,c as We}from"./chunk-H2LEQLVD.js";import{a as Be}from"./chunk-7CUTGGH3.js";import{a as ot,b as bt,c as St,d as Pt,e as Rt,f as wt,g as xt}from"./chunk-N224PFBI.js";import"./chunk-Q4DKP5DO.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 Je,c as qe,d as Ye,e as Xe,f as Ze,h as Qe,j as et}from"./chunk-64TVBQFR.js";import{a as Me,b as j,c as L,d as D,e as ze,f as Ge,g as O,h as A,i as U,j as V,k as H,l as M}from"./chunk-W6T7MOKY.js";import{a as _e}from"./chunk-FUUTGGJS.js";import{a as mt}from"./chunk-ODIECDN7.js";import{VersionOperator as yo}from"@kanonak-protocol/types/document/models/enums";import{existsSync as Rr,readFileSync as wr}from"fs";import{homedir as xr}from"os";import{join as $r}from"path";import{execFile as ir}from"child_process";import{promisify as sr}from"util";var C=sr(ir),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).
1
+ import{a as ct,b as lt,c as dt,d as ut,e as pt}from"./chunk-SD5QKNBC.js";import{a as or,c as ar}from"./chunk-WQZBKRDG.js";import{a as at,b as it,c as st,d as b,e as S,f as i}from"./chunk-WDQONH3P.js";import{a as nr}from"./chunk-IIODYDKS.js";import"./chunk-3NEUHF7E.js";import{a as Te,b as je,c as Le,d as Fe,e as De,f as Ue,g as Ve,h as He}from"./chunk-H673KOGN.js";import{a as Ie,b as Ne,c as Oe,d as Ae}from"./chunk-VHUJSHH7.js";import{a as ft,b as yt,c as gt,d as ht}from"./chunk-CYDDQF6S.js";import{a as kt,b as $t}from"./chunk-DC774EQL.js";import{a as Ct}from"./chunk-NIGFQYVA.js";import{A as Qt,B as er,C as tr,E as rr,a as vt,b as Et,c as Kt,d as It,e as Bt,f as Tt,g as jt,h as Lt,i as Ft,j as Dt,k as Nt,l as Ot,m as At,n as Ut,o as Vt,p as Ht,q as Mt,r as _t,s as zt,t as Gt,u as Wt,v as Jt,w as qt,x as Yt,y as Xt,z as Zt}from"./chunk-BSJ6PEKE.js";import{a as tt,b as rt,c as nt}from"./chunk-VJT6YUWK.js";import{a as F,b as N,c as We}from"./chunk-H2LEQLVD.js";import{a as Be}from"./chunk-7CUTGGH3.js";import{a as ot,b as bt,c as St,d as Pt,e as Rt,f as wt,g as xt}from"./chunk-N224PFBI.js";import"./chunk-Q4DKP5DO.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 Je,c as qe,d as Ye,e as Xe,f as Ze,h as Qe,j as et}from"./chunk-64TVBQFR.js";import{a as Me,b as j,c as L,d as D,e as ze,f as Ge,g as O,h as A,i as U,j as V,k as H,l as M}from"./chunk-W6T7MOKY.js";import{a as _e}from"./chunk-FUUTGGJS.js";import{a as mt}from"./chunk-ODIECDN7.js";import{VersionOperator as yo}from"@kanonak-protocol/types/document/models/enums";import{existsSync as Rr,readFileSync as wr}from"fs";import{homedir as xr}from"os";import{join as $r}from"path";import{execFile as ir}from"child_process";import{promisify as sr}from"util";var C=sr(ir),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)}
@@ -40,6 +40,8 @@ export interface ResolvedLook {
40
40
  export declare class LookRenderer {
41
41
  private readonly catalog;
42
42
  constructor(catalog: Kanonak[]);
43
+ /** Lazily-built syntax highlighter, sourced from the catalog's grammars. */
44
+ private _codeHighlighter?;
43
45
  /**
44
46
  * Walk the instance's type chain (BFS) looking for the first class
45
47
  * that declares `derivation.look`. Checks the instance itself first
@@ -49,6 +51,16 @@ export declare class LookRenderer {
49
51
  * declares one.
50
52
  */
51
53
  findCascadedLook(instance: SubjectKanonak): ResolvedLook | undefined;
54
+ /**
55
+ * Resolve a cascaded look by walking a type queue (BFS through
56
+ * `subClassOf`), version-agnostically, then the `rdfs.Resource` floor.
57
+ * Shared by `findCascadedLook` (seeded from an instance's declared
58
+ * types) and `renderEmbeddedViews` (seeded from an item's inferred
59
+ * range type when the item carries no explicit `rdf:type` — embedded
60
+ * objects are typed by the containing property's range, not a literal
61
+ * type statement).
62
+ */
63
+ private lookFromTypeRefs;
52
64
  /**
53
65
  * Walk the instance's type chain merging token declarations by key.
54
66
  * Closer-to-instance wins; tokens from different keys merge cleanly.
@@ -167,19 +179,16 @@ export declare class LookRenderer {
167
179
  * appear without authors needing a custom look.Figure band.
168
180
  */
169
181
  /**
170
- * Render the publisher index — the default publisher root page (`/`).
171
- * A grid of the publisher's packages, each linking to its `/{package}`
172
- * overview, so the entire publisher is discoverable from the root.
173
- * `tokenSource` is any resource in the publisher (used for the token
174
- * cascade + nav chrome); `entries` are the packages to list.
182
+ * The Publisher resource for a domain — the single configuration point for
183
+ * a publisher's presentation: its `derivation.look` is the landing
184
+ * PublisherView (default on `ck.Publisher` in universal-look) and its nav
185
+ * is the site nav. Returns an authored `ck.Publisher` resource in the
186
+ * publisher's namespace when present; otherwise synthesizes a minimal one
187
+ * (`rdfs.label` = the domain) so the publisher root ALWAYS renders through
188
+ * the normal look cascade — the same path as any other resource page, no
189
+ * special-case index renderer.
175
190
  */
176
- renderPublisherIndex(publisher: string, entries: Array<{
177
- label: string;
178
- href: string;
179
- comment?: string;
180
- }>, tokenSource: SubjectKanonak | undefined): string;
181
- /** Stylesheet for the publisher index — the cascaded tokens + base CSS. */
182
- renderPublisherIndexStylesheet(tokenSource: SubjectKanonak | undefined): string;
191
+ publisherSubject(publisher: string): SubjectKanonak;
183
192
  /**
184
193
  * True when the instance has a look declaration closer than the
185
194
  * rdfs.Resource floor — i.e. an instance-level or class-level view
@@ -326,6 +335,31 @@ export declare class LookRenderer {
326
335
  */
327
336
  private detailReferenceLink;
328
337
  private detailEmbedded;
338
+ /**
339
+ * The `rdfs:range` of a property, as a single-element type-ref list (for
340
+ * seeding the look cascade for range-typed embedded objects). Empty when
341
+ * the property or its range can't be resolved.
342
+ */
343
+ private rangeTypeRefs;
344
+ /**
345
+ * Render an EmbeddedViews band: each embedded item of `look.source` is
346
+ * rendered through ITS OWN class look — the same type-chain cascade page
347
+ * instances use — so a document-tree ontology (Protocol → Convention →
348
+ * Rule) composes readable nested sections instead of collapsing into one
349
+ * generic recursive sheet. Items whose class declares no look fall
350
+ * through to the rdfs.Resource floor (Hero + Details), so every item
351
+ * still renders sensibly. Non-embedded values are skipped (use
352
+ * PropertyList / ReferenceList for scalars and references). Recursion is
353
+ * bounded by the data's embedding depth.
354
+ */
355
+ private renderEmbeddedViews;
356
+ /**
357
+ * A small "copy this link" anchor. Its href is the in-page fragment, so
358
+ * clicking puts the full deep URL in the address bar and right-click →
359
+ * Copy Link Address yields the exact URL for this embedded resource. The
360
+ * fragment is shown in the tooltip.
361
+ */
362
+ private anchorLink;
329
363
  /** Predicates surfaced by other bands (or look-layer meta) — skipped by Details. */
330
364
  private isMetaPredicate;
331
365
  /**
@@ -349,6 +383,31 @@ export declare class LookRenderer {
349
383
  * cannot.
350
384
  */
351
385
  private renderReferencedBy;
386
+ /**
387
+ * One resource card: a main link (SemanticSvg + label + truncated summary)
388
+ * to the resource, plus a subtle, hover-revealed footer linking to the
389
+ * resource's package, with the version as a pill — `package@version`. The
390
+ * card is a container (not a single `<a>`) so the package footer can be a
391
+ * real sibling link (nested `<a>`s are invalid). Both links are
392
+ * same-publisher-gated.
393
+ */
394
+ private resourceCard;
395
+ /**
396
+ * Render an Instances band — the resources whose `rdf:type` is the page
397
+ * resource (a class). DIRECT by default (exact type); `look.transitive:
398
+ * true` widens to instances of subclasses too (the subclass closure) —
399
+ * which is why direct is the default, since transitive on rdfs.Resource
400
+ * would be every resource. Deduped to the highest version per canonical
401
+ * key, capped (with a total count), and self-suppressing when the
402
+ * resource is not a class or has no instances.
403
+ */
404
+ private renderInstances;
405
+ /**
406
+ * The set of canonical class keys covered by `target` plus every class
407
+ * that is (transitively) a subclass of it — used for transitive instance
408
+ * matching. Iterates to a fixpoint over the catalog's subClassOf edges.
409
+ */
410
+ private subclassClosure;
352
411
  /**
353
412
  * True if `subject` has a reference (in a ReferenceStatement or a
354
413
  * ListStatement) whose target's canonical key equals `targetKey`. When
@@ -373,20 +432,18 @@ export declare class LookRenderer {
373
432
  */
374
433
  private renderDistribution;
375
434
  /**
376
- * Render a PublisherPackages band — a grid of the publisher's packages
377
- * (latest version of each), each card linking to its bare `/{package}`
378
- * overview, with the package's SemanticSvg + label + truncated comment.
379
- * Powers the discovery section of a publisher root view.
435
+ * Render a PublisherPackages band — a grid of package cards, each
436
+ * linking to its bare `/{package}` overview with the package's
437
+ * SemanticSvg + label + truncated comment. Powers the discovery
438
+ * section of a publisher root view.
439
+ *
440
+ * By default it enumerates every package the context publisher
441
+ * authors (latest version of each, alphabetical). When the band
442
+ * declares an explicit `look.packages` list, it instead features
443
+ * exactly those packages, in author order — each reference resolved
444
+ * to its package's latest self-resource.
380
445
  */
381
446
  private renderPublisherPackages;
382
- /**
383
- * Find the resource that declares the publisher's root view — a resource
384
- * authored by `publisher` whose instance-level derivation.look is a
385
- * PublisherView. Returned to the publish step so it can render the root
386
- * view at `/` instead of the default package index. Undefined when the
387
- * publisher declares none.
388
- */
389
- findPublisherRootView(publisher: string): SubjectKanonak | undefined;
390
447
  private renderTimeline;
391
448
  /**
392
449
  * Render the Timeline trajectory chart — a server-rendered inline SVG with
@@ -411,7 +468,6 @@ export declare class LookRenderer {
411
468
  * compact variant") is deferred — that requires a variant system.
412
469
  */
413
470
  private renderResourceGrid;
414
- private parseVersion;
415
471
  /**
416
472
  * Find every SubjectKanonak in the catalog whose declared `rdf:type` set
417
473
  * includes the given class URI (canonical, version-agnostic). Used by
@@ -438,6 +494,14 @@ export declare class LookRenderer {
438
494
  * resource reference (use the target's `rdfs.label`, urlForm `*`).
439
495
  */
440
496
  private renderNavGroup;
497
+ /**
498
+ * Render the site-wide footer, shown on every page. Like nav, it is the
499
+ * `footer` (a `look.Footer`) declared on the publisher's
500
+ * core-kanonak.Publisher resource — the single config point. The Footer
501
+ * carries optional literal `text` (license/copyright) and an optional
502
+ * list of `links` (NavLinks). Returns empty when no footer is declared.
503
+ */
504
+ private renderSiteFooter;
441
505
  /**
442
506
  * Resolve a nav entry to (href, label). NavLink resources contribute
443
507
  * their explicit label + target; direct references read the target's
@@ -445,16 +509,31 @@ export declare class LookRenderer {
445
509
  */
446
510
  private resolveNavEntry;
447
511
  /**
448
- * Find the first `look.NavGroup` instance in the catalog authored by
449
- * `publisher`. Returns undefined if the publisher has not declared one.
512
+ * The catalog-sourced code highlighter (built once). Every
513
+ * `code-grammars.CodeGrammar` in the catalog becomes a grammar spec;
514
+ * the generic scanner in highlight.ts applies them. Returns the SDK
515
+ * mechanism wired to graph-declared intent — no language is hardcoded
516
+ * here.
450
517
  */
451
- private findNavGroupForPublisher;
518
+ private codeHighlighter;
519
+ /** Read every CodeGrammar resource in the catalog into a grammar spec. */
520
+ private collectGrammars;
521
+ /**
522
+ * Render a Links band — the resource's outbound links (the
523
+ * `links.links` property named by `look.source`) as a row of real
524
+ * `<a href>` anchors. Each value is a `links.Link`, embedded inline or
525
+ * referenced, read for its `url`, label (rdfs.label → the link text)
526
+ * and comment (rdfs.comment → the hover title). Renders nothing when
527
+ * the resource has no links, so it is safe on the universal floor.
528
+ */
529
+ private renderLinks;
452
530
  /**
453
531
  * Render a Markdown band — reads the property identified by
454
532
  * `look.source` from the instance and pipes its string value through
455
- * the SDK's minimal CommonMark renderer. Wraps the result in a
456
- * `<section class="kan-markdown">` so stylesheets can target the
457
- * prose block without bleeding into other bands.
533
+ * the SDK's minimal CommonMark renderer (with catalog-driven code
534
+ * highlighting). Wraps the result in a `<section class="kan-markdown">`
535
+ * so stylesheets can target the prose block without bleeding into
536
+ * other bands.
458
537
  */
459
538
  private renderMarkdown;
460
539
  /**
@@ -477,6 +556,29 @@ export declare class LookRenderer {
477
556
  renderRawMarkdown(instance: SubjectKanonak): string | undefined;
478
557
  private renderHero;
479
558
  private renderPropertyList;
559
+ /**
560
+ * Render `look.source` (a list of dict-keyed embeddeds) as a table:
561
+ * columns are the union of the items' predicate names, one row per item
562
+ * with the item's dict-key as a leading row-header. The source
563
+ * property's label captions the table, and the table is omitted
564
+ * entirely when there are no items (so an empty group leaves no dangling
565
+ * caption). Cells render scalars / markdown / references inline; a cell
566
+ * whose value is itself a list of embeddeds recurses into a nested
567
+ * table, so a document tree (rules holding sub-rules, etc.) stays
568
+ * tabular all the way down.
569
+ */
570
+ private renderPropertyTable;
571
+ /**
572
+ * Build a `<table>` from a list of embedded resources. Columns are the
573
+ * union of non-meta predicates across the items, in first-seen order;
574
+ * each row is one item (its dict-key as a `<th scope="row">` when
575
+ * present). Recurses for embedded-list cell values.
576
+ */
577
+ private renderEmbeddedTable;
578
+ /** Render one statement value for a table cell (recurses for embedded lists). */
579
+ private tableCellValue;
580
+ /** Markdown (or plain string) statement → HTML, with [[reference]] links resolved. */
581
+ private statementToMarkdownHtml;
480
582
  private renderBadgeRow;
481
583
  private renderChipRow;
482
584
  private renderReferenceList;
@@ -14,4 +14,13 @@
14
14
  * implementation is ever needed, swap this file out — nothing else in
15
15
  * the transformation system depends on its internals.
16
16
  */
17
- export declare function renderMarkdownToHtml(source: string): string;
17
+ export interface MarkdownRenderOptions {
18
+ /**
19
+ * Optional syntax highlighter for fenced code blocks. Receives the
20
+ * fence language and the raw code; MUST return HTML-safe output
21
+ * (escaped text + token spans). When absent, code is plain-escaped.
22
+ */
23
+ highlight?: (language: string, code: string) => string;
24
+ }
25
+ export declare function renderMarkdownToHtml(source: string, options?: MarkdownRenderOptions): string;
26
+ export declare function escapeHtml(s: string): string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Generic, language-neutral syntax-highlighting scanner.
3
+ *
4
+ * This is the MECHANISM half of the declarative-highlighting split: it
5
+ * knows nothing about any particular language. It is handed a set of
6
+ * grammars (each an ordered list of `{ tokenClass, pattern }` rules,
7
+ * authored declaratively in the `code-grammars` packages) and walks a
8
+ * code string left to right, first-match-wins, emitting one
9
+ * `<span class="kan-tok-<class>">` per matched token. The INTENT (which
10
+ * rules, for which language) lives in the graph; the THEME (token
11
+ * colors) lives in the look stylesheet.
12
+ *
13
+ * Scanning is line-oriented: each line is tokenized independently, which
14
+ * keeps single-line constructs (comments, strings, keys, flags) correct
15
+ * and predictable. Multi-line constructs (heredocs, block strings) are
16
+ * not tracked across lines — adequate for the snippets prose carries,
17
+ * and refinable per-grammar later without touching this scanner.
18
+ */
19
+ export interface TokenRuleSpec {
20
+ /** TokenClass name → becomes the `kan-tok-<class>` CSS class. */
21
+ tokenClass: string;
22
+ /** JavaScript regex source, applied sticky at the scan position. */
23
+ pattern: string;
24
+ }
25
+ export interface CodeGrammarSpec {
26
+ /** Fence info string this grammar highlights, e.g. "yaml". */
27
+ language: string;
28
+ rules: TokenRuleSpec[];
29
+ }
30
+ export declare class CodeHighlighter {
31
+ private byLang;
32
+ constructor(grammars: CodeGrammarSpec[]);
33
+ /** True when a grammar is registered for `language`. */
34
+ has(language: string): boolean;
35
+ /**
36
+ * Highlight `code` for `language`, returning HTML-safe output (every
37
+ * literal character escaped; tokens wrapped in spans). When no grammar
38
+ * is registered for the language, falls back to a plain escaped block.
39
+ */
40
+ highlight(language: string, code: string): string;
41
+ private highlightLine;
42
+ }
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f}from"../chunk-KDJYZ2YM.js";import{c as b}from"../chunk-IO5RBK3J.js";import"../chunk-H2LEQLVD.js";import{a}from"../chunk-7CUTGGH3.js";import"../chunk-64TVBQFR.js";import"../chunk-W6T7MOKY.js";import"../chunk-FUUTGGJS.js";export{d as KanonakDocumentPositions,b as KanonakObjectParser,a as KanonakParser,c as PropertyMetadata,f as findMarkdownLinkAt,e as parseWithPositions};
1
+ import{a as c,b as d,c as e,d as f}from"../chunk-CYDDQF6S.js";import{c as b}from"../chunk-VJT6YUWK.js";import"../chunk-H2LEQLVD.js";import{a}from"../chunk-7CUTGGH3.js";import"../chunk-64TVBQFR.js";import"../chunk-W6T7MOKY.js";import"../chunk-FUUTGGJS.js";export{d as KanonakDocumentPositions,b as KanonakObjectParser,a as KanonakParser,c as PropertyMetadata,f as findMarkdownLinkAt,e as parseWithPositions};
@@ -1 +1 @@
1
- import{a as g,b as h,c as i,d as j,e as k}from"../chunk-GQQAXZDK.js";import"../chunk-IO5RBK3J.js";import"../chunk-H2LEQLVD.js";import"../chunk-7CUTGGH3.js";import{d as a,e as b,f as c,h as d,i as e,j as f}from"../chunk-64TVBQFR.js";import"../chunk-W6T7MOKY.js";import"../chunk-FUUTGGJS.js";export{f as KanonakVocabulary,i as OWL_RL_CLASSIFICATION_RULES,h as RDFS_RULES,k as Reasoner,j as ReasoningResult,g as TripleStore,e as canonicalizeBuiltinUri,b as makeUriKey,c as tripleKey,a as uriKey,d as uriTriple};
1
+ import{a as g,b as h,c as i,d as j,e as k}from"../chunk-SD5QKNBC.js";import"../chunk-VJT6YUWK.js";import"../chunk-H2LEQLVD.js";import"../chunk-7CUTGGH3.js";import{d as a,e as b,f as c,h as d,i as e,j as f}from"../chunk-64TVBQFR.js";import"../chunk-W6T7MOKY.js";import"../chunk-FUUTGGJS.js";export{f as KanonakVocabulary,i as OWL_RL_CLASSIFICATION_RULES,h as RDFS_RULES,k as Reasoner,j as ReasoningResult,g as TripleStore,e as canonicalizeBuiltinUri,b as makeUriKey,c as tripleKey,a as uriKey,d as uriTriple};
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as j,g as k,h as l}from"../chunk-MOFATNEC.js";import{a,b as g,c as h,d as i}from"../chunk-VHUJSHH7.js";import"../chunk-7CUTGGH3.js";import"../chunk-FQHALFRR.js";export{d as CompositeKanonakDocumentRepository,c as DocumentLocation,b as FileSystemKanonakDocumentRepository,i as HttpKanonakDocumentRepository,a as InMemoryKanonakDocumentRepository,j as LocalFirstRepository,g as PublisherConfigResolver,h as PublisherIndex,f as RepositoryFactory,l as buildLocalFirstRepository,k as collectKanonakFiles,e as getGlobalCachePath};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as j,g as k,h as l}from"../chunk-H673KOGN.js";import{a,b as g,c as h,d as i}from"../chunk-VHUJSHH7.js";import"../chunk-7CUTGGH3.js";import"../chunk-FQHALFRR.js";export{d as CompositeKanonakDocumentRepository,c as DocumentLocation,b as FileSystemKanonakDocumentRepository,i as HttpKanonakDocumentRepository,a as InMemoryKanonakDocumentRepository,j as LocalFirstRepository,g as PublisherConfigResolver,h as PublisherIndex,f as RepositoryFactory,l as buildLocalFirstRepository,k as collectKanonakFiles,e as getGlobalCachePath};