(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{78922:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return Dn},GraphPage:function(){return In},default:function(){return Ln}});var r=t(87757),i=t.n(r),o=t(92137),l=t(85893),s=t(87329),a=t(96156),c=t(34699),u=t(67294);function d(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function h(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:{},i=f(e,null!==(t=r.storage)&&void 0!==t?t:localStorage),o=i.get(),l=void 0!==o?o:n,s=null!=o&&"object"===typeof o&&!1===Array.isArray(o)?h(h({},n),o):l;s!==o&&i.update(s);var a=(0,u.useState)(s),c=a[0],d=a[1];(0,u.useEffect)((function(){c!==s&&d(s)}),[e]);var g=function(e){e instanceof Function?d((function(n){var t=e(n);return i.update(t),t})):(d(e),i.update(e))};return[c,g]}function f(e,n){return{get:function(){var t=n.getItem(e);if(t&&"undefined"!==t)return JSON.parse(t)},update:function(t){n.setItem(e,JSON.stringify(t))},remove:function(){n.removeItem(e)}}}var p=t(54533),x=t(81253),j=t(18835),b=t.n(j),m=t(13816),v=t.n(m),y=t(42728),C=t.n(y),O=t(71167),k=t.n(O),w=t(27431),S=t.n(w),P=function(e){var n=e.orgText,t=b()().use(v()).use(C()).use(k()).use(S(),{createElement:u.createElement});return console.log(t.processSync(n)),(0,l.jsxs)("div",{children:[" ",t.processSync(n).result]})},L=t(25715),I=t(94096),D=t(48420),z=t(48017),N=t(336),E=t(72026),T=t(86658),Z=t(56884),R=t(29356);function F(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function A(e){for(var n=1;n1,animateOpacity:!0,children:(0,l.jsx)(z.xu,{paddingTop:2,children:(0,l.jsx)(De,{label:"Label Appearance Scale",value:5*n.labelScale,onChange:function(e){return t(Ue(Ue({},n),{},{labelScale:e/5}))}})})})]})]})})};function Ye(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function $e(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:2e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var o=ge.current,l=xe.current,a=je.current,c=null!==(t=de.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,s.Z)(c.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));if("zoom"===e)return l.nodeIds.length&&x({nodeIds:[]}),void setTimeout((function(){return o.zoomToFit(r,i,(function(e){return u[e.id]}))}),50);if(!l.nodeIds.length)return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);if("add"!==a.localSame)return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);if(!l.nodeIds.includes(n)||!l.nodeIds.some((function(e){return u[e]})))return x({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50);x((function(e){return kn(kn({},e),{},{nodeIds:[].concat((0,s.Z)(e.nodeIds),[n])})})),setTimeout((function(){o.centerAt(0,0,10),o.zoomToFit(1,i)}),50)}};return(0,u.useEffect)((function(){be.current=new yn.Z("ws://localhost:35903"),be.current.addEventListener("open",(function(){console.log("Connection with Emacs established")})),be.current.addEventListener("message",(function(e){var n=je.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t,r,i=ue.current;he.current=null!==(n=e.tags)&&void 0!==n?n:[];var o=null!==(t=e.nodes)&&void 0!==t?t:[],l=null!==(r=e.links)&&void 0!==r?r:[],u=o.reduce((function(e,n){var t;return kn(kn({},e),{},(0,a.Z)({},n.file,[].concat((0,s.Z)(null!==(t=e[n.file])&&void 0!==t?t:[]),[n])))}),{}),d=Object.keys(u).flatMap((function(e){var n,t=null!==(n=u[e])&&void 0!==n?n:[],r=t.find((function(e){return 0===e.level})),i=t.filter((function(e){return 0!==e.level}));return r?i.map((function(e){var n=t.filter((function(n){var t;return!(n.level>=e.level||n.pos>=e.pos||null===(t=e.olp)||void 0===t||!t.includes(n.title))})).reduce((function(e,n){return n.level>e.level&&(e=n),e}),r);return{source:e.id,target:(null===n||void 0===n?void 0:n.id)||r.id,type:"heading"}})):[]})),h=Object.keys(u).flatMap((function(e){var n,t=null!==(n=u[e])&&void 0!==n?n:[],r=t.find((function(e){return 0===e.level})),i=t.filter((function(e){return 0!==e.level}));return r?i.map((function(e){return{source:e.id,target:r.id,type:"parent"}})):[]}));ue.current=Object.fromEntries(o.map((function(e){return[e.id,e]})));var g=[].concat((0,s.Z)(l),(0,s.Z)(d),(0,s.Z)(h)),f=[],p=g.map((function(e){var n=e.source,t=e.target;return ue.current[n]?ue.current[t]?e:(f.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0,pos:0,olp:null}),kn(kn({},e),{},{type:"bad"})):(f.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0,pos:0,olp:null}),kn(kn({},e),{},{type:"bad"}))}));ue.current=kn(kn({},ue.current),Object.fromEntries(f.map((function(e){return[e.id,e]})))),de.current=p.reduce((function(e,n){var t,r,i;return kn(kn({},e),{},(i={},(0,a.Z)(i,n.source,[].concat((0,s.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,a.Z)(i,n.target,[].concat((0,s.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),i))}),{});var x={nodes:[].concat((0,s.Z)(o),f),links:p},j=fe.current;if(0===j.nodes.length){var b=JSON.parse(JSON.stringify(x));return fe.current=b,void T(b)}var m=[].concat((0,s.Z)(j.nodes.flatMap((function(e){var n,t=null!==(n=ue.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;return t?[kn(kn({},e),t)]:[]}))),(0,s.Z)(Object.keys(ue.current).filter((function(e){return!i[e]})).map((function(e){return ue.current[e]})))),v=m.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return kn(kn({},e),{},(0,a.Z)({},r,t))}),{}),y=p.map((function(e){var n=Nn(e),t=(0,c.Z)(n,2),r=t[0],i=t[1];return kn(kn({},e),{},{source:m[v[r]],target:m[v[i]]})}));T({nodes:m,links:y})}(t.data);case"orgText":return te(t.data);case"theme":return pe(t.data);case"command":switch(t.data.commandName){case"local":var r=W.zoomSpeed,i=W.zoomPadding;me("local",t.data.id,r,i),A(t.data.id);break;case"zoom":var o,l,u=(null===t||void 0===t||null===(o=t.data)||void 0===o?void 0:o.speed)||n.zoomSpeed,d=(null===t||void 0===t||null===(l=t.data)||void 0===l?void 0:l.padding)||n.zoomPadding;me("zoom",t.data.id,u,d),A(t.data.id);break;case"follow":me(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),A(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),(0,u.useEffect)((function(){var e=ge.current;!e||p.nodeIds.length>1||(p.nodeIds.length||!m.gravityOn?setTimeout((function(){e.zoomToFit(5,200)}),50):e.zoomToFit())}),[p.nodeIds]),E?(0,l.jsxs)(z.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100%",overflow:"hidden",children:[(0,l.jsxs)(z.xu,{display:"flex",justifyContent:"space-between",flexDirection:"row",height:"100%",width:"100%",children:[(0,l.jsx)(H,kn({},{isOpen:se,onClose:ce,previewNode:ie,orgText:U})),(0,l.jsx)(an,kn(kn({},{physics:m,setPhysics:v,threeDim:t,setThreeDim:r,filter:O,setFilter:k,visuals:P,setVisuals:L,mouse:Q,setMouse:G,behavior:W,setBehavior:X,tagColors:d,setTagColors:h}),{},{tags:he.current})),(0,l.jsx)(I.k,{height:"100%",flexDirection:"column",marginLeft:"auto",children:!se&&(0,l.jsx)(D.h,{icon:(0,l.jsx)(Cn.w,{}),height:100,"aria-label":"Open org-viewer",position:"relative",zIndex:"overlay",colorScheme:"purple",onClick:ae,variant:"ghost",marginTop:10})})]}),(0,l.jsx)(z.xu,{position:"absolute",alignItems:"top",overflow:"hidden",children:(0,l.jsx)(Dn,kn({ref:ge,nodeById:ue.current,linksByNodeId:de.current,webSocket:be.current},{physics:m,graphData:E,threeDim:t,emacsNodeId:F,filter:O,visuals:P,behavior:W,mouse:Q,scope:p,setScope:x,tagColors:d,setPreviewNode:oe}))})]}):null}var Dn=(0,u.forwardRef)((function(e,n){var t=e.physics,r=e.graphData,d=e.threeDim,h=e.linksByNodeId,g=e.filter,f=e.emacsNodeId,x=e.nodeById,j=e.visuals,b=e.behavior,m=e.mouse,v=e.scope,y=e.setScope,C=e.webSocket,O=e.tagColors,k=e.setPreviewNode,w=(0,B.iP)(),S=(0,c.Z)(w,2),P=S[0],L=S[1],I=(0,u.useState)(null),D=I[0],N=I[1],E=(0,u.useState)(null),T=E[0],Z=E[1],F=(0,u.useState)([0,0]),A=F[0],H=F[1],X=(0,W.useTheme)(),_=(0,u.useContext)(R.N).emacsTheme,q=function(e,n){"replace"!==n?v.nodeIds.includes(e.id)||y((function(n){return kn(kn({},n),{},{nodeIds:[].concat((0,s.Z)(n.nodeIds),[e.id])})})):y({nodeIds:[e.id]})},Q=(0,M.q)(),G=function(e,n,t){switch(e){case m.local:q(n,b.localSame);break;case m.follow:xn(n,C);break;case m.context:!function(e,n){H([n.pageX,n.pageY]),Z(e),Q.onOpen()}(n,t)}},K=(0,u.useRef)(null);(0,u.useEffect)((function(){f&&N(x[f])}),[f]);var J=(0,u.useRef)({}),Y=(0,u.useRef)({}),$=(0,u.useMemo)((function(){var e;Y.current={};var n=null===r||void 0===r||null===(e=r.nodes)||void 0===e?void 0:e.filter((function(e){var n=e;return g.tagsBlacklist.length&&g.tagsBlacklist.some((function(e){return n.tags.indexOf(e)>-1}))||g.tagsWhitelist.length>0&&!g.tagsWhitelist.some((function(e){return n.tags.indexOf(e)>-1}))||g.filelessCites&&n.properties.FILELESS?(Y.current=kn(kn({},Y.current),{},(0,a.Z)({},n.id,n)),!1):!g.bad||!n.properties.bad||(Y.current=kn(kn({},Y.current),{},(0,a.Z)({},n.id,n)),!1)})).filter((function(e){var n,t=(null!==(n=h[null===e||void 0===e?void 0:e.id])&&void 0!==n?n:[]).filter((function(e){return!Y.current[e.source]&&!Y.current[e.target]}));return!g.orphans||(g.parent?0!==t.length:0!==t.length&&t.some((function(e){return!["parent","heading"].includes(e.type)})))})),t=n.map((function(e){return e.id})),i=r.links.filter((function(e){var n=Nn(e),r=(0,c.Z)(n,2),i=r[0],o=r[1];if(!t.includes(i)||!t.includes(o))return!1;var l=e;return g.parent?"heading"===g.parent?"parent"!==l.type:"heading"!==l.type:!["parent","heading"].includes(l.type)}));return J.current=i.reduce((function(e,n){var t,r,i,o=n,l=Nn(o),u=(0,c.Z)(l,2),d=u[0],h=u[1];return kn(kn({},e),{},(i={},(0,a.Z)(i,d,[].concat((0,s.Z)(null!==(t=e[d])&&void 0!==t?t:[]),[o])),(0,a.Z)(i,h,[].concat((0,s.Z)(null!==(r=e[h])&&void 0!==r?r:[]),[o])),i))}),{}),{nodes:n,links:i}}),[g,r]),ee=(0,u.useState)({nodes:[],links:[]}),ne=ee[0],re=ee[1];(0,u.useEffect)((function(){if(v.nodeIds.length){var e=v.nodeIds.length>1?ne.nodes:[],n=e.map((function(e){return e.id})),t=function(e,n){var t=[e[0]],r=[],i=[e[0]];return Array.from({length:n},(function(){t.forEach((function(e){var n;(null!==(n=J.current[e])&&void 0!==n?n:[]).forEach((function(e){var n=Nn(e),t=(0,c.Z)(n,2),o=t[0],l=t[1];i.includes(o)?i.includes(l)||r.push(l):r.push(o)}))})),t=r,r.forEach((function(e){return e&&i.push(e)})),r=[]})),i}(v.nodeIds,1),r=$.nodes.filter((function(r){var i;return e.length?!n.includes(r.id)&&(null!==(i=J.current[r.id])&&void 0!==i?i:[]).some((function(e){return v.nodeIds.includes(e.source)||v.nodeIds.includes(e.target)})):t.includes(r.id)})).map((function(e){return kn(kn({},e),{},{x:0,y:0,vy:0,vx:0})})),i=[].concat((0,s.Z)(e),(0,s.Z)(r)),o=i.map((function(e){return e.id})),l=v.nodeIds.length>1?ne.links:[],a=$.links.filter((function(e){var t=Nn(e),r=(0,c.Z)(t,2),i=r[0],s=r[1];return!(l.length&&n.includes(s)&&n.includes(i))&&(o.includes(i)&&o.includes(s))})).map((function(e){var n=Nn(e),t=(0,c.Z)(n,2);return{source:t[0],target:t[1]}})),u=[].concat((0,s.Z)(l),(0,s.Z)(a));re({nodes:i,links:u})}}),[g,v,r]),K.current=D;var ie=(0,u.useMemo)((function(){if(!K.current)return{};var e=J.current[K.current.id];return e?Object.fromEntries([K.current.id].concat((0,s.Z)(e.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[JSON.stringify(K.current),JSON.stringify(J.current)]);(0,u.useEffect)((function(){(0,o.Z)(i().mark((function e(){var r,o;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,wn;case 3:o=e.sent,!t.gravityOn||v.nodeIds.length&&!t.gravityLocal?(r.d3Force("x",null),r.d3Force("y",null),d&&r.d3Force("z",null)):(r.d3Force("x",o.forceX().strength(t.gravity)),r.d3Force("y",o.forceY().strength(t.gravity)),d&&r.d3Force("z",o.forceZ().strength(t.gravity))),t.centering?r.d3Force("center",o.forceCenter().strength(t.centeringStrength)):r.d3Force("center",null),t.linkStrength&&r.d3Force("link").strength(t.linkStrength),t.linkIts&&r.d3Force("link").iterations(t.linkIts),t.charge&&r.d3Force("charge").strength(t.charge),r.d3Force("collide",t.collision?o.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()}),[t,d,v]),(0,u.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t,v.nodeIds.length]);var oe=(0,u.useRef)(0),le=(0,u.useState)(1),se=le[0],ae=le[1],ce=(0,V._7)((function(e){return ae(e)}),{duration:j.animationSpeed,algorithm:U[j.algorithmName]}),ue=(0,c.Z)(ce,2),de=ue[0],he=ue[1],ge=(0,V._7)((function(e){return ae(Math.min(se,-1*(e-1)))}),{duration:j.animationSpeed,algorithm:U[j.algorithmName]}),fe=(0,c.Z)(ge,2),pe=fe[0],xe=fe[1],je=(0,u.useRef)(null);(0,u.useEffect)((function(){if(D&&(je.current=D),!j.highlightAnim)return ae(D?1:0);D?de():(he(),se>.5?pe():ae(0))}),[D]);var be=function(e){if(X)return e.split(".").reduce((function(e,n){return e[n]}),X.colors)},me=(0,u.useMemo)((function(){return Object.fromEntries(te.map((function(e){var n=be(e),t=te.map((function(e){return[e,p.Z(n,be(e))]}));return[e,Object.fromEntries(t)]})))}),[_]),ve=(0,u.useMemo)((function(){var e,n,t,r=null!==(e=J.current[null===(n=je.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=je.current)||void 0===t?void 0:t.id].concat((0,s.Z)(r.flatMap((function(e){return Nn(e)})))).map((function(e){return[e,{}]})))}),[JSON.stringify(D),je.current,J.current]),ye=function(e){var n,t,r,i,o,l=null!==(n=null===(t=J.current[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0;return j.nodeColorScheme[(r=l,i=0,o=j.nodeColorScheme.length-1,Math.min(Math.max(r,i),o))]},Ce=function(e,n){return J.current[e].length>J.current[n].length?ye(e):ye(n)},Oe=(0,u.useMemo)((function(){return be(j.labelTextColor)}),[j.labelTextColor,_]),ke=(0,u.useMemo)((function(){return be(j.labelBackgroundColor)}),[j.labelBackgroundColor,_]),we=function(e){var n,t=null!==(n=J.current[e.id])&&void 0!==n?n:[],r=t.length?t.filter((function(e){return"parent"===e.type})).length:0,i=3+t.length*j.nodeSizeLinks-(g.parent?0:r);return 1===j.highlightNodeSize?i:i*(ie[e.id]||ve[e.id]?1+se*(j.highlightNodeSize-1):1)},Se=(0,u.useState)(!1),Pe=Se[0],Le=Se[1],Ie=(0,u.useState)(1),De=Ie[0],ze=Ie[1],Ne={graphData:v.nodeIds.length?ne:$,width:P,height:L,backgroundColor:X.colors.gray[j.backgroundColor],warmupTicks:1===v.nodeIds.length?100:v.nodeIds.length>1?20:0,onZoom:function(e){var n=e.k;e.x,e.y;return ze(n)},nodeLabel:function(e){return e.title},nodeColor:function(e){return function(e){var n=ie[e.id]||ve[e.id];if(j.emacsNodeColor&&e.id===f)return be(j.emacsNodeColor);if(O&&e.tags.some((function(e){return O[e]}))){var t=O[e.tags.filter((function(e){return O[e]}))[0]];return me[t][j.backgroundColor](j.highlightFade*se)}return j.citeNodeColor&&e.properties.ROAM_REFS&&e.properties.FILELESS?n?be(j.citeNodeColor):me[j.citeNodeColor][j.backgroundColor](j.highlightFade*se):j.refNodeColor&&e.properties.ROAM_REFS?n?be(j.refNodeColor):me[j.refNodeColor][j.backgroundColor](j.highlightFade*se):n?j.nodeHighlight?me[ye(e.id)][j.nodeHighlight](se):be(ye(e.id)):me[ye(e.id)][j.backgroundColor](j.highlightFade*se)}(e)},nodeRelSize:j.nodeRel,nodeVal:function(e){return we(e)/Math.pow(De,j.nodeZoomSize)},nodeCanvasObject:function(e,n,t){if(e&&!Pe&&j.labels){var r=ve[e.id];if(!(t<=j.labelScale||1===j.labels)||ie[e.id]||r){var i=e.title,o=i.substring(0,j.labelLength),l=j.labelFontSize/(.75*Math.min(Math.max(.5,t),3)),a=[1.1*n.measureText(o).width,l].map((function(e){return e+.5*l})),c=Math.min(3*(t-j.labelScale)/j.labelScale,1),u=function(){return 1===j.labels||t<=j.labelScale?se:ie[e.id]||ve[e.id]?Math.max(c,se):1*c*(-1*(j.highlightFade*se-1))},d=8*Math.cbrt(we(e)*j.nodeRel);if(j.labelBackgroundColor&&j.labelBackgroundOpacity){var h=u()*j.labelBackgroundOpacity,g=En(ke,h);n.fillStyle=g,n.fillRect.apply(n,[e.x-a[0]/2,e.y-a[1]/2+d].concat((0,s.Z)(a)))}var f=u();n.textAlign="center",n.textBaseline="middle";var p=En(Oe,f);n.fillStyle=p,n.font="".concat(l,"px Sans-Serif");var x=vn()(o,{width:j.labelWordWrap}).split("\n");(i.length>j.labelLength?[].concat((0,s.Z)(x.slice(0,-1)),["".concat(x.slice(-1),"...")]):x).forEach((function(t,r){n.fillText(t,e.x,e.y+d+j.labelLineSpace*l*r)}))}}},nodeCanvasObjectMode:function(){return"after"},linkDirectionalParticles:j.particles?j.particlesNumber:void 0,linkDirectionalArrowLength:j.arrows?j.arrowsLength:void 0,linkDirectionalArrowRelPos:j.arrowsPos,linkDirectionalArrowColor:j.arrowsColor?function(){return be(j.arrowsColor)}:void 0,linkColor:function(e){var n,t="object"===typeof e.source?e.source.id:e.source,r="object"===typeof e.target?e.target.id:e.target,i=zn(e,K.current),o=zn(e,je.current),l=i||o,s=e;return j.refLinkColor&&"ref"===s.type?l&&(j.refLinkHighlightColor||j.linkHighlight)?me[j.refLinkColor][j.refLinkHighlightColor||j.linkHighlight](se):me[j.refLinkColor][j.backgroundColor](j.highlightFade*se):j.citeLinkColor&&null!==(n=s.type)&&void 0!==n&&n.includes("cite")?l&&(j.citeLinkHighlightColor||j.linkHighlight)?me[j.citeLinkColor][j.citeLinkHighlightColor||j.linkHighlight](se):me[j.citeLinkColor][j.backgroundColor](j.highlightFade*se):function(e,n,t){if(!j.linkHighlight&&!j.linkColorScheme&&!t){var r=Ce(e,n);return be(r)}if(!t&&!j.linkColorScheme){var i=Ce(e,n);return me[i][j.backgroundColor](j.highlightFade*se)}if(!t)return me[j.linkColorScheme][j.backgroundColor](j.highlightFade*se);if(!j.linkHighlight&&!j.linkColorScheme){var o=Ce(e,n);return be(o)}return j.linkHighlight?j.linkColorScheme?me[j.linkColorScheme][j.linkHighlight](se):me[Ce(e,n)][j.linkHighlight](se):be(j.linkColorScheme)}(t,r,l)},linkWidth:function(e){if(1===j.highlightLinkSize)return j.linkWidth;var n=zn(e,K.current),t=zn(e,je.current);return n||t?j.linkWidth*(1+se*(j.highlightLinkSize-1)):j.linkWidth},linkDirectionalParticleWidth:j.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e;Q.onClose();var r=n.timeStamp-oe.current<200;if(oe.current=n.timeStamp,r)return G("double",t,n);var i=oe.current;return setTimeout((function(){if(oe.current===i)return G("click",t,n)}),200)},onBackgroundClick:function(){Q.onClose(),N(null),0!==v.nodeIds.length&&y((function(e){return kn(kn({},e),{},{nodeIds:[]})}))},onNodeHover:function(e){j.highlight&&(D||(xe(),ae(0)),N(e))},onNodeRightClick:function(e,n){G("right",e,n)},onNodeDrag:function(e){Q.onClose(),N(e),Le(!0)},onNodeDragEnd:function(){N(null),Le(!1)}};return(0,l.jsxs)(z.xu,{overflow:"hidden",children:[Q.isOpen&&(0,l.jsx)(jn,{scope:v,node:T,nodeType:null===T||void 0===T?void 0:T.id,background:!1,coordinates:A,handleLocal:q,menuClose:Q.onClose.bind(Q),webSocket:C,setPreviewNode:k}),d?(0,l.jsx)(Pn,kn(kn({ref:n},Ne),{},{nodeThreeObjectExtend:!0,backgroundColor:X.colors.white,nodeOpacity:j.nodeOpacity,nodeResolution:j.nodeResolution,linkOpacity:j.linkOpacity,nodeThreeObject:function(e){if(j.labels&&(!(j.labels<3)||ie[e.id])){var n=new bn.Z(e.title.substring(0,40));return n.color=be(j.labelTextColor),n.backgroundColor=be(j.labelBackgroundColor),n.padding=2,n.textHeight=8,n}}})):(0,l.jsx)(Sn,kn(kn({ref:n},Ne),{},{linkLineDash:function(e){var n,t=e;return j.citeDashes&&null!==(n=t.type)&&void 0!==n&&n.includes("cite")?[j.citeDashLength,j.citeGapLength]:j.refDashes&&"ref"==t.type?[j.refDashLength,j.refGapLength]:null}}))]})}));function zn(e,n){var t,r;return(null===(t=e.source)||void 0===t?void 0:t.id)===(null===n||void 0===n?void 0:n.id)||(null===(r=e.target)||void 0===r?void 0:r.id)===(null===n||void 0===n?void 0:n.id)}function Nn(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function En(e,n){return"rgba("+(e=e.replace("#","")).match(new RegExp("(.{"+e.length/3+"})","g")).map((function(n){return parseInt(e.length%2?n+n:n,16)})).concat(isFinite(n)?n:1).join(",")+")"}},45301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(78922)}])}},function(e){e.O(0,[774,737,573,446,750,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]);