modviz 0.1.2
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/README.md +261 -0
- package/dist/client/_shell.html +0 -0
- package/dist/client/android-chrome-192x192.png +0 -0
- package/dist/client/android-chrome-512x512.png +0 -0
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/assets/app-Sjrldkrg.css +2 -0
- package/dist/client/assets/button-aOWckyNs.js +1 -0
- package/dist/client/assets/check-C0EQe2S8.js +1 -0
- package/dist/client/assets/chevron-down-DrspihmT.js +1 -0
- package/dist/client/assets/chevron-right-DIJHr8AN.js +1 -0
- package/dist/client/assets/colors-CQoWjU5E.js +1 -0
- package/dist/client/assets/command-kkF7_wdz.js +45 -0
- package/dist/client/assets/compare-K6jVFsiI.js +1 -0
- package/dist/client/assets/compare-TOnoe1EP.js +2 -0
- package/dist/client/assets/configure-DnlSnhtN.js +1 -0
- package/dist/client/assets/explorer-C7NclVKg.js +2 -0
- package/dist/client/assets/explorer-Xu2X6XXF.js +1 -0
- package/dist/client/assets/external-link-B9eNA-li.js +1 -0
- package/dist/client/assets/flamegraph-CRVZSAlj.js +13 -0
- package/dist/client/assets/floating-ui.dom-DLIT5tPE.js +1 -0
- package/dist/client/assets/formatting-CiC0SYI8.js +1 -0
- package/dist/client/assets/graph-6Vr74V1k.js +2 -0
- package/dist/client/assets/graph-CVzypIGU.js +2 -0
- package/dist/client/assets/graph-command-menu-D2MoVT2B.js +4 -0
- package/dist/client/assets/graph-command-menu-VWiiW3qy.css +1 -0
- package/dist/client/assets/hierarchy-C8xxGb_u.js +2 -0
- package/dist/client/assets/hierarchy-iO7d4oSK.js +2 -0
- package/dist/client/assets/import-display-D-jRyyjM.js +5 -0
- package/dist/client/assets/imports-CPggnrs-.js +2 -0
- package/dist/client/assets/imports-CodbPyUJ.js +1 -0
- package/dist/client/assets/index-Dj_rhLdR.js +12 -0
- package/dist/client/assets/input-BCFMF0aR.js +1 -0
- package/dist/client/assets/jsx-runtime-DWSWI4JT.js +1 -0
- package/dist/client/assets/lazyRouteComponent-PTSyFp1J.js +1 -0
- package/dist/client/assets/loading-state-CyC_hrTF.js +1 -0
- package/dist/client/assets/modviz-data-BiRqoDI5.js +1 -0
- package/dist/client/assets/modviz-layout-Do93E-IB.js +1 -0
- package/dist/client/assets/modviz-sigma-Xl8qHaxK.js +312 -0
- package/dist/client/assets/portal-BgAm3V3j.js +1 -0
- package/dist/client/assets/routes-DBtN8hrZ.js +1 -0
- package/dist/client/assets/schemas-B4zfTepZ.js +39 -0
- package/dist/client/assets/search-BYHxNrYn.js +1 -0
- package/dist/client/assets/search-params-BaZRBvGI.js +1 -0
- package/dist/client/assets/setup-view-j1o0TuZz.js +1 -0
- package/dist/client/assets/summary-D703Zh3x.js +1 -0
- package/dist/client/assets/tooltip-B1VDU9HG.js +1 -0
- package/dist/client/assets/trace-B67CM5s2.js +2 -0
- package/dist/client/assets/trace-Bwwdw3AM.js +1 -0
- package/dist/client/assets/treemap-BZf2shzY.js +5 -0
- package/dist/client/assets/treemap-Csroy8Gy.js +2 -0
- package/dist/client/assets/utils-DkkZd0ys.js +1 -0
- package/dist/client/favicon-16x16.png +0 -0
- package/dist/client/favicon-32x32.png +0 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/site.webmanifest +19 -0
- package/dist/mod/cli-options.js +225 -0
- package/dist/mod/cli.js +519 -0
- package/dist/mod/index.js +3 -0
- package/dist/mod/llm-analysis.js +29 -0
- package/dist/mod/llm-output.js +742 -0
- package/dist/mod/module-graph-plugins.js +60 -0
- package/dist/mod/production-server.js +103 -0
- package/dist/mod/runtime-host.js +217 -0
- package/dist/mod/snapshot-history.js +73 -0
- package/dist/mod/types.js +3 -0
- package/dist/server/assets/__23tanstack-start-plugin-adapters-3QxJs4a0.js +5 -0
- package/dist/server/assets/_tanstack-start-manifest_v-DMytuIue.js +188 -0
- package/dist/server/assets/button-Bqnnid5i.js +41 -0
- package/dist/server/assets/colors-DhAxrYua.js +100 -0
- package/dist/server/assets/command-SdxShIbL.js +138 -0
- package/dist/server/assets/compare-BFMiiUsB.js +562 -0
- package/dist/server/assets/compare-CpOqTpYu.js +10 -0
- package/dist/server/assets/configure-Bvd45DTI.js +288 -0
- package/dist/server/assets/explorer-C7dODpSv.js +379 -0
- package/dist/server/assets/explorer-CpSb0JTa.js +20 -0
- package/dist/server/assets/flamegraph-CdW-VG6I.js +198 -0
- package/dist/server/assets/formatting-iDlL4tA-.js +4 -0
- package/dist/server/assets/graph-C1G9H5O4.js +438 -0
- package/dist/server/assets/graph-DAGFGioS.js +45 -0
- package/dist/server/assets/graph-command-menu-BV5GtOWx.js +249 -0
- package/dist/server/assets/hierarchy-B4K-Zfn9.js +16 -0
- package/dist/server/assets/hierarchy-BGpWSG-f.js +104 -0
- package/dist/server/assets/import-display-BVIOWcsm.js +124 -0
- package/dist/server/assets/imports-B6JBDl_h.js +379 -0
- package/dist/server/assets/imports-BGe5tZJT.js +28 -0
- package/dist/server/assets/input-C5r-hBix.js +19 -0
- package/dist/server/assets/loading-state-CrvCWTtw.js +23 -0
- package/dist/server/assets/modviz-data-CUyTorv0.js +197 -0
- package/dist/server/assets/modviz-layout-BAH2ogse.js +253 -0
- package/dist/server/assets/modviz-server-DoMlAyFW.js +195 -0
- package/dist/server/assets/modviz-sigma-XYxARWqd.js +1441 -0
- package/dist/server/assets/rolldown-runtime-rSIU-vHC.js +13 -0
- package/dist/server/assets/router-DYJ-zDbU.js +353 -0
- package/dist/server/assets/routes-DInCacpY.js +244 -0
- package/dist/server/assets/search-params-BNApPgkX.js +26 -0
- package/dist/server/assets/setup-view-DjI49Iqr.js +91 -0
- package/dist/server/assets/start-Ba3KII43.js +4 -0
- package/dist/server/assets/summary-z3lXkLCQ.js +208 -0
- package/dist/server/assets/tooltip-Ck0DDfF7.js +24 -0
- package/dist/server/assets/trace-ColKOf9g.js +16 -0
- package/dist/server/assets/trace-eVs-hIZO.js +578 -0
- package/dist/server/assets/treemap-BbZ9M4GF.js +17 -0
- package/dist/server/assets/treemap-CrgWFoCF.js +912 -0
- package/dist/server/assets/utils-BQZm0uva.js +8 -0
- package/dist/server/server.js +5259 -0
- package/dist/shared/modviz-compare.js +120 -0
- package/dist/shared/modviz-trace.js +244 -0
- package/package.json +135 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-DWSWI4JT.js";import{_ as i,c as a,s as o}from"./modviz-data-BiRqoDI5.js";import{t as s}from"./flamegraph-CRVZSAlj.js";import{a as c,c as l,d as u,f as d,i as f,l as p,m,n as h,o as g,r as _,s as v,u as y}from"./graph-command-menu-D2MoVT2B.js";import{r as b,t as x}from"./utils-DkkZd0ys.js";import{t as S}from"./check-C0EQe2S8.js";import{t as C}from"./chevron-down-DrspihmT.js";import{t as w}from"./chevron-right-DIJHr8AN.js";import{D as T,O as E,a as D,i as O,o as ee,r as te,s as k,t as A}from"./command-kkF7_wdz.js";import{t as j}from"./loading-state-CyC_hrTF.js";import{$ as M,A as N,C as ne,Ct as P,D as F,E as re,F as ie,G as ae,H as oe,I as se,J as ce,K as I,M as L,N as R,P as z,Q as B,R as V,S as H,St as le,T as U,Tt as ue,U as de,V as fe,W as pe,X as me,Y as he,Z as ge,_ as _e,_t as ve,at as ye,b as be,bt as xe,ct as Se,d as Ce,dt as we,et as Te,f as Ee,g as De,h as Oe,ht as ke,it as Ae,j as je,lt as Me,m as Ne,mt as Pe,nt as Fe,ot as W,p as Ie,st as Le,tt as Re,u as ze,ut as Be,v as Ve,vt as He,w as Ue,wt as We,x as Ge,xt as Ke,y as qe,yt as Je,z as Ye}from"./floating-ui.dom-DLIT5tPE.js";import{_ as Xe,a as Ze,c as G,h as Qe,l as $e,m as et,o as tt,p as nt,s as rt,t as it}from"./button-aOWckyNs.js";import{_ as at,a as ot,c as st,d as ct,f as lt,g as ut,h as dt,i as ft,l as pt,m as mt,o as ht,p as gt,r as _t,s as vt,t as yt,u as bt}from"./tooltip-B1VDU9HG.js";import{t as xt}from"./portal-BgAm3V3j.js";import{t as St}from"./input-BCFMF0aR.js";import{n as Ct,t as wt}from"./colors-CQoWjU5E.js";var Tt=n(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.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},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){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 p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),K=e(t(),1),Et=Tt();function Dt(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var Ot=Dt;typeof Object.assign==`function`&&(Ot=Object.assign);function kt(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function At(e){return typeof e==`object`&&!!e}function jt(e){let t;for(t in e)return!1;return!0}function Mt(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function Nt(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function Pt(e){return!(!At(e)||e.attributes&&!Array.isArray(e.attributes))}function Ft(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function It(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function Lt(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var Rt=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},q=class e extends Rt{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},J=class e extends Rt{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},Y=class e extends Rt{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function zt(e,t){this.key=e,this.attributes=t,this.clear()}zt.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 Bt(e,t){this.key=e,this.attributes=t,this.clear()}Bt.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Vt(e,t){this.key=e,this.attributes=t,this.clear()}Vt.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ht(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}Ht.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},Ht.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},Ht.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},Ht.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var Ut=0,Wt=1,Gt=2,Kt=3;function qt(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===Ut){if(s=e._nodes.get(r),!s)throw new J(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===Kt){if(i=``+i,c=e._edges.get(i),!c)throw new J(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new J(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new J(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===Wt?c.source:c.target,l=i,u=a}return[s,l,u]}function Jt(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);return a.attributes[o]}}function Yt(e,t,n){e.prototype[t]=function(e,r){let[i]=qt(this,t,n,e,r);return i.attributes}}function Xt(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function Zt(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=qt(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function Qt(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=qt(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new q(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function $t(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function en(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);if(!At(o))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function tn(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);if(!At(o))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return Ot(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function nn(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=qt(this,t,n,e,r,i);if(typeof o!=`function`)throw new q(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var rn=[{name:e=>`get${e}Attribute`,attacher:Jt},{name:e=>`get${e}Attributes`,attacher:Yt},{name:e=>`has${e}Attribute`,attacher:Xt},{name:e=>`set${e}Attribute`,attacher:Zt},{name:e=>`update${e}Attribute`,attacher:Qt},{name:e=>`remove${e}Attribute`,attacher:$t},{name:e=>`replace${e}Attributes`,attacher:en},{name:e=>`merge${e}Attributes`,attacher:tn},{name:e=>`update${e}Attributes`,attacher:nn}];function an(e){rn.forEach(function({name:t,attacher:n}){n(e,t(`Node`),Ut),n(e,t(`Source`),Wt),n(e,t(`Target`),Gt),n(e,t(`Opposite`),Kt)})}function on(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function sn(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Y(`Graph.${t}: 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.`);let i=``+e,a=``+arguments[1];if(r=kt(this,i,a,n),!r)throw new J(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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,r=this._edges.get(e),!r)throw new J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function cn(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function ln(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Y(`Graph.${t}: 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.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=kt(this,o,s,n),!a)throw new J(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function un(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Y(`Graph.${t}: 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.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=kt(this,o,s,n),!a)throw new J(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new q(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function dn(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function fn(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!At(r))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function pn(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!At(r))throw new q(`Graph.${t}: provided attributes are not a plain object.`);return Ot(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function mn(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new Y(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Y(`Graph.${t}: 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.`);let a=``+e,o=``+r;if(r=arguments[2],i=kt(this,a,o,n),!i)throw new J(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new Y(`Graph.${t}: 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 J(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new q(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var hn=[{name:e=>`get${e}Attribute`,attacher:on},{name:e=>`get${e}Attributes`,attacher:sn},{name:e=>`has${e}Attribute`,attacher:cn},{name:e=>`set${e}Attribute`,attacher:ln},{name:e=>`update${e}Attribute`,attacher:un},{name:e=>`remove${e}Attribute`,attacher:dn},{name:e=>`replace${e}Attributes`,attacher:fn},{name:e=>`merge${e}Attributes`,attacher:pn},{name:e=>`update${e}Attributes`,attacher:mn}];function gn(e){hn.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var _n=[{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 vn(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function yn(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function bn(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[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 xn(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function Sn(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function Cn(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function wn(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function Tn(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function En(e,t){if(e.size===0)return Lt();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{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},done:!1}}}}function Dn(e,t,n,r,i,a){let o=t?yn:vn,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function On(e,t,n,r){let i=[];return Dn(!1,e,t,n,r,function(e){i.push(e)}),i}function kn(e,t,n){let r=Lt();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=It(r,bn(n.in))),t!==`in`&&n.out!==void 0&&(r=It(r,bn(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=It(r,bn(n.undirected))),r}function An(e,t,n,r,i,a,o){let s=n?Sn:xn,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function jn(e,t,n,r,i){let a=[];return An(!1,e,t,n,r,i,function(e){a.push(e)}),a}function Mn(e,t,n,r){let i=Lt();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=It(i,Cn(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=It(i,Cn(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=It(i,Cn(n.undirected,r))),i}function Nn(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return wn(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${n}: could not find the "${e}" node in the graph.`);return On(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new J(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${n}: could not find the "${t}" target node in the graph.`);return jn(r,this.multi,i,a,t)}throw new q(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Pn(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(!(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)){if(arguments.length===1)return n=e,Tn(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return Dn(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return An(!1,r,this.multi,i,o,t,n)}throw new q(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new q(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new q(`Graph.${c}: 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 t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function Fn(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,Tn(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return Dn(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return An(!0,r,this.multi,i,o,t,n)}throw new q(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function In(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return Lt();if(!arguments.length)return En(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return kn(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.${a}: could not find the "${t}" target node in the graph.`);return Mn(r,i,n,t)}throw new q(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Ln(e){_n.forEach(t=>{Nn(e,t),Pn(e,t),Fn(e,t),In(e,t)})}var Rn=[{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 zn(){this.A=null,this.B=null}zn.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},zn.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function Bn(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function Vn(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return Bn(e,null,r,r.undirected,i);if(typeof n==`string`)return Bn(e,null,r,r[n],i)}let a=new zn,o;if(t!==`undirected`){if(n!==`out`){if(o=Bn(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=Bn(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=Bn(e,a,r,r.undirected,i),e&&o))return o}function Hn(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return Vn(!1,e,t,n,function(e){r.push(e)}),r}function Un(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Wn(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Un(null,n,n.undirected);if(typeof t==`string`)return Un(null,n,n[t])}let r=Lt(),i=new zn;return e!==`undirected`&&(t!==`out`&&(r=It(r,Un(i,n,n.in))),t!==`in`&&(r=It(r,Un(i,n,n.out)))),e!==`directed`&&(r=It(r,Un(i,n,n.undirected))),r}function Gn(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${n}: could not find the "${e}" node in the graph.`);return Hn(r===`mixed`?this.type:r,i,t)}}function Kn(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);Vn(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new q(`Graph.${c}: 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 r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function qn(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new J(`Graph.${o}: could not find the "${e}" node in the graph.`);return Vn(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function Jn(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return Lt();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new J(`Graph.${a}: could not find the "${e}" node in the graph.`);return Wn(r===`mixed`?this.type:r,i,t)}}function Yn(e){Rn.forEach(t=>{Gn(e,t),Kn(e,t),qn(e,t),Jn(e,t)})}function Xn(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function Zn(e,t){let n={key:e};return jt(t.attributes)||(n.attributes=Ot({},t.attributes)),n}function Qn(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return jt(n.attributes)||(r.attributes=Ot({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function $n(e){if(!At(e))throw new q(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new q(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!At(e.attributes)||e.attributes===null))throw new q(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function er(e){if(!At(e))throw new q(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new q(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new q(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!At(e.attributes)||e.attributes===null))throw new q(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new q(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var tr=Ft(),nr=new Set([`directed`,`undirected`,`mixed`]),rr=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),ir=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],ar={allowSelfLoops:!0,multi:!1,type:`mixed`};function or(e,t,n){if(n&&!At(n))throw new q(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new Y(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function sr(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function cr(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new Y(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Y(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!At(s))throw new q(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new Y(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new J(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new J(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Y(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new Y(`Graph.${t}: 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.`);let d=new Ht(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function lr(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new Y(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new Y(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new q(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!At(s))throw new q(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new Y(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new Y(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else Ot(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new Y(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=sr(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=sr(e,o,{}),g=!0),f=new Ht(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function ur(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var dr=class e extends Et.EventEmitter{constructor(e){if(super(),e=Ot({},ar,e),typeof e.multi!=`boolean`)throw new q(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!nr.has(e.type))throw new q(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new q(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?zt:e.type===`directed`?Bt:Vt;Mt(this,`NodeDataClass`,t);let n=`geid_`+tr()+`_`,r=0;Mt(this,`_attributes`,{}),Mt(this,`_nodes`,new Map),Mt(this,`_edges`,new Map),Mt(this,`_directedSize`,0),Mt(this,`_undirectedSize`,0),Mt(this,`_directedSelfLoopCount`,0),Mt(this,`_undirectedSelfLoopCount`,0),Mt(this,`_edgeKeyGenerator`,()=>{let e;do e=n+ r++;while(this._edges.has(e));return e}),Mt(this,`_options`,e),rr.forEach(e=>Mt(this,e,this[e])),Nt(this,`order`,()=>this._nodes.size),Nt(this,`size`,()=>this._edges.size),Nt(this,`directedSize`,()=>this._directedSize),Nt(this,`undirectedSize`,()=>this._undirectedSize),Nt(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Nt(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),Nt(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),Nt(this,`multi`,this._options.multi),Nt(this,`type`,this._options.type),Nt(this,`allowSelfLoops`,this._options.allowSelfLoops),Nt(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new q(`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(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new q(`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(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}else if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new q(`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(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new Y(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new J(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new Y(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new J(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new Y(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new J(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`directed`?!1:t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new J(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new J(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new J(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new J(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new J(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return or(this,e,t).key}mergeNode(e,t){if(t&&!At(t))throw new q(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(Ot(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new q(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new J(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do ur(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do ur(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do ur(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=kt(this,e,n,this.type),!t)throw new J(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new J(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return ur(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new Y(`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 Y(`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.`);e=``+e,t=``+t;let n=kt(this,e,t,`directed`);if(!n)throw new J(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return ur(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new Y(`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 Y(`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.`);let n=kt(this,e,t,`undirected`);if(!n)throw new J(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return ur(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new q(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!At(e))throw new q(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!At(e))throw new q(`Graph.mergeAttributes: provided attributes are not a plain object.`);return Ot(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new q(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new q(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!Pt(t))throw new q(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new q(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!Pt(t))throw new q(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new q(`Graph.forEachAdjacencyEntry: expecting a callback.`);Xn(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new q(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);Xn(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new q(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);Xn(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new q(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);Xn(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new q(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new q(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new q(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new q(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new q(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new q(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new q(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new q(`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 n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=Zn(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=Qn(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!At(t))throw new q(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!At(t.attributes))throw new q(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new q(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],$n(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new q(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],er(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(Ot({},this._options,t));return n.replaceAttributes(Ot({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=Ot({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new Y(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new Y(`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 e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Y(`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.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,cr(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,Ot({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!rr.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Mt(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(dr.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=dr.prototype.inspect),ir.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?cr:lr;e.generateKey?dr.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:dr.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),an(dr),gn(dr),Ln(dr),Yn(dr);var fr=class extends dr{constructor(e){let t=Ot({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new q(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new q(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},pr=class extends dr{constructor(e){let t=Ot({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new q(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new q(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},mr=class extends dr{constructor(e){let t=Ot({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},hr=class extends dr{constructor(e){let t=Ot({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new q(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},gr=class extends dr{constructor(e){let t=Ot({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new q(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new q(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function _r(e){e.from=function(t,n){let r=new e(Ot({},t.options,n));return r.import(t),r}}_r(dr),_r(fr),_r(pr),_r(mr),_r(hr),_r(gr),dr.Graph=dr,dr.DirectedGraph=fr,dr.UndirectedGraph=pr,dr.MultiGraph=mr,dr.MultiDirectedGraph=hr,dr.MultiUndirectedGraph=gr,dr.InvalidArgumentsGraphError=q,dr.NotFoundGraphError=J,dr.UsageGraphError=Y;function vr(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function yr(e){var t=vr(e,`string`);return typeof t==`symbol`?t:t+``}function br(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function xr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,yr(r.key),r)}}function Sr(e,t,n){return t&&xr(e.prototype,t),n&&xr(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function Cr(e){return Cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Cr(e)}function wr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wr=function(){return!!e})()}function Tr(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function Er(e,t){if(t&&(typeof t==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return Tr(e)}function Dr(e,t,n){return t=Cr(t),Er(e,wr()?Reflect.construct(t,n||[],Cr(e).constructor):t.apply(e,n))}function Or(e,t){return Or=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Or(e,t)}function kr(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,`prototype`,{writable:!1}),t&&Or(e,t)}function Ar(e){if(Array.isArray(e))return e}function jr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Mr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Nr(e,t){if(e){if(typeof e==`string`)return Mr(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mr(e,t):void 0}}function Pr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fr(e,t){return Ar(e)||jr(e,t)||Nr(e,t)||Pr()}var Ir={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`},Lr=new Int8Array(4),Rr=new Int32Array(Lr.buffer,0,1),zr=new Float32Array(Lr.buffer,0,1),Br=/^\s*rgba?\s*\(/,Vr=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Hr(e){var t=0,n=0,r=0,i=1;if(e[0]===`#`)e.length===4?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16)),e.length===9&&(i=parseInt(e.charAt(7)+e.charAt(8),16)/255);else if(Br.test(e)){var a=e.match(Vr);a&&(t=+a[1],n=+a[2],r=+a[3],a[4]&&(i=+a[4]))}return{r:t,g:n,b:r,a:i}}var Ur={};for(var Wr in Ir)Ur[Wr]=Kr(Ir[Wr]),Ur[Ir[Wr]]=Ur[Wr];function Gr(e,t,n,r,i){return Rr[0]=r<<24|n<<16|t<<8|e,i&&(Rr[0]&=4278190079),zr[0]}function Kr(e){if(e=e.toLowerCase(),Ur[e]!==void 0)return Ur[e];var t=Hr(e),n=t.r,r=t.g,i=t.b,a=t.a;a=a*255|0;var o=Gr(n,r,i,a,!0);return Ur[e]=o,o}var qr={};function Jr(e){if(qr[e]!==void 0)return qr[e];var t=Gr((e&16711680)>>>16,(e&65280)>>>8,e&255,255,!0);return qr[e]=t,t}function Yr(e,t,n,r){return n+(t<<8)+(e<<16)}function Xr(e,t,n,r,i,a){var o=Math.floor(n/a*i),s=Math.floor(e.drawingBufferHeight/a-r/a*i),c=new Uint8Array(4);e.bindFramebuffer(e.FRAMEBUFFER,t),e.readPixels(o,s,1,1,e.RGBA,e.UNSIGNED_BYTE,c);var l=Fr(c,4);return[l[0],l[1],l[2],l[3]]}function X(e,t,n){return(t=yr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Zr(Object(n),!0).forEach(function(t){X(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qr(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Cr(e))!==null;);return e}function $r(){return $r=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Qr(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},$r.apply(null,arguments)}function ei(e,t,n,r){var i=$r(Cr(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}function ti(e){return e.normalized?1:e.size}function ni(e){var t=0;return e.forEach(function(e){return t+=ti(e)}),t}function ri(e,t,n){var r=e===`VERTEX`?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(i===null)throw Error(`loadShader: error while creating the shader`);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var a=t.getShaderInfoLog(i);throw t.deleteShader(i),Error(`loadShader: error while compiling the shader:
|
|
3
|
+
${a}
|
|
4
|
+
${n}`)}return i}function ii(e,t){return ri(`VERTEX`,e,t)}function ai(e,t){return ri(`FRAGMENT`,e,t)}function oi(e,t){var n=e.createProgram();if(n===null)throw Error(`loadProgram: error while creating the program.`);var r,i;for(r=0,i=t.length;r<i;r++)e.attachShader(n,t[r]);if(e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS))throw e.deleteProgram(n),Error(`loadProgram: error while linking the program.`);return n}function si(e){var t=e.gl,n=e.buffer,r=e.program,i=e.vertexShader,a=e.fragmentShader;t.deleteShader(i),t.deleteShader(a),t.deleteProgram(r),t.deleteBuffer(n)}var ci=`#define PICKING_MODE
|
|
5
|
+
`,li=X(X(X(X(X(X(X(X({},WebGL2RenderingContext.BOOL,1),WebGL2RenderingContext.BYTE,1),WebGL2RenderingContext.UNSIGNED_BYTE,1),WebGL2RenderingContext.SHORT,2),WebGL2RenderingContext.UNSIGNED_SHORT,2),WebGL2RenderingContext.INT,4),WebGL2RenderingContext.UNSIGNED_INT,4),WebGL2RenderingContext.FLOAT,4),ui=function(){function e(t,n,r){br(this,e),X(this,`array`,new Float32Array),X(this,`constantArray`,new Float32Array),X(this,`capacity`,0),X(this,`verticesCount`,0);var i=this.getDefinition();if(this.VERTICES=i.VERTICES,this.VERTEX_SHADER_SOURCE=i.VERTEX_SHADER_SOURCE,this.FRAGMENT_SHADER_SOURCE=i.FRAGMENT_SHADER_SOURCE,this.UNIFORMS=i.UNIFORMS,this.ATTRIBUTES=i.ATTRIBUTES,this.METHOD=i.METHOD,this.CONSTANT_ATTRIBUTES=`CONSTANT_ATTRIBUTES`in i?i.CONSTANT_ATTRIBUTES:[],this.CONSTANT_DATA=`CONSTANT_DATA`in i?i.CONSTANT_DATA:[],this.isInstanced=`CONSTANT_ATTRIBUTES`in i,this.ATTRIBUTES_ITEMS_COUNT=ni(this.ATTRIBUTES),this.STRIDE=this.VERTICES*this.ATTRIBUTES_ITEMS_COUNT,this.renderer=r,this.normalProgram=this.getProgramInfo(`normal`,t,i.VERTEX_SHADER_SOURCE,i.FRAGMENT_SHADER_SOURCE,null),this.pickProgram=n?this.getProgramInfo(`pick`,t,ci+i.VERTEX_SHADER_SOURCE,ci+i.FRAGMENT_SHADER_SOURCE,n):null,this.isInstanced){var a=ni(this.CONSTANT_ATTRIBUTES);if(this.CONSTANT_DATA.length!==this.VERTICES)throw Error(`Program: error while getting constant data (expected ${this.VERTICES} items, received ${this.CONSTANT_DATA.length} instead)`);this.constantArray=new Float32Array(this.CONSTANT_DATA.length*a);for(var o=0;o<this.CONSTANT_DATA.length;o++){var s=this.CONSTANT_DATA[o];if(s.length!==a)throw Error(`Program: error while getting constant data (one vector has ${s.length} items instead of ${a})`);for(var c=0;c<s.length;c++)this.constantArray[o*a+c]=s[c]}this.STRIDE=this.ATTRIBUTES_ITEMS_COUNT}}return Sr(e,[{key:`kill`,value:function(){si(this.normalProgram),this.pickProgram&&=(si(this.pickProgram),null)}},{key:`getProgramInfo`,value:function(e,t,n,r,i){var a=this.getDefinition(),o=t.createBuffer();if(o===null)throw Error(`Program: error while creating the WebGL buffer.`);var s=ii(t,n),c=ai(t,r),l=oi(t,[s,c]),u={};a.UNIFORMS.forEach(function(e){var n=t.getUniformLocation(l,e);n&&(u[e]=n)});var d={};a.ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)});var f;if(`CONSTANT_ATTRIBUTES`in a&&(a.CONSTANT_ATTRIBUTES.forEach(function(e){d[e.name]=t.getAttribLocation(l,e.name)}),f=t.createBuffer(),f===null))throw Error(`Program: error while creating the WebGL constant buffer.`);return{name:e,program:l,gl:t,frameBuffer:i,buffer:o,constantBuffer:f||{},uniformLocations:u,attributeLocations:d,isPicking:e===`pick`,vertexShader:s,fragmentShader:c}}},{key:`bindProgram`,value:function(e){var t=this,n=0,r=e.gl,i=e.buffer;this.isInstanced?(r.bindBuffer(r.ARRAY_BUFFER,e.constantBuffer),n=0,this.CONSTANT_ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!1)}),r.bufferData(r.ARRAY_BUFFER,this.constantArray,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,e.buffer),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n,!0)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)):(r.bindBuffer(r.ARRAY_BUFFER,i),n=0,this.ATTRIBUTES.forEach(function(r){return n+=t.bindAttribute(r,e,n)}),r.bufferData(r.ARRAY_BUFFER,this.array,r.DYNAMIC_DRAW)),r.bindBuffer(r.ARRAY_BUFFER,null)}},{key:`unbindProgram`,value:function(e){var t=this;this.isInstanced?(this.CONSTANT_ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!1)}),this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e,!0)})):this.ATTRIBUTES.forEach(function(n){return t.unbindAttribute(n,e)})}},{key:`bindAttribute`,value:function(e,t,n,r){var i=li[e.type];if(typeof i!=`number`)throw Error(`Program.bind: yet unsupported attribute type "${e.type}"`);var a=t.attributeLocations[e.name],o=t.gl;if(a!==-1){o.enableVertexAttribArray(a);var s=this.isInstanced?(r?this.ATTRIBUTES_ITEMS_COUNT:ni(this.CONSTANT_ATTRIBUTES))*Float32Array.BYTES_PER_ELEMENT:this.ATTRIBUTES_ITEMS_COUNT*Float32Array.BYTES_PER_ELEMENT;if(o.vertexAttribPointer(a,e.size,e.type,e.normalized||!1,s,n),this.isInstanced&&r)if(o instanceof WebGL2RenderingContext)o.vertexAttribDivisor(a,1);else{var c=o.getExtension(`ANGLE_instanced_arrays`);c&&c.vertexAttribDivisorANGLE(a,1)}}return e.size*i}},{key:`unbindAttribute`,value:function(e,t,n){var r=t.attributeLocations[e.name],i=t.gl;if(r!==-1&&(i.disableVertexAttribArray(r),this.isInstanced&&n))if(i instanceof WebGL2RenderingContext)i.vertexAttribDivisor(r,0);else{var a=i.getExtension(`ANGLE_instanced_arrays`);a&&a.vertexAttribDivisorANGLE(r,0)}}},{key:`reallocate`,value:function(e){e!==this.capacity&&(this.capacity=e,this.verticesCount=this.VERTICES*e,this.array=new Float32Array(this.isInstanced?this.capacity*this.ATTRIBUTES_ITEMS_COUNT:this.verticesCount*this.ATTRIBUTES_ITEMS_COUNT))}},{key:`hasNothingToRender`,value:function(){return this.verticesCount===0}},{key:`renderProgram`,value:function(e,t){var n=t.gl,r=t.program;n.enable(n.BLEND),n.useProgram(r),this.setUniforms(e,t),this.drawWebGL(this.METHOD,t)}},{key:`render`,value:function(e){this.hasNothingToRender()||(this.pickProgram&&(this.pickProgram.gl.viewport(0,0,e.width*e.pixelRatio/e.downSizingRatio,e.height*e.pixelRatio/e.downSizingRatio),this.bindProgram(this.pickProgram),this.renderProgram(Z(Z({},e),{},{pixelRatio:e.pixelRatio/e.downSizingRatio}),this.pickProgram),this.unbindProgram(this.pickProgram)),this.normalProgram.gl.viewport(0,0,e.width*e.pixelRatio,e.height*e.pixelRatio),this.bindProgram(this.normalProgram),this.renderProgram(e,this.normalProgram),this.unbindProgram(this.normalProgram))}},{key:`drawWebGL`,value:function(e,t){var n=t.gl,r=t.frameBuffer;if(n.bindFramebuffer(n.FRAMEBUFFER,r),!this.isInstanced)n.drawArrays(e,0,this.verticesCount);else if(n instanceof WebGL2RenderingContext)n.drawArraysInstanced(e,0,this.VERTICES,this.capacity);else{var i=n.getExtension(`ANGLE_instanced_arrays`);i&&i.drawArraysInstancedANGLE(e,0,this.VERTICES,this.capacity)}}}])}(),di=function(e){function t(){return br(this,t),Dr(this,t,arguments)}return kr(t,e),Sr(t,[{key:`kill`,value:function(){ei(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n){var r=t*this.STRIDE;if(n.hidden){for(var i=r+this.STRIDE;r<i;r++)this.array[r]=0;return}return this.processVisibleItem(Jr(e),r,n)}}])}(ui),fi=function(e){function t(){var e;br(this,t);var n=[...arguments];return e=Dr(this,t,[].concat(n)),X(e,`drawLabel`,void 0),e}return kr(t,e),Sr(t,[{key:`kill`,value:function(){ei(t,`kill`,this,3)([])}},{key:`process`,value:function(e,t,n,r,i){var a=t*this.STRIDE;if(i.hidden||n.hidden||r.hidden){for(var o=a+this.STRIDE;a<o;a++)this.array[a]=0;return}return this.processVisibleItem(Jr(e),a,n,r,i)}}])}(ui);function pi(e,t){return function(){function n(r,i,a){br(this,n),X(this,`drawLabel`,t),this.programs=e.map(function(e){return new e(r,i,a)})}return Sr(n,[{key:`reallocate`,value:function(e){this.programs.forEach(function(t){return t.reallocate(e)})}},{key:`process`,value:function(e,t,n,r,i){this.programs.forEach(function(a){return a.process(e,t,n,r,i)})}},{key:`render`,value:function(e){this.programs.forEach(function(t){return t.render(e)})}},{key:`kill`,value:function(){this.programs.forEach(function(e){return e.kill()})}}])}()}function mi(e,t,n,r,i){var a=i.edgeLabelSize,o=i.edgeLabelFont,s=i.edgeLabelWeight,c=i.edgeLabelColor.attribute?t[i.edgeLabelColor.attribute]||i.edgeLabelColor.color||`#000`:i.edgeLabelColor.color,l=t.label;if(l){e.fillStyle=c,e.font=`${s} ${a}px ${o}`;var u=n.size,d=r.size,f=n.x,p=n.y,m=r.x,h=r.y,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);if(!(b<u+d)){f+=v*u/b,p+=y*u/b,m-=v*d/b,h-=y*d/b,g=(f+m)/2,_=(p+h)/2,v=m-f,y=h-p,b=Math.sqrt(v*v+y*y);var x=e.measureText(l).width;if(x>b){var S=`…`;for(l+=S,x=e.measureText(l).width;x>b&&l.length>1;)l=l.slice(0,-2)+S,x=e.measureText(l).width;if(l.length<4)return}var C=v>0?y>0?Math.acos(v/b):Math.asin(y/b):y>0?Math.acos(v/b)+Math.PI:Math.asin(v/b)+Math.PI/2;e.save(),e.translate(g,_),e.rotate(C),e.fillText(l,-x/2,t.size/2+a),e.restore()}}}function hi(e,t,n){if(t.label){var r=n.labelSize,i=n.labelFont,a=n.labelWeight;e.fillStyle=n.labelColor.attribute?t[n.labelColor.attribute]||n.labelColor.color||`#000`:n.labelColor.color,e.font=`${a} ${r}px ${i}`,e.fillText(t.label,t.x+t.size+3,t.y+r/3)}}function gi(e,t,n){var r=n.labelSize,i=n.labelFont;e.font=`${n.labelWeight} ${r}px ${i}`,e.fillStyle=`#FFF`,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor=`#000`;var a=2;if(typeof t.label==`string`){var o=e.measureText(t.label).width,s=Math.round(o+5),c=Math.round(r+2*a),l=Math.max(t.size,r/2)+a,u=Math.asin(c/2/l),d=Math.sqrt(Math.abs(l**2-(c/2)**2));e.beginPath(),e.moveTo(t.x+d,t.y+c/2),e.lineTo(t.x+l+s,t.y+c/2),e.lineTo(t.x+l+s,t.y-c/2),e.lineTo(t.x+d,t.y-c/2),e.arc(t.x,t.y,l,u,-u),e.closePath(),e.fill()}else e.beginPath(),e.arc(t.x,t.y,t.size+a,0,Math.PI*2),e.closePath(),e.fill();e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,hi(e,t,n)}var _i=`
|
|
6
|
+
precision highp float;
|
|
7
|
+
|
|
8
|
+
varying vec4 v_color;
|
|
9
|
+
varying vec2 v_diffVector;
|
|
10
|
+
varying float v_radius;
|
|
11
|
+
|
|
12
|
+
uniform float u_correctionRatio;
|
|
13
|
+
|
|
14
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
15
|
+
|
|
16
|
+
void main(void) {
|
|
17
|
+
float border = u_correctionRatio * 2.0;
|
|
18
|
+
float dist = length(v_diffVector) - v_radius + border;
|
|
19
|
+
|
|
20
|
+
// No antialiasing for picking mode:
|
|
21
|
+
#ifdef PICKING_MODE
|
|
22
|
+
if (dist > border)
|
|
23
|
+
gl_FragColor = transparent;
|
|
24
|
+
else
|
|
25
|
+
gl_FragColor = v_color;
|
|
26
|
+
|
|
27
|
+
#else
|
|
28
|
+
float t = 0.0;
|
|
29
|
+
if (dist > border)
|
|
30
|
+
t = 1.0;
|
|
31
|
+
else if (dist > 0.0)
|
|
32
|
+
t = dist / border;
|
|
33
|
+
|
|
34
|
+
gl_FragColor = mix(v_color, transparent, t);
|
|
35
|
+
#endif
|
|
36
|
+
}
|
|
37
|
+
`,vi=`
|
|
38
|
+
attribute vec4 a_id;
|
|
39
|
+
attribute vec4 a_color;
|
|
40
|
+
attribute vec2 a_position;
|
|
41
|
+
attribute float a_size;
|
|
42
|
+
attribute float a_angle;
|
|
43
|
+
|
|
44
|
+
uniform mat3 u_matrix;
|
|
45
|
+
uniform float u_sizeRatio;
|
|
46
|
+
uniform float u_correctionRatio;
|
|
47
|
+
|
|
48
|
+
varying vec4 v_color;
|
|
49
|
+
varying vec2 v_diffVector;
|
|
50
|
+
varying float v_radius;
|
|
51
|
+
varying float v_border;
|
|
52
|
+
|
|
53
|
+
const float bias = 255.0 / 254.0;
|
|
54
|
+
|
|
55
|
+
void main() {
|
|
56
|
+
float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
|
|
57
|
+
vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
|
|
58
|
+
vec2 position = a_position + diffVector;
|
|
59
|
+
gl_Position = vec4(
|
|
60
|
+
(u_matrix * vec3(position, 1)).xy,
|
|
61
|
+
0,
|
|
62
|
+
1
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
v_diffVector = diffVector;
|
|
66
|
+
v_radius = size / 2.0;
|
|
67
|
+
|
|
68
|
+
#ifdef PICKING_MODE
|
|
69
|
+
// For picking mode, we use the ID as the color:
|
|
70
|
+
v_color = a_id;
|
|
71
|
+
#else
|
|
72
|
+
// For normal mode, we use the color:
|
|
73
|
+
v_color = a_color;
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
v_color.a *= bias;
|
|
77
|
+
}
|
|
78
|
+
`,yi=WebGLRenderingContext,bi=yi.UNSIGNED_BYTE,xi=yi.FLOAT,Si=[`u_sizeRatio`,`u_correctionRatio`,`u_matrix`],Ci=function(e){function t(){return br(this,t),Dr(this,t,arguments)}return kr(t,e),Sr(t,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:vi,FRAGMENT_SHADER_SOURCE:_i,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Si,ATTRIBUTES:[{name:`a_position`,size:2,type:xi},{name:`a_size`,size:1,type:xi},{name:`a_color`,size:4,type:bi,normalized:!0},{name:`a_id`,size:4,type:bi,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_angle`,size:1,type:xi}],CONSTANT_DATA:[[t.ANGLE_1],[t.ANGLE_2],[t.ANGLE_3]]}}},{key:`processVisibleItem`,value:function(e,t,n){var r=this.array,i=Kr(n.color);r[t++]=n.x,r[t++]=n.y,r[t++]=n.size,r[t++]=i,r[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_sizeRatio,a=r.u_correctionRatio,o=r.u_matrix;n.uniform1f(a,e.correctionRatio),n.uniform1f(i,e.sizeRatio),n.uniformMatrix3fv(o,!1,e.matrix)}}])}(di);X(Ci,`ANGLE_1`,0),X(Ci,`ANGLE_2`,2*Math.PI/3),X(Ci,`ANGLE_3`,4*Math.PI/3);var wi=`
|
|
79
|
+
precision mediump float;
|
|
80
|
+
|
|
81
|
+
varying vec4 v_color;
|
|
82
|
+
|
|
83
|
+
void main(void) {
|
|
84
|
+
gl_FragColor = v_color;
|
|
85
|
+
}
|
|
86
|
+
`,Ti=`
|
|
87
|
+
attribute vec2 a_position;
|
|
88
|
+
attribute vec2 a_normal;
|
|
89
|
+
attribute float a_radius;
|
|
90
|
+
attribute vec3 a_barycentric;
|
|
91
|
+
|
|
92
|
+
#ifdef PICKING_MODE
|
|
93
|
+
attribute vec4 a_id;
|
|
94
|
+
#else
|
|
95
|
+
attribute vec4 a_color;
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
uniform mat3 u_matrix;
|
|
99
|
+
uniform float u_sizeRatio;
|
|
100
|
+
uniform float u_correctionRatio;
|
|
101
|
+
uniform float u_minEdgeThickness;
|
|
102
|
+
uniform float u_lengthToThicknessRatio;
|
|
103
|
+
uniform float u_widenessToThicknessRatio;
|
|
104
|
+
|
|
105
|
+
varying vec4 v_color;
|
|
106
|
+
|
|
107
|
+
const float bias = 255.0 / 254.0;
|
|
108
|
+
|
|
109
|
+
void main() {
|
|
110
|
+
float minThickness = u_minEdgeThickness;
|
|
111
|
+
|
|
112
|
+
float normalLength = length(a_normal);
|
|
113
|
+
vec2 unitNormal = a_normal / normalLength;
|
|
114
|
+
|
|
115
|
+
// These first computations are taken from edge.vert.glsl and
|
|
116
|
+
// edge.clamped.vert.glsl. Please read it to get better comments on what's
|
|
117
|
+
// happening:
|
|
118
|
+
float pixelsThickness = max(normalLength / u_sizeRatio, minThickness);
|
|
119
|
+
float webGLThickness = pixelsThickness * u_correctionRatio;
|
|
120
|
+
float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
121
|
+
float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
122
|
+
float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio;
|
|
123
|
+
|
|
124
|
+
float da = a_barycentric.x;
|
|
125
|
+
float db = a_barycentric.y;
|
|
126
|
+
float dc = a_barycentric.z;
|
|
127
|
+
|
|
128
|
+
vec2 delta = vec2(
|
|
129
|
+
da * (webGLNodeRadius * unitNormal.y)
|
|
130
|
+
+ db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x)
|
|
131
|
+
+ dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x),
|
|
132
|
+
|
|
133
|
+
da * (-webGLNodeRadius * unitNormal.x)
|
|
134
|
+
+ db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y)
|
|
135
|
+
+ dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y)
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;
|
|
139
|
+
|
|
140
|
+
gl_Position = vec4(position, 0, 1);
|
|
141
|
+
|
|
142
|
+
#ifdef PICKING_MODE
|
|
143
|
+
// For picking mode, we use the ID as the color:
|
|
144
|
+
v_color = a_id;
|
|
145
|
+
#else
|
|
146
|
+
// For normal mode, we use the color:
|
|
147
|
+
v_color = a_color;
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
v_color.a *= bias;
|
|
151
|
+
}
|
|
152
|
+
`,Ei=WebGLRenderingContext,Di=Ei.UNSIGNED_BYTE,Oi=Ei.FLOAT,ki=[`u_matrix`,`u_sizeRatio`,`u_correctionRatio`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`,`u_widenessToThicknessRatio`],Ai={extremity:`target`,lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function ji(e){var t=Z(Z({},Ai),e||{});return function(e){function n(){return br(this,n),Dr(this,n,arguments)}return kr(n,e),Sr(n,[{key:`getDefinition`,value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Ti,FRAGMENT_SHADER_SOURCE:wi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:ki,ATTRIBUTES:[{name:`a_position`,size:2,type:Oi},{name:`a_normal`,size:2,type:Oi},{name:`a_radius`,size:1,type:Oi},{name:`a_color`,size:4,type:Di,normalized:!0},{name:`a_id`,size:4,type:Di,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_barycentric`,size:3,type:Oi}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:`processVisibleItem`,value:function(e,n,r,i,a){if(t.extremity===`source`){var o=[i,r];r=o[0],i=o[1]}var s=a.size||1,c=i.size||1,l=r.x,u=r.y,d=i.x,f=i.y,p=Kr(a.color),m=d-l,h=f-u,g=m*m+h*h,_=0,v=0;g&&(g=1/Math.sqrt(g),_=-h*g*s,v=m*g*s);var y=this.array;y[n++]=d,y[n++]=f,y[n++]=-_,y[n++]=-v,y[n++]=c,y[n++]=p,y[n++]=e}},{key:`setUniforms`,value:function(e,n){var r=n.gl,i=n.uniformLocations,a=i.u_matrix,o=i.u_sizeRatio,s=i.u_correctionRatio,c=i.u_minEdgeThickness,l=i.u_lengthToThicknessRatio,u=i.u_widenessToThicknessRatio;r.uniformMatrix3fv(a,!1,e.matrix),r.uniform1f(o,e.sizeRatio),r.uniform1f(s,e.correctionRatio),r.uniform1f(c,e.minEdgeThickness),r.uniform1f(l,t.lengthToThicknessRatio),r.uniform1f(u,t.widenessToThicknessRatio)}}])}(fi)}ji();var Mi=`
|
|
153
|
+
precision mediump float;
|
|
154
|
+
|
|
155
|
+
varying vec4 v_color;
|
|
156
|
+
varying vec2 v_normal;
|
|
157
|
+
varying float v_thickness;
|
|
158
|
+
varying float v_feather;
|
|
159
|
+
|
|
160
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
161
|
+
|
|
162
|
+
void main(void) {
|
|
163
|
+
// We only handle antialiasing for normal mode:
|
|
164
|
+
#ifdef PICKING_MODE
|
|
165
|
+
gl_FragColor = v_color;
|
|
166
|
+
#else
|
|
167
|
+
float dist = length(v_normal) * v_thickness;
|
|
168
|
+
|
|
169
|
+
float t = smoothstep(
|
|
170
|
+
v_thickness - v_feather,
|
|
171
|
+
v_thickness,
|
|
172
|
+
dist
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
gl_FragColor = mix(v_color, transparent, t);
|
|
176
|
+
#endif
|
|
177
|
+
}
|
|
178
|
+
`,Ni=`
|
|
179
|
+
attribute vec4 a_id;
|
|
180
|
+
attribute vec4 a_color;
|
|
181
|
+
attribute vec2 a_normal;
|
|
182
|
+
attribute float a_normalCoef;
|
|
183
|
+
attribute vec2 a_positionStart;
|
|
184
|
+
attribute vec2 a_positionEnd;
|
|
185
|
+
attribute float a_positionCoef;
|
|
186
|
+
attribute float a_radius;
|
|
187
|
+
attribute float a_radiusCoef;
|
|
188
|
+
|
|
189
|
+
uniform mat3 u_matrix;
|
|
190
|
+
uniform float u_zoomRatio;
|
|
191
|
+
uniform float u_sizeRatio;
|
|
192
|
+
uniform float u_pixelRatio;
|
|
193
|
+
uniform float u_correctionRatio;
|
|
194
|
+
uniform float u_minEdgeThickness;
|
|
195
|
+
uniform float u_lengthToThicknessRatio;
|
|
196
|
+
uniform float u_feather;
|
|
197
|
+
|
|
198
|
+
varying vec4 v_color;
|
|
199
|
+
varying vec2 v_normal;
|
|
200
|
+
varying float v_thickness;
|
|
201
|
+
varying float v_feather;
|
|
202
|
+
|
|
203
|
+
const float bias = 255.0 / 254.0;
|
|
204
|
+
|
|
205
|
+
void main() {
|
|
206
|
+
float minThickness = u_minEdgeThickness;
|
|
207
|
+
|
|
208
|
+
float radius = a_radius * a_radiusCoef;
|
|
209
|
+
vec2 normal = a_normal * a_normalCoef;
|
|
210
|
+
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
211
|
+
|
|
212
|
+
float normalLength = length(normal);
|
|
213
|
+
vec2 unitNormal = normal / normalLength;
|
|
214
|
+
|
|
215
|
+
// These first computations are taken from edge.vert.glsl. Please read it to
|
|
216
|
+
// get better comments on what's happening:
|
|
217
|
+
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
218
|
+
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
219
|
+
|
|
220
|
+
// Here, we move the point to leave space for the arrow head:
|
|
221
|
+
float direction = sign(radius);
|
|
222
|
+
float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
223
|
+
float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
224
|
+
|
|
225
|
+
vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength);
|
|
226
|
+
|
|
227
|
+
// Here is the proper position of the vertex
|
|
228
|
+
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1);
|
|
229
|
+
|
|
230
|
+
v_thickness = webGLThickness / u_zoomRatio;
|
|
231
|
+
|
|
232
|
+
v_normal = unitNormal;
|
|
233
|
+
|
|
234
|
+
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
235
|
+
|
|
236
|
+
#ifdef PICKING_MODE
|
|
237
|
+
// For picking mode, we use the ID as the color:
|
|
238
|
+
v_color = a_id;
|
|
239
|
+
#else
|
|
240
|
+
// For normal mode, we use the color:
|
|
241
|
+
v_color = a_color;
|
|
242
|
+
#endif
|
|
243
|
+
|
|
244
|
+
v_color.a *= bias;
|
|
245
|
+
}
|
|
246
|
+
`,Pi=WebGLRenderingContext,Fi=Pi.UNSIGNED_BYTE,Ii=Pi.FLOAT,Li=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`,`u_lengthToThicknessRatio`],Ri={lengthToThicknessRatio:Ai.lengthToThicknessRatio};function zi(e){var t=Z(Z({},Ri),e||{});return function(e){function n(){return br(this,n),Dr(this,n,arguments)}return kr(n,e),Sr(n,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Ni,FRAGMENT_SHADER_SOURCE:Mi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Li,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:Ii},{name:`a_positionEnd`,size:2,type:Ii},{name:`a_normal`,size:2,type:Ii},{name:`a_color`,size:4,type:Fi,normalized:!0},{name:`a_id`,size:4,type:Fi,normalized:!0},{name:`a_radius`,size:1,type:Ii}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:Ii},{name:`a_normalCoef`,size:1,type:Ii},{name:`a_radiusCoef`,size:1,type:Ii}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,i){var a=i.size||1,o=n.x,s=n.y,c=r.x,l=r.y,u=Kr(i.color),d=c-o,f=l-s,p=r.size||1,m=d*d+f*f,h=0,g=0;m&&(m=1/Math.sqrt(m),h=-f*m*a,g=d*m*a);var _=this.array;_[t++]=o,_[t++]=s,_[t++]=c,_[t++]=l,_[t++]=h,_[t++]=g,_[t++]=u,_[t++]=e,_[t++]=p}},{key:`setUniforms`,value:function(e,n){var r=n.gl,i=n.uniformLocations,a=i.u_matrix,o=i.u_zoomRatio,s=i.u_feather,c=i.u_pixelRatio,l=i.u_correctionRatio,u=i.u_sizeRatio,d=i.u_minEdgeThickness,f=i.u_lengthToThicknessRatio;r.uniformMatrix3fv(a,!1,e.matrix),r.uniform1f(o,e.zoomRatio),r.uniform1f(u,e.sizeRatio),r.uniform1f(l,e.correctionRatio),r.uniform1f(c,e.pixelRatio),r.uniform1f(s,e.antiAliasingFeather),r.uniform1f(d,e.minEdgeThickness),r.uniform1f(f,t.lengthToThicknessRatio)}}])}(fi)}zi();function Bi(e){return pi([zi(e),ji(e)])}var Vi=Bi(),Hi=`
|
|
247
|
+
attribute vec4 a_id;
|
|
248
|
+
attribute vec4 a_color;
|
|
249
|
+
attribute vec2 a_normal;
|
|
250
|
+
attribute float a_normalCoef;
|
|
251
|
+
attribute vec2 a_positionStart;
|
|
252
|
+
attribute vec2 a_positionEnd;
|
|
253
|
+
attribute float a_positionCoef;
|
|
254
|
+
|
|
255
|
+
uniform mat3 u_matrix;
|
|
256
|
+
uniform float u_sizeRatio;
|
|
257
|
+
uniform float u_zoomRatio;
|
|
258
|
+
uniform float u_pixelRatio;
|
|
259
|
+
uniform float u_correctionRatio;
|
|
260
|
+
uniform float u_minEdgeThickness;
|
|
261
|
+
uniform float u_feather;
|
|
262
|
+
|
|
263
|
+
varying vec4 v_color;
|
|
264
|
+
varying vec2 v_normal;
|
|
265
|
+
varying float v_thickness;
|
|
266
|
+
varying float v_feather;
|
|
267
|
+
|
|
268
|
+
const float bias = 255.0 / 254.0;
|
|
269
|
+
|
|
270
|
+
void main() {
|
|
271
|
+
float minThickness = u_minEdgeThickness;
|
|
272
|
+
|
|
273
|
+
vec2 normal = a_normal * a_normalCoef;
|
|
274
|
+
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
275
|
+
|
|
276
|
+
float normalLength = length(normal);
|
|
277
|
+
vec2 unitNormal = normal / normalLength;
|
|
278
|
+
|
|
279
|
+
// We require edges to be at least "minThickness" pixels thick *on screen*
|
|
280
|
+
// (so we need to compensate the size ratio):
|
|
281
|
+
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
282
|
+
|
|
283
|
+
// Then, we need to retrieve the normalized thickness of the edge in the WebGL
|
|
284
|
+
// referential (in a ([0, 1], [0, 1]) space), using our "magic" correction
|
|
285
|
+
// ratio:
|
|
286
|
+
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
287
|
+
|
|
288
|
+
// Here is the proper position of the vertex
|
|
289
|
+
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1);
|
|
290
|
+
|
|
291
|
+
// For the fragment shader though, we need a thickness that takes the "magic"
|
|
292
|
+
// correction ratio into account (as in webGLThickness), but so that the
|
|
293
|
+
// antialiasing effect does not depend on the zoom level. So here's yet
|
|
294
|
+
// another thickness version:
|
|
295
|
+
v_thickness = webGLThickness / u_zoomRatio;
|
|
296
|
+
|
|
297
|
+
v_normal = unitNormal;
|
|
298
|
+
|
|
299
|
+
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
300
|
+
|
|
301
|
+
#ifdef PICKING_MODE
|
|
302
|
+
// For picking mode, we use the ID as the color:
|
|
303
|
+
v_color = a_id;
|
|
304
|
+
#else
|
|
305
|
+
// For normal mode, we use the color:
|
|
306
|
+
v_color = a_color;
|
|
307
|
+
#endif
|
|
308
|
+
|
|
309
|
+
v_color.a *= bias;
|
|
310
|
+
}
|
|
311
|
+
`,Ui=WebGLRenderingContext,Wi=Ui.UNSIGNED_BYTE,Gi=Ui.FLOAT,Ki=[`u_matrix`,`u_zoomRatio`,`u_sizeRatio`,`u_correctionRatio`,`u_pixelRatio`,`u_feather`,`u_minEdgeThickness`],qi=function(e){function t(){return br(this,t),Dr(this,t,arguments)}return kr(t,e),Sr(t,[{key:`getDefinition`,value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Hi,FRAGMENT_SHADER_SOURCE:Mi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Ki,ATTRIBUTES:[{name:`a_positionStart`,size:2,type:Gi},{name:`a_positionEnd`,size:2,type:Gi},{name:`a_normal`,size:2,type:Gi},{name:`a_color`,size:4,type:Wi,normalized:!0},{name:`a_id`,size:4,type:Wi,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:`a_positionCoef`,size:1,type:Gi},{name:`a_normalCoef`,size:1,type:Gi}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:`processVisibleItem`,value:function(e,t,n,r,i){var a=i.size||1,o=n.x,s=n.y,c=r.x,l=r.y,u=Kr(i.color),d=c-o,f=l-s,p=d*d+f*f,m=0,h=0;p&&(p=1/Math.sqrt(p),m=-f*p*a,h=d*p*a);var g=this.array;g[t++]=o,g[t++]=s,g[t++]=c,g[t++]=l,g[t++]=m,g[t++]=h,g[t++]=u,g[t++]=e}},{key:`setUniforms`,value:function(e,t){var n=t.gl,r=t.uniformLocations,i=r.u_matrix,a=r.u_zoomRatio,o=r.u_feather,s=r.u_pixelRatio,c=r.u_correctionRatio,l=r.u_sizeRatio,u=r.u_minEdgeThickness;n.uniformMatrix3fv(i,!1,e.matrix),n.uniform1f(a,e.zoomRatio),n.uniform1f(l,e.sizeRatio),n.uniform1f(c,e.correctionRatio),n.uniform1f(s,e.pixelRatio),n.uniform1f(o,e.antiAliasingFeather),n.uniform1f(u,e.minEdgeThickness)}}])}(fi),Ji=function(e){function t(){var e;return br(this,t),e=Dr(this,t),e.rawEmitter=e,e}return kr(t,e),Sr(t)}(Et.EventEmitter),Yi=n(((e,t)=>{t.exports=function(e){return typeof e==`object`&&!!e&&typeof e.addUndirectedEdgeWithKey==`function`&&typeof e.dropNode==`function`&&typeof e.multi==`boolean`}})),Xi=e(Yi()),Zi={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Qi={easing:`quadraticInOut`,duration:150};function $i(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ea(e,t,n){return e[0]=t,e[4]=typeof n==`number`?n:t,e}function ta(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}function na(e,t,n){return e[6]=t,e[7]=n,e}function ra(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],d=t[0],f=t[1],p=t[2],m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],y=t[8];return e[0]=d*n+f*a+p*c,e[1]=d*r+f*o+p*l,e[2]=d*i+f*s+p*u,e[3]=m*n+h*a+g*c,e[4]=m*r+h*o+g*l,e[5]=m*i+h*s+g*u,e[6]=_*n+v*a+y*c,e[7]=_*r+v*o+y*l,e[8]=_*i+v*s+y*u,e}function ia(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=e[0],i=e[1],a=e[3],o=e[4],s=e[6],c=e[7],l=t.x,u=t.y;return{x:l*r+u*a+s*n,y:l*i+u*o+c*n}}function aa(e,t){var n=e.height/e.width,r=t.height/t.width;return n<1&&r>1||n>1&&r<1?1:Math.min(Math.max(r,1/r),Math.max(1/n,n))}function oa(e,t,n,r,i){var a=e.angle,o=e.ratio,s=e.x,c=e.y,l=t.width,u=t.height,d=$i(),f=Math.min(l,u)-2*r,p=aa(t,n);return i?(ra(d,na($i(),s,c)),ra(d,ea($i(),o)),ra(d,ta($i(),a)),ra(d,ea($i(),l/f/2/p,u/f/2/p))):(ra(d,ea($i(),f/l*2*p,f/u*2*p)),ra(d,ta($i(),-a)),ra(d,ea($i(),1/o)),ra(d,na($i(),-s,-c))),d}function sa(e,t,n){var r=ia(e,{x:Math.cos(t.angle),y:Math.sin(t.angle)},0),i=r.x,a=r.y;return 1/Math.sqrt(i**2+a**2)/n.width}function ca(e){if(!e.order)return{x:[0,1],y:[0,1]};var t=1/0,n=-1/0,r=1/0,i=-1/0;return e.forEachNode(function(e,a){var o=a.x,s=a.y;o<t&&(t=o),o>n&&(n=o),s<r&&(r=s),s>i&&(i=s)}),{x:[t,n],y:[r,i]}}function la(e){if(!(0,Xi.default)(e))throw Error(`Sigma: invalid graph instance.`);e.forEachNode(function(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw Error(`Sigma: Coordinates of node ${e} are invalid. A node must have a numeric 'x' and 'y' attribute.`)})}function ua(e,t,n){var r=document.createElement(e);if(t)for(var i in t)r.style[i]=t[i];if(n)for(var a in n)r.setAttribute(a,n[a]);return r}function da(){return window.devicePixelRatio===void 0?1:window.devicePixelRatio}function fa(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:+(r>i)})}function pa(e){var t=Fr(e.x,2),n=t[0],r=t[1],i=Fr(e.y,2),a=i[0],o=i[1],s=Math.max(r-n,o-a),c=(r+n)/2,l=(o+a)/2;(s===0||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(c)&&(c=0),isNaN(l)&&(l=0);var u=function(e){return{x:.5+(e.x-c)/s,y:.5+(e.y-l)/s}};return u.applyTo=function(e){e.x=.5+(e.x-c)/s,e.y=.5+(e.y-l)/s},u.inverse=function(e){return{x:c+s*(e.x-.5),y:l+s*(e.y-.5)}},u.ratio=s,u}function ma(e){"@babel/helpers - typeof";return ma=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ma(e)}function ha(e,t){var n=t.size;if(n!==0){var r=e.length;e.length+=n;var i=0;t.forEach(function(t){e[r+i]=t,i++})}}function ga(e){e||={};for(var t=0,n=arguments.length<=1?0:arguments.length-1;t<n;t++){var r=t+1<1||arguments.length<=t+1?void 0:arguments[t+1];r&&Object.assign(e,r)}return e}var _a={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:`#999`,defaultNodeType:`circle`,defaultEdgeColor:`#ccc`,defaultEdgeType:`line`,labelFont:`Arial`,labelSize:14,labelWeight:`normal`,labelColor:{color:`#000`},edgeLabelFont:`Arial`,edgeLabelSize:14,edgeLabelWeight:`normal`,edgeLabelColor:{attribute:`color`},stagePadding:30,defaultDrawEdgeLabel:mi,defaultDrawNodeLabel:hi,defaultDrawNodeHover:gi,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:`screen`,autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},va={circle:Ci},ya={arrow:Vi,line:qi};function ba(e){if(typeof e.labelDensity!=`number`||e.labelDensity<0)throw Error("Settings: invalid `labelDensity`. Expecting a positive number.");var t=e.minCameraRatio,n=e.maxCameraRatio;if(typeof t==`number`&&typeof n==`number`&&n<t)throw Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function xa(e){var t=ga({},_a,e);return t.nodeProgramClasses=ga({},va,t.nodeProgramClasses),t.edgeProgramClasses=ga({},ya,t.edgeProgramClasses),t}var Sa=1.5,Ca=function(e){function t(){var e;return br(this,t),e=Dr(this,t),X(e,`x`,.5),X(e,`y`,.5),X(e,`angle`,0),X(e,`ratio`,1),X(e,`minRatio`,null),X(e,`maxRatio`,null),X(e,`enabledZooming`,!0),X(e,`enabledPanning`,!0),X(e,`enabledRotation`,!0),X(e,`clean`,null),X(e,`nextFrame`,null),X(e,`previousState`,null),X(e,`enabled`,!0),e.previousState=e.getState(),e}return kr(t,e),Sr(t,[{key:`enable`,value:function(){return this.enabled=!0,this}},{key:`disable`,value:function(){return this.enabled=!1,this}},{key:`getState`,value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:`hasState`,value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:`getPreviousState`,value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:`getBoundedRatio`,value:function(e){var t=e;return typeof this.minRatio==`number`&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio==`number`&&(t=Math.min(t,this.maxRatio)),t}},{key:`validateState`,value:function(e){var t={};return this.enabledPanning&&typeof e.x==`number`&&(t.x=e.x),this.enabledPanning&&typeof e.y==`number`&&(t.y=e.y),this.enabledZooming&&typeof e.ratio==`number`&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle==`number`&&(t.angle=e.angle),this.clean?this.clean(Z(Z({},this.getState()),t)):t}},{key:`isAnimated`,value:function(){return!!this.nextFrame}},{key:`setState`,value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x==`number`&&(this.x=t.x),typeof t.y==`number`&&(this.y=t.y),typeof t.ratio==`number`&&(this.ratio=t.ratio),typeof t.angle==`number`&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit(`updated`,this.getState()),this}},{key:`updateState`,value:function(e){return this.setState(e(this.getState())),this}},{key:`animate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(r){return t.animate(e,n,r)});if(this.enabled){var i=Z(Z({},Qi),n),a=this.validateState(e),o=typeof i.easing==`function`?i.easing:Zi[i.easing],s=Date.now(),c=this.getState(),l=function(){var e=(Date.now()-s)/i.duration;if(e>=1){t.nextFrame=null,t.setState(a),t.animationCallback&&=(t.animationCallback.call(null),void 0);return}var n=o(e),r={};typeof a.x==`number`&&(r.x=c.x+(a.x-c.x)*n),typeof a.y==`number`&&(r.y=c.y+(a.y-c.y)*n),t.enabledRotation&&typeof a.angle==`number`&&(r.angle=c.angle+(a.angle-c.angle)*n),typeof a.ratio==`number`&&(r.ratio=c.ratio+(a.ratio-c.ratio)*n),t.setState(r),t.nextFrame=requestAnimationFrame(l)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(l)):l(),this.animationCallback=r}}},{key:`animatedZoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||Sa)},e):this.animate({ratio:this.ratio/Sa})}},{key:`animatedUnzoom`,value:function(e){return e?typeof e==`number`?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||Sa)},e):this.animate({ratio:this.ratio*Sa})}},{key:`animatedReset`,value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:`copy`,value:function(){return t.from(this.getState())}}],[{key:`from`,value:function(e){return new t().setState(e)}}])}(Ji);function wa(e,t){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}function Ta(e,t){var n=Z(Z({},wa(e,t)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0},original:e});return n}function Ea(e){var t=`x`in e?e:Z(Z({},e.touches[0]||e.previousTouches[0]),{},{original:e.original,sigmaDefaultPrevented:e.sigmaDefaultPrevented,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0,t.sigmaDefaultPrevented=!0}});return t}function Da(e,t){return Z(Z({},Ta(e,t)),{},{delta:ja(e)})}var Oa=2;function ka(e){for(var t=[],n=0,r=Math.min(e.length,Oa);n<r;n++)t.push(e[n]);return t}function Aa(e,t,n){var r={touches:ka(e.touches).map(function(e){return wa(e,n)}),previousTouches:t.map(function(e){return wa(e,n)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){r.sigmaDefaultPrevented=!0},original:e};return r}function ja(e){if(e.deltaY!==void 0)return e.deltaY*-3/360;if(e.detail!==void 0)return e.detail/-9;throw Error(`Captor: could not extract delta from event.`)}var Ma=function(e){function t(e,n){var r;return br(this,t),r=Dr(this,t),r.container=e,r.renderer=n,r}return kr(t,e),Sr(t)}(Ji),Na=[`doubleClickTimeout`,`doubleClickZoomingDuration`,`doubleClickZoomingRatio`,`dragTimeout`,`draggedEventsTolerance`,`inertiaDuration`,`inertiaRatio`,`zoomDuration`,`zoomingRatio`].reduce(function(e,t){return Z(Z({},e),{},X({},t,_a[t]))},{}),Pa=function(e){function t(e,n){var r;return br(this,t),r=Dr(this,t,[e,n]),X(r,`enabled`,!0),X(r,`draggedEvents`,0),X(r,`downStartTime`,null),X(r,`lastMouseX`,null),X(r,`lastMouseY`,null),X(r,`isMouseDown`,!1),X(r,`isMoving`,!1),X(r,`movingTimeout`,null),X(r,`startCameraState`,null),X(r,`clicks`,0),X(r,`doubleClickTimeout`,null),X(r,`currentWheelDirection`,0),X(r,`settings`,Na),r.handleClick=r.handleClick.bind(r),r.handleRightClick=r.handleRightClick.bind(r),r.handleDown=r.handleDown.bind(r),r.handleUp=r.handleUp.bind(r),r.handleMove=r.handleMove.bind(r),r.handleWheel=r.handleWheel.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),e.addEventListener(`click`,r.handleClick,{capture:!1}),e.addEventListener(`contextmenu`,r.handleRightClick,{capture:!1}),e.addEventListener(`mousedown`,r.handleDown,{capture:!1}),e.addEventListener(`wheel`,r.handleWheel,{capture:!1}),e.addEventListener(`mouseleave`,r.handleLeave,{capture:!1}),e.addEventListener(`mouseenter`,r.handleEnter,{capture:!1}),document.addEventListener(`mousemove`,r.handleMove,{capture:!1}),document.addEventListener(`mouseup`,r.handleUp,{capture:!1}),r}return kr(t,e),Sr(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`click`,this.handleClick),e.removeEventListener(`contextmenu`,this.handleRightClick),e.removeEventListener(`mousedown`,this.handleDown),e.removeEventListener(`wheel`,this.handleWheel),e.removeEventListener(`mouseleave`,this.handleLeave),e.removeEventListener(`mouseenter`,this.handleEnter),document.removeEventListener(`mousemove`,this.handleMove),document.removeEventListener(`mouseup`,this.handleUp)}},{key:`handleClick`,value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout==`number`&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit(`click`,Ta(e,this.container))}}},{key:`handleRightClick`,value:function(e){this.enabled&&this.emit(`rightClick`,Ta(e,this.container))}},{key:`handleDoubleClick`,value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=Ta(e,this.container);if(this.emit(`doubleClick`,t),!t.sigmaDefaultPrevented){var n=this.renderer.getCamera(),r=n.getBoundedRatio(n.getState().ratio/this.settings.doubleClickZoomingRatio);n.animate(this.renderer.getViewportZoomedState(wa(e,this.container),r),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}}},{key:`handleDown`,value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=wa(e,this.container),n=t.x,r=t.y;this.lastMouseX=n,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit(`mousedown`,Ta(e,this.container))}}},{key:`handleUp`,value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var n=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout==`number`&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=wa(e,this.container),i=r.x,a=r.y,o=n.getState(),s=n.getPreviousState()||{x:0,y:0};this.isMoving?n.animate({x:o.x+this.settings.inertiaRatio*(o.x-s.x),y:o.y+this.settings.inertiaRatio*(o.y-s.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`}):(this.lastMouseX!==i||this.lastMouseY!==a)&&n.setState({x:o.x,y:o.y}),this.isMoving=!1,setTimeout(function(){var e=t.draggedEvents>0;t.draggedEvents=0,e&&t.renderer.getSetting(`hideEdgesOnMove`)&&t.renderer.refresh()},0),this.emit(`mouseup`,Ta(e,this.container))}}},{key:`handleMove`,value:function(e){var t=this;if(this.enabled){var n=Ta(e,this.container);if(this.emit(`mousemovebody`,n),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit(`mousemove`,n),!n.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout==`number`&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),i=wa(e,this.container),a=i.x,o=i.y,s=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),c=this.renderer.viewportToFramedGraph({x:a,y:o}),l=s.x-c.x,u=s.y-c.y,d=r.getState(),f=d.x+l,p=d.y+u;r.setState({x:f,y:p}),this.lastMouseX=a,this.lastMouseY=o,e.preventDefault(),e.stopPropagation()}}}},{key:`handleLeave`,value:function(e){this.emit(`mouseleave`,Ta(e,this.container))}},{key:`handleEnter`,value:function(e){this.emit(`mouseenter`,Ta(e,this.container))}},{key:`handleWheel`,value:function(e){var t=this,n=this.renderer.getCamera();if(!(!this.enabled||!n.enabledZooming)){var r=ja(e);if(r){var i=Da(e,this.container);if(this.emit(`wheel`,i),i.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var a=n.getState().ratio,o=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,s=n.getBoundedRatio(a*o),c=r>0?1:-1,l=Date.now();a!==s&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===c&&this.lastWheelTriggerTime&&l-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(n.animate(this.renderer.getViewportZoomedState(wa(e,this.container),s),{easing:`quadraticOut`,duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=c,this.lastWheelTriggerTime=l))}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}(Ma),Fa=[`dragTimeout`,`inertiaDuration`,`inertiaRatio`,`doubleClickTimeout`,`doubleClickZoomingRatio`,`doubleClickZoomingDuration`,`tapMoveTolerance`].reduce(function(e,t){return Z(Z({},e),{},X({},t,_a[t]))},{}),Ia=function(e){function t(e,n){var r;return br(this,t),r=Dr(this,t,[e,n]),X(r,`enabled`,!0),X(r,`isMoving`,!1),X(r,`hasMoved`,!1),X(r,`touchMode`,0),X(r,`startTouchesPositions`,[]),X(r,`lastTouches`,[]),X(r,`lastTap`,null),X(r,`settings`,Fa),r.handleStart=r.handleStart.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleMove=r.handleMove.bind(r),e.addEventListener(`touchstart`,r.handleStart,{capture:!1}),e.addEventListener(`touchcancel`,r.handleLeave,{capture:!1}),document.addEventListener(`touchend`,r.handleLeave,{capture:!1,passive:!1}),document.addEventListener(`touchmove`,r.handleMove,{capture:!1,passive:!1}),r}return kr(t,e),Sr(t,[{key:`kill`,value:function(){var e=this.container;e.removeEventListener(`touchstart`,this.handleStart),e.removeEventListener(`touchcancel`,this.handleLeave),document.removeEventListener(`touchend`,this.handleLeave),document.removeEventListener(`touchmove`,this.handleMove)}},{key:`getDimensions`,value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:`handleStart`,value:function(e){var t=this;if(this.enabled){e.preventDefault();var n=ka(e.touches);if(this.touchMode=n.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=n.map(function(e){return wa(e,t.container)}),this.touchMode===2){var r=Fr(this.startTouchesPositions,2),i=r[0],a=i.x,o=i.y,s=r[1],c=s.x,l=s.y;this.startTouchesAngle=Math.atan2(l-o,c-a),this.startTouchesDistance=Math.sqrt((c-a)**2+(l-o)**2)}this.emit(`touchdown`,Aa(e,this.lastTouches,this.container)),this.lastTouches=n,this.lastTouchesPositions=this.startTouchesPositions}}},{key:`handleLeave`,value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),n=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:n.x+this.settings.inertiaRatio*(n.x-r.x),y:n.y+this.settings.inertiaRatio*(n.y-r.y)},{duration:this.settings.inertiaDuration,easing:`quadraticOut`})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit(`touchup`,Aa(e,this.lastTouches,this.container)),!e.touches.length){var i=wa(this.lastTouches[0],this.container),a=this.startTouchesPositions[0],o=(i.x-a.x)**2+(i.y-a.y)**2;if(!e.touches.length&&o<this.settings.tapMoveTolerance**2)if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var s=Aa(e,this.lastTouches,this.container);if(this.emit(`doubletap`,s),this.lastTap=null,!s.sigmaDefaultPrevented){var c=this.renderer.getCamera(),l=c.getBoundedRatio(c.getState().ratio/this.settings.doubleClickZoomingRatio);c.animate(this.renderer.getViewportZoomedState(i,l),{easing:`quadraticInOut`,duration:this.settings.doubleClickZoomingDuration})}}else{var u=Aa(e,this.lastTouches,this.container);this.emit(`tap`,u),this.lastTap={time:Date.now(),position:u.touches[0]||u.previousTouches[0]}}}this.lastTouches=ka(e.touches),this.startTouchesPositions=[]}}},{key:`handleMove`,value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var n=ka(e.touches),r=n.map(function(e){return wa(e,t.container)}),i=this.lastTouches;this.lastTouches=n,this.lastTouchesPositions=r;var a=Aa(e,i,this.container);if(this.emit(`touchmove`,a),!a.sigmaDefaultPrevented&&(this.hasMoved||=r.some(function(e,n){var r=t.startTouchesPositions[n];return r&&(e.x!==r.x||e.y!==r.y)}),this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var o=this.renderer.getCamera(),s=this.startCameraState,c=this.renderer.getSetting(`stagePadding`);switch(this.touchMode){case 1:var l=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),u=l.x,d=l.y,f=this.renderer.viewportToFramedGraph(r[0]),p=f.x,m=f.y;o.setState({x:s.x+u-p,y:s.y+d-m});break;case 2:var h={x:.5,y:.5,angle:0,ratio:1},g=r[0],_=g.x,v=g.y,y=r[1],b=y.x,x=y.y,S=Math.atan2(x-v,b-_)-this.startTouchesAngle,C=Math.hypot(x-v,b-_)/this.startTouchesDistance,w=o.getBoundedRatio(s.ratio/C);h.ratio=w,h.angle=s.angle+S;var T=this.getDimensions(),E=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:s}),D=Math.min(T.width,T.height)-2*c,O=D/T.width,ee=D/T.height,te=w/D,k=_-D/2/O,A=v-D/2/ee,j=[k*Math.cos(-h.angle)-A*Math.sin(-h.angle),A*Math.cos(-h.angle)+k*Math.sin(-h.angle)];k=j[0],A=j[1],h.x=E.x-k*te,h.y=E.y+A*te,o.setState(h);break}}}}},{key:`setSettings`,value:function(e){this.settings=e}}])}(Ma);function La(e){if(Array.isArray(e))return Mr(e)}function Ra(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function za(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
312
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ba(e){return La(e)||Ra(e)||Nr(e)||za()}function Va(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Ha(e,t){if(e==null)return{};var n,r,i=Va(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Ua=function(){function e(t,n){br(this,e),this.key=t,this.size=n}return Sr(e,null,[{key:`compare`,value:function(e,t){return e.size>t.size?-1:e.size<t.size||e.key>t.key?1:-1}}])}(),Wa=function(){function e(){br(this,e),X(this,`width`,0),X(this,`height`,0),X(this,`cellSize`,0),X(this,`columns`,0),X(this,`rows`,0),X(this,`cells`,{})}return Sr(e,[{key:`resizeAndClear`,value:function(e,t){this.width=e.width,this.height=e.height,this.cellSize=t,this.columns=Math.ceil(e.width/t),this.rows=Math.ceil(e.height/t),this.cells={}}},{key:`getIndex`,value:function(e){var t=Math.floor(e.x/this.cellSize);return Math.floor(e.y/this.cellSize)*this.columns+t}},{key:`add`,value:function(e,t,n){var r=new Ua(e,t),i=this.getIndex(n),a=this.cells[i];a||(a=[],this.cells[i]=a),a.push(r)}},{key:`organize`,value:function(){for(var e in this.cells)this.cells[e].sort(Ua.compare)}},{key:`getLabelsToDisplay`,value:function(e,t){var n=this.cellSize*this.cellSize,r=n/e/e*t/n,i=Math.ceil(r),a=[];for(var o in this.cells)for(var s=this.cells[o],c=0;c<Math.min(i,s.length);c++)a.push(s[c].key);return a}}])}();function Ga(e){var t=e.graph,n=e.hoveredNode,r=e.highlightedNodes,i=e.displayedNodeLabels,a=[];return t.forEachEdge(function(e,t,o,s){(o===n||s===n||r.has(o)||r.has(s)||i.has(o)&&i.has(s))&&a.push(e)}),a}var Ka=150,qa=50,Ja=Object.prototype.hasOwnProperty;function Ya(e,t,n){if(!Ja.call(n,`x`)||!Ja.call(n,`y`))throw Error(`Sigma: could not find a valid position (x, y) for node "${t}". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?`);return n.color||=e.defaultNodeColor,!n.label&&n.label!==``&&(n.label=null),n.label!==void 0&&n.label!==null?n.label=``+n.label:n.label=null,n.size||=2,Ja.call(n,`hidden`)||(n.hidden=!1),Ja.call(n,`highlighted`)||(n.highlighted=!1),Ja.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultNodeType),n.zIndex||=0,n}function Xa(e,t,n){return n.color||=e.defaultEdgeColor,n.label||=``,n.size||=.5,Ja.call(n,`hidden`)||(n.hidden=!1),Ja.call(n,`forceLabel`)||(n.forceLabel=!1),(!n.type||n.type===``)&&(n.type=e.defaultEdgeType),n.zIndex||=0,n}var Za=function(e){function t(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(br(this,t),r=Dr(this,t),X(r,`elements`,{}),X(r,`canvasContexts`,{}),X(r,`webGLContexts`,{}),X(r,`pickingLayers`,new Set),X(r,`textures`,{}),X(r,`frameBuffers`,{}),X(r,`activeListeners`,{}),X(r,`labelGrid`,new Wa),X(r,`nodeDataCache`,{}),X(r,`edgeDataCache`,{}),X(r,`nodeProgramIndex`,{}),X(r,`edgeProgramIndex`,{}),X(r,`nodesWithForcedLabels`,new Set),X(r,`edgesWithForcedLabels`,new Set),X(r,`nodeExtent`,{x:[0,1],y:[0,1]}),X(r,`nodeZExtent`,[1/0,-1/0]),X(r,`edgeZExtent`,[1/0,-1/0]),X(r,`matrix`,$i()),X(r,`invMatrix`,$i()),X(r,`correctionRatio`,1),X(r,`customBBox`,null),X(r,`normalizationFunction`,pa({x:[0,1],y:[0,1]})),X(r,`graphToViewportRatio`,1),X(r,`itemIDsIndex`,{}),X(r,`nodeIndices`,{}),X(r,`edgeIndices`,{}),X(r,`width`,0),X(r,`height`,0),X(r,`pixelRatio`,da()),X(r,`pickingDownSizingRatio`,2*r.pixelRatio),X(r,`displayedNodeLabels`,new Set),X(r,`displayedEdgeLabels`,new Set),X(r,`highlightedNodes`,new Set),X(r,`hoveredNode`,null),X(r,`hoveredEdge`,null),X(r,`renderFrame`,null),X(r,`renderHighlightedNodesFrame`,null),X(r,`needToProcess`,!1),X(r,`checkEdgesEventsFrame`,null),X(r,`nodePrograms`,{}),X(r,`nodeHoverPrograms`,{}),X(r,`edgePrograms`,{}),r.settings=xa(i),ba(r.settings),la(e),!(n instanceof HTMLElement))throw Error(`Sigma: container should be an html element.`);for(var a in r.graph=e,r.container=n,r.createWebGLContext(`edges`,{picking:i.enableEdgeEvents}),r.createCanvasContext(`edgeLabels`),r.createWebGLContext(`nodes`,{picking:!0}),r.createCanvasContext(`labels`),r.createCanvasContext(`hovers`),r.createWebGLContext(`hoverNodes`),r.createCanvasContext(`mouse`,{style:{touchAction:`none`,userSelect:`none`}}),r.resize(),r.settings.nodeProgramClasses)r.registerNodeProgram(a,r.settings.nodeProgramClasses[a],r.settings.nodeHoverProgramClasses[a]);for(var o in r.settings.edgeProgramClasses)r.registerEdgeProgram(o,r.settings.edgeProgramClasses[o]);return r.camera=new Ca,r.bindCameraHandlers(),r.mouseCaptor=new Pa(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Ia(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return kr(t,e),Sr(t,[{key:`registerNodeProgram`,value:function(e,t,n){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(n||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:`registerEdgeProgram`,value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:`unregisterNodeProgram`,value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,n=t[e],r=Ha(t,[e].map(yr));n.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var i=this.nodeHoverPrograms,a=i[e],o=Ha(i,[e].map(yr));a.kill(),this.nodePrograms=o}return this}},{key:`unregisterEdgeProgram`,value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,n=t[e],r=Ha(t,[e].map(yr));n.kill(),this.edgePrograms=r}return this}},{key:`resetWebGLTexture`,value:function(e){var t=this.webGLContexts[e],n=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var i=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,n),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),this.textures[e]=i,this}},{key:`bindCameraHandlers`,value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on(`updated`,this.activeListeners.camera),this}},{key:`unbindCameraHandlers`,value:function(){return this.camera.removeListener(`updated`,this.activeListeners.camera),this}},{key:`getNodeAtPosition`,value:function(e){var t=e.x,n=e.y,r=Xr(this.webGLContexts.nodes,this.frameBuffers.nodes,t,n,this.pixelRatio,this.pickingDownSizingRatio),i=Yr.apply(void 0,Ba(r)),a=this.itemIDsIndex[i];return a&&a.type===`node`?a.id:null}},{key:`bindEventHandlers`,value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener(`resize`,this.activeListeners.handleResize),this.activeListeners.handleMove=function(t){var n=Ea(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}},i=e.getNodeAtPosition(n);if(i&&e.hoveredNode!==i&&!e.nodeDataCache[i].hidden){e.hoveredNode&&e.emit(`leaveNode`,Z(Z({},r),{},{node:e.hoveredNode})),e.hoveredNode=i,e.emit(`enterNode`,Z(Z({},r),{},{node:i})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(n)!==e.hoveredNode){var a=e.hoveredNode;e.hoveredNode=null,e.emit(`leaveNode`,Z(Z({},r),{},{node:a})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var o=e.hoveredNode?null:e.getEdgeAtPoint(r.event.x,r.event.y);o!==e.hoveredEdge&&(e.hoveredEdge&&e.emit(`leaveEdge`,Z(Z({},r),{},{edge:e.hoveredEdge})),o&&e.emit(`enterEdge`,Z(Z({},r),{},{edge:o})),e.hoveredEdge=o)}},this.activeListeners.handleMoveBody=function(t){var n=Ea(t);e.emit(`moveBody`,{event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(t){var n=Ea(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.hoveredNode&&(e.emit(`leaveNode`,Z(Z({},r),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit(`leaveEdge`,Z(Z({},r),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit(`leaveStage`,Z({},r))},this.activeListeners.handleEnter=function(t){var n=Ea(t),r={event:n,preventSigmaDefault:function(){n.preventSigmaDefault()}};e.emit(`enterStage`,Z({},r))};var t=function(t){return function(n){var r=Ea(n),i={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},a=e.getNodeAtPosition(r);if(a)return e.emit(`${t}Node`,Z(Z({},i),{},{node:a}));if(e.settings.enableEdgeEvents){var o=e.getEdgeAtPoint(r.x,r.y);if(o)return e.emit(`${t}Edge`,Z(Z({},i),{},{edge:o}))}return e.emit(`${t}Stage`,i)}};return this.activeListeners.handleClick=t(`click`),this.activeListeners.handleRightClick=t(`rightClick`),this.activeListeners.handleDoubleClick=t(`doubleClick`),this.activeListeners.handleWheel=t(`wheel`),this.activeListeners.handleDown=t(`down`),this.activeListeners.handleUp=t(`up`),this.mouseCaptor.on(`mousemove`,this.activeListeners.handleMove),this.mouseCaptor.on(`mousemovebody`,this.activeListeners.handleMoveBody),this.mouseCaptor.on(`click`,this.activeListeners.handleClick),this.mouseCaptor.on(`rightClick`,this.activeListeners.handleRightClick),this.mouseCaptor.on(`doubleClick`,this.activeListeners.handleDoubleClick),this.mouseCaptor.on(`wheel`,this.activeListeners.handleWheel),this.mouseCaptor.on(`mousedown`,this.activeListeners.handleDown),this.mouseCaptor.on(`mouseup`,this.activeListeners.handleUp),this.mouseCaptor.on(`mouseleave`,this.activeListeners.handleLeave),this.mouseCaptor.on(`mouseenter`,this.activeListeners.handleEnter),this.touchCaptor.on(`touchdown`,this.activeListeners.handleDown),this.touchCaptor.on(`touchdown`,this.activeListeners.handleMove),this.touchCaptor.on(`touchup`,this.activeListeners.handleUp),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMove),this.touchCaptor.on(`tap`,this.activeListeners.handleClick),this.touchCaptor.on(`doubletap`,this.activeListeners.handleDoubleClick),this.touchCaptor.on(`touchmove`,this.activeListeners.handleMoveBody),this}},{key:`bindGraphHandlers`,value:function(){var e=this,t=this.graph,n=new Set([`x`,`y`,`zIndex`,`type`]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var i=r.hints?.attributes;e.graph.forEachNode(function(t){return e.updateNode(t)});var a=!i||i.some(function(e){return n.has(e)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!a,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(n){var r=n.hints?.attributes;e.graph.forEachEdge(function(t){return e.updateEdge(t)});var i=r&&[`zIndex`,`type`].some(function(e){return r?.includes(e)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!i,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(t){var n=t.key;e.addNode(n),e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{nodes:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(t){var n=t.key;e.removeNode(n),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(t){var n=t.key;e.addEdge(n),e.refresh({partialGraph:{edges:[n]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(t){var n=t.key;e.refresh({partialGraph:{edges:[n]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(t){var n=t.key;e.removeEdge(n),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),t.on(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),t.on(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),t.on(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),t.on(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),t.on(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),t.on(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),t.on(`cleared`,this.activeListeners.clearGraphUpdate),this}},{key:`unbindGraphHandlers`,value:function(){var e=this.graph;e.removeListener(`nodeAdded`,this.activeListeners.addNodeGraphUpdate),e.removeListener(`nodeDropped`,this.activeListeners.dropNodeGraphUpdate),e.removeListener(`nodeAttributesUpdated`,this.activeListeners.updateNodeGraphUpdate),e.removeListener(`eachNodeAttributesUpdated`,this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener(`edgeAdded`,this.activeListeners.addEdgeGraphUpdate),e.removeListener(`edgeDropped`,this.activeListeners.dropEdgeGraphUpdate),e.removeListener(`edgeAttributesUpdated`,this.activeListeners.updateEdgeGraphUpdate),e.removeListener(`eachEdgeAttributesUpdated`,this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener(`edgesCleared`,this.activeListeners.clearEdgesGraphUpdate),e.removeListener(`cleared`,this.activeListeners.clearGraphUpdate)}},{key:`getEdgeAtPoint`,value:function(e,t){var n=Xr(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=Yr.apply(void 0,Ba(n)),i=this.itemIDsIndex[r];return i&&i.type===`edge`?i.id:null}},{key:`process`,value:function(){var e=this;this.emit(`beforeProcess`);var t=this.graph,n=this.settings,r=this.getDimensions();if(this.nodeExtent=ca(this.graph),!this.settings.autoRescale){var i=r.width,a=r.height,o=this.nodeExtent,s=o.x,c=o.y;this.nodeExtent={x:[(s[0]+s[1])/2-i/2,(s[0]+s[1])/2+i/2],y:[(c[0]+c[1])/2-a/2,(c[0]+c[1])/2+a/2]}}this.normalizationFunction=pa(this.customBBox||this.nodeExtent);var l=oa(new Ca().getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,n.labelGridCellSize);for(var u={},d={},f={},p={},m=1,h=t.nodes(),g=0,_=h.length;g<_;g++){var v=h[g],y=this.nodeDataCache[v],b=t.getNodeAttributes(v);y.x=b.x,y.y=b.y,this.normalizationFunction.applyTo(y),typeof y.label==`string`&&!y.hidden&&this.labelGrid.add(v,y.size,this.framedGraphToViewport(y,{matrix:l})),u[y.type]=(u[y.type]||0)+1}for(var x in this.labelGrid.organize(),this.nodePrograms){if(!Ja.call(this.nodePrograms,x))throw Error(`Sigma: could not find a suitable program for node type "${x}"!`);this.nodePrograms[x].reallocate(u[x]||0),u[x]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(h=fa(this.nodeZExtent,function(t){return e.nodeDataCache[t].zIndex},h));for(var S=0,C=h.length;S<C;S++){var w=h[S];d[w]=m,p[d[w]]={type:`node`,id:w},m++;var T=this.nodeDataCache[w];this.addNodeToProgram(w,d[w],u[T.type]++)}for(var E={},D=t.edges(),O=0,ee=D.length;O<ee;O++){var te=D[O],k=this.edgeDataCache[te];E[k.type]=(E[k.type]||0)+1}for(var A in this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(D=fa(this.edgeZExtent,function(t){return e.edgeDataCache[t].zIndex},D)),this.edgePrograms){if(!Ja.call(this.edgePrograms,A))throw Error(`Sigma: could not find a suitable program for edge type "${A}"!`);this.edgePrograms[A].reallocate(E[A]||0),E[A]=0}for(var j=0,M=D.length;j<M;j++){var N=D[j];f[N]=m,p[f[N]]={type:`edge`,id:N},m++;var ne=this.edgeDataCache[N];this.addEdgeToProgram(N,f[N],E[ne.type]++)}return this.itemIDsIndex=p,this.nodeIndices=d,this.edgeIndices=f,this.emit(`afterProcess`),this}},{key:`handleSettingsUpdate`,value:function(e){var t=this,n=this.settings;if(this.camera.minRatio=n.minCameraRatio,this.camera.maxRatio=n.maxCameraRatio,this.camera.enabledZooming=n.enableCameraZooming,this.camera.enabledPanning=n.enableCameraPanning,this.camera.enabledRotation=n.enableCameraRotation,n.cameraPanBoundaries?this.camera.clean=function(e){return t.cleanCameraState(e,n.cameraPanBoundaries&&ma(n.cameraPanBoundaries)===`object`?n.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==n.edgeProgramClasses){for(var r in n.edgeProgramClasses)n.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,n.edgeProgramClasses[r]);for(var i in e.edgeProgramClasses)n.edgeProgramClasses[i]||this.unregisterEdgeProgram(i)}if(e.nodeProgramClasses!==n.nodeProgramClasses||e.nodeHoverProgramClasses!==n.nodeHoverProgramClasses){for(var a in n.nodeProgramClasses)(n.nodeProgramClasses[a]!==e.nodeProgramClasses[a]||n.nodeHoverProgramClasses[a]!==e.nodeHoverProgramClasses[a])&&this.registerNodeProgram(a,n.nodeProgramClasses[a],n.nodeHoverProgramClasses[a]);for(var o in e.nodeProgramClasses)n.nodeProgramClasses[o]||this.unregisterNodeProgram(o)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:`cleanCameraState`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.tolerance,r=n===void 0?0:n,i=t.boundaries,a=Z({},e),o=i||this.nodeExtent,s=Fr(o.x,2),c=s[0],l=s[1],u=Fr(o.y,2),d=u[0],f=u[1],p=[this.graphToViewport({x:c,y:d},{cameraState:e}),this.graphToViewport({x:l,y:d},{cameraState:e}),this.graphToViewport({x:c,y:f},{cameraState:e}),this.graphToViewport({x:l,y:f},{cameraState:e})],m=1/0,h=-1/0,g=1/0,_=-1/0;p.forEach(function(e){var t=e.x,n=e.y;m=Math.min(m,t),h=Math.max(h,t),g=Math.min(g,n),_=Math.max(_,n)});var v=h-m,y=_-g,b=this.getDimensions(),x=b.width,S=b.height,C=0,w=0;if(v>=x?h<x-r?C=h-(x-r):m>r&&(C=m-r):h>x+r?C=h-(x+r):m<-r&&(C=m+r),y>=S?_<S-r?w=_-(S-r):g>r&&(w=g-r):_>S+r?w=_-(S+r):g<-r&&(w=g+r),C||w){var T=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),E=this.viewportToFramedGraph({x:C,y:w},{cameraState:e});C=E.x-T.x,w=E.y-T.y,a.x+=C,a.y+=w}return a}},{key:`renderLabels`,value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);ha(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var n=this.canvasContexts.labels,r=0,i=t.length;r<i;r++){var a=t[r],o=this.nodeDataCache[a];if(!this.displayedNodeLabels.has(a)&&!o.hidden){var s=this.framedGraphToViewport(o),c=s.x,l=s.y,u=this.scaleSize(o.size);if(!(!o.forceLabel&&u<this.settings.labelRenderedSizeThreshold)&&!(c<-Ka||c>this.width+Ka||l<-qa||l>this.height+qa)){this.displayedNodeLabels.add(a);var d=this.settings.defaultDrawNodeLabel;(this.nodePrograms[o.type]?.drawLabel||d)(n,Z(Z({key:a},o),{},{size:u,x:c,y:l}),this.settings)}}}return this}},{key:`renderEdgeLabels`,value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=Ga({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});ha(t,this.edgesWithForcedLabels);for(var n=new Set,r=0,i=t.length;r<i;r++){var a=t[r],o=this.graph.extremities(a),s=this.nodeDataCache[o[0]],c=this.nodeDataCache[o[1]],l=this.edgeDataCache[a];if(!n.has(a)&&!(l.hidden||s.hidden||c.hidden)){var u=this.settings.defaultDrawEdgeLabel;(this.edgePrograms[l.type]?.drawLabel||u)(e,Z(Z({key:a},l),{},{size:this.scaleSize(l.size)}),Z(Z(Z({key:o[0]},s),this.framedGraphToViewport(s)),{},{size:this.scaleSize(s.size)}),Z(Z(Z({key:o[1]},c),this.framedGraphToViewport(c)),{},{size:this.scaleSize(c.size)}),this.settings),n.add(a)}}return this.displayedEdgeLabels=n,this}},{key:`renderHighlightedNodes`,value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var n=function(n){var r=e.nodeDataCache[n],i=e.framedGraphToViewport(r),a=i.x,o=i.y,s=e.scaleSize(r.size),c=e.settings.defaultDrawNodeHover;(e.nodePrograms[r.type]?.drawHover||c)(t,Z(Z({key:n},r),{},{size:s,x:a,y:o}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(t){t!==e.hoveredNode&&r.push(t)}),r.forEach(function(e){return n(e)});var i={};for(var a in r.forEach(function(t){var n=e.nodeDataCache[t].type;i[n]=(i[n]||0)+1}),this.nodeHoverPrograms)this.nodeHoverPrograms[a].reallocate(i[a]||0),i[a]=0;r.forEach(function(t){var n=e.nodeDataCache[t];e.nodeHoverPrograms[n.type].process(0,i[n.type]++,n)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var o=this.getRenderParams();for(var s in this.nodeHoverPrograms)this.nodeHoverPrograms[s].render(o)}},{key:`scheduleHighlightedNodesRender`,value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:`render`,value:function(){var e=this;this.emit(`beforeRender`);var t=function(){return e.emit(`afterRender`),e};if(this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(t){return e.resetWebGLTexture(t)}),!this.graph.order)return t();var n=this.mouseCaptor,r=this.camera.isAnimated()||n.isMoving||n.draggedEvents||n.currentWheelDirection,i=this.camera.getState(),a=this.getDimensions(),o=this.getGraphDimensions(),s=this.getStagePadding();this.matrix=oa(i,a,o,s),this.invMatrix=oa(i,a,o,s,!0),this.correctionRatio=sa(this.matrix,i,a),this.graphToViewportRatio=this.getGraphToViewportRatio();var c=this.getRenderParams();for(var l in this.nodePrograms)this.nodePrograms[l].render(c);if(!this.settings.hideEdgesOnMove||!r)for(var u in this.edgePrograms)this.edgePrograms[u].render(c);return this.settings.hideLabelsOnMove&&r?t():(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes(),t())}},{key:`addNode`,value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var n=Ya(this.settings,e,t);this.nodeDataCache[e]=n,this.nodesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),n.highlighted&&!n.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(n.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=n.zIndex),n.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=n.zIndex))}},{key:`updateNode`,value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:`removeNode`,value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:`addEdge`,value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var n=Xa(this.settings,e,t);this.edgeDataCache[e]=n,this.edgesWithForcedLabels.delete(e),n.forceLabel&&!n.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(n.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=n.zIndex),n.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=n.zIndex))}},{key:`updateEdge`,value:function(e){this.addEdge(e)}},{key:`removeEdge`,value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:`clearNodeIndices`,value:function(){this.labelGrid=new Wa,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:`clearEdgeIndices`,value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:`clearIndices`,value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:`clearNodeState`,value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:`clearEdgeState`,value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:`clearState`,value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:`addNodeToProgram`,value:function(e,t,n){var r=this.nodeDataCache[e],i=this.nodePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for node type "${r.type}"!`);i.process(t,n,r),this.nodeProgramIndex[e]=n}},{key:`addEdgeToProgram`,value:function(e,t,n){var r=this.edgeDataCache[e],i=this.edgePrograms[r.type];if(!i)throw Error(`Sigma: could not find a suitable program for edge type "${r.type}"!`);var a=this.graph.extremities(e),o=this.nodeDataCache[a[0]],s=this.nodeDataCache[a[1]];i.process(t,n,o,s,r),this.edgeProgramIndex[e]=n}},{key:`getRenderParams`,value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:`getStagePadding`,value:function(){var e=this.settings,t=e.stagePadding;return e.autoRescale&&t||0}},{key:`createLayer`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw Error(`Sigma: a layer named "${e}" already exists`);var r=ua(t,{position:`absolute`},{class:`sigma-${e}`});return n.style&&Object.assign(r.style,n.style),this.elements[e]=r,`beforeLayer`in n&&n.beforeLayer?this.elements[n.beforeLayer].before(r):`afterLayer`in n&&n.afterLayer?this.elements[n.afterLayer].after(r):this.container.appendChild(r),r}},{key:`createCanvas`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,`canvas`,t)}},{key:`createCanvasContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=n.getContext(`2d`,r),this}},{key:`createWebGLContext`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t?.canvas||this.createCanvas(e,t);t.hidden&&n.remove();var r=Z({preserveDrawingBuffer:!1,antialias:!1},t),i=n.getContext(`webgl2`,r);i||=n.getContext(`webgl`,r),i||=n.getContext(`experimental-webgl`,r);var a=i;if(this.webGLContexts[e]=a,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var o=a.createFramebuffer();if(!o)throw Error(`Sigma: cannot create a new frame buffer for layer ${e}`);this.frameBuffers[e]=o}return a}},{key:`killLayer`,value:function(e){var t=this.elements[e];if(!t)throw Error(`Sigma: cannot kill layer ${e}, which does not exist`);if(this.webGLContexts[e]){var n;(n=this.webGLContexts[e].getExtension(`WEBGL_lose_context`))==null||n.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:`getCamera`,value:function(){return this.camera}},{key:`setCamera`,value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:`getContainer`,value:function(){return this.container}},{key:`getGraph`,value:function(){return this.graph}},{key:`setGraph`,value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:`getMouseCaptor`,value:function(){return this.mouseCaptor}},{key:`getTouchCaptor`,value:function(){return this.touchCaptor}},{key:`getDimensions`,value:function(){return{width:this.width,height:this.height}}},{key:`getGraphDimensions`,value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:`getNodeDisplayData`,value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getEdgeDisplayData`,value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:`getNodeDisplayedLabels`,value:function(){return new Set(this.displayedNodeLabels)}},{key:`getEdgeDisplayedLabels`,value:function(){return new Set(this.displayedEdgeLabels)}},{key:`getSettings`,value:function(){return Z({},this.settings)}},{key:`getSetting`,value:function(e){return this.settings[e]}},{key:`setSetting`,value:function(e,t){var n=Z({},this.settings);return this.settings[e]=t,ba(this.settings),this.handleSettingsUpdate(n),this.scheduleRefresh(),this}},{key:`updateSetting`,value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:`setSettings`,value:function(e){var t=Z({},this.settings);return this.settings=Z(Z({},this.settings),e),ba(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:`resize`,value:function(e){var t=this.width,n=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=da(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw Error(`Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw Error(`Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.`);if(!e&&t===this.width&&n===this.height)return this;for(var r in this.elements){var i=this.elements[r];i.style.width=this.width+`px`,i.style.height=this.height+`px`}for(var a in this.canvasContexts)this.elements[a].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[a].setAttribute(`height`,this.height*this.pixelRatio+`px`),this.pixelRatio!==1&&this.canvasContexts[a].scale(this.pixelRatio,this.pixelRatio);for(var o in this.webGLContexts){this.elements[o].setAttribute(`width`,this.width*this.pixelRatio+`px`),this.elements[o].setAttribute(`height`,this.height*this.pixelRatio+`px`);var s=this.webGLContexts[o];if(s.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(o)){var c=this.textures[o];c&&s.deleteTexture(c)}}return this.emit(`resize`),this}},{key:`clear`,value:function(){return this.emit(`beforeClear`),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit(`afterClear`),this}},{key:`refresh`,value:function(e){var t=this,n=e?.skipIndexation===void 0?!1:e?.skipIndexation,r=e?.schedule===void 0?!1:e.schedule,i=!e||!e.partialGraph;if(i)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(e){return t.addNode(e)}),this.graph.forEachEdge(function(e){return t.addEdge(e)});else{for(var a,o=e.partialGraph?.nodes||[],s=0,c=o?.length||0;s<c;s++){var l=o[s];if(this.updateNode(l),n){var u=this.nodeProgramIndex[l];if(u===void 0)throw Error(`Sigma: node "${l}" can't be repaint`);this.addNodeToProgram(l,this.nodeIndices[l],u)}}for(var d=(e==null||(a=e.partialGraph)==null?void 0:a.edges)||[],f=0,p=d.length;f<p;f++){var m=d[f];if(this.updateEdge(m),n){var h=this.edgeProgramIndex[m];if(h===void 0)throw Error(`Sigma: edge "${m}" can't be repaint`);this.addEdgeToProgram(m,this.edgeIndices[m],h)}}}return(i||!n)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:`scheduleRender`,value:function(){var e=this;return this.renderFrame||=requestAnimationFrame(function(){e.render()}),this}},{key:`scheduleRefresh`,value:function(e){return this.refresh(Z(Z({},e),{},{schedule:!0}))}},{key:`getViewportZoomedState`,value:function(e,t){var n=this.camera.getState(),r=n.ratio,i=n.angle,a=n.x,o=n.y,s=this.settings,c=s.minCameraRatio,l=s.maxCameraRatio;typeof l==`number`&&(t=Math.min(t,l)),typeof c==`number`&&(t=Math.max(t,c));var u=t/r,d={x:this.width/2,y:this.height/2},f=this.viewportToFramedGraph(e),p=this.viewportToFramedGraph(d);return{angle:i,x:(f.x-p.x)*(1-u)+a,y:(f.y-p.y)*(1-u)+o,ratio:t}}},{key:`viewRectangle`,value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),n=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-n.y}}},{key:`framedGraphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=ia(t.matrix?t.matrix:n?oa(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,e);return{x:(1+r.x)*this.width/2,y:(1-r.y)*this.height/2}}},{key:`viewportToFramedGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=ia(t.matrix?t.matrix:n?oa(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(r.x)&&(r.x=0),isNaN(r.y)&&(r.y=0),r}},{key:`viewportToGraph`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:`graphToViewport`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:`getGraphToViewportRatio`,value:function(){var e={x:0,y:0},t={x:1,y:1},n=Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),r=this.graphToViewport(e),i=this.graphToViewport(t);return Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2)/n}},{key:`getBBox`,value:function(){return this.nodeExtent}},{key:`getCustomBBox`,value:function(){return this.customBBox}},{key:`setCustomBBox`,value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:`kill`,value:function(){this.emit(`kill`),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener(`resize`,this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&=(cancelAnimationFrame(this.renderFrame),null),this.renderHighlightedNodesFrame&&=(cancelAnimationFrame(this.renderHighlightedNodesFrame),null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var n in this.nodeHoverPrograms)this.nodeHoverPrograms[n].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();for(var i in this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={},this.elements)this.killLayer(i);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:`scaleSize`,value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting(`itemSizesReference`)===`positions`?t*this.graphToViewportRatio:1)}},{key:`getCanvases`,value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])}(Ji),Qa=(0,K.createContext)(null),$a=Qa.Provider;function eo(){let e=(0,K.useContext)(Qa);if(e==null)throw Error(`No context provided: useSigmaContext() can only be used in a descendant of <SigmaContainer>`);return e}function to(){return eo().sigma}function no(){let{sigma:e}=eo();return(0,K.useCallback)((t=>{e&&Object.keys(t).forEach((n=>{e.setSetting(n,t[n])}))}),[e])}function ro(e){return new Set(Object.keys(e))}var io=ro({clickNode:!0,rightClickNode:!0,downNode:!0,enterNode:!0,leaveNode:!0,doubleClickNode:!0,wheelNode:!0,clickEdge:!0,rightClickEdge:!0,downEdge:!0,enterEdge:!0,leaveEdge:!0,doubleClickEdge:!0,wheelEdge:!0,clickStage:!0,rightClickStage:!0,downStage:!0,doubleClickStage:!0,wheelStage:!0,beforeRender:!0,afterRender:!0,kill:!0,upStage:!0,upEdge:!0,upNode:!0,enterStage:!0,leaveStage:!0,resize:!0,afterClear:!0,afterProcess:!0,beforeClear:!0,beforeProcess:!0,moveBody:!0}),ao=ro({click:!0,rightClick:!0,doubleClick:!0,mouseup:!0,mousedown:!0,mousemove:!0,mousemovebody:!0,mouseleave:!0,mouseenter:!0,wheel:!0}),oo=ro({touchup:!0,touchdown:!0,touchmove:!0,touchmovebody:!0,tap:!0,doubletap:!0}),so=ro({updated:!0});function co(){let e=to(),t=no(),[n,r]=(0,K.useState)({});return(0,K.useEffect)((()=>{if(!e||!n)return;let t=n,r=Object.keys(t);return r.forEach((n=>{let r=t[n];io.has(n)&&e.on(n,r),ao.has(n)&&e.getMouseCaptor().on(n,r),oo.has(n)&&e.getTouchCaptor().on(n,r),so.has(n)&&e.getCamera().on(n,r)})),()=>{e&&r.forEach((n=>{let r=t[n];io.has(n)&&e.off(n,r),ao.has(n)&&e.getMouseCaptor().off(n,r),oo.has(n)&&e.getTouchCaptor().off(n,r),so.has(n)&&e.getCamera().off(n,r)}))}}),[e,n,t]),r}function lo(){let e=to();return(0,K.useCallback)(((t,n=!0)=>{e&&t&&(n&&e.getGraph().order>0&&e.getGraph().clear(),e.getGraph().import(t),e.refresh())}),[e])}function uo(e,t){if(e===t)return!0;if(typeof e==`object`&&e&&typeof t==`object`&&t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(let n in e)if(!Object.hasOwn(t,n)||!uo(e[n],t[n]))return!1;return!0}return!1}function fo(e,t){let n;return r=>new Promise((i=>{n&&clearTimeout(n),n=setTimeout((()=>{i(e(r))}),t)}))}function po(e){let t=to(),[n,r]=(0,K.useState)(e||{});return(0,K.useEffect)((()=>{r((t=>uo(t,e||{})?t:e||{}))}),[e]),{zoomIn:(0,K.useCallback)((e=>{t.getCamera().animatedZoom(Object.assign(Object.assign({},n),e))}),[t,n]),zoomOut:(0,K.useCallback)((e=>{t.getCamera().animatedUnzoom(Object.assign(Object.assign({},n),e))}),[t,n]),reset:(0,K.useCallback)((e=>{t.getCamera().animatedReset(Object.assign(Object.assign({},n),e))}),[t,n]),goto:(0,K.useCallback)(((e,r)=>{t.getCamera().animate(e,Object.assign(Object.assign({},n),r))}),[t,n]),gotoNode:(0,K.useCallback)(((e,r)=>{let i=t.getNodeDisplayData(e);i?t.getCamera().animate(i,Object.assign(Object.assign({},n),r)):console.warn(`Node ${e} not found`)}),[t,n])}}function mo(e){let t=eo(),[n,r]=(0,K.useState)(!1),[i,a]=(0,K.useState)(e||t.container),o=(0,K.useCallback)((()=>r((e=>!e))),[]);return(0,K.useEffect)((()=>(document.addEventListener(`fullscreenchange`,o),()=>document.removeEventListener(`fullscreenchange`,o))),[o]),(0,K.useEffect)((()=>{a(e||t.container)}),[e,t.container]),{toggle:(0,K.useCallback)((()=>{var e=i;document.fullscreenElement===e?document.exitFullscreen&&document.exitFullscreen():e.requestFullscreen()}),[i]),isFullScreen:n}}var ho=(0,K.forwardRef)((({graph:e,id:t,className:n,style:r,settings:i={},children:a},o)=>{let s=(0,K.useRef)(null),c=(0,K.useRef)(null),l={className:`react-sigma ${n||``}`,id:t,style:r},[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(i);(0,K.useEffect)((()=>{p((e=>uo(e,i)?e:i))}),[i]),(0,K.useEffect)((()=>{let t=null;if(c.current!==null){let n=new dr;e&&(n=typeof e==`function`?new e:e),t=new Za(n,c.current,f),d((e=>{let n=null;return e&&(n=e.getCamera().getState()),n&&t.getCamera().setState(n),t}))}return()=>{t&&t.kill()}}),[c,e,f]),(0,K.useImperativeHandle)(o,(()=>u),[u]);let m=(0,K.useMemo)((()=>u&&s.current?{sigma:u,container:s.current}:null),[u,s]),h=m===null?null:K.createElement($a,{value:m},a);return K.createElement(`div`,Object.assign({},l,{ref:s}),K.createElement(`div`,{className:`sigma-container`,ref:c}),h)})),go=({id:e,className:t,style:n,children:r,position:i=`bottom-left`})=>{let a={className:`react-sigma-controls ${t||``} ${i}`,id:e,style:n};return K.createElement(`div`,Object.assign({},a),r)},_o;function vo(){return vo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vo.apply(null,arguments)}var yo,bo=function(e){return K.createElement(`svg`,vo({xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`dot-circle-regular_svg__svg-inline--fa dot-circle-regular_svg__fa-dot-circle dot-circle-regular_svg__fa-w-16`,"data-icon":`dot-circle`,"data-prefix":`far`,viewBox:`0 0 512 512`,width:`1em`,height:`1em`},e),_o||=K.createElement(`path`,{fill:`currentColor`,d:`M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8m0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80`}))};function xo(){return xo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xo.apply(null,arguments)}var So,Co=function(e){return K.createElement(`svg`,xo({xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`minus-solid_svg__svg-inline--fa minus-solid_svg__fa-minus minus-solid_svg__fa-w-14`,"data-icon":`minus`,"data-prefix":`fas`,viewBox:`0 0 448 512`,width:`1em`,height:`1em`},e),yo||=K.createElement(`path`,{fill:`currentColor`,d:`M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32`}))};function wo(){return wo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wo.apply(null,arguments)}var To=function(e){return K.createElement(`svg`,wo({xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`plus-solid_svg__svg-inline--fa plus-solid_svg__fa-plus plus-solid_svg__fa-w-14`,"data-icon":`plus`,"data-prefix":`fas`,viewBox:`0 0 448 512`,width:`1em`,height:`1em`},e),So||=K.createElement(`path`,{fill:`currentColor`,d:`M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32`}))},Eo=({className:e,style:t,animationDuration:n=200,children:r,labels:i={}})=>{let{zoomIn:a,zoomOut:o,reset:s}=po({duration:n,factor:1.5}),c={style:t,className:`react-sigma-control ${e||``}`};return K.createElement(K.Fragment,null,K.createElement(`div`,Object.assign({},c),K.createElement(`button`,{onClick:()=>a(),title:i.zoomIn||`Zoom In`},r?r[0]:K.createElement(To,{style:{width:`1em`}}))),K.createElement(`div`,Object.assign({},c),K.createElement(`button`,{onClick:()=>o(),title:i.zoomOut||`Zoom Out`},r?r[1]:K.createElement(Co,{style:{width:`1em`}}))),K.createElement(`div`,Object.assign({},c),K.createElement(`button`,{onClick:()=>s(),title:i.reset||`See whole graph`},r?r[2]:K.createElement(bo,{style:{width:`1em`}}))))},Do;function Oo(){return Oo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Oo.apply(null,arguments)}var ko,Ao=function(e){return K.createElement(`svg`,Oo({xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`compress-solid_svg__svg-inline--fa compress-solid_svg__fa-compress compress-solid_svg__fa-w-14`,"data-icon":`compress`,"data-prefix":`fas`,viewBox:`0 0 448 512`,width:`1em`,height:`1em`},e),Do||=K.createElement(`path`,{fill:`currentColor`,d:`M436 192H312c-13.3 0-24-10.7-24-24V44c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v84h84c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12m-276-24V44c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v84H12c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24m0 300V344c0-13.3-10.7-24-24-24H12c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12m192 0v-84h84c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12H312c-13.3 0-24 10.7-24 24v124c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12`}))};function jo(){return jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jo.apply(null,arguments)}var Mo=function(e){return K.createElement(`svg`,jo({xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`expand-solid_svg__svg-inline--fa expand-solid_svg__fa-expand expand-solid_svg__fa-w-14`,"data-icon":`expand`,"data-prefix":`fas`,viewBox:`0 0 448 512`,width:`1em`,height:`1em`},e),ko||=K.createElement(`path`,{fill:`currentColor`,d:`M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12M288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12m148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12M160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12`}))},No=({id:e,className:t,style:n,container:r,children:i,labels:a={}})=>{let{isFullScreen:o,toggle:s}=mo(r?.current),c={className:`react-sigma-control ${t||``}`,id:e,style:n};return document.fullscreenEnabled?K.createElement(`div`,Object.assign({},c),K.createElement(`button`,{onClick:s,title:o?a.exit||`Exit fullscreen`:a.enter||`Enter fullscreen`},i&&!o&&i[0],i&&o&&i[1],!i&&!o&&K.createElement(Mo,{style:{width:`1em`}}),!i&&o&&K.createElement(Ao,{style:{width:`1em`}}))):null},Po=({width:e,height:t,debounceTime:n})=>{let r=to(),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(0),[c,l]=(0,K.useState)({top:0,left:0,width:0,height:0});(0,K.useEffect)((()=>{i&&(i.getCamera().disable(),s(i.getContainer().clientHeight/r.getContainer().clientHeight))}),[i,r]);let u=(0,K.useCallback)((e=>{let t=r.getNodeDisplayData(e);return Object.assign(Object.assign({x:0,y:0},t||{}),{type:`circle`,size:(t?.size||1)*o,label:void 0})}),[r,o]),d=(0,K.useCallback)((e=>({hidden:!0})),[]);return(0,K.useEffect)((()=>{function e(){if(i===null)return;let e=r.viewRectangle(),t=i?.framedGraphToViewport({x:e.x1,y:e.y1}),n=i?.framedGraphToViewport({x:e.x2,y:e.y2+e.height});l({left:t.x,top:t.y,height:t.y-n.y,width:n.x-t.x})}e();let t=fo(e,n||0);return r.getCamera().on(`updated`,t),()=>{r.getCamera().off(`updated`,e)}}),[r,i,l,n]),K.createElement(ho,{ref:a,settings:{renderLabels:!1,maxCameraRatio:1,minCameraRatio:1,stagePadding:2,nodeReducer:u,edgeReducer:d},style:{width:e,height:t},graph:r.getGraph()},K.createElement(`div`,{className:`overlay`,style:{position:`absolute`,inset:0,zIndex:1,overflow:`hidden`}},K.createElement(`div`,{style:Object.assign({border:`1px solid var(--sigma-controls-color)`,backgroundColor:`var(--sigma-controls-color)`,opacity:.5,position:`absolute`},c)})))};function Fo(){Fo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},a=typeof Symbol==`function`?Symbol:{},o=a.iterator||`@@iterator`,s=a.asyncIterator||`@@asyncIterator`,c=a.toStringTag||`@@toStringTag`;function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},``)}catch{l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof _?t:_,o=Object.create(a.prototype);return i(o,`_invoke`,{value:E(e,n,new te(r||[]))}),o}function d(e,t,n){try{return{type:`normal`,arg:e.call(t,n)}}catch(e){return{type:`throw`,arg:e}}}t.wrap=u;var f=`suspendedStart`,p=`suspendedYield`,m=`executing`,h=`completed`,g={};function _(){}function v(){}function y(){}var b={};l(b,o,function(){return this});var x=Object.getPrototypeOf,S=x&&x(x(k([])));S&&S!==n&&r.call(S,o)&&(b=S);var C=y.prototype=_.prototype=Object.create(b);function w(e){[`next`,`throw`,`return`].forEach(function(t){l(e,t,function(e){return this._invoke(t,e)})})}function T(e,t){function n(i,a,o,s){var c=d(e[i],e,a);if(c.type!==`throw`){var l=c.arg,u=l.value;return u&&typeof u==`object`&&r.call(u,`__await`)?t.resolve(u.__await).then(function(e){n(`next`,e,o,s)},function(e){n(`throw`,e,o,s)}):t.resolve(u).then(function(e){l.value=e,o(l)},function(e){return n(`throw`,e,o,s)})}s(c.arg)}var a;i(this,`_invoke`,{value:function(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return a=a?a.then(i,i):i()}})}function E(t,n,r){var i=f;return function(a,o){if(i===m)throw Error(`Generator is already running`);if(i===h){if(a===`throw`)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=D(s,r);if(c){if(c===g)continue;return c}}if(r.method===`next`)r.sent=r._sent=r.arg;else if(r.method===`throw`){if(i===f)throw i=h,r.arg;r.dispatchException(r.arg)}else r.method===`return`&&r.abrupt(`return`,r.arg);i=m;var l=d(t,n,r);if(l.type===`normal`){if(i=r.done?h:p,l.arg===g)continue;return{value:l.arg,done:r.done}}l.type===`throw`&&(i=h,r.method=`throw`,r.arg=l.arg)}}}function D(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,r===`throw`&&t.iterator.return&&(n.method=`return`,n.arg=e,D(t,n),n.method===`throw`)||r!==`return`&&(n.method=`throw`,n.arg=TypeError(`The iterator does not provide a '`+r+`' method`)),g;var a=d(i,t.iterator,n.arg);if(a.type===`throw`)return n.method=`throw`,n.arg=a.arg,n.delegate=null,g;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,n.method!==`return`&&(n.method=`next`,n.arg=e),n.delegate=null,g):o:(n.method=`throw`,n.arg=TypeError(`iterator result is not an object`),n.delegate=null,g)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function ee(e){var t=e.completion||{};t.type=`normal`,delete t.arg,e.completion=t}function te(e){this.tryEntries=[{tryLoc:`root`}],e.forEach(O,this),this.reset(!0)}function k(t){if(t||t===``){var n=t[o];if(n)return n.call(t);if(typeof t.next==`function`)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw TypeError(typeof t+` is not iterable`)}return v.prototype=y,i(C,`constructor`,{value:y,configurable:!0}),i(y,`constructor`,{value:v,configurable:!0}),v.displayName=l(y,c,`GeneratorFunction`),t.isGeneratorFunction=function(e){var t=typeof e==`function`&&e.constructor;return!!t&&(t===v||(t.displayName||t.name)===`GeneratorFunction`)},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,c,`GeneratorFunction`)),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},w(T.prototype),l(T.prototype,s,function(){return this}),t.AsyncIterator=T,t.async=function(e,n,r,i,a){a===void 0&&(a=Promise);var o=new T(u(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},w(C),l(C,c,`Generator`),l(C,o,function(){return this}),l(C,`toString`,function(){return`[object Generator]`}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=k,te.prototype={constructor:te,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=`next`,this.arg=e,this.tryEntries.forEach(ee),!t)for(var n in this)n.charAt(0)===`t`&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type===`throw`)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type=`throw`,s.arg=t,n.next=r,i&&(n.method=`next`,n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc===`root`)return i(`end`);if(o.tryLoc<=this.prev){var c=r.call(o,`catchLoc`),l=r.call(o,`finallyLoc`);if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error(`try statement without catch or finally`);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,`finallyLoc`)&&this.prev<i.finallyLoc){var a=i;break}}a&&(e===`break`||e===`continue`)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method=`next`,this.next=a.finallyLoc,g):this.complete(o)},complete:function(e,t){if(e.type===`throw`)throw e.arg;return e.type===`break`||e.type===`continue`?this.next=e.arg:e.type===`return`?(this.rval=this.arg=e.arg,this.method=`return`,this.next=`end`):e.type===`normal`&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),ee(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(r.type===`throw`){var i=r.arg;ee(n)}return i}}throw Error(`illegal catch attempt`)},delegateYield:function(t,n,r){return this.delegate={iterator:k(t),resultName:n,nextLoc:r},this.method===`next`&&(this.arg=e),g}},t}function Io(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Lo(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Io(a,r,i,o,s,`next`,e)}function s(e){Io(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Ro(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function zo(e){var t=Ro(e,`string`);return typeof t==`symbol`?t:t+``}function Bo(e,t,n){return(t=zo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ho(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vo(Object(n),!0).forEach(function(t){Bo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Uo={animate:!0};function Wo(e,t){if(!t.length)throw Error(`getCameraStateToFitViewportToNodes: There should be at least one node.`);var n=1/0,r=-1/0,i=1/0,a=-1/0,o=1/0,s=-1/0,c=1/0,l=-1/0,u=e.getGraph();t.forEach(function(t){var d=e.getNodeDisplayData(t);if(!d)throw Error(`getCameraStateToFitViewportToNodes: Node ${t} not found in sigma's graph.`);var f=u.getNodeAttributes(t),p=f.x,m=f.y,h=d.x,g=d.y;n=Math.min(n,p),r=Math.max(r,p),i=Math.min(i,m),a=Math.max(a,m),o=Math.min(o,h),s=Math.max(s,h),c=Math.min(c,g),l=Math.max(l,g)});var d=e.getCustomBBox()||e.getBBox(),f=d.x,p=d.y,m=f[1]-f[0]||1,h=p[1]-p[0]||1,g=(o+s)/2,_=(c+l)/2,v=r-n||m,y=a-i||h,b=e.getDimensions(),x=b.width,S=b.height,C=aa({width:x,height:S},{width:m,height:h}),w=(y/v<S/x?v:y)/Math.max(m,h)*C;return Ho(Ho({},e.getCamera().getState()),{},{angle:0,x:g,y:_,ratio:w})}function Go(e,t){return Ko.apply(this,arguments)}function Ko(){return Ko=Lo(Fo().mark(function e(t,n){var r,i,a,o,s,c=arguments;return Fo().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>2&&c[2]!==void 0?c[2]:{},i=Ho(Ho({},Uo),r),a=i.animate,o=t.getCamera(),s=Wo(t,n),!a){e.next=9;break}return e.next=7,o.animate(s);case 7:e.next=10;break;case 9:o.setState(s);case 10:case`end`:return e.stop()}},e)})),Ko.apply(this,arguments)}var qo=b(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Jo=b(`locate-fixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Yo=e=>e?.constructor.name===`Array`,Xo=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Zo(e[n],t[n]))return!1;return!0},Zo=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual==`function`&&typeof t?.isEqual==`function`)return e.isEqual(t);if(typeof e==`function`&&typeof t==`function`)return e.toString()===t.toString();if(Yo(e)&&Yo(t))return Xo(Array.from(e),Array.from(t));if(typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(t??Object.create(null)),r=n.length;for(let t=0;t<r;t++)if(!Reflect.has(e,n[t]))return!1;for(let i=0;i<r;i++){let r=n[i];if(!Zo(e[r],t[r]))return!1}return!0},Qo=new Set([`menu`,`listbox`,`dialog`,`grid`,`tree`,`region`]),$o=e=>Qo.has(e),es=e=>e.getAttribute(`aria-controls`)?.split(` `)||[];function ts(e,t){let n=new Set,r=ce(e),i=e=>{let a=e.querySelectorAll(`[aria-controls]`);for(let e of a){if(e.getAttribute(`aria-expanded`)!==`true`)continue;let a=es(e);for(let e of a){if(!e||n.has(e))continue;n.add(e);let a=r.getElementById(e);if(a){let e=a.getAttribute(`role`),n=a.getAttribute(`aria-modal`)===`true`;if(e&&$o(e)&&!n&&(a===t||a.contains(t)||i(a)))return!0}}}return!1};return i(e)}function ns(e,t){let n=ce(e),r=new Set,i=e=>{let a=e.querySelectorAll(`[aria-controls]`);for(let e of a){if(e.getAttribute(`aria-expanded`)!==`true`)continue;let a=es(e);for(let e of a){if(!e||r.has(e))continue;r.add(e);let a=n.getElementById(e);if(a){let e=a.getAttribute(`role`),n=a.getAttribute(`aria-modal`)===`true`;e&&Qo.has(e)&&!n&&(t(a),i(a))}}}};i(e)}function rs(e){let t=new Set;return ns(e,n=>{e.contains(n)||t.add(n)}),Array.from(t)}function is(e){let t=e.getAttribute(`role`);return!!(t&&Qo.has(t))}function as(e){return e.hasAttribute(`aria-controls`)&&e.getAttribute(`aria-expanded`)===`true`}function os(e){return as(e)?!0:!!e.querySelector?.(`[aria-controls][aria-expanded="true"]`)}function ss(e){if(!e.id)return!1;let t=ce(e),n=CSS.escape(e.id),r=`[aria-controls~="${n}"][aria-expanded="true"], [aria-controls="${n}"][aria-expanded="true"]`;return!!(t.querySelector(r)&&is(e))}function cs(e,t){let{type:n=`HTMLInputElement`,property:r=`value`}=t,i=he(e)[n].prototype;return Object.getOwnPropertyDescriptor(i,r)??{}}function ls(e){if(e.localName===`input`)return`HTMLInputElement`;if(e.localName===`textarea`)return`HTMLTextAreaElement`;if(e.localName===`select`)return`HTMLSelectElement`}function us(e,t,n=`value`){if(!e)return;let r=ls(e);r&&cs(e,{type:r,property:n}).set?.call(e,t),e.setAttribute(n,t)}function ds(e){return e.matches(`textarea, input, select, button`)}function fs(e,t){if(!e)return;let n=ds(e)?e.form:e.closest(`form`),r=e=>{e.defaultPrevented||t()};return n?.addEventListener(`reset`,r,{passive:!0}),()=>n?.removeEventListener(`reset`,r)}function ps(e,t){let n=e?.closest(`fieldset`);if(!n)return;t(n.disabled);let r=new(he(n)).MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:[`disabled`]}),()=>r.disconnect()}function ms(e,t){if(!e)return;let{onFieldsetDisabledChange:n,onFormReset:r}=t,i=[fs(e,r),ps(e,n)];return()=>i.forEach(e=>e?.())}var hs=Symbol.for(`zag.changeEvent`);function gs(e){return Object.prototype.hasOwnProperty.call(e,hs)}function _s(e){return gs(e)||Object.defineProperty(e,hs,{value:!0}),e}var vs=e=>Re(e)&&e.tagName===`IFRAME`,ys=/^(audio|video|details)$/;function bs(e){let t=e.getAttribute(`tabindex`);return t?parseInt(t,10):NaN}var xs=e=>!Number.isNaN(bs(e)),Ss=e=>bs(e)<0;function Cs(e){return Fe(e)&&e.type===`radio`}function ws(e){if(!Cs(e)||!e.name||e.checked)return!0;let t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=e.form??e.ownerDocument,r=Array.from(n.querySelectorAll(t)).filter(t=>t.form===e.form&&ks(t)),i=r.find(e=>e.checked);return i?i===e:r[0]===e}function Ts(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;let n=t(e);return(n===!0?e.shadowRoot:n)||null}function Es(e,t,n){let r=[...e],i=[...e],a=new Set,o=new Map;e.forEach((e,t)=>o.set(e,t));let s=0;for(;s<i.length;){let e=i[s++];if(!e||a.has(e))continue;a.add(e);let c=Ts(e,t);if(c){let t=Array.from(c.querySelectorAll(Ds)).filter(n),a=o.get(e);if(a!==void 0){let e=a+1;r.splice(e,0,...t),t.forEach((t,n)=>{o.set(t,e+n)});for(let n=e+t.length;n<r.length;n++)o.set(r[n],n)}else{let e=r.length;r.push(...t),t.forEach((t,n)=>{o.set(t,e+n)})}i.push(...t)}}return r}var Ds=`input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type`,Os=(e,t={})=>{if(!e)return[];let{includeContainer:n=!1,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(Ds));(n==1||n==`if-empty`&&i.length===0)&&Re(e)&&ks(e)&&i.unshift(e);let a=[];for(let e of i)if(ks(e)){if(vs(e)&&e.contentDocument){let t=e.contentDocument.body;a.push(...Os(t,{getShadowRoot:r}));continue}a.push(e)}return r?Es(a,r,ks):a};function ks(e){return!Re(e)||e.closest(`[inert]`)?!1:e.matches(Ds)&&Te(e)}function As(e,t={}){if(!e)return[];let{includeContainer:n,getShadowRoot:r}=t,i=Array.from(e.querySelectorAll(Ds));n&&js(e)&&i.unshift(e);let a=[];for(let e of i)if(js(e)){if(vs(e)&&e.contentDocument){let t=e.contentDocument.body;a.push(...As(t,{getShadowRoot:r}));continue}a.push(e)}if(r){let e=Es(a,r,js);return!e.length&&n?i:e}return!a.length&&n?i:a}function js(e){return Re(e)&&e.tabIndex>0?!0:!ks(e)||Ss(e)?!1:ws(e)}function Ms(e,t={}){let n=As(e,t);return[n[0]||null,n[n.length-1]||null]}function Ns(e){return e.tabIndex<0&&(ys.test(e.localName)||M(e))&&!xs(e)?0:e.tabIndex}function Ps(e){let{root:t,getInitialEl:n,filter:r,enabled:i=!0}=e;if(!i)return;let a=null;if(a||=typeof n==`function`?n():n,a||=t?.querySelector(`[data-autofocus],[autofocus]`),!a){let e=As(t);a=r?e.filter(r)[0]:e[0]}return a||t||void 0}function Fs(e){let t=e.currentTarget;if(!t)return!1;let[n,r]=Ms(t);return!(me(n)&&e.shiftKey||me(r)&&!e.shiftKey||!n&&!r)}function Is(e,t){if(!e)return;let{attributes:n,callback:r}=t,i=new(e.ownerDocument.defaultView||window).MutationObserver(e=>{for(let t of e)t.type===`attributes`&&t.attributeName&&n.includes(t.attributeName)&&r(t)});return i.observe(e,{attributes:!0,attributeFilter:n}),()=>i.disconnect()}function Ls(e,t){let{defer:n}=t,r=n?U:e=>e(),i=[];return i.push(r(()=>{let n=typeof e==`function`?e():e;i.push(Is(n,t))})),()=>{i.forEach(e=>e?.())}}function Rs(e,t){let{callback:n}=t;if(!e)return;let r=new(e.ownerDocument.defaultView||window).MutationObserver(n);return r.observe(e,{childList:!0,subtree:!0}),()=>r.disconnect()}function zs(e,t){let{defer:n}=t,r=n?U:e=>e(),i=[];return i.push(r(()=>{let n=typeof e==`function`?e():e;i.push(Rs(n,t))})),()=>{i.forEach(e=>e?.())}}function Bs(e){let t=()=>{let t=he(e);e.dispatchEvent(new t.MouseEvent(`click`))};V()?Ue(e,`keyup`,t):queueMicrotask(t)}var Vs=e=>e.split(``).map(e=>{let t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`/x${t.toString(16)}`.replace(`/`,`\\`):``}).join(``).trim(),Hs=e=>Vs(e.dataset?.valuetext??e.textContent??``),Us=(e,t)=>e.trim().toLowerCase().startsWith(t.toLowerCase());function Ws(e,t,n,r=bt){let i=n?ct(e,n,r):-1,a=n?Le(e,i):e;return t.length===1&&(a=a.filter(e=>r(e)!==n)),a.find(e=>Us(Hs(e),t))}function Gs(e,t){let{state:n,activeId:r,key:i,timeout:a=350,itemToId:o}=t,s=n.keysSoFar+i,c=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,l=Ws(e.slice(),c,r,o);function u(){clearTimeout(n.timer),n.timer=-1}function d(e){n.keysSoFar=e,u(),e!==``&&(n.timer=+setTimeout(()=>{d(``),u()},a))}return d(s),l}var Ks=Object.assign(Gs,{defaultOptions:{keysSoFar:``,timer:-1},isValidEvent:qs});function qs(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var Js={border:`0`,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:`0`,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`};function Ys(e,t,n){let{signal:r}=t;return[new Promise((t,i)=>{let a=setTimeout(()=>{i(Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener(`abort`,()=>{clearTimeout(a),i(new DOMException(`Promise aborted`,`AbortError`))}),e.then(e=>{r.aborted||(clearTimeout(a),t(e))}).catch(e=>{r.aborted||(clearTimeout(a),i(e))})}),()=>t.abort()]}function Xs(e,t){let{timeout:n,rootNode:r}=t,i=he(r),a=I(r),o=new i.AbortController;return Ys(new Promise(t=>{let n=e();if(n){t(n);return}let r=new i.MutationObserver(()=>{let n=e();n&&n.isConnected&&(r.disconnect(),t(n))});r.observe(a.body,{childList:!0,subtree:!0})}),o,n)}var[Zs,Qs]=_e({name:`RenderStrategyContext`,hookName:`useRenderStrategyContext`,providerName:`<RenderStrategyPropsProvider />`}),$s=e=>De()(e,[`lazyMount`,`unmountOnExit`]),[ec,tc]=_e({name:`DialogContext`,hookName:`useDialogContext`,providerName:`<DialogProvider />`}),Q=r(),nc=(0,K.forwardRef)((e,t)=>{let n=tc(),r=Oe({...Qs(),present:n.open}),i=G(n.getBackdropProps(),r.getPresenceProps(),e);return r.unmounted?null:(0,Q.jsx)(tt.div,{...i,ref:rt(r.ref,t)})});nc.displayName=`DialogBackdrop`;var rc=(0,K.forwardRef)((e,t)=>{let n=tc(),r=Ne(),i=G(n.getContentProps(),r.getPresenceProps(),e);return r.unmounted?null:(0,Q.jsx)(tt.div,{...i,ref:rt(r.ref,t)})});rc.displayName=`DialogContent`;var ic=(0,K.forwardRef)((e,t)=>{let n=G(tc().getPositionerProps(),e);return Ne().unmounted?null:(0,Q.jsx)(tt.div,{...n,ref:t})});ic.displayName=`DialogPositioner`;var ac=Ze(`dialog`).parts(`trigger`,`backdrop`,`positioner`,`content`,`title`,`description`,`closeTrigger`).build(),oc=e=>e.ids?.positioner??`dialog:${e.id}:positioner`,sc=e=>e.ids?.backdrop??`dialog:${e.id}:backdrop`,cc=e=>e.ids?.content??`dialog:${e.id}:content`,lc=(e,t)=>{let n=e.ids?.trigger;return n==null?t?`dialog:${e.id}:trigger:${t}`:`dialog:${e.id}:trigger`:Qe(n)?n(t):n},uc=e=>e.ids?.title??`dialog:${e.id}:title`,dc=e=>e.ids?.description??`dialog:${e.id}:description`,fc=e=>e.ids?.closeTrigger??`dialog:${e.id}:close`,pc=e=>e.getById(cc(e)),mc=e=>e.getById(oc(e)),hc=e=>e.getById(sc(e)),gc=e=>e.getById(uc(e)),_c=e=>e.getById(dc(e)),vc=e=>e.getById(fc(e)),yc=e=>dt(e.getDoc(),`[data-scope="dialog"][data-part="trigger"][data-ownedby="${e.id}"]`),bc=(e,t)=>t==null?yc(e)[0]:e.getById(lc(e,t));function xc(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a(`aria-label`),c=n.matches(`open`),l=i.get(`triggerValue`);return{open:c,setOpen(e){n.matches(`open`)!==e&&r({type:e?`OPEN`:`CLOSE`})},triggerValue:l,setTriggerValue(e){r({type:`TRIGGER_VALUE.SET`,value:e})},getTriggerProps(e={}){let{value:n}=e,i=n==null?!1:l===n;return t.button({...ac.trigger.attrs,dir:a(`dir`),id:lc(o,n),"data-ownedby":o.id,"data-value":n,"aria-haspopup":`dialog`,type:`button`,"aria-expanded":n==null?c:c&&i,"data-state":c?`open`:`closed`,"aria-controls":cc(o),"data-current":W(i),onClick(e){e.defaultPrevented||r({type:c&&n!=null&&!i?`TRIGGER_VALUE.SET`:`TOGGLE`,value:n})}})},getBackdropProps(){return t.element({...ac.backdrop.attrs,dir:a(`dir`),hidden:!c,id:sc(o),"data-state":c?`open`:`closed`})},getPositionerProps(){return t.element({...ac.positioner.attrs,dir:a(`dir`),id:oc(o),style:ke({pointerEvents:!c||!a(`modal`)?`none`:void 0})})},getContentProps(){let e=i.get(`rendered`);return t.element({...ac.content.attrs,dir:a(`dir`),role:a(`role`),hidden:!c,id:cc(o),tabIndex:-1,"data-state":c?`open`:`closed`,"aria-modal":a(`modal`),"aria-label":s||void 0,"aria-labelledby":s||!e.title?void 0:uc(o),"aria-describedby":e.description?dc(o):void 0,style:ke({pointerEvents:a(`modal`)?void 0:`auto`})})},getTitleProps(){return t.element({...ac.title.attrs,dir:a(`dir`),id:uc(o)})},getDescriptionProps(){return t.element({...ac.description.attrs,dir:a(`dir`),id:dc(o)})},getCloseTriggerProps(){return t.button({...ac.closeTrigger.attrs,dir:a(`dir`),id:fc(o),type:`button`,onClick(e){e.defaultPrevented||(e.stopPropagation(),r({type:`CLOSE`}))}})}}}var Sc=new WeakMap,Cc=new WeakMap,wc={},Tc=0,Ec=e=>e&&(e.host||Ec(e.parentNode)),Dc=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ec(t);return n&&e.contains(n)?n:(console.error(`[zag-js > ariaHidden] target`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(e=>!!e),Oc=new Set([`script`,`output`,`status`,`next-route-announcer`]),kc=e=>Oc.has(e.localName)||e.role===`status`||e.hasAttribute(`aria-live`)?!0:e.matches(`[data-live-announcer]`),Ac=(e,t)=>{let{parentNode:n,markerName:r,controlAttribute:i,explicitBooleanValue:a,followControlledElements:o=!0}=t,s=Dc(n,Array.isArray(e)?e:[e]);wc[r]||(wc[r]=new WeakMap);let c=wc[r],l=[],u=new Set,d=new Set(s),f=e=>{!e||u.has(e)||(u.add(e),f(e.parentNode))};s.forEach(e=>{f(e),o&&Re(e)&&ns(e,e=>{f(e)})});let p=e=>{!e||d.has(e)||Array.prototype.forEach.call(e.children,e=>{if(u.has(e))p(e);else try{if(kc(e))return;let t=e.getAttribute(i),n=a?t===`true`:t!==null&&t!==`false`,o=(Sc.get(e)||0)+1,s=(c.get(e)||0)+1;Sc.set(e,o),c.set(e,s),l.push(e),o===1&&n&&Cc.set(e,!0),s===1&&e.setAttribute(r,``),n||e.setAttribute(i,a?`true`:``)}catch(t){console.error(`[zag-js > ariaHidden] cannot operate on `,e,t)}})};return p(n),u.clear(),Tc++,()=>{l.forEach(e=>{let t=Sc.get(e)-1,n=c.get(e)-1;Sc.set(e,t),c.set(e,n),t||(Cc.has(e)||e.removeAttribute(i),Cc.delete(e)),n||e.removeAttribute(r)}),Tc--,Tc||(Sc=new WeakMap,Sc=new WeakMap,Cc=new WeakMap,wc={})}},jc=e=>(Array.isArray(e)?e[0]:e).ownerDocument.body,Mc=(e,t=jc(e),n=`data-aria-hidden`,r=!0)=>{if(t)return Ac(e,{parentNode:t,markerName:n,controlAttribute:`aria-hidden`,explicitBooleanValue:!0,followControlledElements:r})},Nc=e=>{let t=requestAnimationFrame(()=>e());return()=>cancelAnimationFrame(t)};function Pc(e,t={}){let{defer:n=!0}=t,r=n?Nc:e=>e(),i=[];return i.push(r(()=>{let t=(typeof e==`function`?e():e).filter(Boolean);t.length!==0&&i.push(Mc(t))})),()=>{i.forEach(e=>e?.())}}function Fc(e){let t={each(t){for(let n=0;n<e.frames?.length;n+=1){let r=e.frames[n];r&&t(r)}},addEventListener(e,n,r){return t.each(t=>{try{t.document.addEventListener(e,n,r)}catch{}}),()=>{try{t.removeEventListener(e,n,r)}catch{}}},removeEventListener(e,n,r){t.each(t=>{try{t.document.removeEventListener(e,n,r)}catch{}})}};return t}function Ic(e){let t=e.frameElement==null?null:e.parent;return{addEventListener:(e,n,r)=>{try{t?.addEventListener(e,n,r)}catch{}return()=>{try{t?.removeEventListener(e,n,r)}catch{}}},removeEventListener:(e,n,r)=>{try{t?.removeEventListener(e,n,r)}catch{}}}}var Lc=`pointerdown.outside`,Rc=`focus.outside`;function zc(e){for(let t of e)if(Re(t)&&ks(t))return!0;return!1}var Bc=e=>`clientY`in e;function Vc(e,t){if(!Bc(t)||!e)return!1;let n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function Hc(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Uc(e,t){if(!t||!Bc(e))return!1;let n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,i=t.scrollWidth>t.clientWidth,a=i&&e.clientY>t.offsetTop+t.clientHeight;return Hc({x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(i?16:0)},{x:e.clientX,y:e.clientY})?r||a:!1}function Wc(e,t){let{exclude:n,onFocusOutside:r,onPointerDownOutside:i,onInteractOutside:a,defer:o,followControlledElements:s=!0}=t;if(!e)return;let c=I(e),l=he(e),u=Fc(l),d=Ic(l);function f(t,r){if(!Re(r)||!r.isConnected||pe(e,r)||Vc(e,t)||s&&ts(e,r))return!1;let i=c.querySelector(`[aria-controls="${e.id}"]`);return i&&Uc(t,ut(i))||Uc(t,ut(e))?!1:!n?.(r)}let p=new Set,m=Ae(e?.getRootNode()),h=!1;function g(t){h=!0;let n=()=>{h=!1};c.addEventListener(`pointerup`,n,{once:!0}),l.addEventListener(`pointerup`,n,{once:!0});function r(n){let r=o&&!oe()?U:e=>e(),s=n??t,c=s?.composedPath?.()??[s?.target];r(()=>{let n=m?c[0]:N(t);if(!(!e||!f(t,n))){if(i||a){let t=$e(i,a);e.addEventListener(Lc,t,{once:!0})}Kc(e,Lc,{bubbles:!1,cancelable:!0,detail:{originalEvent:s,contextmenu:R(s),focusable:zc(c),target:n}})}})}t.pointerType===`touch`?(p.forEach(e=>e()),p.add(re(c,`click`,r,{once:!0})),p.add(d.addEventListener(`click`,r,{once:!0})),p.add(u.addEventListener(`click`,r,{once:!0}))):r()}let _=new Set,v=setTimeout(()=>{_.add(re(c,`pointerdown`,g,!0)),_.add(d.addEventListener(`pointerdown`,g,!0)),_.add(u.addEventListener(`pointerdown`,g,!0))},0);function y(t){h||(o?U:e=>e())(()=>{let n=t?.composedPath?.()??[t?.target],i=m?n[0]:N(t);if(!(!e||!f(t,i))){if(r||a){let t=$e(r,a);e.addEventListener(Rc,t,{once:!0})}Kc(e,Rc,{bubbles:!1,cancelable:!0,detail:{originalEvent:t,contextmenu:!1,focusable:ks(i),target:i}})}})}return oe()||(_.add(re(c,`focusin`,y,!0)),_.add(d.addEventListener(`focusin`,y,!0)),_.add(u.addEventListener(`focusin`,y,!0))),()=>{clearTimeout(v),p.forEach(e=>e()),_.forEach(e=>e())}}function Gc(e,t){let{defer:n}=t,r=n?U:e=>e(),i=[];return i.push(r(()=>{let n=typeof e==`function`?e():e;i.push(Wc(n,t))})),()=>{i.forEach(e=>e?.())}}function Kc(e,t,n){let r=new(e.ownerDocument.defaultView||window).CustomEvent(t,n);return e.dispatchEvent(r)}function qc(e,t){return re(I(e),`keydown`,e=>{e.key===`Escape`&&(e.isComposing||t?.(e))},{capture:!0})}var Jc=`layer:request-dismiss`,Yc={layers:[],branches:[],recentlyRemoved:new Set,count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){return this.indexOf(e)<(this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1)},isTopMost(e){return this.layers[this.count()-1]?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){let n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(e=>e.type===t)},getParentLayerOfType(e,t){let n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(e=>e.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(e=>pe(e.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>pe(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){let t=this.indexOf(e);t<0||(this.recentlyRemoved.add(e),ne(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(t=>Yc.dismiss(t.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){let t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty(`--layer-index`,`${t}`),e.node.removeAttribute(`data-nested`),e.node.removeAttribute(`data-has-nested`),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute(`data-nested`,e.type);let n=this.countNestedLayersOfType(e.node,e.type);n>0&&e.node.setAttribute(`data-has-nested`,e.type),e.node.style.setProperty(`--nested-layer-count`,`${n}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){let n=this.indexOf(e);if(n===-1)return;let r=this.layers[n];Zc(e,Jc,e=>{r.requestDismiss?.(e),e.defaultPrevented||r?.dismiss()}),Xc(e,Jc,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function Xc(e,t,n){let r=new(e.ownerDocument.defaultView||window).CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function Zc(e,t,n){e.addEventListener(t,n,{once:!0})}var Qc;function $c(){Yc.layers.forEach(({node:e})=>{e.style.pointerEvents=Yc.isBelowPointerBlockingLayer(e)?`none`:`auto`})}function el(e){e.style.pointerEvents=``}function tl(e,t){let n=I(e),r=[];return Yc.hasPointerBlockingLayer()&&!n.body.hasAttribute(`data-inert`)&&(Qc=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents=`none`,n.body.setAttribute(`data-inert`,``)})),t?.forEach(e=>{let[t,n]=Xs(()=>{let t=e();return Re(t)?t:null},{timeout:1e3});t.then(e=>r.push(Ge(e,{pointerEvents:`auto`}))),r.push(n)}),()=>{Yc.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Qc,n.body.removeAttribute(`data-inert`),n.body.style.length===0&&n.body.removeAttribute(`style`)}),r.forEach(e=>e()))}}function nl(e,t){let{warnOnMissingNode:n=!0}=t;if(n&&!e){Pe("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;let{onDismiss:r,onRequestDismiss:i,pointerBlocking:a,exclude:o,debug:s,type:c=`dialog`}=t,l={dismiss:r,node:e,type:c,pointerBlocking:a,requestDismiss:i};Yc.add(l),$c();function u(n){let i=N(n.detail.originalEvent);Yc.isBelowPointerBlockingLayer(e)||Yc.isInBranch(i)||(t.onPointerDownOutside?.(n),t.onInteractOutside?.(n),!n.defaultPrevented&&(s&&console.log(`onPointerDownOutside:`,n.detail.originalEvent),r?.()))}function d(e){let n=N(e.detail.originalEvent);Yc.isInBranch(n)||(t.onFocusOutside?.(e),t.onInteractOutside?.(e),!e.defaultPrevented&&(s&&console.log(`onFocusOutside:`,e.detail.originalEvent),r?.()))}function f(n){Yc.isTopMost(e)&&(t.onEscapeKeyDown?.(n),!n.defaultPrevented&&r&&(n.preventDefault(),r()))}function p(n){if(!e)return!1;let r=typeof o==`function`?o():o,i=Array.isArray(r)?r:[r],a=t.persistentElements?.map(e=>e()).filter(Re);return a&&i.push(...a),i.some(e=>pe(e,n))||Yc.isInNestedLayer(e,n)}let m=[a?tl(e,t.persistentElements):void 0,qc(e,f),Gc(e,{exclude:p,onFocusOutside:d,onPointerDownOutside:u,defer:t.defer})];return()=>{Yc.remove(e),$c(),el(e),m.forEach(e=>e?.())}}function rl(e,t){let{defer:n}=t,r=n?U:e=>e(),i=[];return i.push(r(()=>{let n=Qe(e)?e():e;i.push(nl(n,t))})),()=>{i.forEach(e=>e?.())}}var il=Object.defineProperty,al=(e,t,n)=>t in e?il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ol=(e,t,n)=>al(e,typeof t==`symbol`?t:t+``,n),sl={activateTrap(e,t){if(e.length>0){let n=e[e.length-1];n!==t&&n.pause()}let n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}},cl=[],ll=class{constructor(e,t){ol(this,`trapStack`),ol(this,`config`),ol(this,`doc`),ol(this,`state`,{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),ol(this,`portalContainers`,new Set),ol(this,`listenerCleanups`,[]),ol(this,`handleFocus`,e=>{let t=N(e),n=this.findContainerIndex(t,e)>=0;if(n||B(t))n&&(this.state.mostRecentlyFocusedNode=t);else{e.stopImmediatePropagation();let t,n=!0;if(this.state.mostRecentlyFocusedNode)if(Ns(this.state.mostRecentlyFocusedNode)>0){let e=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:r}=this.state.containerGroups[e];if(r.length>0){let e=r.findIndex(e=>e===this.state.mostRecentlyFocusedNode);e>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?e+1<r.length&&(t=r[e+1],n=!1):e-1>=0&&(t=r[e-1],n=!1))}}else this.state.containerGroups.some(e=>e.tabbableNodes.some(e=>Ns(e)>0))||(n=!1);else n=!1;n&&(t=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),t?this.tryFocus(t):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),ol(this,`handlePointerDown`,e=>{let t=N(e);if(!(this.findContainerIndex(t,e)>=0)){if(ml(this.config.clickOutsideDeactivates,e)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}ml(this.config.allowOutsideClick,e)||e.preventDefault()}}),ol(this,`handleClick`,e=>{let t=N(e);this.findContainerIndex(t,e)>=0||ml(this.config.clickOutsideDeactivates,e)||ml(this.config.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())}),ol(this,`handleTabKey`,e=>{if(this.config.isKeyForward(e)||this.config.isKeyBackward(e)){this.state.recentNavEvent=e;let t=this.config.isKeyBackward(e),n=this.findNextNavNode({event:e,isBackward:t});if(!n)return;dl(e)&&e.preventDefault(),this.tryFocus(n)}}),ol(this,`handleEscapeKey`,e=>{hl(e)&&ml(this.config.escapeDeactivates,e)!==!1&&(e.preventDefault(),this.deactivate())}),ol(this,`_mutationObserver`),ol(this,`setupMutationObserver`,()=>{this._mutationObserver=new(this.doc.defaultView||window).MutationObserver(e=>{e.some(e=>Array.from(e.removedNodes).some(e=>e===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode()),e.some(e=>e.type===`attributes`&&(e.attributeName===`aria-controls`||e.attributeName===`aria-expanded`)?!0:e.type===`childList`&&e.addedNodes.length>0?Array.from(e.addedNodes).some(e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;let t=e;return os(t)?!0:t.id&&!this.state.containers.some(e=>e.contains(t))?ss(t):!1}):!1)&&this.state.active&&!this.state.paused&&(this.updateTabbableNodes(),this.updatePortalContainers())})}),ol(this,`updateObservedNodes`,()=>{this._mutationObserver?.disconnect(),this.state.active&&!this.state.paused&&(this.state.containers.map(e=>{this._mutationObserver?.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`aria-controls`,`aria-expanded`]})}),this.portalContainers.forEach(e=>{this.observePortalContainer(e)}))}),ol(this,`getInitialFocusNode`,()=>{let e=this.getNodeForOption(`initialFocus`,{hasFallback:!0});if(e===!1)return!1;if(e===void 0||e&&!ks(e)){let t=ae(this.doc);if(t&&this.findContainerIndex(t)>=0)e=t;else{let t=this.state.tabbableGroups[0];e=t&&t.firstTabbableNode||this.getNodeForOption(`fallbackFocus`)}}else e===null&&(e=this.getNodeForOption(`fallbackFocus`));if(!e||(e.isConnected||(e=this.getNodeForOption(`fallbackFocus`)),!e||!e.isConnected))throw Error(`Your focus-trap needs to have at least one focusable element`);return e}),ol(this,`tryFocus`,e=>{if(e!==!1&&e!==ae(this.doc)){if(!e||!e.focus){this.tryFocus(this.getInitialFocusNode());return}e.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=e,_l(e)&&e.select()}}),ol(this,`deactivate`,e=>{if(!this.state.active)return this;let t={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...e};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),sl.deactivateTrap(this.trapStack,this),this.portalContainers.clear();let n=this.getOption(t,`onDeactivate`),r=this.getOption(t,`onPostDeactivate`),i=this.getOption(t,`checkCanReturnFocus`),a=this.getOption(t,`returnFocus`,`returnFocusOnDeactivate`);n?.();let o=()=>{gl(()=>{if(a){let e=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(e)}r?.()})};return a&&i?(i(this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation)).then(o,o),this):(o(),this)}),ol(this,`pause`,e=>{if(this.state.paused||!this.state.active)return this;let t=this.getOption(e,`onPause`),n=this.getOption(e,`onPostPause`);return this.state.paused=!0,t?.(),this.removeListeners(),this.updateObservedNodes(),n?.(),this}),ol(this,`unpause`,e=>{if(!this.state.paused||!this.state.active)return this;let t=this.getOption(e,`onUnpause`),n=this.getOption(e,`onPostUnpause`);return this.state.paused=!1,t?.(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n?.(),this}),ol(this,`updateContainerElements`,e=>(this.state.containers=Array.isArray(e)?e.filter(Boolean):[e].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),ol(this,`getReturnFocusNode`,e=>{let t=this.getNodeForOption(`setReturnFocus`,{params:[e]});return t||(t===!1?!1:e)}),ol(this,`getOption`,(e,t,n)=>e&&e[t]!==void 0?e[t]:this.config[n||t]),ol(this,`getNodeForOption`,(e,{hasFallback:t=!1,params:n=[]}={})=>{let r=this.config[e];if(typeof r==`function`&&(r=r(...n)),r===!0&&(r=void 0),!r){if(r===void 0||r===!1)return r;throw Error(`\`${e}\` was specified but was not a node, or did not return a node`)}let i=r;if(typeof r==`string`){try{i=this.doc.querySelector(r)}catch(t){throw Error(`\`${e}\` appears to be an invalid selector; error="${t.message}"`)}if(!i&&!t)throw Error(`\`${e}\` as selector refers to no known node`)}return i}),ol(this,`findNextNavNode`,e=>{let{event:t,isBackward:n=!1}=e,r=e.target||N(t);this.updateTabbableNodes();let i=null;if(this.state.tabbableGroups.length>0){let e=this.findContainerIndex(r,t),a=e>=0?this.state.containerGroups[e]:void 0;if(e<0)i=n?this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:this.state.tabbableGroups[0].firstTabbableNode;else if(n){let n=this.state.tabbableGroups.findIndex(({firstTabbableNode:e})=>r===e);if(n<0&&(a?.container===r||ks(r)&&!js(r)&&!a?.nextTabbableNode(r,!1))&&(n=e),n>=0){let e=n===0?this.state.tabbableGroups.length-1:n-1,t=this.state.tabbableGroups[e];i=Ns(r)>=0?t.lastTabbableNode:t.lastDomTabbableNode}else dl(t)||(i=a?.nextTabbableNode(r,!1))}else{let n=this.state.tabbableGroups.findIndex(({lastTabbableNode:e})=>r===e);if(n<0&&(a?.container===r||ks(r)&&!js(r)&&!a?.nextTabbableNode(r))&&(n=e),n>=0){let e=n===this.state.tabbableGroups.length-1?0:n+1,t=this.state.tabbableGroups[e];i=Ns(r)>=0?t.firstTabbableNode:t.firstDomTabbableNode}else dl(t)||(i=a?.nextTabbableNode(r))}}else i=this.getNodeForOption(`fallbackFocus`);return i}),this.trapStack=t.trapStack||cl;let n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,followControlledElements:!0,isKeyForward:fl,isKeyBackward:pl,...t};this.doc=n.document||I(Array.isArray(e)?e[0]:e),this.config=n,this.updateContainerElements(e),this.setupMutationObserver()}addPortalContainer(e){let t=e.parentElement;t&&!this.portalContainers.has(t)&&(this.portalContainers.add(t),this.state.active&&!this.state.paused&&this.observePortalContainer(t))}observePortalContainer(e){this._mutationObserver?.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`aria-controls`,`aria-expanded`]})}updatePortalContainers(){this.config.followControlledElements&&this.state.containers.forEach(e=>{rs(e).forEach(e=>{this.addPortalContainer(e)})})}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(e,t){let n=typeof t?.composedPath==`function`?t.composedPath():void 0;return this.state.containerGroups.findIndex(({container:t,tabbableNodes:r})=>t.contains(e)||n?.includes(t)||r.find(t=>t===e)||this.isControlledElement(t,e))}isControlledElement(e,t){return this.config.followControlledElements?ts(e,t):!1}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(e=>{let t=As(e,{getShadowRoot:this.config.getShadowRoot}),n=Os(e,{getShadowRoot:this.config.getShadowRoot}),r=t[0],i=t[t.length-1],a=r,o=i,s=!1;for(let e=0;e<t.length;e++)if(Ns(t[e])>0){s=!0;break}function c(e,r=!0){let i=t.indexOf(e);if(i>=0)return t[i+(r?1:-1)];let a=n.indexOf(e);if(!(a<0)){if(r){for(let e=a+1;e<n.length;e++)if(js(n[e]))return n[e]}else for(let e=a-1;e>=0;e--)if(js(n[e]))return n[e]}}return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:s,firstTabbableNode:r,lastTabbableNode:i,firstDomTabbableNode:a,lastDomTabbableNode:o,nextTabbableNode:c}}),this.state.tabbableGroups=this.state.containerGroups.filter(e=>e.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption(`fallbackFocus`))throw Error(`Your focus-trap must have at least one container with at least one tabbable node in it at all times`);if(this.state.containerGroups.find(e=>e.posTabIndexesFound)&&this.state.containerGroups.length>1)throw Error(`At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.`)}addListeners(){if(this.state.active)return sl.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?gl(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(re(this.doc,`focusin`,this.handleFocus,!0),re(this.doc,`mousedown`,this.handlePointerDown,{capture:!0,passive:!1}),re(this.doc,`touchstart`,this.handlePointerDown,{capture:!0,passive:!1}),re(this.doc,`click`,this.handleClick,{capture:!0,passive:!1}),re(this.doc,`keydown`,this.handleTabKey,{capture:!0,passive:!1}),re(this.doc,`keydown`,this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(e=>e()),this.listenerCleanups=[],this}activate(e){if(this.state.active)return this;let t=this.getOption(e,`onActivate`),n=this.getOption(e,`onPostActivate`),r=this.getOption(e,`checkCanFocusTrap`);r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=ae(this.doc),t?.();let i=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n?.()};return r?(r(this.state.containers.concat()).then(i,i),this):(i(),this)}},ul=e=>e?.type===`keydown`,dl=e=>ul(e)&&e?.key===`Tab`,fl=e=>ul(e)&&e.key===`Tab`&&!e?.shiftKey,pl=e=>ul(e)&&e.key===`Tab`&&e?.shiftKey,ml=(e,...t)=>typeof e==`function`?e(...t):e,hl=e=>!e.isComposing&&e.key===`Escape`,gl=e=>setTimeout(e,0),_l=e=>e.localName===`input`&&`select`in e&&typeof e.select==`function`;function vl(e,t={}){let n,r=U(()=>{let r=(Array.isArray(e)?e:[e]).map(e=>typeof e==`function`?e():e).filter(e=>e!=null);if(r.length===0)return;let i=r[0];n=new ll(r,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:i,...t,document:I(i)});try{n.activate()}catch{}});return function(){n?.deactivate(),r()}}var yl=`data-scroll-lock`;function bl(e){let t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?`paddingLeft`:`paddingRight`}function xl(e){let t=de(e)?.scrollbarGutter;return t===`stable`||t?.startsWith(`stable `)===!0}function Sl(e){let t=e??document,n=t.defaultView??window,{documentElement:r,body:i}=t;if(i.hasAttribute(yl))return;let a=xl(r)||xl(i),o=n.innerWidth-r.clientWidth;i.setAttribute(yl,``);let s=()=>H(r,`--scrollbar-width`,`${o}px`),c=bl(r),l=[s(),Ye()?(()=>{let{scrollX:e,scrollY:t,visualViewport:r}=n,s=r?.offsetLeft??0,l=r?.offsetTop??0,u={position:`fixed`,overflow:`hidden`,top:`${-(t-Math.floor(l))}px`,left:`${-(e-Math.floor(s))}px`,right:`0`};!a&&o>0&&(u[c]=`${o}px`);let d=Ge(i,u);return()=>{d?.(),n.scrollTo({left:e,top:t,behavior:`instant`})}})():(()=>{let e={overflow:`hidden`};return!a&&o>0&&(e[c]=`${o}px`),Ge(i,e)})()];return()=>{l.forEach(e=>e?.()),i.removeAttribute(yl)}}var Cl=Me({props({props:e,scope:t}){let n=e.role===`alertdialog`,r=n?()=>vc(t):void 0,i=typeof e.modal==`boolean`?e.modal:!0;return{role:`dialog`,modal:i,trapFocus:i,preventScroll:i,closeOnInteractOutside:i&&!n,closeOnEscape:!0,restoreFocus:!0,initialFocusEl:r,...e}},initialState({prop:e}){return e(`open`)||e(`defaultOpen`)?`open`:`closed`},context({bindable:e,prop:t,scope:n}){return{rendered:e(()=>({defaultValue:{title:!0,description:!0}})),triggerValue:e(()=>({defaultValue:t(`defaultTriggerValue`)??null,value:t(`triggerValue`),onChange(e){let r=t(`onTriggerValueChange`);r&&r({value:e,triggerElement:bc(n,e)})}}))}},watch({track:e,action:t,prop:n}){e([()=>n(`open`)],()=>{t([`toggleVisibility`])})},states:{open:{entry:[`checkRenderedElements`,`syncZIndex`,`setInitialFocus`],effects:[`trackDismissableElement`,`trapFocus`,`preventScroll`,`hideContentBelow`],on:{"CONTROLLED.CLOSE":{target:`closed`},CLOSE:[{guard:`isOpenControlled`,actions:[`invokeOnClose`]},{target:`closed`,actions:[`invokeOnClose`]}],TOGGLE:[{guard:`isOpenControlled`,actions:[`invokeOnClose`]},{target:`closed`,actions:[`invokeOnClose`]}],"TRIGGER_VALUE.SET":{actions:[`setTriggerValue`]}}},closed:{on:{"CONTROLLED.OPEN":{target:`open`},OPEN:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`,`setTriggerValue`]},{target:`open`,actions:[`invokeOnOpen`,`setTriggerValue`]}],TOGGLE:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`,`setTriggerValue`]},{target:`open`,actions:[`invokeOnOpen`,`setTriggerValue`]}],"TRIGGER_VALUE.SET":{actions:[`setTriggerValue`]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e(`open`)!=null},effects:{trackDismissableElement({scope:e,send:t,prop:n}){return rl(()=>pc(e),{type:`dialog`,defer:!0,pointerBlocking:n(`modal`),exclude:yc(e),onInteractOutside(e){n(`onInteractOutside`)?.(e),n(`closeOnInteractOutside`)||e.preventDefault()},persistentElements:n(`persistentElements`),onFocusOutside:n(`onFocusOutside`),onPointerDownOutside:n(`onPointerDownOutside`),onRequestDismiss:n(`onRequestDismiss`),onEscapeKeyDown(e){n(`onEscapeKeyDown`)?.(e),n(`closeOnEscape`)||e.preventDefault()},onDismiss(){t({type:`CLOSE`,src:`interact-outside`})}})},preventScroll({scope:e,prop:t}){if(t(`preventScroll`))return Sl(e.getDoc())},trapFocus({scope:e,prop:t,context:n}){return t(`trapFocus`)?vl(()=>pc(e),{preventScroll:!0,returnFocusOnDeactivate:!!t(`restoreFocus`),initialFocus:t(`initialFocusEl`),setReturnFocus:r=>{let i=t(`finalFocusEl`)?.();if(i)return i;let a=n.get(`triggerValue`);if(a){let t=bc(e,a);if(t)return t}return yc(e)[0]||r},getShadowRoot:!0}):void 0},hideContentBelow({scope:e,prop:t}){return t(`modal`)?Pc(()=>[pc(e)],{defer:!0}):void 0}},actions:{setInitialFocus({prop:e,scope:t}){e(`trapFocus`)||U(()=>{Ps({root:pc(t),getInitialEl:e(`initialFocusEl`)})?.focus({preventScroll:!0})})},checkRenderedElements({context:e,scope:t}){U(()=>{e.set(`rendered`,{title:!!gc(t),description:!!_c(t)})})},syncZIndex({scope:e}){U(()=>{let t=pc(e);if(!t)return;let n=de(t);[mc(e),hc(e)].forEach(e=>{e?.style.setProperty(`--z-index`,n.zIndex),e?.style.setProperty(`--layer-index`,n.getPropertyValue(`--layer-index`))})})},invokeOnClose({prop:e}){e(`onOpenChange`)?.({open:!1})},invokeOnOpen({prop:e}){e(`onOpenChange`)?.({open:!0})},setTriggerValue({context:e,event:t}){t.value!==void 0&&e.set(`triggerValue`,t.value)},toggleVisibility({prop:e,send:t,event:n}){t({type:e(`open`)?`CONTROLLED.OPEN`:`CONTROLLED.CLOSE`,previousEvent:n})}}}}),wl=e=>{let t=(0,K.useId)(),{getRootNode:n}=Ce(),{dir:r}=ze();return xc(qe(Cl,{id:t,getRootNode:n,dir:r,...e}),Ve)},Tl=e=>{let[t,{children:n,...r}]=Ee(e),[i]=$s(t),a=wl(r);return(0,Q.jsx)(ec,{value:a,children:(0,Q.jsx)(Zs,{value:i,children:(0,Q.jsx)(Ie,{value:Oe(G({present:a.open},t)),children:n})})})},El=(0,K.forwardRef)((e,t)=>{let n=G(tc().getTitleProps(),e);return(0,Q.jsx)(tt.h2,{...n,ref:t})});El.displayName=`DialogTitle`;var[Dl,Ol]=_e({name:`TabsContext`,hookName:`useTabsContext`,providerName:`<TabsProvider />`}),kl=De(),Al=(0,K.forwardRef)((e,t)=>{let[n,r]=kl(e,[`value`]),i=Ol(),a=Oe({...Qs(),present:i.value===e.value,immediate:!0}),o=G(i.getContentProps(n),a.getPresenceProps(),r);return(0,Q.jsx)(Ie,{value:a,children:a.unmounted?null:(0,Q.jsx)(tt.div,{...o,ref:rt(a.ref,t)})})});Al.displayName=`TabContent`;var jl=(0,K.forwardRef)((e,t)=>{let n=G(Ol().getListProps(),e);return(0,Q.jsx)(tt.div,{...n,ref:t})});jl.displayName=`TabList`;var Ml=De(),Nl=(0,K.forwardRef)((e,t)=>{let[n,r]=Ml(e,[`disabled`,`value`]),i=G(Ol().getTriggerProps(n),r);return(0,Q.jsx)(tt.button,{...i,ref:t})});Nl.displayName=`TabTrigger`;var Pl=Ze(`tabs`).parts(`root`,`list`,`trigger`,`content`,`indicator`).build(),Fl=e=>e.ids?.root??`tabs:${e.id}`,Il=e=>e.ids?.list??`tabs:${e.id}:list`,Ll=(e,t)=>e.ids?.content?.(t)??`tabs:${e.id}:content-${t}`,Rl=(e,t)=>e.ids?.trigger?.(t)??`tabs:${e.id}:trigger-${t}`,zl=e=>e.ids?.indicator??`tabs:${e.id}:indicator`,Bl=e=>e.getById(Il(e)),Vl=(e,t)=>e.getById(Ll(e,t)),Hl=(e,t)=>t==null?null:e.getById(Rl(e,t)),Ul=e=>e.getById(zl(e)),Wl=e=>{let t=`[role=tab][data-ownedby='${CSS.escape(Il(e))}']:not([disabled])`;return dt(Bl(e),t)},Gl=e=>xe(Wl(e)),Kl=e=>Ke(Wl(e)),ql=(e,t)=>gt(Wl(e),Rl(e,t.value),t.loopFocus),Jl=(e,t)=>mt(Wl(e),Rl(e,t.value),t.loopFocus),Yl=e=>({x:e?.offsetLeft??0,y:e?.offsetTop??0,width:e?.offsetWidth??0,height:e?.offsetHeight??0}),Xl=(e,t)=>Yl(lt(Wl(e),Rl(e,t)));function Zl(e,t){let{state:n,send:r,context:i,prop:a,scope:o}=e,s=a(`translations`),c=n.matches(`focused`),l=a(`orientation`)===`vertical`,u=a(`orientation`)===`horizontal`,d=a(`composite`);function f(e){return{selected:i.get(`value`)===e.value,focused:i.get(`focusedValue`)===e.value,disabled:!!e.disabled}}return{value:i.get(`value`),focusedValue:i.get(`focusedValue`),setValue(e){r({type:`SET_VALUE`,value:e})},clearValue(){r({type:`CLEAR_VALUE`})},setIndicatorRect(e){r({type:`SET_INDICATOR_RECT`,id:Rl(o,e)})},syncTabIndex(){r({type:`SYNC_TAB_INDEX`})},selectNext(e){r({type:`TAB_FOCUS`,value:e,src:`selectNext`}),r({type:`ARROW_NEXT`,src:`selectNext`})},selectPrev(e){r({type:`TAB_FOCUS`,value:e,src:`selectPrev`}),r({type:`ARROW_PREV`,src:`selectPrev`})},focus(){let e=i.get(`value`);e&&Hl(o,e)?.focus()},getRootProps(){return t.element({...Pl.root.attrs,id:Fl(o),"data-orientation":a(`orientation`),"data-focus":W(c),dir:a(`dir`)})},getListProps(){return t.element({...Pl.list.attrs,id:Il(o),role:`tablist`,dir:a(`dir`),"data-focus":W(c),"aria-orientation":a(`orientation`),"data-orientation":a(`orientation`),"aria-label":s?.listLabel,onKeyDown(e){if(e.defaultPrevented||L(e)||!pe(e.currentTarget,N(e)))return;let t={ArrowDown(){u||r({type:`ARROW_NEXT`,key:`ArrowDown`})},ArrowUp(){u||r({type:`ARROW_PREV`,key:`ArrowUp`})},ArrowLeft(){l||r({type:`ARROW_PREV`,key:`ArrowLeft`})},ArrowRight(){l||r({type:`ARROW_NEXT`,key:`ArrowRight`})},Home(){r({type:`HOME`})},End(){r({type:`END`})}}[F(e,{dir:a(`dir`),orientation:a(`orientation`)})];if(t){e.preventDefault(),t(e);return}}})},getTriggerState:f,getTriggerProps(e){let{value:n,disabled:s}=e,c=f(e);return t.button({...Pl.trigger.attrs,role:`tab`,type:`button`,disabled:s,dir:a(`dir`),"data-orientation":a(`orientation`),"data-disabled":W(s),"aria-disabled":s,"data-value":n,"aria-selected":c.selected,"data-selected":W(c.selected),"data-focus":W(c.focused),"aria-controls":c.selected?Ll(o,n):void 0,"data-ownedby":Il(o),"data-ssr":W(i.get(`ssr`)),id:Rl(o,n),tabIndex:c.selected&&d?0:-1,onFocus(){r({type:`TAB_FOCUS`,value:n})},onBlur(e){e.relatedTarget?.getAttribute(`role`)!==`tab`&&r({type:`TAB_BLUR`})},onClick(e){e.defaultPrevented||se(e)||s||(fe()&&e.currentTarget.focus(),r({type:`TAB_CLICK`,value:n}))}})},getContentProps(e){let{value:n}=e,r=i.get(`value`)===n;return t.element({...Pl.content.attrs,dir:a(`dir`),id:Ll(o,n),tabIndex:d?0:-1,"aria-labelledby":Rl(o,n),role:`tabpanel`,"data-ownedby":Il(o),"data-selected":W(r),"data-orientation":a(`orientation`),hidden:!r})},getIndicatorProps(){let e=i.get(`indicatorRect`),n=i.get(`animateIndicator`);return t.element({id:zl(o),...Pl.indicator.attrs,dir:a(`dir`),"data-orientation":a(`orientation`),hidden:Ql(e),onTransitionEnd(e){N(e)===e.currentTarget&&r({type:`INDICATOR_TRANSITION_END`})},style:{"--transition-property":`left, right, top, bottom, width, height`,"--left":m(e?.x),"--top":m(e?.y),"--width":m(e?.width),"--height":m(e?.height),position:`absolute`,willChange:n?`var(--transition-property)`:`auto`,transitionProperty:n?`var(--transition-property)`:`none`,transitionDuration:n?`var(--transition-duration, 150ms)`:`0ms`,transitionTimingFunction:`var(--transition-timing-function)`,[u?`left`:`top`]:u?`var(--left)`:`var(--top)`}})}}}var Ql=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{createMachine:$l}=Be(),eu=$l({props({props:e}){return{dir:`ltr`,orientation:`horizontal`,activationMode:`automatic`,loopFocus:!0,composite:!0,navigate(e){Bs(e.node)},defaultValue:null,...e}},initialState(){return`idle`},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e(`defaultValue`),value:e(`value`),onChange(t){e(`onValueChange`)?.({value:t})}})),focusedValue:t(()=>({defaultValue:e(`value`)||e(`defaultValue`),sync:!0,onChange(t){e(`onFocusChange`)?.({focusedValue:t})}})),ssr:t(()=>({defaultValue:!0})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1}))}},refs(){return{indicatorCleanup:null,prevValue:null}},watch({context:e,prop:t,track:n,action:r}){n([()=>e.get(`value`)],()=>{r([`syncIndicatorAnimation`,`syncIndicatorRect`,`syncTabIndex`,`navigateIfNeeded`])}),n([()=>t(`dir`),()=>t(`orientation`)],()=>{r([`syncIndicatorRect`])})},on:{SET_VALUE:{actions:[`setValue`]},CLEAR_VALUE:{actions:[`clearValue`]},SET_INDICATOR_RECT:{actions:[`setIndicatorRect`]},SYNC_TAB_INDEX:{actions:[`syncTabIndex`]},INDICATOR_TRANSITION_END:{actions:[`clearIndicatorAnimation`]}},entry:[`syncPrevValue`,`syncIndicatorRect`,`syncTabIndex`,`syncSsr`],exit:[`cleanupObserver`],states:{idle:{on:{TAB_FOCUS:{target:`focused`,actions:[`setFocusedValue`]},TAB_CLICK:{target:`focused`,actions:[`setFocusedValue`,`setValue`]}}},focused:{on:{TAB_CLICK:{actions:[`setFocusedValue`,`setValue`]},ARROW_PREV:[{guard:`selectOnFocus`,actions:[`focusPrevTab`,`selectFocusedTab`]},{actions:[`focusPrevTab`]}],ARROW_NEXT:[{guard:`selectOnFocus`,actions:[`focusNextTab`,`selectFocusedTab`]},{actions:[`focusNextTab`]}],HOME:[{guard:`selectOnFocus`,actions:[`focusFirstTab`,`selectFocusedTab`]},{actions:[`focusFirstTab`]}],END:[{guard:`selectOnFocus`,actions:[`focusLastTab`,`selectFocusedTab`]},{actions:[`focusLastTab`]}],TAB_FOCUS:{actions:[`setFocusedValue`]},TAB_BLUR:{target:`idle`,actions:[`clearFocusedValue`]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e(`activationMode`)===`automatic`},actions:{selectFocusedTab({context:e,prop:t}){U(()=>{let n=e.get(`focusedValue`);if(!n)return;let r=t(`deselectable`)&&e.get(`value`)===n?null:n;e.set(`value`,r)})},setFocusedValue({context:e,event:t,flush:n}){t.value!=null&&n(()=>{e.set(`focusedValue`,t.value)})},clearFocusedValue({context:e}){e.set(`focusedValue`,null)},setValue({context:e,event:t,prop:n}){let r=n(`deselectable`)&&e.get(`value`)===e.get(`focusedValue`);e.set(`value`,r?null:t.value)},clearValue({context:e}){e.set(`value`,null)},focusFirstTab({scope:e}){U(()=>{Gl(e)?.focus()})},focusLastTab({scope:e}){U(()=>{Kl(e)?.focus()})},focusNextTab({context:e,prop:t,scope:n,event:r}){let i=r.value??e.get(`focusedValue`);if(!i)return;let a=ql(n,{value:i,loopFocus:t(`loopFocus`)});U(()=>{t(`composite`)?a?.focus():a?.dataset.value!=null&&e.set(`focusedValue`,a.dataset.value)})},focusPrevTab({context:e,prop:t,scope:n,event:r}){let i=r.value??e.get(`focusedValue`);if(!i)return;let a=Jl(n,{value:i,loopFocus:t(`loopFocus`)});U(()=>{t(`composite`)?a?.focus():a?.dataset.value!=null&&e.set(`focusedValue`,a.dataset.value)})},syncTabIndex({context:e,scope:t}){U(()=>{let n=e.get(`value`);if(!n)return;let r=Vl(t,n);r&&(Os(r).length>0?r.removeAttribute(`tabindex`):r.setAttribute(`tabindex`,`0`))})},cleanupObserver({refs:e}){let t=e.get(`indicatorCleanup`);t&&t()},setIndicatorRect({context:e,event:t,scope:n}){let r=t.id??e.get(`value`);Ul(n)&&r&&Hl(n,r)&&e.set(`indicatorRect`,Xl(n,r))},syncSsr({context:e}){e.set(`ssr`,!1)},syncPrevValue({context:e,refs:t}){t.set(`prevValue`,e.get(`value`))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get(`prevValue`),r=e.get(`value`),i=n!=null&&r!=null&&n!==r;e.set(`animateIndicator`,i),t.set(`prevValue`,r)},clearIndicatorAnimation({context:e}){e.set(`animateIndicator`,!1)},syncIndicatorRect({context:e,refs:t,scope:n}){let r=t.get(`indicatorCleanup`);if(r&&r(),!Ul(n))return;let i=()=>{let t=Hl(n,e.get(`value`));if(!t)return;let r=Yl(t);e.set(`indicatorRect`,e=>Zo(e,r)?e:r)};i();let a=$e(...Wl(n).map(e=>d.observe(e,i)));t.set(`indicatorCleanup`,a)},navigateIfNeeded({context:e,prop:t,scope:n}){let r=e.get(`value`);if(!r)return;let i=Hl(n,r);ge(i)&&t(`navigate`)?.({value:r,node:i,href:i.href})}}}}),tu=e=>{let t=(0,K.useId)(),{getRootNode:n}=Ce(),{dir:r}=ze();return Zl(qe(eu,{id:t,dir:r,getRootNode:n,...e}),Ve)},nu=De(),ru=(0,K.forwardRef)((e,t)=>{let[n,r]=$s(e),[i,a]=nu(r,[`activationMode`,`composite`,`defaultValue`,`deselectable`,`id`,`ids`,`loopFocus`,`navigate`,`onFocusChange`,`onValueChange`,`orientation`,`translations`,`value`]),o=tu(i),s=G(o.getRootProps(),a);return(0,Q.jsx)(Dl,{value:o,children:(0,Q.jsx)(Zs,{value:n,children:(0,Q.jsx)(tt.div,{...s,ref:t})})})});ru.displayName=`TabsRoot`;var iu={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},au=K.createContext&&K.createContext(iu),ou=[`attr`,`size`,`title`];function su(e,t){if(e==null)return{};var n,r,i=cu(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function cu(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function lu(){return lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lu.apply(null,arguments)}function uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uu(Object(n),!0).forEach(function(t){fu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fu(e,t,n){return(t=pu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pu(e){var t=mu(e,`string`);return typeof t==`symbol`?t:t+``}function mu(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hu(e){return e&&e.map((e,t)=>K.createElement(e.tag,du({key:t},e.attr),hu(e.child)))}function gu(e){return t=>K.createElement(_u,lu({attr:du({},e.attr)},t),hu(e.child))}function _u(e){var t=t=>{var{attr:n,size:r,title:i}=e,a=su(e,ou),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),K.createElement(`svg`,lu({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:du(du({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&K.createElement(`title`,null,i),e.children)};return au===void 0?t(iu):K.createElement(au.Consumer,null,e=>t(e))}function vu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`},child:[]},{tag:`path`,attr:{d:`M8 12h8`},child:[]}]})(e)}function yu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3v3a2 2 0 0 1-2 2H3`},child:[]},{tag:`path`,attr:{d:`M21 8h-3a2 2 0 0 1-2-2V3`},child:[]},{tag:`path`,attr:{d:`M3 16h3a2 2 0 0 1 2 2v3`},child:[]},{tag:`path`,attr:{d:`M16 21v-3a2 2 0 0 1 2-2h3`},child:[]}]})(e)}function bu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3H5a2 2 0 0 0-2 2v3`},child:[]},{tag:`path`,attr:{d:`M21 8V5a2 2 0 0 0-2-2h-3`},child:[]},{tag:`path`,attr:{d:`M3 16v3a2 2 0 0 0 2 2h3`},child:[]},{tag:`path`,attr:{d:`M16 21h3a2 2 0 0 0 2-2v-3`},child:[]}]})(e)}function xu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z`},child:[]}]})(e)}function Su(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`m8 2 1.88 1.88`},child:[]},{tag:`path`,attr:{d:`M14.12 3.88 16 2`},child:[]},{tag:`path`,attr:{d:`M9 7.13v-1a3.003 3.003 0 1 1 6 0v1`},child:[]},{tag:`path`,attr:{d:`M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6`},child:[]},{tag:`path`,attr:{d:`M12 20v-9`},child:[]},{tag:`path`,attr:{d:`M6.53 9C4.6 8.8 3 7.1 3 5`},child:[]},{tag:`path`,attr:{d:`M6 13H2`},child:[]},{tag:`path`,attr:{d:`M3 21c0-2.1 1.7-3.9 3.8-4`},child:[]},{tag:`path`,attr:{d:`M20.97 5c0 2.1-1.6 3.8-3.5 4`},child:[]},{tag:`path`,attr:{d:`M22 13h-4`},child:[]},{tag:`path`,attr:{d:`M17.2 17c2.1.1 3.8 1.9 3.8 4`},child:[]}]})(e)}function Cu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 3h14`},child:[]},{tag:`path`,attr:{d:`m18 13-6-6-6 6`},child:[]},{tag:`path`,attr:{d:`M12 7v14`},child:[]}]})(e)}function wu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M5 12h14`},child:[]},{tag:`path`,attr:{d:`m12 5 7 7-7 7`},child:[]}]})(e)}function Tu(e){return gu({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M19 3H5`},child:[]},{tag:`path`,attr:{d:`M12 21V7`},child:[]},{tag:`path`,attr:{d:`m6 15 6 6 6-6`},child:[]}]})(e)}function Eu(e){let t=new Map;return function(n,r){let i=n+(r?Object.entries(r).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(t.has(i))return t.get(i);let a=new e(n,r);return t.set(i,a),a}}var Du=Eu(Intl.Collator);function Ou(e){let{locale:t,...n}=e||{},r=Du(t||`en-US`,{usage:`search`,...n});function i(e){return e=e.normalize(`NFC`),r.resolvedOptions().ignorePunctuation&&(e=e.replace(/\p{P}/gu,``)),e}function a(e,t){return t.length===0?!0:(e=i(e),t=i(t),r.compare(e.slice(0,t.length),t)===0)}function o(e,t){return t.length===0?!0:(e=i(e),t=i(t),r.compare(e.slice(-t.length),t)===0)}function s(e,t){if(t.length===0)return!0;e=i(e),t=i(t);let n=0,a=t.length;for(;n+a<=e.length;n++){let i=e.slice(n,n+a);if(r.compare(t,i)===0)return!0}return!1}return{startsWith:a,endsWith:o,contains:s}}function ku(e){let t=ze(),n=e.locale??t.locale;return(0,K.useMemo)(()=>Ou({...e,locale:n}),[n,e])}var Au=Object.defineProperty,ju=(e,t,n)=>t in e?Au(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t,n)=>ju(e,typeof t==`symbol`?t:t+``,n),Mu={itemToValue(e){return typeof e==`string`?e:Xe(e)&&nt(e,`value`)?e.value:``},itemToString(e){return typeof e==`string`?e:Xe(e)&&nt(e,`label`)?e.label:Mu.itemToValue(e)},isItemDisabled(e){return Xe(e)&&nt(e,`disabled`)?!!e.disabled:!1}},Nu=class e{constructor(t){this.options=t,$(this,`items`),$(this,`indexMap`,null),$(this,`copy`,t=>new e({...this.options,items:t??[...this.items]})),$(this,`isEqual`,e=>Zo(this.items,e.items)),$(this,`setItems`,e=>this.copy(e)),$(this,`getValues`,(e=this.items)=>{let t=[];for(let n of e){let e=this.getItemValue(n);e!=null&&t.push(e)}return t}),$(this,`find`,e=>{if(e==null)return null;let t=this.indexOf(e);return t===-1?null:this.at(t)}),$(this,`findMany`,e=>{let t=[];for(let n of e){let e=this.find(n);e!=null&&t.push(e)}return t}),$(this,`at`,e=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[e]??null;let t=0,n=this.group();for(let[,r]of n)for(let n of r){if(t===e)return n;t++}return null}),$(this,`sortFn`,(e,t)=>{let n=this.indexOf(e),r=this.indexOf(t);return(n??0)-(r??0)}),$(this,`sort`,e=>[...e].sort(this.sortFn.bind(this))),$(this,`getItemValue`,e=>e==null?null:this.options.itemToValue?.(e)??Mu.itemToValue(e)),$(this,`getItemDisabled`,e=>e==null?!1:this.options.isItemDisabled?.(e)??Mu.isItemDisabled(e)),$(this,`stringifyItem`,e=>e==null?null:this.options.itemToString?.(e)??Mu.itemToString(e)),$(this,`stringify`,e=>e==null?null:this.stringifyItem(this.find(e))),$(this,`stringifyItems`,(e,t=`, `)=>{let n=[];for(let t of e){let e=this.stringifyItem(t);e!=null&&n.push(e)}return n.join(t)}),$(this,`stringifyMany`,(e,t)=>this.stringifyItems(this.findMany(e),t)),$(this,`has`,e=>this.indexOf(e)!==-1),$(this,`hasItem`,e=>e==null?!1:this.has(this.getItemValue(e))),$(this,`group`,()=>{let{groupBy:e,groupSort:t}=this.options;if(!e)return[[``,[...this.items]]];let n=new Map;this.items.forEach((t,r)=>{let i=e(t,r);n.has(i)||n.set(i,[]),n.get(i).push(t)});let r=Array.from(n.entries());return t&&r.sort(([e],[n])=>{if(typeof t==`function`)return t(e,n);if(Array.isArray(t)){let r=t.indexOf(e),i=t.indexOf(n);return r===-1?1:i===-1?-1:r-i}return t===`asc`?e.localeCompare(n):t===`desc`?n.localeCompare(e):0}),r}),$(this,`getNextValue`,(e,t=1,n=!1)=>{let r=this.indexOf(e);if(r===-1)return null;for(r=n?Math.min(r+t,this.size-1):r+t;r<=this.size&&this.getItemDisabled(this.at(r));)r++;return this.getItemValue(this.at(r))}),$(this,`getPreviousValue`,(e,t=1,n=!1)=>{let r=this.indexOf(e);if(r===-1)return null;for(r=n?Math.max(r-t,0):r-t;r>=0&&this.getItemDisabled(this.at(r));)r--;return this.getItemValue(this.at(r))}),$(this,`indexOf`,e=>{if(e==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(t=>this.getItemValue(t)===e);if(!this.indexMap){this.indexMap=new Map;let e=0,t=this.group();for(let[,n]of t)for(let t of n){let n=this.getItemValue(t);n!=null&&this.indexMap.set(n,e),e++}}return this.indexMap.get(e)??-1}),$(this,`getByText`,(e,t)=>{let n=t==null?-1:this.indexOf(t),r=e.length===1;for(let i=0;i<this.items.length;i++){let a=this.items[(n+i+1)%this.items.length];if(!(r&&this.getItemValue(a)===t)&&!this.getItemDisabled(a)&&Pu(this.stringifyItem(a),e))return a}}),$(this,`search`,(e,t)=>{let{state:n,currentValue:r,timeout:i=350}=t,a=n.keysSoFar+e,o=a.length>1&&Array.from(a).every(e=>e===a[0])?a[0]:a,s=this.getByText(o,r),c=this.getItemValue(s);function l(){clearTimeout(n.timer),n.timer=-1}function u(e){n.keysSoFar=e,l(),e!==``&&(n.timer=+setTimeout(()=>{u(``),l()},i))}return u(a),c}),$(this,`update`,(e,t)=>{let n=this.indexOf(e);return n===-1?this:this.copy([...this.items.slice(0,n),t,...this.items.slice(n+1)])}),$(this,`upsert`,(e,t,n=`append`)=>{let r=this.indexOf(e);return r===-1?(n===`append`?this.append:this.prepend)(t):this.copy([...this.items.slice(0,r),t,...this.items.slice(r+1)])}),$(this,`insert`,(e,...t)=>this.copy(Fu(this.items,e,...t))),$(this,`insertBefore`,(e,...t)=>{let n=this.indexOf(e);if(n===-1)if(this.items.length===0)n=0;else return this;return this.copy(Fu(this.items,n,...t))}),$(this,`insertAfter`,(e,...t)=>{let n=this.indexOf(e);if(n===-1)if(this.items.length===0)n=0;else return this;return this.copy(Fu(this.items,n+1,...t))}),$(this,`prepend`,(...e)=>this.copy(Fu(this.items,0,...e))),$(this,`append`,(...e)=>this.copy(Fu(this.items,this.items.length,...e))),$(this,`filter`,e=>{let t=this.items.filter((t,n)=>e(this.stringifyItem(t),n,t));return this.copy(t)}),$(this,`remove`,(...e)=>{let t=e.map(e=>typeof e==`string`?e:this.getItemValue(e));return this.copy(this.items.filter(e=>{let n=this.getItemValue(e);return n==null?!1:!t.includes(n)}))}),$(this,`move`,(e,t)=>{let n=this.indexOf(e);return n===-1?this:this.copy(Iu(this.items,[n],t))}),$(this,`moveBefore`,(e,...t)=>{let n=this.items.findIndex(t=>this.getItemValue(t)===e);if(n===-1)return this;let r=t.map(e=>this.items.findIndex(t=>this.getItemValue(t)===e)).sort((e,t)=>e-t);return this.copy(Iu(this.items,r,n))}),$(this,`moveAfter`,(e,...t)=>{let n=this.items.findIndex(t=>this.getItemValue(t)===e);if(n===-1)return this;let r=t.map(e=>this.items.findIndex(t=>this.getItemValue(t)===e)).sort((e,t)=>e-t);return this.copy(Iu(this.items,r,n+1))}),$(this,`reorder`,(e,t)=>this.copy(Iu(this.items,[e],t))),$(this,`compareValue`,(e,t)=>{let n=this.indexOf(e),r=this.indexOf(t);return n<r?-1:+(n>r)}),$(this,`range`,(e,t)=>{let n=[],r=e;for(;r!=null;){if(this.find(r)&&n.push(r),r===t)return n;r=this.getNextValue(r)}return[]}),$(this,`getValueRange`,(e,t)=>e&&t?this.compareValue(e,t)<=0?this.range(e,t):this.range(t,e):[]),$(this,`toString`,()=>{let e=``;for(let t of this.items){let n=[this.getItemValue(t),this.stringifyItem(t),this.getItemDisabled(t)].filter(Boolean).join(`:`);e+=n+`,`}return e}),$(this,`toJSON`,()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let e=0;for(;this.getItemDisabled(this.at(e));)e++;return this.getItemValue(this.at(e))}get lastValue(){let e=this.size-1;for(;this.getItemDisabled(this.at(e));)e--;return this.getItemValue(this.at(e))}*[Symbol.iterator](){yield*this.items}},Pu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function Fu(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Iu(e,t,n){t=[...t].sort((e,t)=>e-t);let r=t.map(t=>e[t]);for(let n=t.length-1;n>=0;n--)e=[...e.slice(0,t[n]),...e.slice(t[n]+1)];return n=Math.max(0,n-t.filter(e=>e<n).length),[...e.slice(0,n),...r,...e.slice(n)]}function Lu({values:e,collection:t,selectedItemMap:n}){let r=[];for(let i of e){let e=t.find(i)??n.get(i);e!=null&&r.push(e)}return r}function Ru({selectedItemMap:e,values:t,selectedItems:n,collection:r}){let i=new Map(e);for(let e of n){let t=r.getItemValue(e);t!=null&&i.set(t,e)}let a=new Set(t);for(let e of i.keys())a.has(e)||i.delete(e);return i}function zu({values:e,collection:t,selectedItemMap:n}){let r=Lu({values:e,collection:t,selectedItemMap:n});return{selectedItems:r,nextSelectedItemMap:Ru({selectedItemMap:n,values:e,selectedItems:r,collection:t})}}function Bu({selectedItems:e,collection:t}){return Ru({selectedItemMap:new Map,values:e.map(e=>t.getItemValue(e)).filter(Boolean),selectedItems:e,collection:t})}function Vu(e,t,n){for(let r=0;r<t.length;r++)e=n.getChildren(e,t.slice(r+1))[t[r]];return e}function Hu(e){let t=Wu(e),n=[],r=new Set;for(let e of t){let t=e.join();r.has(t)||(r.add(t),n.push(e))}return n}function Uu(e,t){for(let n=0;n<Math.min(e.length,t.length);n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.length-t.length}function Wu(e){return e.sort(Uu)}function Gu(e,t){let n;return fd(e,{...t,onEnter:(e,r)=>{if(t.predicate(e,r))return n=e,`stop`}}),n}function Ku(e,t){let n=[];return fd(e,{onEnter:(e,r)=>{t.predicate(e,r)&&n.push(e)},getChildren:t.getChildren}),n}function qu(e,t){let n;return fd(e,{onEnter:(e,r)=>{if(t.predicate(e,r))return n=[...r],`stop`},getChildren:t.getChildren}),n}function Ju(e,t){let n=t.initialResult;return fd(e,{...t,onEnter:(e,r)=>{n=t.nextResult(n,e,r)}}),n}function Yu(e,t){return Ju(e,{...t,initialResult:[],nextResult:(e,n,r)=>(e.push(...t.transform(n,r)),e)})}function Xu(e,t){let{predicate:n,create:r,getChildren:i}=t,a=(e,t)=>{let o=i(e,t),s=[];o.forEach((e,n)=>{let r=a(e,[...t,n]);r&&s.push(r)});let c=t.length===0,l=n(e,t),u=s.length>0;return c||l||u?r(e,s,t):null};return a(e,[])||r(e,[],[])}function Zu(e,t){let n=[],r=0,i=new Map,a=new Map;return fd(e,{getChildren:t.getChildren,onEnter:(e,o)=>{i.has(e)||i.set(e,r++);let s=t.getChildren(e,o);s.forEach(t=>{a.has(t)||a.set(t,e),i.has(t)||i.set(t,r++)});let c=s.length>0?s.map(e=>i.get(e)):void 0,l=a.get(e),u=l?i.get(l):void 0,d=i.get(e);n.push({...e,_children:c,_parent:u,_index:d})}}),n}function Qu(e,t){return{type:`insert`,index:e,nodes:t}}function $u(e){return{type:`remove`,indexes:e}}function ed(){return{type:`replace`}}function td(e){return[e.slice(0,-1),e[e.length-1]]}function nd(e,t,n=new Map){let[r,i]=td(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();switch(n.get(t)?.type){case`remove`:continue}n.set(t,ed())}let a=n.get(r.join());switch(a?.type){case`remove`:n.set(r.join(),{type:`removeThenInsert`,removeIndexes:a.indexes,insertIndex:i,insertNodes:t});break;default:n.set(r.join(),Qu(i,t))}return n}function rd(e){let t=new Map,n=new Map;for(let t of e){let e=t.slice(0,-1).join(),r=n.get(e)??[];r.push(t[t.length-1]),n.set(e,r.sort((e,t)=>e-t))}for(let n of e)for(let e=n.length-2;e>=0;e--){let r=n.slice(0,e).join();t.has(r)||t.set(r,ed())}for(let[e,r]of n)t.set(e,$u(r));return t}function id(e,t){let n=new Map,[r,i]=td(e);for(let e=r.length-1;e>=0;e--){let t=r.slice(0,e).join();n.set(t,ed())}return n.set(r.join(),{type:`removeThenInsert`,removeIndexes:[i],insertIndex:i,insertNodes:[t]}),n}function ad(e,t,n){return sd(e,{...n,getChildren:(e,r)=>{let i=r.join();switch(t.get(i)?.type){case`replace`:case`remove`:case`removeThenInsert`:case`insert`:return n.getChildren(e,r);default:return[]}},transform:(e,r,i)=>{let a=i.join(),o=t.get(a);switch(o?.type){case`remove`:return n.create(e,r.filter((e,t)=>!o.indexes.includes(t)),i);case`removeThenInsert`:let t=r.filter((e,t)=>!o.removeIndexes.includes(t)),a=o.removeIndexes.reduce((e,t)=>t<e?e-1:e,o.insertIndex);return n.create(e,od(t,a,0,...o.insertNodes),i);case`insert`:return n.create(e,od(r,o.index,0,...o.nodes),i);case`replace`:return n.create(e,r,i);default:return e}}})}function od(e,t,n,...r){return[...e.slice(0,t),...r,...e.slice(t+n)]}function sd(e,t){let n={};return fd(e,{...t,onLeave:(e,r)=>{let i=[0,...r],a=i.join(),o=t.transform(e,n[a]??[],r),s=i.slice(0,-1).join(),c=n[s]??[];c.push(o),n[s]=c}}),n[``][0]}function cd(e,t){let{nodes:n,at:r}=t;if(r.length===0)throw Error(`Can't insert nodes at the root`);return ad(e,nd(r,n),t)}function ld(e,t){return t.at.length===0?t.node:ad(e,id(t.at,t.node),t)}function ud(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't remove the root node`);return ad(e,rd(t.indexPaths),t)}function dd(e,t){if(t.indexPaths.length===0)return e;for(let e of t.indexPaths)if(e.length===0)throw Error(`Can't move the root node`);if(t.to.length===0)throw Error(`Can't move nodes to the root`);let n=Hu(t.indexPaths),r=n.map(n=>Vu(e,n,t));return ad(e,nd(t.to,r,rd(n)),t)}function fd(e,t){let{onEnter:n,onLeave:r,getChildren:i}=t,a=[],o=[{node:e}],s=t.reuseIndexPath?()=>a:()=>a.slice();for(;o.length>0;){let e=o[o.length-1];if(e.state===void 0){let t=n?.(e.node,s());if(t===`stop`)return;e.state=t===`skip`?-1:0}let t=e.children||i(e.node,s());if(e.children||=t,e.state!==-1){if(e.state<t.length){let n=e.state;a.push(n),o.push({node:t[n]}),e.state=n+1;continue}if(r?.(e.node,s())===`stop`)return}a.pop(),o.pop()}}var pd=class e{constructor(t){this.options=t,$(this,`rootNode`),$(this,`isEqual`,e=>Zo(this.rootNode,e.rootNode)),$(this,`getNodeChildren`,e=>this.options.nodeToChildren?.(e)??md.nodeToChildren(e)??[]),$(this,`resolveIndexPath`,e=>typeof e==`string`?this.getIndexPath(e):e),$(this,`resolveNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(t):void 0}),$(this,`getNodeChildrenCount`,e=>this.options.nodeToChildrenCount?.(e)??md.nodeToChildrenCount(e)),$(this,`getNodeValue`,e=>this.options.nodeToValue?.(e)??md.nodeToValue(e)),$(this,`getNodeDisabled`,e=>this.options.isNodeDisabled?.(e)??md.isNodeDisabled(e)),$(this,`stringify`,e=>{let t=this.findNode(e);return t?this.stringifyNode(t):null}),$(this,`stringifyNode`,e=>this.options.nodeToString?.(e)??md.nodeToString(e)),$(this,`getFirstNode`,(e=this.rootNode,t={})=>{let n;return fd(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;if(!n&&i.length>0&&!this.getNodeDisabled(r))return n=r,`stop`}}}),n}),$(this,`getLastNode`,(e=this.rootNode,t={})=>{let n;return fd(e,{getChildren:this.getNodeChildren,onEnter:(r,i)=>{if(!this.isSameNode(r,e)){if(t.skip?.({value:this.getNodeValue(r),node:r,indexPath:i}))return`skip`;i.length>0&&!this.getNodeDisabled(r)&&(n=r)}}}),n}),$(this,`at`,e=>Vu(this.rootNode,e,{getChildren:this.getNodeChildren})),$(this,`findNode`,(e,t=this.rootNode)=>Gu(t,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})),$(this,`findNodes`,(e,t=this.rootNode)=>{let n=new Set(e.filter(e=>e!=null));return Ku(t,{getChildren:this.getNodeChildren,predicate:e=>n.has(this.getNodeValue(e))})}),$(this,`sort`,e=>e.reduce((e,t)=>{let n=this.getIndexPath(t);return n&&e.push({value:t,indexPath:n}),e},[]).sort((e,t)=>Uu(e.indexPath,t.indexPath)).map(({value:e})=>e)),$(this,`getValue`,e=>{let t=this.at(e);return t?this.getNodeValue(t):void 0}),$(this,`getValuePath`,e=>{if(!e)return[];let t=[],n=[...e];for(;n.length>0;){let e=this.at(n);e&&t.unshift(this.getNodeValue(e)),n.pop()}return t}),$(this,`getDepth`,e=>qu(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})?.length??0),$(this,`isSameNode`,(e,t)=>this.getNodeValue(e)===this.getNodeValue(t)),$(this,`isRootNode`,e=>this.isSameNode(e,this.rootNode)),$(this,`contains`,(e,t)=>!e||!t?!1:t.slice(0,e.length).every((n,r)=>e[r]===t[r])),$(this,`getNextNode`,(e,t={})=>{let n=!1,r;return fd(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return o===e&&(n=!0),`skip`;if(n&&!this.getNodeDisabled(i))return r=i,`stop`;o===e&&(n=!0)}}),r}),$(this,`getPreviousNode`,(e,t={})=>{let n,r=!1;return fd(this.rootNode,{getChildren:this.getNodeChildren,onEnter:(i,a)=>{if(this.isRootNode(i))return;let o=this.getNodeValue(i);if(t.skip?.({value:o,node:i,indexPath:a}))return`skip`;if(o===e)return r=!0,`stop`;this.getNodeDisabled(i)||(n=i)}}),r?n:void 0}),$(this,`getParentNodes`,e=>{let t=this.resolveIndexPath(e)?.slice();if(!t)return[];let n=[];for(;t.length>0;){t.pop();let e=this.at(t);e&&!this.isRootNode(e)&&n.unshift(e)}return n}),$(this,`getDescendantNodes`,(e,t)=>{let n=this.resolveNode(e);if(!n)return[];let r=[];return fd(n,{getChildren:this.getNodeChildren,onEnter:(e,n)=>{n.length!==0&&(!t?.withBranch&&this.isBranchNode(e)||r.push(e))}}),r}),$(this,`getDescendantValues`,(e,t)=>this.getDescendantNodes(e,t).map(e=>this.getNodeValue(e))),$(this,`getParentIndexPath`,e=>e.slice(0,-1)),$(this,`getParentNode`,e=>{let t=this.resolveIndexPath(e);return t?this.at(this.getParentIndexPath(t)):void 0}),$(this,`visit`,e=>{let{skip:t,...n}=e;fd(this.rootNode,{...n,getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(!this.isRootNode(e))return t?.({value:this.getNodeValue(e),node:e,indexPath:r})?`skip`:n.onEnter?.(e,r)}})}),$(this,`getPreviousSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;--r>=0;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),$(this,`getNextSibling`,e=>{let t=this.getParentNode(e);if(!t)return;let n=this.getNodeChildren(t),r=e[e.length-1];for(;++r<n.length;){let e=n[r];if(!this.getNodeDisabled(e))return e}}),$(this,`getSiblingNodes`,e=>{let t=this.getParentNode(e);return t?this.getNodeChildren(t):[]}),$(this,`getValues`,(e=this.rootNode)=>Yu(e,{getChildren:this.getNodeChildren,transform:e=>[this.getNodeValue(e)]}).slice(1)),$(this,`isValidDepth`,(e,t)=>t==null?!0:typeof t==`function`?t(e.length):e.length===t),$(this,`isBranchNode`,e=>this.getNodeChildren(e).length>0||this.getNodeChildrenCount(e)!=null),$(this,`getBranchValues`,(e=this.rootNode,t={})=>{let n=[];return fd(e,{getChildren:this.getNodeChildren,onEnter:(e,r)=>{if(r.length===0)return;let i=this.getNodeValue(e);if(t.skip?.({value:i,node:e,indexPath:r}))return`skip`;this.isBranchNode(e)&&this.isValidDepth(r,t.depth)&&n.push(this.getNodeValue(e))}}),n}),$(this,`flatten`,(e=this.rootNode)=>Zu(e,{getChildren:this.getNodeChildren})),$(this,`_create`,(e,t)=>this.getNodeChildren(e).length>0||t.length>0?{...e,children:t}:{...e}),$(this,`_insert`,(e,t,n)=>this.copy(cd(e,{at:t,nodes:n,getChildren:this.getNodeChildren,create:this._create}))),$(this,`copy`,t=>new e({...this.options,rootNode:t})),$(this,`_replace`,(e,t,n)=>this.copy(ld(e,{at:t,node:n,getChildren:this.getNodeChildren,create:this._create}))),$(this,`_move`,(e,t,n)=>this.copy(dd(e,{indexPaths:t,to:n,getChildren:this.getNodeChildren,create:this._create}))),$(this,`_remove`,(e,t)=>this.copy(ud(e,{indexPaths:t,getChildren:this.getNodeChildren,create:this._create}))),$(this,`replace`,(e,t)=>this._replace(this.rootNode,e,t)),$(this,`remove`,e=>this._remove(this.rootNode,e)),$(this,`insertBefore`,(e,t)=>this.getParentNode(e)?this._insert(this.rootNode,e,t):void 0),$(this,`insertAfter`,(e,t)=>{if(!this.getParentNode(e))return;let n=[...e.slice(0,-1),e[e.length-1]+1];return this._insert(this.rootNode,n,t)}),$(this,`move`,(e,t)=>this._move(this.rootNode,e,t)),$(this,`filter`,e=>{let t=Xu(this.rootNode,{predicate:e,getChildren:this.getNodeChildren,create:this._create});return this.copy(t)}),$(this,`toJSON`,()=>this.getValues(this.rootNode)),this.rootNode=t.rootNode}getIndexPath(e){if(Array.isArray(e)){if(e.length===0)return[];let t=[],n=this.getNodeChildren(this.rootNode);for(let r=0;r<e.length;r++){let i=e[r],a=n.findIndex(e=>this.getNodeValue(e)===i);if(a===-1)break;if(t.push(a),r<e.length-1){let e=n[a];n=this.getNodeChildren(e)}}return t}else return qu(this.rootNode,{getChildren:this.getNodeChildren,predicate:t=>this.getNodeValue(t)===e})}},md={nodeToValue(e){return typeof e==`string`?e:Xe(e)&&nt(e,`value`)?e.value:``},nodeToString(e){return typeof e==`string`?e:Xe(e)&&nt(e,`label`)?e.label:md.nodeToValue(e)},isNodeDisabled(e){return Xe(e)&&nt(e,`disabled`)?!!e.disabled:!1},nodeToChildren(e){return e.children},nodeToChildrenCount(e){if(Xe(e)&&nt(e,`childrenCount`))return e.childrenCount}},hd=e=>new pd(e),gd=e=>De()(e,[`collapsedHeight`,`collapsedWidth`,`defaultOpen`,`disabled`,`id`,`ids`,`lazyMount`,`onExitComplete`,`onOpenChange`,`open`,`unmountOnExit`]),_d=Ze(`collapsible`).parts(`root`,`trigger`,`content`,`indicator`).build(),vd=e=>e.ids?.root??`collapsible:${e.id}`,yd=e=>e.ids?.content??`collapsible:${e.id}:content`,bd=e=>e.ids?.trigger??`collapsible:${e.id}:trigger`,xd=e=>e.getById(yd(e));function Sd(e,t){let{state:n,send:r,context:i,scope:a,prop:o}=e,s=n.matches(`open`)||n.matches(`closing`),c=n.matches(`open`),l=n.matches(`closed`),{width:u,height:d}=i.get(`size`),f=!!o(`disabled`),p=o(`collapsedHeight`),h=o(`collapsedWidth`),g=p!=null,_=h!=null,v=g||_,y=!i.get(`initial`)&&c;return{disabled:f,visible:s,open:c,measureSize(){r({type:`size.measure`})},setOpen(e){n.matches(`open`)!==e&&r({type:e?`open`:`close`})},getRootProps(){return t.element({..._d.root.attrs,"data-state":c?`open`:`closed`,dir:o(`dir`),id:vd(a)})},getContentProps(){return t.element({..._d.content.attrs,id:yd(a),"data-collapsible":``,"data-state":y?void 0:c?`open`:`closed`,"data-disabled":W(f),"data-has-collapsed-size":W(v),hidden:!s&&!v,dir:o(`dir`),style:{"--height":m(d),"--width":m(u),"--collapsed-height":m(p),"--collapsed-width":m(h),...l&&g&&{overflow:`hidden`,minHeight:m(p),maxHeight:m(p)},...l&&_&&{overflow:`hidden`,minWidth:m(h),maxWidth:m(h)}}})},getTriggerProps(){return t.element({..._d.trigger.attrs,id:bd(a),dir:o(`dir`),type:`button`,"data-state":c?`open`:`closed`,"data-disabled":W(f),"aria-controls":yd(a),"aria-expanded":s||!1,onClick(e){e.defaultPrevented||f||r({type:c?`close`:`open`})}})},getIndicatorProps(){return t.element({..._d.indicator.attrs,dir:o(`dir`),"data-state":c?`open`:`closed`,"data-disabled":W(f)})}}}var Cd=Me({initialState({prop:e}){return e(`open`)||e(`defaultOpen`)?`open`:`closed`},context({bindable:e}){return{size:e(()=>({defaultValue:{height:0,width:0},sync:!0})),initial:e(()=>({defaultValue:!1}))}},refs(){return{cleanup:void 0,stylesRef:void 0}},watch({track:e,prop:t,action:n}){e([()=>t(`open`)],()=>{n([`setInitial`,`computeSize`,`toggleVisibility`])})},exit:[`cleanupNode`],states:{closed:{effects:[`trackTabbableElements`],on:{"controlled.open":{target:`open`},open:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitial`,`computeSize`,`invokeOnOpen`]}]}},closing:{effects:[`trackExitAnimation`],on:{"controlled.close":{target:`closed`},"controlled.open":{target:`open`},open:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitial`,`invokeOnOpen`]}],close:[{guard:`isOpenControlled`,actions:[`invokeOnExitComplete`]},{target:`closed`,actions:[`setInitial`,`computeSize`,`invokeOnExitComplete`]}],"animation.end":{target:`closed`,actions:[`invokeOnExitComplete`,`clearInitial`]}}},open:{effects:[`trackEnterAnimation`],on:{"controlled.close":{target:`closing`},close:[{guard:`isOpenControlled`,actions:[`invokeOnClose`]},{target:`closing`,actions:[`setInitial`,`computeSize`,`invokeOnClose`]}],"size.measure":{actions:[`measureSize`]},"animation.end":{actions:[`clearInitial`]}}}},implementations:{guards:{isOpenControlled:({prop:e})=>e(`open`)!=null},effects:{trackEnterAnimation:({send:e,scope:t})=>{let n,r=U(()=>{let r=xd(t);if(!r)return;let i=de(r).animationName;if(!i||i===`none`){e({type:`animation.end`});return}let a=t=>{N(t)===r&&e({type:`animation.end`})};r.addEventListener(`animationend`,a),n=()=>{r.removeEventListener(`animationend`,a)}});return()=>{r(),n?.()}},trackExitAnimation:({send:e,scope:t})=>{let n,r=U(()=>{let r=xd(t);if(!r)return;let i=de(r).animationName;if(!i||i===`none`){e({type:`animation.end`});return}let a=t=>{N(t)===r&&e({type:`animation.end`})};r.addEventListener(`animationend`,a);let o=Ge(r,{animationFillMode:`forwards`});n=()=>{r.removeEventListener(`animationend`,a),ne(()=>o())}});return()=>{r(),n?.()}},trackTabbableElements:({scope:e,prop:t})=>{if(!t(`collapsedHeight`)&&!t(`collapsedWidth`))return;let n=xd(e);if(!n)return;let r=()=>{let e=As(n).map(e=>be(e,`inert`,``));return()=>{e.forEach(e=>e())}},i=r(),a=zs(n,{callback(){i(),i=r()}});return()=>{i(),a()}}},actions:{setInitial:({context:e,flush:t})=>{t(()=>{e.set(`initial`,!0)})},clearInitial:({context:e})=>{e.set(`initial`,!1)},cleanupNode:({refs:e})=>{e.set(`stylesRef`,null)},measureSize:({context:e,scope:t})=>{let n=xd(t);if(!n)return;let{height:r,width:i}=n.getBoundingClientRect();e.set(`size`,{height:r,width:i})},computeSize:({refs:e,scope:t,context:n})=>{e.get(`cleanup`)?.();let r=U(()=>{let e=xd(t);if(!e)return;let r=e.hidden;e.style.animationName=`none`,e.style.animationDuration=`0s`,e.hidden=!1;let i=e.getBoundingClientRect();n.set(`size`,{height:i.height,width:i.width}),n.get(`initial`)&&(e.style.animationName=``,e.style.animationDuration=``),e.hidden=r});e.set(`cleanup`,r)},invokeOnOpen:({prop:e})=>{e(`onOpenChange`)?.({open:!0})},invokeOnClose:({prop:e})=>{e(`onOpenChange`)?.({open:!1})},invokeOnExitComplete:({prop:e})=>{e(`onExitComplete`)?.()},toggleVisibility:({prop:e,send:t})=>{t({type:e(`open`)?`controlled.open`:`controlled.close`})}}}}),wd=(e={})=>{let{lazyMount:t,unmountOnExit:n,...r}=e,i=(0,K.useId)(),a=(0,K.useRef)(!1),{dir:o}=ze(),{getRootNode:s}=Ce(),c=Sd(qe(Cd,{id:i,dir:o,getRootNode:s,...r}),Ve);c.visible&&(a.current=!0);let l=!c.visible&&!a.current&&t||n&&!c.visible&&a.current;return{...c,isUnmounted:l}},[Td,Ed]=_e({name:`CollapsibleContext`,hookName:`useCollapsibleContext`,providerName:`<CollapsibleProvider />`}),Dd=(0,K.forwardRef)((e,t)=>{let[n,r]=gd(e),i=wd(n),a=G(i.getRootProps(),r);return(0,Q.jsx)(Td,{value:i,children:(0,Q.jsx)(tt.div,{...a,ref:t})})});Dd.displayName=`CollapsibleRoot`;var[Od,kd]=_e({name:`TreeViewContext`,hookName:`useTreeViewContext`,providerName:`<TreeViewProvider />`}),[Ad,jd]=_e({name:`TreeViewNodeContext`,hookName:`useTreeViewNodeContext`,providerName:`<TreeViewNodeProvider />`}),[Md,Nd]=_e({name:`TreeViewNodePropsContext`,hookName:`useTreeViewNodePropsContext`,providerName:`<TreeViewItemProvider />`}),Pd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=jd(),a=Qs(),o=G(n.getBranchProps(r),e),s=n.getBranchContentProps(r);return(0,Q.jsx)(Dd,{ref:t,open:i.expanded,ids:{content:s.id},...a,...o})});Pd.displayName=`TreeViewBranch`;var Fd=(0,K.forwardRef)((e,t)=>{let n=Ed();if(n.isUnmounted)return null;let r=G(n.getContentProps(),e);return(0,Q.jsx)(tt.div,{...r,ref:t})});Fd.displayName=`CollapsibleContent`;var Id=De(),Ld=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),[,i]=Id(n.getBranchContentProps(r),[`hidden`,`data-state`]);return(0,Q.jsx)(Fd,{ref:t,...G(i,e)})});Ld.displayName=`TreeViewBranchContent`;var Rd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getBranchControlProps(r),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});Rd.displayName=`TreeViewBranchControl`;var zd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getBranchIndentGuideProps(r),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});zd.displayName=`TreeViewBranchIndentGuide`;var Bd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getBranchIndicatorProps(r),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});Bd.displayName=`TreeViewBranchIndicator`;var Vd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getBranchTextProps(r),e);return(0,Q.jsx)(tt.span,{...i,ref:t})});Vd.displayName=`TreeViewBranchText`;var Hd=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getItemProps(r),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});Hd.displayName=`TreeViewItem`;var Ud=(0,K.forwardRef)((e,t)=>{let n=kd(),r=Nd(),i=G(n.getItemTextProps(r),e);return(0,Q.jsx)(tt.span,{...i,ref:t})});Ud.displayName=`TreeViewItemText`;var Wd=De();function Gd(e){let[t,n]=Wd(e,[`indexPath`,`node`]);return(0,Q.jsx)(Ad,{value:kd().getNodeState(t),children:(0,Q.jsx)(Md,{value:t,children:n.children})})}var Kd=Ze(`tree-view`).parts(`branch`,`branchContent`,`branchControl`,`branchIndentGuide`,`branchIndicator`,`branchText`,`branchTrigger`,`item`,`itemIndicator`,`itemText`,`label`,`nodeCheckbox`,`nodeRenameInput`,`root`,`tree`).build(),qd=e=>new pd(e);qd.empty=()=>new pd({rootNode:{children:[]}});var Jd=e=>e.ids?.root??`tree:${e.id}:root`,Yd=e=>e.ids?.label??`tree:${e.id}:label`,Xd=(e,t)=>e.ids?.node?.(t)??`tree:${e.id}:node:${t}`,Zd=e=>e.ids?.tree??`tree:${e.id}:tree`,Qd=(e,t)=>{t!=null&&e.getById(Xd(e,t))?.focus()},$d=(e,t)=>`tree:${e.id}:rename-input:${t}`,ef=(e,t)=>e.getById($d(e,t));function tf(e,t,n){let r=e.getNodeValue(t);if(!e.isBranchNode(t))return n.includes(r);let i=e.getDescendantValues(r),a=i.every(e=>n.includes(e)),o=i.some(e=>n.includes(e));return a?!0:o?`indeterminate`:!1}function nf(e,t,n){let r=e.getDescendantValues(t);return ue(r.every(e=>n.includes(e))?P(n,...r):ve(n,...r))}function rf(e,t){let n=new Map;return e.visit({onEnter:r=>{let i=e.getNodeValue(r),a=e.isBranchNode(r),o=tf(e,r,t);n.set(i,{type:a?`branch`:`leaf`,checked:o})}}),n}function af(e,t){let{context:n,scope:r,computed:i,prop:a,send:o}=e,s=a(`collection`),c=a(`translations`),l=Array.from(n.get(`expandedValue`)),u=Array.from(n.get(`selectedValue`)),d=Array.from(n.get(`checkedValue`)),f=i(`isTypingAhead`),p=n.get(`focusedValue`),m=n.get(`loadingStatus`),h=n.get(`renamingValue`),g=s.getFirstNode(void 0,{skip:({indexPath:e})=>s.getValuePath(e).slice(0,-1).some(e=>!l.includes(e))}),_=g?s.getNodeValue(g):null;function v(e){let{node:t,indexPath:n}=e,i=s.getNodeValue(t);return{id:Xd(r,i),value:i,indexPath:n,valuePath:s.getValuePath(n),disabled:!!t.disabled,focused:p==null?_===i:p===i,selected:u.includes(i),expanded:l.includes(i),loading:m[i]===`loading`,depth:n.length,isBranch:s.isBranchNode(t),renaming:h===i,get checked(){return tf(s,t,d)}}}return{collection:s,expandedValue:l,selectedValue:u,checkedValue:d,toggleChecked(e,t){o({type:`CHECKED.TOGGLE`,value:e,isBranch:t})},setChecked(e){o({type:`CHECKED.SET`,value:e})},clearChecked(){o({type:`CHECKED.CLEAR`})},getCheckedMap(){return rf(s,d)},expand(e){o({type:e?`BRANCH.EXPAND`:`EXPANDED.ALL`,value:e})},collapse(e){o({type:e?`BRANCH.COLLAPSE`:`EXPANDED.CLEAR`,value:e})},deselect(e){o({type:e?`NODE.DESELECT`:`SELECTED.CLEAR`,value:e})},select(e){o({type:e?`NODE.SELECT`:`SELECTED.ALL`,value:e,isTrusted:!1})},getVisibleNodes(){return i(`visibleNodes`)},focus(e){Qd(r,e)},selectParent(e){let t=s.getParentNode(e);t&&o({type:`SELECTED.SET`,value:ve(u,s.getNodeValue(t)),src:`select.parent`})},expandParent(e){let t=s.getParentNode(e);t&&o({type:`EXPANDED.SET`,value:ve(l,s.getNodeValue(t)),src:`expand.parent`})},setExpandedValue(e){o({type:`EXPANDED.SET`,value:ue(e)})},setSelectedValue(e){o({type:`SELECTED.SET`,value:ue(e)})},startRenaming(e){o({type:`NODE.RENAME`,value:e})},submitRenaming(e,t){o({type:`RENAME.SUBMIT`,value:e,label:t})},cancelRenaming(){o({type:`RENAME.CANCEL`})},getRootProps(){return t.element({...Kd.root.attrs,id:Jd(r),dir:a(`dir`)})},getLabelProps(){return t.element({...Kd.label.attrs,id:Yd(r),dir:a(`dir`)})},getTreeProps(){return t.element({...Kd.tree.attrs,id:Zd(r),dir:a(`dir`),role:`tree`,"aria-label":c.treeLabel,"aria-labelledby":Yd(r),"aria-multiselectable":a(`selectionMode`)===`multiple`||void 0,tabIndex:-1,onKeyDown(e){if(e.defaultPrevented||L(e))return;let t=N(e);if(M(t))return;let n=t?.closest(`[data-part=branch-control], [data-part=item]`);if(!n)return;let r=n.dataset.value;if(r==null){console.warn(`[zag-js/tree-view] Node id not found for node`,n);return}let i=n.matches(`[data-part=branch-control]`),c={ArrowDown(e){ie(e)||(e.preventDefault(),o({type:`NODE.ARROW_DOWN`,id:r,shiftKey:e.shiftKey}))},ArrowUp(e){ie(e)||(e.preventDefault(),o({type:`NODE.ARROW_UP`,id:r,shiftKey:e.shiftKey}))},ArrowLeft(e){ie(e)||n.dataset.disabled||(e.preventDefault(),o({type:i?`BRANCH_NODE.ARROW_LEFT`:`NODE.ARROW_LEFT`,id:r}))},ArrowRight(e){!i||n.dataset.disabled||(e.preventDefault(),o({type:`BRANCH_NODE.ARROW_RIGHT`,id:r}))},Home(e){ie(e)||(e.preventDefault(),o({type:`NODE.HOME`,id:r,shiftKey:e.shiftKey}))},End(e){ie(e)||(e.preventDefault(),o({type:`NODE.END`,id:r,shiftKey:e.shiftKey}))},Space(e){n.dataset.disabled||(f?o({type:`TREE.TYPEAHEAD`,key:e.key}):c.Enter?.(e))},Enter(e){n.dataset.disabled||ge(t)&&ie(e)||(o({type:i?`BRANCH_NODE.CLICK`:`NODE.CLICK`,id:r,src:`keyboard`}),ge(t)||e.preventDefault())},"*"(e){n.dataset.disabled||(e.preventDefault(),o({type:`SIBLINGS.EXPAND`,id:r}))},a(e){!e.metaKey||n.dataset.disabled||(e.preventDefault(),o({type:`SELECTED.ALL`,moveFocus:!0}))},F2(e){if(n.dataset.disabled)return;let t=a(`canRename`);if(!t)return;let i=s.getIndexPath(r);if(i){let e=s.at(i);if(e&&!t(e,i))return}e.preventDefault(),o({type:`NODE.RENAME`,value:r})}},l=c[F(e,{dir:a(`dir`)})];if(l){l(e);return}Ks.isValidEvent(e)&&(o({type:`TREE.TYPEAHEAD`,key:e.key,id:r}),e.preventDefault())}})},getNodeState:v,getItemProps(e){let n=v(e);return t.element({...Kd.item.attrs,id:n.id,dir:a(`dir`),"data-ownedby":Zd(r),"data-path":e.indexPath.join(`/`),"data-value":n.value,tabIndex:n.focused?0:-1,"data-focus":W(n.focused),role:`treeitem`,"aria-current":n.selected?`true`:void 0,"aria-selected":n.disabled?void 0:n.selected,"data-selected":W(n.selected),"aria-disabled":ye(n.disabled),"data-disabled":W(n.disabled),"data-renaming":W(n.renaming),"data-checked":W(n.checked===!0),"data-indeterminate":W(n.checked===`indeterminate`),"aria-level":n.depth,"data-depth":n.depth,style:{"--depth":n.depth},onFocus(e){e.stopPropagation(),o({type:`NODE.FOCUS`,id:n.value})},onClick(e){if(n.disabled||!z(e)||ge(e.currentTarget)&&ie(e))return;let t=e.metaKey||e.ctrlKey;o({type:`NODE.CLICK`,id:n.value,shiftKey:e.shiftKey,ctrlKey:t}),e.stopPropagation(),ge(e.currentTarget)||e.preventDefault()}})},getItemTextProps(e){let n=v(e);return t.element({...Kd.itemText.attrs,"data-disabled":W(n.disabled),"data-selected":W(n.selected),"data-focus":W(n.focused)})},getItemIndicatorProps(e){let n=v(e);return t.element({...Kd.itemIndicator.attrs,"aria-hidden":!0,"data-disabled":W(n.disabled),"data-selected":W(n.selected),"data-focus":W(n.focused),hidden:!n.selected})},getBranchProps(e){let n=v(e);return t.element({...Kd.branch.attrs,"data-depth":n.depth,dir:a(`dir`),"data-branch":n.value,role:`treeitem`,"data-ownedby":Zd(r),"data-value":n.value,"aria-level":n.depth,"aria-selected":n.disabled?void 0:n.selected,"data-path":e.indexPath.join(`/`),"data-selected":W(n.selected),"aria-expanded":n.expanded,"data-state":n.expanded?`open`:`closed`,"aria-disabled":ye(n.disabled),"data-disabled":W(n.disabled),"data-loading":W(n.loading),"aria-busy":ye(n.loading),style:{"--depth":n.depth}})},getBranchIndicatorProps(e){let n=v(e);return t.element({...Kd.branchIndicator.attrs,"aria-hidden":!0,"data-state":n.expanded?`open`:`closed`,"data-disabled":W(n.disabled),"data-selected":W(n.selected),"data-focus":W(n.focused),"data-loading":W(n.loading)})},getBranchTriggerProps(e){let n=v(e);return t.element({...Kd.branchTrigger.attrs,role:`button`,dir:a(`dir`),"data-disabled":W(n.disabled),"data-state":n.expanded?`open`:`closed`,"data-value":n.value,"data-loading":W(n.loading),disabled:n.loading,onClick(e){n.disabled||n.loading||(o({type:`BRANCH_TOGGLE.CLICK`,id:n.value}),e.stopPropagation())}})},getBranchControlProps(e){let n=v(e);return t.element({...Kd.branchControl.attrs,role:`button`,id:n.id,dir:a(`dir`),tabIndex:n.focused?0:-1,"data-path":e.indexPath.join(`/`),"data-state":n.expanded?`open`:`closed`,"data-disabled":W(n.disabled),"data-selected":W(n.selected),"data-focus":W(n.focused),"data-renaming":W(n.renaming),"data-checked":W(n.checked===!0),"data-indeterminate":W(n.checked===`indeterminate`),"data-value":n.value,"data-depth":n.depth,"data-loading":W(n.loading),"aria-busy":ye(n.loading),onFocus(e){o({type:`NODE.FOCUS`,id:n.value}),e.stopPropagation()},onClick(e){if(n.disabled||n.loading||!z(e)||ge(e.currentTarget)&&ie(e))return;let t=e.metaKey||e.ctrlKey;o({type:`BRANCH_NODE.CLICK`,id:n.value,shiftKey:e.shiftKey,ctrlKey:t}),e.stopPropagation()}})},getBranchTextProps(e){let n=v(e);return t.element({...Kd.branchText.attrs,dir:a(`dir`),"data-disabled":W(n.disabled),"data-state":n.expanded?`open`:`closed`,"data-loading":W(n.loading)})},getBranchContentProps(e){let n=v(e);return t.element({...Kd.branchContent.attrs,role:`group`,dir:a(`dir`),"data-state":n.expanded?`open`:`closed`,"data-depth":n.depth,"data-path":e.indexPath.join(`/`),"data-value":n.value,hidden:!n.expanded})},getBranchIndentGuideProps(e){let n=v(e);return t.element({...Kd.branchIndentGuide.attrs,"data-depth":n.depth})},getNodeCheckboxProps(e){let n=v(e),r=n.checked;return t.element({...Kd.nodeCheckbox.attrs,tabIndex:-1,role:`checkbox`,"data-state":r===!0?`checked`:r===!1?`unchecked`:`indeterminate`,"aria-checked":r===!0?`true`:r===!1?`false`:`mixed`,"data-disabled":W(n.disabled),onClick(e){e.defaultPrevented||n.disabled||z(e)&&(o({type:`CHECKED.TOGGLE`,value:n.value,isBranch:n.isBranch}),e.stopPropagation(),e.currentTarget.closest(`[role=treeitem]`)?.focus({preventScroll:!0}))}})},getNodeRenameInputProps(e){let n=v(e);return t.input({...Kd.nodeRenameInput.attrs,id:$d(r,n.value),type:`text`,"aria-label":c.renameInputLabel,hidden:!n.renaming,onKeyDown(e){L(e)||(e.key===`Escape`&&(o({type:`RENAME.CANCEL`}),e.preventDefault()),e.key===`Enter`&&(o({type:`RENAME.SUBMIT`,label:e.currentTarget.value}),e.preventDefault()),e.stopPropagation())},onBlur(e){o({type:`RENAME.SUBMIT`,label:e.currentTarget.value})}})}}}function of(e,t){let{context:n,prop:r,refs:i}=e;if(!r(`loadChildren`)){n.set(`expandedValue`,e=>ue(ve(e,...t)));return}let a=n.get(`loadingStatus`),[o,s]=le(t,e=>a[e]===`loaded`);if(o.length>0&&n.set(`expandedValue`,e=>ue(ve(e,...o))),s.length===0)return;let c=r(`collection`),[l,u]=le(s,e=>{let t=c.findNode(e);return c.getNodeChildren(t).length>0});if(l.length>0&&n.set(`expandedValue`,e=>ue(ve(e,...l))),u.length===0)return;n.set(`loadingStatus`,e=>({...e,...u.reduce((e,t)=>({...e,[t]:`loading`}),{})}));let d=u.map(e=>{let t=c.getIndexPath(e);return{id:e,indexPath:t,valuePath:c.getValuePath(t),node:c.findNode(e)}}),f=i.get(`pendingAborts`),p=r(`loadChildren`);we(p,()=>"[zag-js/tree-view] `loadChildren` is required for async expansion");let m=d.map(({id:e,indexPath:t,valuePath:n,node:r})=>{let i=f.get(e);i&&(i.abort(),f.delete(e));let a=new AbortController;return f.set(e,a),p({valuePath:n,indexPath:t,node:r,signal:a.signal})});Promise.allSettled(m).then(e=>{let t=[],i=[],a=n.get(`loadingStatus`),o=r(`collection`);e.forEach((e,n)=>{let{id:r,indexPath:s,node:c,valuePath:l}=d[n];e.status===`fulfilled`?(a[r]=`loaded`,t.push(r),o=o.replace(s,{...c,children:e.value})):(f.delete(r),Reflect.deleteProperty(a,r),i.push({node:c,error:e.reason,indexPath:s,valuePath:l}))}),n.set(`loadingStatus`,a),t.length&&(n.set(`expandedValue`,e=>ue(ve(e,...t))),r(`onLoadChildrenComplete`)?.({collection:o})),i.length&&r(`onLoadChildrenError`)?.({nodes:i})})}function sf(e){let{prop:t,context:n}=e;return function({indexPath:e}){return t(`collection`).getValuePath(e).slice(0,-1).some(e=>!n.get(`expandedValue`).includes(e))}}var{and:cf}=Se(),lf=Me({props({props:e}){return{selectionMode:`single`,collection:qd.empty(),typeahead:!0,expandOnClick:!0,defaultExpandedValue:[],defaultSelectedValue:[],...e,translations:{treeLabel:`Tree View`,renameInputLabel:`Rename tree item`,...e.translations}}},initialState(){return`idle`},context({prop:e,bindable:t,getContext:n}){return{expandedValue:t(()=>({defaultValue:e(`defaultExpandedValue`),value:e(`expandedValue`),isEqual:Zo,onChange(t){let r=n().get(`focusedValue`);e(`onExpandedChange`)?.({expandedValue:t,focusedValue:r,get expandedNodes(){return e(`collection`).findNodes(t)}})}})),selectedValue:t(()=>({defaultValue:e(`defaultSelectedValue`),value:e(`selectedValue`),isEqual:Zo,onChange(t){let r=n().get(`focusedValue`);e(`onSelectionChange`)?.({selectedValue:t,focusedValue:r,get selectedNodes(){return e(`collection`).findNodes(t)}})}})),focusedValue:t(()=>({defaultValue:e(`defaultFocusedValue`)||null,value:e(`focusedValue`),onChange(t){e(`onFocusChange`)?.({focusedValue:t,get focusedNode(){return t?e(`collection`).findNode(t):null}})}})),loadingStatus:t(()=>({defaultValue:{}})),checkedValue:t(()=>({defaultValue:e(`defaultCheckedValue`)||[],value:e(`checkedValue`),isEqual:Zo,onChange(t){e(`onCheckedChange`)?.({checkedValue:t})}})),renamingValue:t(()=>({sync:!0,defaultValue:null}))}},refs(){return{typeaheadState:{...Ks.defaultOptions},pendingAborts:new Map}},computed:{isMultipleSelection:({prop:e})=>e(`selectionMode`)===`multiple`,isTypingAhead:({refs:e})=>e.get(`typeaheadState`).keysSoFar.length>0,visibleNodes:({prop:e,context:t})=>{let n=[];return e(`collection`).visit({skip:sf({prop:e,context:t}),onEnter:(e,t)=>{n.push({node:e,indexPath:t})}}),n}},on:{"EXPANDED.SET":{actions:[`setExpanded`]},"EXPANDED.CLEAR":{actions:[`clearExpanded`]},"EXPANDED.ALL":{actions:[`expandAllBranches`]},"BRANCH.EXPAND":{actions:[`expandBranches`]},"BRANCH.COLLAPSE":{actions:[`collapseBranches`]},"SELECTED.SET":{actions:[`setSelected`]},"SELECTED.ALL":[{guard:cf(`isMultipleSelection`,`moveFocus`),actions:[`selectAllNodes`,`focusTreeLastNode`]},{guard:`isMultipleSelection`,actions:[`selectAllNodes`]}],"SELECTED.CLEAR":{actions:[`clearSelected`]},"NODE.SELECT":{actions:[`selectNode`]},"NODE.DESELECT":{actions:[`deselectNode`]},"CHECKED.TOGGLE":{actions:[`toggleChecked`]},"CHECKED.SET":{actions:[`setChecked`]},"CHECKED.CLEAR":{actions:[`clearChecked`]},"NODE.FOCUS":{actions:[`setFocusedNode`]},"NODE.ARROW_DOWN":[{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`focusTreeNextNode`,`extendSelectionToNextNode`]},{actions:[`focusTreeNextNode`]}],"NODE.ARROW_UP":[{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`focusTreePrevNode`,`extendSelectionToPrevNode`]},{actions:[`focusTreePrevNode`]}],"NODE.ARROW_LEFT":{actions:[`focusBranchNode`]},"BRANCH_NODE.ARROW_LEFT":[{guard:`isBranchExpanded`,actions:[`collapseBranch`]},{actions:[`focusBranchNode`]}],"BRANCH_NODE.ARROW_RIGHT":[{guard:cf(`isBranchFocused`,`isBranchExpanded`),actions:[`focusBranchFirstNode`]},{actions:[`expandBranch`]}],"SIBLINGS.EXPAND":{actions:[`expandSiblingBranches`]},"NODE.HOME":[{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToFirstNode`,`focusTreeFirstNode`]},{actions:[`focusTreeFirstNode`]}],"NODE.END":[{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToLastNode`,`focusTreeLastNode`]},{actions:[`focusTreeLastNode`]}],"NODE.CLICK":[{guard:cf(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToNode`]},{actions:[`selectNode`]}],"BRANCH_NODE.CLICK":[{guard:cf(`isCtrlKey`,`isMultipleSelection`),actions:[`toggleNodeSelection`]},{guard:cf(`isShiftKey`,`isMultipleSelection`),actions:[`extendSelectionToNode`]},{guard:`expandOnClick`,actions:[`selectNode`,`toggleBranchNode`]},{actions:[`selectNode`]}],"BRANCH_TOGGLE.CLICK":{actions:[`toggleBranchNode`]},"TREE.TYPEAHEAD":{actions:[`focusMatchedNode`]}},exit:[`clearPendingAborts`],states:{idle:{on:{"NODE.RENAME":{target:`renaming`,actions:[`setRenamingValue`]}}},renaming:{entry:[`syncRenameInput`,`focusRenameInput`],on:{"RENAME.SUBMIT":{guard:`isRenameLabelValid`,target:`idle`,actions:[`submitRenaming`]},"RENAME.CANCEL":{target:`idle`,actions:[`cancelRenaming`]}}}},implementations:{guards:{isBranchFocused:({context:e,event:t})=>e.get(`focusedValue`)===t.id,isBranchExpanded:({context:e,event:t})=>e.get(`expandedValue`).includes(t.id),isShiftKey:({event:e})=>e.shiftKey,isCtrlKey:({event:e})=>e.ctrlKey,hasSelectedItems:({context:e})=>e.get(`selectedValue`).length>0,isMultipleSelection:({prop:e})=>e(`selectionMode`)===`multiple`,moveFocus:({event:e})=>!!e.moveFocus,expandOnClick:({prop:e})=>!!e(`expandOnClick`),isRenameLabelValid:({event:e})=>e.label.trim()!==``},actions:{selectNode({context:e,event:t}){let n=t.id||t.value;e.set(`selectedValue`,e=>n==null?e:!t.isTrusted&&et(n)?e.concat(...n):[et(n)?Ke(n):n].filter(Boolean))},deselectNode({context:e,event:t}){let n=We(t.id||t.value);e.set(`selectedValue`,e=>P(e,...n))},setFocusedNode({context:e,event:t}){e.set(`focusedValue`,t.id)},clearFocusedNode({context:e}){e.set(`focusedValue`,null)},clearSelectedItem({context:e}){e.set(`selectedValue`,[])},toggleBranchNode({context:e,event:t,action:n}){n(e.get(`expandedValue`).includes(t.id)?[`collapseBranch`]:[`expandBranch`])},expandBranch(e){let{event:t}=e;of(e,[t.id])},expandBranches(e){let{context:t,event:n}=e;of(e,Je(We(n.value),t.get(`expandedValue`)))},collapseBranch({context:e,event:t}){e.set(`expandedValue`,e=>P(e,t.id))},collapseBranches(e){let{context:t,event:n}=e,r=We(n.value);t.set(`expandedValue`,e=>P(e,...r))},setExpanded({context:e,event:t}){et(t.value)&&e.set(`expandedValue`,t.value)},clearExpanded({context:e}){e.set(`expandedValue`,[])},setSelected({context:e,event:t}){et(t.value)&&e.set(`selectedValue`,t.value)},clearSelected({context:e}){e.set(`selectedValue`,[])},focusTreeFirstNode(e){let{prop:t,scope:n}=e,r=t(`collection`),i=r.getFirstNode(void 0,{skip:sf(e)});if(!i)return;let a=r.getNodeValue(i);uf(e,a)?U(()=>Qd(n,a)):Qd(n,a)},focusTreeLastNode(e){let{prop:t,scope:n}=e,r=t(`collection`),i=r.getLastNode(void 0,{skip:sf(e)}),a=r.getNodeValue(i);uf(e,a)?U(()=>Qd(n,a)):Qd(n,a)},focusBranchFirstNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.findNode(t.id),o=i.getFirstNode(a,{skip:sf(e)});if(!o)return;let s=i.getNodeValue(o);uf(e,s)?U(()=>Qd(r,s)):Qd(r,s)},focusTreeNextNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getNextNode(t.id,{skip:sf(e)});if(!a)return;let o=i.getNodeValue(a);uf(e,o)?U(()=>Qd(r,o)):Qd(r,o)},focusTreePrevNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getPreviousNode(t.id,{skip:sf(e)});if(!a)return;let o=i.getNodeValue(a);uf(e,o)?U(()=>Qd(r,o)):Qd(r,o)},focusBranchNode(e){let{event:t,prop:n,scope:r}=e,i=n(`collection`),a=i.getParentNode(t.id),o=a?i.getNodeValue(a):void 0;o&&(uf(e,o)?U(()=>Qd(r,o)):Qd(r,o))},selectAllNodes({context:e,prop:t}){e.set(`selectedValue`,t(`collection`).getValues())},focusMatchedNode(e){let{context:t,prop:n,refs:r,event:i,scope:a,computed:o}=e,s=Ks(o(`visibleNodes`).map(({node:e})=>({textContent:n(`collection`).stringifyNode(e),id:n(`collection`).getNodeValue(e)})),{state:r.get(`typeaheadState`),activeId:t.get(`focusedValue`),key:i.key});s?.id&&(uf(e,s.id)?U(()=>Qd(a,s.id)):Qd(a,s.id))},toggleNodeSelection({context:e,event:t}){let n=He(e.get(`selectedValue`),t.id);e.set(`selectedValue`,n)},expandAllBranches(e){let{context:t,prop:n}=e;of(e,Je(n(`collection`).getBranchValues(),t.get(`expandedValue`)))},expandSiblingBranches(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getIndexPath(n.id);a&&of(e,Je(i.getSiblingNodes(a).map(e=>i.getNodeValue(e)),t.get(`expandedValue`)))},extendSelectionToNode(e){let{context:t,event:n,prop:r,computed:i}=e,a=r(`collection`),o=xe(t.get(`selectedValue`))||a.getNodeValue(a.getFirstNode()),s=n.id,c=[o,s],l=0;i(`visibleNodes`).forEach(({node:e})=>{let t=a.getNodeValue(e);l===1&&c.push(t),(t===o||t===s)&&l++}),t.set(`selectedValue`,ue(c))},extendSelectionToNextNode(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getNextNode(n.id,{skip:sf(e)});if(!a)return;let o=new Set(t.get(`selectedValue`)),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set(`selectedValue`,Array.from(o)))},extendSelectionToPrevNode(e){let{context:t,event:n,prop:r}=e,i=r(`collection`),a=i.getPreviousNode(n.id,{skip:sf(e)});if(!a)return;let o=new Set(t.get(`selectedValue`)),s=i.getNodeValue(a);s!=null&&(o.has(n.id)&&o.has(s)?o.delete(n.id):o.has(s)||o.add(s),t.set(`selectedValue`,Array.from(o)))},extendSelectionToFirstNode(e){let{context:t,prop:n}=e,r=n(`collection`),i=xe(t.get(`selectedValue`)),a=[];r.visit({skip:sf(e),onEnter:e=>{let t=r.getNodeValue(e);if(a.push(t),t===i)return`stop`}}),t.set(`selectedValue`,a)},extendSelectionToLastNode(e){let{context:t,prop:n}=e,r=n(`collection`),i=xe(t.get(`selectedValue`)),a=[],o=!1;r.visit({skip:sf(e),onEnter:e=>{let t=r.getNodeValue(e);t===i&&(o=!0),o&&a.push(t)}}),t.set(`selectedValue`,a)},clearPendingAborts({refs:e}){let t=e.get(`pendingAborts`);t.forEach(e=>e.abort()),t.clear()},toggleChecked({context:e,event:t,prop:n}){let r=n(`collection`);e.set(`checkedValue`,e=>t.isBranch?nf(r,t.value,e):He(e,t.value))},setChecked({context:e,event:t}){e.set(`checkedValue`,t.value)},clearChecked({context:e}){e.set(`checkedValue`,[])},setRenamingValue({context:e,event:t,prop:n}){e.set(`renamingValue`,t.value);let r=n(`onRenameStart`);if(r){let e=n(`collection`),i=e.getIndexPath(t.value);if(i){let n=e.at(i);n&&r({value:t.value,node:n,indexPath:i})}}},submitRenaming({context:e,event:t,prop:n,scope:r}){let i=e.get(`renamingValue`);if(!i)return;let a=n(`collection`).getIndexPath(i);if(!a)return;let o=t.label.trim(),s=n(`onBeforeRename`);if(s&&!s({value:i,label:o,indexPath:a})){e.set(`renamingValue`,null),Qd(r,i);return}n(`onRenameComplete`)?.({value:i,label:o,indexPath:a}),e.set(`renamingValue`,null),Qd(r,i)},cancelRenaming({context:e,scope:t}){let n=e.get(`renamingValue`);e.set(`renamingValue`,null),n&&Qd(t,n)},syncRenameInput({context:e,scope:t,prop:n}){let r=e.get(`renamingValue`);if(!r)return;let i=n(`collection`),a=i.findNode(r);if(!a)return;let o=i.stringifyNode(a);us(ef(t,r),o)},focusRenameInput({context:e,scope:t}){let n=e.get(`renamingValue`);if(!n)return;let r=ef(t,n);r&&(r.focus(),r.select())}}}});function uf(e,t){let{prop:n,scope:r,computed:i}=e,a=n(`scrollToIndexFn`);if(!a)return!1;let o=n(`collection`),s=i(`visibleNodes`);for(let e=0;e<s.length;e++){let{node:n,indexPath:i}=s[e];if(o.getNodeValue(n)===t)return a({index:e,node:n,indexPath:i,getElement:()=>r.getById(Xd(r,t))}),!0}return!1}var df=e=>{let t=(0,K.useId)(),{dir:n}=ze(),{getRootNode:r}=Ce();return af(qe(lf,{id:t,dir:n,getRootNode:r,...e}),Ve)},ff=(0,K.forwardRef)((e,t)=>{let[n,r]=$s(e),[{value:i},a]=De()(r,[`value`]),o=G(i.getRootProps(),a);return(0,Q.jsx)(Od,{value:i,children:(0,Q.jsx)(Zs,{value:n,children:(0,Q.jsx)(tt.div,{...o,ref:t})})})}),pf=(0,K.forwardRef)((e,t)=>{let n=G(kd().getTreeProps(),e);return(0,Q.jsx)(tt.div,{...n,ref:t})});pf.displayName=`TreeViewTree`;var mf=Ze(`select`).parts(`label`,`positioner`,`trigger`,`indicator`,`clearTrigger`,`item`,`itemText`,`itemIndicator`,`itemGroup`,`itemGroupLabel`,`list`,`content`,`root`,`control`,`valueText`),hf=mf.build(),gf=e=>new Nu(e);gf.empty=()=>new Nu({items:[]});var _f=e=>e.ids?.root??`select:${e.id}`,vf=e=>e.ids?.content??`select:${e.id}:content`,yf=e=>e.ids?.trigger??`select:${e.id}:trigger`,bf=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,xf=e=>e.ids?.label??`select:${e.id}:label`,Sf=e=>e.ids?.control??`select:${e.id}:control`,Cf=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,wf=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,Tf=e=>e.ids?.positioner??`select:${e.id}:positioner`,Ef=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,Df=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Of=e=>e.getById(wf(e)),kf=e=>e.getById(vf(e)),Af=e=>e.getById(yf(e)),jf=e=>e.getById(bf(e)),Mf=e=>e.getById(Tf(e)),Nf=(e,t)=>t==null?null:e.getById(Cf(e,t));function Pf(e,t){let{context:n,prop:r,scope:i,state:a,computed:o,send:s}=e,c=r(`translations`),l=r(`disabled`)||n.get(`fieldsetDisabled`),u=!!r(`invalid`),d=!!r(`required`),f=!!r(`readOnly`),p=r(`composite`),m=r(`collection`),h=a.hasTag(`open`),g=a.matches(`focused`),_=n.get(`highlightedValue`),v=n.get(`highlightedItem`),y=o(`selectedItems`),b=n.get(`currentPlacement`),x=o(`isTypingAhead`),S=o(`isInteractive`),C=_?Cf(i,_):void 0;function w(e){let t=m.getItemDisabled(e.item),r=m.getItemValue(e.item);return we(r,()=>`[zag-js] No value found for item ${JSON.stringify(e.item)}`),{value:r,disabled:!!(l||t),highlighted:_===r,selected:n.get(`value`).includes(r)}}let T=ot({...r(`positioning`),placement:b});return{open:h,focused:g,empty:n.get(`value`).length===0,highlightedItem:v,highlightedValue:_,selectedItems:y,hasSelectedItems:o(`hasSelectedItems`),value:n.get(`value`),valueAsString:o(`valueAsString`),collection:m,multiple:!!r(`multiple`),disabled:!!l,reposition(e={}){s({type:`POSITIONING.SET`,options:e})},focus(){Af(i)?.focus({preventScroll:!0})},setOpen(e){a.hasTag(`open`)!==e&&s({type:e?`OPEN`:`CLOSE`})},selectValue(e){s({type:`ITEM.SELECT`,value:e})},setValue(e){s({type:`VALUE.SET`,value:e})},selectAll(){s({type:`VALUE.SET`,value:m.getValues()})},setHighlightValue(e){s({type:`HIGHLIGHTED_VALUE.SET`,value:e})},clearHighlightValue(){s({type:`HIGHLIGHTED_VALUE.CLEAR`})},clearValue(e){s(e?{type:`ITEM.CLEAR`,value:e}:{type:`VALUE.CLEAR`})},getItemState:w,getRootProps(){return t.element({...hf.root.attrs,dir:r(`dir`),id:_f(i),"data-invalid":W(u),"data-readonly":W(f)})},getLabelProps(){return t.label({dir:r(`dir`),id:xf(i),...hf.label.attrs,"data-disabled":W(l),"data-invalid":W(u),"data-readonly":W(f),"data-required":W(d),htmlFor:wf(i),onClick(e){e.defaultPrevented||l||Af(i)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...hf.control.attrs,dir:r(`dir`),id:Sf(i),"data-state":h?`open`:`closed`,"data-focus":W(g),"data-disabled":W(l),"data-invalid":W(u)})},getValueTextProps(){return t.element({...hf.valueText.attrs,dir:r(`dir`),"data-disabled":W(l),"data-invalid":W(u),"data-focus":W(g)})},getTriggerProps(){return t.button({id:yf(i),disabled:l,dir:r(`dir`),type:`button`,role:`combobox`,"aria-controls":vf(i),"aria-expanded":h,"aria-haspopup":`listbox`,"data-state":h?`open`:`closed`,"aria-invalid":u,"aria-required":d,"aria-labelledby":xf(i),...hf.trigger.attrs,"data-disabled":W(l),"data-invalid":W(u),"data-readonly":W(f),"data-placement":b,"data-placeholder-shown":W(!o(`hasSelectedItems`)),onClick(e){S&&(e.defaultPrevented||s({type:`TRIGGER.CLICK`}))},onFocus(){s({type:`TRIGGER.FOCUS`})},onBlur(){s({type:`TRIGGER.BLUR`})},onKeyDown(e){if(e.defaultPrevented||!S)return;let t={ArrowUp(){s({type:`TRIGGER.ARROW_UP`})},ArrowDown(e){s({type:e.altKey?`OPEN`:`TRIGGER.ARROW_DOWN`})},ArrowLeft(){s({type:`TRIGGER.ARROW_LEFT`})},ArrowRight(){s({type:`TRIGGER.ARROW_RIGHT`})},Home(){s({type:`TRIGGER.HOME`})},End(){s({type:`TRIGGER.END`})},Enter(){s({type:`TRIGGER.ENTER`})},Space(e){s(x?{type:`TRIGGER.TYPEAHEAD`,key:e.key}:{type:`TRIGGER.ENTER`})}}[F(e,{dir:r(`dir`),orientation:`vertical`})];if(t){t(e),e.preventDefault();return}Ks.isValidEvent(e)&&(s({type:`TRIGGER.TYPEAHEAD`,key:e.key}),e.preventDefault())}})},getIndicatorProps(){return t.element({...hf.indicator.attrs,dir:r(`dir`),"aria-hidden":!0,"data-state":h?`open`:`closed`,"data-disabled":W(l),"data-invalid":W(u),"data-readonly":W(f)})},getItemProps(n){let a=w(n);return t.element({id:Cf(i,a.value),role:`option`,...hf.item.attrs,dir:r(`dir`),"data-value":a.value,"aria-selected":a.selected,"data-state":a.selected?`checked`:`unchecked`,"data-highlighted":W(a.highlighted),"data-disabled":W(a.disabled),"aria-disabled":ye(a.disabled),onPointerMove(e){a.disabled||e.pointerType!==`mouse`||a.value!==_&&s({type:`ITEM.POINTER_MOVE`,value:a.value})},onClick(e){e.defaultPrevented||a.disabled||s({type:`ITEM.CLICK`,src:`pointerup`,value:a.value})},onPointerLeave(t){a.disabled||n.persistFocus||t.pointerType===`mouse`&&e.event.previous()?.type.includes(`POINTER`)&&s({type:`ITEM.POINTER_LEAVE`})}})},getItemTextProps(e){let n=w(e);return t.element({...hf.itemText.attrs,"data-state":n.selected?`checked`:`unchecked`,"data-disabled":W(n.disabled),"data-highlighted":W(n.highlighted)})},getItemIndicatorProps(e){let n=w(e);return t.element({"aria-hidden":!0,...hf.itemIndicator.attrs,"data-state":n.selected?`checked`:`unchecked`,hidden:!n.selected})},getItemGroupLabelProps(e){let{htmlFor:n}=e;return t.element({...hf.itemGroupLabel.attrs,id:Df(i,n),dir:r(`dir`),role:`presentation`})},getItemGroupProps(e){let{id:n}=e;return t.element({...hf.itemGroup.attrs,"data-disabled":W(l),id:Ef(i,n),"aria-labelledby":Df(i,n),role:`group`,dir:r(`dir`)})},getClearTriggerProps(){return t.button({...hf.clearTrigger.attrs,id:bf(i),type:`button`,"aria-label":c.clearTriggerLabel,"data-invalid":W(u),disabled:l,hidden:!o(`hasSelectedItems`),dir:r(`dir`),onClick(e){e.defaultPrevented||s({type:`CLEAR.CLICK`})}})},getHiddenSelectProps(){let e=n.get(`value`),a=r(`multiple`)?e:e?.[0],o=e=>{gs(je(e))||s({type:`VALUE.SET`,value:Ff(e.currentTarget)})};return t.select({name:r(`name`),form:r(`form`),disabled:l,multiple:r(`multiple`),required:r(`required`),"aria-hidden":!0,id:wf(i),defaultValue:a,style:Js,tabIndex:-1,autoComplete:r(`autoComplete`),onChange:o,onInput:o,onFocus(){Af(i)?.focus({preventScroll:!0})},"aria-labelledby":xf(i)})},getPositionerProps(){return t.element({...hf.positioner.attrs,dir:r(`dir`),id:Tf(i),style:T.floating})},getContentProps(){return t.element({hidden:!h,dir:r(`dir`),id:vf(i),role:p?`listbox`:`dialog`,...hf.content.attrs,"data-state":h?`open`:`closed`,"data-placement":b,"data-activedescendant":C,"aria-activedescendant":p?C:void 0,"aria-multiselectable":r(`multiple`)&&p?!0:void 0,"aria-labelledby":xf(i),tabIndex:0,onKeyDown(e){if(!S||!pe(e.currentTarget,N(e)))return;if(e.key===`Tab`&&!Fs(e)){e.preventDefault();return}let t={ArrowUp(){s({type:`CONTENT.ARROW_UP`})},ArrowDown(){s({type:`CONTENT.ARROW_DOWN`})},Home(){s({type:`CONTENT.HOME`})},End(){s({type:`CONTENT.END`})},Enter(){s({type:`ITEM.CLICK`,src:`keydown.enter`})},Space(e){x?s({type:`CONTENT.TYPEAHEAD`,key:e.key}):t.Enter?.(e)}},n=t[F(e)];if(n){n(e),e.preventDefault();return}M(N(e))||Ks.isValidEvent(e)&&(s({type:`CONTENT.TYPEAHEAD`,key:e.key}),e.preventDefault())}})},getListProps(){return t.element({...hf.list.attrs,tabIndex:0,role:p?void 0:`listbox`,"aria-labelledby":yf(i),"aria-activedescendant":p?void 0:C,"aria-multiselectable":!p&&r(`multiple`)?!0:void 0})}}}var Ff=e=>e.multiple?Array.from(e.selectedOptions,e=>e.value):e.value?[e.value]:[],{and:If,not:Lf,or:Rf}=Se(),zf=Me({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??gf.empty(),translations:{clearTriggerLabel:`Clear value`,...e.translations},positioning:{placement:`bottom-start`,gutter:8,...e.positioning}}},context({prop:e,bindable:t,getContext:n}){let r=e(`value`)??e(`defaultValue`)??[],i=e(`collection`).findMany(r);return{value:t(()=>({defaultValue:e(`defaultValue`),value:e(`value`),isEqual:Zo,onChange(t){let r=n(),i=e(`collection`),a=zu({values:t,collection:i,selectedItemMap:r.get(`selectedItemMap`)}),o=e(`value`)??t,s=o===t?a:zu({values:o,collection:i,selectedItemMap:a.nextSelectedItemMap});return r.set(`selectedItemMap`,s.nextSelectedItemMap),e(`onValueChange`)?.({value:t,items:a.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e(`defaultHighlightedValue`)||null,value:e(`highlightedValue`),onChange(t){e(`onHighlightChange`)?.({highlightedValue:t,highlightedItem:e(`collection`).find(t),highlightedIndex:e(`collection`).indexOf(t)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:Bu({selectedItems:i,collection:e(`collection`)})}))}},refs(){return{typeahead:{...Ks.defaultOptions}}},computed:{hasSelectedItems:({context:e})=>e.get(`value`).length>0,isTypingAhead:({refs:e})=>e.get(`typeahead`).keysSoFar!==``,isDisabled:({prop:e,context:t})=>!!e(`disabled`)||!!t.get(`fieldsetDisabled`),isInteractive:({prop:e})=>!(e(`disabled`)||e(`readOnly`)),selectedItems:({context:e,prop:t})=>Lu({values:e.get(`value`),collection:t(`collection`),selectedItemMap:e.get(`selectedItemMap`)}),valueAsString:({computed:e,prop:t})=>t(`collection`).stringifyItems(e(`selectedItems`))},initialState({prop:e}){return e(`open`)||e(`defaultOpen`)?`open`:`idle`},entry:[`syncSelectElement`],watch({context:e,prop:t,track:n,action:r}){n([()=>e.get(`value`).toString()],()=>{r([`syncSelectedItems`,`syncSelectElement`,`dispatchChangeEvent`])}),n([()=>t(`open`)],()=>{r([`toggleVisibility`])}),n([()=>e.get(`highlightedValue`)],()=>{r([`syncHighlightedItem`])}),n([()=>t(`collection`).toString()],()=>{r([`syncCollection`])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:[`setHighlightedItem`]},"HIGHLIGHTED_VALUE.CLEAR":{actions:[`clearHighlightedItem`]},"ITEM.SELECT":{actions:[`selectItem`]},"ITEM.CLEAR":{actions:[`clearItem`]},"VALUE.SET":{actions:[`setSelectedItems`]},"VALUE.CLEAR":{actions:[`clearSelectedItems`]},"CLEAR.CLICK":{actions:[`clearSelectedItems`,`focusTriggerEl`]}},effects:[`trackFormControlState`],states:{idle:{tags:[`closed`],on:{"CONTROLLED.OPEN":[{guard:`isTriggerClickEvent`,target:`open`,actions:[`setInitialFocus`,`highlightFirstSelectedItem`]},{target:`open`,actions:[`setInitialFocus`]}],"TRIGGER.CLICK":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`invokeOnOpen`,`setInitialFocus`,`highlightFirstSelectedItem`]}],"TRIGGER.FOCUS":{target:`focused`},OPEN:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`]}]}},focused:{tags:[`closed`],on:{"CONTROLLED.OPEN":[{guard:`isTriggerClickEvent`,target:`open`,actions:[`setInitialFocus`,`highlightFirstSelectedItem`]},{guard:`isTriggerArrowUpEvent`,target:`open`,actions:[`setInitialFocus`,`highlightComputedLastItem`]},{guard:Rf(`isTriggerArrowDownEvent`,`isTriggerEnterEvent`),target:`open`,actions:[`setInitialFocus`,`highlightComputedFirstItem`]},{target:`open`,actions:[`setInitialFocus`]}],OPEN:[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`]}],"TRIGGER.BLUR":{target:`idle`},"TRIGGER.CLICK":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`,`highlightFirstSelectedItem`]}],"TRIGGER.ENTER":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`,`highlightComputedFirstItem`]}],"TRIGGER.ARROW_UP":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`,`highlightComputedLastItem`]}],"TRIGGER.ARROW_DOWN":[{guard:`isOpenControlled`,actions:[`invokeOnOpen`]},{target:`open`,actions:[`setInitialFocus`,`invokeOnOpen`,`highlightComputedFirstItem`]}],"TRIGGER.ARROW_LEFT":[{guard:If(Lf(`multiple`),`hasSelectedItems`),actions:[`selectPreviousItem`]},{guard:Lf(`multiple`),actions:[`selectLastItem`]}],"TRIGGER.ARROW_RIGHT":[{guard:If(Lf(`multiple`),`hasSelectedItems`),actions:[`selectNextItem`]},{guard:Lf(`multiple`),actions:[`selectFirstItem`]}],"TRIGGER.HOME":{guard:Lf(`multiple`),actions:[`selectFirstItem`]},"TRIGGER.END":{guard:Lf(`multiple`),actions:[`selectLastItem`]},"TRIGGER.TYPEAHEAD":{guard:Lf(`multiple`),actions:[`selectMatchingItem`]}}},open:{tags:[`open`],exit:[`scrollContentToTop`],effects:[`trackDismissableElement`,`trackFocusVisible`,`computePlacement`,`scrollToHighlightedItem`],on:{"CONTROLLED.CLOSE":[{guard:`restoreFocus`,target:`focused`,actions:[`focusTriggerEl`,`clearHighlightedItem`]},{target:`idle`,actions:[`clearHighlightedItem`]}],CLOSE:[{guard:`isOpenControlled`,actions:[`invokeOnClose`]},{guard:`restoreFocus`,target:`focused`,actions:[`invokeOnClose`,`focusTriggerEl`,`clearHighlightedItem`]},{target:`idle`,actions:[`invokeOnClose`,`clearHighlightedItem`]}],"TRIGGER.CLICK":[{guard:`isOpenControlled`,actions:[`invokeOnClose`]},{target:`focused`,actions:[`invokeOnClose`,`clearHighlightedItem`]}],"ITEM.CLICK":[{guard:If(`closeOnSelect`,`isOpenControlled`),actions:[`selectHighlightedItem`,`invokeOnClose`]},{guard:`closeOnSelect`,target:`focused`,actions:[`selectHighlightedItem`,`invokeOnClose`,`focusTriggerEl`,`clearHighlightedItem`]},{actions:[`selectHighlightedItem`]}],"CONTENT.HOME":{actions:[`highlightFirstItem`]},"CONTENT.END":{actions:[`highlightLastItem`]},"CONTENT.ARROW_DOWN":[{guard:If(`hasHighlightedItem`,`loop`,`isLastItemHighlighted`),actions:[`highlightFirstItem`]},{guard:`hasHighlightedItem`,actions:[`highlightNextItem`]},{actions:[`highlightFirstItem`]}],"CONTENT.ARROW_UP":[{guard:If(`hasHighlightedItem`,`loop`,`isFirstItemHighlighted`),actions:[`highlightLastItem`]},{guard:`hasHighlightedItem`,actions:[`highlightPreviousItem`]},{actions:[`highlightLastItem`]}],"CONTENT.TYPEAHEAD":{actions:[`highlightMatchingItem`]},"ITEM.POINTER_MOVE":{actions:[`highlightItem`]},"ITEM.POINTER_LEAVE":{actions:[`clearHighlightedItem`]},"POSITIONING.SET":{actions:[`reposition`]}}}},implementations:{guards:{loop:({prop:e})=>!!e(`loopFocus`),multiple:({prop:e})=>!!e(`multiple`),hasSelectedItems:({computed:e})=>!!e(`hasSelectedItems`),hasHighlightedItem:({context:e})=>e.get(`highlightedValue`)!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get(`highlightedValue`)===t(`collection`).firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get(`highlightedValue`)===t(`collection`).lastValue,closeOnSelect:({prop:e,event:t})=>!!(t.closeOnSelect??e(`closeOnSelect`)),restoreFocus:({event:e})=>Bf(e),isOpenControlled:({prop:e})=>e(`open`)!==void 0,isTriggerClickEvent:({event:e})=>e.previousEvent?.type===`TRIGGER.CLICK`,isTriggerEnterEvent:({event:e})=>e.previousEvent?.type===`TRIGGER.ENTER`,isTriggerArrowUpEvent:({event:e})=>e.previousEvent?.type===`TRIGGER.ARROW_UP`,isTriggerArrowDownEvent:({event:e})=>e.previousEvent?.type===`TRIGGER.ARROW_DOWN`},effects:{trackFocusVisible({scope:e}){return pt({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return ms(Of(t),{onFieldsetDisabledChange(t){e.set(`fieldsetDisabled`,t)},onFormReset(){let t=e.initial(`value`);e.set(`value`,t)}})},trackDismissableElement({scope:e,send:t,prop:n}){let r=()=>kf(e),i=!0;return rl(r,{type:`listbox`,defer:!0,exclude:[Af(e),jf(e)],onFocusOutside:n(`onFocusOutside`),onPointerDownOutside:n(`onPointerDownOutside`),onInteractOutside(e){n(`onInteractOutside`)?.(e),i=!(e.detail.focusable||e.detail.contextmenu)},onDismiss(){t({type:`CLOSE`,src:`interact-outside`,restoreFocus:i})}})},computePlacement({context:e,prop:t,scope:n}){let r=t(`positioning`);return e.set(`currentPlacement`,r.placement),ht(()=>Af(n),()=>Mf(n),{defer:!0,...r,onComplete(t){e.set(`currentPlacement`,t.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){let r=r=>{let i=e.get(`highlightedValue`);if(i==null||vt()===`pointer`)return;let a=kf(n),o=t(`scrollToIndexFn`);if(o){let e=t(`collection`).indexOf(i);o?.({index:e,immediate:r,getElement:()=>Nf(n,i)});return}at(Nf(n,i),{rootEl:a,block:`nearest`})};return U(()=>{st(`virtual`),r(!0)}),Ls(()=>kf(n),{defer:!0,attributes:[`data-activedescendant`],callback(){r(!1)}})}},actions:{reposition({context:e,prop:t,scope:n,event:r}){ht(Af(n),()=>Mf(n),{...t(`positioning`),...r.options,defer:!0,listeners:!1,onComplete(t){e.set(`currentPlacement`,t.placement)}})},toggleVisibility({send:e,prop:t,event:n}){e({type:t(`open`)?`CONTROLLED.OPEN`:`CONTROLLED.CLOSE`,previousEvent:n})},highlightPreviousItem({context:e,prop:t}){let n=e.get(`highlightedValue`);if(n==null)return;let r=t(`collection`).getPreviousValue(n,1,t(`loopFocus`));r!=null&&e.set(`highlightedValue`,r)},highlightNextItem({context:e,prop:t}){let n=e.get(`highlightedValue`);if(n==null)return;let r=t(`collection`).getNextValue(n,1,t(`loopFocus`));r!=null&&e.set(`highlightedValue`,r)},highlightFirstItem({context:e,prop:t}){let n=t(`collection`).firstValue;e.set(`highlightedValue`,n)},highlightLastItem({context:e,prop:t}){let n=t(`collection`).lastValue;e.set(`highlightedValue`,n)},setInitialFocus({scope:e}){U(()=>{Ps({root:kf(e)})?.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){Bf(e)&&U(()=>{Af(t)?.focus({preventScroll:!0})})},selectHighlightedItem({context:e,prop:t,event:n}){let r=n.value??e.get(`highlightedValue`);r==null||!t(`collection`).has(r)||(t(`onSelect`)?.({value:r}),r=t(`deselectable`)&&!t(`multiple`)&&e.get(`value`).includes(r)?null:r,e.set(`value`,e=>r==null?[]:t(`multiple`)?He(e,r):[r]))},highlightComputedFirstItem({context:e,prop:t,computed:n}){let r=t(`collection`),i=n(`hasSelectedItems`)?r.sort(e.get(`value`))[0]:r.firstValue;e.set(`highlightedValue`,i)},highlightComputedLastItem({context:e,prop:t,computed:n}){let r=t(`collection`),i=n(`hasSelectedItems`)?r.sort(e.get(`value`))[0]:r.lastValue;e.set(`highlightedValue`,i)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n(`hasSelectedItems`))return;let r=t(`collection`).sort(e.get(`value`))[0];e.set(`highlightedValue`,r)},highlightItem({context:e,event:t}){e.set(`highlightedValue`,t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t(`collection`).search(n.key,{state:r.get(`typeahead`),currentValue:e.get(`highlightedValue`)});i!=null&&e.set(`highlightedValue`,i)},setHighlightedItem({context:e,event:t}){e.set(`highlightedValue`,t.value)},clearHighlightedItem({context:e}){e.set(`highlightedValue`,null)},selectItem({context:e,prop:t,event:n}){t(`onSelect`)?.({value:n.value});let r=t(`deselectable`)&&!t(`multiple`)&&e.get(`value`).includes(n.value)?null:n.value;e.set(`value`,e=>r==null?[]:t(`multiple`)?He(e,r):[r])},clearItem({context:e,event:t}){e.set(`value`,e=>e.filter(e=>e!==t.value))},setSelectedItems({context:e,event:t}){e.set(`value`,t.value)},clearSelectedItems({context:e}){e.set(`value`,[])},selectPreviousItem({context:e,prop:t}){let[n]=e.get(`value`),r=t(`collection`).getPreviousValue(n);r&&e.set(`value`,[r])},selectNextItem({context:e,prop:t}){let[n]=e.get(`value`),r=t(`collection`).getNextValue(n);r&&e.set(`value`,[r])},selectFirstItem({context:e,prop:t}){let n=t(`collection`).firstValue;n&&e.set(`value`,[n])},selectLastItem({context:e,prop:t}){let n=t(`collection`).lastValue;n&&e.set(`value`,[n])},selectMatchingItem({context:e,prop:t,event:n,refs:r}){let i=t(`collection`).search(n.key,{state:r.get(`typeahead`),currentValue:e.get(`value`)[0]});i!=null&&e.set(`value`,[i])},scrollContentToTop({prop:e,scope:t}){if(e(`scrollToIndexFn`)){let n=e(`collection`).firstValue;e(`scrollToIndexFn`)?.({index:0,immediate:!0,getElement:()=>Nf(t,n)})}else kf(t)?.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){e(`onOpenChange`)?.({open:!0,value:t.get(`value`)})},invokeOnClose({prop:e,context:t}){e(`onOpenChange`)?.({open:!1,value:t.get(`value`)})},syncSelectElement({context:e,prop:t,scope:n}){let r=Of(n);if(r){if(e.get(`value`).length===0&&!t(`multiple`)){r.selectedIndex=-1;return}for(let t of r.options)t.selected=e.get(`value`).includes(t.value)}},syncCollection({context:e,prop:t}){let n=t(`collection`),r=n.find(e.get(`highlightedValue`));r&&e.set(`highlightedItem`,r);let i=zu({values:e.get(`value`),collection:n,selectedItemMap:e.get(`selectedItemMap`)});e.set(`selectedItemMap`,i.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){let n=zu({values:e.get(`value`),collection:t(`collection`),selectedItemMap:e.get(`selectedItemMap`)});e.set(`selectedItemMap`,n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){let n=t(`collection`),r=e.get(`highlightedValue`),i=r?n.find(r):null;e.set(`highlightedItem`,i)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{let t=Of(e);if(!t)return;let n=new(e.getWin()).Event(`change`,{bubbles:!0,composed:!0});t.dispatchEvent(_s(n))})}}}});function Bf(e){let t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}var Vf=e=>{let{node:t}=e;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(yt,{lazyMount:!0,children:[(0,Q.jsx)(ft,{children:(0,Q.jsxs)(`span`,{className:x(`font-medium whitespace-nowrap`,t.original.isBarrelFile&&`underline decoration-amber-600 decoration-2`,e.isCircular&&`text-red-400`),children:[(t.original.isBarrelFile||e.isCircular)&&`⚠️ `,t.name,t.original.isBarrelFile&&` (barrel ${t.original.exports.length} exports)`,e.isCircular&&` (circular)`,e.hasReachedMaxDepth&&` (max depth reached)`]})}),(0,Q.jsx)(_t,{className:`max-w-[auto]`,children:e.visited?.size?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{children:`Imported by:`}),[...e.visited].map((e,n)=>(0,Q.jsxs)(`span`,{className:x(e===t.id&&`text-red-400`),style:{paddingLeft:`${n*10}px`},children:[`->`,` `,e]},e)),(0,Q.jsxs)(`span`,{className:`text-red-400`,style:{paddingLeft:`${[...e.visited].length*10}px`},children:[`->`,` `,t.id]})]}):t.id})]}),e.focusedNodeId!==t.id&&(0,Q.jsx)(it,{className:`ml-auto`,variant:`ghost`,size:`icon`,onClickCapture:e=>{e.stopPropagation(),g.set(t.id),p.set(!0)},children:(0,Q.jsx)(wu,{className:`text-slate-400`})}),(0,Q.jsx)(it,{className:`ml-auto`,variant:`ghost`,size:`icon`,onClickCapture:e=>{e.stopPropagation(),console.log(t)},children:(0,Q.jsx)(Su,{className:`text-slate-400`})})]})},Hf=e=>{let{node:t,indexPath:n}=e;return(0,Q.jsx)(Gd,{node:t,indexPath:n,children:t.children?.length?(0,Q.jsxs)(Pd,{onClick:()=>console.log(n,t),children:[(0,Q.jsxs)(Rd,{className:`group flex w-full items-center gap-2 rounded-lg py-0.5 text-sm font-medium whitespace-nowrap transition-all duration-200 hover:bg-slate-50 dark:hover:bg-slate-800/50 data-[state=open]:text-slate-900 dark:data-[state=open]:text-slate-100`,children:[(0,Q.jsx)(Bd,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Q.jsx)(w,{className:`h-3.5 w-3.5 text-slate-400 transition-transform duration-200 group-data-[state=open]:rotate-90 group-data-[state=open]:text-slate-600`})}),(0,Q.jsx)(Vd,{className:`flex items-center gap-2.5 text-slate-700 dark:text-slate-300 group-data-[state=open]:text-slate-900 dark:group-data-[state=open]:text-slate-100`,children:(0,Q.jsx)(Vf,{node:t,focusedNodeId:e.focusedNodeId})})]}),(0,Q.jsxs)(Ld,{className:`ml-6 border-l border-slate-200 pl-2 dark:border-slate-700/60`,children:[(0,Q.jsx)(zd,{}),t.children.map((t,r)=>e.visited.has(t.id)?(0,Q.jsxs)(Hd,{onClick:()=>console.log([...n,r],t),className:`group flex w-full items-center gap-2 rounded-lg py-1 text-sm font-medium whitespace-nowrap transition-all duration-200 hover:bg-slate-50 dark:hover:bg-slate-800/50 data-[selected]:bg-blue-50 dark:data-[selected]:bg-blue-900/30 data-[selected]:text-blue-700 dark:data-[selected]:text-blue-300 data-[selected]:shadow-sm data-[selected]:ring-1 data-[selected]:ring-blue-200 dark:data-[selected]:ring-blue-800/30`,children:[(0,Q.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-slate-300 dark:bg-slate-600 group-data-[selected]:bg-blue-500`})}),(0,Q.jsxs)(Ud,{className:`flex items-center gap-2.5 text-slate-600 dark:text-slate-400 group-data-[selected]:text-blue-700 dark:group-data-[selected]:text-blue-300`,children:[(0,Q.jsx)(xu,{className:`h-4 w-4 text-slate-400 group-data-[selected]:text-blue-500`}),(0,Q.jsx)(Vf,{node:t,isCircular:!0,visited:e.visited,focusedNodeId:e.focusedNodeId})]})]},t.id):e.currentDepth>=e.maxDepth?(0,Q.jsxs)(Hd,{onClick:()=>console.log([...n,r],t),className:`group flex w-full items-center gap-2 rounded-lg py-1 text-sm font-medium whitespace-nowrap transition-all duration-200 hover:bg-slate-50 dark:hover:bg-slate-800/50 data-[selected]:bg-blue-50 dark:data-[selected]:bg-blue-900/30 data-[selected]:text-blue-700 dark:data-[selected]:text-blue-300 data-[selected]:shadow-sm data-[selected]:ring-1 data-[selected]:ring-blue-200 dark:data-[selected]:ring-blue-800/30`,children:[(0,Q.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-slate-300 dark:bg-slate-600 group-data-[selected]:bg-blue-500`})}),(0,Q.jsxs)(Ud,{className:`flex items-center gap-2.5 text-slate-600 dark:text-slate-400 group-data-[selected]:text-blue-700 dark:group-data-[selected]:text-blue-300`,children:[(0,Q.jsx)(vu,{className:`h-4 w-4 text-slate-400 group-data-[selected]:text-blue-500`}),(0,Q.jsx)(Vf,{node:t,hasReachedMaxDepth:!0,focusedNodeId:e.focusedNodeId})]})]},t.id):(0,Q.jsx)(Hf,{node:t,indexPath:[...n,r],visited:new Set([...e.visited,t.id]),currentDepth:e.currentDepth+1,maxDepth:e.maxDepth,focusedNodeId:e.focusedNodeId},t.id))]})]}):(0,Q.jsxs)(Hd,{onClick:()=>console.log(n,t),className:`group flex w-full items-center gap-2 rounded-lg py-1 text-sm font-medium whitespace-nowrap transition-all duration-200 hover:bg-slate-50 dark:hover:bg-slate-800/50 data-[selected]:bg-blue-50 dark:data-[selected]:bg-blue-900/30 data-[selected]:text-blue-700 dark:data-[selected]:text-blue-300 data-[selected]:shadow-sm data-[selected]:ring-1 data-[selected]:ring-blue-200 dark:data-[selected]:ring-blue-800/30`,children:[(0,Q.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-slate-300 dark:bg-slate-600 group-data-[selected]:bg-blue-500`})}),(0,Q.jsxs)(Ud,{className:`flex items-center gap-2.5 text-slate-600 dark:text-slate-400 group-data-[selected]:text-blue-700 dark:group-data-[selected]:text-blue-300`,children:[(0,Q.jsx)(qo,{className:`h-4 w-4 text-slate-400 group-data-[selected]:text-blue-500`}),(0,Q.jsx)(Vf,{node:t,focusedNodeId:e.focusedNodeId})]})]})},t.id)};function Uf(e){let{contains:t}=ku({sensitivity:`base`}),[n,r]=(0,K.useState)(e.initialCollection),i=i=>{r(i.length>0?n.filter(e=>t(e.name,i)):e.initialCollection)},a=df({id:e.entryNodeId,collection:n,defaultExpandedValue:e.defaultExpandedValue??[e.entryNodeId],selectedValue:[]}),o=a.collection.flatten(),s=a.getVisibleNodes().map(({node:e})=>e.id),c=new Set(o.map(e=>e.id)),l=a.expandedValue.length===c.size;return(0,Q.jsxs)(`div`,{className:`w-full h-full min-h-0 flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(St,{placeholder:`Search`,onChange:e=>i(e.target.value)}),(0,Q.jsx)(`div`,{className:`ml-auto`,children:l?(0,Q.jsx)(it,{variant:`outline`,className:`px-2 py-1`,onClick:()=>a.collapse(),children:(0,Q.jsx)(Cu,{className:`h-4 w-4 text-slate-400`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Collapse all`})})}):(0,Q.jsx)(it,{variant:`outline`,className:`px-2 py-1`,onClick:()=>o.length<=500?a.expand():s.length<=500?a.expand(s):a.expand(s.slice(0,250)),children:(0,Q.jsx)(Tu,{className:`h-4 w-4 text-slate-400`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Expand all`})})})})]}),(0,Q.jsx)(`div`,{className:`w-full h-full min-h-0 overflow-auto`,children:(0,Q.jsx)(ff,{value:a,lazyMount:!0,unmountOnExit:!0,children:(0,Q.jsx)(pf,{children:n.rootNode.children?.map((t,n)=>(0,Q.jsx)(Hf,{node:t,indexPath:[n],visited:new Set([t.id]),currentDepth:0,maxDepth:100,focusedNodeId:e.entryNodeId},t.id))})})})]})}function Wf(e,t){let n=e.nodes.find(e=>e.path===t);if(!n)return null;let r={id:t,name:n.name,children:[],original:n},i=new Set,a=[{nodePath:t,parent:r,visited:new Set([t])}],o=a[0].parent;for(;a.length>0;){let{nodePath:t,parent:n,visited:r}=a.pop();i.add(t);let o=e.nodes.find(e=>e.path===t);if(!o)continue;let s={id:o.path,name:o.path.split(`/`).slice(-2).join(`/`),children:[],original:o};n.children&&n.children.push(s),o.importees.forEach(t=>{if(r.has(t)){let n=e.nodes.find(e=>e.path===t);if(!n)return;let r={id:n.path,name:n.path.split(`/`).slice(-2).join(`/`),children:[],original:n};s.children.push(r);return}r.add(t),a.push({nodePath:t,parent:s,visited:new Set([...r,t])})})}return{visited:i,collection:hd({nodeToValue:e=>e.id,nodeToString:e=>e.name,rootNode:o})}}function Gf(e,t,n=`from-current-node-to-entrypoint`){let r=e.nodes.find(e=>e.path===t);if(!r)return null;let i=r.chain.at(0)??[],a=n===`from-entrypoint-to-current-node`?i:i.reverse(),o=a[0];if(!o)return null;let s=e.nodes.find(e=>e.path===o);if(!s)return null;let c={id:o,name:s.path.split(`/`).slice(-2).join(`/`),children:[],original:s},l=c;for(let t of a){let n=e.nodes.find(e=>e.path===t);if(!n)continue;let r={id:n.path,name:n.path.split(`/`).slice(-2).join(`/`),children:[],original:n};l.children.push(r),l=r}return hd({nodeToValue:e=>e.id,nodeToString:e=>e.name,rootNode:c})}var Kf=e=>new Nu(e),[qf,Jf]=_e({name:`SelectContext`,hookName:`useSelectContext`,providerName:`<SelectProvider />`}),Yf=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getClearTriggerProps(),e);return(0,Q.jsx)(tt.button,{...n,ref:t})});Yf.displayName=`SelectClearTrigger`;var Xf=(0,K.forwardRef)((e,t)=>{let n=Jf(),r=Ne(),i=G(n.getContentProps(),r.getPresenceProps(),e);return r.unmounted?null:(0,Q.jsx)(tt.div,{...i,ref:rt(r.ref,t)})});Xf.displayName=`SelectContent`;var Zf=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getControlProps(),e);return(0,Q.jsx)(tt.div,{...n,ref:t})});Zf.displayName=`SelectControl`;var[Qf,$f]=_e({name:`FieldContext`,hookName:`useFieldContext`,providerName:`<FieldProvider />`,strict:!1}),ep=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getIndicatorProps(),e);return(0,Q.jsx)(tt.div,{...n,ref:t})});ep.displayName=`SelectIndicator`;var[tp,np]=_e({name:`SelectItemContext`,hookName:`useSelectItemContext`,providerName:`<SelectItemProvider />`}),[rp,ip]=_e({name:`SelectItemPropsContext`,hookName:`useSelectItemPropsContext`,providerName:`<SelectItemPropsProvider />`}),ap=De(),op=(0,K.forwardRef)((e,t)=>{let[n,r]=ap(e,[`item`,`persistFocus`]),i=Jf(),a=G(i.getItemProps(n),r);return(0,Q.jsx)(rp,{value:n,children:(0,Q.jsx)(tp,{value:i.getItemState(n),children:(0,Q.jsx)(tt.div,{...a,ref:t})})})});op.displayName=`SelectItem`;var[sp,cp]=_e({name:`SelectItemGroupPropsContext`,hookName:`useSelectItemGroupPropsContext`,providerName:`<SelectItemGroupPropsProvider />`}),lp=De(),up=(0,K.forwardRef)((e,t)=>{let n=(0,K.useId)(),[r,i]=lp(e,[`id`]),a={id:n,...r},o=G(Jf().getItemGroupProps(a),i);return(0,Q.jsx)(sp,{value:a,children:(0,Q.jsx)(tt.div,{...o,ref:t})})});up.displayName=`SelectItemGroup`;var dp=(0,K.forwardRef)((e,t)=>{let n=Jf(),r=cp(),i=G(n.getItemGroupLabelProps({htmlFor:r.id}),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});dp.displayName=`SelectItemGroupLabel`;var fp=(0,K.forwardRef)((e,t)=>{let n=Jf(),r=ip(),i=G(n.getItemIndicatorProps(r),e);return(0,Q.jsx)(tt.div,{...i,ref:t})});fp.displayName=`SelectItemIndicator`;var pp=(0,K.forwardRef)((e,t)=>{let n=Jf(),r=ip(),i=G(n.getItemTextProps(r),e);return(0,Q.jsx)(tt.span,{...i,ref:t})});pp.displayName=`SelectItemText`;var mp=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getLabelProps(),e);return(0,Q.jsx)(tt.label,{...n,ref:t})});mp.displayName=`SelectLabel`;var hp=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getListProps(),e);return(0,Q.jsx)(tt.div,{...n,ref:t})});hp.displayName=`SelectList`;var gp=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getPositionerProps(),e);return Ne().unmounted?null:(0,Q.jsx)(tt.div,{...n,ref:t})});gp.displayName=`SelectPositioner`;var _p=e=>{let t=(0,K.useId)(),{dir:n}=ze(),{getRootNode:r}=Ce(),i=$f();return Pf(qe(zf,{id:t,ids:{label:i?.ids.label,hiddenSelect:i?.ids.control},disabled:i?.disabled,readOnly:i?.readOnly,invalid:i?.invalid,required:i?.required,dir:n,getRootNode:r,...e}),Ve)},vp=(0,K.forwardRef)((e,t)=>{let[n,r]=Ee(e),[i,a]=De()(r,`closeOnSelect.collection.composite.defaultHighlightedValue.defaultOpen.defaultValue.deselectable.disabled.form.highlightedValue.id.ids.invalid.loopFocus.multiple.name.onFocusOutside.onHighlightChange.onInteractOutside.onOpenChange.onPointerDownOutside.onSelect.onValueChange.open.positioning.readOnly.required.scrollToIndexFn.translations.autoComplete.value`.split(`.`)),o=_p(i),s=Oe(G({present:o.open},n)),c=G(o.getRootProps(),a);return(0,Q.jsx)(qf,{value:o,children:(0,Q.jsx)(Ie,{value:s,children:(0,Q.jsx)(tt.div,{...c,ref:t})})})});(0,K.forwardRef)((e,t)=>{let[n,r]=Ee(e),[{value:i},a]=De()(r,[`value`]),o=Oe(G({present:i.open},n)),s=G(i.getRootProps(),a);return(0,Q.jsx)(qf,{value:i,children:(0,Q.jsx)(Ie,{value:o,children:(0,Q.jsx)(tt.div,{...s,ref:t})})})});var yp=(0,K.forwardRef)((e,t)=>{let n=G(Jf().getTriggerProps(),e);return(0,Q.jsx)(tt.button,{...n,ref:t})});yp.displayName=`SelectTrigger`;var bp=(0,K.forwardRef)((e,t)=>{let{children:n,placeholder:r,...i}=e,a=Jf(),o=G(a.getValueTextProps(),i);return(0,Q.jsx)(tt.span,{...o,ref:t,children:n||a.valueAsString||r})});bp.displayName=`SelectValueText`;var xp=mf.extendWith(`separator`).build(),Sp=K.forwardRef((e,t)=>(0,Q.jsx)(vp,{ref:t,...e}));Sp.displayName=`Select`;var Cp=Sp,wp=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(Yf,{ref:n,className:x(`absolute end-0 top-0 flex size-9 items-center justify-center rounded-md border border-transparent text-muted-foreground/80 outline-none transition-[color,box-shadow] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,e),...t}));wp.displayName=`SelectClearTrigger`;var Tp=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(gp,{children:(0,Q.jsx)(Xf,{ref:n,className:x(`relative w-full min-w-32 overflow-hidden rounded-md border border-input bg-popover p-1 text-popover-foreground shadow-lg`,`data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=open]:animate-in`,`data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=left]:-translate-x-1 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 data-[placement=top]:-translate-y-1 data-[placement=right]:translate-x-1 data-[placement=bottom]:translate-y-1`,e),...t})}));Tp.displayName=`SelectContent`;var Ep=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(Zf,{ref:n,className:x(`relative flex min-h-[38px] rounded-md border border-input text-sm outline-none transition-[color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 has-aria-invalid:border-destructive has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40`,e),...t}));Ep.displayName=`SelectControl`;var Dp=K.forwardRef((e,t)=>(0,Q.jsx)(ep,{ref:t,...e,children:(0,Q.jsx)(C,{className:`size-4 shrink-0 in-aria-invalid:text-destructive/80 text-muted-foreground/80`})}));Dp.displayName=`SelectIndicator`;var Op=K.forwardRef(({className:e,children:t,...n},r)=>(0,Q.jsxs)(op,{ref:r,className:x(`relative flex w-full cursor-default select-none items-center rounded py-1.5 ps-8 pe-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50`,e),...n,children:[(0,Q.jsx)(`span`,{className:`absolute start-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(fp,{children:(0,Q.jsx)(S,{size:16})})}),(0,Q.jsx)(pp,{children:t})]}));Op.displayName=`SelectItem`;var kp=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(dp,{ref:n,className:x(`py-1.5 ps-8 pe-2 font-medium text-muted-foreground text-xs`,e),...t}));kp.displayName=`SelectItemGroupLabel`;var Ap=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(mp,{ref:n,className:x(`select-none font-medium text-foreground text-sm leading-4 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,e),...t}));Ap.displayName=`SelectLabel`;var jp=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(hp,{ref:n,className:x(`max-h-[min(24rem,var(--available-height))] overflow-y-auto`,e),...t}));jp.displayName=`SelectList`;var Mp=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(tt.hr,{ref:n,...xp.separator.attrs,className:x(`-mx-1 my-1 h-px bg-border`,e),...t}));Mp.displayName=`SelectSeparator`;var Np=K.forwardRef(({className:e,...t},n)=>(0,Q.jsx)(yp,{ref:n,className:x(`flex flex-1 items-center justify-between gap-1 bg-transparent px-3 py-2 outline-none outline-hidden placeholder:text-muted-foreground/70 has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 data-[placeholder-shown]:text-muted-foreground`,e),...t}));Np.displayName=`SelectTrigger`;var Pp=bp;function Fp(e){let t=u(p),n=u(g),r=n?e.output.nodes.find(e=>e.path===n):null;return(0,Q.jsx)(Tl,{open:!!(t&&r),onOpenChange:e=>{e.open||p.set(!1)},lazyMount:!0,children:(0,Q.jsxs)(xt,{children:[(0,Q.jsx)(nc,{className:`data-[state=open]:animate-backdrop-in data-[state=closed]:animate-backdrop-out fixed inset-0 z-50 bg-black/50 backdrop-blur-xs`}),(0,Q.jsx)(ic,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:r&&(0,Q.jsx)(Ip,{node:r,output:e.output,entryNodeId:e.output.metadata.entrypoints.at(0)})})]})})}var Ip=e=>{let[t,n]=(0,K.useState)(!1),[r,a]=(0,K.useState)(`tree-search`);return(0,Q.jsxs)(rc,{className:`data-[state=open]:animate-dialog-in data-[state=closed]:animate-dialog-out relative w-full max-w-4xl h-[80vh] rounded-lg bg-white dark:bg-gray-900 shadow-lg flex flex-col`,style:{width:t?`95vw`:void 0,maxWidth:t?`95vw`:void 0,height:t?`95vh`:void 0,maxHeight:t?`95vh`:void 0},children:[(0,Q.jsxs)(El,{className:`relative flex gap-2 items-center text-lg font-semibold text-gray-900 dark:text-white p-4 border-b border-gray-200 dark:border-gray-700`,children:[(0,Q.jsx)(`span`,{children:`Current node:`}),(0,Q.jsx)(`span`,{children:e.node.path}),(0,Q.jsx)(`div`,{className:`ml-auto`,children:(0,Q.jsx)(it,{variant:`outline`,className:`px-2 py-1`,onClick:()=>n(e=>!e),children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yu,{className:`h-4 w-4 text-slate-400`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Minimize`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bu,{className:`h-4 w-4 text-slate-400`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Maximize`})]})})})]}),(0,Q.jsx)(`div`,{className:`bg-white dark:bg-gray-800 w-full h-full min-h-0 px-4 py-6 rounded-xl flex flex-col`,children:(0,Q.jsxs)(ru,{className:`w-full h-full min-h-0 overflow-hidden flex flex-col`,defaultValue:`transitive-imports`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full`,children:[(0,Q.jsxs)(jl,{className:`flex gap-1 p-1 bg-gray-100 rounded-lg dark:bg-gray-700 mb-2`,children:[(0,Q.jsx)(Nl,{value:`transitive-imports`,className:`w-fit px-4 py-2 text-sm font-medium text-gray-600 rounded-md transition-all data-selected:bg-white data-selected:text-gray-900 data-selected:shadow-sm dark:text-gray-300 dark:data-selected:bg-gray-800 dark:data-selected:text-gray-100`,children:`Transitive imports`}),(0,Q.jsx)(Nl,{value:`imports-chain`,className:`w-fit px-4 py-2 text-sm font-medium text-gray-600 rounded-md transition-all data-selected:bg-white data-selected:text-gray-900 data-selected:shadow-sm dark:text-gray-300 dark:data-selected:bg-gray-800 dark:data-selected:text-gray-100`,children:`Imports chains`})]}),(0,Q.jsx)(`div`,{className:`relative z-50 ml-auto px-4 py-2 text-sm font-medium text-gray-600 dark:text-gray-300`,children:(0,Q.jsxs)(Cp,{className:`min-w-64 *:not-first:mt-2`,value:[r],onValueChange:e=>a(e.value.at(0)),collection:Bp,positioning:{sameWidth:!0},children:[(0,Q.jsx)(Ep,{children:(0,Q.jsxs)(Np,{children:[(0,Q.jsx)(Pp,{placeholder:`View mode`}),(0,Q.jsx)(Dp,{})]})}),(0,Q.jsx)(Tp,{children:Bp.items.map(e=>(0,Q.jsx)(Op,{item:e,children:e.label},e.value))})]})})]}),(0,Q.jsxs)(Al,{value:`transitive-imports`,className:`w-full h-full min-h-0 text-gray-600 dark:text-gray-300`,children:[r===`tree-search`&&(0,Q.jsx)(Rp,{node:e.node,output:e.output}),r===`flamegraph`&&(0,Q.jsx)(s,{output:e.output,entryNodeId:e.node.path})]}),(0,Q.jsx)(Al,{value:`imports-chain`,className:`w-full h-full min-h-0 text-gray-600 dark:text-gray-300`,children:(0,Q.jsx)(zp,{node:e.node,output:e.output})})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs p-2 border-t border-gray-200 dark:border-gray-700`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[`Current node: `,(0,Q.jsx)(`span`,{children:e.node.path})]}),(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[`Entrypoint: `,(0,Q.jsx)(`span`,{children:e.entryNodeId})]})]}),(0,Q.jsx)(i,{to:`/trace`,search:Lp(e.node),onClick:()=>p.set(!1),className:`rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-xs font-medium text-slate-700 hover:bg-sky-50 hover:border-sky-300 hover:text-sky-700 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300 dark:hover:border-sky-500/60 dark:hover:bg-sky-500/10 dark:hover:text-sky-200`,children:`Trace this node →`})]})]})},Lp=e=>e.path.includes(`node_modules`)?{package:o(e)??e.path,node:``,limit:25}:{node:e.path,package:``,limit:25},Rp=e=>{let t=(0,K.useMemo)(()=>Wf(e.output,e.node.path),[e.output,e.node.path]);if(!t)return;let n=t.visited;return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{className:`h-full min-h-0 flex flex-col p-2 gap-2`,children:[(0,Q.jsxs)(`span`,{onClick:()=>console.log(e.node,t.collection.rootNode,t.visited),children:[n.size,` file imported (transitively) from current node`]}),(0,Q.jsx)(Uf,{entryNodeId:e.node.path,initialCollection:t.collection},e.node.path)]})})},zp=e=>{let[t,n]=(0,K.useState)(`from-entrypoint-to-current-node`),r=(0,K.useMemo)(()=>Gf(e.output,e.node.path,t),[e.output,e.node.path,t]);if(!r)return;let i=e.output.nodes.find(t=>t.path===e.node.path).chain.at(0)??[];return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{className:`h-full min-h-0 flex flex-col p-2 gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2 items-center`,children:[(0,Q.jsxs)(`span`,{onClick:()=>console.log(e.node,r.rootNode,i),children:[(0,Q.jsxs)(`span`,{children:[`Reached`,` `,t===`from-entrypoint-to-current-node`?`current node`:`entrypoint`,` `,`after`]}),(0,Q.jsxs)(`span`,{children:[` `,i.length,` imports`]})]}),(0,Q.jsx)(`div`,{className:`ml-auto`,children:(0,Q.jsx)(Hp,{value:t,onValueChange:n})})]}),(0,Q.jsx)(Uf,{entryNodeId:e.node.path,initialCollection:r,defaultExpandedValue:i},e.node.path+t)]})})},Bp=Kf({items:[{value:`tree-search`,label:`Tree search`},{value:`flamegraph`,label:`Flamegraph`}]}),Vp=Kf({items:[{value:`from-entrypoint-to-current-node`,label:`From entrypoint to current node`},{value:`from-current-node-to-entrypoint`,label:`From current node to entrypoint`}]});function Hp(e){return(0,Q.jsxs)(Cp,{className:`min-w-64 *:not-first:mt-2`,value:[e.value],onValueChange:t=>e.onValueChange(t.value.at(0)),collection:Vp,positioning:{sameWidth:!0},children:[(0,Q.jsx)(Ep,{children:(0,Q.jsxs)(Np,{children:[(0,Q.jsx)(Pp,{placeholder:`Direction`}),(0,Q.jsx)(Dp,{})]})}),(0,Q.jsx)(Tp,{children:Vp.items.map(e=>(0,Q.jsx)(Op,{item:e,children:e.label},e.value))})]})}var Up=(e,t,n)=>Math.min(Math.max(e,n),t);function Wp(e,t){let n=to(),r=(0,K.useRef)(t);return uo(r.current,t)||(r.current=t),{positions:(0,K.useCallback)((()=>r.current?e(n.getGraph(),r.current):{}),[n,r,e]),assign:(0,K.useCallback)((()=>{r.current&&e.assign(n.getGraph(),r.current)}),[n,r,e])}}function Gp(e,t){let n=to(),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=(0,K.useRef)(t);return uo(s.current,t)||(s.current=t),(0,K.useEffect)((()=>{i(!1);let t=null;return s.current&&(t=new e(n.getGraph(),s.current)),o(t),()=>{t!==null&&t.kill()}}),[n,s,o,i,e]),{stop:(0,K.useCallback)((()=>{a&&(a.stop(),i(!1))}),[a,i]),start:(0,K.useCallback)((()=>{a&&(a.start(),i(!0))}),[a,i]),kill:(0,K.useCallback)((()=>{a&&a.kill(),i(!1)}),[a,i]),isRunning:r}}var Kp=n((e=>{function t(e){return typeof e!=`number`||isNaN(e)?1:e}function n(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getNodeAttributes(t))},n.fromEntry=function(e,t){return i(t)}):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createNodeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){return r(e(n,t.getNodeAttributes(n)))},n.fromEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a),n}function r(e,t){var n={},r=function(e){return e===void 0?t:e};typeof t==`function`&&(r=t);var i=function(t){return r(t[e])},a=function(){return r(void 0)};return typeof e==`string`?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):typeof e==`function`?(n.fromAttributes=function(){throw Error(`graphology-utils/getters/createEdgeValueGetter: irrelevant usage.`)},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,a,o,s,c){return r(e(t,n,i,a,o,s,c))},n.fromPartialEntry=function(t,n,i,a){return r(e(t,n,i,a))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=a,n.fromGraph=a,n.fromEntry=a,n.fromMinimalEntry=a),n}e.createNodeValueGetter=n,e.createEdgeValueGetter=r,e.createEdgeWeightGetter=function(e){return r(e,t)}})),qp=n(((e,t)=>{var n=0,r=1,i=2,a=3,o=4,s=5,c=6,l=7,u=8,d=9,f=0,p=1,m=2,h=0,g=1,_=2,v=3,y=4,b=5,x=6,S=7,C=8,w=3,T=10,E=3,D=9,O=10;t.exports=function(e,t,ee){var te,k,A,j,M,N,ne,P,F,re,ie=t.length,ae=ee.length,oe=e.adjustSizes,se=e.barnesHutTheta*e.barnesHutTheta,ce,I,L,R,z,B,V,H=[];for(A=0;A<ie;A+=T)t[A+o]=t[A+i],t[A+s]=t[A+a],t[A+i]=0,t[A+a]=0;if(e.outboundAttractionDistribution){for(ce=0,A=0;A<ie;A+=T)ce+=t[A+c];ce/=ie/T}if(e.barnesHutOptimize){var le=1/0,U=-1/0,ue=1/0,de=-1/0,fe,pe,me;for(A=0;A<ie;A+=T)le=Math.min(le,t[A+n]),U=Math.max(U,t[A+n]),ue=Math.min(ue,t[A+r]),de=Math.max(de,t[A+r]);var he=U-le,ge=de-ue;for(he>ge?(ue-=(he-ge)/2,de=ue+he):(le-=(ge-he)/2,U=le+ge),H[0+h]=-1,H[0+g]=(le+U)/2,H[0+_]=(ue+de)/2,H[0+v]=Math.max(U-le,de-ue),H[0+y]=-1,H[0+b]=-1,H[0+x]=0,H[0+S]=0,H[0+C]=0,te=1,A=0;A<ie;A+=T)for(k=0,me=w;;)if(H[k+b]>=0){fe=t[A+n]<H[k+g]?t[A+r]<H[k+_]?H[k+b]:H[k+b]+D:t[A+r]<H[k+_]?H[k+b]+D*2:H[k+b]+D*3,H[k+S]=(H[k+S]*H[k+x]+t[A+n]*t[A+c])/(H[k+x]+t[A+c]),H[k+C]=(H[k+C]*H[k+x]+t[A+r]*t[A+c])/(H[k+x]+t[A+c]),H[k+x]+=t[A+c],k=fe;continue}else if(H[k+h]<0){H[k+h]=A;break}else{if(H[k+b]=te*D,P=H[k+v]/2,F=H[k+b],H[F+h]=-1,H[F+g]=H[k+g]-P,H[F+_]=H[k+_]-P,H[F+v]=P,H[F+y]=F+D,H[F+b]=-1,H[F+x]=0,H[F+S]=0,H[F+C]=0,F+=D,H[F+h]=-1,H[F+g]=H[k+g]-P,H[F+_]=H[k+_]+P,H[F+v]=P,H[F+y]=F+D,H[F+b]=-1,H[F+x]=0,H[F+S]=0,H[F+C]=0,F+=D,H[F+h]=-1,H[F+g]=H[k+g]+P,H[F+_]=H[k+_]-P,H[F+v]=P,H[F+y]=F+D,H[F+b]=-1,H[F+x]=0,H[F+S]=0,H[F+C]=0,F+=D,H[F+h]=-1,H[F+g]=H[k+g]+P,H[F+_]=H[k+_]+P,H[F+v]=P,H[F+y]=H[k+y],H[F+b]=-1,H[F+x]=0,H[F+S]=0,H[F+C]=0,te+=4,fe=t[H[k+h]+n]<H[k+g]?t[H[k+h]+r]<H[k+_]?H[k+b]:H[k+b]+D:t[H[k+h]+r]<H[k+_]?H[k+b]+D*2:H[k+b]+D*3,H[k+x]=t[H[k+h]+c],H[k+S]=t[H[k+h]+n],H[k+C]=t[H[k+h]+r],H[fe+h]=H[k+h],H[k+h]=-1,pe=t[A+n]<H[k+g]?t[A+r]<H[k+_]?H[k+b]:H[k+b]+D:t[A+r]<H[k+_]?H[k+b]+D*2:H[k+b]+D*3,fe===pe)if(me--){k=fe;continue}else{me=w;break}H[pe+h]=A;break}}if(e.barnesHutOptimize)for(I=e.scalingRatio,A=0;A<ie;A+=T)for(k=0;;)if(H[k+b]>=0)if(B=(t[A+n]-H[k+S])**2+(t[A+r]-H[k+C])**2,re=H[k+v],4*re*re/B<se){if(L=t[A+n]-H[k+S],R=t[A+r]-H[k+C],oe===!0?B>0?(V=I*t[A+c]*H[k+x]/B,t[A+i]+=L*V,t[A+a]+=R*V):B<0&&(V=-I*t[A+c]*H[k+x]/Math.sqrt(B),t[A+i]+=L*V,t[A+a]+=R*V):B>0&&(V=I*t[A+c]*H[k+x]/B,t[A+i]+=L*V,t[A+a]+=R*V),k=H[k+y],k<0)break;continue}else{k=H[k+b];continue}else{if(N=H[k+h],N>=0&&N!==A&&(L=t[A+n]-t[N+n],R=t[A+r]-t[N+r],B=L*L+R*R,oe===!0?B>0?(V=I*t[A+c]*t[N+c]/B,t[A+i]+=L*V,t[A+a]+=R*V):B<0&&(V=-I*t[A+c]*t[N+c]/Math.sqrt(B),t[A+i]+=L*V,t[A+a]+=R*V):B>0&&(V=I*t[A+c]*t[N+c]/B,t[A+i]+=L*V,t[A+a]+=R*V)),k=H[k+y],k<0)break;continue}else for(I=e.scalingRatio,j=0;j<ie;j+=T)for(M=0;M<j;M+=T)L=t[j+n]-t[M+n],R=t[j+r]-t[M+r],oe===!0?(B=Math.sqrt(L*L+R*R)-t[j+u]-t[M+u],B>0?(V=I*t[j+c]*t[M+c]/B/B,t[j+i]+=L*V,t[j+a]+=R*V,t[M+i]-=L*V,t[M+a]-=R*V):B<0&&(V=100*I*t[j+c]*t[M+c],t[j+i]+=L*V,t[j+a]+=R*V,t[M+i]-=L*V,t[M+a]-=R*V)):(B=Math.sqrt(L*L+R*R),B>0&&(V=I*t[j+c]*t[M+c]/B/B,t[j+i]+=L*V,t[j+a]+=R*V,t[M+i]-=L*V,t[M+a]-=R*V));for(F=e.gravity/e.scalingRatio,I=e.scalingRatio,A=0;A<ie;A+=T)V=0,L=t[A+n],R=t[A+r],B=Math.sqrt(L**2+R**2),e.strongGravityMode?B>0&&(V=I*t[A+c]*F):B>0&&(V=I*t[A+c]*F/B),t[A+i]-=L*V,t[A+a]-=R*V;for(I=1*(e.outboundAttractionDistribution?ce:1),ne=0;ne<ae;ne+=E)j=ee[ne+f],M=ee[ne+p],P=ee[ne+m],z=P**+e.edgeWeightInfluence,L=t[j+n]-t[M+n],R=t[j+r]-t[M+r],oe===!0?(B=Math.sqrt(L*L+R*R)-t[j+u]-t[M+u],e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[j+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?B>0&&(V=-I*z/t[j+c]):B>0&&(V=-I*z)):(B=Math.sqrt(L**2+R**2),e.linLogMode?e.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/t[j+c]):B>0&&(V=-I*z*Math.log(1+B)/B):e.outboundAttractionDistribution?(B=1,V=-I*z/t[j+c]):(B=1,V=-I*z)),B>0&&(t[j+i]+=L*V,t[j+a]+=R*V,t[M+i]-=L*V,t[M+a]-=R*V);var _e,ve,ye,be,xe,Se;if(oe===!0)for(A=0;A<ie;A+=T)t[A+d]!==1&&(_e=Math.sqrt(t[A+i]**2+t[A+a]**2),_e>O&&(t[A+i]=t[A+i]*O/_e,t[A+a]=t[A+a]*O/_e),ve=t[A+c]*Math.sqrt((t[A+o]-t[A+i])*(t[A+o]-t[A+i])+(t[A+s]-t[A+a])*(t[A+s]-t[A+a])),ye=Math.sqrt((t[A+o]+t[A+i])*(t[A+o]+t[A+i])+(t[A+s]+t[A+a])*(t[A+s]+t[A+a]))/2,be=.1*Math.log(1+ye)/(1+Math.sqrt(ve)),xe=t[A+n]+t[A+i]*(be/e.slowDown),t[A+n]=xe,Se=t[A+r]+t[A+a]*(be/e.slowDown),t[A+r]=Se);else for(A=0;A<ie;A+=T)t[A+d]!==1&&(ve=t[A+c]*Math.sqrt((t[A+o]-t[A+i])*(t[A+o]-t[A+i])+(t[A+s]-t[A+a])*(t[A+s]-t[A+a])),ye=Math.sqrt((t[A+o]+t[A+i])*(t[A+o]+t[A+i])+(t[A+s]+t[A+a])*(t[A+s]+t[A+a]))/2,be=t[A+l]*Math.log(1+ye)/(1+Math.sqrt(ve)),t[A+l]=Math.min(1,Math.sqrt(be*(t[A+i]**2+t[A+a]**2)/(1+Math.sqrt(ve)))),xe=t[A+n]+t[A+i]*(be/e.slowDown),t[A+n]=xe,Se=t[A+r]+t[A+a]*(be/e.slowDown),t[A+r]=Se);return{}}})),Jp=n((e=>{var t=10,n=3;e.assign=function(e){e||={};var t=Array.prototype.slice.call(arguments).slice(1),n,r,i;for(n=0,i=t.length;n<i;n++)if(t[n])for(r in t[n])e[r]=t[n][r];return e},e.validateSettings=function(e){return`linLogMode`in e&&typeof e.linLogMode!=`boolean`?{message:"the `linLogMode` setting should be a boolean."}:`outboundAttractionDistribution`in e&&typeof e.outboundAttractionDistribution!=`boolean`?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:`adjustSizes`in e&&typeof e.adjustSizes!=`boolean`?{message:"the `adjustSizes` setting should be a boolean."}:`edgeWeightInfluence`in e&&typeof e.edgeWeightInfluence!=`number`?{message:"the `edgeWeightInfluence` setting should be a number."}:`scalingRatio`in e&&!(typeof e.scalingRatio==`number`&&e.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:`strongGravityMode`in e&&typeof e.strongGravityMode!=`boolean`?{message:"the `strongGravityMode` setting should be a boolean."}:`gravity`in e&&!(typeof e.gravity==`number`&&e.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:`slowDown`in e&&!(typeof e.slowDown==`number`||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:`barnesHutOptimize`in e&&typeof e.barnesHutOptimize!=`boolean`?{message:"the `barnesHutOptimize` setting should be a boolean."}:`barnesHutTheta`in e&&!(typeof e.barnesHutTheta==`number`&&e.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},e.graphToByteArrays=function(e,r){var i=e.order,a=e.size,o={},s,c=new Float32Array(i*t),l=new Float32Array(a*n);return s=0,e.forEachNode(function(e,n){o[e]=s,c[s]=n.x,c[s+1]=n.y,c[s+2]=0,c[s+3]=0,c[s+4]=0,c[s+5]=0,c[s+6]=1,c[s+7]=1,c[s+8]=n.size||1,c[s+9]=+!!n.fixed,s+=t}),s=0,e.forEachEdge(function(e,t,i,a,u,d,f){var p=o[i],m=o[a],h=r(e,t,i,a,u,d,f);c[p+6]+=h,c[m+6]+=h,l[s]=p,l[s+1]=m,l[s+2]=h,s+=n}),{nodes:c,edges:l}},e.assignLayoutChanges=function(e,n,r){var i=0;e.updateEachNodeAttributes(function(e,a){return a.x=n[i],a.y=n[i+1],i+=t,r?r(e,a):a})},e.readGraphPositions=function(e,n){var r=0;e.forEachNode(function(e,i){n[r]=i.x,n[r+1]=i.y,r+=t})},e.collectLayoutChanges=function(e,n,r){for(var i=e.nodes(),a={},o=0,s=0,c=n.length;o<c;o+=t){if(r){var l=Object.assign({},e.getNodeAttributes(i[s]));l.x=n[o],l.y=n[o+1],l=r(i[s],l),a[i[s]]={x:l.x,y:l.y}}else a[i[s]]={x:n[o],y:n[o+1]};s++}return a},e.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob([`(`+n+`).call(this);`],{type:`text/javascript`})),i=new Worker(r);return t.revokeObjectURL(r),i}})),Yp=n(((e,t)=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}})),Xp=n(((e,t)=>{var n=Yi(),r=Kp().createEdgeWeightGetter,i=qp(),a=Jp(),o=Yp();function s(e,t,s){if(!n(t))throw Error(`graphology-layout-forceatlas2: the given graph is not a valid graphology instance.`);typeof s==`number`&&(s={iterations:s});var c=s.iterations;if(typeof c!=`number`)throw Error(`graphology-layout-forceatlas2: invalid number of iterations.`);if(c<=0)throw Error(`graphology-layout-forceatlas2: you should provide a positive number of iterations.`);var l=r(`getEdgeWeight`in s?s.getEdgeWeight:`weight`).fromEntry,u=typeof s.outputReducer==`function`?s.outputReducer:null,d=a.assign({},o,s.settings),f=a.validateSettings(d);if(f)throw Error(`graphology-layout-forceatlas2: `+f.message);var p=a.graphToByteArrays(t,l),m;for(m=0;m<c;m++)i(d,p.nodes,p.edges);if(e){a.assignLayoutChanges(t,p.nodes,u);return}return a.collectLayoutChanges(t,p.nodes)}function c(e){var t=typeof e==`number`?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}}var l=s.bind(null,!1);l.assign=s.bind(null,!0),l.inferSettings=c,t.exports=l})),Zp=n(((e,t)=>{t.exports=function(){var e,t,n={};(function(){var e=0,t=1,r=2,i=3,a=4,o=5,s=6,c=7,l=8,u=9,d=0,f=1,p=2,m=0,h=1,g=2,_=3,v=4,y=5,b=6,x=7,S=8,C=3,w=10,T=3,E=9,D=10;n.exports=function(n,O,ee){var te,k,A,j,M,N,ne,P,F,re,ie=O.length,ae=ee.length,oe=n.adjustSizes,se=n.barnesHutTheta*n.barnesHutTheta,ce,I,L,R,z,B,V,H=[];for(A=0;A<ie;A+=w)O[A+a]=O[A+r],O[A+o]=O[A+i],O[A+r]=0,O[A+i]=0;if(n.outboundAttractionDistribution){for(ce=0,A=0;A<ie;A+=w)ce+=O[A+s];ce/=ie/w}if(n.barnesHutOptimize){var le=1/0,U=-1/0,ue=1/0,de=-1/0,fe,pe,me;for(A=0;A<ie;A+=w)le=Math.min(le,O[A+e]),U=Math.max(U,O[A+e]),ue=Math.min(ue,O[A+t]),de=Math.max(de,O[A+t]);var he=U-le,ge=de-ue;for(he>ge?(ue-=(he-ge)/2,de=ue+he):(le-=(ge-he)/2,U=le+ge),H[0+m]=-1,H[0+h]=(le+U)/2,H[0+g]=(ue+de)/2,H[0+_]=Math.max(U-le,de-ue),H[0+v]=-1,H[0+y]=-1,H[0+b]=0,H[0+x]=0,H[0+S]=0,te=1,A=0;A<ie;A+=w)for(k=0,me=C;;)if(H[k+y]>=0){fe=O[A+e]<H[k+h]?O[A+t]<H[k+g]?H[k+y]:H[k+y]+E:O[A+t]<H[k+g]?H[k+y]+E*2:H[k+y]+E*3,H[k+x]=(H[k+x]*H[k+b]+O[A+e]*O[A+s])/(H[k+b]+O[A+s]),H[k+S]=(H[k+S]*H[k+b]+O[A+t]*O[A+s])/(H[k+b]+O[A+s]),H[k+b]+=O[A+s],k=fe;continue}else if(H[k+m]<0){H[k+m]=A;break}else{if(H[k+y]=te*E,P=H[k+_]/2,F=H[k+y],H[F+m]=-1,H[F+h]=H[k+h]-P,H[F+g]=H[k+g]-P,H[F+_]=P,H[F+v]=F+E,H[F+y]=-1,H[F+b]=0,H[F+x]=0,H[F+S]=0,F+=E,H[F+m]=-1,H[F+h]=H[k+h]-P,H[F+g]=H[k+g]+P,H[F+_]=P,H[F+v]=F+E,H[F+y]=-1,H[F+b]=0,H[F+x]=0,H[F+S]=0,F+=E,H[F+m]=-1,H[F+h]=H[k+h]+P,H[F+g]=H[k+g]-P,H[F+_]=P,H[F+v]=F+E,H[F+y]=-1,H[F+b]=0,H[F+x]=0,H[F+S]=0,F+=E,H[F+m]=-1,H[F+h]=H[k+h]+P,H[F+g]=H[k+g]+P,H[F+_]=P,H[F+v]=H[k+v],H[F+y]=-1,H[F+b]=0,H[F+x]=0,H[F+S]=0,te+=4,fe=O[H[k+m]+e]<H[k+h]?O[H[k+m]+t]<H[k+g]?H[k+y]:H[k+y]+E:O[H[k+m]+t]<H[k+g]?H[k+y]+E*2:H[k+y]+E*3,H[k+b]=O[H[k+m]+s],H[k+x]=O[H[k+m]+e],H[k+S]=O[H[k+m]+t],H[fe+m]=H[k+m],H[k+m]=-1,pe=O[A+e]<H[k+h]?O[A+t]<H[k+g]?H[k+y]:H[k+y]+E:O[A+t]<H[k+g]?H[k+y]+E*2:H[k+y]+E*3,fe===pe)if(me--){k=fe;continue}else{me=C;break}H[pe+m]=A;break}}if(n.barnesHutOptimize)for(I=n.scalingRatio,A=0;A<ie;A+=w)for(k=0;;)if(H[k+y]>=0)if(B=(O[A+e]-H[k+x])**2+(O[A+t]-H[k+S])**2,re=H[k+_],4*re*re/B<se){if(L=O[A+e]-H[k+x],R=O[A+t]-H[k+S],oe===!0?B>0?(V=I*O[A+s]*H[k+b]/B,O[A+r]+=L*V,O[A+i]+=R*V):B<0&&(V=-I*O[A+s]*H[k+b]/Math.sqrt(B),O[A+r]+=L*V,O[A+i]+=R*V):B>0&&(V=I*O[A+s]*H[k+b]/B,O[A+r]+=L*V,O[A+i]+=R*V),k=H[k+v],k<0)break;continue}else{k=H[k+y];continue}else{if(N=H[k+m],N>=0&&N!==A&&(L=O[A+e]-O[N+e],R=O[A+t]-O[N+t],B=L*L+R*R,oe===!0?B>0?(V=I*O[A+s]*O[N+s]/B,O[A+r]+=L*V,O[A+i]+=R*V):B<0&&(V=-I*O[A+s]*O[N+s]/Math.sqrt(B),O[A+r]+=L*V,O[A+i]+=R*V):B>0&&(V=I*O[A+s]*O[N+s]/B,O[A+r]+=L*V,O[A+i]+=R*V)),k=H[k+v],k<0)break;continue}else for(I=n.scalingRatio,j=0;j<ie;j+=w)for(M=0;M<j;M+=w)L=O[j+e]-O[M+e],R=O[j+t]-O[M+t],oe===!0?(B=Math.sqrt(L*L+R*R)-O[j+l]-O[M+l],B>0?(V=I*O[j+s]*O[M+s]/B/B,O[j+r]+=L*V,O[j+i]+=R*V,O[M+r]-=L*V,O[M+i]-=R*V):B<0&&(V=100*I*O[j+s]*O[M+s],O[j+r]+=L*V,O[j+i]+=R*V,O[M+r]-=L*V,O[M+i]-=R*V)):(B=Math.sqrt(L*L+R*R),B>0&&(V=I*O[j+s]*O[M+s]/B/B,O[j+r]+=L*V,O[j+i]+=R*V,O[M+r]-=L*V,O[M+i]-=R*V));for(F=n.gravity/n.scalingRatio,I=n.scalingRatio,A=0;A<ie;A+=w)V=0,L=O[A+e],R=O[A+t],B=Math.sqrt(L**2+R**2),n.strongGravityMode?B>0&&(V=I*O[A+s]*F):B>0&&(V=I*O[A+s]*F/B),O[A+r]-=L*V,O[A+i]-=R*V;for(I=1*(n.outboundAttractionDistribution?ce:1),ne=0;ne<ae;ne+=T)j=ee[ne+d],M=ee[ne+f],P=ee[ne+p],z=P**+n.edgeWeightInfluence,L=O[j+e]-O[M+e],R=O[j+t]-O[M+t],oe===!0?(B=Math.sqrt(L*L+R*R)-O[j+l]-O[M+l],n.linLogMode?n.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/O[j+s]):B>0&&(V=-I*z*Math.log(1+B)/B):n.outboundAttractionDistribution?B>0&&(V=-I*z/O[j+s]):B>0&&(V=-I*z)):(B=Math.sqrt(L**2+R**2),n.linLogMode?n.outboundAttractionDistribution?B>0&&(V=-I*z*Math.log(1+B)/B/O[j+s]):B>0&&(V=-I*z*Math.log(1+B)/B):n.outboundAttractionDistribution?(B=1,V=-I*z/O[j+s]):(B=1,V=-I*z)),B>0&&(O[j+r]+=L*V,O[j+i]+=R*V,O[M+r]-=L*V,O[M+i]-=R*V);var _e,ve,ye,be,xe,Se;if(oe===!0)for(A=0;A<ie;A+=w)O[A+u]!==1&&(_e=Math.sqrt(O[A+r]**2+O[A+i]**2),_e>D&&(O[A+r]=O[A+r]*D/_e,O[A+i]=O[A+i]*D/_e),ve=O[A+s]*Math.sqrt((O[A+a]-O[A+r])*(O[A+a]-O[A+r])+(O[A+o]-O[A+i])*(O[A+o]-O[A+i])),ye=Math.sqrt((O[A+a]+O[A+r])*(O[A+a]+O[A+r])+(O[A+o]+O[A+i])*(O[A+o]+O[A+i]))/2,be=.1*Math.log(1+ye)/(1+Math.sqrt(ve)),xe=O[A+e]+O[A+r]*(be/n.slowDown),O[A+e]=xe,Se=O[A+t]+O[A+i]*(be/n.slowDown),O[A+t]=Se);else for(A=0;A<ie;A+=w)O[A+u]!==1&&(ve=O[A+s]*Math.sqrt((O[A+a]-O[A+r])*(O[A+a]-O[A+r])+(O[A+o]-O[A+i])*(O[A+o]-O[A+i])),ye=Math.sqrt((O[A+a]+O[A+r])*(O[A+a]+O[A+r])+(O[A+o]+O[A+i])*(O[A+o]+O[A+i]))/2,be=O[A+c]*Math.log(1+ye)/(1+Math.sqrt(ve)),O[A+c]=Math.min(1,Math.sqrt(be*(O[A+r]**2+O[A+i]**2)/(1+Math.sqrt(ve)))),xe=O[A+e]+O[A+r]*(be/n.slowDown),O[A+e]=xe,Se=O[A+t]+O[A+i]*(be/n.slowDown),O[A+t]=Se);return{}}})();var r=n.exports;self.addEventListener(`message`,function(n){var i=n.data;e=new Float32Array(i.nodes),i.edges&&(t=new Float32Array(i.edges)),r(i.settings,e,t),self.postMessage({nodes:e.buffer},[e.buffer])})}})),Qp=n(((e,t)=>{var n=Zp(),r=Yi(),i=Kp().createEdgeWeightGetter,a=Jp(),o=Yp();function s(e,t){if(t||={},!r(e))throw Error(`graphology-layout-forceatlas2/worker: the given graph is not a valid graphology instance.`);var n=i(`getEdgeWeight`in t?t.getEdgeWeight:`weight`).fromEntry,s=a.assign({},o,t.settings),c=a.validateSettings(s);if(c)throw Error(`graphology-layout-forceatlas2/worker: `+c.message);this.worker=null,this.graph=e,this.settings=s,this.getEdgeWeight=n,this.matrices=null,this.running=!1,this.killed=!1,this.outputReducer=typeof t.outputReducer==`function`?t.outputReducer:null,this.handleMessage=this.handleMessage.bind(this);var l=void 0,u=this;this.handleGraphUpdate=function(){u.worker&&u.worker.terminate(),l&&clearTimeout(l),l=setTimeout(function(){l=void 0,u.spawnWorker()},0)},e.on(`nodeAdded`,this.handleGraphUpdate),e.on(`edgeAdded`,this.handleGraphUpdate),e.on(`nodeDropped`,this.handleGraphUpdate),e.on(`edgeDropped`,this.handleGraphUpdate),this.spawnWorker()}s.prototype.isRunning=function(){return this.running},s.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=a.createWorker(n),this.worker.addEventListener(`message`,this.handleMessage),this.running&&(this.running=!1,this.start())},s.prototype.handleMessage=function(e){if(this.running){var t=new Float32Array(e.data.nodes);a.assignLayoutChanges(this.graph,t,this.outputReducer),this.outputReducer&&a.readGraphPositions(this.graph,t),this.matrices.nodes=t,this.askForIterations()}},s.prototype.askForIterations=function(e){var t=this.matrices,n={settings:this.settings,nodes:t.nodes.buffer},r=[t.nodes.buffer];return e&&(n.edges=t.edges.buffer,r.push(t.edges.buffer)),this.worker.postMessage(n,r),this},s.prototype.start=function(){if(this.killed)throw Error(`graphology-layout-forceatlas2/worker.start: layout was killed.`);return this.running?this:(this.matrices=a.graphToByteArrays(this.graph,this.getEdgeWeight),this.running=!0,this.askForIterations(!0),this)},s.prototype.stop=function(){return this.running=!1,this},s.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener(`nodeAdded`,this.handleGraphUpdate),this.graph.removeListener(`edgeAdded`,this.handleGraphUpdate),this.graph.removeListener(`nodeDropped`,this.handleGraphUpdate),this.graph.removeListener(`edgeDropped`,this.handleGraphUpdate)},t.exports=s}));Xp();var $p=e(Qp(),1);function em(e={}){return Gp($p.default,e)}var tm=n(((e,t)=>{var n=0,r=1,i=2,a=3;function o(e,t){return e+`§`+t}function s(){return .01*(.5-Math.random())}t.exports=function(e,t){var c=e.margin,l=e.ratio,u=e.expansion,d=e.gridSize,f=e.speed,p,m,h,g,_,v,y=!0,b=t.length,x=b/a|0,S=new Float32Array(x),C=new Float32Array(x),w=1/0,T=1/0,E=-1/0,D=-1/0;for(p=0;p<b;p+=a)h=t[p+n],g=t[p+r],v=t[p+i]*l+c,w=Math.min(w,h-v),E=Math.max(E,h+v),T=Math.min(T,g-v),D=Math.max(D,g+v);var O=E-w,ee=D-T,te=(w+E)/2,k=(T+D)/2;w=te-u*O/2,E=te+u*O/2,T=k-u*ee/2,D=k+u*ee/2;var A=Array(d*d),j=A.length,M;for(M=0;M<j;M++)A[M]=[];var N,ne,P,F,re,ie,ae,oe,se,ce;for(p=0;p<b;p+=a)for(h=t[p+n],g=t[p+r],v=t[p+i]*l+c,N=h-v,ne=h+v,P=g-v,F=g+v,re=Math.floor(d*(N-w)/(E-w)),ie=Math.floor(d*(ne-w)/(E-w)),ae=Math.floor(d*(P-T)/(D-T)),oe=Math.floor(d*(F-T)/(D-T)),se=re;se<=ie;se++)for(ce=ae;ce<=oe;ce++)A[se*d+ce].push(p);var I,L=new Set,R,z,B,V,H,le,U,ue,de,fe,pe,me,he;for(M=0;M<j;M++)for(I=A[M],p=0,_=I.length;p<_;p++)for(R=I[p],B=t[R+n],H=t[R+r],U=t[R+i],m=p+1;m<_;m++)z=I[m],de=o(R,z),!(j>1&&L.has(de))&&(j>1&&L.add(de),V=t[z+n],le=t[z+r],ue=t[z+i],fe=V-B,pe=le-H,me=Math.sqrt(fe*fe+pe*pe),he=me<U*l+c+(ue*l+c),he&&(y=!1,z=z/a|0,me>0?(S[z]+=fe/me*(1+U),C[z]+=pe/me*(1+U)):(S[z]+=O*s(),C[z]+=ee*s())));for(p=0,m=0;p<b;p+=a,m++)t[p+n]+=S[m]*.1*f,t[p+r]+=C[m]*.1*f;return{converged:y}}})),nm=n((e=>{var t=3;e.validateSettings=function(e){return`gridSize`in e&&typeof e.gridSize!=`number`||e.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:`margin`in e&&typeof e.margin!=`number`||e.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:`expansion`in e&&typeof e.expansion!=`number`||e.expansion<=0?{message:"the `expansion` setting should be a positive number."}:`ratio`in e&&typeof e.ratio!=`number`||e.ratio<=0?{message:"the `ratio` setting should be a positive number."}:`speed`in e&&typeof e.speed!=`number`||e.speed<=0?{message:"the `speed` setting should be a positive number."}:null},e.graphToByteArray=function(e,n){var r=e.order,i=new Float32Array(r*t),a=0;return e.forEachNode(function(e,r){typeof n==`function`&&(r=n(e,r)),i[a]=r.x,i[a+1]=r.y,i[a+2]=r.size||1,a+=t}),i},e.assignLayoutChanges=function(e,n,r){var i=0;e.forEachNode(function(a){var o={x:n[i],y:n[i+1]};typeof r==`function`&&(o=r(a,o)),e.mergeNodeAttributes(a,o),i+=t})},e.collectLayoutChanges=function(e,n,r){var i={},a=0;return e.forEachNode(function(e){var o={x:n[a],y:n[a+1]};typeof r==`function`&&(o=r(e,o)),i[e]=o,a+=t}),i},e.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob([`(`+n+`).call(this);`],{type:`text/javascript`})),i=new Worker(r);return t.revokeObjectURL(r),i}})),rm=n(((e,t)=>{t.exports={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}})),im=n(((e,t)=>{var n=Yi(),r=tm(),i=nm(),a=rm(),o=500;function s(e,t,s){if(!n(t))throw Error(`graphology-layout-noverlap: the given graph is not a valid graphology instance.`);typeof s==`number`?s={maxIterations:s}:s||={};var c=s.maxIterations||o;if(typeof c!=`number`||c<=0)throw Error(`graphology-layout-force: you should provide a positive number of maximum iterations.`);var l=Object.assign({},a,s.settings),u=i.validateSettings(l);if(u)throw Error(`graphology-layout-noverlap: `+u.message);var d=i.graphToByteArray(t,s.inputReducer),f=!1,p;for(p=0;p<c&&!f;p++)f=r(l,d).converged;if(e){i.assignLayoutChanges(t,d,s.outputReducer);return}return i.collectLayoutChanges(t,d,s.outputReducer)}var c=s.bind(null,!1);c.assign=s.bind(null,!0),t.exports=c})),am=n(((e,t)=>{t.exports=function(){var e,t={};(function(){var e=0,n=1,r=2,i=3;function a(e,t){return e+`§`+t}function o(){return .01*(.5-Math.random())}t.exports=function(t,s){var c=t.margin,l=t.ratio,u=t.expansion,d=t.gridSize,f=t.speed,p,m,h,g,_,v,y=!0,b=s.length,x=b/i|0,S=new Float32Array(x),C=new Float32Array(x),w=1/0,T=1/0,E=-1/0,D=-1/0;for(p=0;p<b;p+=i)h=s[p+e],g=s[p+n],v=s[p+r]*l+c,w=Math.min(w,h-v),E=Math.max(E,h+v),T=Math.min(T,g-v),D=Math.max(D,g+v);var O=E-w,ee=D-T,te=(w+E)/2,k=(T+D)/2;w=te-u*O/2,E=te+u*O/2,T=k-u*ee/2,D=k+u*ee/2;var A=Array(d*d),j=A.length,M;for(M=0;M<j;M++)A[M]=[];var N,ne,P,F,re,ie,ae,oe,se,ce;for(p=0;p<b;p+=i)for(h=s[p+e],g=s[p+n],v=s[p+r]*l+c,N=h-v,ne=h+v,P=g-v,F=g+v,re=Math.floor(d*(N-w)/(E-w)),ie=Math.floor(d*(ne-w)/(E-w)),ae=Math.floor(d*(P-T)/(D-T)),oe=Math.floor(d*(F-T)/(D-T)),se=re;se<=ie;se++)for(ce=ae;ce<=oe;ce++)A[se*d+ce].push(p);var I,L=new Set,R,z,B,V,H,le,U,ue,de,fe,pe,me,he;for(M=0;M<j;M++)for(I=A[M],p=0,_=I.length;p<_;p++)for(R=I[p],B=s[R+e],H=s[R+n],U=s[R+r],m=p+1;m<_;m++)z=I[m],de=a(R,z),!(j>1&&L.has(de))&&(j>1&&L.add(de),V=s[z+e],le=s[z+n],ue=s[z+r],fe=V-B,pe=le-H,me=Math.sqrt(fe*fe+pe*pe),he=me<U*l+c+(ue*l+c),he&&(y=!1,z=z/i|0,me>0?(S[z]+=fe/me*(1+U),C[z]+=pe/me*(1+U)):(S[z]+=O*o(),C[z]+=ee*o())));for(p=0,m=0;p<b;p+=i,m++)s[p+e]+=S[m]*.1*f,s[p+n]+=C[m]*.1*f;return{converged:y}}})();var n=t.exports;self.addEventListener(`message`,function(t){var r=t.data;e=new Float32Array(r.nodes);var i=n(r.settings,e);self.postMessage({result:i,nodes:e.buffer},[e.buffer])})}})),om=n(((e,t)=>{var n=am(),r=Yi(),i=nm(),a=rm();function o(e,t){if(t||={},!r(e))throw Error(`graphology-layout-noverlap/worker: the given graph is not a valid graphology instance.`);var n=Object.assign({},a,t.settings),o=i.validateSettings(n);if(o)throw Error(`graphology-layout-noverlap/worker: `+o.message);this.worker=null,this.graph=e,this.settings=n,this.matrices=null,this.running=!1,this.killed=!1,this.inputReducer=t.inputReducer,this.outputReducer=t.outputReducer,this.callbacks={onConverged:typeof t.onConverged==`function`?t.onConverged:null},this.handleMessage=this.handleMessage.bind(this);var s=!1,c=this;this.handleAddition=function(){s||(s=!0,c.spawnWorker(),setTimeout(function(){s=!1},0))},e.on(`nodeAdded`,this.handleAddition),e.on(`edgeAdded`,this.handleAddition),this.spawnWorker()}o.prototype.isRunning=function(){return this.running},o.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=i.createWorker(n),this.worker.addEventListener(`message`,this.handleMessage),this.running&&(this.running=!1,this.start())},o.prototype.handleMessage=function(e){if(this.running){var t=new Float32Array(e.data.nodes);if(i.assignLayoutChanges(this.graph,t,this.outputReducer),this.matrices.nodes=t,e.data.result.converged){this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop();return}this.askForIterations()}},o.prototype.askForIterations=function(){var e=this.matrices,t={settings:this.settings,nodes:e.nodes.buffer},n=[e.nodes.buffer];return this.worker.postMessage(t,n),this},o.prototype.start=function(){if(this.killed)throw Error(`graphology-layout-noverlap/worker.start: layout was killed.`);return this.running?this:(this.matrices={nodes:i.graphToByteArray(this.graph,this.inputReducer)},this.running=!0,this.askForIterations(),this)},o.prototype.stop=function(){return this.running=!1,this},o.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener(`nodeAdded`,this.handleAddition),this.graph.removeListener(`edgeAdded`,this.handleAddition)},t.exports=o})),sm=e(im(),1);om();function cm(e={}){return Wp(sm.default,e)}var lm=e=>{let t=(0,K.useMemo)(()=>new Set(e.packages.map(e=>e.name)),[e.packages]),n=(0,K.useMemo)(()=>{let n=Math.max(26,Math.sqrt(e.nodes.length)*.9),r=Array.from(new Set(e.nodes.map(n=>a(n,t,e.externalGrouping??`combined`)))).sort((e,t)=>e.localeCompare(t));return new Map(r.map((e,t)=>{let r=t*2.399963229728653,i=n*Math.sqrt(t+1);return[e,{x:Math.cos(r)*i,y:Math.sin(r)*i}]}))},[e.externalGrouping,e.nodes,t]),r=(0,K.useMemo)(()=>{let n=new Map,r=new Set;e.nodes.forEach(n=>{r.add(a(n,t,e.externalGrouping??`combined`))});let i=0;return r.forEach(e=>{n.set(e,wt.list[++i]??wt.deterministic(e))}),n},[e.externalGrouping,e.nodes,t]),i=(0,K.useMemo)(()=>{let t=new Set;return e.nodes.forEach(e=>{e.importedBy.forEach(n=>{t.add(`${n}->${e.path}`)})}),{ids:t,list:Array.from(t).map(e=>{let[t,n]=e.split(`->`);return{source:t,target:n}})}},[e.nodes]);return(0,K.useCallback)(()=>{let o=new fr,s=new Map,c=e.layoutSettings?.nodeSizeScale??1;return e.nodes.forEach(i=>{s.set(i.path,i);let l=a(i,t,e.externalGrouping??`combined`),u=n.get(l)??{x:0,y:0},d=Math.max(12,Math.min(36,Math.sqrt(i.importedBy.length+1)*6)),f=(Ct()-.5)*d,p=(Ct()-.5)*d,m=e.entryNode===i.path,h=m?0:u.x+f,g=m?0:u.y+p,_=i.package&&i.isBarrelFile?`${i.package?.name}/${i.name}`:i.name;o.addNode(i.path,{x:h,y:g,label:_,originalLabel:_,modType:i.type,cluster:l,clusterPath:i.package?.path??l,color:r.get(l)??wt.default,size:Up(4,18*c,Math.max(4,i.importedBy.length*c)),highlighted:!1})}),i.list.forEach(n=>{if(s.has(n.source)&&s.has(n.target)){let i=a(s.get(n.source),t,e.externalGrouping??`combined`);o.addEdge(n.source,n.target,{label:n.source,color:r.get(i)??wt.default})}}),o},[n,r,i.list,e.entryNode,e.externalGrouping,e.layoutSettings?.nodeSizeScale,e.nodes,t])},um=()=>{let e=to(),t=no(),n=co(),r=u(l),i=u(y),a=(0,K.useMemo)(()=>new Set(i),[i]),o=(0,K.useMemo)(()=>{if(a.size===0)return new Set;let t=e.getGraph(),n=new Set(i);for(let e of i)if(t.hasNode(e))for(let r of t.neighbors(e))n.add(r);return n},[i,a.size,e]),[s,c]=(0,K.useState)(null);(0,K.useEffect)(()=>{n({enterNode:e=>c(e.node),leaveNode:()=>c(null),clickNode:e=>{g.set(e.node),v.set(null),y.set(t=>t.includes(e.node)?t.filter(t=>t!==e.node):[...t,e.node])},downStage:()=>{v.set(null)},mousedown:()=>{e.getCustomBBox()||e.setCustomBBox(e.getBBox())}})},[n,e]),(0,K.useEffect)(()=>{t({autoCenter:!0,autoRescale:!0,zoomDuration:150,renderLabels:!!(s||r||a.size>0),hideLabelsOnMove:!0,labelRenderedSizeThreshold:8,nodeReducer:(t,n)=>{let i=e.getGraph(),c=t===s,l={...n,highlighted:n.highlighted||!1};return a.size>0?(a.has(t)?(l.label=n.label,l.highlighted=!0,l.size=n.size+Up(2,8,n.size*.15)):o.has(t)?(l.label=n.label,l.highlighted=!0):(l.color=wt.default,l.label=c?n.label:``,l.highlighted=c),c&&(l.label=n.label,l.highlighted=!0,l.size=n.size+Up(4,10,n.size*.25)),l):(s&&i.hasNode(s)?(t===s&&(l.label=n.label,l.size=n.size+Up(4,10,n.size*.25)),t===s||i.neighbors(s).includes(t)?(l.label=n.label,l.highlighted=!0):(l.color=wt.default,l.highlighted=!1,l.label=``)):r&&(n.cluster===r?(l.label=n.label,l.highlighted=!0):(l.color=wt.default,l.highlighted=!1,l.label=``)),l)},edgeReducer:(t,n)=>{let i=e.getGraph(),o={...n,hidden:!0};if(a.size>0){let[e,n]=i.extremities(t);return(a.has(e)||a.has(n))&&(o.hidden=!1,o.color=i.getNodeAttribute(e,`color`)),o}if(s&&i.extremities(t).includes(s)){let e=i.getNodeAttributes(s);o.hidden=!1,o.color=e.color}else if(r){let[e,n]=i.extremities(t),a=i.getNodeAttributes(e),s=i.getNodeAttributes(n);a.cluster===r&&s.cluster===r&&(o.hidden=!1,o.color=a.color)}return o}})},[r,s,a,o,t,e])},dm=e=>{let t=em((0,K.useMemo)(()=>({...e.layout,settings:{barnesHutOptimize:!0,slowDown:8,...e.layout?.settings,gravity:e.layoutSettings.gravity,scalingRatio:e.layoutSettings.scalingRatio,strongGravityMode:e.layoutSettings.strongGravityMode,linLogMode:e.layoutSettings.linLogMode,adjustSizes:e.layoutSettings.adjustSizes,outboundAttractionDistribution:e.layoutSettings.outboundAttractionDistribution}}),[e.layout,e.layoutSettings.adjustSizes,e.layoutSettings.gravity,e.layoutSettings.linLogMode,e.layoutSettings.outboundAttractionDistribution,e.layoutSettings.scalingRatio,e.layoutSettings.strongGravityMode])),n=cm({maxIterations:Math.min(240,Math.max(80,Math.round(e.layoutSettings.iterations/2))),settings:{expansion:1.2,gridSize:40,margin:6,ratio:1.4,speed:2}}),r=lm(e),i=lo(),a=(0,K.useRef)(null),o=(0,K.useRef)(!1),s=(0,K.useRef)(null),c=(0,K.useRef)(0);um();let l=e=>{c.current===e&&n.assign()},u=(n,r)=>{a.current!=null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{c.current===r&&(t.stop(),l(r),a.current=null,e.onBusyChange?.(!1))},n)},d=()=>{c.current+=1,s.current!=null&&(window.cancelAnimationFrame(s.current),s.current=null),a.current!=null&&(window.clearTimeout(a.current),a.current=null),t.stop(),e.onBusyChange?.(!1)};return(0,K.useEffect)(()=>{let n=c.current+1;return c.current=n,s.current=window.requestAnimationFrame(()=>{if(s.current=null,c.current!==n)return;e.onBusyChange?.(!0);let a=r();c.current===n&&(i(a),o.current=!0,t.stop(),t.start(),u(Math.max(900,e.layoutSettings.iterations*12),n))}),()=>{c.current===n&&d()}},[r,t.start,t.stop,i,e.layoutSettings.iterations,e.onBusyChange]),(0,K.useEffect)(()=>{if(o.current)return e.onBusyChange?.(!0),t.stop(),t.start(),u(Math.max(900,e.layoutSettings.iterations*12),c.current),()=>{a.current!=null&&(window.clearTimeout(a.current),a.current=null),t.stop(),e.onBusyChange?.(!1)}},[t.start,t.stop,e.layoutSettings.adjustSizes,e.layoutSettings.gravity,e.layoutSettings.iterations,e.layoutSettings.linLogMode,e.layoutSettings.outboundAttractionDistribution,e.layoutSettings.scalingRatio,e.layoutSettings.strongGravityMode,e.onBusyChange]),(0,K.useEffect)(()=>{e.cancelNonce&&d()},[e.cancelNonce,t.stop,e.onBusyChange]),(0,K.useEffect)(()=>()=>{d(),t.stop(),t.kill()},[t.kill]),null};function fm(e){if(!e.length)return;let t=e.map(e=>e.split(`/`).filter(e=>e&&e!==`src`&&e!==`lib`&&e!==`dist`&&e!==`build`&&!e.includes(`.`))),n=new Map;t.forEach(e=>{e.forEach((e,t)=>{let r=n.get(e)||{count:0,positions:[]};r.count++,r.positions.push(t),n.set(e,r)})});let r=new Set([`apps`,`packages`,`node_modules`,`.pnpm`,`src`,`modules`,`components`,`utils`,`helpers`,`shared`,`common`,`core`,`base`,`types`,`interfaces`,`backend`,`frontend`,`client`,`server`,`api`,`web`]),i={segment:``,score:0};for(let[t,a]of n){if(r.has(t))continue;let n=a.count/e.length,o=a.positions.reduce((e,t)=>e+t,0)/a.positions.length,s=1-(Math.max(...a.positions)-Math.min(...a.positions))/10,c=n*.6+s*.4-o*.1;c>i.score&&n>=.5&&(i={segment:t,score:c})}if(!i.segment){let t=pm(e).split(`/`).filter(e=>e&&!e.includes(`.`));for(let e=t.length-1;e>=0;e--)if(!r.has(t[e])){i.segment=t[e];break}}return i.segment||void 0}function pm(e){if(e.length===0)return``;if(e.length===1)return e[0];let t=e.map(e=>e.split(`/`)),n=Math.min(...t.map(e=>e.length)),r=0;for(let e=0;e<n;e++){let n=t[0][e];if(t.every(t=>t[e]===n))r=e+1;else break}return t[0].slice(0,r).join(`/`)}var mm={allowInvalidContainer:!0},hm=e=>{let[t,n]=(0,K.useState)(null);return(0,Q.jsxs)(ho,{ref:n,className:`relative h-full w-full`,settings:mm,children:[(0,Q.jsx)(dm,{entryNode:e.entryNode,externalGrouping:e.externalGrouping,layoutSettings:e.layoutSettings,packages:e.packages,nodes:e.nodes,cancelNonce:e.cancelNonce,onBusyChange:e.onBusyChange}),e.isBusy?(0,Q.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center bg-white/72 backdrop-blur-[1.5px] dark:bg-slate-950/72`,children:(0,Q.jsxs)(`div`,{className:`pointer-events-auto flex min-w-[18rem] flex-col items-center gap-4 rounded-3xl border border-slate-200/80 bg-white/90 px-6 py-5 shadow-[0_18px_48px_-32px_rgba(15,23,42,0.65)] dark:border-slate-800 dark:bg-slate-950/90`,children:[(0,Q.jsx)(j,{label:`Updating graph…`,description:`Rebuilding the dependency map and running the layout in the background.`,className:`min-h-0`}),e.onCancelUpdate?(0,Q.jsx)(it,{variant:`outline`,size:`sm`,onClick:e.onCancelUpdate,children:`Cancel update`}):null]})}):null,t&&(0,Q.jsx)(gm,{hideClusterLabels:e.layoutSettings.hideClusterLabels,output:e.output,sigma:t,nodes:e.nodes,externalGrouping:e.externalGrouping,entryNode:e.entryNode})]})},gm=e=>{let t=e.sigma,n=ym(t),r=bm(n),i=(0,K.useMemo)(()=>e.nodes.filter(e=>e.path.includes(`node_modules`)).map(e=>e.path),[e.nodes]),a=(0,K.useMemo)(()=>r.filter(e=>e.nodes.length>5),[r]);xm(t,n,e.hideClusterLabels);let o=t.getGraph(),s=o.nodes(),c=e=>{e.length!==0&&Go(t,e,{animate:!0})},u=e=>{c(o.filterNodes((t,n)=>n.cluster===e))};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(go,{position:`bottom-right`,className:`mb-6`,children:[(0,Q.jsx)(Eo,{}),(0,Q.jsx)(No,{})]}),(0,Q.jsx)(go,{position:`top-left`,className:`z-10!`,children:(0,Q.jsxs)(`div`,{className:`flex w-[18rem] flex-col gap-2 p-2 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(_m,{label:`Reset view (${s.length} nodes)`,onClick:()=>c(s),children:(0,Q.jsx)(T,{className:`size-4`})}),e.entryNode?(0,Q.jsx)(_m,{label:`Focus entrypoint`,onClick:()=>c(e.entryNode?[e.entryNode]:[]),children:(0,Q.jsx)(Jo,{className:`size-4`})}):null,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(vm,{clusters:a,onFocusCluster:u})})]}),e.externalGrouping===`package`&&i.length?(0,Q.jsxs)(`button`,{className:`flex items-center gap-2 rounded-md bg-white px-2 py-1 hover:bg-gray-100`,onClick:()=>c(i),children:[`node_modules (`,i.length,`)`]}):null,(0,Q.jsx)(`div`,{className:`max-h-[300px] overflow-auto`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 pr-1`,children:a.map(e=>(0,Q.jsxs)(`button`,{title:e.path,className:`flex items-center gap-2 rounded-md px-2 py-1 text-left hover:bg-gray-100`,onClick:()=>u(e.name),onMouseEnter:()=>{l.set(e.name)},onMouseLeave:()=>{l.set(null)},children:[(0,Q.jsx)(`div`,{className:`w-2 h-2`,style:{backgroundColor:e.color}}),e.inferredName||e.name,`(`,e.nodes.length,`)`]},e.name))})})]})}),(0,Q.jsx)(h,{nodes:e.nodes,onHighlight:t=>{if(!t)return v.set(null);e.nodes.find(e=>e.path===t)&&v.set(t)},onSelect:t=>{if(v.set(null),!t)return g.set(null);e.nodes.find(e=>e.path===t)&&(g.set(t),y.set(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]))}}),(0,Q.jsx)(go,{position:`bottom-left`,children:(0,Q.jsx)(Po,{width:`100px`,height:`100px`})}),(0,Q.jsx)(Fp,{output:e.output})]})};function _m(e){return(0,Q.jsxs)(yt,{children:[(0,Q.jsx)(ft,{asChild:!0,children:(0,Q.jsx)(it,{size:`icon`,variant:`outline`,onClick:e.onClick,"aria-label":e.label,children:e.children})}),(0,Q.jsx)(_t,{children:e.label})]})}function vm(e){let[t,n]=(0,K.useState)(!1);return(0,Q.jsxs)(_,{open:t,onOpenChange:n,children:[(0,Q.jsx)(c,{asChild:!0,children:(0,Q.jsxs)(it,{variant:`outline`,role:`combobox`,"aria-expanded":t,className:`w-full justify-between`,children:[`Jump to cluster`,(0,Q.jsx)(E,{className:`size-4 opacity-50`})]})}),(0,Q.jsx)(f,{className:`w-[20rem] p-0`,align:`start`,children:(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{placeholder:`Search cluster groups...`}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(te,{children:`No cluster found.`}),(0,Q.jsx)(O,{heading:`Cluster groups`,children:e.clusters.map(t=>(0,Q.jsxs)(ee,{value:`${t.inferredName||t.name} ${t.name} ${t.path}`,onMouseEnter:()=>l.set(t.name),onMouseLeave:()=>l.set(null),onSelect:()=>{e.onFocusCluster(t.name),n(!1)},children:[(0,Q.jsx)(`div`,{className:`size-2 rounded-sm`,style:{backgroundColor:t.color}}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:t.inferredName||t.name}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-slate-500`,children:t.nodes.length})]})]},t.name))})]})]})})]})}var ym=e=>{let[t,n]=(0,K.useState)(()=>new Map);return(0,K.useEffect)(()=>{let t=()=>{let t=new Map;t.clear(),e.getGraph().forEachNode((e,n)=>{if(!n.cluster)return;let r=t.get(n.cluster);if(r){r.nodes.push(e),r.positions.push({x:n.x,y:n.y}),r.isExternal=r.isExternal||n.modType===`external`;return}t.set(n.cluster,{name:n.cluster,isExternal:n.modType===`external`,path:n.clusterPath??``,nodes:[e],positions:[{x:n.x,y:n.y}],color:n.color})}),t.forEach(e=>{if(!e.isExternal){let t=fm(e.nodes.map(t=>t.replace(e.path,``)));t&&(e.inferredName=t)}e.x=e.positions.reduce((e,t)=>e+t.x,0)/e.positions.length,e.y=e.positions.reduce((e,t)=>e+t.y,0)/e.positions.length}),n(t)};return e.addListener(`afterProcess`,t),()=>{e.removeListener(`afterProcess`,t)}},[e]),t},bm=e=>(0,K.useMemo)(()=>Array.from(e.entries()).sort((e,t)=>{let n=t[1].nodes.length-e[1].nodes.length;return n===0?e[0].localeCompare(t[0]):n}).map(([e,t])=>t),[e]),xm=(e,t,n)=>{(0,K.useEffect)(()=>{let r=Array.from(t.values()).filter(e=>e.nodes.length>=8).sort((e,t)=>t.nodes.length-e.nodes.length).slice(0,24),i=document.getElementById(`cluster-label-layers`),a=!!i;a||(i=document.createElement(`div`)),i.id=`cluster-label-layers`,i.dataset.hidden=n?`true`:void 0,n?i.dataset.hidden=`true`:delete i.dataset.hidden,i.className=`absolute top-0 left-0 w-full h-full pointer-events-none overflow-hidden data-hidden:hidden`;let o=``;if(r.forEach(t=>{let n=e.graphToViewport(t),r=Up(14,28,10+Math.log2(t.nodes.length)*3);o+=`<div id='${t.name}' class="absolute -translate-1/2 -translate-y-1/2 text-shadow-md font-semibold whitespace-nowrap" style="top:${n.y}px;left:${n.x}px;color:${t.color};font-size:${r}px;background:color-mix(in srgb, white 78%, transparent);padding:2px 8px;border-radius:999px;backdrop-filter:blur(2px);opacity:0.92">${t.inferredName||t.name}</div>`}),i.innerHTML=o,!a){let t=e.getContainer();t.insertBefore(i,t.querySelector(`.sigma-hovers`))}let s=()=>{r.forEach(t=>{let n=document.getElementById(t.name);if(n){let r=e.graphToViewport(t);n.style.top=`${r.y}px`,n.style.left=`${r.x}px`}})};return e.on(`afterRender`,s),()=>{e.off(`afterRender`,s)}},[t,n,e])};export{hm as ModvizSigma};
|