1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1068],{41068:(e,t,r)=>{r.r(t),r.d(t,{BrandedLens:()=>g});var l=r(95155),s=r(12115),n=r(22389),a=r(34968);let o=n.W8;function i(e){let t=String(e.kind||"").toLowerCase();return t in n.ni?t:null}function d(e){if("gov"===e.layer||"server"===e.layer||"edge"===e.layer)return e.layer;let t=i(e);return t?n.ni[t].layer:"gov"}function c(e){if(e.color)return e.color;let t=i(e);if(t){let r=n.ni[t];if("category"===r.color_rule&&e.category)return n.Gv[e.category]||r.color||o;if(r.color)return r.color}return e.category&&n.Gv[e.category]||o}function u(e){let t=String(e.type||e.kind||"").toUpperCase();return t in n.y2?t:null}function x(e,t){let r=e.replace("#",""),l=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),n=parseInt(r.slice(4,6),16);return"rgba(".concat(l,",").concat(s,",").concat(n,",").concat(t,")")}let m=(()=>{let e={};for(let t of n.yF)e[t]=n.y2[t].default_visible;return e})();function g(e){let{accent:t}=e,r=(0,s.useRef)(null),[o,g]=(0,s.useState)(null),[b,h]=(0,s.useState)(null),[f,j]=(0,s.useState)(null),[v,y]=(0,s.useState)("all"),[N,k]=(0,s.useState)(m),[w,_]=(0,s.useState)("all"),[S,C]=(0,s.useState)(!0);(0,s.useEffect)(()=>{let e=!1;return fetch("/canonic-org-galaxy.json").then(e=>{if(!e.ok)throw Error("galaxy.json ".concat(e.status));return e.json()}).then(t=>{e||g(t)}).catch(t=>{e||h(t.message||"failed to load galaxy")}),()=>{e=!0}},[]);let M=(0,s.useMemo)(()=>o?new Map(o.nodes.map(e=>[e.id,e])):new Map,[o]),F=(0,s.useMemo)(()=>{if(!o)return new Set;let e=new Set(n.Vr),t=o.nodes.filter(e=>!e.parent&&"gov"===d(e)).map(e=>e.id),r=new Map;for(let t of o.edges){let l=u(t);if(!l||!e.has(l))continue;let s=r.get(t.from)||[];if(s.push(t.to),r.set(t.from,s),"bidirectional"===n.y2[l].direction){let e=r.get(t.to)||[];e.push(t.from),r.set(t.to,e)}}let l=new Set(t),s=[...t];for(;s.length;){let e=s.shift();for(let t of r.get(e)||[])l.has(t)||(l.add(t),s.push(t))}return l},[o]),E=(0,s.useMemo)(()=>{if(!o)return new Set;let e=new Set;for(let t of o.nodes)("all"===v||d(t)===v)&&("reachable"!==w||F.has(t.id))&&("orphans"===w&&F.has(t.id)||e.add(t.id));return e},[o,v,w,F]),I=(0,s.useMemo)(()=>{if(!o)return null;let e=o.nodes.filter(e=>E.has(e.id)),t=o.edges.filter(e=>{if(!E.has(e.from)||!E.has(e.to))return!1;let t=u(e);return!!t&&N[t]});return{nodes:e.map(e=>({id:e.id,label:e.label,kind:String(e.kind),bits:e.bits,meta:e})),edges:t.map(e=>({from:e.from,to:e.to,type:String(e.type||e.kind||"")}))}},[o,E,N]),z=(0,s.useMemo)(()=>[(e,r)=>{var l;let s=e.meta,a=d(s),o=!F.has(s.id),u=c(s),x=function(e){let t=i(e);return t?n.ni[t].shape:"dot"}(s),m=i(s),g=!!m&&n.ni[m].outline;return{...r,group:a,color:{background:g?"rgba(10,10,10,0.6)":u,border:o?"#f43f5e":u,highlight:{background:u,border:t},hover:{background:u,border:t}},size:function(e){let t=i(e);if(!t||"tier"===n.ni[t].size_rule){var r;let t=null!=(r=e.bits)?r:0;return t>=255?22:t>=127?18:t>=63?14:11}return"worker"===t||"compiler"===t?16:"ledger_type"===t||"task_contract"===t?14:"asset"===t||"http_route"===t?8:12}(s),shape:x,font:{color:"rgba(248,250,252,0.85)",face:'system-ui,-apple-system,"Segoe UI",sans-serif',size:s.bits&&s.bits>=255?14:s.bits&&s.bits>=127?12:11,strokeWidth:0,vadjust:-2},borderWidth:o?2.5:(null!=(l=s.bits)?l:0)>=255?2:1,borderWidthSelected:3}}],[F,t]),L=(0,s.useCallback)(e=>{let r=String(e.type||"").toUpperCase(),l=r in n.y2?n.y2[r]:null;return l?{color:{color:x(l.color,l.alpha),highlight:t,hover:x(l.color,Math.min(1,1.5*l.alpha))},width:"dotted"===l.line?.5:l.alpha>=.6?1.2:.8,dashes:"dashed"===l.line?[6,4]:"dotted"===l.line&&[2,3],arrows:"forward"===l.direction?{to:{enabled:!0,scaleFactor:.4}}:{to:{enabled:!1}},smooth:{enabled:!0,type:"continuous",roundness:.3}}:{color:{color:x("#64748b",.2),highlight:t},width:.5,dashes:!1,smooth:{enabled:!0,type:"continuous",roundness:.3}}},[t]),O=(0,s.useCallback)(e=>{if(r.current=e,!o)return;let t=o.nodes.filter(e=>E.has(e.id)),l={gov:0,server:0,edge:0};for(let e of t)l[d(e)]++;let s={gov:0,server:0,edge:0};for(let r of t){let t=d(r),a=l[t]||1,o=s[t]++,i=n.CW[t],c=o/a*Math.PI*2;e.moveNode(r.id,Math.cos(c)*i,Math.sin(c)*i)}},[o,E]),A=(0,s.useCallback)(e=>{j(e?e.id:null)},[]),T=(0,s.useMemo)(()=>o&&f&&o.nodes.find(e=>e.id===f)||null,[o,f]),U=(0,s.useMemo)(()=>
1{if(!o||!f)return{incoming:[],outgoing:[]};let e=[],t=[];for(let r of o.edges)r.to===f&&e.push(r),r.from===f&&t.push(r);return{incoming:e,outgoing:t}},[o,f]),W=(0,s.useMemo)(()=>{var e;return o?null!=(e=o.master)?e:function(e){var t,r,l,s,n,a;let o=Math.round(null!=(r=e.stats.avg_bits)?r:0),i=[...e.tiers].sort((e,t)=>t.threshold-e.threshold).find(e=>o>=e.threshold);return{id:"canonic",label:"CANONIC",bits:o,score:null!=(l=e.stats.avg_bits)?l:0,tier:null!=(n=null==i?void 0:i.name)?n:null!=(s=null==(t=e.tiers[0])?void 0:t.name)?s:"",wallet_balance:null!=(a=e.stats.total_coin)?a:0,wallet_events:0}}(o):null},[o]),R=(0,s.useMemo)(()=>{if(!o||!W)return t;let e=o.tiers.find(e=>e.name===W.tier);return(null==e?void 0:e.color)||t},[o,W,t]),B=(0,s.useMemo)(()=>{let e={gov:0,server:0,edge:0};if(!o)return e;for(let t of o.nodes)e[d(t)]++;return e},[o]),G=(0,s.useMemo)(()=>o?o.nodes.filter(e=>!F.has(e.id)).length:0,[o,F]);(0,s.useEffect)(()=>{function e(e){var t,l;let s=null==(t=e.target)?void 0:t.tagName;if("INPUT"!==s&&"TEXTAREA"!==s&&"SELECT"!==s){if("Escape"===e.key){j(null),null==(l=r.current)||l.unselectAll();return}"g"===e.key&&y("gov"),"s"===e.key&&y("server"),"e"===e.key&&y("edge"),"a"===e.key&&y("all"),"h"===e.key&&C(e=>!e)}}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);let P=(0,s.useCallback)(e=>{k(t=>({...t,[e]:!t[e]}))},[]);if(b)return(0,l.jsxs)("div",{className:"flex h-[70vh] items-center justify-center px-4 text-center text-sm text-muted-foreground",children:["Galaxy data unavailable: ",b]});if(!o||!I)return(0,l.jsx)("div",{className:"flex h-[70vh] items-center justify-center text-xs uppercase tracking-wider text-muted-foreground",children:"Loading galaxyâ¦"});let D=0===E.size;return(0,l.jsxs)("div",{className:"relative h-[80vh] w-full bg-black/40",children:[(0,l.jsx)(a.x,{data:I,layout:"force",overlays:z,edgeProps:L,onSelect:A,onReady:O},"".concat(v,":").concat(w,":").concat(Object.values(N).join(""))),D&&(0,l.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center",children:(0,l.jsxs)("div",{className:"rounded-lg border border-border bg-background/80 p-6 text-sm text-muted-foreground backdrop-blur",children:["No nodes match the current filters.",(0,l.jsx)("br",{}),"Try ",(0,l.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px]",children:"a"})," ","to show all layers, or relax the reachability filter."]})}),S&&W&&(0,l.jsxs)("div",{className:"absolute left-4 top-4 z-10 max-h-[calc(100vh-6rem)] w-72 overflow-y-auto rounded-lg border border-border bg-background/85 p-4 text-xs backdrop-blur",children:[(0,l.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:W.label}),(0,l.jsxs)("div",{className:"mt-1 flex items-baseline gap-2",children:[(0,l.jsx)("span",{className:"text-2xl font-bold tracking-tight tabular-nums",style:{color:R},children:W.bits}),(0,l.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"/ 255"}),(0,l.jsx)("span",{className:"ml-auto text-[10px] font-semibold uppercase tracking-wider",style:{color:R},children:W.tier})]}),(0,l.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:[(0,l.jsx)("span",{children:"COIN"}),(0,l.jsx)("span",{className:"text-right font-mono tabular-nums text-foreground",children:W.wallet_balance.toLocaleString()}),(0,l.jsx)("span",{children:"Nodes"}),(0,l.jsx)("span",{className:"text-right font-mono tabular-nums text-foreground",children:o.stats.total}),(0,l.jsx)("span",{children:"Below 255"}),(0,l.jsx)("span",{className:"text-right font-mono tabular-nums text-foreground",children:o.stats.below_magic}),(0,l.jsx)("span",{children:"Orphans"}),(0,l.jsx)("span",{className:"text-right font-mono tabular-nums text-foreground",children:G})]}),(0,l.jsxs)("div",{className:"mt-4 border-t border-border pt-3",children:[(0,l.jsxs)("div",{className:"mb-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:["Layer ",(0,l.jsx)("span",{className:"ml-1 normal-case text-muted-foreground",children:"(g\xb7s\xb7e\xb7a)"})]}),(0,l.jsx)("div",{className:"grid grid-cols-4 gap-1",children:["all","gov","server","edge"].map(e=>{let t="all"===e?o.stats.total:B[e],r=v===e;return(0,l.jsxs)("button",{type:"button",onClick:()=>y(e),className:"rounded-md border px-1 py-1 text-[10px] uppercase tracking-wider transition ".concat(r?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:[(0,l.jsx)("div",{children:e}),(0,l.jsx)("div",{className:"font-mono text-[9px] tabular-nums opacity-70",children:t})]},e)})})]}),(0,l.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,l.jsx)("div",{className:"mb-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Reachability"}),(0,l.jsx)("div",{className:"grid grid-cols-3 gap-1",children:["all","reachable","orphans"].map(e=>{let t=w===e;return(0,l.jsx)("button",{type:"button",onClick:()=>_(e),className:"rounded-md border px-1 py-1 text-[10px] uppercase tracking-wider transition ".concat(t?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:e},e)})})]}),(0,l.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,l.jsx)("div",{className:"mb-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:"Edge types"}),(0,l.jsx)("ul",{className:"space-y-1",children:n.yF.map(e=>{let t=n.y2[e];return(0,l.jsxs)("li",{className:"flex items-center gap-2 text-[11px]",children:[(0,l.jsx)("input",{type:"checkbox",id:"edge-".concat(e),checked:N[e],onChange:()=>P(e),className:"h-3 w-3 cursor-pointer accent-primary"}),(0,l.jsx)("span",{className:"inline-block h-[2px] w-5",style:{background:x(t.color,Math.max(t.alpha,.4))}}),(0,l.jsx)("label",{htmlFor:"edge-".concat(e),className:"cursor-pointer font-mono text-[10px] tracking-tight text-foreground",children:e}
1),t.reachability_root&&(0,l.jsx)("span",{title:"reachability root",className:"ml-auto text-[8px] uppercase tracking-wider text-muted-foreground",children:"â"})]},e)})})]})]}),!S&&(0,l.jsx)("button",{type:"button",onClick:()=>C(!0),className:"absolute left-4 top-4 z-10 rounded-md border border-border bg-background/80 px-3 py-1.5 text-[10px] uppercase tracking-wider text-muted-foreground backdrop-blur hover:text-foreground",children:"Show HUD (h)"}),T&&(0,l.jsx)(p,{node:T,incoming:U.incoming,outgoing:U.outgoing,onClose:()=>{var e;j(null),null==(e=r.current)||e.unselectAll()},onNavigate:e=>{if(M.has(e)){var t,l;j(e),null==(t=r.current)||t.selectNodes([e]),null==(l=r.current)||l.focus(e,1.1)}}})]})}function p(e){let{node:t,incoming:r,outgoing:s,onClose:n,onNavigate:a}=e,o=i(t),u=d(t),x=c(t);return(0,l.jsxs)("aside",{className:"absolute right-0 top-0 z-20 h-full w-[360px] max-w-full overflow-y-auto border-l border-border bg-background/95 p-6 backdrop-blur",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,l.jsx)("span",{children:t.kind||"node"}),(0,l.jsx)("span",{className:"opacity-50",children:"\xb7"}),(0,l.jsx)("span",{children:u}),t.category&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"opacity-50",children:"\xb7"}),(0,l.jsx)("span",{children:t.category})]})]}),(0,l.jsx)("h2",{className:"mt-1 break-words text-xl font-bold leading-tight",style:{color:x},children:t.label}),(t.source||t.path)&&(0,l.jsx)("div",{className:"mt-1 break-all font-mono text-[10px] text-muted-foreground",children:t.source||t.path})]}),(0,l.jsx)("button",{type:"button",onClick:n,"aria-label":"Close detail panel",className:"rounded-md border border-border px-2 py-1 text-[10px] text-muted-foreground transition hover:text-foreground",children:"\xd7"})]}),(0,l.jsxs)("div",{className:"mt-4 grid grid-cols-3 gap-2 text-xs",children:[(0,l.jsx)(b,{label:"In",value:String(r.length)}),(0,l.jsx)(b,{label:"Out",value:String(s.length)}),"number"==typeof t.bits?(0,l.jsx)(b,{label:"Bits",value:String(t.bits)}):(0,l.jsx)(b,{label:"Kind",value:t.kind||"â"})]}),"scope"===o&&(0,l.jsx)(j,{node:t}),"compiler"===o&&(0,l.jsx)(v,{node:t}),"verifier"===o&&(0,l.jsx)(y,{node:t}),"artifact"===o&&(0,l.jsx)(N,{node:t}),"worker"===o&&(0,l.jsx)(k,{node:t}),"handler"===o&&(0,l.jsx)(w,{node:t}),"route"===o&&(0,l.jsx)(_,{node:t}),"component"===o&&(0,l.jsx)(S,{node:t}),"asset"===o&&(0,l.jsx)(C,{node:t}),"ledger_type"===o&&(0,l.jsx)(M,{node:t}),"task_contract"===o&&(0,l.jsx)(F,{node:t}),"healer"===o&&(0,l.jsx)(E,{node:t}),"http_route"===o&&(0,l.jsx)(I,{node:t}),(0,l.jsx)(z,{title:"Incoming",edges:r.slice(0,3),thisId:t.id,flip:"from",onNavigate:a}),(0,l.jsx)(z,{title:"Outgoing",edges:s.slice(0,3),thisId:t.id,flip:"to",onNavigate:a})]})}function b(e){let{label:t,value:r}=e;return(0,l.jsxs)("div",{className:"rounded-md border border-border bg-card/40 px-3 py-2",children:[(0,l.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:t}),(0,l.jsx)("div",{className:"mt-0.5 truncate text-base font-bold tabular-nums",children:r})]})}function h(e){let{label:t,items:r}=e;return r&&0!==r.length?(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:t}),(0,l.jsx)("ul",{className:"mt-1 space-y-0.5",children:r.map((e,t)=>(0,l.jsx)("li",{className:"break-all font-mono text-[11px] text-foreground/85",children:e},t))})]}):null}function f(e){let{label:t,value:r}=e;return r?(0,l.jsxs)("div",{className:"mt-3 grid grid-cols-[100px_1fr] gap-2 text-[11px]",children:[(0,l.jsx)("span",{className:"text-muted-foreground",children:t}),(0,l.jsx)("span",{className:"break-all font-mono text-foreground/85",children:r})]}):null}function j(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"repo",value:t.repo}),(0,l.jsx)(f,{label:"tier",value:t.tier}),(0,l.jsx)(f,{label:"bits",value:null!=t.bits?String(t.bits):void 0}),(0,l.jsx)(f,{label:"children",value:null!=t.children?String(t.children):void 0}),(0,l.jsx)(f,{label:"learning",value:null!=t.learning_count?String(t.learning_count):void 0}),t.missing_dims&&t.missing_dims.length>0&&(0,l.jsxs)("div",{className:"mt-3",children:[(0,l.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Missing dimensions"}),(0,l.jsx)("div",{className:"mt-1 flex flex-wrap gap-1",children:t.missing_dims.map(e=>(0,l.jsx)("span",{className:"rounded-full border border-border px-2 py-0.5 text-[10px] text-muted-foreground",children:e},e))})]})]})}function v(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"last run",value:t.last_run}),(0,l.jsx)(h,{label:"reads",items:t.reads}),(0,l.jsx)(h,{label:"writes",items:t.writes}),(0,l.jsx)(h,{label:"depends",items:t.depends})]})}function y(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"gate",value:t.gate}),(0,l.jsx)(f,{label:"transitional",value:t.transitional?"yes":"no"}),(0,l.jsx)(f,{label:"last run",value:t.last_run})]})}function N(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"emitted by",value:t.emitted_by}),(0,l.jsx)(h,{label:"consumed by",items:t.consumed_by})]})}function k(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h,{label:"handlers",items:t.handlers}),(0,l.jsx)(h,{label:"routes",items:t.routes}),(0,l.jsx)(h,{label:"crons",items:t.crons})]})}function w(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"worker",value:t.worker}),(0,l.jsx)(h,{label:"routes",items:t.routes}),(0,l.jsx)(h,{label:"ledger types",items:t.ledger_types})]})}function _(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"url",value:t.url}),(0,l.jsx)(f,{label:"classification",value:t.classification}),(0,l.jsx)(f,{label:"component",value:t.component})]})}function S(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h,{label:"imports",items:(t.imports||[]).slice(0,10)}),(0,l.jsx)(h,{label:"rendered by",items:t.rendered_by})]})}function C(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"size",value:null!=t.size?"".concat(t.size.toLocaleStr
1ing()," bytes"):void 0}),(0,l.jsx)(f,{label:"modified",value:t.modified}),(0,l.jsx)(h,{label:"referenced by",items:t.referenced_by})]})}function M(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"emitter",value:t.emitter}),(0,l.jsx)(f,{label:"payload",value:t.payload_schema}),(0,l.jsx)(f,{label:"mints",value:t.mint?"yes":"no"})]})}function F(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"schedule",value:t.schedule}),(0,l.jsx)(f,{label:"runtime",value:t.runtime}),(0,l.jsx)(f,{label:"target",value:t.target})]})}function E(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"last run",value:t.last_run}),(0,l.jsx)(h,{label:"reads",items:t.reads}),(0,l.jsx)(h,{label:"writes",items:t.writes})]})}function I(e){let{node:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{label:"url",value:t.url}),(0,l.jsx)(f,{label:"worker",value:t.worker})]})}function z(e){let{title:t,edges:r,thisId:s,flip:a,onNavigate:o}=e;return 0===r.length?null:(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:t}),(0,l.jsx)("ul",{className:"mt-1 space-y-1",children:r.map((e,t)=>{let r=u(e),i="from"===a?e.from:e.to;return i===s?null:(0,l.jsxs)("li",{className:"flex items-center gap-2 rounded border border-border bg-card/40 px-2 py-1 text-[11px]",children:[(0,l.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-wider",style:{color:r?n.y2[r].color:"#64748b"},children:r||"?"}),(0,l.jsx)("button",{type:"button",onClick:()=>o(i),className:"flex-1 truncate text-left font-mono text-[10px] text-foreground/85 hover:text-foreground",title:i,children:i})]},t)})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.