summaryrefslogtreecommitdiff
path: root/out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-08-06 02:31:59 +0200
committerThomas F. K. Jorna <[email protected]>2021-08-06 02:31:59 +0200
commitb92b006e2c22302e708672de97b9a05081ecca1c (patch)
tree7117eee455b6b8e4b60e4265e36f258a3a360f73 /out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js
parentd1a7d3c00a603cb774697e49696e9a0d2c4661b9 (diff)
features!: context menu, better ui, and smoother updates
Diffstat (limited to 'out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js')
-rw-r--r--out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js b/out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js
new file mode 100644
index 0000000..6f721ec
--- /dev/null
+++ b/out/_next/static/chunks/pages/index-a22d59b6e873aa5b1f23.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{96834:function(e,n,t){"use strict";t.r(n),t.d(n,{Graph:function(){return ze},GraphPage:function(){return Ne},default:function(){return Le}});var r=t(809),i=t.n(r),o=t(92447),l=t(85893),s=t(59999),a=t(26265),c=t(64121),d=t(67294);function u(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=h(e,null!==(t=r.storage)&&void 0!==t?t:localStorage),o=i.get(),l=void 0!==o?o:n;l!==o&&i.update(l);var s=(0,d.useState)(l),a=s[0],c=s[1];(0,d.useEffect)((function(){a!==l&&c(l)}),[e]);var u=function(e){e instanceof Function?c((function(n){var t=e(n);return i.update(t),t})):(c(e),i.update(e))};return[a,u]}function h(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 g=t(54533),f=t(54309),x=t(20233),p=t(40980),j=t(48017),m=t(74860),v=t(36194),b=[],C={};for(var y in v.oY)for(var k in v.oY[y]){var w=y+k;"LinearNone"===w&&(w="Linear"),b.push(w),C[w]=v.oY[y][k]}var S=C,I={enabled:!0,charge:-700,collision:!0,collisionStrength:20,centering:!0,centeringStrength:.05,linkStrength:.3,linkIts:1,alphaDecay:.1,alphaTarget:0,alphaMin:0,velocityDecay:.25,gravity:.3,gravityOn:!0},L={orphans:!1,parents:!0,filelessCites:!1,tagsBlacklist:[],tagsWhitelist:[],bad:!0,nodes:[],links:[],date:[]},O={particles:!1,particlesNumber:0,particlesWidth:4,arrows:!1,arrowsLength:1,arrowsPos:.5,arrowsColor:"",linkOpacity:.8,linkWidth:1,nodeRel:4,nodeOpacity:1,nodeResolution:12,labels:2,labelScale:1.5,highlight:!0,highlightNodeSize:2,highlightLinkSize:2,highlightFade:.8,highlightAnim:!0,animationSpeed:420,algorithmOptions:b,algorithmName:"SinusoidalOut",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:"gray.900",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},N={follow:"zoom",localSame:"add",zoomPadding:200,zoomSpeed:2e3},z={highlight:"hover",local:"click",follow:"double"},R=["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"],D=t(38347),T=t(93924),E=t(83986),F=t(48931),Z=t(67546),H=t(93441),P=t(6569),B=t(24189),A=t(2827),V=t(48420),M=t(96699),W=t(40155),X=t(56769),_=t(336),U=t(72026),G=t(94096),q=t(64115),Q=t(88134),K=t(48235),J=t(67273),Y=t(15267),$=t(46049),ee=t(95818),ne=t(47647),te=t(86658),re=t(29356);function ie(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 oe(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ie(Object(t),!0).forEach((function(n){(0,a.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ie(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var le=function(e){var n=e.physics,t=e.setPhysics,r=e.threeDim,i=e.setThreeDim,o=e.filter,a=e.setFilter,u=e.visuals,h=e.setVisuals,g=e.mouse,f=e.setMouse,x=e.behavior,p=e.setBehavior,m=e.tags,v=e.tagColors,b=e.setTagColors,C=(0,d.useState)(!0),y=C[0],k=C[1],w=(0,d.useContext)(re.N),S=w.highlightColor,B=w.setHighlightColor;return y?(0,l.jsxs)(j.xu,{bg:"alt.100",w:"xs",marginTop:10,marginLeft:10,borderRadius:"xl",paddingBottom:5,zIndex:300,position:"relative",boxShadow:"xl",maxH:.95*globalThis.innerHeight,children:[(0,l.jsxs)(j.xu,{display:"flex",justifyContent:"space-between",alignItems:"center",paddingRight:2,paddingTop:1,children:[(0,l.jsx)(M.u,{label:"2D",children:(0,l.jsx)(W.z,{onClick:function(){return i(!r)},variant:"ghost",zIndex:"overlay",children:r?"3D":"2D"})}),(0,l.jsxs)(j.xu,{display:"flex",alignItems:"center",children:[(0,l.jsx)(M.u,{label:"Reset settings to defaults",children:(0,l.jsx)(V.h,{"aria-label":"Reset Defaults",icon:(0,l.jsx)(E.A,{}),onClick:function(){h(O),a(L),f(z),t(I),p(N)},variant:"none",size:"sm"})}),(0,l.jsx)(V.h,{size:"sm",icon:(0,l.jsx)(F.T,{}),"aria-label":"Close Tweak Panel",variant:"ghost",onClick:function(){return k(!1)}})]})]}),(0,l.jsx)(te.ZP,{autoHeight:!0,autoHeightMax:.85*globalThis.innerHeight,autoHide:!0,renderThumbVertical:function(e){var n=e.style,t=(0,D.Z)(e,["style"]);return(0,l.jsx)(j.xu,oe(oe({},t),{},{style:oe(oe({},n),{},{borderRadius:10}),bg:S}))},children:(0,l.jsxs)(X.UQ,{allowMultiple:!0,allowToggle:!0,color:"black",children:[(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:[(0,l.jsx)(X.XE,{marginRight:2}),(0,l.jsx)(_.X,{size:"sm",children:"Filter"})]}),(0,l.jsxs)(X.Hk,{children:[(0,l.jsxs)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsxs)(G.k,{justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Orphans"}),(0,l.jsx)(Q.r,{onChange:function(){a(oe(oe({},o),{},{orphans:!o.orphans}))},isChecked:o.orphans})]}),(0,l.jsxs)(G.k,{justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Link nodes with parent file"}),(0,l.jsx)(Q.r,{onChange:function(){a(oe(oe({},o),{},{parents:!o.parents}))},isChecked:o.parents})]}),(0,l.jsxs)(G.k,{justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Citations without note files"}),(0,l.jsx)(Q.r,{onChange:function(){a(oe(oe({},o),{},{filelessCites:!o.filelessCites}))},isChecked:o.filelessCites})]}),(0,l.jsxs)(G.k,{justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Non-existant nodes"}),(0,l.jsx)(Q.r,{onChange:function(){b(oe(oe({},v),{},{bad:"white"})),a(oe(oe({},o),{},{bad:!o.bad}))},isChecked:o.bad})]})]}),(0,l.jsxs)(X.UQ,{padding:0,allowToggle:!0,allowMultiple:!0,paddingLeft:3,children:[(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:["Tag filters",(0,l.jsx)(X.XE,{})]}),(0,l.jsxs)(X.Hk,{pr:0,mr:0,children:[(0,l.jsx)(ue,{highlightColor:S,filter:o,setFilter:a,tags:m,mode:"blacklist"}),(0,l.jsx)(ue,{highlightColor:S,filter:o,setFilter:a,tags:m,mode:"whitelist"})]})]}),(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:["Tag Colors",(0,l.jsx)(X.XE,{})]}),(0,l.jsx)(X.Hk,{pr:0,mr:0,children:(0,l.jsx)(he,{tags:m,colorList:R,tagColors:v,setTagColors:b,highlightColor:S})})]})]})]})]}),(0,l.jsxs)(X.Qd,{children:[(0,l.jsx)(X.KF,{display:"flex",justifyContent:"space-between",children:(0,l.jsxs)(j.xu,{display:"flex",children:[(0,l.jsx)(X.XE,{marginRight:2}),(0,l.jsx)(_.X,{size:"sm",children:"Physics"})]})}),(0,l.jsxs)(X.Hk,{children:[(0,l.jsxs)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsx)(ce,{label:"Gravity",value:n.gravityOn,onChange:function(){return t(oe(oe({},n),{},{gravityOn:!n.gravityOn}))},children:(0,l.jsx)(ae,{label:"Strength",value:10*n.gravity,onChange:function(e){return t(oe(oe({},n),{},{gravity:e/10}))}})}),(0,l.jsx)(ae,{value:-n.charge/100,onChange:function(e){return t(oe(oe({},n),{},{charge:-100*e}))},label:"Repulsive Force"}),(0,l.jsx)(ce,{label:"Collision",infoText:"Perfomance sap, disable if slow",value:n.collision,onChange:function(){return t(oe(oe({},n),{},{collision:!n.collision}))},children:(0,l.jsx)(ae,{value:n.collisionStrength/5,onChange:function(e){return t(oe(oe({},n),{},{collisionStrength:5*e}))},label:"Collision Radius",infoText:"Easy with this one, high values can lead to a real jiggly mess"})}),(0,l.jsx)(ae,{value:5*n.linkStrength,onChange:function(e){return t(oe(oe({},n),{},{linkStrength:e/5}))},label:"Link Force"}),(0,l.jsx)(ae,{label:"Link Iterations",value:n.linkIts,onChange:function(e){return t(oe(oe({},n),{},{linkIts:e}))},min:0,max:6,step:1,infoText:"How many links down the line the physics of a single node affects (Slow)"}),(0,l.jsx)(ae,{label:"Viscosity",value:10*n.velocityDecay,onChange:function(e){return t(oe(oe({},n),{},{velocityDecay:e/10}))}})]}),(0,l.jsx)(j.xu,{children:(0,l.jsx)(X.UQ,{paddingLeft:3,allowToggle:!0,children:(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:[(0,l.jsx)(q.x,{children:"Advanced"}),(0,l.jsx)(X.XE,{marginRight:2})]}),(0,l.jsx)(X.Hk,{children:(0,l.jsxs)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:3,color:"gray.800",children:[(0,l.jsx)(ae,{label:"Stabilization rate",value:50*n.alphaDecay,onChange:function(e){return t(oe(oe({},n),{},{alphaDecay:e/50}))}}),(0,l.jsx)(ce,{label:"Center nodes",value:n.centering,onChange:function(){return t(oe(oe({},n),{},{centering:!n.centering}))},infoText:"Keeps the nodes in the center of the viewport. If disabled you can drag the nodes anywhere you want.",children:(0,l.jsx)(ae,{label:"Centering Strength",value:n.centeringStrength,max:2,step:.01,onChange:function(e){return t(oe(oe({},n),{},{centeringStrength:e}))}})})]})})]})})})]})]}),(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:[(0,l.jsx)(X.XE,{marginRight:2}),(0,l.jsx)(_.X,{size:"sm",children:"Visual"})]}),(0,l.jsx)(X.Hk,{children:(0,l.jsxs)(U.gC,{justifyContent:"flex-start",align:"stretch",children:[(0,l.jsx)(X.UQ,{allowToggle:!0,defaultIndex:[0],paddingLeft:3,children:(0,l.jsxs)(X.Qd,{children:[(0,l.jsx)(X.KF,{children:(0,l.jsxs)(G.k,{justifyContent:"space-between",w:"100%",children:[(0,l.jsx)(q.x,{children:"Colors"}),(0,l.jsx)(X.XE,{marginRight:2})]})}),(0,l.jsx)(X.Hk,{children:(0,l.jsx)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Nodes"}),(0,l.jsx)(M.u,{label:"Shuffle node colors",children:(0,l.jsx)(V.h,{"aria-label":"Shuffle node colors",size:"sm",icon:(0,l.jsx)(Z.n,{}),variant:"ghost",onClick:function(){var e,n=null!==(e=u.nodeColorScheme)&&void 0!==e?e:[];h(oe(oe({},u),{},{nodeColorScheme:n.map((function(e){return[Math.random(),e]})).sort((function(e,n){return(0,c.Z)(e,1)[0]-(0,c.Z)(n,1)[0]})).map((function(e){var n=(0,c.Z)(e,2);n[0];return n[1]}))}))}})}),(0,l.jsx)(M.u,{label:"Cycle node colors",children:(0,l.jsx)(V.h,{"aria-label":"Shift node colors",icon:(0,l.jsx)(H.L,{}),size:"sm",variant:"ghost",onClick:function(){var e,n=null!==(e=u.nodeColorScheme)&&void 0!==e?e:[];h(oe(oe({},u),{},{nodeColorScheme:[].concat((0,s.Z)(n.slice(1,n.length)),[n[0]])}))}})}),(0,l.jsxs)(K.v2,{placement:"right",closeOnSelect:!1,matchWidth:!0,children:[(0,l.jsx)(K.j2,{width:20,as:W.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(P.v,{}),children:(0,l.jsx)(G.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:u.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:(0,l.jsx)(K.__,{width:500,type:"checkbox",defaultValue:u.nodeColorScheme,onChange:function(e){e.length&&h(oe(oe({},u),{},{nodeColorScheme:e}))},children:R.map((function(e){return(0,l.jsx)(K.ii,{isChecked:u.nodeColorScheme.some((function(n){return n===e})),value:e,isDisabled:1===u.nodeColorScheme.length&&u.nodeColorScheme[0]===e,children:(0,l.jsx)(j.xu,{justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})})},e)}))})})]})]})]}),(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Links"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(P.v,{}),children:(0,l.jsx)(j.xu,{children:u.linkColorScheme?(0,l.jsx)(j.xu,{bgColor:u.linkColorScheme,borderRadius:"sm",height:6,width:6}):(0,l.jsx)(G.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:u.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{linkColorScheme:""}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(G.k,{height:6,width:6,flexDirection:"column",flexWrap:"wrap",children:u.nodeColorScheme.map((function(e){return(0,l.jsx)(j.xu,{bgColor:e,flex:"1 1 8px",borderRadius:"2xl"},e)}))})}),R.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{linkColorScheme:e}))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]}),(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Accent"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(P.v,{}),children:(0,l.jsx)(j.xu,{bgColor:S,borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:R.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return B(e)},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))})]})]})]}),(0,l.jsx)(de,{colorList:R,label:"Link highlight",visuals:u,setVisuals:h,value:"linkHighlight",visValue:u.linkHighlight}),(0,l.jsx)(de,{colorList:R,label:"Node highlight",visuals:u,setVisuals:h,value:"nodeHighlight",visValue:u.nodeHighlight}),(0,l.jsx)(de,{colorList:R,label:"Background",visuals:u,setVisuals:h,value:"backgroundColor",visValue:u.backgroundColor}),(0,l.jsx)(de,{colorList:R,label:"Emacs node",visuals:u,setVisuals:h,value:"emacsNodeColor",visValue:u.emacsNodeColor})]})})})]})}),(0,l.jsxs)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsx)(ae,{label:"Node size",value:u.nodeRel,onChange:function(e){return h(oe(oe({},u),{},{nodeRel:e}))}}),(0,l.jsx)(ae,{label:"Node connections size scale",value:u.nodeSizeLinks,min:0,max:2,onChange:function(e){return h(oe(oe({},u),{},{nodeSizeLinks:e}))}}),r&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ae,{label:"Node opacity",value:u.nodeOpacity,min:0,max:1,onChange:function(e){return h(oe(oe({},u),{},{nodeOpacity:e}))}}),(0,l.jsx)(ae,{label:"Node resolution",value:u.nodeResolution,min:5,max:32,step:1,onChange:function(e){return h(oe(oe({},u),{},{nodeResolution:e}))}})]}),(0,l.jsx)(ae,{label:"Link width",value:u.linkWidth,onChange:function(e){return h(oe(oe({},u),{},{linkWidth:e}))}}),r&&(0,l.jsx)(ae,{label:"Link opacity",min:0,max:1,value:u.linkOpacity,onChange:function(e){return h(oe(oe({},u),{},{linkOpacity:e}))}}),(0,l.jsxs)(ce,{label:"Dash cite links",infoText:"Add dashes to citation links made with org-roam-bibtex",value:u.citeDashes,onChange:function(){return h(oe(oe({},u),{},{citeDashes:!u.citeDashes}))},children:[(0,l.jsx)(ae,{label:"Dash length",value:u.citeDashLength/10,onChange:function(e){return h(oe(oe({},u),{},{citeDashLength:10*e}))}}),(0,l.jsx)(ae,{label:"Gap length",value:u.citeGapLength/5,onChange:function(e){return h(oe(oe({},u),{},{citeGapLength:5*e}))}})]}),(0,l.jsx)(de,{colorList:R,label:"Citation node color",visuals:u,setVisuals:h,value:"citeNodeColor",visValue:u.citeNodeColor}),(0,l.jsx)(de,{colorList:R,label:"Citation link color",visuals:u,setVisuals:h,value:"citeLinkColor",visValue:u.citeLinkColor}),(0,l.jsx)(de,{colorList:R,label:"Reference link highlight",visuals:u,setVisuals:h,value:"citeLinkHighlightColor",visValue:u.citeLinkHighlightColor}),(0,l.jsxs)(ce,{label:"Dash ref links",infoText:"Add dashes to citation links, whose target has a note, made with org-roam-bibtex",value:u.refDashes,onChange:function(){return h(oe(oe({},u),{},{refDashes:!u.refDashes}))},children:[(0,l.jsx)(ae,{label:"Dash length",value:u.refDashLength/10,onChange:function(e){return h(oe(oe({},u),{},{refDashLength:10*e}))}}),(0,l.jsx)(ae,{label:"Gap length",value:u.refGapLength/5,onChange:function(e){return h(oe(oe({},u),{},{refGapLength:5*e}))}})]}),(0,l.jsx)(de,{colorList:R,label:"Reference node color",visuals:u,setVisuals:h,value:"refNodeColor",visValue:u.refNodeColor}),(0,l.jsx)(de,{colorList:R,label:"Reference link color",visuals:u,setVisuals:h,value:"refLinkColor",visValue:u.refLinkColor}),(0,l.jsx)(de,{colorList:R,label:"Reference link highlight",visuals:u,setVisuals:h,value:"refLinkHighlightColor",visValue:u.refLinkHighlightColor}),(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Labels"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(P.v,{}),children:u.labels?u.labels<2?"On Highlight":"Always":"Never"}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{labels:0}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{labels:1}))},children:"On Highlight"}),(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{labels:2}))},children:"Always"}),(0,l.jsx)(K.sN,{onClick:function(){return h(oe(oe({},u),{},{labels:3}))},children:"Always (even in 3D)"})]})]})]})]}),(0,l.jsx)(Y.U,{in:u.labels>0,animateOpacity:!0,children:(0,l.jsxs)(U.gC,{spacing:1,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:2,color:"gray.800",children:[(0,l.jsx)(de,{colorList:R,label:"Text",visuals:u,setVisuals:h,value:"labelTextColor",visValue:u.labelTextColor}),(0,l.jsx)(de,{colorList:R,label:"Text",visuals:u,setVisuals:h,value:"labelBackgroundColor",visValue:u.labelBackgroundColor}),(0,l.jsx)(Y.U,{in:!!u.labelBackgroundColor,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingTop:2,children:(0,l.jsx)(ae,{label:"Background opacity",value:u.labelBackgroundOpacity,onChange:function(e){console.log(u.labelBackgroundOpacity),h(oe(oe({},u),{},{labelBackgroundOpacity:e}))},min:0,max:1,step:.01})})}),(0,l.jsx)(Y.U,{in:u.labels>1,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingTop:2,children:(0,l.jsx)(ae,{label:"Label Appearance Scale",value:5*u.labelScale,onChange:function(e){return h(oe(oe({},u),{},{labelScale:e/5}))}})})})]})})]}),(0,l.jsxs)(ce,{label:"Link arrows",value:u.arrows,onChange:function(){return h(oe(oe({},u),{},{arrows:!u.arrows}))},children:[(0,l.jsx)(ae,{label:"Arrow size",value:u.arrowsLength/10,onChange:function(e){return h(oe(oe({},u),{},{arrowsLength:10*e}))}}),(0,l.jsx)(ae,{label:"Arrow Position",value:u.arrowsPos,min:0,max:1,step:.01,onChange:function(e){return h(oe(oe({},u),{},{arrowsPos:e}))}}),(0,l.jsx)(de,{colorList:R,label:"Arrow Color",visuals:u,setVisuals:h,value:"arrowsColor",visValue:u.arrowsColor})]}),(0,l.jsxs)(ce,{label:"Directional Particles",value:u.particles,onChange:function(){return h(oe(oe({},u),{},{particles:!u.particles}))},children:[(0,l.jsx)(ae,{label:"Particle Number",value:u.particlesNumber,max:5,step:1,onChange:function(e){return h(oe(oe({},u),{},{particlesNumber:e}))}}),(0,l.jsx)(ae,{label:"Particle Size",value:u.particlesWidth,onChange:function(e){return h(oe(oe({},u),{},{particlesWidth:e}))}})]}),(0,l.jsx)(ce,{label:"Highlight",onChange:function(){return h(oe(oe({},u),{},{highlight:!u.highlight}))},value:u.highlight,children:(0,l.jsxs)(U.gC,{spacing:1,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.400"}),align:"stretch",paddingLeft:0,children:[(0,l.jsx)(ae,{label:"Highlight Link Thickness",value:u.highlightLinkSize,onChange:function(e){return h(oe(oe({},u),{},{highlightLinkSize:e}))}}),(0,l.jsx)(ae,{label:"Highlight Node Size",value:u.highlightNodeSize,onChange:function(e){return h(oe(oe({},u),{},{highlightNodeSize:e}))}}),(0,l.jsx)(ae,{min:0,max:1,label:"Highlight Fade",value:u.highlightFade,onChange:function(e){return h(oe(oe({},u),{},{highlightFade:e}))}}),(0,l.jsxs)(ce,{label:"Highlight Animation",onChange:function(){h(oe(oe({},u),{},{highlightAnim:!u.highlightAnim}))},value:u.highlightAnim,children:[(0,l.jsx)(ae,{label:"Animation speed",onChange:function(e){return h(oe(oe({},u),{},{animationSpeed:e}))},value:u.animationSpeed,infoText:"Slower speed has a chance of being buggy",min:50,max:1e3,step:10}),(0,l.jsx)($.Ph,{placeholder:u.algorithmName,onChange:function(e){h(oe(oe({},u),{},{algorithmName:e.target.value}))},children:u.algorithmOptions.map((function(e){return(0,l.jsx)("option",{value:e,children:e},e)}))})]})]})})]})]})})]}),(0,l.jsxs)(X.Qd,{children:[(0,l.jsxs)(X.KF,{children:[(0,l.jsx)(X.XE,{marginRight:2}),(0,l.jsx)(_.X,{size:"sm",children:"Behavior"})]}),(0,l.jsx)(X.Hk,{children:(0,l.jsxs)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",paddingLeft:7,color:"gray.800",children:[(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsxs)(G.k,{children:[(0,l.jsx)(q.x,{children:"Expand Node"}),(0,l.jsx)(se,{infoText:"View only the node and its direct neighbors"})]}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,rightIcon:(0,l.jsx)(P.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(q.x,{children:g.local?g.local[0].toUpperCase()+g.local.slice(1):"Never"})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{local:""}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{local:"click"}))},children:"Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{local:"double"}))},children:"Double Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{local:"right"}))},children:"Right Click"})]})]})]})]}),(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Open in Emacs"}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,rightIcon:(0,l.jsx)(P.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(q.x,{children:g.follow?g.follow[0].toUpperCase()+g.follow.slice(1):"Never"})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{follow:""}))},children:"Never"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{follow:"click"}))},children:"Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{follow:"double"}))},children:"Double Click"}),(0,l.jsx)(K.sN,{onClick:function(){return f(oe(oe({},g),{},{follow:"right"}))},children:"Right Click"})]})]})]})]}),(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:"Follow Emacs by..."}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,rightIcon:(0,l.jsx)(P.v,{}),colorScheme:"",color:"black",children:(0,l.jsx)(q.x,{children:x.follow[0].toUpperCase()+x.follow.slice(1)})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{bgColor:"gray.200",zIndex:"popover",children:[(0,l.jsx)(K.sN,{onClick:function(){return p(oe(oe({},x),{},{follow:"color"}))},children:"Just coloring the currently opened node"}),(0,l.jsx)(K.sN,{onClick:function(){return p(oe(oe({},x),{},{follow:"local"}))},children:"Opening the local graph"}),(0,l.jsx)(K.sN,{onClick:function(){return p(oe(oe({},x),{},{follow:"zoom"}))},children:"Zooming to the current node"})]})]})]})]}),(0,l.jsx)(ae,{label:"Zoom speed",value:x.zoomSpeed,min:0,max:4e3,step:100,onChange:function(e){return p(oe(oe({},x),{},{zoomSpeed:e}))}}),(0,l.jsx)(ae,{label:"Zoom padding",value:x.zoomPadding,min:0,max:400,step:1,onChange:function(e){return p(oe(oe({},x),{},{zoomPadding:e}))},infoText:"How much to zoom out to accomodate all nodes when changing the view."})]})})]})]})})]}):(0,l.jsx)(j.xu,{position:"absolute",zIndex:"overlay",marginTop:10,marginLeft:10,display:y?"none":"block",children:(0,l.jsx)(V.h,{variant:"ghost","aria-label":"Settings",icon:(0,l.jsx)(T.e,{}),onClick:function(){return k(!0)}})})},se=function(e){var n=e.infoText;return(0,l.jsx)(j.xu,{paddingLeft:"1",children:(0,l.jsx)(M.u,{label:n,placement:"top",color:"gray.100",bg:"gray.800",hasArrow:!0,children:(0,l.jsx)(B.h,{})})})},ae=function(e){var n=e.min,t=void 0===n?0:n,r=e.max,i=void 0===r?10:r,o=e.step,s=void 0===o?.1:o,a=e.value,c=void 0===a?1:a,u=(0,D.Z)(e,["min","max","step","value"]),h=u.onChange,g=u.label,f=u.infoText,x=(0,d.useContext)(re.N).highlightColor;return(0,l.jsxs)(j.xu,{children:[(0,l.jsxs)(j.xu,{display:"flex",alignItems:"flex-end",children:[(0,l.jsx)(q.x,{children:g}),f&&(0,l.jsx)(se,{infoText:f})]}),(0,l.jsxs)(ee.iR,{value:c,onChange:h,min:t,max:i,step:s,children:[(0,l.jsx)(ee.Uj,{children:(0,l.jsx)(ee.Ms,{})}),(0,l.jsx)(M.u,{bg:x,label:c.toFixed(1),children:(0,l.jsx)(ee.gs,{bg:"white"})})]})]})},ce=function(e){var n=e.value,t=e.onChange,r=e.label,i=e.infoText,o=e.children;return(0,l.jsxs)(j.xu,{paddingTop:2,children:[(0,l.jsxs)(j.xu,{display:"flex",justifyContent:"space-between",paddingBottom:2,children:[(0,l.jsxs)(j.xu,{display:"flex",alignItems:"center",children:[(0,l.jsx)(q.x,{children:r}),i&&(0,l.jsx)(se,{infoText:i})]}),(0,l.jsx)(Q.r,{isChecked:!!n,onChange:t})]}),(0,l.jsx)(Y.U,{in:!!n,animateOpacity:!0,children:(0,l.jsx)(j.xu,{paddingLeft:4,paddingTop:2,paddingBottom:2,children:o})})]})},de=function(e){var n=e.label,t=e.colorList,r=e.value,i=e.visuals,o=e.visValue,s=e.setVisuals;return(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",children:[(0,l.jsx)(q.x,{children:n}),(0,l.jsxs)(K.v2,{placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,colorScheme:"",color:"black",rightIcon:(0,l.jsx)(P.v,{}),children:(0,l.jsx)(j.xu,{bgColor:o,borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsxs)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:[(0,l.jsx)(K.sN,{onClick:function(){return s(oe(oe({},i),{},(0,a.Z)({},r,"")))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{height:6,width:6})}),t.map((function(e){return(0,l.jsx)(K.sN,{onClick:function(){return s(oe(oe({},i),{},(0,a.Z)({},r,e)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:e,borderRadius:"sm",height:6,width:6})},e)}))]})]})]})]})},ue=function(e){var n=e.filter,t=e.setFilter,r=e.tags,i=e.highlightColor,o=e.mode,s=r.map((function(e){return{value:e,label:e}})),c="blacklist"===o?"tagsBlacklist":"tagsWhitelist",u=(0,d.useState)(n[c].map((function(e){return{value:e,label:e}}))),h=u[0],g=u[1];return(0,l.jsx)(ne.CUIAutoComplete,{items:s,label:"Add tag to "+o,placeholder:" ",onCreateItem:function(e){return null},disableCreateItem:!0,selectedItems:h,onSelectedItemsChange:function(e){e.selectedItems&&(g(e.selectedItems),t(oe(oe({},n),{},(0,a.Z)({},c,e.selectedItems.map((function(e){return e.value}))))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}})},he=function(e){var n=e.colorList,t=e.tagColors,r=e.setTagColors,i=e.highlightColor,o=e.tags.map((function(e){return{value:e,label:e}})),s=(0,d.useState)(Object.keys(t).map((function(e){return{value:e,label:e}}))),c=s[0],u=s[1];return(0,l.jsxs)(j.xu,{children:[(0,l.jsx)(ne.CUIAutoComplete,{items:o,label:"Add tag to filter",placeholder:" ",disableCreateItem:!0,selectedItems:c,onSelectedItemsChange:function(e){e.selectedItems&&(u(Array.from(new Set(e.selectedItems))),r(Object.fromEntries(Array.from(new Set(e.selectedItems)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))))},listItemStyleProps:{overflow:"hidden"},highlightItemBg:"gray.400",toggleButtonStyleProps:{variant:"outline"},inputStyleProps:{focusBorderColor:i,color:"gray.800",borderColor:"gray.600"},tagStyleProps:{display:"none",rounded:"full",bg:i,height:8,paddingLeft:4,fontWeight:"bold"},hideToggleButton:!0,itemRenderer:function(e){return e.label}}),(0,l.jsx)(U.gC,{spacing:2,justifyContent:"flex-start",divider:(0,l.jsx)(U.cX,{borderColor:"gray.500"}),align:"stretch",color:"gray.800",children:Object.keys(t).map((function(e){return(0,l.jsxs)(G.k,{alignItems:"center",justifyContent:"space-between",width:"100%",pl:2,children:[(0,l.jsx)(j.xu,{width:"100%",children:(0,l.jsx)(q.x,{fontWeight:"bold",children:e})}),(0,l.jsxs)(K.v2,{isLazy:!0,placement:"right",children:[(0,l.jsx)(K.j2,{as:W.z,colorScheme:"",color:"black",children:(0,l.jsx)(j.xu,{bgColor:t[e],borderRadius:"sm",height:6,width:6})}),(0,l.jsxs)(J.h,{children:[" ",(0,l.jsx)(K.qy,{minW:10,zIndex:"popover",bgColor:"gray.200",children:n.map((function(n){return(0,l.jsx)(K.sN,{onClick:function(){return r(oe(oe({},t),{},(0,a.Z)({},e,n)))},justifyContent:"space-between",alignItems:"center",display:"flex",children:(0,l.jsx)(j.xu,{bgColor:n,borderRadius:"sm",height:6,width:6})},n)}))})]})]}),(0,l.jsx)(V.h,{"aria-label":"Delete tag color",variant:"ghost",icon:(0,l.jsx)(A.p,{}),onClick:function(){r(Object.fromEntries(Array.from(new Set(c)).map((function(e){var n;return[e.label,null!==(n=t[e.label])&&void 0!==n?n:"gray.600"]})))),u(c.filter((function(n){return n.value!==e})))}})]},e)}))})]})},ge=t(49065),fe=t(94030),xe=t(55830),pe=t(46617),je=t(50862),me=t(68928),ve=function(e){e.background;var n=e.node,t=(e.nodeType,e.coordinates),r=e.handleLocal,i=e.menuClose,o=e.scope,s=e.openNodeInEmacs,a=e.deleteNodeInEmacs,c=e.createNodeInEmacs,u=(0,m.q)(),h=u.isOpen,g=u.onOpen,f=u.onClose;(0,d.useRef)();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(j.xu,{position:"absolute",zIndex:"overlay",left:t[0]+10,top:t[1]-10,padding:5,children:(0,l.jsx)(K.v2,{closeOnBlur:!1,defaultIsOpen:!0,onClose:function(){return i()},children:(0,l.jsxs)(K.qy,{zIndex:"overlay",bgColor:"alt.100",borderColor:"gray.500",maxWidth:"xs",children:[n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(_.X,{size:"sm",isTruncated:!0,px:3,py:1,children:n.title}),(0,l.jsx)(K.R,{borderColor:"gray.500"})]}),0!==o.nodeIds.length&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(K.sN,{onClick:function(){return r(n,"add")},icon:(0,l.jsx)(fe.I,{}),children:"Expand local graph at node"}),(0,l.jsx)(K.sN,{onClick:function(){return r(n,"replace")},icon:(0,l.jsx)(xe.O,{}),children:"Open local graph for this node"})]}),null!==n&&void 0!==n&&n.properties.FILELESS?(0,l.jsx)(K.sN,{icon:(0,l.jsx)(je.d,{}),onClick:function(){return c(n)},children:"Create node"}):(0,l.jsx)(K.sN,{icon:(0,l.jsx)(pe.d,{}),onClick:function(){return s(n)},children:"Open in Emacs"}),(null===n||void 0===n?void 0:n.properties.ROAM_REFS)&&(0,l.jsx)(K.sN,{icon:(0,l.jsx)(me.h,{}),children:"Open in Zotero"}),0===o.nodeIds.length&&(0,l.jsx)(K.sN,{icon:(0,l.jsx)(xe.O,{}),onClick:function(){return r(n,"replace")},children:"Open local graph"}),0===(null===n||void 0===n?void 0:n.level)&&(0,l.jsx)(K.sN,{closeOnSelect:!1,icon:(0,l.jsx)(A.p,{color:"red.500"}),color:"red.500",onClick:g,children:"Permenantly delete note"})]})})}),(0,l.jsxs)(ge.u_,{isCentered:!0,isOpen:h,onClose:f,children:[(0,l.jsx)(ge.ZA,{}),(0,l.jsxs)(ge.hz,{zIndex:"popover",children:[(0,l.jsx)(ge.xB,{children:"Delete node?"}),(0,l.jsx)(ge.ol,{}),(0,l.jsx)(ge.fe,{children:(0,l.jsxs)(U.gC,{spacing:4,display:"flex",alignItems:"flex-start",children:[(0,l.jsx)(q.x,{children:"This will permanently delete your note:"}),(0,l.jsx)(q.x,{fontWeight:"bold",children:null===n||void 0===n?void 0:n.title}),0!==(null===n||void 0===n?void 0:n.level)&&(0,l.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,l.jsx)(q.x,{children:"Are you sure you want to do continue?"})]})}),(0,l.jsxs)(ge.mz,{children:[(0,l.jsx)(W.z,{mr:3,onClick:function(){console.log("closing"),f(),i()},children:"Cancel"}),(0,l.jsx)(W.z,{variant:"link",colorScheme:"red",ml:3,onClick:function(){console.log("aaaaa"),a(n),f(),i()},children:"Delete node"})]})]})]})]})},be=t(31122),Ce=t(22003);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 ke(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?ye(Object(t),!0).forEach((function(n){(0,a.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ye(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var we=t.e(4).then(t.bind(t,57004)),Se=t.g.window?t(61957).f$:null,Ie=t.g.window?t(61957).s6:null;function Le(){var e=(0,d.useState)(!1),n=e[0],t=e[1];return(0,d.useEffect)((function(){t(!0)}),[]),n?(0,l.jsx)(Ne,{}):null}function Oe(e){return["object"===typeof e.source?e.source.id:e.source,"object"===typeof e.target?e.target.id:e.target]}function Ne(){var e=u("physics",I),n=(0,c.Z)(e,2),t=n[0],r=n[1],i=u("filter",L),o=(0,c.Z)(i,2),h=o[0],g=o[1],f=u("visuals",O),x=(0,c.Z)(f,2),p=x[0],m=x[1],v=(0,d.useState)(null),b=v[0],C=v[1],y=(0,d.useState)(null),k=y[0],w=y[1],S=u("behavior",N),R=(0,c.Z)(S,2),D=R[0],T=R[1],E=u("mouse",z),F=(0,c.Z)(E,2),Z=F[0],H=F[1],P=(0,d.useRef)({}),B=(0,d.useRef)({}),A=(0,d.useRef)([]),V=(0,d.useRef)(null),M=(0,d.useRef)({nodes:[],links:[]});(0,d.useEffect)((function(){b&&(M.current=b)}),[b]);var W=(0,d.useContext)(re.N).setEmacsTheme,X=u("3d",!1),_=(0,c.Z)(X,2),U=_[0],G=_[1],q=u("tagCols",{}),Q=(0,c.Z)(q,2),K=Q[0],J=Q[1],Y=(0,d.useState)({nodeIds:[]}),$=Y[0],ee=Y[1],ne=(0,d.useRef)({nodeIds:[]}),te=(0,d.useRef)(N);te.current=D;var ie=(0,d.useRef)(null);ne.current=$;var oe=function(e,n){var t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200;if("color"!==e){var o=V.current,l=ne.current,a=te.current,c=null!==(t=B.current[n])&&void 0!==t?t:[],d=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 console.log(l),l.nodeIds.length&&(console.log("emptying"),console.log("scope "+l.nodeIds),ee({nodeIds:[]})),void setTimeout((function(){return o.zoomToFit(r,i,(function(e){return d[e.id]}))}),50);if(!l.nodeIds.length)return ee({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50);if("add"!==a.localSame)return ee({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50);if(!l.nodeIds.includes(n)||!l.nodeIds.some((function(e){return d[e]})))return ee({nodeIds:[n]}),void setTimeout((function(){o.centerAt(0,0,r)}),50);ee((function(e){return ke(ke({},e),{},{nodeIds:[].concat((0,s.Z)(e.nodeIds),[n])})})),setTimeout((function(){return o.zoomToFit(r,i,(function(e){return d[e.id]}))}),50)}};return(0,d.useEffect)((function(){ie.current=new Ce.Z("ws://localhost:35903"),ie.current.addEventListener("open",(function(e){console.log("Connection with Emacs established")})),ie.current.addEventListener("message",(function(e){V.current;var n=te.current,t=JSON.parse(e.data);switch(t.type){case"graphdata":return function(e){var n,t=M.current,r=P.current;B.current,A.current=null!==(n=e.tags)&&void 0!==n?n:[];var i=e.nodes.reduce((function(e,n){var t;return ke(ke({},e),{},(0,a.Z)({},n.file,[].concat((0,s.Z)(null!==(t=e[n.file])&&void 0!==t?t:[]),[n])))}),{}),o=Object.keys(i).flatMap((function(e){var n,t=null!==(n=i[e])&&void 0!==n?n:[],r=t.find((function(e){return 0===e.level})),o=t.filter((function(e){return 0!==e.level}));return r?o.map((function(e){return{source:e.id,target:r.id,type:"parent"}})):[]}));P.current=Object.fromEntries(e.nodes.map((function(e){return[e.id,e]})));var l=[].concat((0,s.Z)(e.links),(0,s.Z)(o)),d=[],u=l.map((function(e){var n=e.source,t=e.target;return P.current[n]?P.current[t]?e:(d.push({id:t,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:t,level:0}),ke(ke({},e),{},{type:"bad"})):(d.push({id:n,tags:["bad"],properties:{FILELESS:"yes",bad:"yes"},file:"",title:n,level:0}),ke(ke({},e),{},{type:"bad"}))}));P.current=ke(ke({},P.current),Object.fromEntries(d.map((function(e){return[e.id,e]})))),B.current=u.reduce((function(e,n){var t,r,i;return ke(ke({},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 h={nodes:[].concat((0,s.Z)(e.nodes),d),links:u};if(!t.nodes.length){var g=JSON.parse(JSON.stringify(h));return console.log(g),M.current=g,void C(g)}var f=[].concat((0,s.Z)(t.nodes.map((function(e){var n,t=null!==(n=P.current[null===e||void 0===e?void 0:e.id])&&void 0!==n&&n;if(t)return ke(ke({},e),t)}))),(0,s.Z)(Object.keys(P.current).filter((function(e){return!r[e]})).map((function(e){return console.log(e),P.current[e]})))),x=f.reduce((function(e,n,t){var r=null===n||void 0===n?void 0:n.id;return ke(ke({},e),{},(0,a.Z)({},r,t))}),{});console.log(f),console.log(x);var p=u.map((function(e){var n=Oe(e),t=(0,c.Z)(n,2),r=t[0],i=t[1];return ke(ke({},e),{},{source:f[x[r]],target:f[x[i]]})}));V.current,C({nodes:f,links:p})}(t.data);case"theme":return W(t.data);case"command":switch(t.data.commandName){case"local":var r=D.zoomSpeed,i=D.zoomPadding;oe("local",t.data.id,r,i),w(t.data.id);break;case"zoom":var o,l,d=(null===t||void 0===t||null===(o=t.data)||void 0===o?void 0:o.speed)||n.zoomSpeed,u=(null===t||void 0===t||null===(l=t.data)||void 0===l?void 0:l.padding)||n.zoomPadding;oe("zoom",t.data.id,d,u),w(t.data.id);break;case"follow":oe(n.follow,t.data.id,n.zoomSpeed,n.zoomPadding),w(t.data.id);break;default:return console.error("unknown message type",t.type)}}}))}),[]),b?(0,l.jsxs)(j.xu,{display:"flex",alignItems:"flex-start",flexDirection:"row",height:"100%",overflow:"hidden",children:[(0,l.jsx)(le,ke(ke({},{physics:t,setPhysics:r,threeDim:U,setThreeDim:G,filter:h,setFilter:g,visuals:p,setVisuals:m,mouse:Z,setMouse:H,behavior:D,setBehavior:T,tagColors:K,setTagColors:J}),{},{tags:A.current})),(0,l.jsx)(j.xu,{position:"absolute",alignItems:"top",overflow:"hidden",children:(0,l.jsx)(ze,ke({ref:V,nodeById:P.current,linksByNodeId:B.current,webSocket:ie.current},{physics:t,graphData:b,threeDim:U,emacsNodeId:k,filter:h,visuals:p,behavior:D,mouse:Z,scope:$,setScope:ee,tagColors:K}))})]}):null}var ze=(0,d.forwardRef)((function(e,n){var t=e.physics,r=e.graphData,u=e.threeDim,h=e.linksByNodeId,v=e.filter,b=e.emacsNodeId,C=e.nodeById,y=e.visuals,k=e.behavior,w=e.mouse,I=e.scope,L=e.setScope,O=e.webSocket,N=e.tagColors,z=(0,f.iP)(),D=(0,c.Z)(z,2),T=D[0],E=D[1],F=(0,d.useState)(null),Z=F[0],H=F[1],P=(0,p.useTheme)(),B=(0,d.useContext)(re.N).emacsTheme,A=function(e,n){I.nodeIds.includes(e.id)||L("replace"!==n?function(n){return ke(ke({},n),{},{nodeIds:[].concat((0,s.Z)(n.nodeIds),[e.id])})}:{nodeIds:[e.id]})},V=function(e,n){O.send(JSON.stringify({command:e,data:n}))},M=function(e){V("open",{id:e.id})},W=function(e,n){switch(e){case w.local:A(n,k.localSame);break;case w.follow:M(n)}},X=(0,d.useRef)(null);(0,d.useEffect)((function(){b&&H(C[b])}),[b]),X.current=Z;var _=(0,d.useMemo)((function(){if(!X.current)return{};var e=h[X.current.id];return e?Object.fromEntries([X.current.id].concat((0,s.Z)(e.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]}))):{}}),[X.current,h]),U=(0,d.useRef)({}),G=((0,d.useRef)({}),(0,d.useMemo)((function(){var e;U.current={};var n=null===r||void 0===r||null===(e=r.nodes)||void 0===e?void 0:e.filter((function(e){if(e){var n=e;return v.tagsBlacklist.length&&v.tagsBlacklist.some((function(e){return n.tags.indexOf(e)>-1}))||v.tagsWhitelist.length>0&&!v.tagsWhitelist.some((function(e){return n.tags.indexOf(e)>-1}))||v.filelessCites&&n.properties.FILELESS?(U.current=ke(ke({},U.current),{},(0,a.Z)({},n.id,n)),!1):!v.bad||!n.properties.bad||(U.current=ke(ke({},U.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!U.current[e.source]&&!U.current[e.target]}));return!v.orphans||(v.parents?0!==t.length:0!==t.length&&t.some((function(e){return!["parent"].includes(e.type)})))})),t=n.map((function(e){return e.id}));return{filteredNodes:n,filteredLinks:r.links.filter((function(e){var n=Oe(e),r=(0,c.Z)(n,2),i=r[0],o=r[1];if(v.bad||v.tagsBlacklist.length||v.tagsWhitelist.length||v.filelessCites)return t.includes(i)&&t.includes(o);var l=e;return v.parents||"parent"!==l.type}))}}),[v,r])),q=(0,d.useMemo)((function(){var e=G.filteredNodes.filter((function(e){var n,t=null!==(n=h[e.id])&&void 0!==n?n:[];return I.nodeIds.includes(e.id)||t.some((function(e){return I.nodeIds.includes(e.source)||I.nodeIds.includes(e.target)}))})),n=e.map((function(e){return e.id})),t=G.filteredLinks.filter((function(e){var t=Oe(e),r=(0,c.Z)(t,2),i=r[0],o=r[1];return n.includes(i)&&n.includes(o)}));return 0===I.nodeIds.length?{nodes:G.filteredNodes,links:G.filteredLinks}:{nodes:e,links:t}}),[v,I,r]);(0,d.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,we;case 3:o=e.sent,t.gravityOn?(r.d3Force("x",o.forceX().strength(t.gravity)),r.d3Force("y",o.forceY().strength(t.gravity)),u&&r.d3Force("z",o.forceZ().strength(t.gravity))):(r.d3Force("x",null),r.d3Force("y",null),u&&r.d3Force("z",null)),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]),(0,d.useEffect)((function(){var e;null===(e=n.current)||void 0===e||e.d3ReheatSimulation()}),[t]);var Q=(0,d.useRef)(0),K=(0,d.useState)(1),J=K[0],Y=K[1],$=(0,x._7)((function(e){return Y(e)}),{duration:y.animationSpeed,algorithm:S[y.algorithmName]}),ee=(0,c.Z)($,2),ne=ee[0],te=ee[1],ie=(0,x._7)((function(e){return Y(Math.min(J,-1*(e-1)))}),{duration:y.animationSpeed,algorithm:S[y.algorithmName]}),oe=(0,c.Z)(ie,2),le=oe[0],se=oe[1],ae=(0,d.useRef)(null);(0,d.useEffect)((function(){if(Z&&(ae.current=Z),!y.highlightAnim)return Y(Z?1:0);Z?ne():(te(),J>.5?le():Y(0))}),[Z]);var ce=function(e){if(P)return e.split(".").reduce((function(e,n){return e[n]}),P.colors)},de=(0,d.useMemo)((function(){return Object.fromEntries(R.map((function(e){var n=ce(e),t=R.map((function(e){return[e,g.Z(n,ce(e))]}));return[e,Object.fromEntries(t)]})))}),[B]),ue=(0,d.useMemo)((function(){var e,n,t,r=null!==(e=h[null===(n=ae.current)||void 0===n?void 0:n.id])&&void 0!==e?e:[];return Object.fromEntries([null===(t=ae.current)||void 0===t?void 0:t.id].concat((0,s.Z)(r.flatMap((function(e){return[e.source,e.target]})))).map((function(e){return[e,{}]})))}),[JSON.stringify(Z),ae.current]),he=function(e){var n,t,r,i,o,l,s=null!==(n=null===(t=h[e])||void 0===t?void 0:t.length)&&void 0!==n?n:0,a=s?null===(r=h[e])||void 0===r?void 0:r.filter((function(e){return"parent"===e.type})).length:0,c=v.parents?s:s-a;return y.nodeColorScheme[(i=c,o=0,l=y.nodeColorScheme.length-1,Math.min(Math.max(i,o),l))]},ge=function(e,n){return h[e]>h[n]?he(e):he(n)},fe=function(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(",")+")"},xe=(0,d.useMemo)((function(){return ce(y.labelTextColor)}),[y.labelTextColor,B]),pe=(0,d.useMemo)((function(){return ce(y.labelBackgroundColor)}),[y.labelBackgroundColor,B]),je=function(e){var n,t=null!==(n=h[e.id])&&void 0!==n?n:[],r=t.length?t.filter((function(e){return"parent"===e.type})).length:0,i=3+t.length*y.nodeSizeLinks-(v.parents?0:r);return 1===y.highlightNodeSize?i:i*(_[e.id]||ue[e.id]?1+J*(y.highlightNodeSize-1):1)},me=(0,d.useState)(!1),Ce=me[0],ye=me[1],Le=(0,m.q)(),Ne=Le.isOpen,ze=Le.onOpen,De=Le.onClose,Te=(0,d.useState)(null),Ee=Te[0],Fe=Te[1],Ze=(0,d.useState)([0,0]),He=Ze[0],Pe=Ze[1],Be={graphData:q,width:T,height:E,backgroundColor:P.colors.gray[y.backgroundColor],nodeLabel:function(e){return e.title},nodeColor:function(e){return function(e){_.length;var n=_[e.id]||ue[e.id];if(y.emacsNodeColor&&e.id===b)return ce(y.emacsNodeColor);if(N&&e.tags.some((function(e){return N[e]}))){var t=N[e.tags.filter((function(e){return N[e]}))[0]];return de[t][y.backgroundColor](y.highlightFade*J)}return y.citeNodeColor&&e.properties.ROAM_REFS&&e.properties.FILELESS?n?ce(y.citeNodeColor):de[y.citeNodeColor][y.backgroundColor](y.highlightFade*J):y.refNodeColor&&e.properties.ROAM_REFS?n?ce(y.refNodeColor):de[y.refNodeColor][y.backgroundColor](y.highlightFade*J):n?y.nodeHighlight?de[he(e.id)][y.nodeHighlight](J):ce(he(e.id)):de[he(e.id)][y.backgroundColor](y.highlightFade*J)}(e)},nodeRelSize:y.nodeRel,nodeVal:function(e){return je(e)},nodeCanvasObject:function(e,n,t){if(e&&!Ce&&y.labels){var r=ue[e.id];if(!(t<=y.labelScale||1===y.labels)||_[e.id]||r){var i=e.title,o=i.substring(0,Math.min(i.length,40)),l=14/(.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-y.labelScale)/y.labelScale,1),d=function(){return 1===y.labels||t<=y.labelScale?J:_[e.id]||ue[e.id]?Math.max(c,J):1*c*(-1*(y.highlightFade*J-1))},u=8*Math.cbrt(je(e)*y.nodeRel);if(y.labelBackgroundColor&&y.labelBackgroundOpacity){var h=d()*y.labelBackgroundOpacity,g=fe(pe,h);n.fillStyle=g,n.fillRect.apply(n,[e.x-a[0]/2,e.y-a[1]/2+u].concat((0,s.Z)(a)))}var f=d();n.textAlign="center",n.textBaseline="middle";var x=fe(xe,f);n.fillStyle=x,n.font="".concat(l,"px Sans-Serif"),n.fillText(o,e.x,e.y+u)}}},nodeCanvasObjectMode:function(){return"after"},linkDirectionalParticles:y.particles?y.particlesNumber:void 0,linkDirectionalArrowLength:y.arrows?y.arrowsLength:void 0,linkDirectionalArrowRelPos:y.arrowsPos,linkDirectionalArrowColor:y.arrowsColor?function(e){return ce(y.arrowsColor)}:void 0,linkColor:function(e){var n="object"===typeof e.source?e.source.id:e.source,t="object"===typeof e.target?e.target.id:e.target,r=Re(e,X.current),i=Re(e,ae.current),o=r||i,l=e;return y.refLinkColor&&"ref"===l.type?o&&(y.refLinkHighlightColor||y.linkHighlight)?de[y.refLinkColor][y.refLinkHighlightColor||y.linkHighlight](J):de[y.refLinkColor][y.backgroundColor](y.highlightFade*J):y.citeLinkColor&&"cite"===l.type?o&&(y.citeLinkHighlightColor||y.linkHighlight)?de[y.citeLinkColor][y.citeLinkHighlightColor||y.linkHighlight](J):de[y.citeLinkColor][y.backgroundColor](y.highlightFade*J):function(e,n,t){if(!y.linkHighlight&&!y.linkColorScheme&&!t){var r=ge(e,n);return ce(r)}if(!t&&!y.linkColorScheme){var i=ge(e,n);return de[i][y.backgroundColor](y.highlightFade*J)}if(!t)return de[y.linkColorScheme][y.backgroundColor](y.highlightFade*J);if(!y.linkHighlight&&!y.linkColorScheme){var o=ge(e,n);return ce(o)}return y.linkHighlight?y.linkColorScheme?de[y.linkColorScheme][y.linkHighlight](J):de[ge(e,n)][y.linkHighlight](J):ce(y.linkColorScheme)}(n,t,o)},linkWidth:function(e){if(1===y.highlightLinkSize)return y.linkWidth;var n=Re(e,X.current),t=Re(e,ae.current);return n||t?y.linkWidth*(1+J*(y.highlightLinkSize-1)):y.linkWidth},linkDirectionalParticleWidth:y.particlesWidth,d3AlphaDecay:t.alphaDecay,d3AlphaMin:t.alphaMin,d3VelocityDecay:t.velocityDecay,onNodeClick:function(e,n){var t=e;De();var r=n.timeStamp-Q.current<400;return Q.current=n.timeStamp,W(r?"double":"click",t)},onBackgroundClick:function(){De(),H(null),0!==I.nodeIds.length&&L((function(e){return ke(ke({},e),{},{nodeIds:[]})}))},onNodeHover:function(e){y.highlight&&(Z||(se(),Y(0)),H(e))},onNodeRightClick:function(e,n){!function(e,n){Pe([n.pageX,n.pageY]),Fe(e),ze()}(e,n)},onNodeDrag:function(e){De(),H(e),ye(!0)},onNodeDragEnd:function(e){H(null),ye(!1)}};return(0,l.jsxs)(j.xu,{overflow:"hidden",children:[Ne&&(0,l.jsx)(ve,{scope:I,node:Ee,nodeType:null===Ee||void 0===Ee?void 0:Ee.id,background:!1,coordinates:He,handleLocal:A,menuClose:De,openNodeInEmacs:M,deleteNodeInEmacs:function(e){0===e.level&&V("delete",{id:e.id,file:e.file})},createNodeInEmacs:function(e){V("create",{id:e.id,title:e.title,ref:e.properties.ROAM_REFS})}}),u?(0,l.jsx)(Ie,ke(ke({ref:n},Be),{},{nodeThreeObjectExtend:!0,backgroundColor:P.colors.white,nodeOpacity:y.nodeOpacity,nodeResolution:y.nodeResolution,linkOpacity:y.linkOpacity,nodeThreeObject:function(e){if(y.labels&&(!(y.labels<3)||_[e.id])){var n=new be.Z(e.title.substring(0,40));return n.color=ce(y.labelTextColor),n.backgroundColor=ce(y.labelBackgroundColor),n.padding=2,n.textHeight=8,n}}})):(0,l.jsx)(Se,ke(ke({ref:n},Be),{},{linkLineDash:function(e){var n=e;return y.citeDashes&&"cite"===n.type?[y.citeDashLength,y.citeGapLength]:y.refDashes&&"ref"==n.type?[y.refDashLength,y.refGapLength]:null}}))]})}));function Re(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)}},45301:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(96834)}])}},function(e){e.O(0,[774,737,446,238,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