From b76e55754ff054d0b2610a0afc6cac2a9b1b3b0e Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Mon, 18 Oct 2021 01:35:01 +0200 Subject: fix: delete tag from preview pane (#123) --- components/TagMenu.tsx | 22 ++++++++++++++++++++++ out/404.html | 2 +- .../static/IBnt2m6vmdq_HhrE0Ic3m/_buildManifest.js | 1 - .../static/IBnt2m6vmdq_HhrE0Ic3m/_ssgManifest.js | 1 - .../static/VY0dQoySCz7wWs6LY1lTH/_buildManifest.js | 1 + .../static/VY0dQoySCz7wWs6LY1lTH/_ssgManifest.js | 1 + .../chunks/pages/index-54993912d1bcf641f181.js | 1 - .../chunks/pages/index-b72098bce98ef7c492d5.js | 1 + out/index.html | 2 +- 9 files changed, 27 insertions(+), 5 deletions(-) delete mode 100644 out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_buildManifest.js delete mode 100644 out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_ssgManifest.js create mode 100644 out/_next/static/VY0dQoySCz7wWs6LY1lTH/_buildManifest.js create mode 100644 out/_next/static/VY0dQoySCz7wWs6LY1lTH/_ssgManifest.js delete mode 100644 out/_next/static/chunks/pages/index-54993912d1bcf641f181.js create mode 100644 out/_next/static/chunks/pages/index-b72098bce98ef7c492d5.js diff --git a/components/TagMenu.tsx b/components/TagMenu.tsx index 432e9a2..2a72e67 100644 --- a/components/TagMenu.tsx +++ b/components/TagMenu.tsx @@ -51,6 +51,28 @@ export const TagMenu = (props: TagMenuProps) => { + + + setTagColors((curr: { [tag: string]: string }) => + Object.fromEntries( + Object.keys(curr) + .filter((t) => t !== target) + .map((t) => [t, curr[t]]), + ), + ) + } + bgColor={''} + m={1} + borderRadius="sm" + borderColor="gray.600" + borderWidth={1} + height={3} + width={3} + > + {colorList.map((color: string) => ( 404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_buildManifest.js b/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_buildManifest.js deleted file mode 100644 index 983ebcf..0000000 --- a/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/fb7d5399-b53d39280eb7028fd5fb.js","static/chunks/0c428ae2-753f1ebbec24c403674c.js","static/chunks/1a48c3c1-8e9d488ce132c4739e94.js","static/chunks/b5f2ed29-c14b12daa385c4cc7854.js","static/chunks/d25bd147-2c59edc357c0e2372258.js","static/css/9aeb688eb5e47ce218d8.css","static/chunks/1-7660d8a6342f3745cbfd.js","static/chunks/pages/index-54993912d1bcf641f181.js"],"/_error":["static/chunks/pages/_error-ea939aab753d9e9db3bd.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_ssgManifest.js b/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_ssgManifest.js deleted file mode 100644 index 0511aa8..0000000 --- a/out/_next/static/IBnt2m6vmdq_HhrE0Ic3m/_ssgManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_buildManifest.js b/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_buildManifest.js new file mode 100644 index 0000000..f2516e5 --- /dev/null +++ b/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/fb7d5399-b53d39280eb7028fd5fb.js","static/chunks/0c428ae2-753f1ebbec24c403674c.js","static/chunks/1a48c3c1-8e9d488ce132c4739e94.js","static/chunks/b5f2ed29-c14b12daa385c4cc7854.js","static/chunks/d25bd147-2c59edc357c0e2372258.js","static/css/9aeb688eb5e47ce218d8.css","static/chunks/1-7660d8a6342f3745cbfd.js","static/chunks/pages/index-b72098bce98ef7c492d5.js"],"/_error":["static/chunks/pages/_error-ea939aab753d9e9db3bd.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_ssgManifest.js b/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_ssgManifest.js new file mode 100644 index 0000000..0511aa8 --- /dev/null +++ b/out/_next/static/VY0dQoySCz7wWs6LY1lTH/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/chunks/pages/index-54993912d1bcf641f181.js b/out/_next/static/chunks/pages/index-54993912d1bcf641f181.js deleted file mode 100644 index 2c0f3e4..0000000 --- a/out/_next/static/chunks/pages/index-54993912d1bcf641f181.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{86441:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return Jt},GraphPage:function(){return Gt},default:function(){return qt},getThemeColor:function(){return $t},hexToRGBA:function(){return Yt},normalizeLinkEnds:function(){return Kt}});var r=t(15861),i=t(42982),o=t(4942),l=t(70885),s=t(87757),c=t.n(s),a=t(40980),u=t(74860),d=t(95869),h=t(48017),g=t(94096),f=t(96699),p=t(48420),x=t(57775),j=t(54309),b=t(52596),v=t(9008),m=t(67294),y=t(32802),C=t.n(y),O=t(47516),w=t(63750),k=t(22003),S=t(31122),P=t(7520),N=t(36194),I=[],D={};for(var z in N.oY)for(var L in N.oY[z]){var E=z+L;"LinearNone"===E&&(E="Linear"),I.push(E),D[E]=N.oY[z][L]}var R=D,Z={enabled:!0,charge:-700,collision:!0,collisionStrength:20,centering:!0,centeringStrength:.2,linkStrength:.3,linkIts:1,alphaDecay:.05,alphaTarget:0,alphaMin:0,velocityDecay:.25,gravity:.3,gravityOn:!0,gravityLocal:!1},T={orphans:!1,dailies:!1,parent:"heading",filelessCites:!1,tagsBlacklist:[],tagsWhitelist:[],bad:!0,nodes:[],links:[],date:[],noter:!0},B={method:"degree"},F={particles:!1,particlesNumber:0,particlesWidth:4,arrows:!1,arrowsLength:1,arrowsPos:.5,arrowsColor:"",linkOpacity:.8,linkWidth:1,nodeRel:3,nodeOpacity:1,nodeResolution:12,labels:2,labelScale:1.5,labelFontSize:10,labelLength:40,labelWordWrap:25,labelLineSpace:1,labelDynamicDegree:8,labelDynamicStrength:.5,highlight:!0,highlightNodeSize:1.1,highlightLinkSize:.7,highlightFade:.8,highlightAnim:!0,animationSpeed:360,algorithmOptions:I,algorithmName:"CircularOut",linkColorScheme:"gray.500",nodeColorScheme:["red.500","gray.600","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","orange.500"],nodeHighlight:"purple.500",linkHighlight:"purple.500",backgroundColor:"white",emacsNodeColor:"gray.800",labelTextColor:"black",labelBackgroundColor:"",labelBackgroundOpacity:.7,citeDashes:!0,citeDashLength:35,citeGapLength:15,citeLinkColor:"gray.700",citeLinkHighlightColor:"",citeNodeColor:"black",refDashes:!0,refDashLength:35,refGapLength:15,refLinkColor:"gray.700",refLinkHighlightColor:"",refNodeColor:"black",nodeSizeLinks:.5,nodeZoomSize:1.2},H={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},A={highlight:"hover",local:"double",follow:"never",context:"right",preview:"click",backgroundExitsLocal:!1},M={neighbors:1},W=["red.500","orange.500","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","white","gray.100","gray.200","gray.300","gray.400","gray.500","gray.600","gray.700","gray.800","gray.900","black"],V=t(11252),X=t(336),_=t(85675),U=t(72026),q=t(64115),G=t(49364),J=t(94030),Q=t(85305),K=t(46617),$=t(50862),Y=t(68928),ee=t(55830),ne=t(2827);function te(e,n,t){t.send(JSON.stringify({command:e,data:n}))}function re(e,n){te("open",{id:e.id},n)}var ie=t(77787),oe=t(45987),le=t(80658),se=t(38554),ce=t.n(se),ae=t(84461),ue=t(73808),de=t(53869),he=t(39629);function ge(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 fe(e){for(var n=1;n0},Oe={exit:{size:{duration:.2,ease:pe.ease},opacity:{duration:.3,ease:pe.ease}},enter:{size:{duration:.3,ease:pe.ease},opacity:{duration:.4,ease:pe.ease}}},we={exit:function(e){var n,t,r=e.animateOpacity,i=e.startingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return ye(ye({},r&&{opacity:Ce(i)?1:0}),{},(t={overflow:"hidden"},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.exit),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.exit)&&void 0!==n?n:je(Oe.exit,c)),t))},enter:function(e){var n,t,r=e.animateOpacity,i=e.endingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return ye(ye({},r&&{opacity:1}),{},(t={},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.enter),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.enter)&&void 0!==n?n:xe(Oe.enter,c)),t))}},ke=m.forwardRef((function(e,n){var t=e.in,r=e.unmountOnExit,i=e.animateOpacity,o=void 0===i||i,s=e.startingSize,c=void 0===s?0:s,a=e.endingSize,u=void 0===a?"auto":a,d=e.dimension,h=void 0===d?"height":d,g=e.style,f=e.className,p=e.transition,x=e.transitionEnd,j=(0,oe.Z)(e,ve),b=m.useState(!1),v=(0,l.Z)(b,2),y=v[0],C=v[1];m.useEffect((function(){var e=setTimeout((function(){C(!0)}));return function(){return clearTimeout(e)}}),[]),(0,le.ZK)({condition:Boolean(c>0&&r),message:"startingSize and unmountOnExit are mutually exclusive. You can't use them together"});var O=parseFloat(c.toString())>0,w={startingSize:c,endingSize:u,animateOpacity:o,dimension:h,transition:y?p:{enter:{duration:0}},transitionEnd:ce()(x,{enter:{overflow:"initial"},exit:r?void 0:{display:O?"block":"none"}})},k=!r||t,S=t||r?"enter":"exit";return(0,be.jsx)(de.M,{initial:!1,custom:w,children:k&&(0,be.jsx)(he.E.div,ye(ye({ref:n},j),{},{className:(0,ae.cx)("chakra-collapse",f),style:ye({overflow:"hidden",display:"block"},g),custom:w,variants:we,initial:!!r&&"exit",animate:S,exit:"exit"}))})}));function Se(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 Pe(e){for(var n=1;n-1,f=a.indexOf(s)>-1,p=(0,u.q)();return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.sN,{icon:(0,be.jsx)(h.xu,{bgColor:l[s],borderRadius:"sm",height:3,width:3,borderColor:l[s]||"gray.600",borderWidth:1}),closeOnSelect:!1,onClick:p.onToggle,children:(0,be.jsx)(q.x,{children:"Change color"})}),(0,be.jsx)(ke,{in:p.isOpen,children:(0,be.jsx)(g.k,{ml:2,mt:2,flexWrap:"wrap",children:W.map((function(e){return(0,be.jsx)(h.xu,{children:(0,be.jsx)(h.xu,{tabIndex:0,cursor:"pointer",onClick:function(){return n(Pe(Pe({},l),{},(0,o.Z)({},s,e)))},bgColor:e,m:1,borderRadius:"sm",height:3,width:3})},e)}))})}),!f&&(0,be.jsx)(V.sN,{onClick:function(){t(d?function(e){return Pe(Pe({},e),{},{tagsBlacklist:e.tagsBlacklist.filter((function(e){return e!==s}))})}:function(e){return Pe(Pe({},e),{},{tagsBlacklist:[].concat((0,i.Z)(e.tagsBlacklist),[s])})})},icon:d?(0,be.jsx)(Q.V,{}):(0,be.jsx)(ie.t,{}),children:d?"Remove from blacklist":"Add to blacklist"}),!d&&(0,be.jsx)(V.sN,{onClick:function(){t(f?function(e){return Pe(Pe({},e),{},{tagsWhitelist:e.tagsWhitelist.filter((function(e){return e!==s}))})}:function(e){return Pe(Pe({},e),{},{tagsWhitelist:[].concat((0,i.Z)(e.tagsWhitelist),[s])})})},icon:f?(0,be.jsx)(Q.V,{}):(0,be.jsx)(ee.O,{}),children:f?"Remove from whitelist":"Add to whitelist"})]})},Ie=function(e){e.background;var n,t,r=e.target,i=(e.nodeType,e.coordinates),o=e.handleLocal,l=e.menuClose,s=e.scope,c=e.webSocket,a=e.setPreviewNode,d=e.setTagColors,h=e.tagColors,g=e.setFilter,f=e.filter,p=(0,u.q)(),x=p.isOpen,j=p.onOpen,b=p.onClose;(0,m.useRef)();return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.v2,{defaultIsOpen:!0,closeOnBlur:!1,onClose:function(){return l()},children:(0,be.jsx)(V.qy,{zIndex:"overlay",bgColor:"white",color:"black",position:"absolute",left:i.left,top:i.top,right:i.right,bottom:i.bottom,fontSize:"xs",boxShadow:"xl",children:"string"!==typeof r?(0,be.jsxs)(be.Fragment,{children:[r&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(X.X,{size:"xs",isTruncated:!0,px:3,py:1,children:r.title}),(0,be.jsx)(V.R,{borderColor:"gray.500"})]}),0!==s.nodeIds.length&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.sN,{onClick:function(){return o(r,"add")},icon:(0,be.jsx)(J.I,{}),children:"Expand local graph at node"}),(0,be.jsx)(V.sN,{onClick:function(){return o(r,"replace")},icon:(0,be.jsx)(O.DvO,{}),children:"Open local graph for this node"}),(0,be.jsx)(V.sN,{onClick:function(){return o(r,"remove")},icon:(0,be.jsx)(Q.V,{}),children:"Exclude node from local graph"})]}),null!==r&&void 0!==r&&null!==(n=r.properties)&&void 0!==n&&n.FILELESS?(0,be.jsx)(V.sN,{icon:(0,be.jsx)($.d,{}),onClick:function(){return function(e,n){te("create",{id:e.id,title:e.title,ref:e.properties.ROAM_REFS},n)}(r,c)},children:"Create node"}):(0,be.jsx)(V.sN,{icon:(0,be.jsx)(K.d,{}),onClick:function(){return re(r,c)},children:"Open in Emacs"}),(null===r||void 0===r||null===(t=r.properties)||void 0===t?void 0:t.ROAM_REFS)&&(0,be.jsx)(V.sN,{icon:(0,be.jsx)(Y.h,{}),children:"Open in Zotero"}),0===s.nodeIds.length&&(0,be.jsx)(V.sN,{icon:(0,be.jsx)(O.DvO,{}),onClick:function(){return o(r,"replace")},children:"Open local graph"}),(0,be.jsx)(V.sN,{icon:(0,be.jsx)(ee.O,{}),onClick:function(){a(r)},children:"Preview"}),0===(null===r||void 0===r?void 0:r.level)&&(0,be.jsx)(V.sN,{closeOnSelect:!1,icon:(0,be.jsx)(ne.p,{color:"red.500"}),color:"red.500",onClick:j,children:"Permenantly delete note"})]}):(0,be.jsx)(Ne,{target:r,tagColors:h,filter:f,setTagColors:d,setFilter:g})})}),"string"!==typeof r&&(0,be.jsxs)(_.u_,{isCentered:!0,isOpen:x,onClose:b,children:[(0,be.jsx)(_.ZA,{}),(0,be.jsxs)(_.hz,{zIndex:"popover",children:[(0,be.jsx)(_.xB,{children:"Delete node?"}),(0,be.jsx)(_.ol,{}),(0,be.jsx)(_.fe,{children:(0,be.jsxs)(U.gC,{spacing:4,display:"flex",alignItems:"flex-start",children:[(0,be.jsx)(q.x,{children:"This will permanently delete your note:"}),(0,be.jsx)(q.x,{fontWeight:"bold",children:null===r||void 0===r?void 0:r.title}),0!==(null===r||void 0===r?void 0:r.level)&&(0,be.jsx)(q.x,{children:"This will only delete the from this heading until but not including the next node. Your parent file and all other nodes will not be deleted."}),(0,be.jsx)(q.x,{children:"Are you sure you want to do continue?"})]})}),(0,be.jsxs)(_.mz,{children:[(0,be.jsx)(G.z,{mr:3,onClick:function(){console.log("closing"),b(),l()},children:"Cancel"}),(0,be.jsx)(G.z,{variant:"link",colorScheme:"red",ml:3,onClick:function(){console.log("aaaaa"),function(e,n){0===e.level&&te("delete",{id:e.id,file:e.file},n)}(r,c),b(),l()},children:"Delete node"})]})]})]})]})},De=t(67101),ze=t(35255),Le=t(56884),Ee=function(e){var n=e.setJustification,t=(e.setIndent,e.setFont,e.justification),r=(e.setPreviewNode,e.canUndo),i=e.canRedo,o=(e.resetPreviewNode,e.previousPreviewNode),l=e.nextPreviewNode;return(0,be.jsxs)(g.k,{flex:"0 1 40px",pb:3,alignItems:"center",justifyContent:"space-between",pl:1,pr:1,children:[(0,be.jsx)(g.k,{children:(0,be.jsxs)(De.h,{isAttached:!0,children:[(0,be.jsx)(f.u,{label:"Go backward",children:(0,be.jsx)(p.h,{variant:"subtle",icon:(0,be.jsx)(ze.w,{}),"aria-label":"Previous node",disabled:!r,onClick:function(){return o()}})}),(0,be.jsx)(f.u,{label:"Go forward",children:(0,be.jsx)(p.h,{variant:"subtle",icon:(0,be.jsx)(Le.X,{}),"aria-label":"Next node",disabled:!i,onClick:function(){return l()}})})]})}),(0,be.jsx)(g.k,{children:(0,be.jsx)(f.u,{label:"Justify content",children:(0,be.jsx)(p.h,{variant:"subtle","aria-label":"Justify content",icon:[(0,be.jsx)(O.v9V,{},"justify"),(0,be.jsx)(O.YSr,{},"left"),(0,be.jsx)(O.RXA,{},"right"),(0,be.jsx)(O.tr_,{},"center")][t],onClick:function(){return n((function(e){return(e+1)%4}))}})})})]})},Re=t(35528);function Ze(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 Te(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:{},i=Nn(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)?Sn(Sn({},n),o):l;s!==o&&i.update(s);var c=(0,m.useState)(s),a=c[0],u=c[1];(0,m.useEffect)((function(){a!==s&&u(s)}),[e]);var d=function(e){e instanceof Function?u((function(n){var t=e(n);return i.update(t),t})):(u(e),i.update(e))};return[a,d]}function Nn(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 In=["style"];function Dn(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 zn(e){for(var n=1;n1,animateOpacity:!0,children:[(0,be.jsx)(h.xu,{paddingTop:2,children:(0,be.jsx)(Qn,{label:"Label Appearance Scale",value:2*n.labelScale,onChange:function(e){return t(yt(yt({},n),{},{labelScale:e/2}))}})}),(0,be.jsxs)(h.xu,{paddingTop:2,children:[(0,be.jsx)(Qn,{label:"Label dynamicity",infoText:"By default, labels of nodes with more links will appear earlier than those with fewer. This slider changes the strength of this effect, put it at zero to disable it.",value:n.labelDynamicStrength,min:0,max:1,step:.05,onChange:function(e){return t((function(n){return yt(yt({},n),{},{labelDynamicStrength:e})}))}}),(0,be.jsx)(et.U,{in:n.labelDynamicStrength>0,children:(0,be.jsx)(Qn,{label:"Dynamic zoom degree cap",infoText:"By default, labels of nodes with more links will appear earlier than those with fewer. This slider changes the strength of this effect, put it at zero to disable it.",value:n.labelDynamicDegree,min:1,max:15,step:1,onChange:function(e){return t((function(n){return yt(yt({},n),{},{labelDynamicDegree:e})}))}})})]})]}),(0,be.jsx)(gt,{colorList:W,label:"Text",setVisuals:t,value:"labelTextColor",visValue:n.labelTextColor}),(0,be.jsxs)(h.xu,{children:[(0,be.jsx)(gt,{colorList:W,label:"Background",setVisuals:t,value:"labelBackgroundColor",visValue:n.labelBackgroundColor}),(0,be.jsx)(et.U,{in:!!n.labelBackgroundColor,animateOpacity:!0,children:(0,be.jsx)(h.xu,{paddingTop:2,children:(0,be.jsx)(Qn,{label:"Background opacity",value:n.labelBackgroundOpacity,onChange:function(e){console.log(n.labelBackgroundOpacity),t(yt(yt({},n),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})})]}),(0,be.jsx)(Qn,{label:"Label font size",value:n.labelFontSize,min:5,max:20,step:.5,onChange:function(e){return t(yt(yt({},n),{},{labelFontSize:e}))}}),(0,be.jsx)(Qn,{label:"Max. label characters",value:n.labelLength,min:10,max:100,step:1,onChange:function(e){return t(yt(yt({},n),{},{labelLength:e}))}}),(0,be.jsx)(Qn,{label:"Max. label line length",value:n.labelWordWrap,min:10,max:100,step:1,onChange:function(e){return t(yt(yt({},n),{},{labelWordWrap:e}))}}),(0,be.jsx)(Qn,{label:"Space between label lines",value:n.labelLineSpace,min:.2,max:3,step:.1,onChange:function(e){return t(yt(yt({},n),{},{labelLineSpace:e}))}})]})};function Ot(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 wt(e){for(var n=1;ng.labelLength?[].concat((0,i.Z)(L.slice(0,-1)),["".concat(L.slice(-1),"...")]):L,R=[v,m].includes(c.id)?1+.3*f:1;E.forEach((function(e,n){a.fillText(e,c.x,c.y+R*S*8+g.labelLineSpace*P*n)}))}}}function Wt(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 Vt(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:2e3,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var l=Be.current,s=We.current,c=Ve.current,a=null!==(t=Re.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,i.Z)(a.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));if("zoom"===e)return s.nodeIds.length&&y({nodeIds:[],excludedNodeIds:[]}),void setTimeout((function(){return l.zoomToFit(r,o,(function(e){return u[e.id]}))}),50);if(!s.nodeIds.length)return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if("add"!==c.localSame)return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if(!s.nodeIds.includes(n)||!s.nodeIds.some((function(e){return u[e]})))return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);y((function(e){return Vt(Vt({},e),{},{nodeIds:[].concat((0,i.Z)(e.nodeIds),[n])})})),setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50)}};(0,m.useEffect)((function(){Xe.current=new k.Z("ws://localhost:35903"),Xe.current.addEventListener("open",(function(){console.log("Connection with Emacs established")})),Xe.current.addEventListener("message",(function(e){var n=Ve.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t,r,s=Ee.current;Te.current=null!==(n=e.tags)&&void 0!==n?n:[];var c=null!==(t=e.nodes)&&void 0!==t?t:[],a=null!==(r=e.links)&&void 0!==r?r:[],u=c.reduce((function(e,n){var t;return Vt(Vt({},e),{},(0,o.Z)({},n.file,[].concat((0,i.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"}})):[]}));Ee.current=Object.fromEntries(c.map((function(e){return[e.id,e]})));var g=[].concat((0,i.Z)(a),(0,i.Z)(d),(0,i.Z)(h)),f=[],p=g.map((function(e){var n=e.source,t=e.target;return Ee.current[n]?Ee.current[t]?e:(f.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0,pos:0,olp:null}),Vt(Vt({},e),{},{type:"bad"})):(f.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0,pos:0,olp:null}),Vt(Vt({},e),{},{type:"bad"}))}));Ee.current=Vt(Vt({},Ee.current),Object.fromEntries(f.map((function(e){return[e.id,e]})))),Re.current=p.reduce((function(e,n){var t,r,l;return Vt(Vt({},e),{},(l={},(0,o.Z)(l,n.source,[].concat((0,i.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,o.Z)(l,n.target,[].concat((0,i.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),l))}),{});var x=[].concat((0,i.Z)(c),f);Ze.current=x.reduce((function(e,n){var t,r=null===(t=n.properties)||void 0===t?void 0:t.ROAM_REFS;if(null===r||void 0===r||!r.includes("cite"))return e;var i=r.replaceAll(/cite:(.*)/g,"$1");return i?Vt(Vt({},e),{},(0,o.Z)({},i,n)):e}),{});var j={nodes:x,links:p},b=Ae.current;if(0===b.nodes.length){var v=JSON.parse(JSON.stringify(j));return Ae.current=v,void q(v)}var m=[].concat((0,i.Z)(b.nodes.flatMap((function(e){var n,t=null!==(n=Ee.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;return t?[Vt(Vt({},e),t)]:[]}))),(0,i.Z)(Object.keys(Ee.current).filter((function(e){return!s[e]})).map((function(e){return Ee.current[e]})))),y=m.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return Vt(Vt({},e),{},(0,o.Z)({},r,t))}),{}),C=p.map((function(e){var n=Kt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return Vt(Vt({},e),{},{source:m[y[r]],target:m[y[i]]})}));q({nodes:m,links:C})}(t.data);case"variables":return console.log(t.data),void(Fe.current=t.data);case"theme":return Me(["custom",t.data]);case"command":switch(t.data.commandName){case"local":var r=Y.zoomSpeed,s=Y.zoomPadding;_e("local",t.data.id,r,s),Q(t.data.id);break;case"zoom":var c,a,u=(null===t||void 0===t||null===(c=t.data)||void 0===c?void 0:c.speed)||n.zoomSpeed,d=(null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.padding)||n.zoomPadding;_e("zoom",t.data.id,u,d),Q(t.data.id);break;case"follow":_e(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),Q(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),(0,m.useEffect)((function(){var e=Be.current;!e||v.nodeIds.length>1||(v.nodeIds.length||!N.gravityOn?setTimeout((function(){e.zoomToFit(5,200)}),50):e.zoomToFit())}),[v.nodeIds]);var Ue=(0,j.iP)(),qe=(0,l.Z)(Ue,2),Ge=qe[0],Je=qe[1],Qe=(0,m.useRef)(),Ke=(0,m.useState)(null),$e=Ke[0],Ye=Ke[1],en=(0,m.useState)({left:0,top:0,right:void 0,bottom:void 0}),nn=en[0],tn=en[1],on=(0,u.q)();(0,d.O)({ref:Qe,handler:function(){on.onClose()}});var ln=function(e,n,t){tn(t||{left:n.pageX,top:n.pageY,right:void 0,bottom:void 0}),Ye(e),on.onOpen()},sn=function(e,n){"remove"!==n?"replace"!==n?v.nodeIds.includes(e.id)||y((function(n){return Vt(Vt({},n),{},{nodeIds:[].concat((0,i.Z)(n.nodeIds),[e.id])})})):y({nodeIds:[e.id],excludedNodeIds:[]}):y((function(n){return Vt(Vt({},n),{},{excludedNodeIds:[].concat((0,i.Z)(n.excludedNodeIds),[e.id])})}))},cn=(0,m.useState)({type:"Graph",title:"Graph",icon:(0,be.jsx)(O.DvO,{})}),an=(cn[0],cn[1],Pn("mainWindowWidth",Ge)),un=(0,l.Z)(an,2),dn=un[0],hn=un[1];return(0,be.jsxs)(h.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100vh",overflow:"clip",children:[(0,be.jsx)(Ft,{physics:N,setPhysics:I,threeDim:t,setThreeDim:r,filter:L,setFilter:E,visuals:V,setVisuals:X,mouse:re,setMouse:ie,behavior:Y,setBehavior:ee,tagColors:a,setTagColors:x,coloring:se,setColoring:ce,local:de,setLocal:he,tags:Te.current}),(0,be.jsx)(h.xu,{position:"absolute",children:U&&(0,be.jsx)(Jt,{nodeById:Ee.current,linksByNodeId:Re.current,webSocket:Xe.current,variables:Fe.current,physics:N,graphData:U,threeDim:t,emacsNodeId:J,filter:L,visuals:V,behavior:Y,mouse:re,scope:v,setScope:y,tagColors:a,setPreviewNode:je,sidebarHighlightedNode:Se,windowWidth:Ge,windowHeight:Je,openContextMenu:ln,contextMenu:on,handleLocal:sn,mainWindowWidth:dn,setMainWindowWidth:hn,setContextMenuTarget:Ye,graphRef:Be,clusterRef:He,coloring:se,local:de})}),(0,be.jsx)(h.xu,{position:"relative",zIndex:4,width:"100%",children:(0,be.jsx)(g.k,{className:"headerBar",h:10,flexDir:"column",children:(0,be.jsx)(g.k,{alignItems:"center",h:10,justifyContent:"flex-end",children:(0,be.jsxs)(g.k,{height:"100%",flexDirection:"row",children:[v.nodeIds.length>0&&(0,be.jsx)(f.u,{label:"Return to main graph",children:(0,be.jsx)(p.h,{m:1,icon:(0,be.jsx)(O.DvO,{}),"aria-label":"Exit local mode",onClick:function(){return y((function(e){return Vt(Vt({},e),{},{nodeIds:[]})}))},variant:"subtle"})}),(0,be.jsx)(f.u,{label:De?"Close sidebar":"Open sidebar",children:(0,be.jsx)(p.h,{m:1,icon:(0,be.jsx)(w.iBV,{}),"aria-label":"Close file-viewer",variant:"subtle",onClick:De?Le:ze})})]})})})}),(0,be.jsx)(h.xu,{position:"relative",zIndex:4,children:(0,be.jsx)(Ln,{isOpen:De,onOpen:ze,onClose:Le,previewNode:we,setPreviewNode:je,canUndo:Ce,canRedo:Oe,previousPreviewNode:me,nextPreviewNode:ye,resetPreviewNode:ve,setSidebarHighlightedNode:Pe,openContextMenu:ln,scope:v,setScope:y,windowWidth:Ge,tagColors:a,setTagColors:x,filter:L,setFilter:E,nodeById:Ee.current,linksByNodeId:Re.current,nodeByCite:Ze.current})}),on.isOpen&&(0,be.jsx)("div",{ref:Qe,children:(0,be.jsx)(Ie,{scope:v,target:$e,background:!1,coordinates:nn,handleLocal:sn,menuClose:on.onClose.bind(on),webSocket:Xe.current,setPreviewNode:je,setFilter:E,filter:L,setTagColors:x,tagColors:a})})]})}var Jt=function(e){var n=e.graphRef,t=e.physics,s=e.graphData,u=e.threeDim,d=e.linksByNodeId,g=e.filter,f=e.emacsNodeId,p=e.nodeById,j=e.visuals,v=e.behavior,y=e.mouse,O=e.scope,w=e.local,k=(e.setScope,e.webSocket),P=e.tagColors,N=e.setPreviewNode,I=e.sidebarHighlightedNode,D=e.windowWidth,z=e.windowHeight,L=(e.setContextMenuTarget,e.openContextMenu),E=e.contextMenu,Z=e.handleLocal,T=e.variables,B=e.clusterRef,F=e.coloring,H=T.dailyDir,A=(T.roamDir,(0,m.useState)(null)),M=A[0],V=A[1],X=(0,a.useTheme)(),_=(0,m.useContext)(rn.N).emacsTheme,U=function(e,n,t){switch(e){case y.preview:N(n);break;case y.local:Z(n,v.localSame);break;case y.follow:re(n,k);break;case y.context:L(n,t)}},q=(0,m.useRef)(null);(0,m.useEffect)((function(){f&&V(p[f])}),[f]);var G=(0,m.useRef)({}),J=(0,m.useRef)({}),Q=(0,m.useMemo)((function(){var e;J.current={};var n=null===s||void 0===s||null===(e=s.nodes)||void 0===e?void 0:e.filter((function(e){var n,t,r,i,l=e;return g.tagsBlacklist.length&&g.tagsBlacklist.some((function(e){var n;return(null===l||void 0===l||null===(n=l.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.tagsWhitelist.length>0&&!g.tagsWhitelist.some((function(e){var n;return(null===l||void 0===l||null===(n=l.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.filelessCites&&null!==l&&void 0!==l&&null!==(n=l.properties)&&void 0!==n&&n.FILELESS||null!==g&&void 0!==g&&g.bad&&null!==l&&void 0!==l&&null!==(t=l.properties)&&void 0!==t&&t.bad||g.dailies&&H&&null!==(r=l.file)&&void 0!==r&&r.includes(H)?(J.current=Vt(Vt({},J.current),{},(0,o.Z)({},l.id,l)),!1):!g.noter||null===(i=l.properties)||void 0===i||!i.NOTER_PAGE||(J.current=Vt(Vt({},J.current),{},(0,o.Z)({},l.id,l)),!1)})).filter((function(e){var n,t=(null!==(n=d[null===e||void 0===e?void 0:e.id])&&void 0!==n?n:[]).filter((function(e){return!J.current[e.source]&&!J.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})),r=s.links.filter((function(e){var n=Kt(e),r=(0,l.Z)(n,2),i=r[0],o=r[1];if(!t.includes(i)||!t.includes(o))return!1;var s=e;return g.parent?"heading"===g.parent?"parent"!==s.type:"heading"!==s.type:!["parent","heading"].includes(s.type)}));G.current=r.reduce((function(e,n){var t,r,s,c=n,a=Kt(c),u=(0,l.Z)(a,2),d=u[0],h=u[1];return Vt(Vt({},e),{},(s={},(0,o.Z)(s,d,[].concat((0,i.Z)(null!==(t=e[d])&&void 0!==t?t:[]),[c])),(0,o.Z)(s,h,[].concat((0,i.Z)(null!==(r=e[h])&&void 0!==r?r:[]),[c])),s))}),{});var c=r.map((function(e){var n=Kt(e),t=(0,l.Z)(n,2);return{target:t[0],source:t[1],weight:"cite"===e.type?1:2}}));if("community"===F.method){var a=C()().nodes(t).edges(c);B.current=a()}return{nodes:n,links:r}}),[g,s,F.method]),K=(0,m.useState)({nodes:[],links:[]}),$=K[0],Y=K[1];(0,m.useEffect)((function(){if(O.nodeIds.length){var e=O.nodeIds.length>1?$.nodes.filter((function(e){return!O.excludedNodeIds.includes(e.id)})):[],n=e.map((function(e){return e.id})),t=function(e,n,t){var r=[e[0]],i=[],o=[e[0]];return Array.from({length:t},(function(){r.forEach((function(e){var t;(null!==(t=G.current[e])&&void 0!==t?t:[]).forEach((function(e){var t=Kt(e),r=(0,l.Z)(t,2),s=r[0],c=r[1];n.some((function(e){return[s,c].includes(e)}))||(o.includes(s)?o.includes(c)||i.push(c):i.push(s))}))})),r=i,i.forEach((function(e){return e&&o.push(e)})),i=[]})),o}(O.nodeIds,O.excludedNodeIds,w.neighbors),r=Q.nodes.filter((function(r){var i;return e.length?!n.includes(r.id)&&(null!==(i=G.current[r.id])&&void 0!==i?i:[]).some((function(e){var n=Kt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return O.nodeIds.includes(r)||O.nodeIds.includes(i)})):t.includes(r.id)})).map((function(e){return Vt(Vt({},e),{},{x:0,y:0,vy:0,vx:0})})),o=[].concat((0,i.Z)(e),(0,i.Z)(r)),s=o.map((function(e){return e.id})),c=(O.nodeIds.length>1?$.links:[]).filter((function(e){O.excludedNodeIds.some((function(n){return Kt(e).includes(n)}))})),a=Q.links.filter((function(e){var t=Kt(e),r=(0,l.Z)(t,2),i=r[0],o=r[1];return!(c.length&&n.includes(o)&&n.includes(i))&&(s.includes(i)&&s.includes(o))})).map((function(e){var n=Kt(e),t=(0,l.Z)(n,2);return{source:t[0],target:t[1]}})),u=[].concat((0,i.Z)(c),(0,i.Z)(a));Y({nodes:o,links:u})}}),[w.neighbors,g,JSON.stringify(O),JSON.stringify(s),Q.links,Q.nodes]),(0,m.useEffect)((function(){(0,r.Z)(c().mark((function e(){var r,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,Xt;case 3:i=e.sent,!t.gravityOn||O.nodeIds.length&&!t.gravityLocal?(r.d3Force("x",null),r.d3Force("y",null),u&&r.d3Force("z",null)):(r.d3Force("x",i.forceX().strength(t.gravity)),r.d3Force("y",i.forceY().strength(t.gravity)),u&&r.d3Force("z",i.forceZ().strength(t.gravity))),t.centering?r.d3Force("center",i.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?i.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()}),[t,u,O]),(0,m.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t,O.nodeIds.length]);var ee=(0,m.useRef)(0),ne=(0,m.useState)(1),te=ne[0],ie=ne[1],oe=(0,x._7)((function(e){return ie(e)}),{duration:j.animationSpeed,algorithm:R[j.algorithmName]}),le=(0,l.Z)(oe,2),se=le[0],ce=le[1],ae=(0,x._7)((function(e){return ie(Math.min(te,-1*(e-1)))}),{duration:j.animationSpeed,algorithm:R[j.algorithmName]}),ue=(0,l.Z)(ae,2),de=ue[0],he=ue[1],ge=(0,m.useMemo)((function(){var e;if(!q.current)return{};var n=G.current[q.current.id];return n?Object.fromEntries([null===(e=q.current)||void 0===e?void 0:e.id].concat((0,i.Z)(n.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[JSON.stringify(q.current),JSON.stringify(G.current)]);(0,m.useEffect)((function(){null!==I&&void 0!==I&&I.id?V(I):V(null)}),[I]);var fe=(0,m.useRef)(null);(0,m.useEffect)((function(){if(q.current=M,M&&(fe.current=M),!j.highlightAnim)return ie(M?1:0);M?se():(ce(),te>.5?de():ie(0))}),[M]);var pe=(0,m.useMemo)((function(){return Object.fromEntries(W.map((function(e){var n=$t(e,X),t=W.map((function(e){return[e,b.Z(n,$t(e,X))]}));return[e,Object.fromEntries(t)]})))}),[_]),xe=(0,m.useMemo)((function(){var e,n,t,r=null!==(e=G.current[null===(n=fe.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=fe.current)||void 0===t?void 0:t.id].concat((0,i.Z)(r.flatMap((function(e){return Kt(e)})))).map((function(e){return[e,{}]})))}),[JSON.stringify(M),fe.current,G.current]),je=function(e){var n,t,r,i,o,l=null!==(n=null===(t=G.current[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0;return"degree"===F.method?j.nodeColorScheme[(r=l,i=0,o=j.nodeColorScheme.length-1,Math.min(Math.max(r,i),o))]:j.nodeColorScheme[l&&B.current[e]%j.nodeColorScheme.length]},ve=function(e,n){return G.current[e].length>G.current[n].length?je(e):je(n)},me=(0,m.useMemo)((function(){return $t(j.labelTextColor,X)}),[j.labelTextColor,_]),ye=(0,m.useMemo)((function(){return $t(j.labelBackgroundColor,X)}),[j.labelBackgroundColor,_]),Ce=function(e){var n,t=null!==(n=G.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*(ge[e.id]||xe[e.id]?1+te*(j.highlightNodeSize-1):1)},Oe=(0,m.useState)(!1),we=Oe[0],ke=Oe[1],Se=(0,m.useRef)(1),Pe={graphData:O.nodeIds.length?$:Q,width:D,height:z,backgroundColor:$t(j.backgroundColor,X),warmupTicks:1===O.nodeIds.length?100:O.nodeIds.length>1?20:0,onZoom:function(e){var n=e.k;e.x,e.y;return Se.current=n},nodeColor:function(e){return function(e,n){var t,r,i=ge[e.id]||xe[e.id];if(j.emacsNodeColor&&e.id===f)return $t(j.emacsNodeColor,n);if(P&&null!==e&&void 0!==e&&e.tags.some((function(e){return P[e]}))){var o=P[null===e||void 0===e?void 0:e.tags.filter((function(e){return P[e]}))[0]];return i?pe[o][o](j.highlightFade*te):pe[o][j.backgroundColor](j.highlightFade*te)}return j.citeNodeColor&&null!==e&&void 0!==e&&null!==(t=e.properties)&&void 0!==t&&t.ROAM_REFS&&null!==e&&void 0!==e&&null!==(r=e.properties)&&void 0!==r&&r.FILELESS?i?$t(j.citeNodeColor,n):pe[j.citeNodeColor][j.backgroundColor](j.highlightFade*te):j.refNodeColor&&e.properties.ROAM_REFS?i?$t(j.refNodeColor,n):pe[j.refNodeColor][j.backgroundColor](j.highlightFade*te):i?j.nodeHighlight?pe[je(e.id)][j.nodeHighlight](te):$t(je(e.id),n):pe[je(e.id)][j.backgroundColor](j.highlightFade*te)}(e,X)},nodeRelSize:j.nodeRel,nodeVal:function(e){return Ce(e)/Math.pow(Se.current,j.nodeZoomSize)},nodeCanvasObject:function(e,n,t){Mt(Vt({nodeRel:j.nodeRel,filteredLinksByNodeId:G.current,lastHoverNode:fe.current},{node:e,ctx:n,globalScale:t,highlightedNodes:ge,previouslyHighlightedNodes:xe,visuals:j,opacity:te,nodeSize:Ce,labelTextColor:me,labelBackgroundColor:ye,hoverNode:M}))},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 $t(j.arrowsColor,X)}: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=Qt(e,q.current),o=Qt(e,fe.current),l=i||o,s=e;return j.refLinkColor&&"ref"===s.type?l&&(j.refLinkHighlightColor||j.linkHighlight)?pe[j.refLinkColor][j.refLinkHighlightColor||j.linkHighlight](te):pe[j.refLinkColor][j.backgroundColor](j.highlightFade*te):j.citeLinkColor&&null!==(n=s.type)&&void 0!==n&&n.includes("cite")?l&&(j.citeLinkHighlightColor||j.linkHighlight)?pe[j.citeLinkColor][j.citeLinkHighlightColor||j.linkHighlight](te):pe[j.citeLinkColor][j.backgroundColor](j.highlightFade*te):function(e,n,t,r){if(!j.linkHighlight&&!j.linkColorScheme&&!t)return $t(ve(e,n),r);if(!t&&!j.linkColorScheme){var i=ve(e,n);return pe[i][j.backgroundColor](j.highlightFade*te)}return t?j.linkHighlight||j.linkColorScheme?j.linkHighlight?j.linkColorScheme?pe[j.linkColorScheme][j.linkHighlight](te):pe[ve(e,n)][j.linkHighlight](te):$t(j.linkColorScheme,r):$t(ve(e,n),r):pe[j.linkColorScheme][j.backgroundColor](j.highlightFade*te)}(t,r,l,X)},linkWidth:function(e){if(1===j.highlightLinkSize)return j.linkWidth;var n=Qt(e,q.current),t=Qt(e,fe.current);return n||t?j.linkWidth*(1+te*(j.highlightLinkSize-1)):j.linkWidth},linkDirectionalParticleWidth:j.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e,r=n.timeStamp-ee.current<200;if(ee.current=n.timeStamp,r)return U("double",t,n);var i=ee.current;return setTimeout((function(){if(ee.current===i)return U("click",t,n)}),200)},onNodeHover:function(e){j.highlight&&(we||(M||(he(),ie(0)),V(e)))},onNodeRightClick:function(e,n){U("right",e,n)},onNodeDrag:function(e){V(e),ke(!0)},onNodeDragEnd:function(){V(null),ke(!1)}};return(0,be.jsx)(h.xu,{overflow:"hidden",onClick:E.onClose,children:u?(0,be.jsx)(Ut,Vt(Vt({ref:n},Pe),{},{nodeThreeObjectExtend:!0,nodeOpacity:j.nodeOpacity,nodeResolution:j.nodeResolution,linkOpacity:j.linkOpacity,nodeThreeObject:function(e){if(j.labels&&(!(j.labels<3)||ge[e.id])){var n=new S.Z(e.title.substring(0,40));return n.color=$t(j.labelTextColor,X),n.backgroundColor=$t(j.labelBackgroundColor,X),n.padding=2,n.textHeight=8,n}}})):(0,be.jsx)(_t,Vt(Vt({ref:n},Pe),{},{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 Qt(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 Kt(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function $t(e,n){return e.split(".").reduce((function(e,n){return e[n]}),n.colors)}function Yt(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(86441)}])}},function(e){e.O(0,[774,737,13,874,573,446,1,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]); \ No newline at end of file diff --git a/out/_next/static/chunks/pages/index-b72098bce98ef7c492d5.js b/out/_next/static/chunks/pages/index-b72098bce98ef7c492d5.js new file mode 100644 index 0000000..8139024 --- /dev/null +++ b/out/_next/static/chunks/pages/index-b72098bce98ef7c492d5.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{86441:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return Jt},GraphPage:function(){return Gt},default:function(){return qt},getThemeColor:function(){return $t},hexToRGBA:function(){return Yt},normalizeLinkEnds:function(){return Kt}});var r=t(15861),i=t(42982),o=t(4942),l=t(70885),s=t(87757),c=t.n(s),a=t(40980),u=t(74860),d=t(95869),h=t(48017),g=t(94096),f=t(96699),p=t(48420),x=t(57775),j=t(54309),b=t(52596),v=t(9008),m=t(67294),y=t(32802),C=t.n(y),O=t(47516),w=t(63750),k=t(22003),S=t(31122),P=t(7520),N=t(36194),I=[],D={};for(var z in N.oY)for(var L in N.oY[z]){var E=z+L;"LinearNone"===E&&(E="Linear"),I.push(E),D[E]=N.oY[z][L]}var R=D,Z={enabled:!0,charge:-700,collision:!0,collisionStrength:20,centering:!0,centeringStrength:.2,linkStrength:.3,linkIts:1,alphaDecay:.05,alphaTarget:0,alphaMin:0,velocityDecay:.25,gravity:.3,gravityOn:!0,gravityLocal:!1},T={orphans:!1,dailies:!1,parent:"heading",filelessCites:!1,tagsBlacklist:[],tagsWhitelist:[],bad:!0,nodes:[],links:[],date:[],noter:!0},B={method:"degree"},F={particles:!1,particlesNumber:0,particlesWidth:4,arrows:!1,arrowsLength:1,arrowsPos:.5,arrowsColor:"",linkOpacity:.8,linkWidth:1,nodeRel:3,nodeOpacity:1,nodeResolution:12,labels:2,labelScale:1.5,labelFontSize:10,labelLength:40,labelWordWrap:25,labelLineSpace:1,labelDynamicDegree:8,labelDynamicStrength:.5,highlight:!0,highlightNodeSize:1.1,highlightLinkSize:.7,highlightFade:.8,highlightAnim:!0,animationSpeed:360,algorithmOptions:I,algorithmName:"CircularOut",linkColorScheme:"gray.500",nodeColorScheme:["red.500","gray.600","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","orange.500"],nodeHighlight:"purple.500",linkHighlight:"purple.500",backgroundColor:"white",emacsNodeColor:"gray.800",labelTextColor:"black",labelBackgroundColor:"",labelBackgroundOpacity:.7,citeDashes:!0,citeDashLength:35,citeGapLength:15,citeLinkColor:"gray.700",citeLinkHighlightColor:"",citeNodeColor:"black",refDashes:!0,refDashLength:35,refGapLength:15,refLinkColor:"gray.700",refLinkHighlightColor:"",refNodeColor:"black",nodeSizeLinks:.5,nodeZoomSize:1.2},H={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},A={highlight:"hover",local:"double",follow:"never",context:"right",preview:"click",backgroundExitsLocal:!1},M={neighbors:1},W=["red.500","orange.500","yellow.500","green.500","cyan.500","blue.500","pink.500","purple.500","white","gray.100","gray.200","gray.300","gray.400","gray.500","gray.600","gray.700","gray.800","gray.900","black"],V=t(11252),X=t(336),_=t(85675),U=t(72026),q=t(64115),G=t(49364),J=t(94030),Q=t(85305),K=t(46617),$=t(50862),Y=t(68928),ee=t(55830),ne=t(2827);function te(e,n,t){t.send(JSON.stringify({command:e,data:n}))}function re(e,n){te("open",{id:e.id},n)}var ie=t(77787),oe=t(45987),le=t(80658),se=t(38554),ce=t.n(se),ae=t(84461),ue=t(73808),de=t(53869),he=t(39629);function ge(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 fe(e){for(var n=1;n0},Oe={exit:{size:{duration:.2,ease:pe.ease},opacity:{duration:.3,ease:pe.ease}},enter:{size:{duration:.3,ease:pe.ease},opacity:{duration:.4,ease:pe.ease}}},we={exit:function(e){var n,t,r=e.animateOpacity,i=e.startingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return ye(ye({},r&&{opacity:Ce(i)?1:0}),{},(t={overflow:"hidden"},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.exit),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.exit)&&void 0!==n?n:je(Oe.exit,c)),t))},enter:function(e){var n,t,r=e.animateOpacity,i=e.endingSize,l=e.transition,s=e.transitionEnd,c=e.delay,a=e.dimension;return ye(ye({},r&&{opacity:1}),{},(t={},(0,o.Z)(t,a,i),(0,o.Z)(t,"transitionEnd",null===s||void 0===s?void 0:s.enter),(0,o.Z)(t,"transition",null!==(n=null===l||void 0===l?void 0:l.enter)&&void 0!==n?n:xe(Oe.enter,c)),t))}},ke=m.forwardRef((function(e,n){var t=e.in,r=e.unmountOnExit,i=e.animateOpacity,o=void 0===i||i,s=e.startingSize,c=void 0===s?0:s,a=e.endingSize,u=void 0===a?"auto":a,d=e.dimension,h=void 0===d?"height":d,g=e.style,f=e.className,p=e.transition,x=e.transitionEnd,j=(0,oe.Z)(e,ve),b=m.useState(!1),v=(0,l.Z)(b,2),y=v[0],C=v[1];m.useEffect((function(){var e=setTimeout((function(){C(!0)}));return function(){return clearTimeout(e)}}),[]),(0,le.ZK)({condition:Boolean(c>0&&r),message:"startingSize and unmountOnExit are mutually exclusive. You can't use them together"});var O=parseFloat(c.toString())>0,w={startingSize:c,endingSize:u,animateOpacity:o,dimension:h,transition:y?p:{enter:{duration:0}},transitionEnd:ce()(x,{enter:{overflow:"initial"},exit:r?void 0:{display:O?"block":"none"}})},k=!r||t,S=t||r?"enter":"exit";return(0,be.jsx)(de.M,{initial:!1,custom:w,children:k&&(0,be.jsx)(he.E.div,ye(ye({ref:n},j),{},{className:(0,ae.cx)("chakra-collapse",f),style:ye({overflow:"hidden",display:"block"},g),custom:w,variants:we,initial:!!r&&"exit",animate:S,exit:"exit"}))})}));function Se(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 Pe(e){for(var n=1;n-1,f=a.indexOf(s)>-1,p=(0,u.q)();return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.sN,{icon:(0,be.jsx)(h.xu,{bgColor:l[s],borderRadius:"sm",height:3,width:3,borderColor:l[s]||"gray.600",borderWidth:1}),closeOnSelect:!1,onClick:p.onToggle,children:(0,be.jsx)(q.x,{children:"Change color"})}),(0,be.jsx)(ke,{in:p.isOpen,children:(0,be.jsxs)(g.k,{ml:2,mt:2,flexWrap:"wrap",children:[(0,be.jsx)(h.xu,{children:(0,be.jsx)(h.xu,{tabIndex:0,cursor:"pointer",onClick:function(){return n((function(e){return Object.fromEntries(Object.keys(e).filter((function(e){return e!==s})).map((function(n){return[n,e[n]]})))}))},bgColor:"",m:1,borderRadius:"sm",borderColor:"gray.600",borderWidth:1,height:3,width:3})},"empty"),W.map((function(e){return(0,be.jsx)(h.xu,{children:(0,be.jsx)(h.xu,{tabIndex:0,cursor:"pointer",onClick:function(){return n(Pe(Pe({},l),{},(0,o.Z)({},s,e)))},bgColor:e,m:1,borderRadius:"sm",height:3,width:3})},e)}))]})}),!f&&(0,be.jsx)(V.sN,{onClick:function(){t(d?function(e){return Pe(Pe({},e),{},{tagsBlacklist:e.tagsBlacklist.filter((function(e){return e!==s}))})}:function(e){return Pe(Pe({},e),{},{tagsBlacklist:[].concat((0,i.Z)(e.tagsBlacklist),[s])})})},icon:d?(0,be.jsx)(Q.V,{}):(0,be.jsx)(ie.t,{}),children:d?"Remove from blacklist":"Add to blacklist"}),!d&&(0,be.jsx)(V.sN,{onClick:function(){t(f?function(e){return Pe(Pe({},e),{},{tagsWhitelist:e.tagsWhitelist.filter((function(e){return e!==s}))})}:function(e){return Pe(Pe({},e),{},{tagsWhitelist:[].concat((0,i.Z)(e.tagsWhitelist),[s])})})},icon:f?(0,be.jsx)(Q.V,{}):(0,be.jsx)(ee.O,{}),children:f?"Remove from whitelist":"Add to whitelist"})]})},Ie=function(e){e.background;var n,t,r=e.target,i=(e.nodeType,e.coordinates),o=e.handleLocal,l=e.menuClose,s=e.scope,c=e.webSocket,a=e.setPreviewNode,d=e.setTagColors,h=e.tagColors,g=e.setFilter,f=e.filter,p=(0,u.q)(),x=p.isOpen,j=p.onOpen,b=p.onClose;(0,m.useRef)();return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.v2,{defaultIsOpen:!0,closeOnBlur:!1,onClose:function(){return l()},children:(0,be.jsx)(V.qy,{zIndex:"overlay",bgColor:"white",color:"black",position:"absolute",left:i.left,top:i.top,right:i.right,bottom:i.bottom,fontSize:"xs",boxShadow:"xl",children:"string"!==typeof r?(0,be.jsxs)(be.Fragment,{children:[r&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(X.X,{size:"xs",isTruncated:!0,px:3,py:1,children:r.title}),(0,be.jsx)(V.R,{borderColor:"gray.500"})]}),0!==s.nodeIds.length&&(0,be.jsxs)(be.Fragment,{children:[(0,be.jsx)(V.sN,{onClick:function(){return o(r,"add")},icon:(0,be.jsx)(J.I,{}),children:"Expand local graph at node"}),(0,be.jsx)(V.sN,{onClick:function(){return o(r,"replace")},icon:(0,be.jsx)(O.DvO,{}),children:"Open local graph for this node"}),(0,be.jsx)(V.sN,{onClick:function(){return o(r,"remove")},icon:(0,be.jsx)(Q.V,{}),children:"Exclude node from local graph"})]}),null!==r&&void 0!==r&&null!==(n=r.properties)&&void 0!==n&&n.FILELESS?(0,be.jsx)(V.sN,{icon:(0,be.jsx)($.d,{}),onClick:function(){return function(e,n){te("create",{id:e.id,title:e.title,ref:e.properties.ROAM_REFS},n)}(r,c)},children:"Create node"}):(0,be.jsx)(V.sN,{icon:(0,be.jsx)(K.d,{}),onClick:function(){return re(r,c)},children:"Open in Emacs"}),(null===r||void 0===r||null===(t=r.properties)||void 0===t?void 0:t.ROAM_REFS)&&(0,be.jsx)(V.sN,{icon:(0,be.jsx)(Y.h,{}),children:"Open in Zotero"}),0===s.nodeIds.length&&(0,be.jsx)(V.sN,{icon:(0,be.jsx)(O.DvO,{}),onClick:function(){return o(r,"replace")},children:"Open local graph"}),(0,be.jsx)(V.sN,{icon:(0,be.jsx)(ee.O,{}),onClick:function(){a(r)},children:"Preview"}),0===(null===r||void 0===r?void 0:r.level)&&(0,be.jsx)(V.sN,{closeOnSelect:!1,icon:(0,be.jsx)(ne.p,{color:"red.500"}),color:"red.500",onClick:j,children:"Permenantly delete note"})]}):(0,be.jsx)(Ne,{target:r,tagColors:h,filter:f,setTagColors:d,setFilter:g})})}),"string"!==typeof r&&(0,be.jsxs)(_.u_,{isCentered:!0,isOpen:x,onClose:b,children:[(0,be.jsx)(_.ZA,{}),(0,be.jsxs)(_.hz,{zIndex:"popover",children:[(0,be.jsx)(_.xB,{children:"Delete node?"}),(0,be.jsx)(_.ol,{}),(0,be.jsx)(_.fe,{children:(0,be.jsxs)(U.gC,{spacing:4,display:"flex",alignItems:"flex-start",children:[(0,be.jsx)(q.x,{children:"This will permanently delete your note:"}),(0,be.jsx)(q.x,{fontWeight:"bold",children:null===r||void 0===r?void 0:r.title}),0!==(null===r||void 0===r?void 0:r.level)&&(0,be.jsx)(q.x,{children:"This will only delete the from this heading until but not including the next node. Your parent file and all other nodes will not be deleted."}),(0,be.jsx)(q.x,{children:"Are you sure you want to do continue?"})]})}),(0,be.jsxs)(_.mz,{children:[(0,be.jsx)(G.z,{mr:3,onClick:function(){console.log("closing"),b(),l()},children:"Cancel"}),(0,be.jsx)(G.z,{variant:"link",colorScheme:"red",ml:3,onClick:function(){console.log("aaaaa"),function(e,n){0===e.level&&te("delete",{id:e.id,file:e.file},n)}(r,c),b(),l()},children:"Delete node"})]})]})]})]})},De=t(67101),ze=t(35255),Le=t(56884),Ee=function(e){var n=e.setJustification,t=(e.setIndent,e.setFont,e.justification),r=(e.setPreviewNode,e.canUndo),i=e.canRedo,o=(e.resetPreviewNode,e.previousPreviewNode),l=e.nextPreviewNode;return(0,be.jsxs)(g.k,{flex:"0 1 40px",pb:3,alignItems:"center",justifyContent:"space-between",pl:1,pr:1,children:[(0,be.jsx)(g.k,{children:(0,be.jsxs)(De.h,{isAttached:!0,children:[(0,be.jsx)(f.u,{label:"Go backward",children:(0,be.jsx)(p.h,{variant:"subtle",icon:(0,be.jsx)(ze.w,{}),"aria-label":"Previous node",disabled:!r,onClick:function(){return o()}})}),(0,be.jsx)(f.u,{label:"Go forward",children:(0,be.jsx)(p.h,{variant:"subtle",icon:(0,be.jsx)(Le.X,{}),"aria-label":"Next node",disabled:!i,onClick:function(){return l()}})})]})}),(0,be.jsx)(g.k,{children:(0,be.jsx)(f.u,{label:"Justify content",children:(0,be.jsx)(p.h,{variant:"subtle","aria-label":"Justify content",icon:[(0,be.jsx)(O.v9V,{},"justify"),(0,be.jsx)(O.YSr,{},"left"),(0,be.jsx)(O.RXA,{},"right"),(0,be.jsx)(O.tr_,{},"center")][t],onClick:function(){return n((function(e){return(e+1)%4}))}})})})]})},Re=t(35528);function Ze(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 Te(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:{},i=Nn(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)?Sn(Sn({},n),o):l;s!==o&&i.update(s);var c=(0,m.useState)(s),a=c[0],u=c[1];(0,m.useEffect)((function(){a!==s&&u(s)}),[e]);var d=function(e){e instanceof Function?u((function(n){var t=e(n);return i.update(t),t})):(u(e),i.update(e))};return[a,d]}function Nn(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 In=["style"];function Dn(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 zn(e){for(var n=1;n1,animateOpacity:!0,children:[(0,be.jsx)(h.xu,{paddingTop:2,children:(0,be.jsx)(Qn,{label:"Label Appearance Scale",value:2*n.labelScale,onChange:function(e){return t(yt(yt({},n),{},{labelScale:e/2}))}})}),(0,be.jsxs)(h.xu,{paddingTop:2,children:[(0,be.jsx)(Qn,{label:"Label dynamicity",infoText:"By default, labels of nodes with more links will appear earlier than those with fewer. This slider changes the strength of this effect, put it at zero to disable it.",value:n.labelDynamicStrength,min:0,max:1,step:.05,onChange:function(e){return t((function(n){return yt(yt({},n),{},{labelDynamicStrength:e})}))}}),(0,be.jsx)(et.U,{in:n.labelDynamicStrength>0,children:(0,be.jsx)(Qn,{label:"Dynamic zoom degree cap",infoText:"By default, labels of nodes with more links will appear earlier than those with fewer. This slider changes the strength of this effect, put it at zero to disable it.",value:n.labelDynamicDegree,min:1,max:15,step:1,onChange:function(e){return t((function(n){return yt(yt({},n),{},{labelDynamicDegree:e})}))}})})]})]}),(0,be.jsx)(gt,{colorList:W,label:"Text",setVisuals:t,value:"labelTextColor",visValue:n.labelTextColor}),(0,be.jsxs)(h.xu,{children:[(0,be.jsx)(gt,{colorList:W,label:"Background",setVisuals:t,value:"labelBackgroundColor",visValue:n.labelBackgroundColor}),(0,be.jsx)(et.U,{in:!!n.labelBackgroundColor,animateOpacity:!0,children:(0,be.jsx)(h.xu,{paddingTop:2,children:(0,be.jsx)(Qn,{label:"Background opacity",value:n.labelBackgroundOpacity,onChange:function(e){console.log(n.labelBackgroundOpacity),t(yt(yt({},n),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})})]}),(0,be.jsx)(Qn,{label:"Label font size",value:n.labelFontSize,min:5,max:20,step:.5,onChange:function(e){return t(yt(yt({},n),{},{labelFontSize:e}))}}),(0,be.jsx)(Qn,{label:"Max. label characters",value:n.labelLength,min:10,max:100,step:1,onChange:function(e){return t(yt(yt({},n),{},{labelLength:e}))}}),(0,be.jsx)(Qn,{label:"Max. label line length",value:n.labelWordWrap,min:10,max:100,step:1,onChange:function(e){return t(yt(yt({},n),{},{labelWordWrap:e}))}}),(0,be.jsx)(Qn,{label:"Space between label lines",value:n.labelLineSpace,min:.2,max:3,step:.1,onChange:function(e){return t(yt(yt({},n),{},{labelLineSpace:e}))}})]})};function Ot(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 wt(e){for(var n=1;ng.labelLength?[].concat((0,i.Z)(L.slice(0,-1)),["".concat(L.slice(-1),"...")]):L,R=[v,m].includes(c.id)?1+.3*f:1;E.forEach((function(e,n){a.fillText(e,c.x,c.y+R*S*8+g.labelLineSpace*P*n)}))}}}function Wt(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 Vt(e){for(var n=1;n2&&void 0!==arguments[2]?arguments[2]:2e3,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var l=Be.current,s=We.current,c=Ve.current,a=null!==(t=Re.current[n])&&void 0!==t?t:[],u=Object.fromEntries([n].concat((0,i.Z)(a.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})));if("zoom"===e)return s.nodeIds.length&&y({nodeIds:[],excludedNodeIds:[]}),void setTimeout((function(){return l.zoomToFit(r,o,(function(e){return u[e.id]}))}),50);if(!s.nodeIds.length)return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if("add"!==c.localSame)return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);if(!s.nodeIds.includes(n)||!s.nodeIds.some((function(e){return u[e]})))return y((function(e){return Vt(Vt({},e),{},{nodeIds:[n]})})),void setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50);y((function(e){return Vt(Vt({},e),{},{nodeIds:[].concat((0,i.Z)(e.nodeIds),[n])})})),setTimeout((function(){l.centerAt(0,0,10),l.zoomToFit(1,o)}),50)}};(0,m.useEffect)((function(){Xe.current=new k.Z("ws://localhost:35903"),Xe.current.addEventListener("open",(function(){console.log("Connection with Emacs established")})),Xe.current.addEventListener("message",(function(e){var n=Ve.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t,r,s=Ee.current;Te.current=null!==(n=e.tags)&&void 0!==n?n:[];var c=null!==(t=e.nodes)&&void 0!==t?t:[],a=null!==(r=e.links)&&void 0!==r?r:[],u=c.reduce((function(e,n){var t;return Vt(Vt({},e),{},(0,o.Z)({},n.file,[].concat((0,i.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"}})):[]}));Ee.current=Object.fromEntries(c.map((function(e){return[e.id,e]})));var g=[].concat((0,i.Z)(a),(0,i.Z)(d),(0,i.Z)(h)),f=[],p=g.map((function(e){var n=e.source,t=e.target;return Ee.current[n]?Ee.current[t]?e:(f.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0,pos:0,olp:null}),Vt(Vt({},e),{},{type:"bad"})):(f.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0,pos:0,olp:null}),Vt(Vt({},e),{},{type:"bad"}))}));Ee.current=Vt(Vt({},Ee.current),Object.fromEntries(f.map((function(e){return[e.id,e]})))),Re.current=p.reduce((function(e,n){var t,r,l;return Vt(Vt({},e),{},(l={},(0,o.Z)(l,n.source,[].concat((0,i.Z)(null!==(t=e[n.source])&&void 0!==t?t:[]),[n])),(0,o.Z)(l,n.target,[].concat((0,i.Z)(null!==(r=e[n.target])&&void 0!==r?r:[]),[n])),l))}),{});var x=[].concat((0,i.Z)(c),f);Ze.current=x.reduce((function(e,n){var t,r=null===(t=n.properties)||void 0===t?void 0:t.ROAM_REFS;if(null===r||void 0===r||!r.includes("cite"))return e;var i=r.replaceAll(/cite:(.*)/g,"$1");return i?Vt(Vt({},e),{},(0,o.Z)({},i,n)):e}),{});var j={nodes:x,links:p},b=Ae.current;if(0===b.nodes.length){var v=JSON.parse(JSON.stringify(j));return Ae.current=v,void q(v)}var m=[].concat((0,i.Z)(b.nodes.flatMap((function(e){var n,t=null!==(n=Ee.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;return t?[Vt(Vt({},e),t)]:[]}))),(0,i.Z)(Object.keys(Ee.current).filter((function(e){return!s[e]})).map((function(e){return Ee.current[e]})))),y=m.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return Vt(Vt({},e),{},(0,o.Z)({},r,t))}),{}),C=p.map((function(e){var n=Kt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return Vt(Vt({},e),{},{source:m[y[r]],target:m[y[i]]})}));q({nodes:m,links:C})}(t.data);case"variables":return console.log(t.data),void(Fe.current=t.data);case"theme":return Me(["custom",t.data]);case"command":switch(t.data.commandName){case"local":var r=Y.zoomSpeed,s=Y.zoomPadding;_e("local",t.data.id,r,s),Q(t.data.id);break;case"zoom":var c,a,u=(null===t||void 0===t||null===(c=t.data)||void 0===c?void 0:c.speed)||n.zoomSpeed,d=(null===t||void 0===t||null===(a=t.data)||void 0===a?void 0:a.padding)||n.zoomPadding;_e("zoom",t.data.id,u,d),Q(t.data.id);break;case"follow":_e(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),Q(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),(0,m.useEffect)((function(){var e=Be.current;!e||v.nodeIds.length>1||(v.nodeIds.length||!N.gravityOn?setTimeout((function(){e.zoomToFit(5,200)}),50):e.zoomToFit())}),[v.nodeIds]);var Ue=(0,j.iP)(),qe=(0,l.Z)(Ue,2),Ge=qe[0],Je=qe[1],Qe=(0,m.useRef)(),Ke=(0,m.useState)(null),$e=Ke[0],Ye=Ke[1],en=(0,m.useState)({left:0,top:0,right:void 0,bottom:void 0}),nn=en[0],tn=en[1],on=(0,u.q)();(0,d.O)({ref:Qe,handler:function(){on.onClose()}});var ln=function(e,n,t){tn(t||{left:n.pageX,top:n.pageY,right:void 0,bottom:void 0}),Ye(e),on.onOpen()},sn=function(e,n){"remove"!==n?"replace"!==n?v.nodeIds.includes(e.id)||y((function(n){return Vt(Vt({},n),{},{nodeIds:[].concat((0,i.Z)(n.nodeIds),[e.id])})})):y({nodeIds:[e.id],excludedNodeIds:[]}):y((function(n){return Vt(Vt({},n),{},{excludedNodeIds:[].concat((0,i.Z)(n.excludedNodeIds),[e.id])})}))},cn=(0,m.useState)({type:"Graph",title:"Graph",icon:(0,be.jsx)(O.DvO,{})}),an=(cn[0],cn[1],Pn("mainWindowWidth",Ge)),un=(0,l.Z)(an,2),dn=un[0],hn=un[1];return(0,be.jsxs)(h.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100vh",overflow:"clip",children:[(0,be.jsx)(Ft,{physics:N,setPhysics:I,threeDim:t,setThreeDim:r,filter:L,setFilter:E,visuals:V,setVisuals:X,mouse:re,setMouse:ie,behavior:Y,setBehavior:ee,tagColors:a,setTagColors:x,coloring:se,setColoring:ce,local:de,setLocal:he,tags:Te.current}),(0,be.jsx)(h.xu,{position:"absolute",children:U&&(0,be.jsx)(Jt,{nodeById:Ee.current,linksByNodeId:Re.current,webSocket:Xe.current,variables:Fe.current,physics:N,graphData:U,threeDim:t,emacsNodeId:J,filter:L,visuals:V,behavior:Y,mouse:re,scope:v,setScope:y,tagColors:a,setPreviewNode:je,sidebarHighlightedNode:Se,windowWidth:Ge,windowHeight:Je,openContextMenu:ln,contextMenu:on,handleLocal:sn,mainWindowWidth:dn,setMainWindowWidth:hn,setContextMenuTarget:Ye,graphRef:Be,clusterRef:He,coloring:se,local:de})}),(0,be.jsx)(h.xu,{position:"relative",zIndex:4,width:"100%",children:(0,be.jsx)(g.k,{className:"headerBar",h:10,flexDir:"column",children:(0,be.jsx)(g.k,{alignItems:"center",h:10,justifyContent:"flex-end",children:(0,be.jsxs)(g.k,{height:"100%",flexDirection:"row",children:[v.nodeIds.length>0&&(0,be.jsx)(f.u,{label:"Return to main graph",children:(0,be.jsx)(p.h,{m:1,icon:(0,be.jsx)(O.DvO,{}),"aria-label":"Exit local mode",onClick:function(){return y((function(e){return Vt(Vt({},e),{},{nodeIds:[]})}))},variant:"subtle"})}),(0,be.jsx)(f.u,{label:De?"Close sidebar":"Open sidebar",children:(0,be.jsx)(p.h,{m:1,icon:(0,be.jsx)(w.iBV,{}),"aria-label":"Close file-viewer",variant:"subtle",onClick:De?Le:ze})})]})})})}),(0,be.jsx)(h.xu,{position:"relative",zIndex:4,children:(0,be.jsx)(Ln,{isOpen:De,onOpen:ze,onClose:Le,previewNode:we,setPreviewNode:je,canUndo:Ce,canRedo:Oe,previousPreviewNode:me,nextPreviewNode:ye,resetPreviewNode:ve,setSidebarHighlightedNode:Pe,openContextMenu:ln,scope:v,setScope:y,windowWidth:Ge,tagColors:a,setTagColors:x,filter:L,setFilter:E,nodeById:Ee.current,linksByNodeId:Re.current,nodeByCite:Ze.current})}),on.isOpen&&(0,be.jsx)("div",{ref:Qe,children:(0,be.jsx)(Ie,{scope:v,target:$e,background:!1,coordinates:nn,handleLocal:sn,menuClose:on.onClose.bind(on),webSocket:Xe.current,setPreviewNode:je,setFilter:E,filter:L,setTagColors:x,tagColors:a})})]})}var Jt=function(e){var n=e.graphRef,t=e.physics,s=e.graphData,u=e.threeDim,d=e.linksByNodeId,g=e.filter,f=e.emacsNodeId,p=e.nodeById,j=e.visuals,v=e.behavior,y=e.mouse,O=e.scope,w=e.local,k=(e.setScope,e.webSocket),P=e.tagColors,N=e.setPreviewNode,I=e.sidebarHighlightedNode,D=e.windowWidth,z=e.windowHeight,L=(e.setContextMenuTarget,e.openContextMenu),E=e.contextMenu,Z=e.handleLocal,T=e.variables,B=e.clusterRef,F=e.coloring,H=T.dailyDir,A=(T.roamDir,(0,m.useState)(null)),M=A[0],V=A[1],X=(0,a.useTheme)(),_=(0,m.useContext)(rn.N).emacsTheme,U=function(e,n,t){switch(e){case y.preview:N(n);break;case y.local:Z(n,v.localSame);break;case y.follow:re(n,k);break;case y.context:L(n,t)}},q=(0,m.useRef)(null);(0,m.useEffect)((function(){f&&V(p[f])}),[f]);var G=(0,m.useRef)({}),J=(0,m.useRef)({}),Q=(0,m.useMemo)((function(){var e;J.current={};var n=null===s||void 0===s||null===(e=s.nodes)||void 0===e?void 0:e.filter((function(e){var n,t,r,i,l=e;return g.tagsBlacklist.length&&g.tagsBlacklist.some((function(e){var n;return(null===l||void 0===l||null===(n=l.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.tagsWhitelist.length>0&&!g.tagsWhitelist.some((function(e){var n;return(null===l||void 0===l||null===(n=l.tags)||void 0===n?void 0:n.indexOf(e))>-1}))||g.filelessCites&&null!==l&&void 0!==l&&null!==(n=l.properties)&&void 0!==n&&n.FILELESS||null!==g&&void 0!==g&&g.bad&&null!==l&&void 0!==l&&null!==(t=l.properties)&&void 0!==t&&t.bad||g.dailies&&H&&null!==(r=l.file)&&void 0!==r&&r.includes(H)?(J.current=Vt(Vt({},J.current),{},(0,o.Z)({},l.id,l)),!1):!g.noter||null===(i=l.properties)||void 0===i||!i.NOTER_PAGE||(J.current=Vt(Vt({},J.current),{},(0,o.Z)({},l.id,l)),!1)})).filter((function(e){var n,t=(null!==(n=d[null===e||void 0===e?void 0:e.id])&&void 0!==n?n:[]).filter((function(e){return!J.current[e.source]&&!J.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})),r=s.links.filter((function(e){var n=Kt(e),r=(0,l.Z)(n,2),i=r[0],o=r[1];if(!t.includes(i)||!t.includes(o))return!1;var s=e;return g.parent?"heading"===g.parent?"parent"!==s.type:"heading"!==s.type:!["parent","heading"].includes(s.type)}));G.current=r.reduce((function(e,n){var t,r,s,c=n,a=Kt(c),u=(0,l.Z)(a,2),d=u[0],h=u[1];return Vt(Vt({},e),{},(s={},(0,o.Z)(s,d,[].concat((0,i.Z)(null!==(t=e[d])&&void 0!==t?t:[]),[c])),(0,o.Z)(s,h,[].concat((0,i.Z)(null!==(r=e[h])&&void 0!==r?r:[]),[c])),s))}),{});var c=r.map((function(e){var n=Kt(e),t=(0,l.Z)(n,2);return{target:t[0],source:t[1],weight:"cite"===e.type?1:2}}));if("community"===F.method){var a=C()().nodes(t).edges(c);B.current=a()}return{nodes:n,links:r}}),[g,s,F.method]),K=(0,m.useState)({nodes:[],links:[]}),$=K[0],Y=K[1];(0,m.useEffect)((function(){if(O.nodeIds.length){var e=O.nodeIds.length>1?$.nodes.filter((function(e){return!O.excludedNodeIds.includes(e.id)})):[],n=e.map((function(e){return e.id})),t=function(e,n,t){var r=[e[0]],i=[],o=[e[0]];return Array.from({length:t},(function(){r.forEach((function(e){var t;(null!==(t=G.current[e])&&void 0!==t?t:[]).forEach((function(e){var t=Kt(e),r=(0,l.Z)(t,2),s=r[0],c=r[1];n.some((function(e){return[s,c].includes(e)}))||(o.includes(s)?o.includes(c)||i.push(c):i.push(s))}))})),r=i,i.forEach((function(e){return e&&o.push(e)})),i=[]})),o}(O.nodeIds,O.excludedNodeIds,w.neighbors),r=Q.nodes.filter((function(r){var i;return e.length?!n.includes(r.id)&&(null!==(i=G.current[r.id])&&void 0!==i?i:[]).some((function(e){var n=Kt(e),t=(0,l.Z)(n,2),r=t[0],i=t[1];return O.nodeIds.includes(r)||O.nodeIds.includes(i)})):t.includes(r.id)})).map((function(e){return Vt(Vt({},e),{},{x:0,y:0,vy:0,vx:0})})),o=[].concat((0,i.Z)(e),(0,i.Z)(r)),s=o.map((function(e){return e.id})),c=(O.nodeIds.length>1?$.links:[]).filter((function(e){O.excludedNodeIds.some((function(n){return Kt(e).includes(n)}))})),a=Q.links.filter((function(e){var t=Kt(e),r=(0,l.Z)(t,2),i=r[0],o=r[1];return!(c.length&&n.includes(o)&&n.includes(i))&&(s.includes(i)&&s.includes(o))})).map((function(e){var n=Kt(e),t=(0,l.Z)(n,2);return{source:t[0],target:t[1]}})),u=[].concat((0,i.Z)(c),(0,i.Z)(a));Y({nodes:o,links:u})}}),[w.neighbors,g,JSON.stringify(O),JSON.stringify(s),Q.links,Q.nodes]),(0,m.useEffect)((function(){(0,r.Z)(c().mark((function e(){var r,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.current,e.next=3,Xt;case 3:i=e.sent,!t.gravityOn||O.nodeIds.length&&!t.gravityLocal?(r.d3Force("x",null),r.d3Force("y",null),u&&r.d3Force("z",null)):(r.d3Force("x",i.forceX().strength(t.gravity)),r.d3Force("y",i.forceY().strength(t.gravity)),u&&r.d3Force("z",i.forceZ().strength(t.gravity))),t.centering?r.d3Force("center",i.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?i.forceCollide().radius(t.collisionStrength):null);case 10:case"end":return e.stop()}}),e)})))()}),[t,u,O]),(0,m.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t,O.nodeIds.length]);var ee=(0,m.useRef)(0),ne=(0,m.useState)(1),te=ne[0],ie=ne[1],oe=(0,x._7)((function(e){return ie(e)}),{duration:j.animationSpeed,algorithm:R[j.algorithmName]}),le=(0,l.Z)(oe,2),se=le[0],ce=le[1],ae=(0,x._7)((function(e){return ie(Math.min(te,-1*(e-1)))}),{duration:j.animationSpeed,algorithm:R[j.algorithmName]}),ue=(0,l.Z)(ae,2),de=ue[0],he=ue[1],ge=(0,m.useMemo)((function(){var e;if(!q.current)return{};var n=G.current[q.current.id];return n?Object.fromEntries([null===(e=q.current)||void 0===e?void 0:e.id].concat((0,i.Z)(n.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[JSON.stringify(q.current),JSON.stringify(G.current)]);(0,m.useEffect)((function(){null!==I&&void 0!==I&&I.id?V(I):V(null)}),[I]);var fe=(0,m.useRef)(null);(0,m.useEffect)((function(){if(q.current=M,M&&(fe.current=M),!j.highlightAnim)return ie(M?1:0);M?se():(ce(),te>.5?de():ie(0))}),[M]);var pe=(0,m.useMemo)((function(){return Object.fromEntries(W.map((function(e){var n=$t(e,X),t=W.map((function(e){return[e,b.Z(n,$t(e,X))]}));return[e,Object.fromEntries(t)]})))}),[_]),xe=(0,m.useMemo)((function(){var e,n,t,r=null!==(e=G.current[null===(n=fe.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=fe.current)||void 0===t?void 0:t.id].concat((0,i.Z)(r.flatMap((function(e){return Kt(e)})))).map((function(e){return[e,{}]})))}),[JSON.stringify(M),fe.current,G.current]),je=function(e){var n,t,r,i,o,l=null!==(n=null===(t=G.current[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0;return"degree"===F.method?j.nodeColorScheme[(r=l,i=0,o=j.nodeColorScheme.length-1,Math.min(Math.max(r,i),o))]:j.nodeColorScheme[l&&B.current[e]%j.nodeColorScheme.length]},ve=function(e,n){return G.current[e].length>G.current[n].length?je(e):je(n)},me=(0,m.useMemo)((function(){return $t(j.labelTextColor,X)}),[j.labelTextColor,_]),ye=(0,m.useMemo)((function(){return $t(j.labelBackgroundColor,X)}),[j.labelBackgroundColor,_]),Ce=function(e){var n,t=null!==(n=G.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*(ge[e.id]||xe[e.id]?1+te*(j.highlightNodeSize-1):1)},Oe=(0,m.useState)(!1),we=Oe[0],ke=Oe[1],Se=(0,m.useRef)(1),Pe={graphData:O.nodeIds.length?$:Q,width:D,height:z,backgroundColor:$t(j.backgroundColor,X),warmupTicks:1===O.nodeIds.length?100:O.nodeIds.length>1?20:0,onZoom:function(e){var n=e.k;e.x,e.y;return Se.current=n},nodeColor:function(e){return function(e,n){var t,r,i=ge[e.id]||xe[e.id];if(j.emacsNodeColor&&e.id===f)return $t(j.emacsNodeColor,n);if(P&&null!==e&&void 0!==e&&e.tags.some((function(e){return P[e]}))){var o=P[null===e||void 0===e?void 0:e.tags.filter((function(e){return P[e]}))[0]];return i?pe[o][o](j.highlightFade*te):pe[o][j.backgroundColor](j.highlightFade*te)}return j.citeNodeColor&&null!==e&&void 0!==e&&null!==(t=e.properties)&&void 0!==t&&t.ROAM_REFS&&null!==e&&void 0!==e&&null!==(r=e.properties)&&void 0!==r&&r.FILELESS?i?$t(j.citeNodeColor,n):pe[j.citeNodeColor][j.backgroundColor](j.highlightFade*te):j.refNodeColor&&e.properties.ROAM_REFS?i?$t(j.refNodeColor,n):pe[j.refNodeColor][j.backgroundColor](j.highlightFade*te):i?j.nodeHighlight?pe[je(e.id)][j.nodeHighlight](te):$t(je(e.id),n):pe[je(e.id)][j.backgroundColor](j.highlightFade*te)}(e,X)},nodeRelSize:j.nodeRel,nodeVal:function(e){return Ce(e)/Math.pow(Se.current,j.nodeZoomSize)},nodeCanvasObject:function(e,n,t){Mt(Vt({nodeRel:j.nodeRel,filteredLinksByNodeId:G.current,lastHoverNode:fe.current},{node:e,ctx:n,globalScale:t,highlightedNodes:ge,previouslyHighlightedNodes:xe,visuals:j,opacity:te,nodeSize:Ce,labelTextColor:me,labelBackgroundColor:ye,hoverNode:M}))},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 $t(j.arrowsColor,X)}: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=Qt(e,q.current),o=Qt(e,fe.current),l=i||o,s=e;return j.refLinkColor&&"ref"===s.type?l&&(j.refLinkHighlightColor||j.linkHighlight)?pe[j.refLinkColor][j.refLinkHighlightColor||j.linkHighlight](te):pe[j.refLinkColor][j.backgroundColor](j.highlightFade*te):j.citeLinkColor&&null!==(n=s.type)&&void 0!==n&&n.includes("cite")?l&&(j.citeLinkHighlightColor||j.linkHighlight)?pe[j.citeLinkColor][j.citeLinkHighlightColor||j.linkHighlight](te):pe[j.citeLinkColor][j.backgroundColor](j.highlightFade*te):function(e,n,t,r){if(!j.linkHighlight&&!j.linkColorScheme&&!t)return $t(ve(e,n),r);if(!t&&!j.linkColorScheme){var i=ve(e,n);return pe[i][j.backgroundColor](j.highlightFade*te)}return t?j.linkHighlight||j.linkColorScheme?j.linkHighlight?j.linkColorScheme?pe[j.linkColorScheme][j.linkHighlight](te):pe[ve(e,n)][j.linkHighlight](te):$t(j.linkColorScheme,r):$t(ve(e,n),r):pe[j.linkColorScheme][j.backgroundColor](j.highlightFade*te)}(t,r,l,X)},linkWidth:function(e){if(1===j.highlightLinkSize)return j.linkWidth;var n=Qt(e,q.current),t=Qt(e,fe.current);return n||t?j.linkWidth*(1+te*(j.highlightLinkSize-1)):j.linkWidth},linkDirectionalParticleWidth:j.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e,r=n.timeStamp-ee.current<200;if(ee.current=n.timeStamp,r)return U("double",t,n);var i=ee.current;return setTimeout((function(){if(ee.current===i)return U("click",t,n)}),200)},onNodeHover:function(e){j.highlight&&(we||(M||(he(),ie(0)),V(e)))},onNodeRightClick:function(e,n){U("right",e,n)},onNodeDrag:function(e){V(e),ke(!0)},onNodeDragEnd:function(){V(null),ke(!1)}};return(0,be.jsx)(h.xu,{overflow:"hidden",onClick:E.onClose,children:u?(0,be.jsx)(Ut,Vt(Vt({ref:n},Pe),{},{nodeThreeObjectExtend:!0,nodeOpacity:j.nodeOpacity,nodeResolution:j.nodeResolution,linkOpacity:j.linkOpacity,nodeThreeObject:function(e){if(j.labels&&(!(j.labels<3)||ge[e.id])){var n=new S.Z(e.title.substring(0,40));return n.color=$t(j.labelTextColor,X),n.backgroundColor=$t(j.labelBackgroundColor,X),n.padding=2,n.textHeight=8,n}}})):(0,be.jsx)(_t,Vt(Vt({ref:n},Pe),{},{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 Qt(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 Kt(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function $t(e,n){return e.split(".").reduce((function(e,n){return e[n]}),n.colors)}function Yt(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(86441)}])}},function(e){e.O(0,[774,737,13,874,573,446,1,888,179],(function(){return n=45301,e(e.s=n);var n}));var n=e.O();_N_E=n}]); \ No newline at end of file diff --git a/out/index.html b/out/index.html index 13c9622..eea751d 100644 --- a/out/index.html +++ b/out/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file -- cgit v1.2.3