@reddb-io/ui 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/build/404.html +10 -10
  2. package/build/_app/immutable/chunks/{BVl6pBRc.js → C3QbliX6.js} +6 -6
  3. package/build/_app/immutable/chunks/{DWBmncSs.js → CRcUHjOC.js} +1 -1
  4. package/build/_app/immutable/chunks/{kV8hsQzl.js → Dblyp_YC.js} +1 -1
  5. package/build/_app/immutable/chunks/QTZ_pxoY.js +1 -0
  6. package/build/_app/immutable/chunks/{Dc8lKBnh.js → RBJGFHIL.js} +8 -8
  7. package/build/_app/immutable/chunks/Uan23_-U.js +9 -0
  8. package/build/_app/immutable/entry/{app.ClFhgICw.js → app.DyPXqkIP.js} +2 -2
  9. package/build/_app/immutable/entry/start.BBR6s3gw.js +1 -0
  10. package/build/_app/immutable/nodes/{0.DnxEB_UF.js → 0.jHk_xbql.js} +2 -2
  11. package/build/_app/immutable/nodes/{1.DTJl_4yI.js → 1.DG6cNRZC.js} +1 -1
  12. package/build/_app/immutable/nodes/10.Cf1044jB.js +1 -0
  13. package/build/_app/immutable/nodes/{15.aWdEGw6h.js → 15.B_-RXVqx.js} +4 -4
  14. package/build/_app/version.json +1 -1
  15. package/build/analytics.html +10 -10
  16. package/build/appearance.html +10 -10
  17. package/build/ask.html +10 -10
  18. package/build/cluster.html +10 -10
  19. package/build/collections.html +10 -10
  20. package/build/graph.html +11 -12
  21. package/build/index.html +10 -10
  22. package/build/query.html +10 -10
  23. package/build/redwire-ws-spike.html +10 -10
  24. package/build/security.html +10 -10
  25. package/build/settings.html +10 -10
  26. package/build/shadow-dom-spike.html +11 -11
  27. package/dist/embed/{AnalyticsView-DJ0Y_Zv4.js → AnalyticsView-Bc4NYbS5.js} +2405 -2416
  28. package/dist/embed/AnalyticsView-Bc4NYbS5.js.map +1 -0
  29. package/dist/embed/{RedUiEmbedRoot-CoCFK0ru.js → RedUiEmbedRoot-BUcz7vnW.js} +11899 -11620
  30. package/dist/embed/RedUiEmbedRoot-BUcz7vnW.js.map +1 -0
  31. package/dist/embed/{index-DpTEAkP_.js → index-C3zysLt8.js} +4 -4
  32. package/dist/embed/{index-DpTEAkP_.js.map → index-C3zysLt8.js.map} +1 -1
  33. package/dist/embed/{index-client-mxz2no-1.js → index-client-esdlRozF.js} +2 -2
  34. package/dist/embed/{index-client-mxz2no-1.js.map → index-client-esdlRozF.js.map} +1 -1
  35. package/dist/embed/index.js +1 -1
  36. package/dist/embed/{sigma.esm-CS_13_LV.js → sigma.esm-Ds5a5Bdj.js} +2 -2
  37. package/dist/embed/{sigma.esm-CS_13_LV.js.map → sigma.esm-Ds5a5Bdj.js.map} +1 -1
  38. package/package.json +3 -3
  39. package/src/lib/Topbar.svelte +7 -6
  40. package/build/_app/immutable/chunks/BhXOdBY3.js +0 -5
  41. package/build/_app/immutable/chunks/CFwxJx29.js +0 -1
  42. package/build/_app/immutable/chunks/DRlh90Cv.js +0 -1
  43. package/build/_app/immutable/entry/start.CkIHSDqO.js +0 -1
  44. package/build/_app/immutable/nodes/10.DvpOZduu.js +0 -1
  45. package/dist/embed/AnalyticsView-DJ0Y_Zv4.js.map +0 -1
  46. package/dist/embed/RedUiEmbedRoot-CoCFK0ru.js.map +0 -1
