@mcp-graph-workflow/mcp-graph 5.0.4 → 5.0.5
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.
- package/dist/api/routes/benchmark.d.ts.map +1 -1
- package/dist/api/routes/benchmark.js +1 -2
- package/dist/api/routes/benchmark.js.map +1 -1
- package/dist/web/dashboard/dist/assets/benchmark-tab-CuZsNkbP.js +1 -0
- package/dist/web/dashboard/dist/assets/{gitnexus-tab-DMCU41Nr.js → gitnexus-tab-D7If6lxT.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-tab-BK8wjCuY.js → graph-tab-Dp7PfUEJ.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-utils-qelY_PVT.js → graph-utils-D5iPoiPD.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-BBlpGofr.js → index-CN9Wi5mu.js} +2 -2
- package/dist/web/dashboard/dist/assets/{insights-tab-OQnPT7h1.js → insights-tab-CLA0OIxd.js} +1 -1
- package/dist/web/dashboard/dist/assets/{logs-tab-BCwPTvn9.js → logs-tab-CSYlvuCu.js} +1 -1
- package/dist/web/dashboard/dist/assets/{prd-backlog-tab-DkTq385t.js → prd-backlog-tab-BBLpErTk.js} +1 -1
- package/dist/web/dashboard/dist/assets/{serena-tab-CZ8Lp8yJ.js → serena-tab-BxYP8nU5.js} +1 -1
- package/dist/web/dashboard/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/web/dashboard/dist/assets/benchmark-tab-5r5wZQij.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAIlE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CA+FhE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Router } from "express";
|
|
2
2
|
import { buildTaskContext } from "../../core/context/compact-context.js";
|
|
3
|
-
import { estimateTokens } from "../../core/context/token-estimator.js";
|
|
4
3
|
import { detectCycles } from "../../core/planner/dependency-chain.js";
|
|
5
4
|
export function createBenchmarkRouter(storeRef) {
|
|
6
5
|
const router = Router();
|
|
@@ -19,7 +18,7 @@ export function createBenchmarkRouter(storeRef) {
|
|
|
19
18
|
const ctx = buildTaskContext(store, node.id);
|
|
20
19
|
if (!ctx)
|
|
21
20
|
continue;
|
|
22
|
-
const rawTokens =
|
|
21
|
+
const rawTokens = Math.ceil(ctx.metrics.originalChars / 4);
|
|
23
22
|
perTaskMetrics.push({
|
|
24
23
|
id: node.id,
|
|
25
24
|
title: node.title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../../../src/api/routes/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,MAAM,UAAU,qBAAqB,CAAC,QAAkB;IACtD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;YAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC;YACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC;YAE3B,wCAAwC;YACxC,MAAM,cAAc,GAQf,EAAE,CAAC;YAER,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;oBAAE,SAAS;gBAC9D,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC7C,IAAI,CAAC,GAAG;oBAAE,SAAS;gBAEnB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;gBAC3D,cAAc,CAAC,IAAI,CAAC;oBAClB,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa;oBACnC,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY;oBACtC,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB;oBAChD,eAAe,EAAE,GAAG,CAAC,OAAO,CAAC,eAAe;oBAC5C,oBAAoB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC;iBAC3E,CAAC,CAAC;YACL,CAAC;YAED,WAAW;YACX,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC;YACzC,MAAM,qBAAqB,GAAG,UAAU,GAAG,CAAC;gBAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC;gBACvF,CAAC,CAAC,CAAC,CAAC;YACN,MAAM,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;YACxF,MAAM,gBAAgB,GAAG,UAAU,GAAG,CAAC;gBACrC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC;gBACpF,CAAC,CAAC,CAAC,CAAC;YAEN,0BAA0B;YAC1B,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;YAClF,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;YACvE,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;YAEjC,oBAAoB;YACpB,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,SAAS;YACtC,MAAM,gBAAgB,GAAG,GAAG,CAAC,CAAC,SAAS;YACvC,MAAM,WAAW,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,cAAc,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/F,MAAM,aAAa,GAAG,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAEnG,GAAG,CAAC,IAAI,CAAC;gBACP,YAAY,EAAE;oBACZ,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,qBAAqB;oBACrB,UAAU;oBACV,cAAc;oBACd,gBAAgB;oBAChB,gBAAgB;oBAChB,WAAW,EAAE;wBACX,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI;wBAClD,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,IAAI;qBACvD;iBACF;gBACD,sBAAsB,EAAE;oBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,YAAY;oBACZ,YAAY;oBACZ,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB;gBACD,QAAQ,EAAE;oBACR,kBAAkB,EAAE,qCAAqC;oBACzD,aAAa,EAAE,oDAAoD;oBACnE,kBAAkB,EAAE,yDAAyD;oBAC7E,WAAW,EAAE,mCAAmC;oBAChD,cAAc,EAAE,aAAa;oBAC7B,gBAAgB,EAAE,YAAY;iBAC/B;aACF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,a as x,j as e}from"./index-CN9Wi5mu.js";function m(){const[r,o]=i.useState(null),[c,s]=i.useState(!0),[n,d]=i.useState(null);return i.useEffect(()=>{async function t(){try{const l=await x.request("/benchmark");o(l)}catch(l){d(l instanceof Error?l.message:"Failed to load benchmark data")}finally{s(!1)}}t()},[]),{data:r,loading:c,error:n}}function h(){const{data:r,loading:o,error:c}=m();if(o)return e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading benchmark data..."});if(c)return e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load: ",c]});if(!r)return e.jsx("div",{});const{tokenEconomy:s,dependencyIntelligence:n,formulas:d}=r;return e.jsxs("div",{className:"p-6 max-w-5xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Token Economy"}),e.jsxs("div",{className:"grid grid-cols-4 gap-3 mb-4",children:[e.jsx(a,{value:`${s.avgCompressionPercent}%`,label:"Avg Compress"}),e.jsx(a,{value:s.sampleSize>0?Math.round(s.totalTokensSaved/s.sampleSize).toLocaleString():"0",label:"Tokens Saved/Task"}),e.jsx(a,{value:s.totalNodes,label:"Nodes"}),e.jsx(a,{value:s.totalEdges,label:"Edges"})]}),s.perTaskMetrics.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:"Context Compression per Task"}),e.jsx("div",{className:"space-y-1.5","data-testid":"compression-bars",children:s.perTaskMetrics.slice(0,15).map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-32 truncate",title:t.title,children:t.title}),e.jsx("div",{className:"flex-1 h-3 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-[var(--color-accent)]",style:{width:`${Math.min(t.compressionPercent,100)}%`}})}),e.jsxs("span",{className:"text-[var(--color-text-muted)] w-24 text-right",children:[t.compressionPercent,"% (",t.estimatedTokens," tok)"]})]},t.id))})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Dependency Intelligence"}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(a,{value:n.inferredDeps,label:"Auto Inferred"}),e.jsx(a,{value:`${n.blockedTasks}/${s.totalNodes}`,label:"Blocked Detected"}),e.jsx(a,{value:n.cycles,label:"Cycles Detected"})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Formulas & Justification"}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] text-xs space-y-1","data-testid":"formulas-section",children:Object.entries(d).map(([t,l])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("span",{className:"text-[var(--color-text-muted)] font-mono w-40 shrink-0",children:[t,":"]}),e.jsx("span",{children:l})]},t))})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-sm font-semibold mb-3",children:"Cost Savings per Task"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(a,{value:`$${s.costSavings.opusPerTask.toFixed(3)}`,label:"Opus Input"}),e.jsx(a,{value:`$${s.costSavings.sonnetPerTask.toFixed(3)}`,label:"Sonnet Input"})]})]})]})}function a({value:r,label:o}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] text-center","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xl font-bold",children:r}),e.jsx("div",{className:"text-[10px] text-[var(--color-text-muted)] uppercase",children:o})]})}export{h as BenchmarkTab};
|
package/dist/web/dashboard/dist/assets/{gitnexus-tab-DMCU41Nr.js → gitnexus-tab-D7If6lxT.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ar,r as j,t as gt,j as E,a as Se}from"./index-BBlpGofr.js";import{C as ut,b as vi}from"./constants-BIEJOBya.js";var tt={exports:{}},Mt;function yi(){if(Mt)return tt.exports;Mt=1;var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(v,S,T){return Function.prototype.apply.call(v,S,T)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:t=function(v){return Object.getOwnPropertyNames(v)};function e(m){console&&console.warn&&console.warn(m)}var i=Number.isNaN||function(v){return v!==v};function a(){a.init.call(this)}tt.exports=a,tt.exports.once=L,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||i(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(v){for(var S=[],T=1;T<arguments.length;T++)S.push(arguments[T]);var I=v==="error",P=this._events;if(P!==void 0)I=I&&P.error===void 0;else if(!I)return!1;if(I){var N;if(S.length>0&&(N=S[0]),N instanceof Error)throw N;var q=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw q.context=N,q}var U=P[v];if(U===void 0)return!1;if(typeof U=="function")r(U,this,S);else for(var f=U.length,K=b(U,f),T=0;T<f;++T)r(K[T],this,S);return!0};function h(m,v,S,T){var I,P,N;if(s(S),P=m._events,P===void 0?(P=m._events=Object.create(null),m._eventsCount=0):(P.newListener!==void 0&&(m.emit("newListener",v,S.listener?S.listener:S),P=m._events),N=P[v]),N===void 0)N=P[v]=S,++m._eventsCount;else if(typeof N=="function"?N=P[v]=T?[S,N]:[N,S]:T?N.unshift(S):N.push(S),I=u(m),I>0&&N.length>I&&!N.warned){N.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=m,q.type=v,q.count=N.length,e(q)}return m}a.prototype.addListener=function(v,S){return h(this,v,S,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,S){return h(this,v,S,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,S){var T={fired:!1,wrapFn:void 0,target:m,type:v,listener:S},I=d.bind(T);return I.listener=S,T.wrapFn=I,I}a.prototype.once=function(v,S){return s(S),this.on(v,l(this,v,S)),this},a.prototype.prependOnceListener=function(v,S){return s(S),this.prependListener(v,l(this,v,S)),this},a.prototype.removeListener=function(v,S){var T,I,P,N,q;if(s(S),I=this._events,I===void 0)return this;if(T=I[v],T===void 0)return this;if(T===S||T.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete I[v],I.removeListener&&this.emit("removeListener",v,T.listener||S));else if(typeof T!="function"){for(P=-1,N=T.length-1;N>=0;N--)if(T[N]===S||T[N].listener===S){q=T[N].listener,P=N;break}if(P<0)return this;P===0?T.shift():w(T,P),T.length===1&&(I[v]=T[0]),I.removeListener!==void 0&&this.emit("removeListener",v,q||S)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var S,T,I;if(T=this._events,T===void 0)return this;if(T.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):T[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete T[v]),this;if(arguments.length===0){var P=Object.keys(T),N;for(I=0;I<P.length;++I)N=P[I],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=T[v],typeof S=="function")this.removeListener(v,S);else if(S!==void 0)for(I=S.length-1;I>=0;I--)this.removeListener(v,S[I]);return this};function c(m,v,S){var T=m._events;if(T===void 0)return[];var I=T[v];return I===void 0?[]:typeof I=="function"?S?[I.listener||I]:[I]:S?_(I):b(I,I.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var S=v[m];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var S=new Array(v),T=0;T<v;++T)S[T]=m[T];return S}function w(m,v){for(;v+1<m.length;v++)m[v]=m[v+1];m.pop()}function _(m){for(var v=new Array(m.length),S=0;S<v.length;++S)v[S]=m[S].listener||m[S];return v}function L(m,v){return new Promise(function(S,T){function I(N){m.removeListener(v,P),T(N)}function P(){typeof m.removeListener=="function"&&m.removeListener("error",I),S([].slice.call(arguments))}k(m,v,P,{once:!0}),v!=="error"&&C(m,I,{once:!0})})}function C(m,v,S){typeof m.on=="function"&&k(m,"error",v,S)}function k(m,v,S,T){if(typeof m.on=="function")T.once?m.once(v,S):m.on(v,S);else if(typeof m.addEventListener=="function")m.addEventListener(v,function I(P){T.once&&m.removeEventListener(v,I),S(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return tt.exports}var kr=yi();function bi(){const n=arguments[0];for(let r=1,t=arguments.length;r<t;r++)if(arguments[r])for(const e in arguments[r])n[e]=arguments[r][e];return n}let J=bi;typeof Object.assign=="function"&&(J=Object.assign);function ue(n,r,t,e){const i=n._nodes.get(r);let a=null;return i&&(e==="mixed"?a=i.out&&i.out[t]||i.undirected&&i.undirected[t]:e==="directed"?a=i.out&&i.out[t]:a=i.undirected&&i.undirected[t]),a}function te(n){return typeof n=="object"&&n!==null}function Rr(n){let r;for(r in n)return!1;return!0}function oe(n,r,t){Object.defineProperty(n,r,{enumerable:!1,configurable:!1,writable:!0,value:t})}function le(n,r,t){const e={enumerable:!0,configurable:!0};typeof t=="function"?e.get=t:(e.value=t,e.writable=!1),Object.defineProperty(n,r,e)}function Bt(n){return!(!te(n)||n.attributes&&!Array.isArray(n.attributes))}function wi(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function ye(){const n=arguments;let r=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(r===null){if(t++,t>=n.length)return{done:!0};r=n[t][Symbol.iterator]()}if(e=r.next(),e.done){r=null;continue}break}while(!0);return e}}}function Ne(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Pt extends Error{constructor(r){super(),this.name="GraphError",this.message=r}}class D extends Pt{constructor(r){super(r),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,D.prototype.constructor)}}class R extends Pt{constructor(r){super(r),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,R.prototype.constructor)}}class O extends Pt{constructor(r){super(r),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,O.prototype.constructor)}}function Lr(n,r){this.key=n,this.attributes=r,this.clear()}Lr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Dr(n,r){this.key=n,this.attributes=r,this.clear()}Dr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Gr(n,r){this.key=n,this.attributes=r,this.clear()}Gr.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Fe(n,r,t,e,i){this.key=r,this.attributes=i,this.undirected=n,this.source=t,this.target=e}Fe.prototype.attach=function(){let n="out",r="in";this.undirected&&(n=r="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[r][t]=this)};Fe.prototype.attachMulti=function(){let n="out",r="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=r="undirected");const i=this.source[n],a=i[e];if(typeof a>"u"){i[e]=this,this.undirected&&t===e||(this.target[r][t]=this);return}a.previous=this,this.next=a,i[e]=this,this.target[r][t]=this};Fe.prototype.detach=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][r],delete this.target[e][n]};Fe.prototype.detachMulti=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][r],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][r]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Nr=0,Fr=1,Ei=2,Pr=3;function be(n,r,t,e,i,a,o){let s,u,h,d;if(e=""+e,t===Nr){if(s=n._nodes.get(e),!s)throw new R(`Graph.${r}: could not find the "${e}" node in the graph.`);h=i,d=a}else if(t===Pr){if(i=""+i,u=n._edges.get(i),!u)throw new R(`Graph.${r}: could not find the "${i}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new R(`Graph.${r}: the "${e}" node is not attached to the "${i}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`);t===Fr?s=u.source:s=u.target,h=i,d=a}return[s,h,d]}function xi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return o.attributes[s]}}function _i(n,r,t){n.prototype[r]=function(e,i){const[a]=be(this,r,t,e,i);return a.attributes}}function Si(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return o.attributes.hasOwnProperty(s)}}function Ci(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,h]=be(this,r,t,e,i,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Ti(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,h]=be(this,r,t,e,i,a,o);if(typeof h!="function")throw new D(`Graph.${r}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Ai(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function ki(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(!te(s))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Ri(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(!te(s))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return J(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function Li(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(typeof s!="function")throw new D(`Graph.${r}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Di=[{name:n=>`get${n}Attribute`,attacher:xi},{name:n=>`get${n}Attributes`,attacher:_i},{name:n=>`has${n}Attribute`,attacher:Si},{name:n=>`set${n}Attribute`,attacher:Ci},{name:n=>`update${n}Attribute`,attacher:Ti},{name:n=>`remove${n}Attribute`,attacher:Ai},{name:n=>`replace${n}Attributes`,attacher:ki},{name:n=>`merge${n}Attributes`,attacher:Ri},{name:n=>`update${n}Attributes`,attacher:Li}];function Gi(n){Di.forEach(function({name:r,attacher:t}){t(n,r("Node"),Nr),t(n,r("Source"),Fr),t(n,r("Target"),Ei),t(n,r("Opposite"),Pr)})}function Ni(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes[i]}}function Fi(n,r,t){n.prototype[r]=function(e){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(i=ue(this,a,o,t),!i)throw new R(`Graph.${r}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return i.attributes}}function Pi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(i)}}function Ii(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=ue(this,s,u,t),!o)throw new R(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return o.attributes[i]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function zi(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=ue(this,s,u,t),!o)throw new R(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new D(`Graph.${r}: updater should be a function.`);return o.attributes[i]=a(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function Oi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[i],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:i}),this}}function $i(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!te(i))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return a.attributes=i,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Ui(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!te(i))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return J(a.attributes,i),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:i}),this}}function ji(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof i!="function")throw new D(`Graph.${r}: provided updater is not a function.`);return a.attributes=i(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Mi=[{name:n=>`get${n}Attribute`,attacher:Ni},{name:n=>`get${n}Attributes`,attacher:Fi},{name:n=>`has${n}Attribute`,attacher:Pi},{name:n=>`set${n}Attribute`,attacher:Ii},{name:n=>`update${n}Attribute`,attacher:zi},{name:n=>`remove${n}Attribute`,attacher:Oi},{name:n=>`replace${n}Attributes`,attacher:$i},{name:n=>`merge${n}Attributes`,attacher:Ui},{name:n=>`update${n}Attributes`,attacher:ji}];function Bi(n){Mi.forEach(function({name:r,attacher:t}){t(n,r("Edge"),"mixed"),t(n,r("DirectedEdge"),"directed"),t(n,r("UndirectedEdge"),"undirected")})}const Hi=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Wi(n,r,t,e){let i=!1;for(const a in r){if(a===e)continue;const o=r[a];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&i)return o.key}}function Vi(n,r,t,e){let i,a,o,s=!1;for(const u in r)if(u!==e){i=r[u];do{if(a=i.source,o=i.target,s=t(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),n&&s)return i.key;i=i.next}while(i!==void 0)}}function pt(n,r){const t=Object.keys(n),e=t.length;let i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===r){i=void 0;continue}i=n[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function qi(n,r,t,e){const i=r[t];if(!i)return;const a=i.source,o=i.target;if(e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&n)return i.key}function Ki(n,r,t,e){let i=r[t];if(!i)return;let a=!1;do{if(a=e(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&a)return i.key;i=i.next}while(i!==void 0)}function mt(n,r){let t=n[r];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Yi(n,r){if(n.size===0)return[];if(r==="mixed"||r===n.type)return Array.from(n._edges.keys());const t=r==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),i=r==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===i&&(e[o++]=u.key);return e}function Ir(n,r,t,e){if(r.size===0)return;const i=t!=="mixed"&&t!==r.type,a=t==="undirected";let o,s,u=!1;const h=r._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function Zi(n,r){if(n.size===0)return Ne();const t=r!=="mixed"&&r!==n.type,e=r==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=i.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function It(n,r,t,e,i,a){const o=r?Vi:Wi;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,i.in,a),n&&s)||e!=="in"&&(s=o(n,i.out,a,e?void 0:i.key),n&&s))||t!=="directed"&&(s=o(n,i.undirected,a),n&&s))return s}function Xi(n,r,t,e){const i=[];return It(!1,n,r,t,e,function(a){i.push(a)}),i}function Qi(n,r,t){let e=Ne();return n!=="undirected"&&(r!=="out"&&typeof t.in<"u"&&(e=ye(e,pt(t.in))),r!=="in"&&typeof t.out<"u"&&(e=ye(e,pt(t.out,r?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=ye(e,pt(t.undirected))),e}function zt(n,r,t,e,i,a,o){const s=t?Ki:qi;let u;if(r!=="undirected"&&(typeof i.in<"u"&&e!=="out"&&(u=s(n,i.in,a,o),n&&u)||typeof i.out<"u"&&e!=="in"&&(e||i.key!==a)&&(u=s(n,i.out,a,o),n&&u))||r!=="directed"&&typeof i.undirected<"u"&&(u=s(n,i.undirected,a,o),n&&u))return u}function Ji(n,r,t,e,i){const a=[];return zt(!1,n,r,t,e,i,function(o){a.push(o)}),a}function en(n,r,t,e){let i=Ne();return n!=="undirected"&&(typeof t.in<"u"&&r!=="out"&&e in t.in&&(i=ye(i,mt(t.in,e))),typeof t.out<"u"&&r!=="in"&&e in t.out&&(r||t.key!==e)&&(i=ye(i,mt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(i=ye(i,mt(t.undirected,e))),i}function tn(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Yi(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new R(`Graph.${t}: could not find the "${a}" node in the graph.`);return Xi(this.multi,e==="mixed"?this.type:e,i,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new R(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new R(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Ji(e,this.multi,i,s,o)}throw new D(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function rn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ir(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new R(`Graph.${a}: could not find the "${h}" node in the graph.`);return It(!1,this.multi,e==="mixed"?this.type:e,i,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new R(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new R(`Graph.${a}: could not find the "${d}" target node in the graph.`);return zt(!1,e,this.multi,i,c,d,l)}throw new D(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,_,L,C,k,m)=>{l[g++]=d(b,w,_,L,C,k,m)})}else l=[],h.push((c,g,b,w,_,L,C)=>{l.push(d(c,g,b,w,_,L,C))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,_,L,C)=>{d(c,g,b,w,_,L,C)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new D(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new D(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,_,L,C,k)=>{c=d(c,g,b,w,_,L,C,k)}),this[a].apply(this,h),c}}function nn(n,r){const{name:t,type:e,direction:i}=r,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ir(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new R(`Graph.${a}: could not find the "${u}" node in the graph.`);return It(!0,this.multi,e==="mixed"?this.type:e,i,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new R(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new R(`Graph.${a}: could not find the "${h}" target node in the graph.`);return zt(!0,e,this.multi,i,l,h,d)}throw new D(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,_,L)=>h(l,c,g,b,w,_,L)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,_,L)=>!h(l,c,g,b,w,_,L)),!this[a].apply(this,u)}}function an(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ne();if(!arguments.length)return Zi(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new R(`Graph.${a}: could not find the "${o}" node in the graph.`);return Qi(e,i,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new R(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new R(`Graph.${a}: could not find the "${s}" target node in the graph.`);return en(e,i,u,s)}throw new D(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function on(n){Hi.forEach(r=>{tn(n,r),rn(n,r),nn(n,r),an(n,r)})}const sn=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ht(){this.A=null,this.B=null}ht.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ht.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function $e(n,r,t,e,i){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(r&&r.has(h.key))continue;const d=i(h.key,h.attributes);if(n&&d)return h.key}}function Ot(n,r,t,e,i){if(r!=="mixed"){if(r==="undirected")return $e(n,null,e,e.undirected,i);if(typeof t=="string")return $e(n,null,e,e[t],i)}const a=new ht;let o;if(r!=="undirected"){if(t!=="out"){if(o=$e(n,null,e,e.in,i),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=$e(n,a,e,e.out,i),n&&o)return o;a.wrap(e.out)}}if(r!=="directed"&&(o=$e(n,a,e,e.undirected,i),n&&o))return o}function un(n,r,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof r=="string")return Object.keys(t[r])}const e=[];return Ot(!1,n,r,t,function(i){e.push(i)}),e}function Ue(n,r,t){const e=Object.keys(t),i=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===r?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function hn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof r=="string")return Ue(null,t,t[r])}let e=Ne();const i=new ht;return n!=="undirected"&&(r!=="out"&&(e=ye(e,Ue(i,t,t.in))),r!=="in"&&(e=ye(e,Ue(i,t,t.out)))),n!=="directed"&&(e=ye(e,Ue(i,t,t.undirected))),e}function dn(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new R(`Graph.${t}: could not find the "${a}" node in the graph.`);return un(e==="mixed"?this.type:e,i,o)}}function ln(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new R(`Graph.${a}: could not find the "${h}" node in the graph.`);Ot(!1,e==="mixed"?this.type:e,i,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new D(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function cn(n,r){const{name:t,type:e,direction:i}=r,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new R(`Graph.${o}: could not find the "${h}" node in the graph.`);return Ot(!0,e==="mixed"?this.type:e,i,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function fn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ne();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new R(`Graph.${a}: could not find the "${o}" node in the graph.`);return hn(e==="mixed"?this.type:e,i,s)}}function gn(n){sn.forEach(r=>{dn(n,r),ln(n,r),cn(n,r),fn(n,r)})}function rt(n,r,t,e,i){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,i(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(r&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,i(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&i(u.key,null,u.attributes,null,null,null,null)}}function pn(n,r){const t={key:n};return Rr(r.attributes)||(t.attributes=J({},r.attributes)),t}function mn(n,r,t){const e={key:r,source:t.source.key,target:t.target.key};return Rr(t.attributes)||(e.attributes=J({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function vn(n){if(!te(n))throw new D('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new D("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!te(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function yn(n){if(!te(n))throw new D('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new D("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new D("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!te(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new D("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const bn=wi(),wn=new Set(["directed","undirected","mixed"]),Ht=new Set(["domain","_events","_eventsCount","_maxListeners"]),En=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],xn={allowSelfLoops:!0,multi:!1,type:"mixed"};function _n(n,r,t){if(t&&!te(t))throw new D(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(r=""+r,t=t||{},n._nodes.has(r))throw new O(`Graph.addNode: the "${r}" node already exist in the graph.`);const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function Wt(n,r,t){const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function zr(n,r,t,e,i,a,o,s){if(!e&&n.type==="undirected")throw new O(`Graph.${r}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new O(`Graph.${r}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!te(s))throw new D(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new O(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new R(`Graph.${r}: source node "${a}" not found.`);if(!h)throw new R(`Graph.${r}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new O(`Graph.${r}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new O(`Graph.${r}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Fe(e,i,u,h,s);n._edges.set(i,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=i,n.emit("edgeAdded",d),i}function Sn(n,r,t,e,i,a,o,s,u){if(!e&&n.type==="undirected")throw new O(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new O(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new D(`Graph.${r}: invalid updater function. Expecting a function but got "${s}"`)}else if(!te(s))throw new D(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new O(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(i),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new O(`Graph.${r}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const C=[g.key,!1,!1,!1];if(u?!h:!s)return C;if(u){const k=g.attributes;g.attributes=h(k),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else J(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return C}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new O(`Graph.${r}: the "${i}" edge already exists in the graph.`);let w=!1,_=!1;d||(d=Wt(n,a,{}),w=!0,a===o&&(l=d,_=!0)),l||(l=Wt(n,o,{}),_=!0),c=new Fe(e,i,d,l,s),n._edges.set(i,c);const L=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,L&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,L&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=i,n.emit("edgeAdded",b),[i,!0,w,_]}function Re(n,r){n._edges.delete(r.key);const{source:t,target:e,attributes:i}=r,a=r.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?r.detachMulti():r.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:r.key,attributes:i,source:t.key,target:e.key,undirected:a})}class V extends kr.EventEmitter{constructor(r){if(super(),r=J({},xn,r),typeof r.multi!="boolean")throw new D(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${r.multi}".`);if(!wn.has(r.type))throw new D(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${r.type}".`);if(typeof r.allowSelfLoops!="boolean")throw new D(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${r.allowSelfLoops}".`);const t=r.type==="mixed"?Lr:r.type==="directed"?Dr:Gr;oe(this,"NodeDataClass",t);const e="geid_"+bn()+"_";let i=0;const a=()=>{let o;do o=e+i++;while(this._edges.has(o));return o};oe(this,"_attributes",{}),oe(this,"_nodes",new Map),oe(this,"_edges",new Map),oe(this,"_directedSize",0),oe(this,"_undirectedSize",0),oe(this,"_directedSelfLoopCount",0),oe(this,"_undirectedSelfLoopCount",0),oe(this,"_edgeKeyGenerator",a),oe(this,"_options",r),Ht.forEach(o=>oe(this,o,this[o])),le(this,"order",()=>this._nodes.size),le(this,"size",()=>this._edges.size),le(this,"directedSize",()=>this._directedSize),le(this,"undirectedSize",()=>this._undirectedSize),le(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),le(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),le(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),le(this,"multi",this._options.multi),le(this,"type",this._options.type),le(this,"allowSelfLoops",this._options.allowSelfLoops),le(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(r){return this._nodes.has(""+r)}hasDirectedEdge(r,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&!i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.out.hasOwnProperty(t):!1}throw new D(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(r,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.undirected.hasOwnProperty(t):!1}throw new D(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(r,t){if(arguments.length===1){const e=""+r;return this._edges.has(e)}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new D(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(r,t){if(this.type==="undirected")return;if(r=""+r,t=""+t,this.multi)throw new O("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(r);if(!e)throw new R(`Graph.directedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||void 0;if(i)return i.key}undirectedEdge(r,t){if(this.type==="directed")return;if(r=""+r,t=""+t,this.multi)throw new O("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(r);if(!e)throw new R(`Graph.undirectedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=e.undirected&&e.undirected[t]||void 0;if(i)return i.key}edge(r,t){if(this.multi)throw new O("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.edge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areDirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areOutNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areInNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areUndirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areInboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areOutboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.directedDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.undirectedDegree: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.degree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.directedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,i+=t.directedLoops),e-i}outboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,i+=t.directedLoops),e-i}degreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.degreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,i+=t.directedLoops*2),e-i}source(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.source: could not find the "${r}" edge in the graph.`);return t.source.key}target(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.target: could not find the "${r}" edge in the graph.`);return t.target.key}extremities(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.extremities: could not find the "${r}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(r,t){r=""+r,t=""+t;const e=this._edges.get(t);if(!e)throw new R(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=e.source.key,a=e.target.key;if(r===i)return a;if(r===a)return i;throw new R(`Graph.opposite: the "${r}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(r,t){r=""+r,t=""+t;const e=this._edges.get(r);if(!e)throw new R(`Graph.hasExtremity: could not find the "${r}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isUndirected: could not find the "${r}" edge in the graph.`);return t.undirected}isDirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isDirected: could not find the "${r}" edge in the graph.`);return!t.undirected}isSelfLoop(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isSelfLoop: could not find the "${r}" edge in the graph.`);return t.source===t.target}addNode(r,t){return _n(this,r,t).key}mergeNode(r,t){if(t&&!te(t))throw new D(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);r=""+r,t=t||{};let e=this._nodes.get(r);return e?(t&&(J(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:r,attributes:e.attributes,data:t})),[r,!1]):(e=new this.NodeDataClass(r,t),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:t}),[r,!0])}updateNode(r,t){if(t&&typeof t!="function")throw new D(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);r=""+r;let e=this._nodes.get(r);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:r,attributes:e.attributes})}return[r,!1]}const i=t?t({}):{};return e=new this.NodeDataClass(r,i),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:i}),[r,!0]}dropNode(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.dropNode: could not find the "${r}" node in the graph.`);let e;if(this.type!=="undirected"){for(const i in t.out){e=t.out[i];do Re(this,e),e=e.next;while(e)}for(const i in t.in){e=t.in[i];do Re(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const i in t.undirected){e=t.undirected[i];do Re(this,e),e=e.next;while(e)}this._nodes.delete(r),this.emit("nodeDropped",{key:r,attributes:t.attributes})}dropEdge(r){let t;if(arguments.length>1){const e=""+arguments[0],i=""+arguments[1];if(t=ue(this,e,i,this.type),!t)throw new R(`Graph.dropEdge: could not find the "${e}" -> "${i}" edge in the graph.`)}else if(r=""+r,t=this._edges.get(r),!t)throw new R(`Graph.dropEdge: could not find the "${r}" edge in the graph.`);return Re(this,t),this}dropDirectedEdge(r,t){if(arguments.length<2)throw new O("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new O("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");r=""+r,t=""+t;const e=ue(this,r,t,"directed");if(!e)throw new R(`Graph.dropDirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Re(this,e),this}dropUndirectedEdge(r,t){if(arguments.length<2)throw new O("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new O("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=ue(this,r,t,"undirected");if(!e)throw new R(`Graph.dropUndirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Re(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const r=this._nodes.values();let t;for(;t=r.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(r){return this._attributes[r]}getAttributes(){return this._attributes}hasAttribute(r){return this._attributes.hasOwnProperty(r)}setAttribute(r,t){return this._attributes[r]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}updateAttribute(r,t){if(typeof t!="function")throw new D("Graph.updateAttribute: updater should be a function.");const e=this._attributes[r];return this._attributes[r]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}removeAttribute(r){return delete this._attributes[r],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:r}),this}replaceAttributes(r){if(!te(r))throw new D("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=r,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(r){if(!te(r))throw new D("Graph.mergeAttributes: provided attributes are not a plain object.");return J(this._attributes,r),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:r}),this}updateAttributes(r){if(typeof r!="function")throw new D("Graph.updateAttributes: provided updater is not a function.");return this._attributes=r(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(r,t){if(typeof r!="function")throw new D("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Bt(t))throw new D("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,a.attributes=r(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(r,t){if(typeof r!="function")throw new D("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Bt(t))throw new D("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let i,a,o,s;for(;i=e.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=r(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(r){if(typeof r!="function")throw new D("Graph.forEachAdjacencyEntry: expecting a callback.");rt(!1,!1,!1,this,r)}forEachAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new D("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");rt(!1,!1,!0,this,r)}forEachAssymetricAdjacencyEntry(r){if(typeof r!="function")throw new D("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");rt(!1,!0,!1,this,r)}forEachAssymetricAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new D("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");rt(!1,!0,!0,this,r)}nodes(){return Array.from(this._nodes.keys())}forEachNode(r){if(typeof r!="function")throw new D("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)}findNode(r){if(typeof r!="function")throw new D("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return i.key}mapNodes(r){if(typeof r!="function")throw new D("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,i;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)i=e.value,a[o++]=r(i.key,i.attributes);return a}someNode(r){if(typeof r!="function")throw new D("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return!0;return!1}everyNode(r){if(typeof r!="function")throw new D("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,!r(i.key,i.attributes))return!1;return!0}filterNodes(r){if(typeof r!="function")throw new D("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,i;const a=[];for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(r,t){if(typeof r!="function")throw new D("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new D("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const i=this._nodes.values();let a,o;for(;a=i.next(),a.done!==!0;)o=a.value,e=r(e,o.key,o.attributes);return e}nodeEntries(){const r=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=r.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const r=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,a)=>{r[t++]=pn(a,i)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((i,a)=>{e[t++]=mn(this.type,a,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:r,edges:e}}import(r,t=!1){if(r instanceof V)return r.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),r.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!te(r))throw new D("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(r.attributes){if(!te(r.attributes))throw new D("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(r.attributes):this.replaceAttributes(r.attributes)}let e,i,a,o,s;if(r.nodes){if(a=r.nodes,!Array.isArray(a))throw new D("Graph.import: invalid nodes. Expecting an array.");for(e=0,i=a.length;e<i;e++){o=a[e],vn(o);const{key:u,attributes:h}=o;t?this.mergeNode(u,h):this.addNode(u,h)}}if(r.edges){let u=!1;if(this.type==="undirected"&&(u=!0),a=r.edges,!Array.isArray(a))throw new D("Graph.import: invalid edges. Expecting an array.");for(e=0,i=a.length;e<i;e++){s=a[e],yn(s);const{source:h,target:d,attributes:l,undirected:c=u}=s;let g;"key"in s?(g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,h,d,l)):(g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,h,d,l))}}return this}nullCopy(r){const t=new V(J({},this._options,r));return t.replaceAttributes(J({},this.getAttributes())),t}emptyCopy(r){const t=this.nullCopy(r);return this._nodes.forEach((e,i)=>{const a=J({},e.attributes);e=new t.NodeDataClass(i,a),t._nodes.set(i,e)}),t}copy(r){if(r=r||{},typeof r.type=="string"&&r.type!==this.type&&r.type!=="mixed")throw new O(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${r.type}" because this would mean losing information about the current graph.`);if(typeof r.multi=="boolean"&&r.multi!==this.multi&&r.multi!==!0)throw new O("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof r.allowSelfLoops=="boolean"&&r.allowSelfLoops!==this.allowSelfLoops&&r.allowSelfLoops!==!0)throw new O("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(r),e=this._edges.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,zr(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,J({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const r={};this._nodes.forEach((a,o)=>{r[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const i={};for(const a in this)this.hasOwnProperty(a)&&!Ht.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(i[a]=this[a]);return i.attributes=this._attributes,i.nodes=r,i.edges=t,oe(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(V.prototype[Symbol.for("nodejs.util.inspect.custom")]=V.prototype.inspect);En.forEach(n=>{["add","merge","update"].forEach(r=>{const t=n.name(r),e=r==="add"?zr:Sn;n.generateKey?V.prototype[t]=function(i,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,i,a,o,r==="update")}:V.prototype[t]=function(i,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",i,a,o,s,r==="update")}})});Gi(V);Bi(V);on(V);gn(V);class Or extends V{constructor(r){const t=J({type:"directed"},r);if("multi"in t&&t.multi!==!1)throw new D("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new D('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class $r extends V{constructor(r){const t=J({type:"undirected"},r);if("multi"in t&&t.multi!==!1)throw new D("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new D('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Ur extends V{constructor(r){const t=J({multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class jr extends V{constructor(r){const t=J({type:"directed",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new D('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Mr extends V{constructor(r){const t=J({type:"undirected",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new D('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Pe(n){n.from=function(r,t){const e=J({},r.options,t),i=new n(e);return i.import(r),i}}Pe(V);Pe(Or);Pe($r);Pe(Ur);Pe(jr);Pe(Mr);V.Graph=V;V.DirectedGraph=Or;V.UndirectedGraph=$r;V.MultiGraph=Ur;V.MultiDirectedGraph=jr;V.MultiUndirectedGraph=Mr;V.InvalidArgumentsGraphError=D;V.NotFoundGraphError=R;V.UsageGraphError=O;function Cn(n,r){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,r);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function Ve(n){var r=Cn(n,"string");return typeof r=="symbol"?r:r+""}function re(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}function Vt(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,Ve(e.key),e)}}function ie(n,r,t){return r&&Vt(n.prototype,r),t&&Vt(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function De(n){return De=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},De(n)}function Br(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Br=function(){return!!n})()}function Tn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function An(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tn(n)}function he(n,r,t){return r=De(r),An(n,Br()?Reflect.construct(r,t||[],De(n).constructor):r.apply(n,t))}function Rt(n,r){return Rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rt(n,r)}function de(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),r&&Rt(n,r)}function kn(n){if(Array.isArray(n))return n}function Rn(n,r){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var e,i,a,o,s=[],u=!0,h=!1;try{if(a=(t=t.call(n)).next,r===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(e=a.call(t)).done)&&(s.push(e.value),s.length!==r);u=!0);}catch(d){h=!0,i=d}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(h)throw i}}return s}}function Lt(n,r){(r==null||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);t<r;t++)e[t]=n[t];return e}function Hr(n,r){if(n){if(typeof n=="string")return Lt(n,r);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Lt(n,r):void 0}}function Ln(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{g as Ar,r as j,t as gt,j as E,a as Se}from"./index-CN9Wi5mu.js";import{C as ut,b as vi}from"./constants-BIEJOBya.js";var tt={exports:{}},Mt;function yi(){if(Mt)return tt.exports;Mt=1;var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(v,S,T){return Function.prototype.apply.call(v,S,T)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:t=function(v){return Object.getOwnPropertyNames(v)};function e(m){console&&console.warn&&console.warn(m)}var i=Number.isNaN||function(v){return v!==v};function a(){a.init.call(this)}tt.exports=a,tt.exports.once=L,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||i(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(v){for(var S=[],T=1;T<arguments.length;T++)S.push(arguments[T]);var I=v==="error",P=this._events;if(P!==void 0)I=I&&P.error===void 0;else if(!I)return!1;if(I){var N;if(S.length>0&&(N=S[0]),N instanceof Error)throw N;var q=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw q.context=N,q}var U=P[v];if(U===void 0)return!1;if(typeof U=="function")r(U,this,S);else for(var f=U.length,K=b(U,f),T=0;T<f;++T)r(K[T],this,S);return!0};function h(m,v,S,T){var I,P,N;if(s(S),P=m._events,P===void 0?(P=m._events=Object.create(null),m._eventsCount=0):(P.newListener!==void 0&&(m.emit("newListener",v,S.listener?S.listener:S),P=m._events),N=P[v]),N===void 0)N=P[v]=S,++m._eventsCount;else if(typeof N=="function"?N=P[v]=T?[S,N]:[N,S]:T?N.unshift(S):N.push(S),I=u(m),I>0&&N.length>I&&!N.warned){N.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=m,q.type=v,q.count=N.length,e(q)}return m}a.prototype.addListener=function(v,S){return h(this,v,S,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,S){return h(this,v,S,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,S){var T={fired:!1,wrapFn:void 0,target:m,type:v,listener:S},I=d.bind(T);return I.listener=S,T.wrapFn=I,I}a.prototype.once=function(v,S){return s(S),this.on(v,l(this,v,S)),this},a.prototype.prependOnceListener=function(v,S){return s(S),this.prependListener(v,l(this,v,S)),this},a.prototype.removeListener=function(v,S){var T,I,P,N,q;if(s(S),I=this._events,I===void 0)return this;if(T=I[v],T===void 0)return this;if(T===S||T.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete I[v],I.removeListener&&this.emit("removeListener",v,T.listener||S));else if(typeof T!="function"){for(P=-1,N=T.length-1;N>=0;N--)if(T[N]===S||T[N].listener===S){q=T[N].listener,P=N;break}if(P<0)return this;P===0?T.shift():w(T,P),T.length===1&&(I[v]=T[0]),I.removeListener!==void 0&&this.emit("removeListener",v,q||S)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var S,T,I;if(T=this._events,T===void 0)return this;if(T.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):T[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete T[v]),this;if(arguments.length===0){var P=Object.keys(T),N;for(I=0;I<P.length;++I)N=P[I],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=T[v],typeof S=="function")this.removeListener(v,S);else if(S!==void 0)for(I=S.length-1;I>=0;I--)this.removeListener(v,S[I]);return this};function c(m,v,S){var T=m._events;if(T===void 0)return[];var I=T[v];return I===void 0?[]:typeof I=="function"?S?[I.listener||I]:[I]:S?_(I):b(I,I.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var S=v[m];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var S=new Array(v),T=0;T<v;++T)S[T]=m[T];return S}function w(m,v){for(;v+1<m.length;v++)m[v]=m[v+1];m.pop()}function _(m){for(var v=new Array(m.length),S=0;S<v.length;++S)v[S]=m[S].listener||m[S];return v}function L(m,v){return new Promise(function(S,T){function I(N){m.removeListener(v,P),T(N)}function P(){typeof m.removeListener=="function"&&m.removeListener("error",I),S([].slice.call(arguments))}k(m,v,P,{once:!0}),v!=="error"&&C(m,I,{once:!0})})}function C(m,v,S){typeof m.on=="function"&&k(m,"error",v,S)}function k(m,v,S,T){if(typeof m.on=="function")T.once?m.once(v,S):m.on(v,S);else if(typeof m.addEventListener=="function")m.addEventListener(v,function I(P){T.once&&m.removeEventListener(v,I),S(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return tt.exports}var kr=yi();function bi(){const n=arguments[0];for(let r=1,t=arguments.length;r<t;r++)if(arguments[r])for(const e in arguments[r])n[e]=arguments[r][e];return n}let J=bi;typeof Object.assign=="function"&&(J=Object.assign);function ue(n,r,t,e){const i=n._nodes.get(r);let a=null;return i&&(e==="mixed"?a=i.out&&i.out[t]||i.undirected&&i.undirected[t]:e==="directed"?a=i.out&&i.out[t]:a=i.undirected&&i.undirected[t]),a}function te(n){return typeof n=="object"&&n!==null}function Rr(n){let r;for(r in n)return!1;return!0}function oe(n,r,t){Object.defineProperty(n,r,{enumerable:!1,configurable:!1,writable:!0,value:t})}function le(n,r,t){const e={enumerable:!0,configurable:!0};typeof t=="function"?e.get=t:(e.value=t,e.writable=!1),Object.defineProperty(n,r,e)}function Bt(n){return!(!te(n)||n.attributes&&!Array.isArray(n.attributes))}function wi(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function ye(){const n=arguments;let r=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(r===null){if(t++,t>=n.length)return{done:!0};r=n[t][Symbol.iterator]()}if(e=r.next(),e.done){r=null;continue}break}while(!0);return e}}}function Ne(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Pt extends Error{constructor(r){super(),this.name="GraphError",this.message=r}}class D extends Pt{constructor(r){super(r),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,D.prototype.constructor)}}class R extends Pt{constructor(r){super(r),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,R.prototype.constructor)}}class O extends Pt{constructor(r){super(r),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,O.prototype.constructor)}}function Lr(n,r){this.key=n,this.attributes=r,this.clear()}Lr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Dr(n,r){this.key=n,this.attributes=r,this.clear()}Dr.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Gr(n,r){this.key=n,this.attributes=r,this.clear()}Gr.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Fe(n,r,t,e,i){this.key=r,this.attributes=i,this.undirected=n,this.source=t,this.target=e}Fe.prototype.attach=function(){let n="out",r="in";this.undirected&&(n=r="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[r][t]=this)};Fe.prototype.attachMulti=function(){let n="out",r="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=r="undirected");const i=this.source[n],a=i[e];if(typeof a>"u"){i[e]=this,this.undirected&&t===e||(this.target[r][t]=this);return}a.previous=this,this.next=a,i[e]=this,this.target[r][t]=this};Fe.prototype.detach=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][r],delete this.target[e][n]};Fe.prototype.detachMulti=function(){const n=this.source.key,r=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][r],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][r]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Nr=0,Fr=1,Ei=2,Pr=3;function be(n,r,t,e,i,a,o){let s,u,h,d;if(e=""+e,t===Nr){if(s=n._nodes.get(e),!s)throw new R(`Graph.${r}: could not find the "${e}" node in the graph.`);h=i,d=a}else if(t===Pr){if(i=""+i,u=n._edges.get(i),!u)throw new R(`Graph.${r}: could not find the "${i}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new R(`Graph.${r}: the "${e}" node is not attached to the "${i}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`);t===Fr?s=u.source:s=u.target,h=i,d=a}return[s,h,d]}function xi(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return o.attributes[s]}}function _i(n,r,t){n.prototype[r]=function(e,i){const[a]=be(this,r,t,e,i);return a.attributes}}function Si(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return o.attributes.hasOwnProperty(s)}}function Ci(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,h]=be(this,r,t,e,i,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Ti(n,r,t){n.prototype[r]=function(e,i,a,o){const[s,u,h]=be(this,r,t,e,i,a,o);if(typeof h!="function")throw new D(`Graph.${r}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function Ai(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function ki(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(!te(s))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Ri(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(!te(s))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return J(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function Li(n,r,t){n.prototype[r]=function(e,i,a){const[o,s]=be(this,r,t,e,i,a);if(typeof s!="function")throw new D(`Graph.${r}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const Di=[{name:n=>`get${n}Attribute`,attacher:xi},{name:n=>`get${n}Attributes`,attacher:_i},{name:n=>`has${n}Attribute`,attacher:Si},{name:n=>`set${n}Attribute`,attacher:Ci},{name:n=>`update${n}Attribute`,attacher:Ti},{name:n=>`remove${n}Attribute`,attacher:Ai},{name:n=>`replace${n}Attributes`,attacher:ki},{name:n=>`merge${n}Attributes`,attacher:Ri},{name:n=>`update${n}Attributes`,attacher:Li}];function Gi(n){Di.forEach(function({name:r,attacher:t}){t(n,r("Node"),Nr),t(n,r("Source"),Fr),t(n,r("Target"),Ei),t(n,r("Opposite"),Pr)})}function Ni(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes[i]}}function Fi(n,r,t){n.prototype[r]=function(e){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(i=ue(this,a,o,t),!i)throw new R(`Graph.${r}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return i.attributes}}function Pi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(i)}}function Ii(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=ue(this,s,u,t),!o)throw new R(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return o.attributes[i]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function zi(n,r,t){n.prototype[r]=function(e,i,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+i;if(i=arguments[2],a=arguments[3],o=ue(this,s,u,t),!o)throw new R(`Graph.${r}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new D(`Graph.${r}: updater should be a function.`);return o.attributes[i]=a(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function Oi(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[i],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:i}),this}}function $i(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!te(i))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return a.attributes=i,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Ui(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(!te(i))throw new D(`Graph.${r}: provided attributes are not a plain object.`);return J(a.attributes,i),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:i}),this}}function ji(n,r,t){n.prototype[r]=function(e,i){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new O(`Graph.${r}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new O(`Graph.${r}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+i;if(i=arguments[2],a=ue(this,o,s,t),!a)throw new R(`Graph.${r}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new O(`Graph.${r}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new R(`Graph.${r}: could not find the "${e}" edge in the graph.`)}if(typeof i!="function")throw new D(`Graph.${r}: provided updater is not a function.`);return a.attributes=i(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Mi=[{name:n=>`get${n}Attribute`,attacher:Ni},{name:n=>`get${n}Attributes`,attacher:Fi},{name:n=>`has${n}Attribute`,attacher:Pi},{name:n=>`set${n}Attribute`,attacher:Ii},{name:n=>`update${n}Attribute`,attacher:zi},{name:n=>`remove${n}Attribute`,attacher:Oi},{name:n=>`replace${n}Attributes`,attacher:$i},{name:n=>`merge${n}Attributes`,attacher:Ui},{name:n=>`update${n}Attributes`,attacher:ji}];function Bi(n){Mi.forEach(function({name:r,attacher:t}){t(n,r("Edge"),"mixed"),t(n,r("DirectedEdge"),"directed"),t(n,r("UndirectedEdge"),"undirected")})}const Hi=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Wi(n,r,t,e){let i=!1;for(const a in r){if(a===e)continue;const o=r[a];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&i)return o.key}}function Vi(n,r,t,e){let i,a,o,s=!1;for(const u in r)if(u!==e){i=r[u];do{if(a=i.source,o=i.target,s=t(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),n&&s)return i.key;i=i.next}while(i!==void 0)}}function pt(n,r){const t=Object.keys(n),e=t.length;let i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===r){i=void 0;continue}i=n[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function qi(n,r,t,e){const i=r[t];if(!i)return;const a=i.source,o=i.target;if(e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&n)return i.key}function Ki(n,r,t,e){let i=r[t];if(!i)return;let a=!1;do{if(a=e(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&a)return i.key;i=i.next}while(i!==void 0)}function mt(n,r){let t=n[r];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Yi(n,r){if(n.size===0)return[];if(r==="mixed"||r===n.type)return Array.from(n._edges.keys());const t=r==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),i=r==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===i&&(e[o++]=u.key);return e}function Ir(n,r,t,e){if(r.size===0)return;const i=t!=="mixed"&&t!==r.type,a=t==="undirected";let o,s,u=!1;const h=r._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function Zi(n,r){if(n.size===0)return Ne();const t=r!=="mixed"&&r!==n.type,e=r==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=i.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function It(n,r,t,e,i,a){const o=r?Vi:Wi;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,i.in,a),n&&s)||e!=="in"&&(s=o(n,i.out,a,e?void 0:i.key),n&&s))||t!=="directed"&&(s=o(n,i.undirected,a),n&&s))return s}function Xi(n,r,t,e){const i=[];return It(!1,n,r,t,e,function(a){i.push(a)}),i}function Qi(n,r,t){let e=Ne();return n!=="undirected"&&(r!=="out"&&typeof t.in<"u"&&(e=ye(e,pt(t.in))),r!=="in"&&typeof t.out<"u"&&(e=ye(e,pt(t.out,r?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=ye(e,pt(t.undirected))),e}function zt(n,r,t,e,i,a,o){const s=t?Ki:qi;let u;if(r!=="undirected"&&(typeof i.in<"u"&&e!=="out"&&(u=s(n,i.in,a,o),n&&u)||typeof i.out<"u"&&e!=="in"&&(e||i.key!==a)&&(u=s(n,i.out,a,o),n&&u))||r!=="directed"&&typeof i.undirected<"u"&&(u=s(n,i.undirected,a,o),n&&u))return u}function Ji(n,r,t,e,i){const a=[];return zt(!1,n,r,t,e,i,function(o){a.push(o)}),a}function en(n,r,t,e){let i=Ne();return n!=="undirected"&&(typeof t.in<"u"&&r!=="out"&&e in t.in&&(i=ye(i,mt(t.in,e))),typeof t.out<"u"&&r!=="in"&&e in t.out&&(r||t.key!==e)&&(i=ye(i,mt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(i=ye(i,mt(t.undirected,e))),i}function tn(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Yi(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new R(`Graph.${t}: could not find the "${a}" node in the graph.`);return Xi(this.multi,e==="mixed"?this.type:e,i,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new R(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new R(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Ji(e,this.multi,i,s,o)}throw new D(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function rn(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ir(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new R(`Graph.${a}: could not find the "${h}" node in the graph.`);return It(!1,this.multi,e==="mixed"?this.type:e,i,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new R(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new R(`Graph.${a}: could not find the "${d}" target node in the graph.`);return zt(!1,e,this.multi,i,c,d,l)}throw new D(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,_,L,C,k,m)=>{l[g++]=d(b,w,_,L,C,k,m)})}else l=[],h.push((c,g,b,w,_,L,C)=>{l.push(d(c,g,b,w,_,L,C))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,_,L,C)=>{d(c,g,b,w,_,L,C)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new D(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new D(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,_,L,C,k)=>{c=d(c,g,b,w,_,L,C,k)}),this[a].apply(this,h),c}}function nn(n,r){const{name:t,type:e,direction:i}=r,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ir(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new R(`Graph.${a}: could not find the "${u}" node in the graph.`);return It(!0,this.multi,e==="mixed"?this.type:e,i,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new R(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new R(`Graph.${a}: could not find the "${h}" target node in the graph.`);return zt(!0,e,this.multi,i,l,h,d)}throw new D(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,_,L)=>h(l,c,g,b,w,_,L)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,_,L)=>!h(l,c,g,b,w,_,L)),!this[a].apply(this,u)}}function an(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ne();if(!arguments.length)return Zi(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new R(`Graph.${a}: could not find the "${o}" node in the graph.`);return Qi(e,i,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new R(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new R(`Graph.${a}: could not find the "${s}" target node in the graph.`);return en(e,i,u,s)}throw new D(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function on(n){Hi.forEach(r=>{tn(n,r),rn(n,r),nn(n,r),an(n,r)})}const sn=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ht(){this.A=null,this.B=null}ht.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ht.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function $e(n,r,t,e,i){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(r&&r.has(h.key))continue;const d=i(h.key,h.attributes);if(n&&d)return h.key}}function Ot(n,r,t,e,i){if(r!=="mixed"){if(r==="undirected")return $e(n,null,e,e.undirected,i);if(typeof t=="string")return $e(n,null,e,e[t],i)}const a=new ht;let o;if(r!=="undirected"){if(t!=="out"){if(o=$e(n,null,e,e.in,i),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=$e(n,a,e,e.out,i),n&&o)return o;a.wrap(e.out)}}if(r!=="directed"&&(o=$e(n,a,e,e.undirected,i),n&&o))return o}function un(n,r,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof r=="string")return Object.keys(t[r])}const e=[];return Ot(!1,n,r,t,function(i){e.push(i)}),e}function Ue(n,r,t){const e=Object.keys(t),i=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===r?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function hn(n,r,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof r=="string")return Ue(null,t,t[r])}let e=Ne();const i=new ht;return n!=="undirected"&&(r!=="out"&&(e=ye(e,Ue(i,t,t.in))),r!=="in"&&(e=ye(e,Ue(i,t,t.out)))),n!=="directed"&&(e=ye(e,Ue(i,t,t.undirected))),e}function dn(n,r){const{name:t,type:e,direction:i}=r;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new R(`Graph.${t}: could not find the "${a}" node in the graph.`);return un(e==="mixed"?this.type:e,i,o)}}function ln(n,r){const{name:t,type:e,direction:i}=r,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new R(`Graph.${a}: could not find the "${h}" node in the graph.`);Ot(!1,e==="mixed"?this.type:e,i,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new D(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function cn(n,r){const{name:t,type:e,direction:i}=r,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new R(`Graph.${o}: could not find the "${h}" node in the graph.`);return Ot(!0,e==="mixed"?this.type:e,i,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function fn(n,r){const{name:t,type:e,direction:i}=r,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Ne();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new R(`Graph.${a}: could not find the "${o}" node in the graph.`);return hn(e==="mixed"?this.type:e,i,s)}}function gn(n){sn.forEach(r=>{dn(n,r),ln(n,r),cn(n,r),fn(n,r)})}function rt(n,r,t,e,i){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,i(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(r&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,i(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&i(u.key,null,u.attributes,null,null,null,null)}}function pn(n,r){const t={key:n};return Rr(r.attributes)||(t.attributes=J({},r.attributes)),t}function mn(n,r,t){const e={key:r,source:t.source.key,target:t.target.key};return Rr(t.attributes)||(e.attributes=J({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function vn(n){if(!te(n))throw new D('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new D("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!te(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function yn(n){if(!te(n))throw new D('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new D("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new D("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!te(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new D("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const bn=wi(),wn=new Set(["directed","undirected","mixed"]),Ht=new Set(["domain","_events","_eventsCount","_maxListeners"]),En=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],xn={allowSelfLoops:!0,multi:!1,type:"mixed"};function _n(n,r,t){if(t&&!te(t))throw new D(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(r=""+r,t=t||{},n._nodes.has(r))throw new O(`Graph.addNode: the "${r}" node already exist in the graph.`);const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function Wt(n,r,t){const e=new n.NodeDataClass(r,t);return n._nodes.set(r,e),n.emit("nodeAdded",{key:r,attributes:t}),e}function zr(n,r,t,e,i,a,o,s){if(!e&&n.type==="undirected")throw new O(`Graph.${r}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new O(`Graph.${r}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!te(s))throw new D(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new O(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new R(`Graph.${r}: source node "${a}" not found.`);if(!h)throw new R(`Graph.${r}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new O(`Graph.${r}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new O(`Graph.${r}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Fe(e,i,u,h,s);n._edges.set(i,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=i,n.emit("edgeAdded",d),i}function Sn(n,r,t,e,i,a,o,s,u){if(!e&&n.type==="undirected")throw new O(`Graph.${r}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new O(`Graph.${r}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new D(`Graph.${r}: invalid updater function. Expecting a function but got "${s}"`)}else if(!te(s))throw new D(`Graph.${r}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new O(`Graph.${r}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(i),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new O(`Graph.${r}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const C=[g.key,!1,!1,!1];if(u?!h:!s)return C;if(u){const k=g.attributes;g.attributes=h(k),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else J(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return C}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new O(`Graph.${r}: the "${i}" edge already exists in the graph.`);let w=!1,_=!1;d||(d=Wt(n,a,{}),w=!0,a===o&&(l=d,_=!0)),l||(l=Wt(n,o,{}),_=!0),c=new Fe(e,i,d,l,s),n._edges.set(i,c);const L=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,L&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,L&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=i,n.emit("edgeAdded",b),[i,!0,w,_]}function Re(n,r){n._edges.delete(r.key);const{source:t,target:e,attributes:i}=r,a=r.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?r.detachMulti():r.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:r.key,attributes:i,source:t.key,target:e.key,undirected:a})}class V extends kr.EventEmitter{constructor(r){if(super(),r=J({},xn,r),typeof r.multi!="boolean")throw new D(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${r.multi}".`);if(!wn.has(r.type))throw new D(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${r.type}".`);if(typeof r.allowSelfLoops!="boolean")throw new D(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${r.allowSelfLoops}".`);const t=r.type==="mixed"?Lr:r.type==="directed"?Dr:Gr;oe(this,"NodeDataClass",t);const e="geid_"+bn()+"_";let i=0;const a=()=>{let o;do o=e+i++;while(this._edges.has(o));return o};oe(this,"_attributes",{}),oe(this,"_nodes",new Map),oe(this,"_edges",new Map),oe(this,"_directedSize",0),oe(this,"_undirectedSize",0),oe(this,"_directedSelfLoopCount",0),oe(this,"_undirectedSelfLoopCount",0),oe(this,"_edgeKeyGenerator",a),oe(this,"_options",r),Ht.forEach(o=>oe(this,o,this[o])),le(this,"order",()=>this._nodes.size),le(this,"size",()=>this._edges.size),le(this,"directedSize",()=>this._directedSize),le(this,"undirectedSize",()=>this._undirectedSize),le(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),le(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),le(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),le(this,"multi",this._options.multi),le(this,"type",this._options.type),le(this,"allowSelfLoops",this._options.allowSelfLoops),le(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(r){return this._nodes.has(""+r)}hasDirectedEdge(r,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&!i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.out.hasOwnProperty(t):!1}throw new D(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(r,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+r,i=this._edges.get(e);return!!i&&i.undirected}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?e.undirected.hasOwnProperty(t):!1}throw new D(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(r,t){if(arguments.length===1){const e=""+r;return this._edges.has(e)}else if(arguments.length===2){r=""+r,t=""+t;const e=this._nodes.get(r);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new D(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(r,t){if(this.type==="undirected")return;if(r=""+r,t=""+t,this.multi)throw new O("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(r);if(!e)throw new R(`Graph.directedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||void 0;if(i)return i.key}undirectedEdge(r,t){if(this.type==="directed")return;if(r=""+r,t=""+t,this.multi)throw new O("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(r);if(!e)throw new R(`Graph.undirectedEdge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=e.undirected&&e.undirected[t]||void 0;if(i)return i.key}edge(r,t){if(this.multi)throw new O("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.edge: could not find the "${r}" source node in the graph.`);if(!this._nodes.has(t))throw new R(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areDirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areOutNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areInNeighbors: could not find the "${r}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areUndirectedNeighbors: could not find the "${r}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areInboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(r,t){r=""+r,t=""+t;const e=this._nodes.get(r);if(!e)throw new R(`Graph.areOutboundNeighbors: could not find the "${r}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.directedDegree: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.undirectedDegree: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outboundDegree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.degree: could not find the "${r}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.directedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,i+=t.directedLoops),e-i}outboundDegreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,i+=t.directedLoops),e-i}degreeWithoutSelfLoops(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.degreeWithoutSelfLoops: could not find the "${r}" node in the graph.`);let e=0,i=0;return this.type!=="directed"&&(e+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,i+=t.directedLoops*2),e-i}source(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.source: could not find the "${r}" edge in the graph.`);return t.source.key}target(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.target: could not find the "${r}" edge in the graph.`);return t.target.key}extremities(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.extremities: could not find the "${r}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(r,t){r=""+r,t=""+t;const e=this._edges.get(t);if(!e)throw new R(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=e.source.key,a=e.target.key;if(r===i)return a;if(r===a)return i;throw new R(`Graph.opposite: the "${r}" node is not attached to the "${t}" edge (${i}, ${a}).`)}hasExtremity(r,t){r=""+r,t=""+t;const e=this._edges.get(r);if(!e)throw new R(`Graph.hasExtremity: could not find the "${r}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isUndirected: could not find the "${r}" edge in the graph.`);return t.undirected}isDirected(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isDirected: could not find the "${r}" edge in the graph.`);return!t.undirected}isSelfLoop(r){r=""+r;const t=this._edges.get(r);if(!t)throw new R(`Graph.isSelfLoop: could not find the "${r}" edge in the graph.`);return t.source===t.target}addNode(r,t){return _n(this,r,t).key}mergeNode(r,t){if(t&&!te(t))throw new D(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);r=""+r,t=t||{};let e=this._nodes.get(r);return e?(t&&(J(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:r,attributes:e.attributes,data:t})),[r,!1]):(e=new this.NodeDataClass(r,t),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:t}),[r,!0])}updateNode(r,t){if(t&&typeof t!="function")throw new D(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);r=""+r;let e=this._nodes.get(r);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:r,attributes:e.attributes})}return[r,!1]}const i=t?t({}):{};return e=new this.NodeDataClass(r,i),this._nodes.set(r,e),this.emit("nodeAdded",{key:r,attributes:i}),[r,!0]}dropNode(r){r=""+r;const t=this._nodes.get(r);if(!t)throw new R(`Graph.dropNode: could not find the "${r}" node in the graph.`);let e;if(this.type!=="undirected"){for(const i in t.out){e=t.out[i];do Re(this,e),e=e.next;while(e)}for(const i in t.in){e=t.in[i];do Re(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const i in t.undirected){e=t.undirected[i];do Re(this,e),e=e.next;while(e)}this._nodes.delete(r),this.emit("nodeDropped",{key:r,attributes:t.attributes})}dropEdge(r){let t;if(arguments.length>1){const e=""+arguments[0],i=""+arguments[1];if(t=ue(this,e,i,this.type),!t)throw new R(`Graph.dropEdge: could not find the "${e}" -> "${i}" edge in the graph.`)}else if(r=""+r,t=this._edges.get(r),!t)throw new R(`Graph.dropEdge: could not find the "${r}" edge in the graph.`);return Re(this,t),this}dropDirectedEdge(r,t){if(arguments.length<2)throw new O("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new O("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");r=""+r,t=""+t;const e=ue(this,r,t,"directed");if(!e)throw new R(`Graph.dropDirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Re(this,e),this}dropUndirectedEdge(r,t){if(arguments.length<2)throw new O("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new O("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=ue(this,r,t,"undirected");if(!e)throw new R(`Graph.dropUndirectedEdge: could not find a "${r}" -> "${t}" edge in the graph.`);return Re(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const r=this._nodes.values();let t;for(;t=r.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(r){return this._attributes[r]}getAttributes(){return this._attributes}hasAttribute(r){return this._attributes.hasOwnProperty(r)}setAttribute(r,t){return this._attributes[r]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}updateAttribute(r,t){if(typeof t!="function")throw new D("Graph.updateAttribute: updater should be a function.");const e=this._attributes[r];return this._attributes[r]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:r}),this}removeAttribute(r){return delete this._attributes[r],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:r}),this}replaceAttributes(r){if(!te(r))throw new D("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=r,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(r){if(!te(r))throw new D("Graph.mergeAttributes: provided attributes are not a plain object.");return J(this._attributes,r),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:r}),this}updateAttributes(r){if(typeof r!="function")throw new D("Graph.updateAttributes: provided updater is not a function.");return this._attributes=r(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(r,t){if(typeof r!="function")throw new D("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Bt(t))throw new D("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,a.attributes=r(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(r,t){if(typeof r!="function")throw new D("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Bt(t))throw new D("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let i,a,o,s;for(;i=e.next(),i.done!==!0;)a=i.value,o=a.source,s=a.target,a.attributes=r(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(r){if(typeof r!="function")throw new D("Graph.forEachAdjacencyEntry: expecting a callback.");rt(!1,!1,!1,this,r)}forEachAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new D("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");rt(!1,!1,!0,this,r)}forEachAssymetricAdjacencyEntry(r){if(typeof r!="function")throw new D("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");rt(!1,!0,!1,this,r)}forEachAssymetricAdjacencyEntryWithOrphans(r){if(typeof r!="function")throw new D("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");rt(!1,!0,!0,this,r)}nodes(){return Array.from(this._nodes.keys())}forEachNode(r){if(typeof r!="function")throw new D("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)}findNode(r){if(typeof r!="function")throw new D("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return i.key}mapNodes(r){if(typeof r!="function")throw new D("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,i;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)i=e.value,a[o++]=r(i.key,i.attributes);return a}someNode(r){if(typeof r!="function")throw new D("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,r(i.key,i.attributes))return!0;return!1}everyNode(r){if(typeof r!="function")throw new D("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,i;for(;e=t.next(),e.done!==!0;)if(i=e.value,!r(i.key,i.attributes))return!1;return!0}filterNodes(r){if(typeof r!="function")throw new D("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,i;const a=[];for(;e=t.next(),e.done!==!0;)i=e.value,r(i.key,i.attributes)&&a.push(i.key);return a}reduceNodes(r,t){if(typeof r!="function")throw new D("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new D("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const i=this._nodes.values();let a,o;for(;a=i.next(),a.done!==!0;)o=a.value,e=r(e,o.key,o.attributes);return e}nodeEntries(){const r=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=r.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const r=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,a)=>{r[t++]=pn(a,i)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((i,a)=>{e[t++]=mn(this.type,a,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:r,edges:e}}import(r,t=!1){if(r instanceof V)return r.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),r.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!te(r))throw new D("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(r.attributes){if(!te(r.attributes))throw new D("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(r.attributes):this.replaceAttributes(r.attributes)}let e,i,a,o,s;if(r.nodes){if(a=r.nodes,!Array.isArray(a))throw new D("Graph.import: invalid nodes. Expecting an array.");for(e=0,i=a.length;e<i;e++){o=a[e],vn(o);const{key:u,attributes:h}=o;t?this.mergeNode(u,h):this.addNode(u,h)}}if(r.edges){let u=!1;if(this.type==="undirected"&&(u=!0),a=r.edges,!Array.isArray(a))throw new D("Graph.import: invalid edges. Expecting an array.");for(e=0,i=a.length;e<i;e++){s=a[e],yn(s);const{source:h,target:d,attributes:l,undirected:c=u}=s;let g;"key"in s?(g=t?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.key,h,d,l)):(g=t?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,h,d,l))}}return this}nullCopy(r){const t=new V(J({},this._options,r));return t.replaceAttributes(J({},this.getAttributes())),t}emptyCopy(r){const t=this.nullCopy(r);return this._nodes.forEach((e,i)=>{const a=J({},e.attributes);e=new t.NodeDataClass(i,a),t._nodes.set(i,e)}),t}copy(r){if(r=r||{},typeof r.type=="string"&&r.type!==this.type&&r.type!=="mixed")throw new O(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${r.type}" because this would mean losing information about the current graph.`);if(typeof r.multi=="boolean"&&r.multi!==this.multi&&r.multi!==!0)throw new O("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof r.allowSelfLoops=="boolean"&&r.allowSelfLoops!==this.allowSelfLoops&&r.allowSelfLoops!==!0)throw new O("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(r),e=this._edges.values();let i,a;for(;i=e.next(),i.done!==!0;)a=i.value,zr(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,J({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const r={};this._nodes.forEach((a,o)=>{r[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const i={};for(const a in this)this.hasOwnProperty(a)&&!Ht.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(i[a]=this[a]);return i.attributes=this._attributes,i.nodes=r,i.edges=t,oe(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(V.prototype[Symbol.for("nodejs.util.inspect.custom")]=V.prototype.inspect);En.forEach(n=>{["add","merge","update"].forEach(r=>{const t=n.name(r),e=r==="add"?zr:Sn;n.generateKey?V.prototype[t]=function(i,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,i,a,o,r==="update")}:V.prototype[t]=function(i,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",i,a,o,s,r==="update")}})});Gi(V);Bi(V);on(V);gn(V);class Or extends V{constructor(r){const t=J({type:"directed"},r);if("multi"in t&&t.multi!==!1)throw new D("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new D('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class $r extends V{constructor(r){const t=J({type:"undirected"},r);if("multi"in t&&t.multi!==!1)throw new D("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new D('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Ur extends V{constructor(r){const t=J({multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class jr extends V{constructor(r){const t=J({type:"directed",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new D('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Mr extends V{constructor(r){const t=J({type:"undirected",multi:!0},r);if("multi"in t&&t.multi!==!0)throw new D("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new D('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Pe(n){n.from=function(r,t){const e=J({},r.options,t),i=new n(e);return i.import(r),i}}Pe(V);Pe(Or);Pe($r);Pe(Ur);Pe(jr);Pe(Mr);V.Graph=V;V.DirectedGraph=Or;V.UndirectedGraph=$r;V.MultiGraph=Ur;V.MultiDirectedGraph=jr;V.MultiUndirectedGraph=Mr;V.InvalidArgumentsGraphError=D;V.NotFoundGraphError=R;V.UsageGraphError=O;function Cn(n,r){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,r);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function Ve(n){var r=Cn(n,"string");return typeof r=="symbol"?r:r+""}function re(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}function Vt(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,Ve(e.key),e)}}function ie(n,r,t){return r&&Vt(n.prototype,r),t&&Vt(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function De(n){return De=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},De(n)}function Br(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Br=function(){return!!n})()}function Tn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function An(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tn(n)}function he(n,r,t){return r=De(r),An(n,Br()?Reflect.construct(r,t||[],De(n).constructor):r.apply(n,t))}function Rt(n,r){return Rt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rt(n,r)}function de(n,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(r&&r.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),r&&Rt(n,r)}function kn(n){if(Array.isArray(n))return n}function Rn(n,r){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var e,i,a,o,s=[],u=!0,h=!1;try{if(a=(t=t.call(n)).next,r===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(e=a.call(t)).done)&&(s.push(e.value),s.length!==r);u=!0);}catch(d){h=!0,i=d}finally{try{if(!u&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(h)throw i}}return s}}function Lt(n,r){(r==null||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);t<r;t++)e[t]=n[t];return e}function Hr(n,r){if(n){if(typeof n=="string")return Lt(n,r);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Lt(n,r):void 0}}function Ln(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ge(n,r){return kn(n)||Rn(n,r)||Hr(n,r)||Ln()}var vt={black:"#000000",silver:"#C0C0C0",gray:"#808080",grey:"#808080",white:"#FFFFFF",maroon:"#800000",red:"#FF0000",purple:"#800080",fuchsia:"#FF00FF",green:"#008000",lime:"#00FF00",olive:"#808000",yellow:"#FFFF00",navy:"#000080",blue:"#0000FF",teal:"#008080",aqua:"#00FFFF",darkblue:"#00008B",mediumblue:"#0000CD",darkgreen:"#006400",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",rebeccapurple:"#663399",mediumaquamarine:"#66CDAA",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370DB",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",palevioletred:"#DB7093",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",lightyellow:"#FFFFE0",ivory:"#FFFFF0"},Wr=new Int8Array(4),yt=new Int32Array(Wr.buffer,0,1),Dn=new Float32Array(Wr.buffer,0,1),Gn=/^\s*rgba?\s*\(/,Nn=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Fn(n){var r=0,t=0,e=0,i=1;if(n[0]==="#")n.length===4?(r=parseInt(n.charAt(1)+n.charAt(1),16),t=parseInt(n.charAt(2)+n.charAt(2),16),e=parseInt(n.charAt(3)+n.charAt(3),16)):(r=parseInt(n.charAt(1)+n.charAt(2),16),t=parseInt(n.charAt(3)+n.charAt(4),16),e=parseInt(n.charAt(5)+n.charAt(6),16)),n.length===9&&(i=parseInt(n.charAt(7)+n.charAt(8),16)/255);else if(Gn.test(n)){var a=n.match(Nn);a&&(r=+a[1],t=+a[2],e=+a[3],a[4]&&(i=+a[4]))}return{r,g:t,b:e,a:i}}var Le={};for(var it in vt)Le[it]=qe(vt[it]),Le[vt[it]]=Le[it];function Vr(n,r,t,e,i){return yt[0]=e<<24|t<<16|r<<8|n,yt[0]=yt[0]&4278190079,Dn[0]}function qe(n){if(n=n.toLowerCase(),typeof Le[n]<"u")return Le[n];var r=Fn(n),t=r.r,e=r.g,i=r.b,a=r.a;a=a*255|0;var o=Vr(t,e,i,a);return Le[n]=o,o}var bt={};function qr(n){if(typeof bt[n]<"u")return bt[n];var r=(n&16711680)>>>16,t=(n&65280)>>>8,e=n&255,i=255,a=Vr(r,t,e,i);return bt[n]=a,a}function qt(n,r,t,e){return t+(r<<8)+(n<<16)}function Kt(n,r,t,e,i,a){var o=Math.floor(t/a*i),s=Math.floor(n.drawingBufferHeight/a-e/a*i),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,r),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var h=Ge(u,4),d=h[0],l=h[1],c=h[2],g=h[3];return[d,l,c,g]}function x(n,r,t){return(r=Ve(r))in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function Yt(n,r){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,e)}return t}function F(n){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Yt(Object(t),!0).forEach(function(e){x(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yt(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function Pn(n,r){for(;!{}.hasOwnProperty.call(n,r)&&(n=De(n))!==null;);return n}function Dt(){return Dt=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,r,t){var e=Pn(n,r);if(e){var i=Object.getOwnPropertyDescriptor(e,r);return i.get?i.get.call(arguments.length<3?n:t):i.value}},Dt.apply(null,arguments)}function Kr(n,r,t,e){var i=Dt(De(n.prototype),r,t);return typeof i=="function"?function(a){return i.apply(t,a)}:i}function In(n){return n.normalized?1:n.size}function wt(n){var r=0;return n.forEach(function(t){return r+=In(t)}),r}function Yr(n,r,t){var e=n==="VERTEX"?r.VERTEX_SHADER:r.FRAGMENT_SHADER,i=r.createShader(e);if(i===null)throw new Error("loadShader: error while creating the shader");r.shaderSource(i,t),r.compileShader(i);var a=r.getShaderParameter(i,r.COMPILE_STATUS);if(!a){var o=r.getShaderInfoLog(i);throw r.deleteShader(i),new Error(`loadShader: error while compiling the shader:
|
|
3
3
|
`.concat(o,`
|
|
4
4
|
`).concat(t))}return i}function zn(n,r){return Yr("VERTEX",n,r)}function On(n,r){return Yr("FRAGMENT",n,r)}function $n(n,r){var t=n.createProgram();if(t===null)throw new Error("loadProgram: error while creating the program.");var e,i;for(e=0,i=r.length;e<i;e++)n.attachShader(t,r[e]);n.linkProgram(t);var a=n.getProgramParameter(t,n.LINK_STATUS);if(!a)throw n.deleteProgram(t),new Error("loadProgram: error while linking the program.");return t}function Zt(n){var r=n.gl,t=n.buffer,e=n.program,i=n.vertexShader,a=n.fragmentShader;r.deleteShader(i),r.deleteShader(a),r.deleteProgram(e),r.deleteBuffer(t)}var Xt=`#define PICKING_MODE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as e,a as X}from"./index-BBlpGofr.js";import{u as ee,a as se,f as M,t as te,s as re,b as ae,c as oe,i as le,W as ne,d as ce,B as de,C as ie,N as xe}from"./graph-utils-qelY_PVT.js";import{A as ue,S as L,a as pe,N as _,E as me}from"./constants-BIEJOBya.js";const be=t.memo(function({statuses:p,types:y,direction:m,onStatusToggle:N,onTypeToggle:h,onDirectionChange:f,onClear:b,showFullGraph:n,totalNodeCount:c,onShowFullGraphChange:v}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Status:"}),ue.map(a=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.has(a),onChange:()=>N(a),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L[a]}}),e.jsx("span",{children:a.replace("_"," ")})]},a))]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Type:"}),pe.map(a=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:y.has(a),onChange:()=>h(a),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:_[a]}}),e.jsx("span",{children:a.replace("_"," ")})]},a))]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Layout:"}),e.jsxs("select",{value:m,onChange:a=>f(a.target.value),className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-1 py-0.5 text-xs",children:[e.jsx("option",{value:"TB",children:"Top → Down"}),e.jsx("option",{value:"LR",children:"Left → Right"})]})]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:()=>v(!n),className:"w-3 h-3"}),e.jsxs("span",{children:["Show all nodes (",c,")"]})]}),n&&c>200&&e.jsx("span",{className:"text-[var(--color-warning)] font-medium",children:"Large graph — may be slow"}),e.jsx("button",{onClick:b,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] underline",children:"Clear"})]})}),E=50,he=t.memo(function({nodes:p,onNodeClick:y}){const[m,N]=t.useState("priority"),[h,f]=t.useState("asc"),[b,n]=t.useState(""),[c,v]=t.useState(0),a=t.useMemo(()=>{if(!b)return p;const s=b.toLowerCase();return p.filter(u=>u.title.toLowerCase().includes(s)||u.type.toLowerCase().includes(s)||u.status.toLowerCase().includes(s)||(u.sprint||"").toLowerCase().includes(s))},[p,b]),g=t.useMemo(()=>[...a].sort((s,u)=>{const C=s[m]??"",w=u[m]??"",S=typeof C=="number"?C-w:String(C).localeCompare(String(w));return h==="asc"?S:-S}),[a,m,h]),i=Math.max(1,Math.ceil(g.length/E)),j=t.useMemo(()=>g.slice(c*E,(c+1)*E),[g,c]),l=s=>{m===s?f(u=>u==="asc"?"desc":"asc"):(N(s),f("asc"))},k=[{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"status",label:"Status"},{key:"priority",label:"Priority"},{key:"xpSize",label:"Size"},{key:"sprint",label:"Sprint"}];return e.jsxs("div",{className:"border-t border-[var(--color-border)]",children:[e.jsx("div",{className:"px-4 py-2 bg-[var(--color-bg-secondary)]",children:e.jsx("input",{type:"text",placeholder:"Search nodes...",value:b,onChange:s=>n(s.target.value),className:"w-full max-w-xs px-2 py-1 text-sm border border-[var(--color-border)] rounded bg-[var(--color-bg)]"})}),e.jsx("div",{className:"overflow-x-auto max-h-64",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-[var(--color-bg-tertiary)]",children:k.map(s=>e.jsxs("th",{onClick:()=>l(s.key),className:"px-3 py-1.5 text-left text-xs font-medium text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text)]",children:[s.label,m===s.key&&(h==="asc"?" ↑":" ↓")]},s.key))})}),e.jsx("tbody",{children:j.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-[var(--color-text-muted)]",children:"No nodes found"})}):j.map(s=>e.jsxs("tr",{onClick:()=>y(s),className:"border-t border-[var(--color-border)] hover:bg-[var(--color-bg-secondary)] cursor-pointer",children:[e.jsx("td",{className:"px-3 py-1.5 max-w-[200px] truncate",children:s.title}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{background:`${_[s.type]}20`,color:_[s.type]},children:s.type})}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{background:`${L[s.status]}20`,color:L[s.status]},children:s.status.replace("_"," ")})}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:s.priority}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:s.xpSize||"-"}),e.jsx("td",{className:"px-3 py-1.5",children:s.sprint||"-"})]},s.id))})]})}),i>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-[var(--color-bg-secondary)] border-t border-[var(--color-border)] text-xs text-[var(--color-text-muted)]",children:[e.jsxs("span",{children:[g.length," nodes"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{disabled:c===0,onClick:()=>v(s=>Math.max(0,s-1)),className:"px-2 py-0.5 rounded border border-[var(--color-border)] disabled:opacity-30",children:"Prev"}),e.jsxs("span",{children:[c+1,"/",i]}),e.jsx("button",{disabled:c>=i-1,onClick:()=>v(s=>Math.min(i-1,s+1)),className:"px-2 py-0.5 rounded border border-[var(--color-border)] disabled:opacity-30",children:"Next"})]})]})]})}),fe=["depends_on","blocks","parent_of","child_of","related_to","priority_over","implements","derived_from"];function ge({fromId:o,toId:p,fromTitle:y,toTitle:m,onCreated:N,onCancel:h}){const[f,b]=t.useState("depends_on"),[n,c]=t.useState(""),[v,a]=t.useState(!1),[g,i]=t.useState(null),j=t.useCallback(async()=>{a(!0),i(null);try{await X.createEdge({from:o,to:p,relationType:f,reason:n.trim()||void 0}),N()}catch(l){i(l instanceof Error?l.message:"Failed to create edge")}finally{a(!1)}},[o,p,f,n,N]);return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded-lg shadow-xl w-96 p-4",children:[e.jsx("h3",{className:"text-sm font-bold mb-3",children:"Create Relationship"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"From"}),e.jsx("div",{className:"text-xs bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded truncate",children:y??o})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"To"}),e.jsx("div",{className:"text-xs bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded truncate",children:m??p})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"Relation Type"}),e.jsx("select",{value:f,onChange:l=>b(l.target.value),className:"w-full text-xs px-2 py-1.5 rounded bg-[var(--color-bg-tertiary)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]",children:fe.map(l=>{const k=me[l];return e.jsx("option",{value:l,children:k.label},l)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"Reason (optional)"}),e.jsx("input",{type:"text",value:n,onChange:l=>c(l.target.value),placeholder:"Why this relationship exists...",className:"w-full text-xs px-2 py-1.5 rounded bg-[var(--color-bg-tertiary)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]"})]}),g&&e.jsx("div",{className:"text-xs text-[var(--color-danger)] bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded",children:g})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:h,className:"text-xs px-3 py-1.5 rounded bg-[var(--color-bg-tertiary)] hover:bg-[var(--color-border)] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:j,disabled:v,className:"text-xs px-3 py-1.5 rounded bg-[var(--color-accent)] text-white font-medium disabled:opacity-50 hover:opacity-90 transition-opacity",children:v?"Creating...":"Create"})]})]})})}const ve={workflowNode:ce},ye={workflowEdge:ne},Ne={hideAttribution:!0};function je({graph:o}){var P,F;const[p,y,m]=ee([]),[N,h,f]=se([]),[b,n]=t.useState(null),[c,v]=t.useState("TB"),[a,g]=t.useState(new Set),[i,j]=t.useState(new Set),[l,k]=t.useState(!1),[s,u]=t.useState(null),C=t.useDeferredValue(a),w=t.useDeferredValue(i),S=t.useDeferredValue(c),D=t.useRef(null),R=t.useCallback((r,x,d)=>{const q=M(o.nodes,l),I=te(q,{statuses:r,types:x}),T=I.map(Q=>Q.id);if(re(D.current,T)&&d===S)return;D.current=T;const H=new Set(T),J=ae(o.edges,H),A=oe(I,J,d);y(A.nodes),h(A.edges)},[o,y,h,S,l]);t.useEffect(()=>{R(C,w,S)},[o,R,C,w,S]);const z=t.useCallback((r,x)=>{n(x.data.sourceNode)},[]),O=t.useCallback(r=>{n(r)},[]),G=t.useCallback(r=>{const x=o.nodes.find(d=>d.id===r);x&&n(x)},[o.nodes]),W=t.useCallback(r=>{r.source&&r.target&&r.source!==r.target&&u({fromId:r.source,toId:r.target})},[]),B=t.useCallback(()=>{u(null)},[]),V=t.useCallback(r=>{g(x=>{const d=new Set(x);return d.has(r)?d.delete(r):d.add(r),d})},[]),Y=t.useCallback(r=>{j(x=>{const d=new Set(x);return d.has(r)?d.delete(r):d.add(r),d})},[]),Z=t.useCallback(()=>{g(new Set),j(new Set)},[]),K=t.useMemo(()=>M(o.nodes,l).filter(x=>!(a.size&&!a.has(x.status)||i.size&&!i.has(x.type))),[o.nodes,a,i,l]),U=s?(P=o.nodes.find(r=>r.id===s.fromId))==null?void 0:P.title:void 0,$=s?(F=o.nodes.find(r=>r.id===s.toId))==null?void 0:F.title:void 0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(be,{statuses:a,types:i,direction:c,onStatusToggle:V,onTypeToggle:Y,onDirectionChange:v,onClear:Z,showFullGraph:l,totalNodeCount:o.nodes.length,onShowFullGraphChange:k}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 relative",children:o.nodes.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg mb-2",children:"No nodes in graph"}),e.jsx("p",{className:"text-sm",children:"Import a PRD to get started"})]})}):e.jsxs(le,{nodes:p,edges:N,onNodesChange:m,onEdgesChange:f,onNodeClick:z,onConnect:W,nodeTypes:ve,edgeTypes:ye,nodesDraggable:!1,nodesConnectable:!0,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Ne,children:[e.jsx(de,{gap:16,size:1}),e.jsx(ie,{showInteractive:!1})]})}),b&&e.jsx(xe,{node:b,edges:o.edges,allNodes:o.nodes,onClose:()=>n(null),onNodeNavigate:G})]}),e.jsx(he,{nodes:K,onNodeClick:O}),s&&e.jsx(ge,{fromId:s.fromId,toId:s.toId,fromTitle:U,toTitle:$,onCreated:B,onCancel:()=>u(null)})]})}function Te({graph:o}){return e.jsx("div",{className:"h-full",children:e.jsx(je,{graph:o})})}export{Te as GraphTab};
|
|
1
|
+
import{r as t,j as e,a as X}from"./index-CN9Wi5mu.js";import{u as ee,a as se,f as M,t as te,s as re,b as ae,c as oe,i as le,W as ne,d as ce,B as de,C as ie,N as xe}from"./graph-utils-D5iPoiPD.js";import{A as ue,S as L,a as pe,N as _,E as me}from"./constants-BIEJOBya.js";const be=t.memo(function({statuses:p,types:y,direction:m,onStatusToggle:N,onTypeToggle:h,onDirectionChange:f,onClear:b,showFullGraph:n,totalNodeCount:c,onShowFullGraphChange:v}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Status:"}),ue.map(a=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:p.has(a),onChange:()=>N(a),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L[a]}}),e.jsx("span",{children:a.replace("_"," ")})]},a))]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Type:"}),pe.map(a=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:y.has(a),onChange:()=>h(a),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:_[a]}}),e.jsx("span",{children:a.replace("_"," ")})]},a))]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-[var(--color-text-muted)]",children:"Layout:"}),e.jsxs("select",{value:m,onChange:a=>f(a.target.value),className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded px-1 py-0.5 text-xs",children:[e.jsx("option",{value:"TB",children:"Top → Down"}),e.jsx("option",{value:"LR",children:"Left → Right"})]})]}),e.jsx("div",{className:"w-px h-4 bg-[var(--color-border)]"}),e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:()=>v(!n),className:"w-3 h-3"}),e.jsxs("span",{children:["Show all nodes (",c,")"]})]}),n&&c>200&&e.jsx("span",{className:"text-[var(--color-warning)] font-medium",children:"Large graph — may be slow"}),e.jsx("button",{onClick:b,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] underline",children:"Clear"})]})}),E=50,he=t.memo(function({nodes:p,onNodeClick:y}){const[m,N]=t.useState("priority"),[h,f]=t.useState("asc"),[b,n]=t.useState(""),[c,v]=t.useState(0),a=t.useMemo(()=>{if(!b)return p;const s=b.toLowerCase();return p.filter(u=>u.title.toLowerCase().includes(s)||u.type.toLowerCase().includes(s)||u.status.toLowerCase().includes(s)||(u.sprint||"").toLowerCase().includes(s))},[p,b]),g=t.useMemo(()=>[...a].sort((s,u)=>{const C=s[m]??"",w=u[m]??"",S=typeof C=="number"?C-w:String(C).localeCompare(String(w));return h==="asc"?S:-S}),[a,m,h]),i=Math.max(1,Math.ceil(g.length/E)),j=t.useMemo(()=>g.slice(c*E,(c+1)*E),[g,c]),l=s=>{m===s?f(u=>u==="asc"?"desc":"asc"):(N(s),f("asc"))},k=[{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"status",label:"Status"},{key:"priority",label:"Priority"},{key:"xpSize",label:"Size"},{key:"sprint",label:"Sprint"}];return e.jsxs("div",{className:"border-t border-[var(--color-border)]",children:[e.jsx("div",{className:"px-4 py-2 bg-[var(--color-bg-secondary)]",children:e.jsx("input",{type:"text",placeholder:"Search nodes...",value:b,onChange:s=>n(s.target.value),className:"w-full max-w-xs px-2 py-1 text-sm border border-[var(--color-border)] rounded bg-[var(--color-bg)]"})}),e.jsx("div",{className:"overflow-x-auto max-h-64",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-[var(--color-bg-tertiary)]",children:k.map(s=>e.jsxs("th",{onClick:()=>l(s.key),className:"px-3 py-1.5 text-left text-xs font-medium text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text)]",children:[s.label,m===s.key&&(h==="asc"?" ↑":" ↓")]},s.key))})}),e.jsx("tbody",{children:j.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-3 py-4 text-center text-[var(--color-text-muted)]",children:"No nodes found"})}):j.map(s=>e.jsxs("tr",{onClick:()=>y(s),className:"border-t border-[var(--color-border)] hover:bg-[var(--color-bg-secondary)] cursor-pointer",children:[e.jsx("td",{className:"px-3 py-1.5 max-w-[200px] truncate",children:s.title}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{background:`${_[s.type]}20`,color:_[s.type]},children:s.type})}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{background:`${L[s.status]}20`,color:L[s.status]},children:s.status.replace("_"," ")})}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:s.priority}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:s.xpSize||"-"}),e.jsx("td",{className:"px-3 py-1.5",children:s.sprint||"-"})]},s.id))})]})}),i>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-[var(--color-bg-secondary)] border-t border-[var(--color-border)] text-xs text-[var(--color-text-muted)]",children:[e.jsxs("span",{children:[g.length," nodes"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{disabled:c===0,onClick:()=>v(s=>Math.max(0,s-1)),className:"px-2 py-0.5 rounded border border-[var(--color-border)] disabled:opacity-30",children:"Prev"}),e.jsxs("span",{children:[c+1,"/",i]}),e.jsx("button",{disabled:c>=i-1,onClick:()=>v(s=>Math.min(i-1,s+1)),className:"px-2 py-0.5 rounded border border-[var(--color-border)] disabled:opacity-30",children:"Next"})]})]})]})}),fe=["depends_on","blocks","parent_of","child_of","related_to","priority_over","implements","derived_from"];function ge({fromId:o,toId:p,fromTitle:y,toTitle:m,onCreated:N,onCancel:h}){const[f,b]=t.useState("depends_on"),[n,c]=t.useState(""),[v,a]=t.useState(!1),[g,i]=t.useState(null),j=t.useCallback(async()=>{a(!0),i(null);try{await X.createEdge({from:o,to:p,relationType:f,reason:n.trim()||void 0}),N()}catch(l){i(l instanceof Error?l.message:"Failed to create edge")}finally{a(!1)}},[o,p,f,n,N]);return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded-lg shadow-xl w-96 p-4",children:[e.jsx("h3",{className:"text-sm font-bold mb-3",children:"Create Relationship"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"From"}),e.jsx("div",{className:"text-xs bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded truncate",children:y??o})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"To"}),e.jsx("div",{className:"text-xs bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded truncate",children:m??p})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"Relation Type"}),e.jsx("select",{value:f,onChange:l=>b(l.target.value),className:"w-full text-xs px-2 py-1.5 rounded bg-[var(--color-bg-tertiary)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]",children:fe.map(l=>{const k=me[l];return e.jsx("option",{value:l,children:k.label},l)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-[var(--color-text-muted)] block mb-1",children:"Reason (optional)"}),e.jsx("input",{type:"text",value:n,onChange:l=>c(l.target.value),placeholder:"Why this relationship exists...",className:"w-full text-xs px-2 py-1.5 rounded bg-[var(--color-bg-tertiary)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]"})]}),g&&e.jsx("div",{className:"text-xs text-[var(--color-danger)] bg-[var(--color-bg-tertiary)] px-2 py-1.5 rounded",children:g})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:h,className:"text-xs px-3 py-1.5 rounded bg-[var(--color-bg-tertiary)] hover:bg-[var(--color-border)] transition-colors",children:"Cancel"}),e.jsx("button",{onClick:j,disabled:v,className:"text-xs px-3 py-1.5 rounded bg-[var(--color-accent)] text-white font-medium disabled:opacity-50 hover:opacity-90 transition-opacity",children:v?"Creating...":"Create"})]})]})})}const ve={workflowNode:ce},ye={workflowEdge:ne},Ne={hideAttribution:!0};function je({graph:o}){var P,F;const[p,y,m]=ee([]),[N,h,f]=se([]),[b,n]=t.useState(null),[c,v]=t.useState("TB"),[a,g]=t.useState(new Set),[i,j]=t.useState(new Set),[l,k]=t.useState(!1),[s,u]=t.useState(null),C=t.useDeferredValue(a),w=t.useDeferredValue(i),S=t.useDeferredValue(c),D=t.useRef(null),R=t.useCallback((r,x,d)=>{const q=M(o.nodes,l),I=te(q,{statuses:r,types:x}),T=I.map(Q=>Q.id);if(re(D.current,T)&&d===S)return;D.current=T;const H=new Set(T),J=ae(o.edges,H),A=oe(I,J,d);y(A.nodes),h(A.edges)},[o,y,h,S,l]);t.useEffect(()=>{R(C,w,S)},[o,R,C,w,S]);const z=t.useCallback((r,x)=>{n(x.data.sourceNode)},[]),O=t.useCallback(r=>{n(r)},[]),G=t.useCallback(r=>{const x=o.nodes.find(d=>d.id===r);x&&n(x)},[o.nodes]),W=t.useCallback(r=>{r.source&&r.target&&r.source!==r.target&&u({fromId:r.source,toId:r.target})},[]),B=t.useCallback(()=>{u(null)},[]),V=t.useCallback(r=>{g(x=>{const d=new Set(x);return d.has(r)?d.delete(r):d.add(r),d})},[]),Y=t.useCallback(r=>{j(x=>{const d=new Set(x);return d.has(r)?d.delete(r):d.add(r),d})},[]),Z=t.useCallback(()=>{g(new Set),j(new Set)},[]),K=t.useMemo(()=>M(o.nodes,l).filter(x=>!(a.size&&!a.has(x.status)||i.size&&!i.has(x.type))),[o.nodes,a,i,l]),U=s?(P=o.nodes.find(r=>r.id===s.fromId))==null?void 0:P.title:void 0,$=s?(F=o.nodes.find(r=>r.id===s.toId))==null?void 0:F.title:void 0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(be,{statuses:a,types:i,direction:c,onStatusToggle:V,onTypeToggle:Y,onDirectionChange:v,onClear:Z,showFullGraph:l,totalNodeCount:o.nodes.length,onShowFullGraphChange:k}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx("div",{className:"flex-1 relative",children:o.nodes.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg mb-2",children:"No nodes in graph"}),e.jsx("p",{className:"text-sm",children:"Import a PRD to get started"})]})}):e.jsxs(le,{nodes:p,edges:N,onNodesChange:m,onEdgesChange:f,onNodeClick:z,onConnect:W,nodeTypes:ve,edgeTypes:ye,nodesDraggable:!1,nodesConnectable:!0,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Ne,children:[e.jsx(de,{gap:16,size:1}),e.jsx(ie,{showInteractive:!1})]})}),b&&e.jsx(xe,{node:b,edges:o.edges,allNodes:o.nodes,onClose:()=>n(null),onNodeNavigate:G})]}),e.jsx(he,{nodes:K,onNodeClick:O}),s&&e.jsx(ge,{fromId:s.fromId,toId:s.toId,fromTitle:U,toTitle:$,onCreated:B,onCancel:()=>u(null)})]})}function Te({graph:o}){return e.jsx("div",{className:"h-full",children:e.jsx(je,{graph:o})})}export{Te as GraphTab};
|