@@ -1 +1 @@
1
- import{a as e,p as r}from"./CFwxJx29.js";const t={get error(){return r.error},get status(){return r.status},get url(){return r.url}};e.updated.check;const a=t;export{a as p};
1
+ import{a as e,p as r}from"./QTZ_pxoY.js";const t={get error(){return r.error},get status(){return r.status},get url(){return r.url}};e.updated.check;const a=t;export{a as p};
@@ -1,2 +1,2 @@
1
- import{h as Y,f as O,e as Z,d as j,j as Q,o as Re,p as Ne,q as Me,N as Ge,b as Ie,E as Fe,i as v,g as c,k as ne,s as ge,n as ve,l as ze,_ as Ae}from"./DqvWKbSc.js";import{p as Ue,y as He,r as Be}from"./Dc8lKBnh.js";var ue=(function(s){function n(){var i;return Z(this,n),i=j(this,n),i.rawEmitter=i,i}return Y(n,s),O(n)})(Ue.EventEmitter),We=He();const Oe=Be(We);var Ze=function(n){return n},_e=function(n){return n*n},Ve=function(n){return n*(2-n)},qe=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},Ye=function(n){return n*n*n},je=function(n){return--n*n*n+1},Xe=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},Ke={linear:Ze,quadraticIn:_e,quadraticOut:Ve,quadraticInOut:qe,cubicIn:Ye,cubicOut:je,cubicInOut:Xe},Je={easing:"quadraticInOut",duration:150};function N(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ee(s,n,i){return s[0]=n,s[4]=typeof i=="number"?i:n,s}function fe(s,n){var i=Math.sin(n),e=Math.cos(n);return s[0]=e,s[1]=i,s[3]=-i,s[4]=e,s}function me(s,n,i){return s[6]=n,s[7]=i,s}function W(s,n){var i=s[0],e=s[1],t=s[2],a=s[3],r=s[4],o=s[5],h=s[6],d=s[7],l=s[8],u=n[0],g=n[1],f=n[2],m=n[3],p=n[4],y=n[5],E=n[6],b=n[7],x=n[8];return s[0]=u*i+g*a+f*h,s[1]=u*e+g*r+f*d,s[2]=u*t+g*o+f*l,s[3]=m*i+p*a+y*h,s[4]=m*e+p*r+y*d,s[5]=m*t+p*o+y*l,s[6]=E*i+b*a+x*h,s[7]=E*e+b*r+x*d,s[8]=E*t+b*o+x*l,s}function de(s,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=s[0],t=s[1],a=s[3],r=s[4],o=s[6],h=s[7],d=n.x,l=n.y;return{x:d*e+l*a+o*i,y:d*t+l*r+h*i}}function Qe(s,n){var i=s.height/s.width,e=n.height/n.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function X(s,n,i,e,t){var a=s.angle,r=s.ratio,o=s.x,h=s.y,d=n.width,l=n.height,u=N(),g=Math.min(d,l)-2*e,f=Qe(n,i);return t?(W(u,me(N(),o,h)),W(u,ee(N(),r)),W(u,fe(N(),a)),W(u,ee(N(),d/g/2/f,l/g/2/f))):(W(u,ee(N(),2*(g/d)*f,2*(g/l)*f)),W(u,fe(N(),-a)),W(u,ee(N(),1/r)),W(u,me(N(),-o,-h))),u}function $e(s,n,i){var e=de(s,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),t=e.x,a=e.y;return 1/Math.sqrt(Math.pow(t,2)+Math.pow(a,2))/i.width}function et(s){if(!s.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,e=1/0,t=-1/0;return s.forEachNode(function(a,r){var o=r.x,h=r.y;o<n&&(n=o),o>i&&(i=o),h<e&&(e=h),h>t&&(t=h)}),{x:[n,i],y:[e,t]}}function tt(s){if(!Oe(s))throw new Error("Sigma: invalid graph instance.");s.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function it(s,n,i){var e=document.createElement(s);if(n)for(var t in n)e.style[t]=n[t];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function pe(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ye(s,n,i){return i.sort(function(e,t){var a=n(e)||0,r=n(t)||0;return a<r?-1:a>r?1:0})}function be(s){var n=Q(s.x,2),i=n[0],e=n[1],t=Q(s.y,2),a=t[0],r=t[1],o=Math.max(e-i,r-a),h=(e+i)/2,d=(r+a)/2;(o===0||Math.abs(o)===1/0||isNaN(o))&&(o=1),isNaN(h)&&(h=0),isNaN(d)&&(d=0);var l=function(g){return{x:.5+(g.x-h)/o,y:.5+(g.y-d)/o}};return l.applyTo=function(u){u.x=.5+(u.x-h)/o,u.y=.5+(u.y-d)/o},l.inverse=function(u){return{x:h+o*(u.x-.5),y:d+o*(u.y-.5)}},l.ratio=o,l}function le(s){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},le(s)}function xe(s,n){var i=n.size;if(i!==0){var e=s.length;s.length+=i;var t=0;n.forEach(function(a){s[e+t]=a,t++})}}function se(s){s=s||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n<i;n++){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];e&&Object.assign(s,e)}return s}var ce={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Me,defaultDrawNodeLabel:Ne,defaultDrawNodeHover:Re,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},at={circle:Ge},rt={arrow:Fe,line:Ie};function oe(s){if(typeof s.labelDensity!="number"||s.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var n=s.minCameraRatio,i=s.maxCameraRatio;if(typeof n=="number"&&typeof i=="number"&&i<n)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function nt(s){var n=se({},ce,s);return n.nodeProgramClasses=se({},at,n.nodeProgramClasses),n.edgeProgramClasses=se({},rt,n.edgeProgramClasses),n}var te=1.5,Ce=(function(s){function n(){var i;return Z(this,n),i=j(this,n),c(i,"x",.5),c(i,"y",.5),c(i,"angle",0),c(i,"ratio",1),c(i,"minRatio",null),c(i,"maxRatio",null),c(i,"enabledZooming",!0),c(i,"enabledPanning",!0),c(i,"enabledRotation",!0),c(i,"clean",null),c(i,"nextFrame",null),c(i,"previousState",null),c(i,"enabled",!0),i.previousState=i.getState(),i}return Y(n,s),O(n,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return typeof this.minRatio=="number"&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio=="number"&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&typeof e.x=="number"&&(t.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(t.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(t.angle=e.angle),this.clean?this.clean(v(v({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x=="number"&&(this.x=t.x),typeof t.y=="number"&&(this.y=t.y),typeof t.ratio=="number"&&(this.ratio=t.ratio),typeof t.angle=="number"&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(f){return t.animate(e,a,f)});if(this.enabled){var o=v(v({},Je),a),h=this.validateState(e),d=typeof o.easing=="function"?o.easing:Ke[o.easing],l=Date.now(),u=this.getState(),g=function(){var m=(Date.now()-l)/o.duration;if(m>=1){t.nextFrame=null,t.setState(h),t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0);return}var p=d(m),y={};typeof h.x=="number"&&(y.x=u.x+(h.x-u.x)*p),typeof h.y=="number"&&(y.y=u.y+(h.y-u.y)*p),t.enabledRotation&&typeof h.angle=="number"&&(y.angle=u.angle+(h.angle-u.angle)*p),typeof h.ratio=="number"&&(y.ratio=u.ratio+(h.ratio-u.ratio)*p),t.setState(y),t.nextFrame=requestAnimationFrame(g)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(g)):g(),this.animationCallback=r}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||te)},e):this.animate({ratio:this.ratio/te})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||te)},e):this.animate({ratio:this.ratio*te})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){var t=new n;return t.setState(e)}}])})(ue);function M(s,n){var i=n.getBoundingClientRect();return{x:s.clientX-i.left,y:s.clientY-i.top}}function F(s,n){var i=v(v({},M(s,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:s});return i}function K(s){var n="x"in s?s:v(v({},s.touches[0]||s.previousTouches[0]),{},{original:s.original,sigmaDefaultPrevented:s.sigmaDefaultPrevented,preventSigmaDefault:function(){s.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function st(s,n){return v(v({},F(s,n)),{},{delta:Te(s)})}var ot=2;function ie(s){for(var n=[],i=0,e=Math.min(s.length,ot);i<e;i++)n.push(s[i]);return n}function J(s,n,i){var e={touches:ie(s.touches).map(function(t){return M(t,i)}),previousTouches:n.map(function(t){return M(t,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:s};return e}function Te(s){if(typeof s.deltaY<"u")return s.deltaY*-3/360;if(typeof s.detail<"u")return s.detail/-9;throw new Error("Captor: could not extract delta from event.")}var De=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n),t.container=i,t.renderer=e,t}return Y(n,s),O(n)})(ue),ht=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],dt=ht.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),lt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"draggedEvents",0),c(t,"downStartTime",null),c(t,"lastMouseX",null),c(t,"lastMouseY",null),c(t,"isMouseDown",!1),c(t,"isMoving",!1),c(t,"movingTimeout",null),c(t,"startCameraState",null),c(t,"clicks",0),c(t,"doubleClickTimeout",null),c(t,"currentWheelDirection",0),c(t,"settings",dt),t.handleClick=t.handleClick.bind(t),t.handleRightClick=t.handleRightClick.bind(t),t.handleDown=t.handleDown.bind(t),t.handleUp=t.handleUp.bind(t),t.handleMove=t.handleMove.bind(t),t.handleWheel=t.handleWheel.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleEnter=t.handleEnter.bind(t),i.addEventListener("click",t.handleClick,{capture:!1}),i.addEventListener("contextmenu",t.handleRightClick,{capture:!1}),i.addEventListener("mousedown",t.handleDown,{capture:!1}),i.addEventListener("wheel",t.handleWheel,{capture:!1}),i.addEventListener("mouseleave",t.handleLeave,{capture:!1}),i.addEventListener("mouseenter",t.handleEnter,{capture:!1}),document.addEventListener("mousemove",t.handleMove,{capture:!1}),document.addEventListener("mouseup",t.handleUp,{capture:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",F(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",F(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=F(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var a=this.renderer.getCamera(),r=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(M(e,this.container),r),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=M(e,this.container),a=t.x,r=t.y;this.lastMouseX=a,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",F(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=M(e,this.container),o=r.x,h=r.y,d=a.getState(),l=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:d.x+this.settings.inertiaRatio*(d.x-l.x),y:d.y+this.settings.inertiaRatio*(d.y-l.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==o||this.lastMouseY!==h)&&a.setState({x:d.x,y:d.y}),this.isMoving=!1,setTimeout(function(){var u=t.draggedEvents>0;t.draggedEvents=0,u&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()},0),this.emit("mouseup",F(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var a=F(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),o=M(e,this.container),h=o.x,d=o.y,l=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),u=this.renderer.viewportToFramedGraph({x:h,y:d}),g=l.x-u.x,f=l.y-u.y,m=r.getState(),p=m.x+g,y=m.y+f;r.setState({x:p,y}),this.lastMouseX=h,this.lastMouseY=d,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",F(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",F(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var r=Te(e);if(r){var o=st(e,this.container);if(this.emit("wheel",o),o.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var h=a.getState().ratio,d=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,l=a.getBoundedRatio(h*d),u=r>0?1:-1,g=Date.now();h!==l&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===u&&this.lastWheelTriggerTime&&g-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(M(e,this.container),l),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=u,this.lastWheelTriggerTime=g))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De),ut=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],ct=ut.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),gt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"isMoving",!1),c(t,"hasMoved",!1),c(t,"touchMode",0),c(t,"startTouchesPositions",[]),c(t,"lastTouches",[]),c(t,"lastTap",null),c(t,"settings",ct),t.handleStart=t.handleStart.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleMove=t.handleMove.bind(t),i.addEventListener("touchstart",t.handleStart,{capture:!1}),i.addEventListener("touchcancel",t.handleLeave,{capture:!1}),document.addEventListener("touchend",t.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",t.handleMove,{capture:!1,passive:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var a=ie(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return M(f,t.container)}),this.touchMode===2){var r=Q(this.startTouchesPositions,2),o=r[0],h=o.x,d=o.y,l=r[1],u=l.x,g=l.y;this.startTouchesAngle=Math.atan2(g-d,u-h),this.startTouchesDistance=Math.sqrt(Math.pow(u-h,2)+Math.pow(g-d,2))}this.emit("touchdown",J(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),a=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:a.x+this.settings.inertiaRatio*(a.x-r.x),y:a.y+this.settings.inertiaRatio*(a.y-r.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",J(e,this.lastTouches,this.container)),!e.touches.length){var o=M(this.lastTouches[0],this.container),h=this.startTouchesPositions[0],d=Math.pow(o.x-h.x,2)+Math.pow(o.y-h.y,2);if(!e.touches.length&&d<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var l=J(e,this.lastTouches,this.container);if(this.emit("doubletap",l),this.lastTap=null,!l.sigmaDefaultPrevented){var u=this.renderer.getCamera(),g=u.getBoundedRatio(u.getState().ratio/this.settings.doubleClickZoomingRatio);u.animate(this.renderer.getViewportZoomedState(o,g),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=J(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=ie(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=ie(e.touches),r=a.map(function(B){return M(B,t.container)}),o=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=r;var h=J(e,o,this.container);if(this.emit("touchmove",h),!h.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=r.some(function(B,ae){var G=t.startTouchesPositions[ae];return G&&(B.x!==G.x||B.y!==G.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var d=this.renderer.getCamera(),l=this.startCameraState,u=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var g=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=g.x,m=g.y,p=this.renderer.viewportToFramedGraph(r[0]),y=p.x,E=p.y;d.setState({x:l.x+f-y,y:l.y+m-E});break}case 2:{var b={x:.5,y:.5,angle:0,ratio:1},x=r[0],C=x.x,I=x.y,A=r[1],w=A.x,k=A.y,T=Math.atan2(k-I,w-C)-this.startTouchesAngle,L=Math.hypot(k-I,w-C)/this.startTouchesDistance,D=d.getBoundedRatio(l.ratio/L);b.ratio=D,b.angle=l.angle+T;var S=this.getDimensions(),_=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:l}),P=Math.min(S.width,S.height)-2*u,R=P/S.width,U=P/S.height,$=D/P,q=C-P/2/R,V=I-P/2/U,H=[q*Math.cos(-b.angle)-V*Math.sin(-b.angle),V*Math.cos(-b.angle)+q*Math.sin(-b.angle)];q=H[0],V=H[1],b.x=_.x-q*$,b.y=_.y+V*$,d.setState(b);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De);function vt(s){if(Array.isArray(s))return Ae(s)}function ft(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function mt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{h as Y,f as O,e as Z,d as j,j as Q,o as Re,p as Ne,q as Me,N as Ge,b as Ie,E as Fe,i as v,g as c,k as ne,s as ge,n as ve,l as ze,_ as Ae}from"./DqvWKbSc.js";import{p as Ue,z as He,r as Be}from"./RBJGFHIL.js";var ue=(function(s){function n(){var i;return Z(this,n),i=j(this,n),i.rawEmitter=i,i}return Y(n,s),O(n)})(Ue.EventEmitter),We=He();const Oe=Be(We);var Ze=function(n){return n},_e=function(n){return n*n},Ve=function(n){return n*(2-n)},qe=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},Ye=function(n){return n*n*n},je=function(n){return--n*n*n+1},Xe=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},Ke={linear:Ze,quadraticIn:_e,quadraticOut:Ve,quadraticInOut:qe,cubicIn:Ye,cubicOut:je,cubicInOut:Xe},Je={easing:"quadraticInOut",duration:150};function N(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ee(s,n,i){return s[0]=n,s[4]=typeof i=="number"?i:n,s}function fe(s,n){var i=Math.sin(n),e=Math.cos(n);return s[0]=e,s[1]=i,s[3]=-i,s[4]=e,s}function me(s,n,i){return s[6]=n,s[7]=i,s}function W(s,n){var i=s[0],e=s[1],t=s[2],a=s[3],r=s[4],o=s[5],h=s[6],d=s[7],l=s[8],u=n[0],g=n[1],f=n[2],m=n[3],p=n[4],y=n[5],E=n[6],b=n[7],x=n[8];return s[0]=u*i+g*a+f*h,s[1]=u*e+g*r+f*d,s[2]=u*t+g*o+f*l,s[3]=m*i+p*a+y*h,s[4]=m*e+p*r+y*d,s[5]=m*t+p*o+y*l,s[6]=E*i+b*a+x*h,s[7]=E*e+b*r+x*d,s[8]=E*t+b*o+x*l,s}function de(s,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=s[0],t=s[1],a=s[3],r=s[4],o=s[6],h=s[7],d=n.x,l=n.y;return{x:d*e+l*a+o*i,y:d*t+l*r+h*i}}function Qe(s,n){var i=s.height/s.width,e=n.height/n.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function X(s,n,i,e,t){var a=s.angle,r=s.ratio,o=s.x,h=s.y,d=n.width,l=n.height,u=N(),g=Math.min(d,l)-2*e,f=Qe(n,i);return t?(W(u,me(N(),o,h)),W(u,ee(N(),r)),W(u,fe(N(),a)),W(u,ee(N(),d/g/2/f,l/g/2/f))):(W(u,ee(N(),2*(g/d)*f,2*(g/l)*f)),W(u,fe(N(),-a)),W(u,ee(N(),1/r)),W(u,me(N(),-o,-h))),u}function $e(s,n,i){var e=de(s,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),t=e.x,a=e.y;return 1/Math.sqrt(Math.pow(t,2)+Math.pow(a,2))/i.width}function et(s){if(!s.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,e=1/0,t=-1/0;return s.forEachNode(function(a,r){var o=r.x,h=r.y;o<n&&(n=o),o>i&&(i=o),h<e&&(e=h),h>t&&(t=h)}),{x:[n,i],y:[e,t]}}function tt(s){if(!Oe(s))throw new Error("Sigma: invalid graph instance.");s.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function it(s,n,i){var e=document.createElement(s);if(n)for(var t in n)e.style[t]=n[t];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function pe(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ye(s,n,i){return i.sort(function(e,t){var a=n(e)||0,r=n(t)||0;return a<r?-1:a>r?1:0})}function be(s){var n=Q(s.x,2),i=n[0],e=n[1],t=Q(s.y,2),a=t[0],r=t[1],o=Math.max(e-i,r-a),h=(e+i)/2,d=(r+a)/2;(o===0||Math.abs(o)===1/0||isNaN(o))&&(o=1),isNaN(h)&&(h=0),isNaN(d)&&(d=0);var l=function(g){return{x:.5+(g.x-h)/o,y:.5+(g.y-d)/o}};return l.applyTo=function(u){u.x=.5+(u.x-h)/o,u.y=.5+(u.y-d)/o},l.inverse=function(u){return{x:h+o*(u.x-.5),y:d+o*(u.y-.5)}},l.ratio=o,l}function le(s){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},le(s)}function xe(s,n){var i=n.size;if(i!==0){var e=s.length;s.length+=i;var t=0;n.forEach(function(a){s[e+t]=a,t++})}}function se(s){s=s||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n<i;n++){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];e&&Object.assign(s,e)}return s}var ce={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Me,defaultDrawNodeLabel:Ne,defaultDrawNodeHover:Re,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},at={circle:Ge},rt={arrow:Fe,line:Ie};function oe(s){if(typeof s.labelDensity!="number"||s.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var n=s.minCameraRatio,i=s.maxCameraRatio;if(typeof n=="number"&&typeof i=="number"&&i<n)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function nt(s){var n=se({},ce,s);return n.nodeProgramClasses=se({},at,n.nodeProgramClasses),n.edgeProgramClasses=se({},rt,n.edgeProgramClasses),n}var te=1.5,Ce=(function(s){function n(){var i;return Z(this,n),i=j(this,n),c(i,"x",.5),c(i,"y",.5),c(i,"angle",0),c(i,"ratio",1),c(i,"minRatio",null),c(i,"maxRatio",null),c(i,"enabledZooming",!0),c(i,"enabledPanning",!0),c(i,"enabledRotation",!0),c(i,"clean",null),c(i,"nextFrame",null),c(i,"previousState",null),c(i,"enabled",!0),i.previousState=i.getState(),i}return Y(n,s),O(n,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return typeof this.minRatio=="number"&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio=="number"&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&typeof e.x=="number"&&(t.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(t.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(t.angle=e.angle),this.clean?this.clean(v(v({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x=="number"&&(this.x=t.x),typeof t.y=="number"&&(this.y=t.y),typeof t.ratio=="number"&&(this.ratio=t.ratio),typeof t.angle=="number"&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(f){return t.animate(e,a,f)});if(this.enabled){var o=v(v({},Je),a),h=this.validateState(e),d=typeof o.easing=="function"?o.easing:Ke[o.easing],l=Date.now(),u=this.getState(),g=function(){var m=(Date.now()-l)/o.duration;if(m>=1){t.nextFrame=null,t.setState(h),t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0);return}var p=d(m),y={};typeof h.x=="number"&&(y.x=u.x+(h.x-u.x)*p),typeof h.y=="number"&&(y.y=u.y+(h.y-u.y)*p),t.enabledRotation&&typeof h.angle=="number"&&(y.angle=u.angle+(h.angle-u.angle)*p),typeof h.ratio=="number"&&(y.ratio=u.ratio+(h.ratio-u.ratio)*p),t.setState(y),t.nextFrame=requestAnimationFrame(g)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(g)):g(),this.animationCallback=r}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||te)},e):this.animate({ratio:this.ratio/te})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||te)},e):this.animate({ratio:this.ratio*te})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){var t=new n;return t.setState(e)}}])})(ue);function M(s,n){var i=n.getBoundingClientRect();return{x:s.clientX-i.left,y:s.clientY-i.top}}function F(s,n){var i=v(v({},M(s,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:s});return i}function K(s){var n="x"in s?s:v(v({},s.touches[0]||s.previousTouches[0]),{},{original:s.original,sigmaDefaultPrevented:s.sigmaDefaultPrevented,preventSigmaDefault:function(){s.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function st(s,n){return v(v({},F(s,n)),{},{delta:Te(s)})}var ot=2;function ie(s){for(var n=[],i=0,e=Math.min(s.length,ot);i<e;i++)n.push(s[i]);return n}function J(s,n,i){var e={touches:ie(s.touches).map(function(t){return M(t,i)}),previousTouches:n.map(function(t){return M(t,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:s};return e}function Te(s){if(typeof s.deltaY<"u")return s.deltaY*-3/360;if(typeof s.detail<"u")return s.detail/-9;throw new Error("Captor: could not extract delta from event.")}var De=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n),t.container=i,t.renderer=e,t}return Y(n,s),O(n)})(ue),ht=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],dt=ht.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),lt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"draggedEvents",0),c(t,"downStartTime",null),c(t,"lastMouseX",null),c(t,"lastMouseY",null),c(t,"isMouseDown",!1),c(t,"isMoving",!1),c(t,"movingTimeout",null),c(t,"startCameraState",null),c(t,"clicks",0),c(t,"doubleClickTimeout",null),c(t,"currentWheelDirection",0),c(t,"settings",dt),t.handleClick=t.handleClick.bind(t),t.handleRightClick=t.handleRightClick.bind(t),t.handleDown=t.handleDown.bind(t),t.handleUp=t.handleUp.bind(t),t.handleMove=t.handleMove.bind(t),t.handleWheel=t.handleWheel.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleEnter=t.handleEnter.bind(t),i.addEventListener("click",t.handleClick,{capture:!1}),i.addEventListener("contextmenu",t.handleRightClick,{capture:!1}),i.addEventListener("mousedown",t.handleDown,{capture:!1}),i.addEventListener("wheel",t.handleWheel,{capture:!1}),i.addEventListener("mouseleave",t.handleLeave,{capture:!1}),i.addEventListener("mouseenter",t.handleEnter,{capture:!1}),document.addEventListener("mousemove",t.handleMove,{capture:!1}),document.addEventListener("mouseup",t.handleUp,{capture:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",F(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",F(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=F(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var a=this.renderer.getCamera(),r=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(M(e,this.container),r),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=M(e,this.container),a=t.x,r=t.y;this.lastMouseX=a,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",F(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=M(e,this.container),o=r.x,h=r.y,d=a.getState(),l=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:d.x+this.settings.inertiaRatio*(d.x-l.x),y:d.y+this.settings.inertiaRatio*(d.y-l.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==o||this.lastMouseY!==h)&&a.setState({x:d.x,y:d.y}),this.isMoving=!1,setTimeout(function(){var u=t.draggedEvents>0;t.draggedEvents=0,u&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()},0),this.emit("mouseup",F(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var a=F(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),o=M(e,this.container),h=o.x,d=o.y,l=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),u=this.renderer.viewportToFramedGraph({x:h,y:d}),g=l.x-u.x,f=l.y-u.y,m=r.getState(),p=m.x+g,y=m.y+f;r.setState({x:p,y}),this.lastMouseX=h,this.lastMouseY=d,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",F(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",F(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var r=Te(e);if(r){var o=st(e,this.container);if(this.emit("wheel",o),o.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var h=a.getState().ratio,d=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,l=a.getBoundedRatio(h*d),u=r>0?1:-1,g=Date.now();h!==l&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===u&&this.lastWheelTriggerTime&&g-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(M(e,this.container),l),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=u,this.lastWheelTriggerTime=g))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De),ut=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],ct=ut.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),gt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"isMoving",!1),c(t,"hasMoved",!1),c(t,"touchMode",0),c(t,"startTouchesPositions",[]),c(t,"lastTouches",[]),c(t,"lastTap",null),c(t,"settings",ct),t.handleStart=t.handleStart.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleMove=t.handleMove.bind(t),i.addEventListener("touchstart",t.handleStart,{capture:!1}),i.addEventListener("touchcancel",t.handleLeave,{capture:!1}),document.addEventListener("touchend",t.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",t.handleMove,{capture:!1,passive:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var a=ie(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return M(f,t.container)}),this.touchMode===2){var r=Q(this.startTouchesPositions,2),o=r[0],h=o.x,d=o.y,l=r[1],u=l.x,g=l.y;this.startTouchesAngle=Math.atan2(g-d,u-h),this.startTouchesDistance=Math.sqrt(Math.pow(u-h,2)+Math.pow(g-d,2))}this.emit("touchdown",J(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),a=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:a.x+this.settings.inertiaRatio*(a.x-r.x),y:a.y+this.settings.inertiaRatio*(a.y-r.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",J(e,this.lastTouches,this.container)),!e.touches.length){var o=M(this.lastTouches[0],this.container),h=this.startTouchesPositions[0],d=Math.pow(o.x-h.x,2)+Math.pow(o.y-h.y,2);if(!e.touches.length&&d<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var l=J(e,this.lastTouches,this.container);if(this.emit("doubletap",l),this.lastTap=null,!l.sigmaDefaultPrevented){var u=this.renderer.getCamera(),g=u.getBoundedRatio(u.getState().ratio/this.settings.doubleClickZoomingRatio);u.animate(this.renderer.getViewportZoomedState(o,g),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=J(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=ie(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=ie(e.touches),r=a.map(function(B){return M(B,t.container)}),o=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=r;var h=J(e,o,this.container);if(this.emit("touchmove",h),!h.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=r.some(function(B,ae){var G=t.startTouchesPositions[ae];return G&&(B.x!==G.x||B.y!==G.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var d=this.renderer.getCamera(),l=this.startCameraState,u=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var g=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=g.x,m=g.y,p=this.renderer.viewportToFramedGraph(r[0]),y=p.x,E=p.y;d.setState({x:l.x+f-y,y:l.y+m-E});break}case 2:{var b={x:.5,y:.5,angle:0,ratio:1},x=r[0],C=x.x,I=x.y,A=r[1],w=A.x,k=A.y,T=Math.atan2(k-I,w-C)-this.startTouchesAngle,L=Math.hypot(k-I,w-C)/this.startTouchesDistance,D=d.getBoundedRatio(l.ratio/L);b.ratio=D,b.angle=l.angle+T;var S=this.getDimensions(),_=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:l}),P=Math.min(S.width,S.height)-2*u,R=P/S.width,U=P/S.height,$=D/P,q=C-P/2/R,V=I-P/2/U,H=[q*Math.cos(-b.angle)-V*Math.sin(-b.angle),V*Math.cos(-b.angle)+q*Math.sin(-b.angle)];q=H[0],V=H[1],b.x=_.x-q*$,b.y=_.y+V*$,d.setState(b);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De);function vt(s){if(Array.isArray(s))return Ae(s)}function ft(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function mt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ee(s){return vt(s)||ft(s)||ze(s)||mt()}function pt(s,n){if(s==null)return{};var i={};for(var e in s)if({}.hasOwnProperty.call(s,e)){if(n.indexOf(e)!==-1)continue;i[e]=s[e]}return i}function he(s,n){if(s==null)return{};var i,e,t=pt(s,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);for(e=0;e<a.length;e++)i=a[e],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(s,i)&&(t[i]=s[i])}return t}var we=(function(){function s(n,i){Z(this,s),this.key=n,this.size=i}return O(s,null,[{key:"compare",value:function(i,e){return i.size>e.size?-1:i.size<e.size||i.key>e.key?1:-1}}])})(),Le=(function(){function s(){Z(this,s),c(this,"width",0),c(this,"height",0),c(this,"cellSize",0),c(this,"columns",0),c(this,"rows",0),c(this,"cells",{})}return O(s,[{key:"resizeAndClear",value:function(i,e){this.width=i.width,this.height=i.height,this.cellSize=e,this.columns=Math.ceil(i.width/e),this.rows=Math.ceil(i.height/e),this.cells={}}},{key:"getIndex",value:function(i){var e=Math.floor(i.x/this.cellSize),t=Math.floor(i.y/this.cellSize);return t*this.columns+e}},{key:"add",value:function(i,e,t){var a=new we(i,e),r=this.getIndex(t),o=this.cells[r];o||(o=[],this.cells[r]=o),o.push(a)}},{key:"organize",value:function(){for(var i in this.cells){var e=this.cells[i];e.sort(we.compare)}}},{key:"getLabelsToDisplay",value:function(i,e){var t=this.cellSize*this.cellSize,a=t/i/i,r=a*e/t,o=Math.ceil(r),h=[];for(var d in this.cells)for(var l=this.cells[d],u=0;u<Math.min(o,l.length);u++)h.push(l[u].key);return h}}])})();function yt(s){var n=s.graph,i=s.hoveredNode,e=s.highlightedNodes,t=s.displayedNodeLabels,a=[];return n.forEachEdge(function(r,o,h,d){(h===i||d===i||e.has(h)||e.has(d)||t.has(h)&&t.has(d))&&a.push(r)}),a}var Se=150,Pe=50,z=Object.prototype.hasOwnProperty;function bt(s,n,i){if(!z.call(i,"x")||!z.call(i,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(n,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return i.color||(i.color=s.defaultNodeColor),!i.label&&i.label!==""&&(i.label=null),i.label!==void 0&&i.label!==null?i.label=""+i.label:i.label=null,i.size||(i.size=2),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"highlighted")||(i.highlighted=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultNodeType),i.zIndex||(i.zIndex=0),i}function xt(s,n,i){return i.color||(i.color=s.defaultEdgeColor),i.label||(i.label=""),i.size||(i.size=.5),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultEdgeType),i.zIndex||(i.zIndex=0),i}var Ct=(function(s){function n(i,e){var t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Z(this,n),t=j(this,n),c(t,"elements",{}),c(t,"canvasContexts",{}),c(t,"webGLContexts",{}),c(t,"pickingLayers",new Set),c(t,"textures",{}),c(t,"frameBuffers",{}),c(t,"activeListeners",{}),c(t,"labelGrid",new Le),c(t,"nodeDataCache",{}),c(t,"edgeDataCache",{}),c(t,"nodeProgramIndex",{}),c(t,"edgeProgramIndex",{}),c(t,"nodesWithForcedLabels",new Set),c(t,"edgesWithForcedLabels",new Set),c(t,"nodeExtent",{x:[0,1],y:[0,1]}),c(t,"nodeZExtent",[1/0,-1/0]),c(t,"edgeZExtent",[1/0,-1/0]),c(t,"matrix",N()),c(t,"invMatrix",N()),c(t,"correctionRatio",1),c(t,"customBBox",null),c(t,"normalizationFunction",be({x:[0,1],y:[0,1]})),c(t,"graphToViewportRatio",1),c(t,"itemIDsIndex",{}),c(t,"nodeIndices",{}),c(t,"edgeIndices",{}),c(t,"width",0),c(t,"height",0),c(t,"pixelRatio",pe()),c(t,"pickingDownSizingRatio",2*t.pixelRatio),c(t,"displayedNodeLabels",new Set),c(t,"displayedEdgeLabels",new Set),c(t,"highlightedNodes",new Set),c(t,"hoveredNode",null),c(t,"hoveredEdge",null),c(t,"renderFrame",null),c(t,"renderHighlightedNodesFrame",null),c(t,"needToProcess",!1),c(t,"checkEdgesEventsFrame",null),c(t,"nodePrograms",{}),c(t,"nodeHoverPrograms",{}),c(t,"edgePrograms",{}),t.settings=nt(a),oe(t.settings),tt(i),!(e instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");t.graph=i,t.container=e,t.createWebGLContext("edges",{picking:a.enableEdgeEvents}),t.createCanvasContext("edgeLabels"),t.createWebGLContext("nodes",{picking:!0}),t.createCanvasContext("labels"),t.createCanvasContext("hovers"),t.createWebGLContext("hoverNodes"),t.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),t.resize();for(var r in t.settings.nodeProgramClasses)t.registerNodeProgram(r,t.settings.nodeProgramClasses[r],t.settings.nodeHoverProgramClasses[r]);for(var o in t.settings.edgeProgramClasses)t.registerEdgeProgram(o,t.settings.edgeProgramClasses[o]);return t.camera=new Ce,t.bindCameraHandlers(),t.mouseCaptor=new lt(t.elements.mouse,t),t.mouseCaptor.setSettings(t.settings),t.touchCaptor=new gt(t.elements.mouse,t),t.touchCaptor.setSettings(t.settings),t.bindEventHandlers(),t.bindGraphHandlers(),t.handleSettingsUpdate(),t.refresh(),t}return Y(n,s),O(n,[{key:"registerNodeProgram",value:function(e,t,a){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(a||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var o=this.nodeHoverPrograms,h=o[e],d=he(o,[e].map(ne));h.kill(),this.nodePrograms=d}return this}},{key:"unregisterEdgeProgram",value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.edgePrograms=r}return this}},{key:"resetWebGLTexture",value:function(e){var t=this.webGLContexts[e],a=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var o=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,a),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o,0),this.textures[e]=o,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var t=e.x,a=e.y,r=ge(this.webGLContexts.nodes,this.frameBuffers.nodes,t,a,this.pixelRatio,this.pickingDownSizingRatio),o=ve.apply(void 0,Ee(r)),h=this.itemIDsIndex[o];return h&&h.type==="node"?h.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},h=e.getNodeAtPosition(r);if(h&&e.hoveredNode!==h&&!e.nodeDataCache[h].hidden){e.hoveredNode&&e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.hoveredNode=h,e.emit("enterNode",v(v({},o),{},{node:h})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(r)!==e.hoveredNode){var d=e.hoveredNode;e.hoveredNode=null,e.emit("leaveNode",v(v({},o),{},{node:d})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var l=e.hoveredNode?null:e.getEdgeAtPoint(o.event.x,o.event.y);l!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),l&&e.emit("enterEdge",v(v({},o),{},{edge:l})),e.hoveredEdge=l)}},this.activeListeners.handleMoveBody=function(a){var r=K(a);e.emit("moveBody",{event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",v({},o))},this.activeListeners.handleEnter=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.emit("enterStage",v({},o))};var t=function(r){return function(o){var h=K(o),d={event:h,preventSigmaDefault:function(){h.preventSigmaDefault()}},l=e.getNodeAtPosition(h);if(l)return e.emit("".concat(r,"Node"),v(v({},d),{},{node:l}));if(e.settings.enableEdgeEvents){var u=e.getEdgeAtPoint(h.x,h.y);if(u)return e.emit("".concat(r,"Edge"),v(v({},d),{},{edge:u}))}return e.emit("".concat(r,"Stage"),d)}};return this.activeListeners.handleClick=t("click"),this.activeListeners.handleRightClick=t("rightClick"),this.activeListeners.handleDoubleClick=t("doubleClick"),this.activeListeners.handleWheel=t("wheel"),this.activeListeners.handleDown=t("down"),this.activeListeners.handleUp=t("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph,a=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachNode(function(l){return e.updateNode(l)});var d=!h||h.some(function(l){return a.has(l)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!d,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachEdge(function(l){return e.updateEdge(l)});var d=h&&["zIndex","type"].some(function(l){return h==null?void 0:h.includes(l)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!d,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(r){var o=r.key;e.addNode(o),e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(r){var o=r.key;e.removeNode(o),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(r){var o=r.key;e.addEdge(o),e.refresh({partialGraph:{edges:[o]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{edges:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(r){var o=r.key;e.removeEdge(o),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),t.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),t.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),t.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),t.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),t.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),t.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),t.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,t){var a=ge(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=ve.apply(void 0,Ee(a)),o=this.itemIDsIndex[r];return o&&o.type==="edge"?o.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var t=this.graph,a=this.settings,r=this.getDimensions();if(this.nodeExtent=et(this.graph),!this.settings.autoRescale){var o=r.width,h=r.height,d=this.nodeExtent,l=d.x,u=d.y;this.nodeExtent={x:[(l[0]+l[1])/2-o/2,(l[0]+l[1])/2+o/2],y:[(u[0]+u[1])/2-h/2,(u[0]+u[1])/2+h/2]}}this.normalizationFunction=be(this.customBBox||this.nodeExtent);var g=new Ce,f=X(g.getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,a.labelGridCellSize);for(var m={},p={},y={},E={},b=1,x=t.nodes(),C=0,I=x.length;C<I;C++){var A=x[C],w=this.nodeDataCache[A],k=t.getNodeAttributes(A);w.x=k.x,w.y=k.y,this.normalizationFunction.applyTo(w),typeof w.label=="string"&&!w.hidden&&this.labelGrid.add(A,w.size,this.framedGraphToViewport(w,{matrix:f})),m[w.type]=(m[w.type]||0)+1}this.labelGrid.organize();for(var T in this.nodePrograms){if(!z.call(this.nodePrograms,T))throw new Error('Sigma: could not find a suitable program for node type "'.concat(T,'"!'));this.nodePrograms[T].reallocate(m[T]||0),m[T]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(x=ye(this.nodeZExtent,function(re){return e.nodeDataCache[re].zIndex},x));for(var L=0,D=x.length;L<D;L++){var S=x[L];p[S]=b,E[p[S]]={type:"node",id:S},b++;var _=this.nodeDataCache[S];this.addNodeToProgram(S,p[S],m[_.type]++)}for(var P={},R=t.edges(),U=0,$=R.length;U<$;U++){var q=R[U],V=this.edgeDataCache[q];P[V.type]=(P[V.type]||0)+1}this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(R=ye(this.edgeZExtent,function(re){return e.edgeDataCache[re].zIndex},R));for(var H in this.edgePrograms){if(!z.call(this.edgePrograms,H))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(H,'"!'));this.edgePrograms[H].reallocate(P[H]||0),P[H]=0}for(var B=0,ae=R.length;B<ae;B++){var G=R[B];y[G]=b,E[y[G]]={type:"edge",id:G},b++;var ke=this.edgeDataCache[G];this.addEdgeToProgram(G,y[G],P[ke.type]++)}return this.itemIDsIndex=E,this.nodeIndices=p,this.edgeIndices=y,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var t=this,a=this.settings;if(this.camera.minRatio=a.minCameraRatio,this.camera.maxRatio=a.maxCameraRatio,this.camera.enabledZooming=a.enableCameraZooming,this.camera.enabledPanning=a.enableCameraPanning,this.camera.enabledRotation=a.enableCameraRotation,a.cameraPanBoundaries?this.camera.clean=function(l){return t.cleanCameraState(l,a.cameraPanBoundaries&&le(a.cameraPanBoundaries)==="object"?a.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==a.edgeProgramClasses){for(var r in a.edgeProgramClasses)a.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,a.edgeProgramClasses[r]);for(var o in e.edgeProgramClasses)a.edgeProgramClasses[o]||this.unregisterEdgeProgram(o)}if(e.nodeProgramClasses!==a.nodeProgramClasses||e.nodeHoverProgramClasses!==a.nodeHoverProgramClasses){for(var h in a.nodeProgramClasses)(a.nodeProgramClasses[h]!==e.nodeProgramClasses[h]||a.nodeHoverProgramClasses[h]!==e.nodeHoverProgramClasses[h])&&this.registerNodeProgram(h,a.nodeProgramClasses[h],a.nodeHoverProgramClasses[h]);for(var d in e.nodeProgramClasses)a.nodeProgramClasses[d]||this.unregisterNodeProgram(d)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t.tolerance,r=a===void 0?0:a,o=t.boundaries,h=v({},e),d=o||this.nodeExtent,l=Q(d.x,2),u=l[0],g=l[1],f=Q(d.y,2),m=f[0],p=f[1],y=[this.graphToViewport({x:u,y:m},{cameraState:e}),this.graphToViewport({x:g,y:m},{cameraState:e}),this.graphToViewport({x:u,y:p},{cameraState:e}),this.graphToViewport({x:g,y:p},{cameraState:e})],E=1/0,b=-1/0,x=1/0,C=-1/0;y.forEach(function(P){var R=P.x,U=P.y;E=Math.min(E,R),b=Math.max(b,R),x=Math.min(x,U),C=Math.max(C,U)});var I=b-E,A=C-x,w=this.getDimensions(),k=w.width,T=w.height,L=0,D=0;if(I>=k?b<k-r?L=b-(k-r):E>r&&(L=E-r):b>k+r?L=b-(k+r):E<-r&&(L=E+r),A>=T?C<T-r?D=C-(T-r):x>r&&(D=x-r):C>T+r?D=C-(T+r):x<-r&&(D=x+r),L||D){var S=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),_=this.viewportToFramedGraph({x:L,y:D},{cameraState:e});L=_.x-S.x,D=_.y-S.y,h.x+=L,h.y+=D}return h}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);xe(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var a=this.canvasContexts.labels,r=0,o=t.length;r<o;r++){var h=t[r],d=this.nodeDataCache[h];if(!this.displayedNodeLabels.has(h)&&!d.hidden){var l=this.framedGraphToViewport(d),u=l.x,g=l.y,f=this.scaleSize(d.size);if(!(!d.forceLabel&&f<this.settings.labelRenderedSizeThreshold)&&!(u<-Se||u>this.width+Se||g<-Pe||g>this.height+Pe)){this.displayedNodeLabels.add(h);var m=this.settings.defaultDrawNodeLabel,p=this.nodePrograms[d.type],y=(p==null?void 0:p.drawLabel)||m;y(a,v(v({key:h},d),{},{size:f,x:u,y:g}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=yt({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});xe(t,this.edgesWithForcedLabels);for(var a=new Set,r=0,o=t.length;r<o;r++){var h=t[r],d=this.graph.extremities(h),l=this.nodeDataCache[d[0]],u=this.nodeDataCache[d[1]],g=this.edgeDataCache[h];if(!a.has(h)&&!(g.hidden||l.hidden||u.hidden)){var f=this.settings.defaultDrawEdgeLabel,m=this.edgePrograms[g.type],p=(m==null?void 0:m.drawLabel)||f;p(e,v(v({key:h},g),{},{size:this.scaleSize(g.size)}),v(v(v({key:d[0]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),v(v(v({key:d[1]},u),this.framedGraphToViewport(u)),{},{size:this.scaleSize(u.size)}),this.settings),a.add(h)}}return this.displayedEdgeLabels=a,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var a=function(f){var m=e.nodeDataCache[f],p=e.framedGraphToViewport(m),y=p.x,E=p.y,b=e.scaleSize(m.size),x=e.settings.defaultDrawNodeHover,C=e.nodePrograms[m.type],I=(C==null?void 0:C.drawHover)||x;I(t,v(v({key:f},m),{},{size:b,x:y,y:E}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(g){g!==e.hoveredNode&&r.push(g)}),r.forEach(function(g){return a(g)});var o={};r.forEach(function(g){var f=e.nodeDataCache[g].type;o[f]=(o[f]||0)+1});for(var h in this.nodeHoverPrograms)this.nodeHoverPrograms[h].reallocate(o[h]||0),o[h]=0;r.forEach(function(g){var f=e.nodeDataCache[g];e.nodeHoverPrograms[f.type].process(0,o[f.type]++,f)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var d=this.getRenderParams();for(var l in this.nodeHoverPrograms){var u=this.nodeHoverPrograms[l];u.render(d)}}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var t=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(y){return e.resetWebGLTexture(y)}),!this.graph.order)return t();var a=this.mouseCaptor,r=this.camera.isAnimated()||a.isMoving||a.draggedEvents||a.currentWheelDirection,o=this.camera.getState(),h=this.getDimensions(),d=this.getGraphDimensions(),l=this.getStagePadding();this.matrix=X(o,h,d,l),this.invMatrix=X(o,h,d,l,!0),this.correctionRatio=$e(this.matrix,o,h),this.graphToViewportRatio=this.getGraphToViewportRatio();var u=this.getRenderParams();for(var g in this.nodePrograms){var f=this.nodePrograms[g];f.render(u)}if(!this.settings.hideEdgesOnMove||!r)for(var m in this.edgePrograms){var p=this.edgePrograms[m];p.render(u)}return this.settings.hideLabelsOnMove&&r||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),t()}},{key:"addNode",value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var a=bt(this.settings,e,t);this.nodeDataCache[e]=a,this.nodesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),a.highlighted&&!a.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(a.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=a.zIndex),a.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=a.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var a=xt(this.settings,e,t);this.edgeDataCache[e]=a,this.edgesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(a.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=a.zIndex),a.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=a.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new Le,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,t,a){var r=this.nodeDataCache[e],o=this.nodePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for node type "'.concat(r.type,'"!'));o.process(t,a,r),this.nodeProgramIndex[e]=a}},{key:"addEdgeToProgram",value:function(e,t,a){var r=this.edgeDataCache[e],o=this.edgePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(r.type,'"!'));var h=this.graph.extremities(e),d=this.nodeDataCache[h[0]],l=this.nodeDataCache[h[1]];o.process(t,a,d,l,r),this.edgeProgramIndex[e]=a}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,t=e.stagePadding,a=e.autoRescale;return a&&t||0}},{key:"createLayer",value:function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var r=it(t,{position:"absolute"},{class:"sigma-".concat(e)});return a.style&&Object.assign(r.style,a.style),this.elements[e]=r,"beforeLayer"in a&&a.beforeLayer?this.elements[a.beforeLayer].before(r):"afterLayer"in a&&a.afterLayer?this.elements[a.afterLayer].after(r):this.container.appendChild(r),r}},{key:"createCanvas",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,"canvas",t)}},{key:"createCanvasContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=a.getContext("2d",r),this}},{key:"createWebGLContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(t==null?void 0:t.canvas)||this.createCanvas(e,t);t.hidden&&a.remove();var r=v({preserveDrawingBuffer:!1,antialias:!1},t),o;o=a.getContext("webgl2",r),o||(o=a.getContext("webgl",r)),o||(o=a.getContext("experimental-webgl",r));var h=o;if(this.webGLContexts[e]=h,h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var d=h.createFramebuffer();if(!d)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=d}return h}},{key:"killLayer",value:function(e){var t=this.elements[e];if(!t)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));if(this.webGLContexts[e]){var a,r=this.webGLContexts[e];(a=r.getExtension("WEBGL_lose_context"))===null||a===void 0||a.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getEdgeDisplayData",value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return v({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,t){var a=v({},this.settings);return this.settings[e]=t,oe(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:"setSettings",value:function(e){var t=v({},this.settings);return this.settings=v(v({},this.settings),e),oe(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var t=this.width,a=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=pe(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!e&&t===this.width&&a===this.height)return this;for(var r in this.elements){var o=this.elements[r];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var h in this.canvasContexts)this.elements[h].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[h].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[h].scale(this.pixelRatio,this.pixelRatio);for(var d in this.webGLContexts){this.elements[d].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[d].setAttribute("height",this.height*this.pixelRatio+"px");var l=this.webGLContexts[d];if(l.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(d)){var u=this.textures[d];u&&l.deleteTexture(u)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var t=this,a=(e==null?void 0:e.skipIndexation)!==void 0?e==null?void 0:e.skipIndexation:!1,r=(e==null?void 0:e.schedule)!==void 0?e.schedule:!1,o=!e||!e.partialGraph;if(o)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(C){return t.addNode(C)}),this.graph.forEachEdge(function(C){return t.addEdge(C)});else{for(var h,d,l=((h=e.partialGraph)===null||h===void 0?void 0:h.nodes)||[],u=0,g=(l==null?void 0:l.length)||0;u<g;u++){var f=l[u];if(this.updateNode(f),a){var m=this.nodeProgramIndex[f];if(m===void 0)throw new Error('Sigma: node "'.concat(f,`" can't be repaint`));this.addNodeToProgram(f,this.nodeIndices[f],m)}}for(var p=(e==null||(d=e.partialGraph)===null||d===void 0?void 0:d.edges)||[],y=0,E=p.length;y<E;y++){var b=p[y];if(this.updateEdge(b),a){var x=this.edgeProgramIndex[b];if(x===void 0)throw new Error('Sigma: edge "'.concat(b,`" can't be repaint`));this.addEdgeToProgram(b,this.edgeIndices[b],x)}}}return(o||!a)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame(function(){e.render()})),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(v(v({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,t){var a=this.camera.getState(),r=a.ratio,o=a.angle,h=a.x,d=a.y,l=this.settings,u=l.minCameraRatio,g=l.maxCameraRatio;typeof g=="number"&&(t=Math.min(t,g)),typeof u=="number"&&(t=Math.max(t,u));var f=t/r,m={x:this.width/2,y:this.height/2},p=this.viewportToFramedGraph(e),y=this.viewportToFramedGraph(m);return{angle:o,x:(p.x-y.x)*(1-f)+h,y:(p.y-y.y)*(1-f)+d,ratio:t}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),a=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-a.y}}},{key:"framedGraphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,o=de(r,e);return{x:(1+o.x)*this.width/2,y:(1-o.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,o=de(r,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0),o}},{key:"viewportToGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:"graphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},t={x:1,y:1},a=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=this.graphToViewport(e),o=this.graphToViewport(t),h=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2));return h/a}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var o in this.elements)this.killLayer(o);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:"scaleSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting("itemSizesReference")==="positions"?t*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])})(ue),Lt=Ct;export{Ce as Camera,lt as MouseCaptor,Ct as Sigma,gt as TouchCaptor,Lt as default};
@@ -0,0 +1 @@
1
+ var ee=t=>{throw TypeError(t)};var De=(t,e,n)=>e.has(t)||ee("Cannot "+n);var y=(t,e,n)=>(De(t,e,"read from private field"),n?n.call(t):e.get(t)),A=(t,e,n)=>e.has(t)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n);import{bR as qt,bz as T,at as I,bm as P,bH as _t,bt as Ve}from"./CGFL56WJ.js";import{a as ne}from"./Btd6PFkC.js";class Bt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(e,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=n}}class Mt extends Error{constructor(e,n,r){super(r),this.status=e,this.text=n}}new URL("sveltekit-internal://");function qe(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function Be(t){return t.split("%25").map(decodeURI).join("%25")}function Ke(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function Pt({href:t}){return t.split("#")[0]}function j(){}function Me(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)e=e*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;function He(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}const Fe=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&Y.delete(Ht(t)),Fe(t,e));const Y=new Map;function Ge(t,e){const n=Ht(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...o}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&Y.set(n,{body:a,init:o,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=He(a)),Promise.resolve(new Response(a,o))}return window.fetch(t,e)}function We(t,e,n){if(Y.size>0){const r=Ht(t,n),a=Y.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);Y.delete(r)}}return window.fetch(e,n)}function Ht(t,e){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(t instanceof Request?t.url:t)}]`;if(e!=null&&e.headers||e!=null&&e.body){const a=[];e.headers&&a.push([...new Headers(e.headers)].join(",")),e.body&&(typeof e.body=="string"||ArrayBuffer.isView(e.body))&&a.push(e.body),r+=`[data-hash="${Me(...a)}"]`}return r}const ze=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,Je=/^\/\((?:[^)]+)\)$/;function Ye(t){const e=[];return{pattern:t==="/"||Je.test(t)?/^\/$/:new RegExp(`^${Qe(t).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return e.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return Ot(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return Ot(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const u=ze.exec(l),[,h,_,p,f]=u;return e.push({name:p,matcher:f,optional:!!h,rest:!!_,chained:_?c===1&&s[0]==="":!1}),_?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return Ot(l)}).join("")}).join("")}/?$`),params:e}}function Xe(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function Qe(t){return t.slice(1).split("/").filter(Xe)}function Ze(t,e,n){const r={},a=t.slice(1),o=a.filter(i=>i!==void 0);let s=0;for(let i=0;i<e.length;i+=1){const l=e[i];let c=a[i-s];if(l.chained&&l.rest&&s&&(c=a.slice(i-s,i+1).filter(u=>u).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const u=e[i+1],h=a[i+1];u&&!u.rest&&u.optional&&h&&l.chained&&(s=0),!u&&!h&&Object.keys(r).length===o.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function Ot(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function tn({nodes:t,server_loads:e,dictionary:n,matchers:r}){const a=new Set(e);return Object.entries(n).map(([i,[l,c,u]])=>{const{pattern:h,params:_}=Ye(i),p={id:i,exec:f=>{const m=h.exec(f);if(m)return Ze(m,_,r)},errors:[1,...u||[]].map(f=>t[f]),layouts:[0,...c||[]].map(s),leaf:o(l)};return p.errors.length=p.layouts.length=Math.max(p.errors.length,p.layouts.length),p});function o(i){const l=i<0;return l&&(i=~i),[l,t[i]]}function s(i){return i===void 0?i:[a.has(i),t[i]]}}function me(t,e=JSON.parse){try{return e(sessionStorage[t])}catch{}}function re(t,e,n=JSON.stringify){const r=n(e);try{sessionStorage[t]=r}catch{}}var ue;const U=((ue=globalThis.__sveltekit_197472r)==null?void 0:ue.base)??"";var de;const en=((de=globalThis.__sveltekit_197472r)==null?void 0:de.assets)??U??"",nn="1792722253923",_e="sveltekit:snapshot",we="sveltekit:scroll",ve="sveltekit:states",rn="sveltekit:pageurl",H="sveltekit:history",Q="sveltekit:navigation",q={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Lt=location.origin;function Ft(t){if(t instanceof URL)return t;let e=document.baseURI;if(!e){const n=document.getElementsByTagName("base");e=n.length?n[0].href:document.URL}return new URL(t,e)}function B(){return{x:pageXOffset,y:pageYOffset}}function M(t,e){return t.getAttribute(`data-sveltekit-${e}`)}const ae={...q,"":q.hover};function ye(t){let e=t.assignedSlot??t.parentNode;return(e==null?void 0:e.nodeType)===11&&(e=e.host),e}function be(t,e){for(;t&&t!==e;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=ye(t)}}function jt(t,e,n){let r;try{if(r=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const i=location.hash.split("#")[1]||"/";r.hash=`#${i}${r.hash}`}}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,o=!r||!!a||Ut(r,e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),s=(r==null?void 0:r.origin)===Lt&&t.hasAttribute("download");return{url:r,external:o,target:a,download:s}}function wt(t){let e=null,n=null,r=null,a=null,o=null,s=null,i=t;for(;i&&i!==document.documentElement;)r===null&&(r=M(i,"preload-code")),a===null&&(a=M(i,"preload-data")),e===null&&(e=M(i,"keepfocus")),n===null&&(n=M(i,"noscroll")),o===null&&(o=M(i,"reload")),s===null&&(s=M(i,"replacestate")),i=ye(i);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:ae[r??"off"],preload_data:ae[a??"off"],keepfocus:l(e),noscroll:l(n),reload:l(o),replace_state:l(s)}}function oe(t){const e=qt(t);let n=!0;function r(){n=!0,e.update(s=>s)}function a(s){n=!1,e.set(s)}function o(s){let i;return e.subscribe(l=>{(i===void 0||n&&l!==i)&&s(i=l)})}return{notify:r,set:a,subscribe:o}}const ke={v:j};function an(){const{set:t,subscribe:e}=qt(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${en}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==nn;return s&&(t(!0),ke.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ut(t,e,n){return t.origin!==Lt||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function Pn(t){}const Ee=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Ee];const on=new Set([...Ee]);[...on];function sn(t){return t.filter(e=>e!=null)}function gt(t,e){return t+"/"+e}function Gt(t){return t instanceof Bt||t instanceof Mt?t.status:500}function ln(t){return t instanceof Mt?t.text:"Internal Error"}let x,Z,$t;const cn=ne.toString().includes("$$")||/function \w+\(\) \{\}/.test(ne.toString()),se="a:";var at,ot,st,it,lt,ct,ft,ut,he,dt,pe,ht,ge;cn?(x={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(se)},Z={current:null},$t={current:!1}):(x=new(he=class{constructor(){A(this,at,T({}));A(this,ot,T(null));A(this,st,T(null));A(this,it,T({}));A(this,lt,T({id:null}));A(this,ct,T({}));A(this,ft,T(-1));A(this,ut,T(new URL(se)))}get data(){return I(y(this,at))}set data(e){P(y(this,at),e)}get form(){return I(y(this,ot))}set form(e){P(y(this,ot),e)}get error(){return I(y(this,st))}set error(e){P(y(this,st),e)}get params(){return I(y(this,it))}set params(e){P(y(this,it),e)}get route(){return I(y(this,lt))}set route(e){P(y(this,lt),e)}get state(){return I(y(this,ct))}set state(e){P(y(this,ct),e)}get status(){return I(y(this,ft))}set status(e){P(y(this,ft),e)}get url(){return I(y(this,ut))}set url(e){P(y(this,ut),e)}},at=new WeakMap,ot=new WeakMap,st=new WeakMap,it=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,ut=new WeakMap,he),Z=new(pe=class{constructor(){A(this,dt,T(null))}get current(){return I(y(this,dt))}set current(e){P(y(this,dt),e)}},dt=new WeakMap,pe),$t=new(ge=class{constructor(){A(this,ht,T(!1))}get current(){return I(y(this,ht))}set current(e){P(y(this,ht),e)}},ht=new WeakMap,ge),ke.v=()=>$t.current=!0);function Se(t){Object.assign(x,t)}const fn=new Set(["icon","shortcut icon","apple-touch-icon"]);let z=null;const D=me(we)??{},tt=me(_e)??{},N={url:oe({}),page:oe({}),navigating:qt(null),updated:an()};function Wt(t){D[t]=B()}function un(t,e){let n=t+1;for(;D[n];)delete D[n],n+=1;for(n=e+1;tt[n];)delete tt[n],n+=1}function et(t,e=!1){return e?location.replace(t.href):location.href=t.href,new Promise(j)}async function Re(){if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistration(U||"/");t&&await t.update()}}let zt,Nt,vt,O,Dt,E;const yt=[],bt=[];let v=null;function kt(){var t;(t=v==null?void 0:v.fork)==null||t.then(e=>e==null?void 0:e.discard()),v=null}const mt=new Map,xe=new Set,dn=new Set,X=new Set;let w={branch:[],error:null,url:null},Le=!1,Et=!1,ie=!0,nt=!1,J=!1,Ue=!1,Jt=!1,Ae,k,L,C;const St=new Set,le=new Map,ce=new Map;async function jn(t,e,n){var o,s,i,l;globalThis.__sveltekit_197472r&&(globalThis.__sveltekit_197472r.query,globalThis.__sveltekit_197472r.prerender),document.URL!==location.href&&(location.href=location.href),E=t,await((s=(o=t.hooks).init)==null?void 0:s.call(o)),zt=tn(t),O=document.documentElement,Dt=e,Nt=t.nodes[0],vt=t.nodes[1],Nt(),vt(),k=(i=history.state)==null?void 0:i[H],L=(l=history.state)==null?void 0:l[Q],k||(k=L=Date.now(),history.replaceState({...history.state,[H]:k,[Q]:L},""));const r=D[k];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Rn(Dt,n)):(await F({type:"enter",url:Ft(E.hash?Un(new URL(location.href)):location.href),replace_state:!0}),a()),Sn()}function hn(){yt.length=0,Jt=!1}function Te(t){bt.some(e=>e==null?void 0:e.snapshot)&&(tt[t]=bt.map(e=>{var n;return(n=e==null?void 0:e.snapshot)==null?void 0:n.capture()}))}function Ie(t){var e;(e=tt[t])==null||e.forEach((n,r)=>{var a,o;(o=(a=bt[r])==null?void 0:a.snapshot)==null||o.restore(n)})}function fe(){Wt(k),re(we,D),Te(L),re(_e,tt)}async function Pe(t,e,n,r){let a,o;e.invalidateAll&&kt(),await F({type:"goto",url:Ft(t),keepfocus:e.keepFocus,noscroll:e.noScroll,replace_state:e.replaceState,state:e.state,redirect_count:n,nav_token:r,accept:()=>{if(e.invalidateAll){Jt=!0,a=new Set;for(const[s,i]of le)for(const l of i.keys())a.add(gt(s,l));o=new Set;for(const[s,i]of ce)for(const l of i.keys())o.add(gt(s,l))}e.invalidate&&e.invalidate.forEach(En)}}),e.invalidateAll&&_t().then(_t).then(()=>{for(const[s,i]of le)for(const[l,{resource:c}]of i)a!=null&&a.has(gt(s,l))&&c.refresh();for(const[s,i]of ce)for(const[l,{resource:c}]of i)o!=null&&o.has(gt(s,l))&&c.reconnect()})}async function pn(t){if(t.id!==(v==null?void 0:v.id)){kt();const e={};St.add(e),v={id:t.id,token:e,promise:$e({...t,preload:e}).then(n=>(St.delete(e),n.type==="loaded"&&n.state.error&&kt(),n)),fork:null}}return v.promise}async function Ct(t){var n;const e=(n=await At(t,!1))==null?void 0:n.route;e&&await Promise.all([...e.layouts,e.leaf].filter(Boolean).map(r=>r[1]()))}async function Oe(t,e,n){var a;const r={params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)};if(w={...t.state,nav:r},Se(t.props.page),Ae=new E.root({target:e,props:{...t.props,stores:N,components:bt},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),Ie(L),n){const o={from:null,to:{...r,scroll:D[k]??B()},willUnload:!1,type:"enter",complete:Promise.resolve()};X.forEach(s=>s(o))}Et=!0}async function Rt({url:t,params:e,branch:n,errors:r,status:a,error:o,route:s,form:i}){let l="never";if(U&&(t.pathname===U||t.pathname===U+"/"))l="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(l=f.slash);t.pathname=qe(t.pathname,l),t.search=t.search;const c={type:"loaded",state:{url:t,params:e,branch:n,error:o,route:s},props:{constructors:sn(n).map(f=>f.node.component),page:te(x)}};i!==void 0&&(c.props.form=i);let u={},h=!x,_=0;for(let f=0;f<Math.max(n.length,w.branch.length);f+=1){const m=n[f],d=w.branch[f];(m==null?void 0:m.data)!==(d==null?void 0:d.data)&&(h=!0),m&&(u={...u,...m.data},h&&(c.props[`data_${_}`]=u),_+=1)}return(!w.url||t.href!==w.url.href||w.error!==o||i!==void 0&&i!==x.form||h)&&(c.props.page={error:o,params:e,route:{id:(s==null?void 0:s.id)??null},state:{},status:a,url:new URL(t),form:i??null,data:h?u:x.data}),c}async function Yt({loader:t,parent:e,url:n,params:r,route:a,server_data_node:o}){var c,u;let s=null;const i={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await t();return{node:l,loader:t,server:o,universal:(c=l.universal)!=null&&c.load?{type:"data",data:s,uses:i}:null,data:s??(o==null?void 0:o.data)??null,slash:((u=l.universal)==null?void 0:u.trailingSlash)??(o==null?void 0:o.slash)}}function gn(t,e,n){let r=t instanceof Request?t.url:t;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const o=Et?We(r,a.href,e):Ge(r,e);return{resolved:a,promise:o}}function mn(t,e,n,r,a,o){if(Jt)return!0;if(!a)return!1;if(a.parent&&t||a.route&&e||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(o[s]!==w.params[s])return!0;for(const s of a.dependencies)if(yt.some(i=>i(new URL(s))))return!0;return!1}function Xt(t,e){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?e??null:null}function _n(t,e){if(!t)return new Set(e.searchParams.keys());const n=new Set([...t.searchParams.keys(),...e.searchParams.keys()]);for(const r of n){const a=t.searchParams.getAll(r),o=e.searchParams.getAll(r);a.every(s=>o.includes(s))&&o.every(s=>a.includes(s))&&n.delete(r)}return n}function wn({error:t,url:e,route:n,params:r}){return{type:"loaded",state:{error:t,url:e,route:n,params:r,branch:[]},props:{page:te(x),constructors:[]}}}async function $e({id:t,invalidating:e,url:n,params:r,route:a,preload:o}){if((v==null?void 0:v.id)===t)return St.delete(v.token),v.promise;const{errors:s,layouts:i,leaf:l}=a,c=[...i,l];s.forEach(d=>d==null?void 0:d().catch(j)),c.forEach(d=>d==null?void 0:d[1]().catch(j));const u=w.url?t!==xt(w.url):!1,h=w.route?a.id!==w.route.id:!1,_=_n(w.url,n);let p=!1;const f=c.map(async(d,g)=>{var $;if(!d)return;const b=w.branch[g];return d[1]===(b==null?void 0:b.loader)&&!mn(p,h,u,_,($=b.universal)==null?void 0:$.uses,r)?b:(p=!0,Yt({loader:d[1],url:n,params:r,route:a,parent:async()=>{var pt;const V={};for(let K=0;K<g;K+=1)Object.assign(V,(pt=await f[K])==null?void 0:pt.data);return V},server_data_node:Xt(d[0]?{type:"skip"}:null,d[0]?b==null?void 0:b.server:void 0)}))});for(const d of f)d.catch(j);const m=[];for(let d=0;d<c.length;d+=1)if(c[d])try{m.push(await f[d])}catch(g){if(g instanceof Kt)return{type:"redirect",location:g.location};if(St.has(o))return wn({error:await rt(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=Gt(g),R;if(g instanceof Bt)R=g.body;else{if(await N.updated.check())return await Re(),await et(n);R=await rt(g,{params:r,url:n,route:{id:a.id}})}const $=await vn(d,m,s);return $?Rt({url:n,params:r,branch:m.slice(0,$.idx).concat($.node),errors:s,status:b,error:R,route:a}):await je(n,{id:a.id},R,b)}else m.push(void 0);return Rt({url:n,params:r,branch:m,errors:s,status:200,error:null,route:a,form:e?void 0:null})}async function vn(t,e,n){for(;t--;)if(n[t]){let r=t;for(;!e[r];)r-=1;try{return{idx:r+1,node:{node:await n[t](),loader:n[t],data:{},server:null,universal:null}}}catch{continue}}}async function Qt({status:t,error:e,url:n,route:r}){const a={};let o=null;try{const s=await Yt({loader:Nt,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Xt(o)}),i={node:await vt(),loader:vt,universal:null,server:null,data:null};return Rt({url:n,params:a,branch:[s,i],status:t,error:e,errors:[],route:null})}catch(s){if(s instanceof Kt)return Pe(new URL(s.location,location.href),{},0);throw s}}async function yn(t){const e=t.href;if(mt.has(e))return mt.get(e);let n;try{const r=(async()=>{let a=await E.hooks.reroute({url:new URL(t),fetch:async(o,s)=>gn(o,s,t).promise})??t;if(typeof a=="string"){const o=new URL(t);E.hash?o.hash=a:o.pathname=a,a=o}return a})();mt.set(e,r),n=await r}catch{mt.delete(e);return}return n}async function At(t,e){if(t&&!Ut(t,U,E.hash)){const n=await yn(t);if(!n)return;const r=bn(n);for(const a of zt){const o=a.exec(r);if(o)return{id:xt(t),invalidating:e,route:a,params:Ke(o),url:t}}}}function bn(t){return Be(E.hash?t.hash.replace(/^#/,"").replace(/[?#].+/,""):t.pathname.slice(U.length))||"/"}function xt(t){return(E.hash?t.hash.replace(/^#/,""):t.pathname)+t.search}function Ce({url:t,type:e,intent:n,delta:r,event:a,scroll:o}){let s=!1;const i=Zt(w,n,t,e,o??null);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const l={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return nt||xe.forEach(c=>c(l)),s?null:i}async function F({type:t,url:e,popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s={},redirect_count:i=0,nav_token:l={},accept:c=j,block:u=j,event:h}){var K;const _=C;C=l;const p=await At(e,!1),f=t==="enter"?Zt(w,p,e,t):Ce({url:e,type:t,delta:n==null?void 0:n.delta,intent:p,scroll:n==null?void 0:n.scroll,event:h});if(!f){u(),C===l&&(C=_);return}const m=k,d=L;c(),nt=!0,Et&&f.navigation.type!=="enter"&&N.navigating.set(Z.current=f.navigation);let g=p&&await $e(p);if(!g){if(Ut(e,U,E.hash))return await et(e,o);g=await je(e,{id:null},await rt(new Mt(404,"Not Found",`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404,o)}if(e=(p==null?void 0:p.url)||e,C!==l)return f.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(i<20){await F({type:t,url:new URL(g.location,e),popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s,redirect_count:i+1,nav_token:l}),f.fulfil(void 0);return}g=await Qt({status:500,error:await rt(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}})}else g.props.page.status>=400&&await N.updated.check()&&(await Re(),await et(e,o));if(hn(),Wt(m),Te(d),g.props.page.url.pathname!==e.pathname&&(e.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const S=o?0:1,G={[H]:k+=S,[Q]:L+=S,[ve]:s};(o?history.replaceState:history.pushState).call(history,G,"",e),o||un(k,L)}const b=p&&(v==null?void 0:v.id)===p.id?v.fork:null;v!=null&&v.fork&&!b&&kt(),v=null,g.props.page.state=s;let R;if(Et){const S=(await Promise.all(Array.from(dn,W=>W(f.navigation)))).filter(W=>typeof W=="function");if(S.length>0){let W=function(){S.forEach(It=>{X.delete(It)})};S.push(W),S.forEach(It=>{X.add(It)})}const G=f.navigation.to;w={...g.state,nav:{params:G.params,route:G.route,url:G.url}},g.props.page&&(g.props.page.url=e);const Tt=b&&await b;Tt?R=Tt.commit():(z=null,Ae.$set(g.props),z&&Object.assign(g.props.page,z),Se(g.props.page),R=(K=Ve)==null?void 0:K()),Ue=!0}else await Oe(g,Dt,!1);const{activeElement:$}=document;if(await R,await _t(),await _t(),C!==l)return f.reject(new Error("navigation aborted")),!1;g.props.page&&z&&Object.assign(g.props.page,z);let V=null;if(ie){const S=n?n.scroll:a?B():null;S?scrollTo(S.x,S.y):(V=e.hash&&document.getElementById(Ne(e)))?V.scrollIntoView():scrollTo(0,0)}const pt=document.activeElement!==$&&document.activeElement!==document.body;!r&&!pt&&Ln(e,!V),ie=!0,nt=!1,t==="popstate"&&Ie(L),f.fulfil(void 0),f.navigation.to&&(f.navigation.to.scroll=B()),X.forEach(S=>S(f.navigation)),N.navigating.set(Z.current=null)}async function je(t,e,n,r,a){return t.origin===Lt&&t.pathname===location.pathname&&!Le?await Qt({status:r,error:n,url:t,route:e}):await et(t,a)}function kn(){let t,e={element:void 0,href:void 0},n;O.addEventListener("mousemove",i=>{const l=i.target;clearTimeout(t),t=setTimeout(()=>{o(l,q.hover)},20)});function r(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}O.addEventListener("mousedown",r),O.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(i=>{for(const l of i)l.isIntersecting&&(Ct(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function o(i,l){const c=be(i,O),u=c===e.element&&(c==null?void 0:c.href)===e.href&&l>=n;if(!c||u)return;const{url:h,external:_,download:p}=jt(c,U,E.hash);if(_||p)return;const f=wt(c),m=h&&xt(w.url)===xt(h);if(!(f.reload||m))if(l<=f.preload_data){e={element:c,href:c.href},n=q.tap;const d=await At(h,!1);if(!d)return;pn(d)}else l<=f.preload_code&&(e={element:c,href:c.href},n=l,Ct(h))}function s(){a.disconnect();for(const i of O.querySelectorAll("a")){const{url:l,external:c,download:u}=jt(i,U,E.hash);if(c||u)continue;const h=wt(i);h.reload||(h.preload_code===q.viewport&&a.observe(i),h.preload_code===q.eager&&Ct(l))}}X.add(s),s()}function rt(t,e){if(t instanceof Bt)return t.body;const n=Gt(t),r=ln(t);return E.hooks.handleError({error:t,event:e,status:n,message:r})??{message:r}}function Nn(t,e={}){return t=new URL(Ft(t)),t.origin!==Lt?Promise.reject(new Error("goto: invalid URL")):Pe(t,e,0)}function En(t){if(typeof t=="function")yt.push(t);else{const{href:e}=new URL(t,location.href);yt.push(n=>n.href===e)}}function Sn(){var e,n;history.scrollRestoration="manual",addEventListener("beforeunload",r=>{let a=!1;if(fe(),!nt){const o=Zt(w,void 0,null,"leave"),s={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};xe.forEach(i=>i(s))}a?(r.preventDefault(),r.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&fe()}),!((e=navigator.connection)!=null&&e.saveData)&&!/2g/.test((n=navigator.connection)==null?void 0:n.effectiveType)&&kn(),O.addEventListener("click",async r=>{if(r.button||r.which!==1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.defaultPrevented)return;const a=be(r.composedPath()[0],O);if(!a)return;const{url:o,external:s,target:i,download:l}=jt(a,U,E.hash);if(!o)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=wt(a);if(!(a instanceof SVGAElement)&&o.protocol!==location.protocol&&!(o.protocol==="https:"||o.protocol==="http:")||l)return;const[h,_]=(E.hash?o.hash.replace(/^#/,""):o.href).split("#"),p=h===Pt(location);if(s||c.reload&&(!p||!_)){Ce({url:o,type:"link",event:r})?nt=!0:r.preventDefault();return}if(_!==void 0&&p){const[,f]=w.url.href.split("#");if(f===_){if(r.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const m=a.ownerDocument.getElementById(decodeURIComponent(_));m&&(m.scrollIntoView(),m.focus())}return}if(J=!0,Wt(k),t(o),!c.replace_state)return;J=!1}r.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:o,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??o.href===location.href,event:r})}),O.addEventListener("submit",r=>{if(r.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(r.target),o=r.submitter;if(((o==null?void 0:o.formTarget)||a.target)==="_blank"||((o==null?void 0:o.formMethod)||a.method)!=="get")return;const l=new URL((o==null?void 0:o.hasAttribute("formaction"))&&(o==null?void 0:o.formAction)||a.action);if(Ut(l,U,!1))return;const c=r.target,u=wt(c);if(u.reload)return;r.preventDefault(),r.stopPropagation();const h=new FormData(c,o);l.search=new URLSearchParams(h).toString(),F({type:"form",url:l,keepfocus:u.keepfocus,noscroll:u.noscroll,replace_state:u.replace_state??l.href===location.href,event:r})}),addEventListener("popstate",async r=>{var a;if(!Vt){if((a=r.state)!=null&&a[H]){const o=r.state[H];if(C={},o===k)return;const s=D[o],i=r.state[ve]??{},l=new URL(r.state[rn]??location.href),c=r.state[Q],u=w.url?Pt(location)===Pt(w.url):!1;if(c===L&&(Ue||u)){i!==x.state&&(x.state=i),t(l),D[k]=B(),s&&scrollTo(s.x,s.y),k=o;return}const _=o-k;await F({type:"popstate",url:l,popped:{state:i,scroll:s,delta:_},accept:()=>{k=o,L=c},block:()=>{history.go(-_)},nav_token:C,event:r})}else if(!J){const o=new URL(location.href);t(o),E.hash&&location.reload()}}}),addEventListener("hashchange",()=>{J&&(J=!1,history.replaceState({...history.state,[H]:++k,[Q]:L},"",location.href))});for(const r of document.querySelectorAll("link"))fn.has(r.rel)&&(r.href=r.href);addEventListener("pageshow",r=>{r.persisted&&N.navigating.set(Z.current=null)});function t(r){w.url=x.url=r,N.page.set(te(x)),N.page.notify()}}async function Rn(t,{status:e=200,error:n,node_ids:r,params:a,route:o,server_route:s,data:i,form:l}){Le=!0;const c=new URL(location.href);let u;({params:a={},route:o={id:null}}=await At(c,!1)||{}),u=zt.find(({id:p})=>p===o.id);let h,_=!0;try{const p=r.map(async(m,d)=>{const g=i[d];return g!=null&&g.uses&&(g.uses=xn(g.uses)),Yt({loader:E.nodes[m],url:c,params:a,route:o,parent:async()=>{const b={};for(let R=0;R<d;R+=1)Object.assign(b,(await p[R]).data);return b},server_data_node:Xt(g)})}),f=await Promise.all(p);if(u){const m=u.layouts;for(let d=0;d<m.length;d++)m[d]||f.splice(d,0,void 0)}h=await Rt({url:c,params:a,branch:f,status:e,error:n,errors:u==null?void 0:u.errors,form:l,route:u??null})}catch(p){if(p instanceof Kt){await et(new URL(p.location,location.href));return}h=await Qt({status:Gt(p),error:await rt(p,{url:c,params:a,route:o}),url:c,route:o}),t.textContent="",_=!1}finally{}h.props.page&&(h.props.page.state={}),await Oe(h,t,_)}function xn(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url),search_params:new Set((t==null?void 0:t.search_params)??[])}}let Vt=!1;function Ln(t,e=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=Ne(t);if(r&&document.getElementById(r)){const{x:o,y:s}=B();setTimeout(()=>{const i=history.state;Vt=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(i,"",t),e&&scrollTo(o,s),Vt=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const o=[];for(let s=0;s<a.rangeCount;s+=1)o.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===o.length){for(let s=0;s<a.rangeCount;s+=1){const i=o[s],l=a.getRangeAt(s);if(i.commonAncestorContainer!==l.commonAncestorContainer||i.startContainer!==l.startContainer||i.endContainer!==l.endContainer||i.startOffset!==l.startOffset||i.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Zt(t,e,n,r,a=null){var c,u;let o,s;const i=new Promise((h,_)=>{o=h,s=_});return i.catch(j),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url,scroll:B()},to:n&&{params:(e==null?void 0:e.params)??null,route:{id:((u=e==null?void 0:e.route)==null?void 0:u.id)??null},url:n,scroll:a},willUnload:!e,type:r,complete:i},fulfil:o,reject:s}}function te(t){return{data:t.data,error:t.error,form:t.form,params:t.params,route:t.route,state:t.state,status:t.status,url:t.url}}function Un(t){const e=new URL(t);return e.hash=decodeURIComponent(t.hash),e}function Ne(t){let e;if(E.hash){const[,,n]=t.hash.split("#",3);e=n??""}else e=t.hash.slice(1);return decodeURIComponent(e)}export{N as a,U as b,Nn as g,Pn as l,x as p,jn as s};